[SciPy-dev] [Docutils-users] Fwd: [sage-devel] numpy in SAGE, etc.

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Wed Dec 20 07:10:09 CST 2006


On Tue, 2006-12-19 at 15:34 -0500, David Huard wrote:
> If I understand correctly, I'd have to add the latex-math
> role to rst/roles.py and the latex-math directive to the 
> rst/directives directory and register it in the __init__. However, the
> directives defined in Jens' sandbox are writer specific, so I'm a bit lost.

You will have to merge the code from rst2mathml.py and rst2latexmath.py.
I would start from the code in rst2mathml.py, where the node class
(latex_math) will have to be changed to something like this:

class latex_math(nodes.Element):
    tagname = '#latex-math'
    def __init__(self, rawsource, mathml_tree, latex):
        nodes.Element.__init__(self, rawsource)
        self.mathml_tree = mathml_tree
        self.latex = latex

Also the latex_math_role function and the latex_math_directive class
will have to be modified a bit to use the new node class.  

And then the visit/depart methods should be added to the writers.

Hope that helps,
Jens Jørgen

> A little bit of context: 
> The SciPy and NumPy folks are looking at the
> various documentation systems out there to build the API documentation
> and tutorials. Up to now, the combination epydoc+reST seems to most
> powerful. However, Latex formulas are a must for those packages and the
> raw role is a bit low-level for our needs, hence the interest in
> including the latex-math role and directive in the trunk so that epydoc
> can run smoothly using it.   




More information about the Scipy-dev mailing list