14

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?

Jack
  • 16,506
  • 19
  • 100
  • 167

1 Answers1

14

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

Community
  • 1
  • 1
garnierclement
  • 511
  • 5
  • 6
  • For others information: The "geometry" variable is not implemented in pandoc included in Ubuntu 12.04 LTS. For a possible workaround see: https://groups.google.com/forum/#!topic/pandoc-discuss/59mBEixlIJU – Samuel Åslund Mar 18 '14 at 09:49