如何修复:Jupyter PDF导出PNG(降价)包含失败



结束时的更新

在经历了一个非常痛苦的更新过程后,主要是因为PDF导出使用XeLaTeX,我一直更喜欢La TeX,所以需要不同的包(。。。

(重要的一点是:我认为pandoc希望在MS包中找到Everysi.sty,但正如CTAN上报道的那样,它已经不在那个包中了(

PDF创建失败,来自服务器的此信息:

notebook.tex:1678: Unable to load picture or PDF file '
dvipdfmx:fatal: Image inclusion failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.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:UsersusernamehereAppDataLocalMiKTeX2.9miktexlogxelatex.log

xelatax.log显示:

2021-06-10 08:02:26,620+0100 INFO  xelatex.core - start process: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Invalid argument
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Function: fwrite
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Result: 22
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Data: <no data>
2021-06-10 08:02:28,594+0100 FATAL xelatex.core - Source: LibrariesMiKTeXTeXAndFriendsincludemiktex/C4P/C4P.h:646
2021-06-10 08:02:28,594+0100 FATAL xelatex - Invalid argument
2021-06-10 08:02:28,594+0100 FATAL xelatex - Info: 
2021-06-10 08:02:28,594+0100 FATAL xelatex - Source: LibrariesMiKTeXTeXAndFriendsincludemiktex/C4P/C4P.h
2021-06-10 08:02:28,594+0100 FATAL xelatex - Line: 646
2021-06-10 08:02:28,596+0100 INFO  xelatex - this process (37528) finishes with exit code 1

如果我们查看miktex-dvipdfmx.log,我们会发现调用的另一端。。。

2021-06-10 08:02:26,808+0100 INFO  miktex-dvipdfmx - this process (4364) started by 'xelatex' with command line: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-10 08:02:28,558+0100 ERROR miktex-dvipdfmx - Image inclusion failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.png".
2021-06-10 08:02:28,559+0100 INFO  miktex-dvipdfmx - this process (4364) finishes with exit code 1

所以。png的图像包含失败,它是markdown单元格中的附件(以前输出的截屏,这样长时间运行的代码就不必总是重新运行(。

有人能确认这应该有效吗(我很久以前在某个地方看到过降价单元格中的图像出现问题(如果是,请解释如何解决此问题

更新I 2021年6月29日

根据xelatex日志:;无效参数消息";以及论点"-q-E-o";上面是针对miktex-dvipdfmx.exe的,但参考dvipdfmx手册,我找不到-q,-o参数。。。

然后检查BASIC手册中的dvipddf((和选项,其中-o是输出文件名(这并不奇怪(,但仍然没有-q选项的迹象。

这至少是一致的,但是。。。什么怎样等等等等

2021年6月29日的更新II

更新的miktex;发现一个新项目miktex-dvipdfmx-bin-x64-2已经安装!重新运行笔记本导出。不同错误:

nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:
notebook.tex:561: Undefined control sequence

检查miktex-dvipdfmx.log我发现

2021-06-10 08:02:26,808+0100 INFO  miktex-dvipdfmx - this process (4364) started by 'xelatex' with command line: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-10 08:02:28,558+0100 ERROR miktex-dvipdfmx - Image inclusion failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.png".
2021-06-10 08:02:28,559+0100 INFO  miktex-dvipdfmx - this process (4364) finishes with exit code 1

因此,通过使用miktex-dvipdfmx-bin-x64-2(可能(解决了自变量错误,现在在tex本身的中还有一些其他问题

不幸的是,对C:\和单独的文档驱动器的全面搜索未能找到notebook.tex,因此调查到此结束。

然而,请注意,PDF导出对于没有嵌入";附件"-我想知道它是不是根本找不到附件"文件";

jupyter作为500服务器错误的最终错误报告:

nbconvert failed: PDF creating failed, captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:
notebook.tex:496: Undefined control sequence [17 times]
...
notebook.tex:2119: Unable to load picture or PDF file '
dvipdfmx:fatal: Image inclusion failed for "attachment:9e002d53-d7a5-42e1-8b51-0fdec8f4dad5.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:UsersJulianAppDataLocalMiKTeX2.9miktexlogxelatex.log

xelatex日志显示没有数据

2021-06-29 08:30:42,590+0100 INFO  xelatex.core - start process: miktex-dvipdfmx.exe --miktex-enable-installer -q -E -o notebook.pdf
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Invalid argument
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Function: fwrite
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Result: 22
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Data: <no data>
2021-06-29 08:30:43,984+0100 FATAL xelatex.core - Source: LibrariesMiKTeXTeXAndFriendsincludemiktex/C4P/C4P.h:646
2021-06-29 08:30:43,984+0100 FATAL xelatex - Invalid argument
2021-06-29 08:30:43,984+0100 FATAL xelatex - Info: 
2021-06-29 08:30:43,984+0100 FATAL xelatex - Source: LibrariesMiKTeXTeXAndFriendsincludemiktex/C4P/C4P.h
2021-06-29 08:30:43,984+0100 FATAL xelatex - Line: 646
2021-06-29 08:30:43,986+0100 INFO  xelatex - this process (38968) finishes with exit code 1

可能相关:github nbconvert问题

我也遇到了这个问题。

我的解决方案在图像的附件定义中使用完整路径,而不是相对路径。虽然,当我这样做的时候,它不会在VS代码中呈现,但它确实允许nbconvert现在成功地找到文件并创建PDF。

问题代码:(test image)[test_image.jpg]

工作代码:(test image)[C:test_image.jpg]

我不能确定,但我在错误日志中注意到它正在将临时文件写入AppData。我怀疑当时是而不是拉入图像,然后找不到与该临时文件相关的图像。

我也遇到了同样的问题。现在,我的临时解决方案只是使用Chrome浏览器的打印功能(另存为pdf(,但标题部分和脚注看起来很无味,很烦人。

最新更新