我有一个Jupyter笔记本,我正在用nbconvert将它导出为PDF。当我这样做的时候,如果我合并了图像,它会给我一个错误。
我使用edit -> insert image进行编辑,并将图像保存在jupyter文档所在的文件夹中。该单元格为Markdown。
我展示了我的代码来查看错误:

当使用nbconvert和语句导出它时
jupyter nbconvert --to PDF --no-input REDACCION.ipynb
它给出了以下错误:
(base) C:\Users\USUARIO\Desktop\DOC BECA COLABORACIÓN\CURSO AEROPYTHON-JUPITER>jupyter nbconvert --to PDF --no-input REDACCION.ipynb
[NbConvertApp] Converting notebook REDACCION.ipynb to PDF
Traceback (most recent call last):
File "C:\Users\USUARIO\anaconda3\Scripts\jupyter-nbconvert-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\USUARIO\anaconda3\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\traitlets\config\application.py", line 845, in launch_instance
app.start()
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 350, in start
self.convert_notebooks()
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 524, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 489, in convert_single_notebook
output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 418, in export_single_notebook
output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\exporters\exporter.py", line 181, in from_filename
return self.from_file(f, resources=resources, **kw)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\exporters\exporter.py", line 199, in from_file
return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\exporters\pdf.py", line 183, in from_notebook_node
self.run_latex(tex_file)
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\exporters\pdf.py", line 153, in run_latex
return self.run_command(self.latex_command, filename,
File "C:\Users\USUARIO\anaconda3\lib\site-packages\nbconvert\exporters\pdf.py", line 141, in run_command
raise raise_on_failure(
nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:
notebook.tex:446: Unable to load picture or PDF file '
notebook.tex:469: You can't use `
notebook.tex:470: Missing $ inserted
notebook.tex:471: You can't use `
notebook.tex:473: Missing $ inserted
dvipdfmx:fatal: Image inclusion failed for "attachment:Captura%20de%20pantalla%20%2825%29.png".
No output PDF file written.
Sorry, but xelatex did not succeed.
The log file hopefully contains the information to get MiKTeX going again:
C:\Users\USUARIO\AppData\Local\MiKTeX\miktex\log\xelatex.log
发布于 2021-11-19 16:01:29
这是一种变通方法,但它确实有效。
您需要单击“打印”按钮触发打印预览,然后使用浏览器“另存为PDF”保存PDF:
https://stackoverflow.com/questions/67210193
复制相似问题