New extension: load_tex_macros.#1257
Conversation
|
It looks like all the Travis jobs that actually ran passed. There are some failures, but those jobs seem never even to have started. What can I do to help git this PR merged? |
jcb91
left a comment
There was a problem hiding this comment.
Looks fine to me, a couple of comments inline, but in general I see nothing here that won't work, and certainly nothing that will break anything else
| @@ -0,0 +1,7 @@ | |||
| Type: IPython Notebook Extension | |||
There was a problem hiding this comment.
Could you change this to Jupyter Notebook Extension? Thanks!
|
Travis builds restarted, but they aren't going to check anything relevant for this all-js extension anyway, tbh, so not a problem to ignore them here if they fail... |
|
@jcb91 Thanks for the review. I changed "IPython" to "Jupyter". |
| if ($('#latexdefs').length > 0) $('#latexdefs').remove(); | ||
| $('body').append($('<div/>').attr('id', 'latexdefs').text(data)); | ||
| console.log('latex_envs: loaded user LaTeX definitions latexdefs.tex'); | ||
| onMarkdownCellRendering(); |
There was a problem hiding this comment.
I am not sure it works because function onMarkdownCellRendering() is not defined. It is defined in latex_envs and is global (which is not a good practice indeed), but in the absence of latex_envs extension, this will not work.
There was a problem hiding this comment.
Hmmm, somehow it works for me even with latex_envs disabled.
| Link: readme.md | ||
| Icon: icon.png | ||
| Main: main.js | ||
| Compatibility: 4.x |
There was a problem hiding this comment.
add 5.X in Compatibility: 4.x, 5.x
| function rerenderMaths() { // probably something like that | ||
| MathJax.Hub.Queue( | ||
| ["PreProcess", MathJax.Hub], ["Reprocess", MathJax.Hub] | ||
| ); |
There was a problem hiding this comment.
I think
MathJax.Hub.Queue(
["resetEquationNumbers",MathJax.InputJax.TeX],
["PreProcess",MathJax.Hub],
["Reprocess",MathJax.Hub]
);
could be better (resets equation numbers before reprocessing avoid an issue with labels in equations that cannot be rendered several times without reset.
| Usage | ||
| ===== | ||
|
|
||
| Simply put your latex macros in a file named latexdefs.tex, in the same directory as your notebook. |
There was a problem hiding this comment.
Perhaps "This is mainly derived from jupyter_latex_envs, following the discussion here".
There was a problem hiding this comment.
Sorry! didn't read the mention at the beginning. Thanks.
Compatible with 5.x. Correctly reprocess mathjax, including resetting equation numbers. Better readme.
|
Okay, I've incorporated all the suggestions form @jfbercher . I think this is ready to go now. |
|
Nice and useful. Thanks @ketch! |
Just loads a tex file whenever a notebook is loaded, then re-runs mathjax. Useful if you have several notebooks that use a common set of latex macros, so you don't have to copy the macros to each notebook.
Essentially all credit for this goes to @jfbercher who practically wrote the extension for me; it's based on one of the functions from his
latex_envextension.