Pandoc   a universal document converter

FAQs

On linux or OSX:

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

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 my.md

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'

Run the following command as admin:

msiexec /i pandoc-VERSION.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"

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"

Or

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

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

Add

subparagraph: true

to your metadata, or use --metadata subparagraph on the command line. The default template redefines \paragraph in a way that is incompatible with titlesec, in order to make all header levels appear as section headings.

For example, if you convert an image with {width="50%"}, the LaTeX produced will be \includegraphics[width=0.5\textwidth,height=\textheight].

This output presupposes the following code in pandoc’s default latex template:

% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}

If you don’t have this in your custom template, you should add it. If we didn’t set the height explicitly in this way, the image would not be resized correctly unless it was being resized to smaller than its original size.