Introduction

This is a basic tutorial on using Latex syntax inside a Jupyter notebook.

Using Latex to typeset mathematical functions

Below is a example of using two dollar signs to group a Latex expression, but it dumps it onto a separate line:

The raw markdown text is:

Here is the $$c = \sqrt{a^2 + b^2}$$ equation.

with the result being:

Here is the $$c = \sqrt{a^2 + b^2}$$ equation.

https://stackoverflow.com/a/19413196/257924 talks about how to inline the expression into the Markdown cell:

So with this syntax:

Here is the $c = \sqrt{a^2 + b^2}$ equation.

We get:

Here is the $c = \sqrt{a^2 + b^2}$ equation.

Examples of Latex syntax

The "bla" words below is just to show where normal Markdown syntax begins and ends with the Latex code in between:

Example:

bla $\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}}$ bla

gives:

bla $\frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}}$ bla

Taking out the Bigl and Bigr like this:

bla $\frac{1}{\sqrt{\phi \sqrt{5}}-\phi e^{\frac25 \pi}}$ bla

yeilds:

bla $\frac{1}{\sqrt{\phi \sqrt{5}}-\phi e^{\frac25 \pi}}$ bla

Focusing only on the smaller expression:

bla $\frac25 \pi$ bla

gives:

bla $\frac25 \pi$ bla

Using sine and cosine in a Latex expression like this:

bla $x \sin\phi + z \cos\phi$ bla

gives:

bla $x \sin\phi + z \cos\phi$ bla

Latex symbols

https://www.sharelatex.com/learn/List_of_Greek_letters_and_math_symbols has a list of commonly used mathematical symbols.

How to quote multiple lines of code without execution

http://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/notebooks/Part%204%20-%20Markdown%20Cells.ipynb#Embedded-code describes how to quote multiple lines of code instead of executing them. Just prefix each line with four spaces, but you must add a blank line before and after the section of code as otherwise it bundles it up with the previous paragraph). That is how I formatted the Latex code in the example above.