Actually, I find that when I reload the notebook I have to re-run all the markdown cells (after executing the code cell with the IPython.display.Latex object), otherwise any LaTeX code in the document using the macros doesn't display properly.
In the first cell of the notebook I have: import IPython.display IPython.display.display_latex(IPython.display.Latex(filename="LaTeXmacros")) If I run this cell and then make markdown cells using my macros, it works. When I reload the notebook, none of my macros are rendered properly (even if I re-run the top cell) until I re-run each markdown cell. Is there a way to avoid this? --Keir On Saturday, July 23, 2016 at 6:43:05 PM UTC-4, takowl wrote: > > On 23 July 2016 at 22:24, Keir Lockridge <[email protected] <javascript:> > > wrote: > >> It seems that latex macros may be included in any markdown cell (between >> dollar signs), and these macros are then available throughout the notebook. >> Is there a way to load a file containing LaTeX macros in a markdown cell >> (or in some other location, if it gets the job done)? I am trying to avoid >> having to cut-and-paste a long list of LaTeX macros into every Jupyter >> Notebook I create. >> > > You can construct an IPython.display.Latex object with a string - which > you could read from a file. When that object is displayed, its content is > added to the page as Latex. > > Within the notebook interface, Latex is rendered by the Mathjax library, > so only a subset of Latex works, but it sounds like what you want to do is > already working. > > Thomas > -- You received this message because you are subscribed to the Google Groups "Project Jupyter" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/f9c58601-14d7-44af-8c18-744ee93b54a3%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
