pandoc-crossref demo document

This is a demo file for pandoc-crossref. With this filter, you can cross-reference figures (see figs. 2-4), display equations (see eq. 1), tables (see tbl. 1) and sections (secs. 1, 2, 4.1-4.3)

For immediate example, see fig. 1

Figure # 1: A figure
Figure # 1: A figure

There is also support for code blocks, for example, lsts. 1-3

It’s possible to capitalize reference prefixes, like this: Fig. 2.

In case of multiple references, capitalization is determined by first reference. Figs. 2, 3 is capitalized, while figs. 2, 3 is not.

It is also possible to mix different references, like fig. 2, tbl. 1, lsts. 1, 2, figs. 3, 4, which will be grouped in order they are specified. You can even intermix this with regular citations, although it’s not recommended: fig. 2, tbl. 1, [@unprocessedCitation]

You can also have custom chapter reference labels, like sec. AppA.CustLab

Subfigures are supported, see figs. 5, 5 (b)

1 Chapter 1. Figures

Figure # 2: First figure
Figure # 2: First figure
Figure # 3: Second figure
Figure # 3: Second figure
Figure # 4: Third figure
Figure # 4: Third figure
Unlabelled image
Unlabelled image
a
a
b
b

Figure # 5: Subfigures caption. a — Subfigure a, b — Subfigure b

2 Chapter 2. Equations

Display equations are labelled and numbered


Pi(x)=∑iaixi  (1)

Since 0.1.6.0 those can also appear in the middle of paragraph
ax2 + bx2 + c = 0  (2)
like this.

3 Chapter 3. Tables

Table 1: Table example
First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

Table without caption:

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell

4 Chapter 4. Code blocks

There are a couple options for code block labels. Those work only if code block id starts with lst:, e.g. {#lst:label}

4.1 caption attribute

caption attribute will be treated as code block caption. If code block has both id and caption attributes, it will be treated as numbered code block.

Listing 1: Listing caption

main :: IO ()
main = putStrLn "Hello World!"

4.2 Table-style captions

Enabled with codeBlockCaptions metadata option. If code block is immediately adjacent to paragraph, starting with Listing: or :, said paragraph will be treated as code block caption.

Listing 2: Listing caption

main :: IO ()
main = putStrLn "Hello World!"

4.3 Wrapping div

Wrapping code block without label in a div with id lst:... and class, starting with listing, and adding paragraph before code block, but inside div, will treat said paragraph as code block caption.

Listing 3: Listing caption

main :: IO ()
main = putStrLn "Hello World!"

Unnumbered chapter.

This chapter doesn’t change chapter prefix of referenced elements, instead keeping number of previous chapter, e.g.
S(x)=∫x1x2ax + b dx  (3)

5 Chapter 5. Reference lists

It’s also possible to show lists of figures and tables, like this:

5.1 List of Figures

  1. A figure
  2. First figure
  3. Second figure
  4. Third figure
  5. Subfigure a
  6. Subfigure b
  7. Subfigures caption

5.2 List of Tables

  1. Table example

6 List of Listings

  1. Listing caption
  2. Listing caption
  3. Listing caption

7 Appendix A. Custom labels

7.1 This section will have custom label