Fast calculations, slow LaTeX

I have a long notebook (60 pages if converted to PDF) which combines a lot of calculations along with a lot of mathematical formulas in \LaTeX. When I run it, the Julia calculations are done pretty fast ( < 1 min), but the \LaTeX code takes around 30 min to be converted (typesetting/processing math) in JuliaBox and around 10 min in my IJulia local installation. Any suggestions to speed up the \LaTeX part?

I’m not sure I understand: are you taking about LaTeX in comment cells that gets rendered mathjax?

Yes, in Markdown cells.

One option to save the Mathjax content in SVG form and include the images. Of course, you’d want to maintain a separate source file with the original LaTeX and have a build process to produce the SVGs and insert appropriate HTML—that’s what we do at Data Gymnasia. It’s a bit different there, though, because it isn’t Jupyter-based and we have a lot more control. My guess is that this approach isn’t going to be very convenient for your use case.

An alternative would be to break your notebook into several smaller notebooks, though that isn’t exactly what you’re asking for since it would involve re-thinking the design. It does seem, though, that Jupyter wasn’t really designed with huge notebooks in mind. Furthermore, distributing a zipped directory of notebooks rather than just one notebook is a better-supported pattern anyway, since there isn’t a way to embed images into an ipynb file except as the output of a code cell. Shipping whole directories also allows you to separate out data, scripts, etc., to keep the notebook clean.

The only thing I know about support for long form Jupyter content is the existence of Jupyter Book, though all I can do is suggest a look if it seems interesting. Good luck!

1 Like

Thank you very much, Jupyter Book sounds like an interesting option to explore. And good to know about Data Gymnasia, nice!