Citations and cross-references
Link to a theorem, a figure, a section or a printed page in the same document, and what the [@key] citation syntax does today.
A document points at its own parts all the time: "by Lemma 2", "see the figure below", "as in the previous section". In LibreTimes Markdown you do that with an ordinary link to an anchor, a name you give the block you want to point at.
Link to a block in the same document
Give the block an anchor with {#name}, then link to #name:
Theorem (Lagrange). The order of a subgroup divides the order of the group.
By Lagrange's theorem, a group of prime order has no proper subgroups other than the trivial one.
:::theorem[Lagrange]{#lagrange}
The order of a subgroup divides the order of the group.
:::
By [Lagrange's theorem](#lagrange), a group of prime order has no proper
subgroups other than the trivial one.The link takes the reader to the block, and the address of the page with
#lagrange at the end is one others can share.
What can carry an anchor:
| Block | How | Link |
|---|---|---|
| A heading | automatically, from its text: ## Main result | […](#main-result) |
| A statement | on its fence: :::theorem{#lagrange} | […](#lagrange) |
| A figure | on its fence: ::::figure{#fig-orbit} | […](#fig-orbit) |
| Any other block | an attribute line above it: {#key-table} | […](#key-table) |
| A printed page | :pb[412] in a book | […](#p412) |
The rules for a name you choose:
- It starts with a letter, then letters, digits,
-,_,.or:, up to 100 characters. Anything else is dropped and the block gets no anchor. - Use each name once. If two blocks carry the same name, the first one keeps it and links go there.
- A name with a
.or a:in it is written{id="eq-2.1"}, because the short#form stops at a dot. - Pick a name that says what the block is (
#lagrange,#fig-orbit), not where it is (#theorem-3): the number changes when you add a theorem above it, and the name does not have to.
The link text is yours to write. Nothing fills in "Theorem 3" for you, so if
the statement has a printed number, put it in the link text:
[Theorem 3.17](#monotone).
Link to a block in another work
Add the anchor to the other work's address. On the published page, a name
you chose has user-content- in front of it, so that it can never clash with
the page's own parts; a link inside the same document is adjusted for that
automatically, and a link from elsewhere spells it out:
| Anchor | From another document |
|---|---|
A statement, a figure, or a block with {#name} | …/works/<work-id>#user-content-name |
| A heading | …/works/<work-id>#main-result |
| A printed page | …/works/<work-id>#p412 |
A problem's {#p-412} | …/works/<work-id>#p-412 |
Replace <work-id> with the id in the other work's address.
The [@key] syntax
Square brackets with an @ and a key are reserved for citations resolved
against a bibliography and for numbered cross-references:
| Written | Meant for |
|---|---|
[@knuth1974] | a citation |
[@knuth1974, p. 33] | a citation with a page or other locator |
[see @knuth1974] | a citation with text before it |
[-@knuth1974] | a citation without the author's name |
[@knuth1974; @lamport1994] | several citations |
[@fig:setup], [@eq:euler], [@tbl:results] | a cross-reference to a figure, an equation or a table |
Today the published page shows this text exactly as you wrote it. It is not yet replaced with an author and year or with "Figure 2". What the syntax does already is keep your text intact:
[@knuth1974]is never turned into a link to a profile, although a key looks like a mention.- An address such as
ada@example.orgis not a citation, because the character before the@is a letter. - If any part of a bracket does not parse, the whole bracket is left as ordinary text.
Knuth's analysis [@knuth1974, p. 33] covers the general case.
Knuth's analysis [@knuth1974, p. 33] covers the general case.This is the syntax pandoc reads and writes. A LaTeX or Word file
imported on the site does not use
it: its citations arrive as numbered markers such as [1], with the
bibliography as the work's list of references.
Cite a source today
To give a reader a source they can follow, cite it in a footnote with a DOI or an arXiv link:
The bound is known to be tight.1
The bound is known to be tight.[^knuth]
[^knuth]: D. E. Knuth, "Structured programming with go to statements",
*Computing Surveys* 6 (1974). <https://doi.org/10.1145/356635.356640>Footnotes
-
D. E. Knuth, "Structured programming with go to statements", Computing Surveys 6 (1974). https://doi.org/10.1145/356635.356640 ↩