Angus McMorland wrote:
>>> 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)
>>>       
>
> Excellent - the use of raw docstrings _does_ fix the errors during the
> sphinx build.
>
>   
>> 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?
>>     
>
> Just an FYI so you can probably tell what was going on, without the
> curative r'', and with raise in place, the error reported was:
>
> 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)
> Exception occurred:
>   File "/usr/lib/python2.5/site-packages/matplotlib/mathtext.py", line
> 1963, in raise_error
>     raise ParseFatalException(msg + "\n" + s)
> ParseFatalException: Expected end of math '$'
> $lpha$ (at char 0), (line:1, col:1)
>   
Thanks -- that's a good clue, though I'm still not sure why it's 
failing.  Glad to see you have it working for the time being anyway.
> Next, I initially got no pictures (a silent fail) in my browser, but I
> traced that back to an assumption that mathmpl makes that sphinx-build
> is being run from the html directory, whereas I was running it from
> one higher up the hierarchy (my docs directory). Running sphinx-build
> from the appropriate location makes it all work.
>
> Obviously this is fine for mpl's needs (and mine too, now I know the
> tricks). If, however, you're interested in making this a little more
> robust for general usage, then the path handling probably needs
> tweaking. I think the problem is that mathmpl.latex2html puts the
> _static directory in the current directory sphinx-build is run from,
> whereas in the html it points to '../_static/', which is not the same
> thing whenever html pages are being rendered at deeper directory
> levels.
>
>   
For clarification, the matplotlib doc build creates the images within 
the doc/ directory and then copies them to the build.  But that's not 
ideal either -- I agree the "file handling" stuff needs to be improved.

Long term, I think I'll need to look at what the new(ish) math 
extensions in the sphinx core do and emulate that.  Just haven't found 
the time to get around to it lately.

Cheers,
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