通过 LateX 将 Jupyter Notebook 下载为 PDF 时出错

发布于 2025-01-17 17:09:14 字数 1215 浏览 0 评论 0原文

[在 Windows 11、Python 3.9.7 上工作]

我刚刚安装了 MikTex Console,设置显示按键 xelatexxelatex-dev 存在(参见下图底部):

在此处输入图像描述

现在,在 Jupyter Notebook 的 markdown 单元 中,我引入一个图像(存储在我的个人桌面上):

![1%20cbGPF1go7MMWvHif7-2hAw.png](attachment:1%20cbGPF1go7MMWvHif7-2hAw.png)

当我运行单元时,我在笔记本中获得完美的图像:

在此处输入图像描述

所以,一切似乎都表现良好,但是,当我只想将笔记本另存为 PDF via LateX 时,如下图所示:

在此处输入图像描述

然后我收到 500:内部服务器错误,说

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

有人知道这个“xelatex notebook.tex -quiet”命令是什么吗?它与 LateX 有何关系? MikTex Console 的设置中是否缺少某些内容?你知道我该如何解决这种错误吗?

[Working on Windows 11, Python 3.9.7]

I just installed the MikTex Console, and the settings show that keys xelatex and xelatex-dev are present (see bottom of image below):

enter image description here

Now, in a markdown cell of a Jupyter Notebook, I introduce an image (stored on my personal Desktop):

![1%20cbGPF1go7MMWvHif7-2hAw.png](attachment:1%20cbGPF1go7MMWvHif7-2hAw.png)

When I run the cell, I get the perfect image in the Notebook:

enter image description here

So, everything seems to behave well, BUT, when I just want to save the Notebook as PDF via LateX,as indicated in the image below:

enter image description here

then I get a 500 : Internal Server Error, saying:

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

Does somebody know what is this "xelatex notebook.tex -quiet" command ? How is it related to LateX? Is it something missing in the settings of the MikTex Console? Do you know how could I fix this kind of error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独岁月 2025-01-24 17:09:14

提供的错误非常简洁,command: 之后应该有一些东西,比如

This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.

Responding to your questions 不管怎样,xelatex notebook.tex -quiet 是命令运行当你点击“通过 LaTeX 另存为 PDF”时,XeLaTeX 本身就是 LaTeX 的增强(它本身增强了 TeX)。
XeLaTeX 的主要目标是提供比 LaTeX 更好的编码和字体支持。 请参阅此处

关于如何修复错误,我建议“另存为 LaTeX (.tex)”并尝试直接在控制台中运行 xelatex notebook.tex 。它应该向您显示正在发生的确切错误。 jupyter GitHub 上的 此问题 让我猜测这要么是依赖问题,要么是语法不受支持问题。

如果需要,您可以使用更具体的日志评论/更新您的问题

the provided error is quite succinct, there should have been things after the command:, something like

This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.

Responding to your questions anyway, the xelatex notebook.tex -quiet is the command run when you click "save as PDF via LaTeX", XeLaTeX itself is an enhancment of LaTeX (which itself enhanced TeX).
The main objective of XeLaTeX is to provide better encoding and font support than LaTeX does. see here.

On how to fix the error, I would recommand to make a "save as LaTeX (.tex)" and try running xelatex notebook.tex directly in a console. It should show you the exact error that is happening. This issue on jupyter GitHub makes me guess it is either a dependency problem or a unsupported syntax problem.

If needed you can comment/update your question with more specific logs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文