Pandoc Lua filter for cross-references. Faster than the non-Lua alternatives.
In order to reference an element, it must have an Id and be numbered. Sections, figures, tables, and equations are automatically numbered, unless they have the class unnumbered
.
Section and figure Ids are specified as they would normally be in Pandoc's Markdown:
# A section {#sec}
{#fig}
$$
E=mc^2
$${#einstein .class key="val"}
Table: Table caption. {#id .class key=val}
FirstCol SecondCol
---------- -----------
FirstCell SecondCell
The syntax used for cross-referencing items is briefly presented below using a series of examples.
Pandoc's Markdown | Output |
---|---|
See #figid. See #eqid. |
See Fig. 1. See Eqn. (1). |
See [#figid, #figid2, and #figid3]. |
See Figs. 1, 2, and 3. |
See [#figid and #figid2 or #figid3]. |
See Figs. 1 and 2 or 3. |
See [#figid; #figid2; #figid3]. |
See Figs. 1, 2, and 3. |
See [#figid\; #figid2\; #figid3]. |
See Figs. 1; 2; 3. |
See -#figid. |
See 1. |
No particular Id naming convention is assumed - the user is free to use a naming convention like #sec:id
for section Ids, or #fig:id
for figure Ids, but can also choose not to do so. The cross-reference's prefix ("Sec.", "Fig.", "Eqn.", or "Tbl.") is inferred from the type of element that the Id references.
© 2025 R. N. West. Released under the GPL version 2 or greater.