Mukund Deshpande wrote:
> Is there any way I can add math symbols/equations in reStructured text ?
> I could not find any mention of math in the reST specs.
No direct math support exists yet (but see below).
> I mainly interested in obtaining HTML (math via mathML) and this
> what I tried. I typed math equations using the TeX markup, by enclosing the
> equations in '$' symbol. After that I used a tool called itex2mml that
> converts anything between $ symbols to mathML.
Please provide a selfcontained sample, along with the commands necessary
for the processing steps.
> Unfortunately, that did not work because reST parser substituted all the '\'
> in the tex equations, is there way to tell the parser to not touch the text
> between two $ signs ?
No direct way, no. I can think of one indirect way and several direct ways
to do what you want.
The best, direct way would be to create a new directive.
If you want TeX notation in your source text files, there could be a
"texmath" directive. For TeX output, the TeX code would be passed through
untouched. For output formats supporting MathML, the TeX code would call
itex2mml and insert the resulting MathML markup into the document. For
output formats that don't support MathML, perhaps a MathMLtobitmap
rendering tool could be used, and the resulting image inserted into the
document. For example::
.. texmath::
(raw TeX math code here)
If you want to use MathML directly, you could use the "raw" directive to
pass the markup through to the HTML writer (and only the HTML writer), like
this::
.. raw:: html
<math xmlns="..."> raw HTML/MathML here </math>
You could use this approach right now.
A new "mathml" directive would be even better. It would be able to take
care of the bookkeeping details details (like the <math> tags, namespaces,
and output format compatibility issues)::
.. mathml::
(raw MathML here)
Finally, there's a quick & dirty indirect way to use TeX code, without any
programming. Use the "raw" directive with the TeX code between "$", and
preprocess the file with itex2mml. (I assume itex2mml removes the "$"
characters? If not, this won't work without another step to remove them.)
::
.. raw:: html
$(raw TeX math code here)$
There may be other associated issues, like declaring a MathML namespace
and/or a DTD declaration. Please provide samples.
 David Goodger http://starship.python.net/~goodger
Programmer/sysadmin for hire: http://starship.python.net/~goodger/cv
