Joseph Petitti —

# How to take beautiful notes with Pandoc

Taking notes by hand is so old fashioned. You can't version control or backup paper, it's hard to search through, and a small mistake can force you to cross out or erase a whole line of text. But taking good notes on a computer has a host of problems of its own. Fiddling with formatting and typesetting is time-consuming, and it's hard to include mathematical notation, images, and other elements that are easy to write by hand but hard to type. Fortunately, I've found a solution that's easy and fun to use: writing Markdown and compiling it to a LaTeX-produced PDF with Pandoc. Read on to learn how I do it.

LaTeX is indisputably the king of math and science typesetting, but it's cumbersome to use for basic tasks like note-taking. Writing out a whole LaTeX preamble for a every document is more work than is needed for something this simple. Instead, I write my notes in a super simple markup language called Markdown. If you don't already know Markdown, spend two minutes reading this page and you'll know everything you need to. The nice thing about Markdown, as opposed to other markup languages like HTML or YAML is that it's already pretty readable as plain text. But we want our notes, and especially our notes, to look better than "pretty readable."

We'll use a lovely program called Pandoc to convert our okay-looking Markdown notes to beautiful PDF notes. Pandoc is free software written in Haskell, so installing it is easy. On a Fedora system, just do:

# dnf install pandoc

See here if you need more help installing.

Pandoc converts between many different types of documents, among them being Markdown files and PDFs. For creating PDFs Pandoc uses LaTeX as its backend, so you get the professional look of TeX without having to actually write it.

This does mean that it relies on a a TeX backend, so install one if you don't already have one. For example:

Now we can convert our markdown to beautiful PDFs with one command:

$pandoc -s -o notes.pdf notes.md The -o flag tells Pandoc the filename and format to output to, and the -s flag stands for "standalone" (create a full file instead of just a snippet). # dnf install texlive-latex "But wait!" you say. "Markdown is nice, but what about math mode and those other neat features from LaTeX?" Fear not. Pandoc supports many Markdown extensions like tex_math_dollars out of the box. (See here for a full list of supported extensions). Anything between two dollar signs will be treated as TeX math by the Pandoc compiler. So this: $\min \{ \pi(w), \pi(v) + l_e \}\$

Becomes this:

This is a great resource on mathematics in LaTeX that I'd recommend looking through.

This method is what I use for taking notes in my computer science classes. It lets me write quickly during class, but compiles to beautifully-typeset PDFs that are great for studying later. Pandoc is also an incredibly useful tool with tons more features that I haven't covered here, so I'd recommend looking into it more if you do any large amount of writing.