LaTeX in Markdown

Dr. Drang drdrang at gmail.com
Thu Sep 22 12:26:09 EDT 2005


On Sep 22, 2005, at 4:27 AM, Johannes Grosse wrote:


> I wrote a small filter program which allows

> the inclusion of arbitrary LaTeX commands in

> a Markdown document by extracting them to

> separate TeX files, calling a conversion script

> (by default textogif by John Walker) and replacing

> the TeX commands by a suitable image link in

> Markdown syntax. (I.e. the output of my filter

> is a regular Markdown document.)

>

> So full conversion works like this

>

> TeXdown.pl mydoc.text | Markdown.pl > mydoc.html

>


This seems like a nice tool for generating static pages for screen
display. Including equation numbers is a nice touch.

I've been experimenting with Markdown in combination with two other
equation-handling programs: [ASCIIMathML][1] and [jsMath][2]. Both
are written in JavaScript and transform an HTML document on the fly.
ASCIIMathML takes either TeX or a more simplified math markup syntax
and creates Presentation MathML. I haven't looked deeply into jsMath,
but it appears to do its own typesetting of TeX equations based on
the metrics of the Computer Modern font.

In my tests, I've been running my file through Markdown first,
protecting the equations by enclosing them in <amath></amath> or
<tex></tex> tags, then replacing the tags with what ASCIIMathML or
jsMath require as equation delimiters. This is similar to what
Johannes Grosse is doing in that Markdown itself is not altered, but
my filters are applied in the opposite order because the JavaScript
has to be the last in line.

The advantages of ASCIIMathML are that it has a simpler syntax than
TeX, which is more in keeping with Markdown, and it creates a
standard MathML output. The disadvantage is that MathML is not
universally supported--Mozilla and Firefox support it, but their
recent versions for the Mac have bugs that screw up the output,
forcing me to use Mozilla 1.2.

The advantage of jsMath is that it works now in most browsers. The
disadvantage is that it will turn into an anachronism when (if?)
MathML gets better support.

An advantage of both is that the the equations they produce will
scale with the font size of the page and will print at high
resolution (if you have the right fonts installed).

I've been meaning to write up a description of these tools in [my
blog][3], and show how I've combined them with Markdown, but I
haven't gotten around to it. Maybe in the next day or two...

[1]: http://asciimathml.sourceforge.net/
[2]: http://www.math.union.edu/~dpvc/jsMath/welcome.html
[3]: http://www.leancrew.com/all-this

--
Dr. Drang




More information about the Markdown-Discuss mailing list