LaTeX Math Formulas: A Cheat Sheet

Forketyfork
7 min readNov 25, 2021
Image by Darkmoon_Art from Pixabay

This article should serve as a very simple cheat sheet for everyone who needs to write LaTeX mathematical formulas in Jupyter Notebooks. It’s by no means complete, as the full description of LaTeX notation takes up hundreds of pages. But I’ve tried to gather the stuff I typically use. Hopefully, it will be useful for you too.

This guide should also be applicable for general LaTeX usage, not only in Jupyter Notebooks.

Writing LaTeX formulas in Jupyter Notebooks

First off, you need to switch the cell type to Markdown, then you’ll be able to write both Markdown text and embedded math formulas in the LaTeX format:

Inline formulas are delimited by $:

This is an inline formula: $\alpha=5$

Multiline formulas are delimited by $$:

This is a multiline formula: 
$$
\alpha=\begin{cases}
1, & \beta \ge 0 \\
2, & \beta < 0
\end{cases}
$$

Letters

You can display greek letters just by spelling them out after a backslash:

Greek letters: $\alpha,\beta,\gamma...$

To display something known as the “blackboard font”, use \mathbb{} with a letter in curly braces. Probably the most prominent example of using this font in math is the symbol for real numbers:

Blackboard font: $\mathbb{R}, \mathbb{Z}, \mathbb{D}...$

Similarly, calligraphic font may be displayed by using \mathcal{} :

Calligraphic font: $\mathcal{R}, \mathcal{Z}, \mathcal{D}...$

If you need to display a line over any symbol, use \bar with this symbol in curly braces. You can actually put any expression inside \bar{}:

Bars over symbols: $\bar{a}, \bar{b}, \bar{c}$

Similarly, a “hat” over a symbol is displayed by wrapping it with \hat{}:

Hats over symbols: $\hat{a}, \hat{b}, \hat{c}$

Finally, a tilde (wavy line) over a symbol is displayed by wrapping it with \tilde:

--

--

Forketyfork

Software developer @ JetBrains Space. I write technical how-to articles and occasional rants on software development in general. Opinions are my own.