> For the complete documentation index, see [llms.txt](https://help.brieftech.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.brieftech.ai/reference/template-syntax.md).

# Template syntax

BriefTech uses a token-based template syntax to generate volume labels, page stamps, tab labels, file names, PDF bookmarks, and Document Index volume headings automatically. Tokens are written in curly braces and are resolved at generation time. You can combine multiple tokens in a single field.

## Token reference

### Senior grouping identifier

Used in multi-tier bundles (e.g. Records of Appeal) where documents are first grouped into master volumes, then subdivided.

| Token  | Output format          | Example            |
| ------ | ---------------------- | ------------------ |
| `{sR}` | Roman numerals (upper) | I, II, III, IV, V… |
| `{sA}` | Letters (upper)        | A, B, C, D, E…     |
| `{sn}` | Arabic numerals        | 1, 2, 3, 4, 5…     |
| `{sr}` | Roman numerals (lower) | i, ii, iii, iv, v… |
| `{sa}` | Letters (lower)        | a, b, c, d, e…     |

### Junior grouping identifier

Used for the sub-volume within each senior group.

| Token | Output format          | Example            |
| ----- | ---------------------- | ------------------ |
| `{R}` | Roman numerals (upper) | I, II, III, IV, V… |
| `{A}` | Letters (upper)        | A, B, C, D, E…     |
| `{n}` | Arabic numerals        | 1, 2, 3, 4, 5…     |
| `{r}` | Roman numerals (lower) | i, ii, iii, iv, v… |
| `{a}` | Letters (lower)        | a, b, c, d, e…     |

### Bundle volume counter

| Token            | Output                    | Description                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{v}`            | 1, 2, 3…                  | Current volume number within the bundle.                                                                                                                                                                                                                                                                                                                                                                 |
| `{vT}`           | Total count               | Total number of volumes in the bundle. Available in the cover page and file name only. It renders blank in the page stamp and volume header row; in a tab page DOCX template it renders `undefined`, as any unavailable token does there.                                                                                                                                                                |
| `{volumeNumber}` | Volume label, or 1, 2, 3… | What this renders depends on the field. In the **file name** and **cover page** it renders the volume's *label* (and is blank on a single-volume cover); in the **page stamp** it renders the volume number. It is not available in tab page, volume header row, or bookmark title templates. Use `{v}` when you want the volume number — but `{v}` is not available in bookmark title templates either. |

The bundle's total volume count can also be rendered as Roman numerals or letters — **cover page only**:

| Token   | Output                         | Example (4 volumes) |
| ------- | ------------------------------ | ------------------- |
| `{TvR}` | Total volumes, Roman (upper)   | IV                  |
| `{Tvr}` | Total volumes, Roman (lower)   | iv                  |
| `{TvA}` | Total volumes, letters (upper) | D                   |
| `{Tva}` | Total volumes, letters (lower) | d                   |

### Composed volume label

| Token   | Output          | Description                                                                                                                                                                    |
| ------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `{vol}` | I, II(a), 1(2)… | The volume's full label, exactly as produced by the volume-label template. Useful in the file name and page stamp fields so the label always matches the volume-label setting. |

*(Older templates may use `{V}`, an alias of `{vol}`, in the cover page, page stamp and file name. `{V}` is **not** available in the volume header row — use `{vol}` there — or in a tab page template.)*

On the cover page of a single-volume bundle, every token that carries the volume *label* renders as an empty string — `{vol}`, `{V}`, `{volumeString}` and `{volumeNumber}`. This is deliberate: there's no volume label to show. `{v}` still renders the volume number, so use it when you need a number on a single-volume cover.

If you enter a name under **Volume Names Overrides** in Bundle settings, that name replaces the volume-label template's output for that volume:

* **Cover page, page stamp and file names** — `{vol}` renders your override. This includes the Cover and TOC DOCX exports.
* **The Document Index's `Vol` column** — prints your override directly. This column has no template, so there is no `{vol}` to put in it.
* **Document Index volume heading rows** — *not* affected. These always use the volume-label template, so a heading can read `Volume 1` while the `Vol` column beside it shows your override.

Overrides are matched to volumes line by line in order, so you cannot skip a volume. On a single-volume bundle's cover page `{vol}` is still empty, as above.

### Page number

| Token          | Output   | Description                                                                                  |
| -------------- | -------- | -------------------------------------------------------------------------------------------- |
| `{p}`          | 1, 2, 3… | Page number stamped on each applicable page.                                                 |
| `{pageNumber}` | 1, 2, 3… | The page number — this is the token in the default page-stamp template; `{p}` is equivalent. |

### Tab identifier

| Token  | Output format          | Example     |
| ------ | ---------------------- | ----------- |
| `{tn}` | Arabic numerals        | 1, 2, 3…    |
| `{tA}` | Letters (upper)        | A, B, C…    |
| `{ta}` | Letters (lower)        | a, b, c…    |
| `{tR}` | Roman numerals (upper) | I, II, III… |
| `{tr}` | Roman numerals (lower) | i, ii, iii… |

`{tn}` is derived from the document's serial number (its first run of digits), not from the tab's position in the sequence — so tab numbering follows the serial, not a simple 1, 2, 3 count.

### Document metadata

| Token            | Output           | Description                                                                                                                                                                                                                                             |
| ---------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{date}`         | Date string      | The document's date. A full date renders as `yyyy.MM.dd` (e.g. `2026.01.15`); a month-only date as `yyyy.MM`; a date range as `start-end`; and a document with no date as `Undated`. This token does not follow the Document Index date-format setting. |
| `{description}`  | Description text | The document description from the index.                                                                                                                                                                                                                |
| `{fileName}`     | File name        | The source document's file name.                                                                                                                                                                                                                        |
| `{fileSerialNo}` | Serial number    | The source document's file serial number.                                                                                                                                                                                                               |
| `{exref}`        | Serial number    | External reference — the source document's file serial number (the same value as `{fileSerialNo}`).                                                                                                                                                     |

*These document tokens (including `{date}` and `{description}`) are available in **tab page** templates only.*

Note: inside a **tab page** template, `{n}` resolves to the document's serial number, not the junior-volume number.

### Conditional display block

| Syntax        | Behaviour                                                                                                                                                                                                                                                                                                                                                                                                       |
| ------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{#j} … {/j}` | Renders the content between the tags only when the matter uses Senior Volume categories **and** more than one junior volume exists within the senior group. If Senior Volumes categories are off (the default), or there is only one junior volume, the block — including the tags themselves — is suppressed. So the jurisdiction examples below that use `{#j}` apply to matters with Senior Volumes enabled. |

Use this to avoid redundant sub-labels when a senior group contains a single volume. For example, `{sR}{#j}({A}){/j}` produces `I` for a single-volume group and `I(A)`, `I(B)` when there are multiple.

### Contextual (file name only)

| Token              | Output          | Description                                              |
| ------------------ | --------------- | -------------------------------------------------------- |
| `{workspaceName}`  | Matter name     | The name of the matter the bundle is generated in.       |
| `{collectionName}` | Collection name | The name of the collection the bundle is generated from. |
| `{today}`          | 2026-01-15      | The generation date, in `YYYY-MM-DD` form.               |

These three tokens are available in the **file name** field only.

***

## Common combinations

The page stamp and file name are text fields you type these into directly. The cover page and tab page are DOCX templates you upload — put the syntax inside the DOCX file you upload for each. You'll find the page stamp under **Pagination → Page Number Settings** in Bundle settings, where the field is labelled **Page Number Template**; the file name under **Filename on Export** in **Volumes Settings**; and the volume-label template in the same **Volumes Settings** section, labelled **Volume column template**.

In a cover page or tab page DOCX template, a token that isn't available in that context renders as the literal word `undefined` rather than as blank — so check which tokens each field accepts before putting one in a DOCX template. The page stamp, file name, bookmark title and volume header row are rendered differently and leave an unavailable token blank.

### Cover page

| Output example                                             | Syntax                                  |
| ---------------------------------------------------------- | --------------------------------------- |
| Volume 1, Volume 2, Volume 3…                              | `Volume {v}`                            |
| Volume A, Volume B, Volume C…                              | `Volume {A}`                            |
| Volume I(A), Volume I(B), Volume II(A)… *(SG ROA)*         | `Volume {sR}{#j}({A}){/j}`              |
| PART A(1), PART A(2), PART B… *(SG ROA)*                   | `PART {sA}{#j}({n}){/j}`                |
| BAHAGIAN A JILID 1(1), BAHAGIAN B JILID 2(1)… *(MY Civil)* | `BAHAGIAN {sA} {#j}JILID {sn}({n}){/j}` |
| PART A VOLUME 1(1), PART B VOLUME 2(1)… *(MY Civil)*       | `PART {sA} {#j}VOLUME {sn}({n}){/j}`    |
| JILID 1(1), JILID 1(2), JILID 1(3)… *(MY Civil)*           | `JILID {sn}({n})`                       |
| JILID 1(a), JILID 1(b), JILID 2(a)… *(MY Criminal)*        | `JILID {sn}{#j}({a}){/j}`               |
| JILID 1(A), JILID 1(B), JILID 2(A)… *(MY Criminal)*        | `JILID {sn}{#j}({A}){/j}`               |

### Volume counter (for cover page)

| Output example                    | Syntax                |
| --------------------------------- | --------------------- |
| (1 out of 35), (2 out of 35)…     | `({v} out of {vT})`   |
| (1 daripada 35), (2 daripada 35)… | `({v} daripada {vT})` |

### Tab page

| Output example                                           | Syntax                 |
| -------------------------------------------------------- | ---------------------- |
| TAB 1, TAB 2, TAB 3…                                     | `TAB {tn}`             |
| TAB A, TAB B, TAB C…                                     | `TAB {tA}`             |
| TAB a, TAB b, TAB c…                                     | `TAB {ta}`             |
| TAB I, TAB II, TAB III…                                  | `TAB {tR}`             |
| CVC-1, CVC-2, CVC-3… *(Certificate Verifying Affidavit)* | `<your initials>-{tn}` |

### Page stamp

| Output example                    | Syntax                     | Use case            |
| --------------------------------- | -------------------------- | ------------------- |
| 1, 2, 3…                          | `{p}`                      | Simple page number  |
| I(A)-1, I(A)-2, I(B)-1…           | `{sR}{#j}({A}){/j}-{p}`    | SG ROA              |
| I RA 1, I RA 2, II RA 1…          | `{sR} RA {p}`              | SG ROA              |
| I(A) RA 1, I(B) RA 1, II(A) RA 1… | `{sR}{#j}({A}){/j} RA {p}` | SG ROA              |
| 1(1)-1, 1(2)-1, 2(1)-1…           | `{sn}{#j}({n}){/j}-{p}`    | MY Civil Appeals    |
| Vol 1-1, Vol 1-2, Vol 2-1…        | `Vol {n}-{p}`              | Bundle of Documents |

### File name

| Output example                              | Syntax                                 | Use case              |
| ------------------------------------------- | -------------------------------------- | --------------------- |
| ROA Vol I(A), ROA Vol I(B), ROA Vol II(A)…  | `ROA Vol {sR}{#j}({A}){/j}`            | SG ROA                |
| ROA Bhg A Jilid 1(1), ROA Bhg B Jilid 2(1)… | `ROA Bhg {sA} {#j}Jilid {sn}({n}){/j}` | MY ROA                |
| BOA Vol 1, BOA Vol 2, BOA Vol 3…            | `BOA Vol {n}`                          | Bundle of Authorities |
| BOD Vol 1, BOD Vol 2, BOD Vol 3…            | `BOD Vol {n}`                          | Bundle of Documents   |

BriefTech cleans up the generated file name: any characters that aren't allowed in a file name (`\ / : * ? " < > |`) are replaced with a space, the name is capped at 120 characters, and if the template produces an empty name it falls back to `Vol` followed by the volume's label (or its number, if the label is empty).

***

## Examples by jurisdiction

### Singapore — Records of Appeal

**Cover page**

| Field                                                       | Value                                                                                                        |
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Syntax                                                      | <p><code>RECORDS OF APPEAL</code><br><code>VOLUME {sR}{#j}({A}){/j}</code><br><code>({v} of {vT})</code></p> |
| Rendered (volume 8 of 35, senior group III, junior group B) | <p><code>RECORDS OF APPEAL</code><br><code>VOLUME III(B)</code><br><code>(8 of 35)</code></p>                |

**Page stamp**

| Field    | Value                                                      |
| -------- | ---------------------------------------------------------- |
| Syntax   | `{sR}{#j}({A}){/j}-{p}`                                    |
| Rendered | I(A)-1, I(A)-2, I(A)-3… then I(B)-1, I(B)-2… then II(A)-1… |

**File name**

| Field    | Value                                                     |
| -------- | --------------------------------------------------------- |
| Syntax   | `ROA Vol {sR}{#j}({A}){/j}`                               |
| Rendered | ROA Vol I(A), ROA Vol I(B), ROA Vol II(A), ROA Vol II(B)… |

***

### Singapore — Bundle of Authorities

**Cover page**

| Field                     | Value                                                                                    |
| ------------------------- | ---------------------------------------------------------------------------------------- |
| Syntax                    | <p><code>PLAINTIFF'S BUNDLE OF AUTHORITIES</code><br><code>VOLUME {v} of {vT}</code></p> |
| Rendered (volume 8 of 50) | <p><code>PLAINTIFF'S BUNDLE OF AUTHORITIES</code><br><code>VOLUME 8 of 50</code></p>     |

**Tab page**

| Field    | Value      |
| -------- | ---------- |
| Syntax   | `TAB {tn}` |
| Rendered | TAB 8      |

**Affidavit exhibit label**

Paste this into the Certificate Verifying Affidavit template, which you upload under **Upload Tab / Page Separators Template** in Bundle settings:

| Field                   | Value                    |
| ----------------------- | ------------------------ |
| Syntax                  | `<your initials> – {tn}` |
| Rendered (initials CVC) | CVC – 8                  |

***

### Malaysia — Records of Appeal (Civil)

**Cover page**

| Field                                                                                          | Value                                                                                  |
| ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| Syntax                                                                                         | <p><code>REKOD RAYUAN</code><br><code>BAHAGIAN {sA} {#j}JILID {sn}({n}){/j}</code></p> |
| Rendered (senior group B, junior volume 3 — the `2` and `3` are the senior and junior numbers) | <p><code>REKOD RAYUAN</code><br><code>BAHAGIAN B JILID 2(3)</code></p>                 |

**Page stamp**

| Field    | Value                                             |
| -------- | ------------------------------------------------- |
| Syntax   | `{sn}{#j}({n}){/j}-{p}`                           |
| Rendered | 1(1)-1, 1(1)-2… then 1(2)-1, 1(2)-2… then 2(1)-1… |

***

### Malaysia — Records of Appeal (Criminal)

**Cover page**

| Field                                           | Value                                                                    |
| ----------------------------------------------- | ------------------------------------------------------------------------ |
| Syntax                                          | <p><code>REKOD RAYUAN</code><br><code>JILID {sn}{#j}({a}){/j}</code></p> |
| Rendered (senior volume 2, junior sub-volume b) | <p><code>REKOD RAYUAN</code><br><code>JILID 2(b)</code></p>              |

***

### Malaysia — Bundle of Authorities

The cover page and tab page templates are the same as the Singapore Bundle of Authorities section above.

**Affidavit exhibit label**

| Field                   | Value                    |
| ----------------------- | ------------------------ |
| Syntax                  | `<your initials> - {tn}` |
| Rendered (initials CVC) | CVC - 8                  |

***

## Bookmark title template

Bundles are generated with a PDF bookmark (outline entry) for each document. The Bookmark Title Template field — under Bundle settings, in the Bookmarks section — controls the text of each bookmark. It uses its own small set of document tokens, separate from the volume/page tokens above.

Default: `{tab} - {summary}{partSuffix}`

| Token          | Output example        | Description                                                                                  |
| -------------- | --------------------- | -------------------------------------------------------------------------------------------- |
| `{tab}`        | A-1                   | The document's tab / file serial label.                                                      |
| `{summary}`    | Sample Document Title | The document's summary (first line, as plain text).                                          |
| `{partSuffix}` | `(Part 1 of 3)`       | Added only when a document is split across volumes; blank otherwise. Note the leading space. |

**Common combinations**

| Output example                                        | Syntax                              |
| ----------------------------------------------------- | ----------------------------------- |
| A-1 - Sample Document Title                           | `{tab} - {summary}{partSuffix}`     |
| TAB A-1 - Sample Document Title                       | `TAB {tab} - {summary}{partSuffix}` |
| A-1. Sample Document Title                            | `{tab}. {summary}{partSuffix}`      |
| B-2 - Large Document (Part 1 of 3) *(split document)* | `{tab} - {summary}{partSuffix}`     |

The bookmark title must not resolve to an empty string. If a template produces a blank title for a document (for example, an empty template, or one that references only tokens with no value), bundle generation stops with an error rather than adding an untitled bookmark.

***

## Volume header row template

In the Document Index (the Index tab), when a collection is grouped into volumes, a heading row is shown above each volume and sub-volume group. Two templates control the text of those heading rows:

* Senior Volume Header Template — the heading above each senior (top-level) volume group. Stored as `lodSeniorVolumeHeaderRowTemplate`.
* Junior Volume Header Template — the heading above each sub-volume. Stored as `lodVolumeHeaderRowTemplate`.

Both are edited from the Document Index:

| Template                      | How to edit                                                                              | Availability                                                                |
| ----------------------------- | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
| Senior Volume Header Template | Row menu's "Edit Volume" item, or double-click the heading text, on a volume heading row | Only available when senior volume categories are enabled for the collection |
| Junior Volume Header Template | "Edit subvolume" control on a sub-volume heading row                                     | Always available                                                            |

Default (both templates): `Volume {vol}` — which renders as `Volume 1`, `Volume 2` out of the box. `{vol}` follows the volume-label template, so it only shows Roman numerals or letters (e.g. `Volume I`, `Volume II(a)`) once you set that template. If the Senior template is left blank it falls back to the Junior template; if both are blank the default `Volume {vol}` is used.

### Tokens

These templates reuse tokens already documented in the [Token reference](#token-reference) above:

* the **senior grouping identifiers** (`{sR}`, `{sA}`, `{sn}`, `{sr}`, `{sa}`) and **junior grouping identifiers** (`{R}`, `{A}`, `{n}`, `{r}`, `{a}`),
* the `{v}` volume counter,
* the `{#j} … {/j}` conditional block, and
* the `{vol}` composed volume label — the volume's fully-rendered label (for example `I`, `II(a)`, `1(2)`), exactly as produced by the volume-label template. `Volume {vol}` is the default for both header templates.

Additional notes:

* Use the common and senior tokens in the **Senior** template; the **Junior** template also uses the junior tokens. (Junior tokens are technically resolvable in a Senior template but have no meaningful value there.)
* `{sN}` and `{N}` are digit forms of the senior and junior numbers, equivalent to `{sn}` and `{n}` respectively.
* The junior template also accepts explicit junior variants `{jA}`, `{ja}`, `{jN}`, `{jn}`, `{jR}`, `{jr}`, which behave the same as their unprefixed forms.

### Common combinations

**Senior Volume Header Template**

| Output example                                 | Syntax          |
| ---------------------------------------------- | --------------- |
| VOLUME I, VOLUME II, VOLUME III… *(SG ROA)*    | `VOLUME {sR}`   |
| BAHAGIAN A, BAHAGIAN B, BAHAGIAN C… *(MY ROA)* | `BAHAGIAN {sA}` |
| 1, 2, 3…                                       | `{sN}`          |
| A, B, C…                                       | `{sA}`          |
| I, II, III…                                    | `{sR}`          |

**Junior Volume Header Template**

| Output example                                                 | Syntax                                  |
| -------------------------------------------------------------- | --------------------------------------- |
| 1, 2, 3…                                                       | `{N}`                                   |
| Volume I(A), Volume I(B), Volume II(A)… *(SG ROA)*             | `Volume {sR}{#j}({A}){/j}`              |
| Volume I(a), Volume I(b), Volume II(a)… *(SG ROA, small caps)* | `Volume {sR}{#j}({a}){/j}`              |
| Bahagian A Jilid 1(1), Bahagian A Jilid 1(2)… *(MY ROA)*       | `Bahagian {sA} {#j}Jilid {sn}({n}){/j}` |
| A, B, C…                                                       | `{A}`                                   |
| I, II, III…                                                    | `{R}`                                   |

## Related

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Court bundle settings</strong></td><td>Configure cover pages, separators, and pagination.</td><td><a href="/pages/edPkESM3ksGgGUtgylqQ">/pages/edPkESM3ksGgGUtgylqQ</a></td></tr><tr><td><strong>Serial numbers and date formats</strong></td><td>Numbering and date-token reference.</td><td><a href="/pages/KN2LgxNA7iMxtRv0vVU2">/pages/KN2LgxNA7iMxtRv0vVU2</a></td></tr><tr><td><strong>Generate a paginated court bundle</strong></td><td>Generate a paginated court bundle.</td><td><a href="/pages/S1SOsoreySW80VYcLo3F">/pages/S1SOsoreySW80VYcLo3F</a></td></tr><tr><td><strong>From Document Index to court bundle</strong></td><td>How the Document Index drives bundle generation.</td><td><a href="/pages/7lW88GmSGYo70LiS8Ds7">/pages/7lW88GmSGYo70LiS8Ds7</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.brieftech.ai/reference/template-syntax.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
