Skip to content
This repository

Allow latex formulas in HTML output #994

Closed
wants to merge 1 commit into from

3 participants

Pablo Winant Min RK Brian E. Granger
Pablo Winant

Currently latex rendering works for markdown cells and latex output.
However, HTML output containing latex formulas will not be processed until a true latex content is detected (or when entering a markdown cell). Given that HTML output may well contain formulas (e.g a table whose columns are latex variables), it seems natural to call the mathjax renderer after html output too. This is what this patch does.
It looks like Mathjax is caching already computed results, so the overhead may be small even if there are many formulas around.

Min RK
Owner

This seems perfectly sensible to me, thanks! Unless @ellisonbg knows a reason that this would have unsavory side effects, we should go ahead with it.

Brian E. Granger
Owner
Min RK
Owner

Thanks! merged.

Min RK minrk closed this November 14, 2011
Michael Droettboom mdboom referenced this pull request from a commit in mdboom/ipython November 13, 2011
Pablo Winant Latexify formulas contained in html text.
closes gh-994
2ad63d5
Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 13, 2011
Pablo Winant Latexify formulas contained in html text. 08bd02f
This page is out of date. Refresh to see the latest.
4  IPython/frontend/html/notebook/static/js/codecell.js
@@ -243,7 +243,7 @@ var IPython = (function (IPython) {
243 243
         this.append_mime_type(json, toinsert);
244 244
         this.element.find('div.output').append(toinsert);
245 245
         // If we just output latex, typeset it.
246  
-        if (json.latex !== undefined) {
  246
+        if ((json.latex !== undefined) || (json.html !== undefined)) {
247 247
             MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
248 248
         };
249 249
     };
@@ -295,7 +295,7 @@ var IPython = (function (IPython) {
295 295
         this.append_mime_type(json, toinsert)
296 296
         this.element.find('div.output').append(toinsert);
297 297
         // If we just output latex, typeset it.
298  
-        if (json.latex !== undefined) {
  298
+        if ( (json.latex !== undefined) || (json.html !== undefined) ) {
299 299
             MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
300 300
         };
301 301
     };
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.