Skip to content

Numbering

Giorgio Garofalo edited this page Dec 11, 2024 · 21 revisions

The .numbering function sets the global numbering format of the document. When a numbering format is set, counters are displayed in:

The configuration is represented by a Dictionary:

.numbering
  - headings: <format>
  - figures: <format>
  - tables: <format>

If a key is missing, its numbering is disabled.

Each format parameter accepts either none or a string where each character represents either a counter or a fixed symbol:

  • 1 for decimal (1, 2, 3, ...)
  • a for lowercase latin alphabet (a, b, c, ...)
  • A for uppercase latin alphabet (A, B, C, ...)
  • i for lowercase roman numerals (i, ii, iii, ...)
  • I for uppercase roman numerals (I, II, III, ...)
  • Any other character is a fixed symbol

The default numbering format, if unspecified, is:

  • For paged documents (can be disabled via .nonumbering):

    • 1.1.1 for headings;
    • 1.1 for figures and tables.
  • None for other documents

Headings

.numbering
  - headings: 1.A.a

# Title    <!--   1   -->
## Title   <!--  1.A  -->
### Title  <!-- 1.A.a -->
### Title  <!-- 1.A.b -->
#### Title <!-- None  -->
## Title   <!--  1.B  -->
# Title    <!--   2   -->
## Title   <!--  2.A  -->
Latex theme numbering Latex theme table of contents

Decorative headings

To prevent a heading from being numbered, append a ! after the last # sign. For example #!, ##!, ###!, etc.

.center
    #! My document

# Introduction

.loremipsum
image

 

Figures

Figures are numbered only if they feature a caption, which may also be empty.

.numbering
  - headings: 1.A.a
  - figures: 1.1

# Title

![Logo](quarkdown-icon.svg "The Quarkdown icon")

## Title

![Logo](quarkdown-icon.svg "")

# Title

![Logo](quarkdown-icon.svg "")
Figure numbering with format 1.1

 

When numbering figures and tables, the amount of symbols in the format dictates the rules which cause the counters to reset.
The previous example, run with figures:{1}, results in the following:

Figure numbering with format 1

Tables

Tables are numbered only if they feature a caption, which may also be empty.

.numbering
  - headings: 1.A.a
  - tables: 1.1

# Title

|           | Age | Favorite food |
|-----------|-----|---------------|
| **Anne**  | 24  | Hamburger     |
| **Lucas** | 19  | Pizza         |
| **Joe**   | 32  | Sushi         |
"Study results."

## Title

|           | Age | Favorite food |
|-----------|-----|---------------|
| **Anne**  | 24  | Hamburger     |
| **Lucas** | 19  | Pizza         |
| **Joe**   | 32  | Sushi         |
""

# Title

|           | Age | Favorite food |
|-----------|-----|---------------|
| **Anne**  | 24  | Hamburger     |
| **Lucas** | 19  | Pizza         |
| **Joe**   | 32  | Sushi         |
""
Table numbering

 

Custom numbered elements

Along with built-in numerable elements we just discussed, Quarkdown additionally allows any element to be numbered if wrapped in a .numbered block.

The function accepts two arguments:

  1. A key string. The number of the element is counted across previous occurrences with the same key;
  2. A lambda block which takes the number as an argument, formatted according to the active numbering format.
.numbered {greetings}
  number:
  **Hello!** This block has the number **.number**

Executing the previous block will render an empty string in place of number. That's because we need to specify the numbering format for greetings in the .numbering call:

.numbering
  ...
  - greetings: 1.a

Full example:

.numbering
    - headings: 1.1
    - greetings: 1.a

# Title 1

.numbered {greetings}
    number:
    **Hello!** This block has the number **.number**

.numbered {greetings}
    number:
    **Hey!** This has instead the number **.number**

# Title 2

.numbered {greetings}
    number:
    **Hi!** Here we have the number **.number**
Custom numbering

 

Localization

The localized name of the labeled element appear in captions if .doclang is set and the locale is supported.
For instance Figure and Table for the English locale, Figura and Tabella for Italian.

 

Themes

Layout themes affect the way numbers are displayed:

Minimal headings numbering Minimal ToC numbering

minimal theme

Clone this wiki locally