Democratizing Data
Udacity's Data Blog

A Primer on Using LaTeX in Jupyter Notebooks

Mat Leonard |

Jupyter Notebooks have become one of the dominant tools for data scientists. Notebooks allow you to have code, text, math notation, and images all in the same document. They are also easily shareable so others can repeat the analysis, such as detecting gravitational waves with LIGO. Notebooks have also been used as entire online textbooks.

One of my favorite features is using LaTeX (pronounced Lah-Tek) to include mathematical notation directly in the text, rendered with MathJax. If you haven't encountered it before, LaTeX is the standard for typesetting technical and scientific documents. With LaTeX, you can write any document but it also includes the capability to write out mathematical notation. MathJax uses the LaTeX symbols to render math directly in the browser.

This is an extremely useful feature of Jupyter notebooks, but many people lack the LaTeX experience to take advantage of it. So here I’m going to provide a primer on writing mathematical notation in LaTeX. This won’t cover everything LaTeX can do (apparently it’s Turing complete, instead I’ll give you the basics so you can get started including math notation in your notebooks.