Convert Jupyter notebook to PDF - pdflatex not found on PATH

cyril picture cyril · Aug 27, 2016 · Viewed 9k times · Source

I'm trying to download my Jupyter notebook as a PDF from the web interface by going to:

File -> Download as -> PDF via LaTeX

However, I get this error:

nbconvert failed: pdflatex not found on PATH

I have both pandoc and MacTex installed. Additionally, in the terminal the pdflatex is set.

$ which pdflatex
/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin/pdflatex

I'm running on Mac OS X El Capitan using Jupyter 4.2.0 with Python 2.7.11

Answer

Francio Rodrigues picture Francio Rodrigues · Nov 24, 2017

Print it to pdf using your browser (ctrl+p). It is simple and the "you print what you see" approach is great to share a reports/analysis with people that do not code or use the jupyter enviroment. Not publication ready by any means but gets the job done. Just make sure your plots and figures are not on interactive mode otherwise they will not be displayed (set them to %matplotlib inline).

I always had trouble with exporting my jupyter nb to pdf through latex. Quick search and you see that A LOT of people do. I could get some stuff worked out but the formatting was lackluster with code and plots not displayed the way I wanted. I eventually accepted that the jupyter notebook could not produce "publish-ready" pdfs easily. When I want that, I generate plots/figures/code on jupyter and call them on a latex file.

You may want to hide some of your code from the pdf, set the resolution of your plots and add some extensions to improve your jupyter documents. If you really want to make your publications from inside jupyter, this tutorial has some great tips.