【问题标题】:Jupyter nbconvert fails to convert this line of LaTexJupyter nbconvert 无法转换这行 LaTex
【发布时间】:2021-07-10 22:36:19
【问题描述】:

我正在尝试将 Jupyter Notebook 转换为 pdf,但它会向我抛出此错误:

nbconvert.exporters.pdf.LatexFailed: PDF creating failed, captured latex output:
Failed to run "xelatex notebook.tex -quiet" command:
notebook.tex:411: Missing $ inserted
notebook.tex:411: Extra }, or forgotten
notebook.tex:412: Missing $ inserted

如果我把这个 LaTex 从我的笔记本中拿出来,它会起作用:

$ y=\frac{1}{2}x+3 $

我对 LaTex 不太熟悉,但它在 .ipynb 文件中正确显示,所以我假设这种语法没有任何问题。这是 nbconvert 的问题吗?谢谢!

【问题讨论】:

    标签: jupyter-notebook latex


    【解决方案1】:

    玩了一会儿,我已经解决了这个问题。这是 LaTeX 语法的问题。我希望 jupyter 笔记本能够到达单元格显示错误的位置,但事实并非如此。正确的语法与上面相同,只是美元符号之间没有空格。将该行代码更改为:

    $y=\frac{1}{2}x+3$
    

    nbconvert 成功制作了 PDF。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多