---
title: "Converting markdown to pdf with pandoc on linux"
description: "Converting markdown posts to pdf on ubuntu takes a few packages from the standard repos. I had to go through a few stack overflow posts, and nothing seemed..."
date: 2022-01-12
published: false
tags:
  - blog
  - cli
  - linux
template: til
---


Converting markdown posts to pdf on ubuntu takes a few packages from the
standard repos.  I had to go through a few stack overflow posts, and
nothing seemed to have all the fonts and packages that I needed to
convert markdown, but this is what ended up working for me.

## Installing all the packages

``` bash
sudo apt install \
  pandoc \
  texlive-latex-base \
  texlive-fonts-recommended \
  texlive-extra-utils \
  texlive-latex-extra \
  texlive-xetex
```

## Using pandoc to convert markdown to a pdf

``` python
# older versions of pandoc, I needed this one on ubuntu 18.04
pandoc pages/til/convert-markdown-pdf-linux.md -o convert-markdown-pdf.pdf --latex-engine=xelatex
# newer versions of pandoc, I needed this one on ubuntu 21.04
pandoc pages/til/convert-markdown-pdf-linux.md -o convert-markdown-pdf.pdf --pdf-engine=xelatex
```

![results of converting this post to a pdf](https://dropper.waylonwalker.com/file/c367ae8a-5626-4cf6-9aec-070cbf054f46.webp)

> Here is an image of what converting this article over to a pdf looks
> like.  The raw markdown is
> [here](https://waylonwalker.com/convert-markdown-pdf-linux.md "a link to the raw markdown of this post").
