Using a Jupyter notebook to make presentation slides

TL;DR:

  1. Open a blank Jupyter notebook.
  2. Add a cell and convert it to Markdown (either esc + m) or by using the drop down menu at the top of the notebook.
  3. Add your text, equation or image to the cell (images can be added via the edit menu, though some HTML tags may be needed to render and/or resize the image).
  4. Choose a slide type in the drop down menu of the cell itself (slide, sub-slide, fragment, skip or notes).
  5. Save the notebook.
  6. In the terminal, run jupyter nbconvert *.ipynb --to slides.
  7. Open the resulting .html file in a browser and use the arrow keys to navigate.

I turn coffee Lapsang Souchong tea into code; if you found this post useful you can contribute to my habit here: https://ko-fi.com/nataliebhogg.


I’m in a strange kind of limbo at the moment. I’m not being paid, since I can’t sign my new contract without being physically present in Spain. And, until the 30th of March, it was physically impossible to enter Spain unless you were a Spanish resident, since the borders were closed due to Covid restrictions. Due to Brexit, I also need a visa in order to be able to stay in Spain for more than ninety days and to legally work there. So, I have an appointment at the Spanish consulate in London on Friday to submit my visa application. I’m hoping for a quick decision so I can book a flight, get to Madrid, sign my contract and start working (and drawing a salary). But, until then, I’m in this strange, semi-working state.

I could have taken this time off completely, but with the UK in lockdown and everything shut, I know I would have quickly got bored in the face of a two or three month holiday with nothing to do and nowhere to go. So, I resolved to keep working, despite the lack of pay, albeit at a reduced pace. I’ve been attending journal clubs and mainly working on turning a chapter of my PhD thesis into a paper.

As a result, it was nice to take a full five days off over the Easter weekend. I finished reading three books: Island of Dreams by Dan Boothby (ok if you are interested in Gavin Maxwell, Scotland or otters), The Nine Tailors by Dorothy L. Sayers (which I highly recommend!) and Never Split the Difference by Chris Voss (probably only useful if you’re a hostage negotiator or someone working in big business). It was a conscious decision to try and read more and I’m glad it paid off. I always forget how refreshed I feel after even just a couple of days off from work.

This morning I finished making my slides for my talk at Britgrav next week. I’m going to be presenting my work from a few months ago on how the distance duality relation can be constrained with standard sirens and how modified gravity effects can bias this type of analysis. I tend to use either Google Slides or LaTeX Beamer to make presentations, depending on the content and audience, but this time I decided to use Markdown in a Jupyter Notebook which I then converted to HTML.

Markdown in Jupyter Notebook cell.

This produces very clean looking slides, and it’s easy to write LaTeX commands too (unlike in Google Slides).

The same cell converted to HTML and displayed in a browser.

The process I followed to create the slides is very simple.

  1. Open a blank Jupyter notebook.
  2. Add a cell and convert it to Markdown (either esc + m) or by using the drop down menu at the top of the notebook.
  3. Add your text, equation or image to the cell (images can be added via the edit menu, though some HTML tags may be needed to render and/or resize the image).
  4. Choose a slide type in the drop down menu of the cell itself (slide, sub-slide, fragment, skip or notes).
  5. Save the notebook.
  6. In the terminal, run jupyter nbconvert *.ipynb --to slides.
  7. Open the resulting .html file in a browser and use the arrow keys to navigate.

The same week that I’m giving this talk, I’m also presenting the H0 review paper by Di Valentino et al (we’re having a special H0 tension week, as someone else is going to present Efstathiou’s recent offering on the same topic) and the following week I’ve been invited to give a seminar at my old undergraduate institution, Aberystwyth University, which I’m really looking forward to.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

%d bloggers like this: