djot
djot copied to clipboard
Cross-references and numbering
LaTeX has a flexible system for creating numbering counters, labels, and cross-references. This can be used with headings, tables, figures, equations, even list items. This is a must for serious academic writing, but it's not easy to see how to create a system that is sufficiently flexible but still natural for plain text writing and easy to use.
Pandoc's example lists offer some of the functionality of these, but only some. It would be better to have a more general solution, rather than implementing example lists here.
Can you please give an example of what you mean by this? I'm familiar with putting an #that-id
in a doc, and then linking to it from elsewhere with a link pointing to #that-id
...
Also, where does "numbering" factor in here?
In LaTeX you can have
\section{My section heading}\label{mysec}
and then at some other point in the document,
See Section \ref{mysec}.
The section will be automatically numbered and the reference will resolve automatically. You can do the same kind of thing for other automatically numbered things, like equations, figures, and tables.
pandoc-crossref provides these capabilities as an add-on to pandoc.
Thanks, John. I found the link to pandoc-crossref.
Although I don't understand your "mysec" example (since you're explicitly naming the reference "mysec" and there doesn't appear to be any numbering or auto-numbering involved), I can see how, if you have a bunch of display-math examples, they would/should be auto-numbered... though I'm not sure how I'd know what number they would be (or what their #id
's would be to link to them).
Nice, I use this all the time in my own notes (mostly in rst but not sphinx nor pandoc) and would often like to write documents with links to sections in the same document, and sometimes with references to sections in other documents. There one would need some kind of name spaces I think, sphinx "extends" rst to add that, but with a global namespace, so documents add anchor labels with unique names for sections that are linked to.