Giter VIP home page Giter VIP logo

Comments (5)

tomduck avatar tomduck commented on August 21, 2024

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.

tomduck avatar tomduck commented on August 21, 2024

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.

tomduck avatar tomduck commented on August 21, 2024

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.

dbobak avatar dbobak commented on August 21, 2024

@tomduck, thanks for taking my idea under consideration :) The "clever referencing" feature looks very promising!

Thank you! :)

from pandoc-fignos.

tomduck avatar tomduck commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.