=B3=AF=AC=E8=BF=CB wrote on 2003-11-14:
> Dear all: Does the docutils have any way to express formula? Since
> there often are formulas in document, I wonders the docutils how to
> deal with about this issue.
No built-in way, yet. The main issue is that HTML provides no
built-in way to exress formulas; there is MathML but its rendering is
still quite borken (or absent) on most browsers. For HTML output the
most popular and usable way is still using images (typically generated
by TeX). That's somewhat too dirty to include into docutils [IMHO].
Besides, the syntax of TeX doesn't blend too cleanly into docutils.
Old eqn had a much better syntax style; EZMath is an interesting
development to watch...
If you use LaTeX output only, a simple way is to write::
=2E. raw:: latex
$your formula here$
You can also use subsitutions to make it inline.
I've written some preprocessing scripts (grab all three files at
http://docutils.sourceforge.net/sandbox/cben/rolehack/) for making
this much easier::
Just write :texmath:`formula` or simply `formula` for inline
formulas; for display formulas use a directive:
.. texmath:: formula
Now you take this (in file foo.txt) and run::
mathhack.py foo.txt | rst2latex.py - foo.tex
which converts the roles/directives to ``raw:: latex`` directives or::
imgmathhack.py foo.txt | html.py - foo.html
which runs TeX (generating images into a subdirectory!) and converts
the roles/directives into ``img::`` directives. Quick, dirty and
Note that the later scripts relies on some external commands (see the
comments at its top). `tex_to_images` seems to be separately
Also note that the scripts you regexps to "parse" the
roles/directives, so expect some bugs (e.g. don't try to split a
formula into multiple lines inside a table cell...).
Beni Cherniavsky <cben@...>
Note: I can only read emails on week-ends...