如何制作nbconvert自定义模板

Byt*_*ter 5 python-3.5 jupyter jupyter-notebook

我正在使用python 3.5进行El Capitan,我已经安装了succsfully jupyter,pandoc和latex.

我试图为nbconvert制作一个tempalte,以编辑pdf中的输出(一些边缘看起来不太好,有些代码不属于论文范围).

出于这个原因,我尝试下载并使用https://github.com/jupyter/nbconvert-examples播放,如其他问题所示.唯一的问题是它不起作用.

例如在citations文件夹中,教程指示我使用该ipython nbconvert命令,但它给了我警告:

[TerminalIPythonApp] WARNING | Subcommand `ipython nbconvert` is deprecated and will be removed in future versions.
Run Code Online (Sandbox Code Playgroud)

并失败.当我用它运行时,jupiter nbconvert我得到了同样的错误.

我尝试了许多版本中建议的完整命令,每个版本都失败了:

的:

jupyter nbconvert --to latex --template citations.tplx --post pdf mynotebook.ipynb
Run Code Online (Sandbox Code Playgroud)

可理解的是,由于语法已经改变,因此不再起作用.但是:

jupyter nbconvert --to pdf --template citations.tplx LifecycleTools 
Run Code Online (Sandbox Code Playgroud)

运行但不创建引用.当我跑:

jupyter nbconvert --config ipython_nbconvert_config.py --template citations.tplx  LifecycleTools.ipynb
Run Code Online (Sandbox Code Playgroud)

同样的事情发生了

对于正确的示例有什么想法,或者我可以找到有关如何白化和运行模板的资源?

Byt*_*ter 1

最后我设法使用模板,首先将其导出到 markdown:

jupyter nbconvert  --to markdown my_file.ipynb --template="mytemplate.tpl";
Run Code Online (Sandbox Code Playgroud)

然后使用创建的文件与 pandoc 构建 pdf。

pandoc --toc --template=mdtemplate.tex $PATHTOMYFILES/* --latex-engine=pdflatex -o $NBDIR/ROOT-Primer_v0.pdf
Run Code Online (Sandbox Code Playgroud)