Open fperez opened 8 years ago
Ping @flying-sheep in case there is an issue with something we're doing on the R side.
Well, as you know, Jupyter used to be part of IPython. That’s why nobody thought it’d be a problem to create a default LateX template that has exactly the \usepackage{...}
calls that IPython needs.
Now, however, other kernels either need to utilize a subset of the LaTeX packages IPython uses (which has historically grown over time) or require a custom template.
There’s no way for a kernel to provide custom templates or even something more specific (like listing LaTeX packages), but it really should be. Especially for LaTeX.
I think that downloading a 4 line template and using the console is exactly the right amount of inconvenience that is acceptable for users but still incentive to fix the root issue (lack of flexibility in nbconvert/Jupyter and a Kernel-specific termplate)
what you need is is documented in the repr package. try:
package?repr
The repr package
Description:
The repr package
Details:
The LaTeX repr of vectors needs
\usepackage[inline]{enumitem}
The LaTeX repr of functions with the
repr.function.highlight
option set to FALSE needs\usepackage{minted}
See Also:
repr, repr-options, repr-generics, repr_text
We do need to do something smarter with Latex conversions. Maybe part of it is that display_data messages with latex output should have some metadata indicating required packages, which could be persisted in cell/notebook metadata, and used by nbconvert when exporting to latex.
Part of the confusion is also that we're using Latex preamble from pandoc, but that's not really as static as we had hoped.
Consider an R notebook that simply contains the cell
1:5
.Converting this notebook produces latex with the following:
but for some reason, when attempting to run pdflatex we get this error:
despite the fact that the preamble contains
and the console log shows:
I'm not 100% sure this is our bug, but it does stop users dead on their tracks with certain notebooks.