Quantcast

[IPython-User] mathjax

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[IPython-User] mathjax

Francesco Montesano
Dear all,

As clearly stated, ipython notebook uses mathjax for rendering latex and the default behaviour is to use a online location for mathjax. If you want to install it you have to do:

from IPython.external.mathjax import install_mathjax
install_mathjax()

The "problem" with it is that it install mathjax on the ipython directory.

My work and laptop computers (kubuntu 12.04 and 12.10) have already installed a 'libjs-mathjax' from the ubuntu repo. Is this mathjax different from the one used by ipython. 
If yes: what is the difference?
if not: why Ipython does not use the system mathjax if available. If this is the case, it looks to me redundant, in particular if mathjax is a large package

Cheers.

Francesco

_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax

Matthias Bussonnier

Le 19 févr. 2013 à 11:17, Francesco Montesano a écrit :

Dear all,

As clearly stated, ipython notebook uses mathjax for rendering latex and the default behaviour is to use a online location for mathjax. If you want to install it you have to do:

from IPython.external.mathjax import install_mathjax
install_mathjax()

The "problem" with it is that it install mathjax on the ipython directory.

My work and laptop computers (kubuntu 12.04 and 12.10) have already installed a 'libjs-mathjax' from the ubuntu repo. Is this mathjax different from the one used by ipython. 
If yes: what is the difference?
if not: why Ipython does not use the system mathjax if available. If this is the case, it looks to me redundant, in particular if mathjax is a large package

Hi Francesco. 

Yes IPython can use the package mathjax, we just not configure it to do so, it is the responsibility of the maintainer of each distribution to do so. 
I suppose libjs-mathjax should be fine.

Still you should be able to use the following configuration flag : 

c.NotebookApp.mathjax_url
c.NotebookApp.extra_static_paths

To provide the correct information to IPython in order to use it. 

Does this help you ?

-- 
Matthias



Cheers.

Francesco
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax

Thomas Kluyver-2
In reply to this post by Francesco Montesano
On 19 February 2013 10:17, Francesco Montesano <[hidden email]> wrote:
if not: why Ipython does not use the system mathjax if available. If this is the case, it looks to me redundant, in particular if mathjax is a large package

I wonder if there's anything we can do to make this sort of thing work better, i.e. with less changes required in packaging.

Thomas


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax

Julian Taylor-3
On 02/19/2013 04:07 PM, Thomas Kluyver wrote:

> On 19 February 2013 10:17, Francesco Montesano
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     if not: why Ipython does not use the system mathjax if available. If
>     this is the case, it looks to me redundant, in particular if mathjax
>     is a large package
>
>
> See also the patch in the Ubuntu IPython packages to use the
> system-installed mathjax:
>
> http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/raring/ipython/raring/view/head:/debian/patches/use-system-mathjax-if-available.patch
>
> I wonder if there's anything we can do to make this sort of thing work
> better, i.e. with less changes required in packaging.
>

for reference, above patch is for 0.13.1, here is the patch that applies
to git HEAD:

http://bazaar.launchpad.net/~jtaylor/ipython/debian-daily/view/head:/debian/patches/use-system-mathjax-if-available.patch
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax

Francesco Montesano
Hi,

sorry for coming back so late to the topic (the problem hit me again today)
 
In my ipython_notebook_config.py I've uncommented and added the path

c.NotebookApp.mathjax_url = '/usr/share/javascript/mathjax/MathJax.js'

But the notebook tells me "Failed to retrieve MathJax from /usr/share/javascript/mathjax/MathJax.js"

Then I've searched for "c.NotebookApp.extra_static_paths" but I couldn't find it in the config file, so I've added the following line after mathjax_url
c.NotebookApp.extra_static_paths = '/usr/share/javascript/mathjax/MathJax.js'.

But still does not work.

Any suggestion?

Francesco





2013/2/19 Julian Taylor <[hidden email]>
On 02/19/2013 04:07 PM, Thomas Kluyver wrote:
> On 19 February 2013 10:17, Francesco Montesano
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     if not: why Ipython does not use the system mathjax if available. If
>     this is the case, it looks to me redundant, in particular if mathjax
>     is a large package
>
>
> See also the patch in the Ubuntu IPython packages to use the
> system-installed mathjax:
>
> http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/raring/ipython/raring/view/head:/debian/patches/use-system-mathjax-if-available.patch
>
> I wonder if there's anything we can do to make this sort of thing work
> better, i.e. with less changes required in packaging.
>

for reference, above patch is for 0.13.1, here is the patch that applies
to git HEAD:

http://bazaar.launchpad.net/~jtaylor/ipython/debian-daily/view/head:/debian/patches/use-system-mathjax-if-available.patch
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax

Matthias Bussonnier

Le 5 mars 2013 à 21:45, Francesco Montesano a écrit :

> Hi,
>
> sorry for coming back so late to the topic (the problem hit me again today)
>  
> In my ipython_notebook_config.py I've uncommented and added the path
>
> c.NotebookApp.mathjax_url = '/usr/share/javascript/mathjax/MathJax.js'

Here you need to put the Mathjax **URL** that the notebook should fetch.
It's will either be a full url or relative.

> But the notebook tells me "Failed to retrieve MathJax from /usr/share/javascript/mathjax/MathJax.js"
>
> Then I've searched for "c.NotebookApp.extra_static_paths" but I couldn't find it in the config file, so I've added the following line after mathjax_url
> c.NotebookApp.extra_static_paths = '/usr/share/javascript/mathjax/MathJax.js'.

Static Path should be a list of **folder**.
be carefull to keep the default folder if you add others.

So IMHO, you should

> c.NotebookApp.extra_static_paths = ['/usr/share/', default_folder]

meaning that anything under
> /usr/share/<something>

will be accessible as /static/<something> URL

so I would put:

> c.NotebookApp.mathjax_url = '/static/javascript/mathjax/MathJax.js'


--
Matthias
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax

Francesco Montesano
Hi Matthias

2013/3/5 Matthias BUSSONNIER <[hidden email]>

Le 5 mars 2013 à 21:45, Francesco Montesano a écrit :

> Hi,
>
> sorry for coming back so late to the topic (the problem hit me again today)
>
> In my ipython_notebook_config.py I've uncommented and added the path
>
> c.NotebookApp.mathjax_url = '/usr/share/javascript/mathjax/MathJax.js'

Here you need to put the Mathjax **URL** that the notebook should fetch.
It's will either be a full url or relative.

> But the notebook tells me "Failed to retrieve MathJax from /usr/share/javascript/mathjax/MathJax.js"
>
> Then I've searched for "c.NotebookApp.extra_static_paths" but I couldn't find it in the config file, so I've added the following line after mathjax_url
> c.NotebookApp.extra_static_paths = '/usr/share/javascript/mathjax/MathJax.js'.

Static Path should be a list of **folder**.
be carefull to keep the default folder if you add others.

So IMHO, you should

> c.NotebookApp.extra_static_paths = ['/usr/share/', default_folder]

meaning that anything under
> /usr/share/<something>

will be accessible as /static/<something> URL

so I would put:

> c.NotebookApp.mathjax_url = '/static/javascript/mathjax/MathJax.js'


Thank you for the answer. I have modified my python_notebook_config.py as you suggest

15 c.NotebookApp.extra_static_paths = ['/usr/share/', default_folder]
16 c.NotebookApp.mathjax_url = '/static/javascript/mathjax/MathJax.js'

but it says that it fails to retrieve mathjax from http://cdn.mathjax.org/mathjax/latest/MathJax.js

Francesco
 

--
Matthias
_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user


_______________________________________________
IPython-User mailing list
[hidden email]
http://mail.scipy.org/mailman/listinfo/ipython-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax not working in ipython notebook

Buguen
Hi,

I have the same problem with mathjax I can't fix.
I can't succeed to have mathjax working in the notebook

I am working with the master branch of ipython 1.0-dev
I have recently upgraded to ubuntu 12.04
I have upgraded pyzmq and tornado.

# The url for MathJax.js.
c.NotebookApp.mathjax_url = '/javascript/mathjax/MathJax.js'
#c.NotebookApp.mathjax_url = 'http://cdn.mathjax.org'   # not working
#c.NotebookApp.mathjax_url = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js'


c.NotebookApp.enable_mathjax = True

# Extra paths to search for serving static files.
#
# This allows adding javascript/css to be available from the notebook server
# machine, or overriding individual files in the IPython
c.NotebookApp.extra_static_paths = ['/usr/share',default_folder]

I have also applied the patch in notebookapp.py

But still i can't manage to have Mathjax working.

I am stucked and I would appreciate suggestion on what's happening.

Bernard
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: mathjax not working in ipython notebook

Buguen
Hi,

The problem is now fixed.  

I got that the local mathjax directory is now in $HOME/.config/ipython/profile_default/static

It is no longer required to sudo ipython for executing install_mathjax()


Bernard
Loading...