On Wed, Aug 25, 2010 at 12:12 AM, TP <wing...@gmail.com> wrote:
> On Tue, Aug 24, 2010 at 4:04 PM, Fernando Perez <fperez....@gmail.com> wrote:
>> On Tue, Aug 24, 2010 at 2:58 PM, Kevin Dunn <kgd...@gmail.com> wrote:
>>>
>>> You can compare how the same HTML page is shown with MathJax or with
>>> Sphinx's built-in pngmath extension:
>>> * mathjax: http://connectmv.com/mathjax-extension/with-mathjax.html
>>> * pngmath: http://connectmv.com/mathjax-extension/with-pngmath.html
>>>
>>> MathJax shows better, and the HTML can also be zoomed, and the math
>>> will zoom clearly, unlike PNG.
>>
>> Wow, beautiful.  Many thanks for posting this, I'm sure I'll be making
>> good use of it soon.
>>
>> Regards,
>>
>> f
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sphinx-dev" group.
>> To post to this group, send email to sphinx-...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sphinx-dev+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/sphinx-dev?hl=en.
>>
>>
>
> I've just tried mathjax on Windows XP with Sphinx 1.0.3 and ran into a
> two problems. First of all, when testing html files on my local
> computer, I couldn't figure out how to get
>
>  mathjax_path = '/MathJax/MathJax.js'
>
> in my conf.py to work. At least I couldn't figure out where Firefox
> 3.6.8 thought /Mathjax was (it apparently wasn't C:\Mathjax). So I
> changed to:
>
>  mathjax_path = 'file:///C:/MathJax/MathJax.js'
>
> but ran into problems with Sphinx 1.0.3 that are reported and "fixed"
> at 
> http://bitbucket.org/birkenfeld/sphinx/issue/513/add_javascript-relative_uri-dont-support-local-file-url-syntax-in-sphinx
> (the solution is a hack but it works).
>
> I also had to install the mathjax fonts in
> \MathJax\fonts\HTML-CSS\TeX\otf\ by following the instructions given
> at http://www.mathjax.org/resources/faqs/#image-fonts to get Firefox
> to work with my local test files. Otherwise I got a message that my
> browser didn't support "web-based fonts".
>
> Now all I have to do is figure out how to use TeX :P
>

More notes on using MathJax with Sphinx 1.0.3 on Windows:

I decided it was better for local testing and sharing of the
preliminary builds to copy the MathJax folder to my Sphinx projects
_static directory rather than using it from C:\MathJax. Because it
takes up over 120MB(!) of disk space on Windows (only 16MB of that is
the total files size but all those tiny png files take lots of room),
I removed the docs, test, unpacked directories, and most importantly,
disabled image fonts by following the advice of
http://www.mathjax.org/resources/faqs/#fonts-too-big and deleting the
fonts\HTML-CSS\TeX\png directory.

My conf.py file has the following mathjax_path for local testing:

  mathjax_path = 'MathJax/MathJax.js'

which correctly points to _static/MathJax/MathJax.js in the generated HTML.

It now takes a annoyingly long time to copy the entire _static
directory (still about 4MB in 440 files) every time I do a make. I
couldn't find any way to tell Sphinx not to bother copying the _static
directory? Once I've done a full make it doesn't change so copying the
entire thing over & over is unnecessary.

Additionally, as http://www.mathjax.org/resources/faqs/#ie8-slow says,
you need to add the following to the beginning of the <head> tag in
order for Internet Explorer 8 not to be ridiculously slow when
displaying pages with MathJax (even only small amounts):

    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">

I spent awhile looking in the source code for how to add meta tags
using Sphinx (hint: you can't use the extrahead template block because
that comes too late in the <head> tag).

As it turns out, all you need to do is use the following docutils meta
directive (http://docutils.sourceforge.net/docs/ref/rst/directives.html#meta)
at the top of each .rst file that contains MathJax code.

.. meta::
   :http-equiv=X-UA-Compatible: IE=EmulateIE7

If you have lots of pages with MathJax, you could alternatively put
the above in the new rst_prolog setting
(http://sphinx.pocoo.org/config.html#confval-rst_prolog) in your
conf.py file.

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-dev" group.
To post to this group, send email to sphinx-...@googlegroups.com.
To unsubscribe from this group, send email to 
sphinx-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sphinx-dev?hl=en.

Reply via email to