Okay, this sucks a little. I write math in LaTeX in my Markdown documents. Pandoc can easily translate that when generating PDF files, that goes through LaTeX anyway so is just used verbatim, or when generating ePub files, where it is translated to mathjax.
Right now I am using Ulysses to write but still use Pandoc to compile my documents — I need to use both knitr and pandoc to evaluate my embedded R code and I have more control over the generated PDF output — so I just write in Ulysses and export the Markdown before compiling. I wish that was easier, but it isn’t. I can live with that, though.
The problem is that Ulysses removes backslashes when it exports, for some reason. Ok, I thought, then I will just escape them and write two backslashes when I want a single one. That is how it is usually done, after all.
Not so with Ulysses. An escaped backslash is exported as two backslashes. A single is simply removed.
It is not a major biggie because I run my Markdown files through gpp to do conditional compilation (I need slightly different options to knitr when generating PDF files from when I generate ebooks) and it already eats up one of the backslashes — something I fix with sed. Now I can just remove the sed step and always write two backslashes, I guess.
It just means that I won’t be importing my Data Science book into Ulysses ‘cause I don’t want to go through the hassel of rewriting all the equations there just to get it to work. For my future writing I just have to keep in mind that I must escape all backslashes and always run the documents through gpp.
The workflow is not made easier by this, but it is a small change to my Makefile. Annoying, though.