Home

Recent
Archive

Numerical experiments, Tips, Tricks and Gotchas

Numerically speaking

IPython nbconvert mathjax fix

Problem

Rendering of LaTex in IPython nbconvert appears to be broken [1]. I discovered this when I converted a notebook to HTML.

The fix for slides in the IPython 2.x series was suggested [2].

This perfectly works for HTML as well. It is necessary just to edit mathjax.tpl. In my case the template is located in

C:\Anaconda3\Lib\site-packages\IPython\nbconvert\templates\html\

Fix

Replace

<script src="https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>

with

<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>

 

References

  1. IPython LaTeX math not rendered in HTML using nbconvert.
  2. Temporary fix for mathjax problem with slides in the IPython 2.x series.

 

© Nikolai Shokhirev, 2012-2017

email: nikolai(dot)shokhirev(at)gmail(dot)com

Count: