How do you specify that Pandoc should use a specific header and footer when generating a PDF from Markdown?
Currently I use the following to create my doc from the command line:
pandoc -s -V geometry:margin=1in --number-sections -o doc.pdf doc.mkd
This gives a lovely result with numbered sections.
What I would like to do, is to include a header and footer on each page. How do I go about it?
The extensions mechanism, e.g. pandoc_title_block
may hold the key, but how do you use it?
Lastly (as a bonus), is there some way to create a title page for a document using pandoc?
We can insert headings and subheadings in R Markdown using the pound sign # . There are six heading/subheading sizes in R Markdown. The number of pound signs before your line of text determines the heading size, 1 being the largest heading and 6 being the smallest.
There are actually two steps involved in converting a Markdown file to a PDF file: The Markdown source file is converted to a LaTeX source file. Pandoc invokes the pdflatex or xelatex or other TeX command and converts the . tex source file to a PDF file.
When using the -s
(--standalone
) argument for the generation of PDFs, Pandoc uses a specific LateX template.
You can look at the template with pandoc -D latex
and notice that there are many variables that you can set (the same way you did you with -V geometry:margin=1in
in your command).
In order to add a specific header/footer, you can modify this template and use the --template
argument in the command line.
You can get more information here Pandoc demo templates
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With