What tools are available to export an ipython notebook to a PDF file? [closed]

假如想象 提交于 2019-12-03 06:01:47

you cannot directly convert an ipynb into a pdf, so the error message is right! You need to first convert it into latex: nbconvert.py -f latex your_nb.ipynb and then use pdflatex your_nb.tex to build the pdf file.

Hope it helps.

Josh

You can use ipython to do this, for instance the command:

ipython nbconvert notebookname.ipynb --to latex --post pdf

to convert notebookname.ipynb to a pdf. It does however require that you are running the latest version of texlive (that's texlive 2013) to have the supporting software. Note that Ubuntu 12.04 comes with texlive 2009 from their repositories. 2013 can be installed from CTAN directly, just follow these directions. Then you are up and running, and it looks great.

IF all else fails as tex can be quite moody... install wkhtmltopdf

\i then use nbconvert to create a html, and then wkhtmltopdf to create the pdf.

If you're converting notebooks often enough, here is a script that uses wkhtmltopdf to convert a selected notebook into HTML and PDF. Once you've installed wkhtmltopdf, keep this script in the same folder as your notebooks and run it whenever you want to convert a notebook quickly.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!