使用 LaTeX 将 Jupyter 转换为 PDF

使用 LaTeX 将 Jupyter 转换为 PDF

我正在尝试使用 LaTeX 将 Jupyter 笔记本转换为 PDF,但遇到了以下问题。我认为这与编译文档时生成的图表有关。该文件还包含参考资料。有办法解决这个问题吗?

Package hyperref Warning: Difference (2) between bookmark levels is greater 
(hyperref)                than one, level fixed on input line 691.


! LaTeX Error: Cannot determine size of graphic in Machine_Learning_Project_2_f
iles/Machine_Learning_Project_2_36_1.png (no BoundingBox).

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.719 ...iles/Machine_Learning_Project_2_36_1.png}

? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.
? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.
? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
? Type <return> to proceed, S to scroll future error messages,
R to run without stopping, Q to run quietly,
I to insert something, E to edit your file,
1 or ... or 9 to ignore the next 1 to 9 tokens of input,
H for help, X to quit.
? 
! Emergency stop.

这是我用来转换为 PDF 的代码

ipython nbconvert Machine_Learning_Project_2.ipynb --to latex --template citation.tplx
latex Machine_Learning_Project_2.tex
bibtex Machine_Learning_Project_2.aux
pdflatex Machine_Learning_Project_2.tex
pdflatex Machine_Learning_Project_2.tex
pdflatex Machine_Learning_Project_2.tex

答案1

脚本的第一行是

latex Machine_Learning_Project_2.tex

latex/dvips 无法包含 png 文件,并解释您显示的错误。将其更改为pdflatex

相关内容