gbo*_*ffi 5 python jupyter jupyter-notebook nbconvert
我有不同的 ANCIENT 模板来将 Jupyter 笔记本转换为 PDF,但从 5.0 版开始jupyter-nbconvert(至少,这是 Debian 上的二进制文件的名称)默认使用 XeLaTeX,并且碰巧,其中一些模板在以下情况下很好与 XeLaTeX 一起使用,其他人仍然需要 pdfLaTeX。
我可以使用jupyter-nbconvert --to latex --template old_template MyNotebook并稍后pdflatex从 CLI运行,这是我迄今为止所做的,但我想知道是否有办法告诉 Jupyter 我想使用pdflatex.
我知道 NBConvert 有一个配置选项,
PDFExporter.latex_command : List
Default: ['xelatex', '{filename}', '-quiet']
Shell command used to compile latex.
Run Code Online (Sandbox Code Playgroud)
但我更喜欢命令行上的某些内容,以便我可以定义别名以针对不同的用例使用不同的 TeX 引擎。
PDFExporter.latex_command确实是你想要的;它对应于命令行选项--PDFExporter.latex_command。
因此,由于使用 pdfLaTeX 将 TeX 转换为 PDF 是通过命令 完成的pdflatex <file>,因此列表选项PDFExporter.latex_command需要设置为['pdflatex', '{filename}']。这可以通过命令行指定选项两次来完成:
jupyter-nbconvert \
--to pdf \
--PDFExporter.latex_command pdflatex \
--PDFExporter.latex_command {filename} \
MyNotebook.ipynb
Run Code Online (Sandbox Code Playgroud)
(以及其他 IPython / Jupyter 工具)的配置系统jupyter-nbconvert来自一个名为 Traitlets 的库,其命令行语法详细信息请参见此处。
| 归档时间: |
|
| 查看次数: |
131 次 |
| 最近记录: |