clean-text-allow-latex.xslt behavior

I have altered line 40 of xhtml2latex.xslt to read:

<xsl:import href="clean-text-allow-latex.xslt"/> 

However, I notice that the character:


and the combination:


are not being passed through unscathed. AFAIK, the ampersand is still being escaped, and I’m not really sure what is happening to multiple backslashes. I just realized that I can get around \ by using a double space at the end of the line in MMD, but the behavior of & is a real problem for including raw LaTeX tables.

Furthermore, if I escape the & in Scrivener by typing


it’s ‘re-escape’ by MMD leads to


so it is not escaped in the LaTeX output, leading to ‘Misplaced alignment tab character’ errors.

This made we wonder, is this a bug of MMD? A feature? Is there some other place I should be using clean-text-allow-latex.xslt? Or is there something I just don’t get?

Any help gratefully received…


Have you tried using the XHTML comment method? That is how I pass all LaTeX through the system. MMD won’t touch it at any stage, it just dumps it verbatim into the final .tex file.

Regular text here will be cleaned & converted by the scripts <!-- but this text will come through clean & untouched -->.

Should compile exactly as you see it there, and LaTeX should throw an error since you have a bare & in a paragraph. The first ampersand will “…be cleaned & converted…”

No, I haven’t tried that yet, partly since I’m reluctant to XHTML:markup the LaTeX:markup in my MMD:markdown 8) But it’s great to know I can if I need to, since it is such a pragmatic solution, and I really appreciate that it’s available. Part of why I trust the whole MMD approach.

Short of that, I’m just trying to get a sense of how much LaTeX is allowed by allow-latex.