Gmane
Favicon
From: David Goodger <goodger <at> python.org>
Subject: Re: Adding Math to reStructuredText
Newsgroups: gmane.text.docutils.user
Date: 2003-01-24 02:55:48 GMT (6 years, 23 weeks, 23 hours and 27 minutes ago)
Mukund Deshpande wrote:
> Thanks for a detailed response. Let met give some examples, I am mainly
> using math in two ways  (i) inline math and (ii) math displayed on its own.

I didn't realize that "itex" was a separate dialect of TeX.  I found a
description of itex at
<http://pear.math.pitt.edu/mathzilla/itex2mmlItex.html>.  For math displayed
on its own I would suggest calling the directive "itex", and implementing it
like this::

    .. itex:: \alpha_t(i) = P(O_1, O_2, \dots O_t, q_t = S_i \lambda)

Since the directive knows its context, the \[ and \] delimiters wouldn't be
necessary.  They could be added on by the directive code before it calls the
itex2MML program, if required.

For inline math, an interpreted text role would be appropriate::

    Given the HMM model (`\lambda`:itex: = (A, B, `\pi`:itex:)) and a
    sequence of symbols `O = <O_1, O_2, \dots ,O_T>`:itex:, ...

Again, the delimting $'s should be left off.  If the default interpreted
text role was set to "itex", the ":itex:" role tags could be left off too.
Eventually there will be a directive and/or command-line option to set the
default role at runtime.

Note though that since Docutils can handle all the text encodings Python
can, you don't really need the "\lambda" and "\pi" markup.  You could simply
use UTF-8 and insert those characters directly.

> MathML is very verbose format so I don't think I will be directly typing
> mathml in any of my documents. I will stick with
> Tex math notation as it is widely used and easy to understand.

Compared to MathML and other math notations, itex does seem easy to
understand, but it's much less readable than the rest of the text and
markup.  But I suppose there's no way around it in this case.

> Let me see if I can implement the tex-math:: directive and tie
> it with itex2mml. I will keep you posted...

Please do, and let us know if you need any help.  The
docutils-develop <at> lists.sf.net mailing list would be the best place for it.

-- David Goodger    http://starship.python.net/~goodger

Programmer/sysadmin for hire: http://starship.python.net/~goodger/cv

-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com