Pandoc with Xelatex29 Nov 2015
A few notes after spending a some time battling with Pandoc, YAML, and the Xelatex typesetting engine:
Theoretically it is easier to specify fontsize in the YAML block instead of in the command line. You don’t have to retype it each time and you can better version control your attributes.
For book projects, where your YAML headers are reused, separate the YAML block into its own file. Then pass both sources to concatenate. Something like
pandoc -s metadata.yaml chapter1.md -o chapter1.pdf.
--latex-engine=xelatexoption to work with languages other than English. Make sure your tex editor supports the UTF-8 encoding.
However, when you use the Xelatex engine, the YAML attribute to change default fonts switches from
mainfont:. Doh! It was in the docs.
man pandocfor more.
When specifying the main font, put the font name in quotations like so:
mainfont: "Day Roman".
You can find the LATEX font names in the excellent Latex Font Catalog. Use the full name as shown above.
pandocincantations are slightly tedious to type out. Use a shell script to automate. You can find the one I use here. Note that it expects you to pass a few arguments (everything is in the comments).
If none of this makes sense to you, read this first.
Hopefully these notes can save you a few moments of frustration.