Comments (5)
Hi, @dbobak. Thanks for this excellent suggestion. I have been thinking on it for a few days. LaTeX supports "clever referencing" through the cleveref
package. To implement it for other output formats I just need to work out what cleveref
is doing.
The question is how to best enable this behaviour.
It seems reasonable to add a metadata field to signal clever referencing; e.g., -M cref
in the call to pandoc. It is probably also necessary to have control on a per-reference class basis; e.g., -M eqnos-cref
. Each of these could be optionally set to on
or off
.
As you have pointed out, there needs to be some way to turn off clever referencing. The use case is markdown text like @fig:one and @fig:two
that would be transformed to "Figure 1 and Figure 2". We need to turn off clever referencing in order to manually generate the text "Figures 1 and 2". (Note: I know the cleveref
package support grouping references, but I don't presently have a markdown spec that describes such behaviour. Let's take it one step at a time.)
Using markdown like -@fig:one
to disable clever referencing is well outside of the syntax developed in Pandoc Issue #813. It doesn't seem likely to me that pandoc would adopt it. Perhaps we can come up with something better.
Pandoc is increasingly using attributes. Can we use them instead? e.g., something like @fig:one{cref=off}
. It isn't quite as economical, but it is more consistent with pandoc's direction and the meaning is clear.
Thoughts?
from pandoc-fignos.
I created a new cleveref
branch that has this feature working for tex/pdf output. There is still some tuning to do, more coding for the other formats, and documentation to write. But it won't be long.
Feedback on the proposed syntax is definitely welcome.
from pandoc-fignos.
I was wrong about the -@fig:one
syntax. Pandoc does use something similar for citation processing. We can use it too.
This enhancement is still in progress. I'm doing a pretty major refactoring to allow for the same behaviour in pandoc-eqnos and pandoc-tablenos.
from pandoc-fignos.
@tomduck, thanks for taking my idea under consideration :) The "clever referencing" feature looks very promising!
Thank you! :)
from pandoc-fignos.
I just posted new releases of pandoc-fignos/eqnos/tablenos that have clever referencing. The syntax is close to what you suggested. Unfortunately, I couldn't use the minus sign to disable clever referencing because pandoc silently drops minus signs in front of references. There is nothing that I can do to work around this flaw. An exclamation point is used to disable clever referencing instead.
As part of this release, I pulled common code out of the three projects and created the pandoc-xnos library. This should make maintenance and further development easier.
In any case, enjoy!
from pandoc-fignos.
Related Issues (20)
- Auto-generated caption names want to be bold, when converting from markdown to word.
- Installation of Fignos for windows
- Error producing PDF related to no-prefix-figure-caption HOT 1
- Changing figure caption name with babel in LaTeX
- RuntimeError: Cannot understand pandocversion=3.0.1 HOT 9
- No caption numbers in docx output HOT 4
- "Bad reference" - syntax doesn't work on recent pandoc releases HOT 1
- TypeError in pandocxnos.core.process_refs with Pandoc 2.11 HOT 4
- Pandoc HTML5 Video, Media Fragments HOT 3
- Please clarify documentation for `pandoc-fignos` and `pandoc-eqnos` when a pandoc defaults file is used
- ! LaTeX Error: Environment fignos:no-prefix-figure-caption undefined. HOT 3
- Feature Request: new caption separator for respecting some language typo rules
- Label and sizing HOT 3
- Error when filtering with 'python -m pandoc_fignos json'
- Hardwire figure numbers in LaTeX
- Using a figure caption as referenced label
- Feature Request: `--fail-if-warnings`
- Issues when converting "*.tex" to "*.html"
- \theHfigure undefined
- Figure reference links on epub files are wrong HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandoc-fignos.