9.9 KiB
Pandoc YAML Variables Reference
Comprehensive guide to YAML frontmatter variables for Pandoc document conversion.
Core Metadata
title
Type: String Usage: Document title Example:
title: "My Research Paper"
author
Type: String or List Usage: Author name(s) Examples:
author: "John Smith"
# Multiple authors
author:
- "John Smith"
- "Jane Doe"
date
Type: String Usage: Publication/document date Examples:
date: "November 2024"
date: "2024-11-16"
date: "16 November 2024"
lang
Type: String (BCP 47 language code) Usage: Document language for hyphenation, quotes, citations Examples:
lang: en-GB # British English
lang: en-US # American English
lang: en-IE # Irish English
lang: de # German
lang: fr # French
Bibliography and Citations
bibliography
Type: String or List Usage: Path to BibTeX (.bib) file(s) Examples:
bibliography: references.bib
# Multiple files
bibliography:
- references.bib
- additional.bib
csl
Type: String Usage: Path to Citation Style Language (.csl) file Examples:
csl: harvard.csl
csl: apa.csl
csl: ieee.csl
Download CSL styles: https://github.com/citation-style-language/styles
link-citations
Type: Boolean Usage: Make citations clickable links to bibliography Example:
link-citations: true
citeproc
Type: Boolean (command-line option, not frontmatter) Usage: Enable citation processing Command:
pandoc doc.md -o doc.pdf --citeproc
PDF Output Settings
documentclass
Type: String Usage: LaTeX document class Options:
article- Short documents, papersreport- Longer documents with chaptersbook- Books with front matterbeamer- Presentations
Example:
documentclass: report
fontsize
Type: String
Usage: Base font size
Options: 10pt, 11pt, 12pt
Example:
fontsize: 12pt
geometry
Type: String Usage: Page layout and margins Examples:
geometry: margin=1in
geometry: margin=2cm
geometry: "left=1.5in, right=1in, top=1in, bottom=1in"
geometry: "a4paper, margin=2.5cm"
linestretch
Type: Number Usage: Line spacing multiplier Examples:
linestretch: 1.0 # Single spacing
linestretch: 1.5 # 1.5 spacing
linestretch: 2.0 # Double spacing
papersize
Type: String
Usage: Paper size
Options: a4, letter, legal, executive
Example:
papersize: a4
Table of Contents
toc
Type: Boolean Usage: Include table of contents Example:
toc: true
toc-depth
Type: Integer (1-5) Usage: Maximum heading level in TOC Example:
toc-depth: 3 # Include h1, h2, h3
toc-title
Type: String Usage: Custom TOC heading Example:
toc-title: "Contents"
lof
Type: Boolean Usage: Include list of figures Example:
lof: true
lot
Type: Boolean Usage: Include list of tables Example:
lot: true
Section Numbering
numbersections
Type: Boolean Usage: Number section headings automatically Example:
numbersections: true
secnumdepth
Type: Integer Usage: Maximum heading level to number Example:
secnumdepth: 3 # Number up to h3
LaTeX Customization
header-includes
Type: String (multiline) Usage: Custom LaTeX commands and packages Example:
header-includes: |
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{amsmath}
include-before
Type: String (multiline) Usage: Content before document body Example:
include-before: |
\begin{abstract}
This is the abstract.
\end{abstract}
include-after
Type: String (multiline) Usage: Content after document body Example:
include-after: |
\appendix
# Appendix content
Typography
mainfont
Type: String Usage: Main document font (requires XeLaTeX or LuaLaTeX) Example:
mainfont: "Times New Roman"
sansfont
Type: String Usage: Sans-serif font Example:
sansfont: "Arial"
monofont
Type: String Usage: Monospace font for code Example:
monofont: "Courier New"
fontfamily
Type: String Usage: LaTeX font package Example:
fontfamily: palatino
Presentation (Beamer)
theme
Type: String Usage: Beamer theme Options: Madrid, Berlin, Copenhagen, Dresden, Frankfurt, Singapore, Warsaw Example:
theme: Madrid
colortheme
Type: String Usage: Beamer color scheme Options: default, dolphin, beaver, crane, seahorse Example:
colortheme: default
fonttheme
Type: String Usage: Beamer font theme Options: default, serif, structurebold, structureitalicserif Example:
fonttheme: default
aspectratio
Type: Integer
Usage: Slide aspect ratio
Options: 43 (4:3), 169 (16:9), 1610 (16:10)
Example:
aspectratio: 169
navigation
Type: String Usage: Navigation symbols Options: horizontal, vertical, frame Example:
navigation: horizontal
HTML Output
css
Type: String or List Usage: CSS stylesheet path(s) Examples:
css: style.css
# Multiple stylesheets
css:
- style.css
- syntax.css
self-contained
Type: Boolean (command-line) Usage: Embed all resources in HTML Command:
pandoc doc.md -o doc.html --self-contained
Code Highlighting
highlight-style
Type: String Usage: Syntax highlighting theme Options: tango, pygments, kate, monochrome, espresso, zenburn, haddock, breezedark Example:
highlight-style: tango
Custom Variables
Custom Title Page Fields
For thesis/academic work:
supervisor: "Dr. Jane Smith"
institution: "University Name"
department: "Department of Computer Science"
degree: "BSc Computer Science"
Student Information:
student-id: "C21348423"
programme: "TU856"
module: "COMP4060"
Contact Information:
email: "student@example.com"
website: "https://example.com"
BibTeX Reference
Entry Types
Article:
@article{citekey,
author = {Smith, John and Doe, Jane},
title = {Paper Title},
journal = {Journal Name},
year = {2024},
volume = {42},
number = {3},
pages = {123--145},
doi = {10.1234/example}
}
Book:
@book{citekey,
author = {Johnson, Alice},
title = {Book Title},
publisher = {Publisher Name},
year = {2023},
edition = {2nd},
address = {City},
isbn = {978-0-12-345678-9}
}
Conference Paper:
@inproceedings{citekey,
author = {Brown, Robert},
title = {Paper Title},
booktitle = {Conference Proceedings},
year = {2024},
pages = {45--52},
publisher = {ACM},
doi = {10.1145/example}
}
PhD Thesis:
@phdthesis{citekey,
author = {Williams, Michael},
title = {Thesis Title},
school = {University Name},
year = {2023},
address = {City, Country}
}
Master's Thesis:
@mastersthesis{citekey,
author = {Davis, Sarah},
title = {Thesis Title},
school = {University Name},
year = {2024}
}
Website:
@misc{citekey,
author = {Organization},
title = {Page Title},
year = {2024},
url = {https://example.com},
note = {Accessed: 2024-11-16}
}
BibTeX Field Reference
Required vs Optional varies by entry type
Common Fields:
author- Author names (use "and" to separate)title- Work titleyear- Publication yearjournal- Journal name (article)booktitle- Book/conference namepublisher- Publisher nameschool- University (thesis)pages- Page range (use double dash: 123--145)volume- Volume numbernumber- Issue numberedition- Edition (2nd, 3rd, etc.)address- Location (city, country)doi- Digital Object Identifierurl- Web addressnote- Additional information
Author Formatting:
author = {Lastname, Firstname}
author = {Lastname1, Firstname1 and Lastname2, Firstname2}
author = {Firstname Lastname} # Auto-parsed
Special Characters:
title = {Study of {DNA} Sequencing} # Protect caps
title = {Analysis of {IoT} Systems}
author = {M{\"u}ller, Hans} # Umlaut
Example Complete Frontmatter
Academic Paper
---
title: "Research Paper Title"
author: "Author Name"
date: "November 2024"
lang: en-GB
bibliography: references.bib
csl: harvard.csl
link-citations: true
documentclass: report
fontsize: 12pt
geometry: margin=1in
linestretch: 1.5
numbersections: true
toc: true
toc-depth: 3
header-includes: |
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
---
Thesis
---
title: "Thesis Title"
author: "Student Name"
date: "Month Year"
supervisor: "Dr. Supervisor Name"
institution: "University Name"
department: "Department Name"
degree: "BSc Computer Science"
lang: en-GB
bibliography: references.bib
csl: harvard.csl
link-citations: true
documentclass: report
fontsize: 12pt
geometry: margin=1in
linestretch: 1.5
numbersections: true
secnumdepth: 3
toc: true
toc-depth: 3
lof: true
lot: true
---
Simple Article
---
title: "Article Title"
author: "Author Name"
date: "Date"
lang: en-GB
documentclass: article
fontsize: 11pt
geometry: margin=1in
---
Variable Precedence
- Command-line variables (
-V key=value) override - Frontmatter variables
- Defaults file variables
- Pandoc built-in defaults
Resources
- Pandoc Manual: https://pandoc.org/MANUAL.html
- CSL Styles: https://github.com/citation-style-language/styles
- BibTeX Reference: https://www.bibtex.com/
- LaTeX Packages: https://ctan.org/