jupyter-notebook - 如何修复:Jupyter PDF 导出 PNG(在降价中)包含失败
问题描述
最后更新
在经历了一个极其痛苦的更新过程之后,主要是因为 PDF 导出使用 XeLaTeX,而我一直更喜欢 LaTeX,所以需要不同的包)......
(重要的是:我认为 pandoc 希望在包 MS 中找到everyshi.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:\Users\usernamehere\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.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: Libraries\MiKTeX\TeXAndFriends\include\miktex/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: Libraries\MiKTeX\TeXAndFriends\include\miktex/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 的图像包含失败,它是降价单元格中的附件(先前输出的屏幕抓取,因此不必总是重新运行长时间运行的代码)。
任何人都可以确认这应该有效(我已经看到了一些东西,很久以前在降价单元格中的图像存在问题)如果是这样,请解释如何解决这个问题?
更新我 29/06/2021
从 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:\Users\Julian\AppData\Local\MiKTeX\2.9\miktex\log\xelatex.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: Libraries\MiKTeX\TeXAndFriends\include\miktex/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: Libraries\MiKTeX\TeXAndFriends\include\miktex/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 问题
解决方案
我在这里也遇到了同样的问题。现在我的临时解决方案就是使用 Chrome 浏览器的打印功能(另存为 pdf),但这样的页眉部分和脚注就显得如此鸡肋和烦人。
推荐阅读
- oracle - Oracle 触发器中的动态查询错误
- c# - 如何在 Windows 窗体应用程序的项目文件夹中查找文件
- laravel - Laravel取消链接不会删除文件
- javascript - 我无法在 excel web add in (javascript) 中保存对代码的更改
- r - 如何计算 Quanteda 中多词表达的频率?
- linux - 源子中的父脚本名称
- wordpress - 在 Woocommerce 产品属性中保存 URL
- flutter - 将 DraggableScrollableSheet 添加到 Sliver 页面的底部
- excel - Excel VBA多次重复3行相同的值
- c++ - 在 C++ 中检查枚举变量的无效值