# Pandoc: minimal headers for LaTeX output

I'm taking mediawiki text and trying to convert it to latex in Pandoc. All seems to be reasonably well.

However, I had to make sure to use:

\documentclass{book}
\usepackage{hyperref}
\begin{document}
... pandoc output ...
\end{document}

to get LaTeX to work at all - specifically, importing hyperref wasn't particularly intuitive.

Is there a canonical list of packages I should be importing to handle any output from pandoc -f latex ? Or even just a list of "you should import this to cover this use-case".

(I ask because I have further problems deep inside my document, and suspect this is the cause instead of Pandoc producing malformed LaTeX.)

GarethJones is absolutely right; using -s (--standalone) gets you the headers for free, and was exactly what I needed.

I also needed to use xelatex rather than latex in order to properly support unicode in order to parse some of the odder unicode characters (left-to-right direction marks, amongst others) and to ensure it output the correct ligatures (fl was being converted to Æ rather than ﬂ)

• Were you using the -s (--standalone) option? (Just a thought, having read the manual yesterday to determine if PanDoc could solve a problem I had. It couldn’t, but for some reason that option stuck in my memory. As far as I can tell, with the -s option, it should output the LaTeX preamble itself.) – Gareth Jones Jun 25 '13 at 14:39
• This is totally the answer I needed, thank you. Would you like to make it a question so you can get a big tick? :) – Dragon Jul 18 '13 at 17:34
• You can also use a template – henrique Jul 18 '13 at 18:43
• You shouldn't edit your question to ask a new one. Anyway, check slightly above pandoc.org/README.html#citation-rendering, --latex-engine=xelatex, but this only matters if you output to pdf directly, otherwise you just run whatever LaTeX-engine you want on the .tex file generated – Tobias Kienzler Dec 11 '15 at 10:58