Skip to content

Markdown, Pandoc, Mou and LaTeX

For those that haven’t guessed already, Markdown is my new thing. It’s a fantastic little language that allows you to quickly write HTML and XHTML without knowing HTML!

Writing with it is quite natural (for those fans of Reddit, it’s the code method used to write replys) as it’s fairly simple.

# Item

gives a headline.

**item**

gives bold text etc etc.

After using it for a bit in Reddit, I found Mou Offsite Link, a Markdown editor for Mac that lets you type on one side of the window whilst in realtime, updating the HTML preview on the right. Simple, easy and elegant. I started using this for writing in Evernote Offsite Link. Write a note in Mou, which is simple, easy and quick (without worrying to much about the formatting) then copy and paste the right side into Evernote for an awesome looking note (at least it is until it syncs to the server – workaround is to export the HTML to a normal HTML, open in a browser and copy into Evernote from there – not so pretty and a bit long winded – have asked Evernote why it’s a problem)

In terms of quickly formatting a block of text, Markdown is pretty damn good. So much so, it got me thinking. Could it be used for academic writing? Turns out with another program, it can! Using pandoc Offsite Link, you can easily convert Markdown into LaTeX. The output is actually pretty impressive! Better than I have expected from cnversion software anyhow!

For example, we can take the help file from Mou as an example. It’s Markdown for a section is this Offsite Link. This corresponds to this in an HTML (what you see in a browser) which is this Offsite Link. Not to shabby. Load up pandoc and use the command

pandoc -s file.html -o file.tex

to convert the HTML file into a LaTeX file and you get the following LaTeX code Offsite Link. The -s flag means standalone and thus it adds the required preamble to the LaTeX document. This is then converted into PDF in the LaTeX editor (and with a few flaws, thanks to the .ico file type used by Mou in the help file which is unrecognised by LaTeX) you get this Offsite Link as the output.

As you can see, it’s a pretty good representation in LaTeX to the HTML file.

Conclusion

I use LaTeX to write my reports in – most, if not all get formatted and written in LaTeX using the new, but excellent, Texpad Offsite Link. This app is fantastic but remembering LaTeX commands can be a pain and it’s also slow at times when all you need to do is write down a draft. Once you start adding references etc, LaTeX starts to shine.

However, for the drafting process, using Markdown and Pandoc can speed up the crucial part of putting words on sheets and pandoc means that converting from Markdown to LaTeX will require as little possible time for the end user. Which can only be a good thing at the end of the day!

Published inUncategorised

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *