LaTeX in Markdown

Johannes Grosse jgrosse at mppmu.mpg.de
Fri Sep 23 04:55:58 EDT 2005



* Faisal N Jawdat wrote:

> do you have any plan to turn this into some sort of module or something?

Umm, I must confess this is only my second perl program.
I've done lots of php and c stuff before but I don't know anything about
how to write modules (yet).

* Dr. Drang wrote:

> [... mentioning ASCIIMathML and jsMath ...]

> An advantage of both is that 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).

That's a major advantage. My solution requires to set the commandline
parameters of textogif to an appropriate resolution before you
ever think about the size of the HTML fonts.
But then you still have the problem that A. Pagaltzis mentions below:

* A. Pagaltzis wrote:

> You may also want to have a look at [\TtH][1], the TeX to HTML

> translator. I don't know how well it works for really complex

> equations (or arbitrary TeX), but it does an excellent job for my

> needs, and I love not having to litter my directories with heaps

> of offensively badly rendered tiny images.


Yeah, I hide the tons of images in a .images-texdown directory but
still...

Anyway, thank you for the link. TtH works fine for my home machine, but
on my workplace I do not have the possibility to install the
required fonts. I *do* like software which runs out of the box
and I was allowed to include textogif in a tar bundle.
(I also included Markdown.pl together with its license and readme.)

I chose textogif (which also produces png!) because it is
written in perl and quite tiny; at least if you
neglect the full LaTeX distribution it requires.
(But keep in mind, that most of the time I mail to people who
have a latex distro anyway -- it comes with the job.)

Nevertheless, the commandline which actually does the translation
is fully configurable by a configuration file. (I confess the
config file reader is completely untested and will probably
not work, yet.)
In any case *it should be very easy to change the tex converter*.
(For example, by editing the line which sets the default value
in the source, in case the config file does not work.)
In future versions, there should be a set of ready-to-use
config files for tth, textogif, mimetex etc.

In principle it is also possible to use different programs
like gnuplot (though some latex stuff is hardwired at the moment),
but the problem is that one has to assign a type to the tags like
`%gnuplot: ... %`.
Then all the beauty gets lost in creeping featuritis - a problem
I already see with the current solution, though John Gruber
kindly objected:

* On Thu, 22 Sep 2005, John Gruber wrote:

> * Johannes wrote:

> > I know it's against the design goals of Markdown, but [...]

> I would say it's well *within* the design goals of Markdown. Doing

> it as a separate step keeps it simple and keeps it separate. I think

> it's a neat idea.


Thank you, I'm flattered and cajoled (says LEO - I'm not convinced
this is the right phrase :)).

As you might have noticed, as a step towards the Markdown
philosophy I introduced a slight change in the syntax compared to
the syntax mentioned in my last post:

Inline tex commands now look like this: `% a^2 + b^2 %` and this
is a latex display:

%% a^2 + b^2

Of course you see the intention: The TeXdown source is now
also a valid Markdown source. I was able to feed my example
page into Markdown.pl without producing errors. The result
is perfectly readable though the latex commands look a bit ugly
as they are not rendered.

BTW. I was too stupid to escape the backticks, so I had to
use an ugly html hex entity. What is the right way to
do it?
\`% ... %\` did not do the job for me.

-Johannes


More information about the Markdown-Discuss mailing list