How to Convert a Jupyter Notebook to PDF or Other Formats

A quick guide to the nbconvert tool to convert a Jupyter notebook to other formats such as PDF, LaTeX and Markdown.

Francesco Pastore
4 min readApr 28, 2024

Jupyter notebooks have become one of the main choices for various tasks regarding Python nowadays, from mastering the basics of the language to developing advanced machine learning algorithms.

In this article, we will see how to export a Jupyter Notebook into various file formats, such as PDF or LaTeX, using the nbconvert tool.

Foto di Christina Morillo

Installing nbconvert

First of all, we need to install the nbconvert tool.

nbconvert is an optional package for Jupyter Notebook and can be easily installed with pip or conda.

pip install nbconvert

# OR

conda install nbconvert

However, to work with nbconvert we also need at least pandoc for markdown content and TeX packages for PDF and LaTeX formats.

# pandoc
sudo apt-get install pandoc

# TeX
sudo apt-get install texlive-xetex texlive-fonts-recommended texlive-plain-generic

See the following link for the official instructions on installing nbconvert and other dependencies.

--

--

Francesco Pastore

An engineering student in Milan and a web developer for an IT company. Write about programming and cybersecurity topics.