From: <ds...@us...> - 2008-05-23 16:13:16
|
Revision: 5228 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5228&view=rev Author: dsdale Date: 2008-05-23 09:12:50 -0700 (Fri, 23 May 2008) Log Message: ----------- equation rendering is now working using Jens Mortensen's mathpng extension. The syntax is illustrated in the developers guide, in the "Documenting Matplotlib" section Modified Paths: -------------- trunk/matplotlib/doc/api_reference/conf.py trunk/matplotlib/doc/sphinxext/mathpng.py trunk/matplotlib/doc/users_guide/conf.py trunk/matplotlib/doc/users_guide/documenting_mpl.txt Modified: trunk/matplotlib/doc/api_reference/conf.py =================================================================== --- trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 14:53:33 UTC (rev 5227) +++ trunk/matplotlib/doc/api_reference/conf.py 2008-05-23 16:12:50 UTC (rev 5228) @@ -23,7 +23,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['mathml', 'sphinx.ext.autodoc'] +extensions = ['mathpng', 'sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] Modified: trunk/matplotlib/doc/sphinxext/mathpng.py =================================================================== --- trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-23 14:53:33 UTC (rev 5227) +++ trunk/matplotlib/doc/sphinxext/mathpng.py 2008-05-23 16:12:50 UTC (rev 5228) @@ -95,7 +95,11 @@ os.system('latex --interaction=nonstopmode math.tex > /dev/null') os.system('dvipng -bgTransparent -Ttight --noghostscript -l10 ' + '-o _static/%s.png math.dvi > /dev/null' % name) - path = source.split('/doc/')[-1].count('/') * '../' + '_static' + path = '_static' + count = source.split('/doc/')[-1].count('/') + for i in range(count): + if os.path.exists(path): break + path = '../'+path if inline and '_' in latex: align = 'align="absmiddle" ' else: Modified: trunk/matplotlib/doc/users_guide/conf.py =================================================================== --- trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 14:53:33 UTC (rev 5227) +++ trunk/matplotlib/doc/users_guide/conf.py 2008-05-23 16:12:50 UTC (rev 5228) @@ -27,7 +27,7 @@ # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['mathml', 'sphinx.ext.autodoc'] +extensions = ['mathpng', 'sphinx.ext.autodoc'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] Modified: trunk/matplotlib/doc/users_guide/documenting_mpl.txt =================================================================== --- trunk/matplotlib/doc/users_guide/documenting_mpl.txt 2008-05-23 14:53:33 UTC (rev 5227) +++ trunk/matplotlib/doc/users_guide/documenting_mpl.txt 2008-05-23 16:12:50 UTC (rev 5228) @@ -4,8 +4,7 @@ The documentation for matplotlib is generated from ReStructured Text using the Sphinx_ documentation generation tool. Sphinx-0.4 or later -is required to generate xml files to render mathematical expressions -with mathml. Currently this means we need to install from the svn +is required. Currently this means we need to install from the svn repository by doing:: svn co http://svn.python.org/projects/doctools/trunk sphinx @@ -34,10 +33,25 @@ gets its contents from the CODING_GUIDE file in the trunk: ``.. include:: ../../CODING_GUIDE``. +Mathematical expressions can be rendered as png images in html, and in +the usual way by latex. For example: + +``math:`sin(x_n^2)`` yields: :math:`sin(x_n^2)`, and:: + + .. math:: + + \int_{-\infty}^{\infty}\frac{e^{i\phi}}{1+x^2\frac{e^{i\phi}}{1+x^2}}`` + +yields: + +.. math:: + + \int_{-\infty}^{\infty}\frac{e^{i\phi}}{1+x^2\frac{e^{i\phi}}{1+x^2}} + The output produced by Sphinx can be configured by editing the conf.py files located in the documentation source directories. The Sphinx website contains plenty of documentation_ concerning ReST markup and working with Sphinx in general. -.. _documentation: http://sphinx.pocoo.org/contents.html \ No newline at end of file +.. _documentation: http://sphinx.pocoo.org/contents.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |