Enable mathematical formulas in doc strings
Brought to you by:
edloper
For html output this seems to be quite easy to achieve
when using ASCIImathML or LaTeXMathML since both are
just javascript libraries. It would be a nice addition
for scipy / numpy related stuff.
ASCIImathML:
http://www1.chapman.edu/~jipsen/mathml/asciimath.html
LaTeXMathML
http://www.maths.nottingham.ac.uk/personal/drw/lm.html
Regards,
David
Logged In: YES
user_id=1053920
Originator: NO
The folks at ScyPy are planning to use Epydoc for their documentation, and of course they posed the question of how to represent math formulas :)
Here is a couple of pointer about the issue:
- http://projects.scipy.org/scipy/numpy/wiki/DocstringStandards
- http://article.gmane.org/gmane.text.docutils.user/3482
I think math support into docutils is still very experimental (the whole docutils are), but they are receiving much pressure to enable math in reST.
Logged In: YES
user_id=1053920
Originator: NO
Using the latex directive found at
http://docutils.sourceforge.net/sandbox/latex_directive/latex_directive.py
i could indeed typeset math in docstrings.
In html it worked; in latex the file i tried crashed instead. The png's were created in the wrong directory and i had to move them in the proper one by hand.
...said this, it worked like a charme :)
The following patch is required to register the directive. You must also add a line:
'latex':latex'
in the roles dictionary in the site-packages/docutils/parsers/rst/languages/en.py file.
Regards,
Daniele
--- src/epydoc/markup/restructuredtext.py (revision 1437)
+++ src/epydoc/markup/restructuredtext.py (working copy)
@@ -83,6 +83,9 @@
import docutils.transforms
import docutils.utils
+import latex_directive
+latex_directive.register()
+
from epydoc.compat import * # Backwards compatibility
from epydoc.markup import *
from epydoc.apidoc import ModuleDoc, ClassDoc