Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert ipynb to pdf in Jupyter

I am new to ipython notebook, and I would like to convert my ipynb to pdf. But I get the following error when I try to Download as PDF via LaTex.

nbconvert failed: pdflatex not found on PATH 

There is no documentation anywhere how to add pdflatex to my PATH. I use windows. Thank you!

like image 236
Christa Avatar asked Apr 28 '16 13:04

Christa


People also ask

How do I save Ipynb as PDF in Jupyter notebook?

The Jupyter Notebook has an option to export the notebook to many formats. It can be accessed by clicking File -> Download as -> PDF via LaTeX (or PDF via HTML - not visible in the screenshot). This approach requires you to install some additional packages.

How do I convert a python notebook to PDF?

Create a notebook and the click "File -> Download As". Click the new menu entry called "PDF via HTML". Your notebook will be converted to a PDF on the fly and then downloaded.

How do you save a Jupyter notebook as a PDF in VS code?

You can export a Jupyter Notebook as a Python file ( . py ), a PDF, or an HTML file. To export, select the Export action on the main toolbar. You'll then be presented with a dropdown of file format options.

How do I open Ipynb files in PDF?

How to open IPYNB file? To open a . ipynb file, you can use Jupyter Notebook, Jupyter Notebook Viewer, or Cantor. Or, if you don't want to install third-party applications, you can convert IPYNB to PDF using Vertopal.


1 Answers

A simple and surprisingly good solution is to print the notebook to pdf through the browser with ctrl+p. Just make sure your plots and figures are not on interactive mode otherwise they will not be displayed (set them to %matplotlib inline).

Exporting jupyter notebooks through latex is quite troublesome and takes a lot of tinkering to get something remotely close to publish ready. When I absolutely need publication quality I do it on a latex editor, but this tutorial goes in great length about doing it on jupyter.

A few useful tips to get better results:

  • Higher resolution plots
  • Hide your code-cells from the pdf
  • Take a look at these extensions to improve your jupyter documents
like image 88
Francio Rodrigues Avatar answered Sep 19 '22 00:09

Francio Rodrigues