From: <michael.abbott@di...>  20110627 10:48:42

I'm trying to figure out the options for writing equations in reST, and the possibilities appear to be to use either itex2MML or the latexmath plugin from http://docutils.sourceforge.net/sandbox/jensj/latex_math/ However, it seems that the latex generated by rst2latexmath.py (in the tools directory of the link above) is incomplete. For example, running the commands (latex_math.txt from the docs directory): rst2latexmath.py latex_math.txt latex_math.tex pdflatex latex_math.tex complains about undefined symbols. To get latex_math.tex to build I have to apply this patch:  latex_math.tex.original 20110627 09:18:18.000000000 +0100 +++ latex_math.tex 20110627 09:18:43.000000000 +0100 @@ 14,9 +14,19 @@ %%% Custom LaTeX preamble % PDF Standard Fonts \usepackage{mathptmx} % Times +\usepackage{amsmath} +\usepackage{amsfonts} +\usepackage{amssymb} \usepackage[scaled=.90]{helvet} \usepackage{courier} +\let\amalg=\undefined +\let\coprod=\undefined +\DeclareSymbolFont{cmsymbols}{OMS}{cmsy}{m}{n} +\DeclareSymbolFont{cmlargesymbols}{OMX}{cmex}{m}{n} +\DeclareMathSymbol{\amalg}{\mathbin}{cmsymbols}{"71} +\DeclareMathSymbol{\coprod}{\mathop}{cmlargesymbols}{"60} + %%% User specified packages and stylesheets %%% Fallback definitions for Docutilsspecific commands Unfortunately, of course, I'm patching completely the wrong file here! So two questions: 1. How do I modify rst2latexmath.py so that the changes above occur in the generated .tex file? I'm wholly unfamiliar with the docutils plugin mechanism, so pointers to relevant documents will be gratefully received. 2. What's the state of play with equation support in reST, in particular, should I pay more attention to the latexmath plugin or to itex2MML? Or am I missing more recent work? I'm not subscribed to this list, so *please* CC me.  I'm very very sorry, but I can do nothing about the garbage added by my employer below this email :(  This email and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the email and do not use, copy, retain, distribute or disclose the information in or attached to the email. Any opinions expressed within this email are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this email or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom 
From: Guenter Milde <milde@us...>  20110627 21:04:51

On 20110627, <michael.abbott@...> wrote: > I'm trying to figure out the options for writing equations in reST, and > the possibilities appear to be to use either itex2MML or the latexmath > plugin from http://docutils.sourceforge.net/sandbox/jensj/latex_math/ You can also use a recent snapshot of the upcoming release 0.8 that includes math support into the core (incorporating and extending Jens Jörgens latex_math). > However, it seems that the latex generated by rst2latexmath.py (in the > tools directory of the link above) is incomplete. For example, running > the commands (latex_math.txt from the docs directory): > rst2latexmath.py latex_math.txt latex_math.tex > pdflatex latex_math.tex > complains about undefined symbols. To get latex_math.tex to build I > have to apply this patch: >  latex_math.tex.original 20110627 09:18:18.000000000 +0100 > +++ latex_math.tex 20110627 09:18:43.000000000 +0100 > @@ 14,9 +14,19 @@ > %%% Custom LaTeX preamble > % PDF Standard Fonts > \usepackage{mathptmx} % Times > +\usepackage{amsmath} > +\usepackage{amsfonts} > +\usepackage{amssymb} > \usepackage[scaled=.90]{helvet} > \usepackage{courier} I suppose it is documented somewhere that you need to add amsmath and amssymb to the list of stylesheets. The builtin "math" directive and role will automatically load the amsmath package but still requires you to specify amssymb (or an alternative like txfonts) in the stylesheet argument, say :: rst2latex stylesheet=amssymb mathexample.txt mathexample.tex > +\let\amalg=\undefined > +\let\coprod=\undefined > +\DeclareSymbolFont{cmsymbols}{OMS}{cmsy}{m}{n} > +\DeclareSymbolFont{cmlargesymbols}{OMX}{cmex}{m}{n} > +\DeclareMathSymbol{\amalg}{\mathbin}{cmsymbols}{"71} > +\DeclareMathSymbol{\coprod}{\mathop}{cmlargesymbols}{"60} What is the intention of these redefinitions? Are these fixes or defining variants? > Unfortunately, of course, I'm patching completely the wrong file here! > So two questions: > 1. How do I modify rst2latexmath.py so that the changes above occur in > the generated .tex file? I'm wholly unfamiliar with the docutils > plugin mechanism, so pointers to relevant documents will be > gratefully received. Dont, use the development version of Docutils (SVN checkout or daily snapshot). > 2. What's the state of play with equation support in reST, in > particular, should I pay more attention to the latexmath plugin or > to itex2MML? Or am I missing more recent work? Yes. > I'm not subscribed to this list, so *please* CC me. I am not sure whether this works via the Gmane usenet interface... Günter 
From: <michael.abbott@di...>  20110628 07:01:35

From: Guenter Milde [mailto:milde@...] > > +\let\amalg=\undefined > > +\let\coprod=\undefined > > +\DeclareSymbolFont{cmsymbols}{OMS}{cmsy}{m}{n} > > +\DeclareSymbolFont{cmlargesymbols}{OMX}{cmex}{m}{n} > > +\DeclareMathSymbol{\amalg}{\mathbin}{cmsymbols}{"71} > > +\DeclareMathSymbol{\coprod}{\mathop}{cmlargesymbols}{"60} > > What is the intention of these redefinitions? Are these fixes or > defining variants? These are fixes. The problem is that mathptmx doesn't define \amalg, \coprod or \jmath, or more precisely defines them to generate errors. These lines are a fudge to pull in alternative (and perfectly workable) definitions directly from the original computer modern files. These lines are required because latex_math.txt uses \amalg and \coprod. The issue, presumably, is that these symbols don't have postscript forms, and for whatever reason the writers of mathptmx didn't want to do the fudge I'm doing here (despite the fact it works perfectly well, as far as I can tell). For reference, the third symbol \jmath requires these lines: \let\jmath=\undefined \DeclareSymbolFont{cmletters}{OML}{cmm}{m}{it} \DeclareMathSymbol{\jmath}{\mathord}{cmletters}{"7C} > Dont, use the development version of Docutils (SVN checkout or daily > snapshot). Gosh, must be pretty recent: I only checked out my docutils build literally a month ago! > > to itex2MML? Or am I missing more recent work? > Yes. :) Guess I need to do more reading... > > I'm not subscribed to this list, so *please* CC me. > I am not sure whether this works via the Gmane usenet interface... Yes, seemed to get through just fine.  Please disregard stuff below. 
From: Guenter Milde <milde@us...>  20110628 08:53:25

On 20110628, <michael.abbott@...> wrote: > From: Guenter Milde [mailto:milde@...] ... >> > +\DeclareMathSymbol{\amalg}{\mathbin}{cmsymbols}{"71} ... >> What is the intention of these redefinitions? Are these fixes or >> defining variants? > These are fixes. The problem is that mathptmx doesn't define \amalg, > \coprod or \jmath, or more precisely defines them to generate errors. > These lines are a fudge to pull in alternative (and perfectly workable) > definitions directly from the original computer modern files. These > lines are required because latex_math.txt uses \amalg and \coprod. > The issue, presumably, is that these symbols don't have postscript > forms, and for whatever reason the writers of mathptmx didn't want to > do the fudge I'm doing here (despite the fact it works perfectly well, > as far as I can tell). While it works well, it might be too scary for font experts like the mathptmx author(s). But more generally: mathptmx is not suited for serious/heavy math use: 1 mix of Times letters with nonmatching CM nonalphanumerical symbols. 2 no bold. `mathptmx` was chosen as default font package following feature requests because it provides a well known "Base Postscript/PDF font" without further dependencies (LaTeX core package). At this time, there was no math support in Docutils. Anyone using more than just very basic math should also use a different font package. (A survey of free math typesetting packages (in German) with example pages is available at http://milde.users.sourceforge.net/Matheschriften/matheschriften.html.) Best consistency is achieved with stylesheet=lmodern,amssymb. Times can be used with e.g. stylesheet=txfonts or stylesheet=qtxmath. Another recommended choice is Utopia with stylesheet=fourier. Of course the stylesheet can be defined in a config file for a more permanent setting. Then, overwriting the "latex_preamble" is recommended, too. >> Dont, use the development version of Docutils (SVN checkout or daily >> snapshot). > Gosh, must be pretty recent: I only checked out my docutils build > literally a month ago! Strange: the first version was added 20101025 with the commit ``Support mathematics with a "math" role and directive``. Since then, math is documented in the local documentation. However, the documentation at Sourceforge seems to be far behind the current state. 
From: Romulo <romulor3@gm...>  20121030 00:10:07

<michael.abbott <at> diamond.ac.uk> writes: > > From: Guenter Milde [mailto:milde <at> users.berlios.de] > > > +\let\amalg=\undefined > > > +\let\coprod=\undefined > > > +\DeclareSymbolFont{cmsymbols}{OMS}{cmsy}{m}{n} > > > +\DeclareSymbolFont{cmlargesymbols}{OMX}{cmex}{m}{n} > > > +\DeclareMathSymbol{\amalg}{\mathbin}{cmsymbols}{"71} > > > +\DeclareMathSymbol{\coprod}{\mathop}{cmlargesymbols}{"60} > These are fixes. The problem is that mathptmx doesn't define \amalg, \coprod or \jmath, or more precisely > defines them to generate errors. These lines are a fudge to pull in alternative (and perfectly workable) > definitions directly from the original computer modern files. These lines are required because > latex_math.txt uses \amalg and \coprod. > Many, many thanks michael.abbott <at> diamond.ac.uk ! 
From: Guenter Milde <milde@us...>  20121102 21:21:56

BTW: Using rst2latexmath should no longer be required. Docutils supports "math" directive and role out of the box since release 0.8 (20110707). Günter 