diff --git a/IPython/frontend/html/notebook/static/js/cell.js b/IPython/frontend/html/notebook/static/js/cell.js index 4dbb9e6e6..be63097d7 100644 --- a/IPython/frontend/html/notebook/static/js/cell.js +++ b/IPython/frontend/html/notebook/static/js/cell.js @@ -50,15 +50,13 @@ var IPython = (function (IPython) { }); }; - - // typeset with MathJax if MathJax is available Cell.prototype.typeset = function () { if (window.MathJax){ - MathJax.Hub.Queue(["Typeset",MathJax.Hub]); + var cell_math = this.element.get(0); + MathJax.Hub.Queue(["Typeset",MathJax.Hub,cell_math]); } }; - Cell.prototype.select = function () { this.element.addClass('ui-widget-content ui-corner-all'); this.selected = true; diff --git a/IPython/frontend/html/notebook/static/js/mathjaxutils.js b/IPython/frontend/html/notebook/static/js/mathjaxutils.js index 2dea85e65..7c7cb1a58 100644 --- a/IPython/frontend/html/notebook/static/js/mathjaxutils.js +++ b/IPython/frontend/html/notebook/static/js/mathjaxutils.js @@ -14,10 +14,9 @@ IPython.namespace('IPython.mathjaxutils'); IPython.mathjaxutils = (function (IPython) { var init = function () { - if (window.MathJax) { + if (window.MathJax) { // MathJax loaded MathJax.Hub.Config({ - TeX: { equationNumbers: { autoNumber: "AMS", useLabelIds: true } }, tex2jax: { inlineMath: [ ['$','$'], ["\\(","\\)"] ], displayMath: [ ['$$','$$'], ["\\[","\\]"] ], @@ -28,6 +27,7 @@ IPython.mathjaxutils = (function (IPython) { styles: {'.MathJax_Display': {"margin": 0}} } }); + MathJax.Hub.Configured(); } else if (window.mathjax_url != "") { // Don't have MathJax, but should. Show dialog. var dialog = $('
') @@ -88,7 +88,6 @@ IPython.mathjaxutils = (function (IPython) { var inline = "$"; // the inline math delimiter var blocks, start, end, last, braces; // used in searching for math var math; // stores math until pagedown (Markdown parser) is done - var HUB = MathJax.Hub; // MATHSPLIT contains the pattern for math delimiters and special symbols // needed for searching for math in the text input. @@ -102,11 +101,12 @@ IPython.mathjaxutils = (function (IPython) { // math, then push the math string onto the storage array. // The preProcess function is called on all blocks if it has been passed in var process_math = function (i, j, pre_process) { + var hub = MathJax.Hub; var block = blocks.slice(i, j + 1).join("").replace(/&/g, "&") // use HTML entity for & .replace(//g, ">") // use HTML entity for > ; - if (HUB.Browser.isMSIE) { + if (hub.Browser.isMSIE) { block = block.replace(/(%[^\n]*)\n/g, "$1' + code + '';
});
-
- IPython.mathjaxutils.queue_render()
+ this.typeset()
this.rendered = true;
}
};
diff --git a/IPython/frontend/html/notebook/templates/notebook.html b/IPython/frontend/html/notebook/templates/notebook.html
index 7eea6e8b7..1868e72e1 100644
--- a/IPython/frontend/html/notebook/templates/notebook.html
+++ b/IPython/frontend/html/notebook/templates/notebook.html
@@ -2,7 +2,7 @@
{% block stylesheet %}
{% if mathjax_url %}
-
+
{% end %}