djot icon indicating copy to clipboard operation
djot copied to clipboard

Cross-references and numbering

Open jgm opened this issue 2 years ago • 9 comments

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.

jgm avatar Jul 31 '22 17:07 jgm

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.

jgm avatar Jul 31 '22 17:07 jgm

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?

uvtc avatar Aug 01 '22 01:08 uvtc

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.

jgm avatar Aug 01 '22 02:08 jgm

pandoc-crossref provides these capabilities as an add-on to pandoc.

jgm avatar Aug 01 '22 02:08 jgm

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).

uvtc avatar Aug 01 '22 03:08 uvtc

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.

stagnation avatar Sep 12 '23 14:09 stagnation