Question

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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top