Angus McMorland wrote:
> Hi Mike et al,
>
> Thanks for the reply.
>
> 2008/12/15 Michael Droettboom <md...@stsci.edu>:
>   
>> You don't need the $.  In fact, an unescaped $ in a math expression is a
>> syntax error.
>>
>> Admittedly, the feedback about this could be better than just "couldn't
>> render".  I'll look at passing more information about the exception back to
>> Sphinx.
>>
>> Note also, you'll want a slash in front of \alpha in order to get Greek,
>> rather than "alpha".
>>     
>
> I think I've copied the usage suggested by the 'writing mathtext' page
> in the mpl documentation (i.e. looking at its rst source [1]). That is
> to say, the appearance of $ and the lack of \ are produced by the
> extension, and not by me.
>   
I see what you're saying now.  Sorry for the assumption.
> With this docstring:
>
>     """
>     Test docstring with :math:`\alpha`
>
>     and longer
>
>     .. math::
>
>         \alpha = 2
>
>     """
>   
You'll need to use raw strings (prefix the """ with an r) so that the \a 
will appear in the final string.
> I get this error:
>
> writing output... index modules/calculate
> /usr/lib/python2.5/site-packages/sphinx/ext/sphinxext/mathmpl.py:107:
> Warning: Could not render math expression $lpha$
>   Warning)
> /usr/lib/python2.5/site-packages/sphinx/ext/sphinxext/mathmpl.py:107:
> Warning: Could not render math expression $lpha = 2$
>   Warning)
>
> I've just redownloaded the sphinx extensions from matplotlib svn, so
> they're definitely all the latest versions.
>   
That doesn't seem to be the root of this problem, however, as these strings 
should at least render to *something*, though probably not what you want.

The warning is hiding the real error here.  In mathmpl.py, after the line where 
the warning is emitted:

            warnings.warn("Could not render math expression %s" % latex,
                          Warning)

Add the line:

            raise

and then post the output to this list?

Thanks,
Mike

Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to