Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
7c4c84f
claude: Remove duplicate engine-shared.ts
gordonwoodhull Dec 30, 2025
89e7412
[deps] Pandoc 3.7.0.2
cscheid Aug 20, 2025
8c4c46b
Pandoc binary dep -> 3.8.3
cscheid Dec 13, 2025
71215c9
typst -> 0.14.2
cscheid Dec 13, 2025
adb349d
inset is raw typst inline
gordonwoodhull Dec 14, 2025
dc013b1
typst template: import highlighting-definitions
gordonwoodhull Dec 17, 2025
8ad4c6f
pull template changes from jgm/pandoc/#11201
cscheid Dec 18, 2025
79b4cc1
quarto check
cscheid Dec 18, 2025
1ef1504
claude: Add test for sidebar auto-generation with ipynb index
gordonwoodhull Dec 15, 2025
d100a04
claude: Merge Pandoc typst template features into Quarto
gordonwoodhull Dec 17, 2025
f68a91d
Merge branch 'main' into deps/pandoc-2025-08
cderv Jan 6, 2026
09c3e22
pandoc update - update list of known extensions for pandoc
cderv Jan 6, 2026
3d826dd
pandoc, template - Update for beamer format
cderv Jan 6, 2026
6de156f
pandoc, template, latex- New none counter
cderv Jan 6, 2026
4e98273
pandoc, template, latex - new shorthands handling for babel with LuaTeX
cderv Jan 6, 2026
c811899
pandoc, template, latex - new RTL support for LuaTeX
cderv Jan 6, 2026
3a5f35b
pandoc, template, latex - 'cancel` package is now required for \cance…
cderv Jan 6, 2026
63ac403
pandoc, template, latex - Support for `pdf-trailer-id`
cderv Jan 6, 2026
58195c1
pandoc, template, latex - fix for empty toccolor
cderv Jan 6, 2026
ab7aca5
pandoc, template, revealjs - Scrollview option are in pandoc template…
cderv Jan 6, 2026
961363a
pandoc, template, html - new header on CSS part coming from pandoc
cderv Jan 6, 2026
72452ee
pandoc, format extensions - Don't use yet new table_attributes extension
cderv Jan 6, 2026
f33f44f
tests - update tex snapshot to add counter for unnumbered tables
cderv Jan 6, 2026
064828d
update new typst version in check commands
cderv Jan 6, 2026
7535d71
test, typst, highlighting - defaults for typst is now to use Skylighting
cderv Jan 6, 2026
c9cfe4c
remove accidental checkin of .quarto directory
gordonwoodhull Jan 6, 2026
ea1ccd0
tests, snapshot - improve diff output for snapshot comparison failures
cderv Jan 7, 2026
d5d9d31
chore - update some files
cderv Jan 7, 2026
ddcf969
pandoc, docx - update test snapshot as this is only id changes
cderv Jan 7, 2026
5fcbb59
tests, smoke-all - add skip field and skip docusaurus equations test
cderv Jan 8, 2026
ee3f232
pandoc, format extensions - Check extension support before disabling
cderv Jan 8, 2026
c5d6e82
claude: Fix typst two-column layout to use set page(columns:)
gordonwoodhull Jan 8, 2026
e40138e
tests, smoke-all - add skip field and skip docusaurus equations test
cderv Jan 8, 2026
c2bef9d
pandoc 3.8+, latex - Strip LTcaptype definition for captioned longtables
cderv Jan 9, 2026
f78207f
add verify step to the tests
cderv Jan 9, 2026
8bd7018
tests, feature-format-matrix - skip docusaurus math test pending Pand…
cderv Jan 9, 2026
1edf415
pandoc 3.8+, highlight-style - Use "none" string instead of null
cderv Jan 12, 2026
bdcec01
tests - Remove duplicated YAML in test file
cderv Jan 13, 2026
bca6583
lua-types - Add Pandoc 3.8 API additions (normalize, subscript, super…
cderv Jan 13, 2026
c95e21c
chore - remove checkbox in checklist
cderv Jan 13, 2026
45c47a1
dev-doc - add a doc about LaTeX template like the typst one
cderv Jan 13, 2026
1ac9852
pandoc, latex - Add new shorthand template variable
cderv Jan 13, 2026
8b7e13e
dev-call - build artifacts
cderv Jan 13, 2026
2a14bc1
tests - document skip field and snapshot testing in README
cderv Jan 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions configuration
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
# but it also used when packaging (e.g. run configure.sh, then prepare-dist.sh, then package.sh)
# deno_dom should match release at https://github.com/b-fuze/deno-dom/releases

# NB: When these are updated, you must also update the versions
# IMPORTANT: When these are updated, you must also update the versions
# in src/command/check/check.ts

# Binary dependencies
export DENO=v2.4.5
# TODO figure out where 0.1.41 apple silicon libs are available
export DENO_DOM=v0.1.41-alpha-artifacts
export PANDOC=3.6.3
export PANDOC=3.8.3
export DARTSASS=1.87.0
export ESBUILD=0.25.10
export TYPST=0.13.0
export TYPST=0.14.2


# NB: we can't put comments in the same line as export statements because it
Expand Down
2 changes: 2 additions & 0 deletions dev-docs/feature-format-matrix/qmd-files/math/document.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format:
html: default
_quarto:
tests:
run:
skip: "Pandoc 3.7+ removes newlines in display math blocks (fixed in pandoc@8123be6, awaiting release)"
html:
ensureHtmlElements:
- []
Expand Down
19 changes: 19 additions & 0 deletions dev-docs/update-pandoc-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ Carlos needs to run this:
- [ ] Run `AWS_PROFILE=... ./package/src/quarto-bld update-pandoc PANDOC_VERSION`
- [ ] look at `git diff`, specifically for changes in Pandoc templates, and adjust as needed.

As a reminder, our templates are kept in the same directories as Pandoc's templates, but with different names. `git diff` will show the diff in Pandoc's template; we have to manually patch
ours. (We can't just use `patch` because the templates have diverged too much)

### Pandoc templates

The general rule for the naming is that "format.template" indicates Pandoc naming, and "template.format" indicates ours. Examples below:

#### beamer

- Pandoc's: src/resources/formats/beamer/pandoc/beamer.template
- Ours: src/resources/formats/beamer/pandoc/template.tex

Partials:

- Pandoc's:
- src/resources/formats/beamer/pandoc/latex.common
- Ours:
- src/resources/formats/beamer/pandoc/common.latex

## Manual steps

- [ ] Update schemas by inspecting [their changelog](https://github.com/jgm/pandoc/blob/main/changelog.md) for new commands, deprecation removals, etc
Expand Down
287 changes: 287 additions & 0 deletions llm-docs/pandoc-quarto-latex-templates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
# Pandoc and Quarto LaTeX Templates

This document describes how Quarto integrates Pandoc's LaTeX templates and transforms them into a modular structure suitable for Quarto's extended functionality.

## 1. How Pandoc Templates Are Copied into Quarto

The `writePandocTemplates` function in `package/src/common/update-pandoc.ts` handles copying Pandoc's templates into Quarto's resources during the Pandoc update process.

### Source and Destination

- **Source**: Pandoc templates are downloaded from the Pandoc GitHub repository's `data/templates/` directory
- **Destination**: `src/resources/formats/pdf/pandoc/`

### Files Copied

Seven files are copied from Pandoc for LaTeX support:

| Pandoc Source | Quarto Destination | Notes |
| ----------------------------- | ------------------ | -------------------------------------------------- |
| `default.latex` | `latex.template` | Main Pandoc template |
| `common.latex` | `latex.common` | Reference copy (Quarto maintains modified version) |
| `after-header-includes.latex` | (unchanged) | Post-header-includes processing |
| `hypersetup.latex` | (unchanged) | Hyperref configuration |
| `font-settings.latex` | (unchanged) | User font configuration |
| `fonts.latex` | (unchanged) | Font engine detection |
| `passoptions.latex` | (unchanged) | Package options passthrough |

### Purpose of Each Pandoc File

**default.latex** (becomes `latex.template`): The main Pandoc LaTeX template. Quarto uses its own `template.tex` as the main orchestrator instead.

**common.latex** (becomes `latex.common`): Common preamble setup from Pandoc including paragraph formatting, verbatim settings, highlighting, tables, graphics, citations, and bibliography. Quarto keeps this as a reference copy.

**after-header-includes.latex**: Processing after user-provided header includes. Sets up xspace, bookmark, and URL packages.

**hypersetup.latex**: Hyperref configuration for PDF links, colors, and metadata.

**font-settings.latex**: User font configuration for different TeX engines (PDFTeX, XeTeX, LuaTeX). Handles mainfont, sansfont, monofont, mathfont, and CJK fonts.

**fonts.latex**: Font engine detection and setup. Loads fontspec for XeTeX/LuaTeX, handles font fallbacks.

**passoptions.latex**: Package options passthrough mechanism for hyperref, xcolor, and xeCJK.

## 2. Quarto's Modular Template Structure

Quarto breaks the Pandoc templates into a modular structure in `src/resources/formats/pdf/pandoc/`. This allows for:

- Better separation of concerns
- Easier customization and extension
- Support for Quarto-specific features (author normalization, bibliography control)

### File Extension Convention

Quarto uses file extensions to distinguish template origin:

- `.tex` files: Quarto-maintained partials
- `.latex` files: Pandoc-derived partials

### Template Files

The `pdfFormat` function in `src/format/pdf/format-pdf.ts` configures the template context, specifying `template.tex` as the main template with partials from both Quarto (`.tex`) and Pandoc (`.latex`).

### template.tex - The Orchestrator

Assembles the document by including all partials in order. This is Quarto's main template, distinct from Pandoc's `latex.template`.

### The "common" Files Architecture

Quarto maintains two versions of the common preamble:

**latex.common** (264 lines): Pandoc's original, kept as reference. Contains the full common preamble: paragraph formatting, verbatim, highlighting, tables, graphics, strikeout, CSL citations, Babel, page style, tight lists, subfigure support, text direction, natbib/biblatex configuration.

**common.latex** (66 lines): Quarto's shortened version that:

- Keeps Pandoc's paragraph formatting, verbatim, and listings setup
- Calls `$pandoc.tex()$` to delegate the rest to Quarto partials

This allows Quarto to selectively override specific parts of the common preamble while maintaining compatibility with Pandoc updates.

### Quarto Partials (\*.tex)

**Document Structure:**

| File | Purpose |
| ------------------ | -------------------------------------------------------------------------------------------------- |
| `doc-class.tex` | Document class declaration with babel languages, fontsize, papersize, and class options |
| `before-title.tex` | Empty placeholder for pre-title content |
| `title.tex` | Title, subtitle, author, and date setup. Uses Quarto's `authors` normalization (`it.name.literal`) |
| `before-body.tex` | Frontmatter, `\maketitle`, and abstract rendering |
| `toc.tex` | Table of contents, list of figures, list of tables |
| `after-body.tex` | Empty placeholder for post-body content |

**Bibliography:**

| File | Purpose |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `before-bib.tex` | Empty placeholder before bibliography |
| `biblio.tex` | Bibliography rendering with natbib or biblatex |
| `biblio-config.tex` | Bibliography package configuration. Adds `$biblio-config$` conditional (Quarto-only variable) to allow class files to handle bibliography configuration |

**Content Elements (called via pandoc.tex):**

| File | Purpose |
| ---------------- | --------------------------------------------------------------------------- |
| `tables.tex` | Table packages (longtable, booktabs, array, multirow) and footnote handling |
| `graphics.tex` | graphicx package and `\pandocbounded` command for auto-scaling images |
| `citations.tex` | CSL citation definitions (`\citeproc`, `CSLReferences` environment) |
| `babel-lang.tex` | Babel language configuration and font setup |
| `tightlist.tex` | `\tightlist` command for compact list spacing |

**Hub Partial:**

| File | Purpose |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pandoc.tex` | Hub that calls other Quarto partials. Contains highlighting, strikeout/underline, page style, subfigure support, text direction. Calls: `$tables.tex()$`, `$graphics.tex()$`, `$citations.tex()$`, `$babel-lang.tex()$`, `$tightlist.tex()$`, `$biblio-config.tex()$` |

## 3. Template Invocation Order

The `template.tex` orchestrates the full document:

### Preamble (before `\begin{document}`)

1. `$passoptions.latex()$` - Package options passthrough
2. `$doc-class.tex()$` - `\documentclass[...]{...}` declaration
3. (inline) - beamerarticle, xcolor, geometry, amsmath
4. (inline) - Section numbering configuration
5. `$fonts.latex()$` - Font engine detection (ifPDFTeX, ifXeTeX, ifLuaTeX)
6. `$font-settings.latex()$` - User font configuration
7. `$common.latex()$` - Common preamble setup, which internally calls:
- `$pandoc.tex()$` → `$tables.tex()$`, `$graphics.tex()$`, `$citations.tex()$`, `$babel-lang.tex()$`, `$tightlist.tex()$`, `$biblio-config.tex()$`
8. `$after-header-includes.latex()$` - Bookmark, URL packages
9. `$hypersetup.latex()$` - Hyperref configuration
10. `$before-title.tex()$` - Pre-title content
11. `$title.tex()$` - `\title{}`, `\author{}`, `\date{}`

### Document Body

12. `\begin{document}`
13. `$before-body.tex()$` - Frontmatter, `\maketitle`, abstract
14. (loop) - include-before content
15. `$toc.tex()$` - Table of contents
16. (inline) - linestretch, mainmatter
17. `$body$` - Document content
18. `$before-bib.tex()$` - Pre-bibliography content
19. (inline) - backmatter, nocite
20. `$biblio.tex()$` - Bibliography rendering
21. (loop) - include-after content
22. `$after-body.tex()$` - Post-body content
23. `\end{document}`

## 4. TypeScript Configuration

The `pdfFormat` function in `src/format/pdf/format-pdf.ts` (lines 236-284) defines the template configuration:

```typescript
// Quarto-maintained partials (.tex)
const partialNamesQuarto: string[] = [
"babel-lang",
"before-bib",
"biblio",
"biblio-config",
"citations",
"doc-class",
"graphics",
"after-body",
"before-body",
"pandoc",
"tables",
"tightlist",
"before-title",
"title",
"toc",
];

// Pandoc-derived partials (.latex)
const partialNamesPandoc: string[] = [
"after-header-includes",
"common",
"font-settings",
"fonts",
"hypersetup",
"passoptions",
];
```

The template context maps these to files:

- Quarto partials: `pandoc/${name}.tex`
- Pandoc partials: `pandoc/${name}.latex`

## 5. Parameter Summary Table

### Font Parameters (XeTeX/LuaTeX)

| Parameter | Type | Description |
| ------------------ | ------ | ---------------------------- |
| `mainfont` | string | Main text font family |
| `mainfontoptions` | array | Font options for main font |
| `mainfontfallback` | array | Fallback fonts for main font |
| `sansfont` | string | Sans-serif font family |
| `sansfontoptions` | array | Font options for sans font |
| `sansfontfallback` | array | Fallback fonts for sans font |
| `monofont` | string | Monospace font family |
| `monofontoptions` | array | Font options for mono font |
| `monofontfallback` | array | Fallback fonts for mono font |
| `mathfont` | string | Math font family |
| `mathfontoptions` | array | Font options for math font |

### Font Parameters (PDFTeX)

| Parameter | Type | Description |
| ------------------- | ------ | -------------------------------------- |
| `fontfamily` | string | Font package name (e.g., "libertinus") |
| `fontfamilyoptions` | array | Options for font package |
| `fontenc` | string | Font encoding (default: "T1") |

### CJK Font Parameters

| Parameter | Type | Description |
| ------------- | ------ | ---------------- |
| `CJKmainfont` | string | CJK main font |
| `CJKsansfont` | string | CJK sans font |
| `CJKmonofont` | string | CJK mono font |
| `CJKoptions` | array | CJK font options |

### Layout Parameters

| Parameter | Type | Description |
| --------------- | ------ | ----------------------------------------------- |
| `documentclass` | string | Document class (default: "scrartcl" for Quarto) |
| `classoption` | array | Class options (e.g., "12pt", "twoside") |
| `papersize` | string | Paper size (e.g., "letter", "a4") |
| `geometry` | array | Geometry package options |
| `linestretch` | number | Line spacing multiplier |

### Section Parameters

| Parameter | Type | Description |
| ---------------- | ------- | ----------------------------- |
| `numbersections` | boolean | Enable section numbering |
| `secnumdepth` | integer | Depth of section numbering |
| `fontsize` | string | Base font size (e.g., "11pt") |

### Color Parameters

| Parameter | Type | Description |
| ----------- | ------ | ------------------------ |
| `linkcolor` | string | Color for internal links |
| `citecolor` | string | Color for citations |
| `urlcolor` | string | Color for URLs |
| `toccolor` | string | Color for TOC links |

### Bibliography Parameters

| Parameter | Type | Description |
| --------------- | ------- | --------------------------------------------------------------- |
| `natbib` | boolean | Use natbib for citations |
| `biblatex` | boolean | Use biblatex for citations |
| `biblio-style` | string | Bibliography style |
| `biblio-title` | string | Bibliography section title |
| `bibliography` | array | Bibliography file paths |
| `biblio-config` | boolean | Emit bibliography configuration (Quarto-only, defaults to true) |

### Quarto-Specific Parameters

| Parameter | Quarto Name | Description |
| ------------------------ | ------------------------ | ----------------------------------------------------- |
| `number-sections` | `numbersections` | Enable section numbering |
| `shift-heading-level-by` | `shift-heading-level-by` | Auto-set to -1 when numbersections and no L1 headings |
| `toc` | `toc` | Include table of contents |
| `toc-depth` | `toc-depth` | TOC depth |
| `toc-title` | `toc-title` | TOC heading |
| `lof` | `lof` | Include list of figures |
| `lot` | `lot` | Include list of tables |

### Brand.yaml Integration

**Important**: Unlike HTML and Typst formats, LaTeX does NOT have automatic brand.yaml fallback for typography. Font and color settings must be specified explicitly via Pandoc metadata variables:

```yaml
format:
pdf:
mainfont: "Inter"
sansfont: "Outfit"
monofont: "Fira Code"
fontsize: 11pt
```
Loading
Loading