-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Improved MathJax, bug fixes #2517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In my tests, this fixes the main problem I was having as a result of #2349. Notebooks always load correctly. The MathJax rendering speed seems to be greatly improved as well, though still a bit slower than in 0.13. |
This branch is completely broken for me. I see the following: Uncaught TypeError: Object [object Object] has no method 'typeset' textcell.js:403 |
This is very frustrating. I have time to work on this tomorrow, but there
I tested this against Safari and Chrome, the error Brian is seeing doesn't A |
On Fri, Oct 26, 2012 at 12:40 PM, ahmadia [email protected] wrote:
Yes, very frustrating...thanks for looking at this.
Cheers, Brian
Brian E. Granger |
Yes, I'll work on that now. Just a note, we have identical versions of Chrome and OS, and neither David or I saw the issue you mentioned. Are you working from a locally installed MathJax? Did you, ahem, clear your cache? I think it's worth reverting the code for now anyway, and there are definitely problems I'd like to pester Davide Cervone about. |
Okay, I've thought about this a little more, and read through the MathJax documentation and mailing list discussions on this issue more carefully. I thought I would be able to get away with re-rendering the entire page every time a cell was edited, but now it's clear that for performance reasons we need to should only reprocess the edited div. I think we can add equation numbering back in, but it will need to be a separate action triggered by dropdown menu/button/command key because the entire page must be re-rendered from scratch when this is requested. |
As someone who wants this feature very much, I think that would be a perfectly acceptable setup. Equation numbering is mainly for readers; you don't need it much when you are writing a notebook, so I wouldn't expect this to be much of a bother. |
@ketch @ellisonbg - I found and fixed a couple mistakes I had made with regard to development, and I backed out the equation numbers/references. Please pull this branch and test it. Please also test with your internet connection turned off (with/without a local mathjax copy). Offline --no-mathjax notebooks are currently broken in master (sorry!). Side note about re-enabling equation numbers/references@ketch - if you'd like to turn equation numbers/references on, the following seems to work for me: Modify the
Equation numbers/references will have a decent chance at getting rendered correctly, just remember to throw equations in align or equation environments (the MathJax examples uses a few shortcuts) if you want to attach references to them. If things start to render improperly, save the notebook, then reload it manually with your browser, and everything should render correctly. This is very beta functionality, but I know you're willing to deal with the annoyance of a browser refresh now and then for nicer typesetting. I'm interested in seeing how you are using equation numbers/references so I can plan around your use cases for future development on this code. |
(I also just rewrote history very slightly and amended the commit message). Placeholders are not being rendered, this is a very minor fix to be made before merging into master. |
I confirm that the rendering speed is back to normal with this fix, and it works both with local and online MathJax. Also, the --no-mathjax option is fine now. |
Cell.prototype.typeset = function () { | ||
if (window.MathJax){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do code cells get typeset now?
I have tested all possible combinations (Local/CDN, --no-mathjax) and all issues appear to be fully resolved. Thanks for chasing all of this down. Please see my comments on the code above though. If I understand things correctly, the current version won't number equations or do reference, but if we change the Math Jax config, it would work each time the user reloads the page. |
MathJax.InputJax.TeX.resetEquationNumbers is supposed to be available, but isn't consistently loaded before the notebook fires off its first re-render request. The code edits in mathjaxutils.js fix this issue. Additionally, there was some init code in mathjaxutils.js that has been properly excised to the html templates. Removed some orphan rendering code so that all typesetting now goes through mathjaxutils.js Finally, removed an extra cell in the demo notebook.
Equation References and Numbering are not going to be trivial to add, so the code has been removed for now. Important fixes include no-MathJax support (previously, the code was failing), and the generation of unique ids for the rendering content in each cell, tremendously speeding up MathJax rendering. I am still not rendering placeholder text.
@ellisonbg - Thanks for the detailed code review. I'm pushing changes according to your suggestions, so I will respond to your comments in summary form below.
|
* Cell.prototype.typeset functionality restored * MathJax configuration files back in .js, delayedStartup * Renamed HUB to hub * Removed vestigial comment * Restored Markdown Cell placeholder render functionality
So I think this branch is looking good, but I would like it if some others could test it. But Aron, this is great work, we really appreciate your chasing down all of these things. |
Works for me with the new commits. It might even be faster (rendering) than 0.13 now; it's hard to tell because they're both pretty fast on my worksheets. |
I've tested it with many of our examples that were basically unusable. @ahmadia, many thanks for tracking these problems down, and everyone else for the careful testing and review! Because this is so high priority (master is basically unusable right now with large/complex notebooks), I'm going to merge this now. We can always refine further, but having an effectively unusable master isn't a good idea. |
Addresses the javascript errors resulting in a blank notebook pointed out in #2349 as well as significant performance degradations that were introduced by that merge. It also disables equation numbering/references, fixes broken offline access and re-typesets individual Notebook Cells instead of the entire document on edit. Closes #2289.
Addresses the javascript errors resulting in a blank notebook pointed out in ipython#2349 as well as significant performance degradations that were introduced by that merge. It also disables equation numbering/references, fixes broken offline access and re-typesets individual Notebook Cells instead of the entire document on edit. Closes ipython#2289.
This pull request addresses the javascript errors resulting in a blank notebook pointed out in #2349
It also disables equation numbering/references (but see this comment for how to turn it back on), fixes broken offline access and re-typesets individual Notebook Cells instead of the entire document on edit.
If you are testing this out, please remember to clear your cache. Performance is addressed in this pull request, as well as the error resulting in a single cell notebook with the Markdown placeholder text "Type Markdown and LaTeX: α2"