Markdown with Latex

I heart Latex, but I don’t really write with it these days since I’m no longer in grad school. Markdown, though, I use all the time. So, on the occasions that I need to use math in my markdown file, I like to be able to have a math mode that’s identical to Latex’s math mode.

Turns out, when I’m converting from markdown to HTML in Pandoc, I really only need to add one option to it– --mathml. There’s also an option for MathJax, but I’m not quite as fond of that because I need to specify the source file and it also means adding JavaScript to the HTML output.

So, pandoc --mathml myfile.markdown -o myfile.html will convert my file to HTML with Latex math support. $$ is the delimiter for math mode and $ is the delimiter for inline math mode. Pretty simple.

Of course, it’s not nearly as robust as a proper Latex setup, but if I need something more powerful than what’s available, I’ll probably just switch over from markdown to Latex.

Update: I also don’t like the block equations in the middle of the page (I don’t like that with Latex proper, either), so I put some css directly into the markdown file at the very top:

<style>math[display="block"] {display:block;padding-left:4em;} </style>