takluyver / bookbook

Tools to use a collection of notebooks as 'chapters'
MIT License
99 stars 24 forks source link

Handling of Latex macros #12

Open ketch opened 6 years ago

ketch commented 6 years ago

One can use \newcommand in a Jupyter notebook to define a macro, by putting it inside a math environment; e.g.

$$\newcommand{\bigO}{{\mathcal O}}$$

However, the conversion to Latex naturally then puts the \newcommand inside a math environment, which makes it available only within that set of math delimiters.

Furthermore, in notebooks one must define a given macro again in each notebook that uses it. But when these notebooks are combined into a book, the resulting .tex file should only define each macro once.

It would be great if bookbook collected all the macros from the set of notebooks, and placed them together in the preamble of the .tex file (without math delimiters around them, of course).