pandoc
A universal document converter.
Specifying options
via CLI
# adapt URL colors:
pandoc -i input.md -o output.pdf -V colorlinks=true -V linkcolor=blue -V urlcolor=red -V toccolor=gray
# specifying papersize or geometry:
pandoc -V papersize:a4 -i input.md -o output.pdf
pandoc -V geometry:a4paper -i input.md -o output.pdf # ... for smaller margins
via YAML frontmatter
Given the following text.md file:
---
fontfamily: libertinus
fontsize: 12pt
linestretch: 1.5
---
# Chapter 1
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
calling
pandoc -i text.md -o text.pdf
will create a text.pdf with the lorem ipsum text in the Libertine
font in fontsize 12 with 1.5 line spacing.
Citations
The powertool that it is, pandoc also seamlessly supports scientific
citations with the help of bibtex (.bib) and
Citation Style Language (.csl) files.
Given a directory like this,
.
├── style.csl
├── library.bib
├── my_article.md
...
and the following frontmatter and content in my_article.md,
---
bibliography: library.bib
csl: style.csl
---
In their seminal paper on ... @author123 describe .... However, the
strength of the effect remains disputed [@author4; @author5].
running pandoc --citeproc -i my_article.md -o my_article.pdf will
build a bibliography at the end of your pdf document and cite the
sources in the text as defined per the referenced citation style (as
long as the bibtexkeys cited in my_article.md are actually specified
in library.bib).
For more info, have a look at pandoc's documentation on citations or consult this pandoc citation tutorial.
Common issues
Page numbering
Normally, specifying the pagestyle variable as
empty should do the trick. However, it might be necessary to
additionally add \thispagestyle{empty} after \maketitle{}.