pandoc-crossref demo document

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

For immediate example, see fig. 1

A figure
Figure # 1: A figure

There is also support for code blocks, for example, lsts. 4.1-4.3

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

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

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

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

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

1 Chapter 1. Figures

First figure
Figure # 1.1: First figure
Second figure
Figure # 1.2: Second figure
Third figure
Figure # 1.3: Third figure
Unlabelled image
Subfigure a
a
Subfigure b
b

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

2 Chapter 2. Equations

Display equations are labelled and numbered

Pi(x) = ∑iaixi   (2.1)

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

3 Chapter 3. Tables

Table 3.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 4.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 4.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 4.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   (4.1)

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
1.1. First figure
1.2. Second figure
1.3. Third figure
1.4. Subfigures caption
1.4 (a). Subfigure a
1.4 (b). Subfigure b

5.2 List of Tables

3.1. Table example

5.3 List of Listings

4.1. Listing caption
4.2. Listing caption
4.3. Listing caption

6 Appendix A. Custom labels

6.1 This section will have custom label