Pandoc
Overview
Pandoc is an extension to MarkDown providing support for a number of document formats.
See http://johnmacfarlane.net/pandoc/
This is an extremely powerful and easy-to-use tool and well worth looking at.
Create Standalone HTML Document
$ pandoc --output test.html --standalone --toc test.mdml
$ man pandoc # for more information
Creating a PDF Document
Earlier versions of Pandoc included markdown2pdf that is
no longer needed as Pandoc now includes the ability to create PDFs.
This is the old markdown2pdf usage:
$ markdown2pdf --output test.pdf test.mdml
$ man markdown2pdf # for more information
The same with later versions of Pandoc (e.g. 1.9.4.2)
$ pandoc --toc --output test.pdf test.md
Pandoc requires pdflatex to create PDFs. In Debian 8 (Jessie)
installing the texlive package should install all required
dependencies. If not, you could also consider installing packages such
as texlive-lang-all, texlive-lang-english and
texlive-latex-extra.
– Frank Dean - 2 Aug 2016
Creating an ebook
http://johnmacfarlane.net/pandoc/epub.html
Page Breaks
You can use inline (LaTeX) to create page breaks. Newpage forces a new page. Pagebreak encourages a page break.
\newpage
\pagebreak
Trouble-shooting
- Package inputenc Error: Unicode char—(inputenc) not set up for use with LaTeX
Additionally, the error message suggests *Try running pandoc with
--latex-engine=xelatex* – Which should fix the issue. E.g.
$ pandoc --pdf-engine=xelatex --toc --output test.pdf test.md
You may also need to specify a different font which has the unicode
characters in it. E.g. on macOS:
$ pandoc --pdf-engine=xelatex -V 'mainfont:Helvetica Neue' --toc \
--output test.pdf test.md
– Frank Dean - 27 Nov 2025
Resources
Related Topics: CreatingDocuments, DocumentFormats, MarkDown, LaTeX
– Frank Dean - 10 Aug 2009