Search code examples
markdownpandocgrofftroff

Set papersize for pandoc with pdfroff


I'm using pandoc to convert markdown into PDFs. When using the LaTeX PDF engine (which is the default), I can specify a different paper size with -V geometry:a1paper.

I want to use the pdfroff backend with --pdf-engine=pdfroff as it's faster and produces better output for my use case.

So how can I specify the paper size for the pdfroff with pandoc?


Solution

  • If you print the roff ms pandoc template with pandoc -D ms, you can see that it makes use of the papersize variable. Not sure which sizes your groff version supports, but try something like:

    pandoc -V papersize=a4 --pdf-engine=pdfroff -o foo.pdf --verbose
    

    This emits .ds paper a4

    You can also pass options directory to groff, see --pdf-engine-opt.