# Pandoc

For my degree in Computer Science, I write a lot of math papers. Typing mathematical formulas on computers is not a common task and hence the tools around it can be a bit finicky at times. The most common format is LaTeX, which provides a lot of expressiveness. For all the nice things about LaTeX, it cannot be said to be terse. After writing in LaTeX for some months I got fed up and searched for an alternative. All I wanted was Markdown with the ability to include mathematical formulas.

Turns out that very thing exists, it’s called Pandoc. Granted Pandoc does many other things, but this is how I use it. It’s super simple I can just write Markdown and if I need the power of LaTeX I can just type valid LaTeX and it will work. Since my papers are mostly text this provides a far superior writing environment for me. However, there are a few gotchas.

## Installation

Instructions are availible on their website, but on OSX brew install pandoc. You can then convert Markdown to PDF using pandoc -o output.pdf input.md

You might be used to using $$...$$ and $...$ in LaTeX. Pro tip you can also used $ which is easier to type and looks more Markdown native. # Title Some text$\frac{1}{2}$with an inline equation. And an equation centered on it's own line: $$c = \sqrt{a^2 + b^2}$$  ## Import LaTeX packages It happens frequently that I need character sets that are not part of standard LaTeX. For this you need to import LaTeX packages. It can easily be done with a Markdown header: --- header-includes: - \usepackage{cleveref} - \usepackage{stmaryrd} - \usepackage{mathtools} - \DeclarePairedDelimiter\ceil{\lceil}{\rceil} - \DeclarePairedDelimiter\floor{\lfloor}{\rfloor} --- # Section ![A Markdown logo\label{markdown}](markdown.png) See \cref{markdown}.$\llbracket \phi \rrbracket = T\ceil{n/b}$or$\floor{n/b}\$


Picked up that trick here.

## Sizing images

When using traditional markdown syntax for images they will fill to expand the width of the page if the image is large enough. Most of the time this is not what you want as the reader will lose the context of the image and the text surrounding it. Fixing this is luckily simple.

![image](foo.jpg){width=50%}


Rather annoyingly you can’t force the image’s position which is often needed in LaTeX.

Docs