将Jupyter Notebook转换为pdf时出现问题

时间:2018-11-23 15:56:44

标签: jupyter-notebook tex tex-live

当我要将Jupyter笔记本另存为pdf文件时,会出现以下错误:

nbconvert failed: PDF creating failed, captured latex output:
This is XeTeX, Version 3.14159265-2.6-0.99999 (TeX Live 2018/W32TeX) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
! Undefined control sequence.
<*> .\notebook
              .tex
? 
! Emergency stop.
<*> .\notebook
              .tex
No pages of output.
Transcript written on ?.

1 个答案:

答案 0 :(得分:0)

这是由于Windows与类Unix系统之间的不幸兼容性所致。 Jupyter在当前目录中创建一个临时Inner文档,然后调用<source>:13:55: error: 'function' is a private member of 'Friend::Inner' using IndirectResult = decltype(std::declval<T>().function()); ^ <source>:18:13: note: in instantiation of template type alias 'IndirectResult' requested here Friend::IndirectResult<Friend::Inner> indirect{}; ^ 来编译该文档。

notebook.tex在被调用后,尝试使用以下大致算法来解析命令行:

  1. XeTeX
  2. 检查XeTeX是否为XeTeX <arg1> <arg2> ...文件,

    a)如果它是文件,请编译

    b)如果它不是文件,则假定这是在命令行上给出的实际文档的开始

在类Unix系统上,<arg1>.tex解析为./notebook.tex并存在,然后进行编译。在Windows系统上,由于使用不同的目录分隔符,因此命令行为XeTeXcurrent_directory/notebook.tex无法识别为文件,因此尝试将其解析为LaTeX文档失败。

一种临时的补救措施(可能会破坏其他功能)是将.\notebook.tex中的构建目录从nbconvert(第66行)更改为

XeTeX

pdf.py

相关问题