Skip to content

Instantly share code, notes, and snippets.

Last active August 1, 2023 07:59
Show Gist options
  • Save killshot13/5b379355d275e79a5cb1f03c841c7d53 to your computer and use it in GitHub Desktop.
Save killshot13/5b379355d275e79a5cb1f03c841c7d53 to your computer and use it in GitHub Desktop.
A guide to installing and configuring Pandoc on the Windows & the Linux OS.

What is Pandoc?

Pandoc is open-source software used to transform various filetypes such as .md into more user-friendly filetypes including .pdf, .docx, and .html.

Installing Pandoc

Listed below are the steps I took to install and configure Pandoc on Windows (10 Pro Edition) and Linux (Ubuntu 20.04 Focal) for markdown --> PDF document creation.

Please note all disclaimers remain flapping in the breeze, including "Your Mileage Might Vary."

--> Pandoc on Windows

I have been using the chocolately package manager with Windows for several years now. So for me the simplest way to get Pandoc up and running was to install with this simple command.

choco install pandoc

Then I grabbed the Windows installer for MikTex from the official downloads page, and ran the .exe file to install.

No further configuration was necessary, at least not on a functional level. Provisions exist within Pandoc to customize your installation at a quite granular level.

There is a reference section at the end of this document that is a good starting place.

--> Pandoc on Linux

Getting Pandoc setup with .pdf capabilities on Linux proved a bit more challenging.

After triaging a good deal of noise encountered while researching different packages, I found the general consensus for Ubuntu seemed to favor a Pandoc/TexLive setup.

Since I am running Linux on WSL2, I opted to build from scratch to avoid any conflicts with my local Windows environment.

First I used wget to pull the latest pandoc-linux-amd64 tarball from the release page.

Then, without switching directories, I used a two-step installation process.

sudo tar xvzf $TGZ --strip-components 1 -C '/usr/local'

Note the PATH in this snippet is generic and substitutions must be made to reflect your home directory.

sudo apt-get install texlive texlive-latex-extra

Configuring Pandoc

These configuration options are just examples and may not apply in every situation.

One should always consult the official Pandoc documentation for complete details and latest changes.

  • Specifies which engine Pandoc should use when producing PDF output.

  • Valid values are pdflatex, lualatex, xelatex, latexmk, tectonic, wkhtmltopdf, weasyprint, prince, context, and pdfroff.

  • If the engine is not in your PATH, the full path of the engine may be specified here.

  • If this option is not specified, pandoc uses the following defaults depending on the output format specified by -t/--to:

> -t latex or none
  • defaults to pdflatex (other options: xelatex, lualatex, tectonic, latexmk)
> -t context:
  • defaults to context
> -t html:
  • defaults to wkhtmltopdf (other options: prince, weasyprint; see for a good introduction to PDF generation from HTML/CSS.)
> -t ms:
  • defaults to pdfroff

  • Use the given string as a command-line argument to the pdf-engine. For example, to use a persistent directory foo for latexmk’s auxiliary files, use --pdf-engine-opt=-outdir=foo.

  • Note that no check for duplicate options is done.

Copyright 2006–2021 John MacFarlane ( Released under the GPL, version 2 or greater. This software carries no warranty of any kind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment