From: Mukund D. <muk...@ho...> - 2003-01-24 01:32:02
|
Hi, 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. The inline math is enclosed in '$' and here is an example of it, Given the HMM model ($\lambda$ = (A, B, $\pi$)) and a sequence of symbols $O = <O_1, O_2, \dots ,O_T>$, what is the probability that this sequence was generated by the model ? If I want to write equations that won't fit on a line then I go with the display math option for example, \[\alpha_t(i) = P(O_1, O_2, \dots O_t, q_t = S_i \lambda)\] Here the math is enclosed in \[ and \]. Both these options are currently supported by itex2mml. So if you give itex2MML an html document with these tags it will convert them to mathML. About your suggestion I think I will use the tex-math:: directive for displaying equations that won't fit in a line, but using it for inline might be a bit cumbersome. 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. Let me see if I can implement the tex-math:: directive and tie it with itex2mml. I will keep you posted... Thanks, Mukund >From: David Goodger <go...@py...> >To: Mukund Deshpande ><muk...@ho...>,<doc...@li...> >Subject: Re: [Docutils-users] Adding Math to reStructuredText >Date: Wed, 22 Jan 2003 16:10:47 -0500 > >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 self-contained 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 >"tex-math" 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 MathML-to-bitmap >rendering tool could be used, and the resulting image inserted into the >document. For example:: > > .. tex-math:: > > (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 _________________________________________________________________ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail |