pandoc

Pandoc is a free and open-source software tool that is used to convert files from one markup format to another. It was developed by John MacFarlane, a professor of philosophy at the University of California, Berkeley. Pandoc is a universal document converter that supports a wide range of file formats, including but not limited to: Microsoft Word, HTML, LaTeX, Markdown, EPUB, and many others. This versatility makes Pandoc an indispensable tool for writers, researchers, and publishers who need to convert their documents between different formats.

Installation (Unix only)

To make pandoc work, we usually need two packages: pandoc and basictex. Both can be easily installed by Homebrew in terminal:

% brew install pandoc
% brew install --cask basictex

Sometimes you need to change the path variable, but it works fine for me without any change.

Usage

Suppose we have a markdown file like "doc.md”, and we want convert it to a pdf file. We can simply use the code below to achieve it.

% pandoc doc.md -s -o doc.pdf