Skip to content

Instantly share code, notes, and snippets.

@juliantaylor
Created December 10, 2011 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juliantaylor/1456031 to your computer and use it in GitHub Desktop.
Save juliantaylor/1456031 to your computer and use it in GitHub Desktop.
use system mathjax
diff --git a/IPython/frontend/html/notebook/notebookapp.py b/IPython/frontend/html/notebook/notebookapp.py
index e7a00c0..7b60934 100644
--- a/IPython/frontend/html/notebook/notebookapp.py
+++ b/IPython/frontend/html/notebook/notebookapp.py
@@ -105,6 +105,11 @@ class NotebookWebApplication(web.Application):
(r"/notebooks/%s" % _notebook_id_regex, NotebookHandler),
(r"/rstservice/render", RSTHandler)
]
+
+ if os.path.exists("/usr/share/javascript/mathjax/MathJax.js"):
+ handlers.append((r"/mathjax/(.*)", web.StaticFileHandler,
+ {"path": "/usr/share/javascript/mathjax"}))
+
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),
static_path=os.path.join(os.path.dirname(__file__), "static"),
@@ -265,7 +270,10 @@ class NotebookApp(BaseIPythonApplication):
if not self.enable_mathjax:
return u''
static_path = os.path.join(os.path.dirname(__file__), "static")
- if os.path.exists(os.path.join(static_path, 'mathjax', "MathJax.js")):
+ if os.path.exists("/usr/share/javascript/mathjax/MathJax.js"):
+ self.log.info("Using system MathJax")
+ return u"mathjax/MathJax.js"
+ elif os.path.exists(os.path.join(static_path, 'mathjax', "MathJax.js")):
self.log.info("Using local MathJax")
return u"static/mathjax/MathJax.js"
else:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment