Pandoc   a universal document converter


How can I convert a whole directory of files from Markdown to RTF?

On linux or OSX:

for f in *.txt; do pandoc "$f" -s -o "${f%.txt}.rtf"; done

I used pandoc to convert a document to ICML (or OPML or RTF), and when I try to open it in InDesign (or OmniOutliner or a word processor), I’m told it’s invalid. What have I done wrong?

Be sure to use the -s or --standalone flag, or you just get a fragment, not a full document with the required header:

pandoc -s -f markdown -t icml -o my.icml

I get a blank document when I try to convert a markdown document in Chinese to pdf using pandoc -o test.pdf test.markdown.

By default, pandoc uses pdflatex to generate the PDF, and pdflatex doesn’t handle Chinese characters. But you can change the default to use xelatex instead. You should also make sure you’re using a font with Chinese glyphs. For example:

pandoc -o c.pdf --pdf-engine=xelatex -V mainfont='Adobe Ming Std'

The new Windows installer (starting with 1.11) does a single user install, rather than installing pandoc for all users. How can I install pandoc for all users?

Run the following command as admin:

msiexec /i pandoc-1.xx.msi ALLUSERS=1

This will put pandoc in C:\Program Files\Pandoc. You can install Pandoc to a different directory by setting APPLICATIONFOLDER parameter, for example:

msiexec /i pandoc-1.11.1.msi ALLUSERS=1 APPLICATIONFOLDER="C:\Pandoc"

How do I change the margins in PDF output?

The option

-V geometry:margin=1in

will set the margins to one inch on each side. If you don’t want uniform margins, you can do something like

-V geometry:"top=2cm, bottom=1.5cm, left=1cm, right=1cm"


-V geometry:"left=3cm, width=10cm"

For more options, see the documentation for the LaTeX geometry package.

How does pandoc compare to multimarkdown?

Here is a wiki page comparing the two.

Pandoc hangs when I try to use --bibliography.

Most likely this is a packaging problem. If you are running the version of pandoc 1.9.1 packaged in Ubuntu 12.04, you should be able to fix the problem by doing

sudo apt-get install libghc-citeproc-hs-data

After upgrading to, markdown2pdf messes up tables when used with my custom latex template.

You need to add the line \usepackage{ctable} to your custom latex template, preferably right after the line $if(tables)$.