Open chris-hld opened 3 years ago
Is this issue still occurring? I would think that would be covered by this line: https://github.com/jupyter/nbconvert/blob/master/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2#L45
I'm seeing the same problem, also in nbconvert 6.0.7.
FWIW, I have a TinyTeX installation. Although I don't see any error messages about missing packages, that would be a possibility.
Yep, still fails.
I think there is a fundamental issue.
\includegraphic
is not compatible with svg.
However, from what I can see
https://github.com/jupyter/nbconvert/blob/d7c286b9bd07a8670d8ab08469c2e266140522c1/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2#L53
calls with filename
, where it should be the output of the svg conversion instead.
Could that be it?
Some more details
if I run
jupyter-nbconvert --debug --to latex notebook.ipynb
and then inspect the resulting .tex file I can also see that the include remains as
\includegraphics{figs/myfig1.png}
whereas I would expect it to look something like
\includegraphics{notebook_files/notebook_slidenumber.png}
Similarly, the include to an svg remains as
\includegraphics{figs/myfig2.svg}
whereas I would expect it to point to the converted pdf
\includegraphics{notebook_files/notebook_slidenumber.pdf}
This is still an issue in nbconvert
version 6.1.0
Is this issue still occurring? I would think that would be covered by this line: https://github.com/jupyter/nbconvert/blob/master/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2#L45
@shreve , I am having this issue, and I was hoping your link would provide some hints as to how to resolve, but the link appears to be broken.
@riziles I believe it was this line: https://github.com/jupyter/nbconvert/blob/6.x/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2#L45
Or the newer file location: https://github.com/jupyter/nbconvert/blob/main/share/templates/latex/document_contents.tex.j2
The issue came from the resulting latex call with
\includegraphics{figs/myfig.svg}
.
Includegraphics can not handle svg files, therefore, there was a pre-processor script converting the svg files to pdf, which can be included with includegraphics.
However, the resulting includegraphics command should now point to the converted pdf, not to the original svg.
When I looked at the produced intermediate latex file it was clear that this path never got replaced/updated to the converted file. In fact, none of the figure path were actually pointing to the notebook_files/
folder where all graphics were copied into, but they all remained at the path given in the original jupyter notebook.
I will try upgrading and see if that solves. I actually just wrote a script to manually convert all the images because I couldn't find any other workaround.
This issue still persists. How can this not be addressed since more than 2 years?
@decimad , I'd recommend using MyST or Quarto to convert notebooks to LaTeX, Typst or PDF. Both of them support svgs.
When trying to convert a notebook with svg files in it, nbconvert calls Inkscape correctly. However, in the resulting latex file, the call remains as
\(0.5\)\includegraphics{figs/myfigure.svg}
Resulting in the error
LaTeX Error: Cannot determine size of graphic in figs/myfigure.svg (no Bounding Box).
Am I missing a step, or is some further pre-processor needed to replace that line in the latex file? \includegraphics is not capable of svg from what I can see.
Nbconvert version: 6.0.7 - conda