You can use MultiMarkDown comments ("<! - your LaTeX code inside โ") with Pandoc when you conclude a Pandoc command in which you convert markdowns to LaTeX with two sed commands.
In the first sed experiment, you change the MultiMarkDown comments to "\ verb + AAAAAAALaTeX-StuffZZZZZZ +". Then you turn into LaTeX with Pandoc, as usual, everything inside "\ verb + AAAAAAALaTeX-StuffZZZZZZZ +" stays alone. Then you run sed in the TeX file and delete "\ verb + AAAAAAA" and "ZZZZZZ +", deploying your LaTeX code.
The first sed command line before the Pandoc conversion might look like this:
sed -E -e "s/<\\!--(.+)--\\>/\\\\verb\+AAAAAAA\1ZZZZZZZ\+/g " \ source.md > source.i.md
Then use Pandoc on source.i.md, as usual, to create source.tex. The second sed works as follows:
sed -E -e "s/\\\\verb\+AAAAAAA(.+)ZZZZZZZ\+/\1/g" -i "" source.tex
I automated everything in the Makefile so that I can make more changes, for example. to define tables in one step. At first glance, this approach works just fine (tested it for definitions of columns with a ray class).
With these little sed scripts, you can use all the nice things from Pandoc. You only need to mmd-comment on those TeX and LaTeX commands that either escape or cover large parts of your Markdown.
Martin May 03 '13 at 19:32 2013-05-03 19:32
source share