LaTeX (pronounced "lay-tech", or sometimes "la-tech") is a markup language that is the standard for typesetting mathematics.

The easiest way to get started is by using a free online LaTeX editor like https://overleaf.com. Most people learn LaTeX by taking existing examples and modifying them to see what happens. You can start your journey by pasting the code from one of the problem set or exam templates into a new project in Overleaf.

Inline mathematical expressions can be inserted into your text as follows:

` $insert-mathematical-expression-here$`

The dollars signs surrounding the mathematical expression are *delimiters* that indicate where the expression begins and ends. You must have an opening and closing delimiter to avoid an error.

Here's an example: this sentence, which includes the equation $x^2+y^2 = R^2$, is typeset in $\LaTeX$ as

` this sentence, which includes the equation $x^2+y^2 = R^2$, is typeset in \LaTeX as`

Notice that I enclosed the entire mathematical expression with delimiters, rather than each individual symbol. Also notice that the command `\LaTeX`

did not require delimiters.

It is best practice to *display* large mathematical expressions rather than place them inline. For example, my MATH 103A students may want to write down Cauchy's integral formula:
$$
f(z_0) = \frac{1}{2\pi i}\int_C \frac{f(z)}{z-z_0} \, dz.
$$

The code you would use is:

```
\[
f(z_0) = \frac{1}{2\pi i}\int_C \frac{f(z)}{z-z_0}\, d z.
\]
```

Here are a few things to keep in mind:

- All inline mathematical notation must be framed by dollar signs.
- All displayed mathematical notation (i.e., on its own line and centered) is of the form
`\[ math-stuff \]`

. - All special symbols in LaTeX are of the form
`\some-command`

. Once you've used LaTeX enough, you can almost guess what the command is for a certain symbol.

Here are a few more examples that illustrate some of the mathematical notation we may want to use:

Expression you want | Code you type |
---|---|

$\int_a^b f(x)\; dx=F(b)-F(a)$ | `$\int_a^b f(x)\; dx=F(b)-F(a)$` |

$n \in \mathbb{N} \subseteq \mathbb{Z}$ | `$n \in \mathbb{N} \subseteq \mathbb{Z}$` |

$\sum_{i=1}^n i^2=1^2+2^2+ \cdots +n^2$ | `$\sum_{i=1}^n i^2=1^2+2^2+ \cdots +n^2$` |

$\sqrt{2} \notin \mathbb{Q}$ | `$ \sqrt{2} \notin \mathbb{Q}$` |

$2\in \{2,3,4\} \cap \{1,2,3\}$ | `$2\in \{2,3,4\} \cap \{1,2,3\}$` |

$f:A\to B$ | `$f:A\to B$` |

$f(x_1)\neq f(x_2)$ | `$f(x_1)\neq f(x_2)$` |

$\{a_n\}_{n=1}^{\infty}$ | ` $\{a_n\}_{n=1}^{\infty}$` |

$(f\circ g)(x)=f(g(x))$ | ` $(f\circ g)(x)=f(g(x))$` |

$\frac{a}{b}+\frac{c}{d}\neq \frac{a+b}{c+d}$ | ` $\frac{a}{b}+\frac{c}{d}\neq \frac{a+b}{c+d}$` |

Greek letters are typeset using `\name`

. For example, `\theta`

produces $\theta$ (as long as you also include the appropriate delimiters).

In order to produce a left or right brace, the brace needs to be preceded by a backslash. For example, to obtain $\mathbb{N}=\{1,2,3,\ldots\}$ we type `$\mathbb{N}=\{1,2,3,\ldots\}$`

and notice the use of `\{`

and `\}`

, which are needed to obtain the braces for the set.

Using LaTeX allows you to do fancy things like the following: $$\begin{align*} \sum_{i=1}^{k+1}i & = \left(\sum_{i=1}^{k}i\right) +(k+1) \newline & = \frac{k(k+1)}{2}+k+1 & (\text{by inductive hypothesis}) \newline & = \frac{k(k+1)+2(k+1)}{2} \newline & = \frac{(k+1)(k+2)}{2} \newline & = \frac{(k+1)((k+1)+1)}{2}. \end{align*}$$ which is typeset using

```
\begin{align*}
\sum_{i=1}^{k+1}i & = \left(\sum_{i=1}^{k}i\right) +(k+1) \newline
& = \frac{k(k+1)}{2}+k+1 & (\text{by inductive hypothesis}) \newline
& = \frac{k(k+1)+2(k+1)}{2} \newline
& = \frac{(k+1)(k+2)}{2} \newline
& = \frac{(k+1)((k+1)+1)}{2}.
\end{align*}
```

To correctly typeset double quotation marks in a full-fledged LaTeX document, you should use the following syntax; otherwise, the left pair of quotes will be backwards.

` ``stuff you are quoting"`

To obtain the symbols on the left, look for the key on your keyboard in the upper left corner that also has the the tilde (~) on it. You'll need to hit this key twice. Using incorrect quotation marks is one of the most common mistakes that I see in documents written using LaTeX.

A really cool tool for looking up LaTeX symbols is Detexify, which allows you to draw a picture of the symbol for which you are looking. Also, Dave Richeson of Dickinson College has put together a really great "cheat sheet", which you can find here.

If you want to see a really, really, really long list of symbols, go here.

Lastly, you may find the following resources useful:

Writing a LaTeX document is much more complicated than just starting to write. There are a whole host of things that you need to put at the top of your document and this can be rather intimidating at first. The big picture is that the content of your document comes after the line `\begin{document}`

. All of the stuff before this line is called the *preamble* and when you first start learning LaTeX, you should just ignore this stuff. Below, I've included some templates to get you started. In the beginning, don't worry too much about all of the complicated stuff in the preamble.

The .tex file is where you type the content of your file. You won't see the output until you *compile* it. If you've done everything correctly, the output after compiling will be a PDF. I highly recommend compiling often to see what you've got so far and to make it easier to find your syntax errors if you have any.

When you are typing the content of your document, you will partition your content into various *environments*. Examples of environments include: `theorem, proof, align*, itemize, enumerate`

, but there are lots more. Every environment begins with `\begin{environment-name}`

and ends with `\end{environment-name}`

. For example, see the example above that uses the `align*`

environment. As another example, if you wanted to write the statement of the theorem that divides is transitive, you would write:

```
\begin{theorem}
Let $a,b,c\in \mathbb{Z}$. If $a\mid b$ and $b\mid c$, then $a\mid c$.
\end{theorem}
```

*Note:* LaTeX ignores whitespace. What this means is that extra spaces and carriage returns (i.e., hitting the space bar or return/enter key repeatedly) have no impact on the output of the .tex document. You can adjust vertical spacing using commands like: `\newline, \bigskip, \medskip, \smallskip, \vspace{1cm}, \vfill`

. If you experiment with these commands, you'll be able to see what impact they have.

While there are several benefits of using an online editor, if you use LaTeX enough, you'll eventually want to install it locally on your own computer.

If you have a Mac, installing and using LaTeX is easy. All you need to do is go here and download the latest version of the MacTeX distribution (filename should be MacTeX.mpkg.zip). Once you have downloaded the package, double-click the installer (if it doesn't run automatically). If you follow the instructions during the installation, you will be provided with the LaTeX "backend" (which you can safely ignore) and the "frontend" editor TeXShop (which will be located in a folder called TeX in your Applications folder). TeXShop will be the default application for editing any file with a .tex extension. After editing a tex file, click "Typeset" and if you don't have any errors, TeXShop will render the corresponding PDF. I recommend clicking "Trash Aux Files" in the Console window after you are done editing.

To get up and running with LaTeX on a computer running Windows, you need to install two things. First, install the MiKTeX "backend", located here. Click the "download" link at the top of the list under MiKTeX Releases and following the instructions. Next, download TeXnicCenter by going here. Download the latest version and proceed according to the instructions. TeXnicCenter will now be your default application for editing any file with a .tex extension. You can safely ignore the MiKTeX "backend".

Most Linux distributions (e.g., Ubuntu, Debian, Fedora, etc.) use a package manager to install and update software. (Don't use a web browser to look for LaTeX online. Your computer already knows where to go online to find LaTeX and how to install it.) These instructions assume you are using Ubuntu, but similar actions will work on any Linux distro with a modern package management system. Using your package manager ("Ubuntu Software Center" or similar in your applications menu) and assuming you have an internet connection, you need to search for and install two things:

- A LaTeX backend: For the most basic install, search for and install "texlive-base". For a more comprehensive install, search for an install "texlive-full".
- A LaTeX editor: Search for and install "Kile". Kile is the editor of choice for many Linux users writing LaTeX.
- After Ubuntu installs these, you should find Kile in your applications menu and it should be capable of calling the various LaTeX programs automatically.

This page is a modification of Dana Ernst's Quick LaTeX Guide. The mathematical symbols on this page were typeset using MathJax.