-
-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-references and numbering #30
Comments
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 Also, where does "numbering" factor in here? |
In LaTeX you can have
and then at some other point in the document,
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 |
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. |
I just stumbled across djot as I've been implementing my own sortof-markdownish-thing for writing essays to publish online, for which I've been trying to implement three things missing in markdown which I miss from LaTeX:
So, since this issue is about references, @jgm are you intending to work this into djot or is there more discussion to be had? I came up with the same syntax as you for footnotes Reference anchors, in my design, were part of the blocks, so:
And I limited the types of reference to sections, citations, figures, tables, and (code-)listings, which I know is restrictive but it prevented me from having to use a convention that I used in my LaTeX docs of Anyway, the above is just stuff I tried but I'd be interested in trying to get citations and references into djot (and djoths) because I think I'd rather use your implementation for my website than have to solve all the problems you've already solved building my own markup language. Is there something I can do? |
At this point we're still at the design phase, figuring out what syntax for citations and references should be. Implementing the decisions will be relatively straightforward. |
FWIW, regarding cross-references, in my workflows with either Markdown or Djot inputs, I went for "filtering" empty links (i.e. without link text)1:
The syntax is not that friendly, but has the advantage of remaining somehow readable (and avoiding low-level syntax extensions, being entirely done via a filter and/or by the renderer itself, which is responsible anyway for tracking the underlying counters2). Footnotes |
Cross-references and auto-numbering are very important to my writing. Indeed, if djot supports these features natively, I would consider switching to djot instead of Pandoc Markdown, which I believe doesn’t support auto-numbering and cross-references natively at this time. For syntax, I personally prefer those by pandoc-crossref and Quarto. They're very similar. Here are examples of numbering images and referencing them: ## pandoc-crossref syntax
![Caption](file.ext){#fig:label}
See @fig:label for an illustration.
## quarto syntax
![Caption](file.ext){#fig-label}
See @fig-label for an illustration. Quarto also supports auto-numbering and cross-referencing for call-out and theorem environments, which could be useful. I did not use it, but quarto also allows defining new types of cross references: docs Other remarks on syntax
Cross-references and hyperlinksI think this issue is mainly about auto-numbering and referring to the correct number. In implementation, one may consider also supporting hyperlinks (at least for HTML and PDF outputs), without requiring extra syntax from users.
Other syntax optionsMyST has the following syntax (docs) $$
y = x^2
$$ (mymath)
The equation {eq}`mymath` is quadratic. Asciidoctor supports counters (docs). But it seems not support cross-ref (i do not use asciidoc myself) |
LaTeX allows quite a bit of flexibility in its counters. For example, you might want the figures to be numbered after the section or chapter, e.g. Figure 3.2. I think this kind of configurability would be necessary for a really workable solution. |
That's a renderer styling issue no? (For different current document languages and usages, independent from the Djot syntax) |
@Omikhleia I agree. In the previous post, I am (mostly) expressing my desire for this feature and thought-streaming. My main point is that "Cross-references and Numbering" may be solved by introducing some "counter attribute" and allow pandoc users "cite" ( |
@jgm I agree that flexibility is essential (particularly for pdf books). I think the djot/pandoc parser can accurately infer the header/section counters for figures? I'm mostly a LaTeX user. I think a LaTeX-like \pageref{} command can be challenging for djot. For other edge cases, I'm open to manually specifying the "counter dependency." Eg, for "Figure 3.2", I could tell djot the section label for that figure. |
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.
The text was updated successfully, but these errors were encountered: