2.1 metadata.yml

The metadata.yml file is read by Pandoc. Settings in this file affect the behaviour of Pandoc and get inserted in the templates. For more info on templates, see Section 2.3. You can override settings by placing a metadata.yml file at the root directory of your project. For example, the metadata for this project contains:

---
title: Books.jl
subtitle: Create books with Julia
author:
  - Rik Huijzer
  - and contributors

# An example additional header include for html.
# Note that the url will be updated by \`Books.fix_links\`.
header-includes:
- |
  \`\`\`{=html}
  <link rel="stylesheet" href="/files/style.css"/>
  \`\`\`
mousetrap: true

#
# PDF only settings.
#
pdf-footer: ""

# Avoid adding a blank page before each chapter.
disable-cleardoublepage: true

bibliography: bibliography.bib

titlepage-top: >
  \begin{tabular}{l}
  Rik Huijzer\\
  University of Groningen\\
  the Netherlands\\
  t.h.huijzer@rug.nl\\
  \end{tabular}

titlepage-bottom: >
  \url{https://books.huijzer.xyz}
---

And, the following defaults are set by Books.jl.

---
title: My book
subtitle: My book subtitle
author:
  - John Doe

# Licenses; can be empty.
html-license: <a href="http://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a>
tex-license: Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International

pdf-footer: "\\url{https://github.com/johndoe/Book.jl}"

geometry:
  # Defaulting to large pages to be able to show 92 chars in code blocks.
  - paperheight=10in # 25.4 cm.
  - paperwidth=7in # 17.78 cm.
  - marginparwidth=30mm
  - marginparsep=2mm
  - bindingoffset=10mm
  - top=10mm
  - inner=8mm
  - outer=8mm
  - bottom=16mm
  - includehead
  - includemp

# A setting for the PDF. I don't know whether it is important.
lang: en-US

# Uncomment the following to enable a Chinese/Japanese/Korean (CJK) font.
# CJKmainfont: Noto Serif CJK SC

links-as-notes: true

tags: [pandoc, Books.jl, JuliaLang]
number-sections: true

code-block-font-size: \scriptsize

titlepage: true
linkReferences: true
link-citations: true

# These table of contents settings only affect the PDF.
toc: true
tocdepth: 1

# Cross-reference prefixes.
eqnPrefix: Equation
figPrefix: Figure
tblPrefix: Table
secPrefix: Section

# Keyboard shortcuts.
mousetrap: true

header-left: foobar
---

Note that Pandoc has a great templating system. For example, the Pandoc LaTeX template “default.latex” contains hundreds of options which can all be set via “metadata.yml.” In the template of this project, I tried to get the basics right and haven’t spend hours on making it configurable. However, if you want to add options to the templates, feel free to open a pull request. If you want to configure the template completely by yourself, you can place “template.tex” in “pandoc/” at the root of your project1. This same holds for the HTML, CSS, and DOCX template.


  1. 1. With LaTeX, be ready for hours of fiddling to get things right though. The current LaTeX template is adjusted to work with Tectonic, Julia syntax highlighting and the Tufte LaTeX class.↩︎



CC BY-NC-SA 4.0 Rik Huijzer, and contributors