Skip to content
Tyler Makaro edited this page Mar 28, 2019 · 7 revisions

How to make the most out of nbconvert

  1. Want to remove page numbers? Add \pagenumbering{gobble} to a raw cell at the top of the notebook.
  2. Want to set page numbers to start at a specific number? Add \setcounter{page}{number_here} to a raw cell at the top of the notebook.
  3. Want to re-add the maketitle? Add:
\author{name}
\title{title}
\date{date}
\maketitle

to a raw cell at the top of the notebook to customize the maketitle.

  1. If using Pandas (as pd), try:
pd.set_option('display.latex.repr', True)
pd.set_option('display.latex.longtable', True)

at the start of your notebook. This should add nice formating of pandas dataframes in the conversion.

  1. Add \tableofcontents to a raw cell to get a table of contents.

Workarounds for nbconvert limitations

  1. Typing \insertword in a markdown cell in Jupyter Notebook can cause conversion to fail since LaTeX will attempt to compile the command. Instead use \\insertword since markdown will only render one backslash, and the conversion will use a plain text backslash.

$ equation $

can cause a conversion to fail, but

$equation$

will succeed. (This is a limitation of Pandoc on which nbconvert depends)

  1. When making a list in a markdown cell, include a blank line before the list. This will allow for proper conversion of the list in the final pdf.
Clone this wiki locally