What is well written math?
The solutions to $(x-3)(x-4)=0$ are \[ x=3 \quad\textrm{and}\quad x = 4. \]
We expect your homework to be written like this!
At the end of this tutorial, you will
Math 1200 requires your assignments to be submitted as a PDF produced by \(\LaTeX\). This is in the course outline.
To access just the slides, scan or click the following QR code on your mobile devices.
This tutorial is interative! You can try out code by going to https://ktychan.gitlab.io/teaching/1200-latex/
A typical workflow
Time saving tip: Solve problems on paper before typing them up.
Syntax consists of some special purpose symbols
% \ [ ] { } # $ _ ^ & ~
 
%
starts a comment that gets ignored
This shows up in the output. % gets ignored :(
\
starts a command that does special things
\commandname[option]{argument}
Anatomy of a .tex
file
\documentclass{amsart}
\begin{document}
hello!
\end{document}
Packages
Many \(\LaTeX\) features come in packages. To activate them, put
usepackage
commands in the
preamble.
\usepackage[margin=1in]{geometry}
Note usepackage
commands placed
inside document body will result in errors.
Giving your document some structure
\documentclass{amsart}
\begin{document}
\section{Introduction}
This is Section 1
\subsection{Definitions}
This is Section 1.1.
This will be in the same line as above.
This is a new line!
\end{document}
A blank line starts a new paragraph!
A really basic template.
\documentclass[12pt,letterpaper,reqno]{amsart}
\author{Your Name}
\title{title}
\date{\today}
\begin{document}
\maketitle
% start writing here!
% don't write past this line!
\end{document}
YOUR TURN! @ https://ktychan.gitlab.io/teaching/1200-latex/
Add to one of the above template
title
with
argument template
author
argument
as your name
date
with
argument \today
maketitle
command with
no argument immediately below
\begin{document}
\(\LaTeX\) distinguishes math and text by special markers that start and end math modes.
Inline math mode: $x = 3$.
Display math mode: \[ x = 3. \] This is in a new line.
Inline math mode: $x = 3$. Display math mode: \[ x = 3. \] This is in a new line.
Compare the readibility of the following.
The absolute value function $|x|$ can be defined piecewisely by assigning $|x| = x$ when $x \ge 0$, and $|x|=-x$ when $x \lt 0$.
The absolute value function $|x|$ can be defined as \[ |x| = \begin{cases} x, &\textrm{if } x \ge 0, \\ -x, &\textrm{if } x \lt 0. \end{cases} \]
Which one do you prefer?
Warning! The following doesn't output what you think it does.
\[
x=3
and
x=4.
\]
The above code ouputs the following.
\[ x=3 and x = 4. \]
Commands for symbols
Some examples
\times \div \ge \sqrt{n} \frac{a}{b}
\alpha \beta \gamma ...
(...) \{...\} [...]
x_{1,2} x^{3} \alpha_{0}^{2^{2}}
Detexify (free!) is your friend to find the command for the symbol you want.
It works amazingly well on mobile.
YOUR TURN! @ https://ktychan.gitlab.io/teaching/1200-latex/
Add to your file the following
The solution to $ax^{2} + bx + c = 0$ is \[ x = \frac{-b \pm \sqrt{b^{2} - 4ac}}{2a}. \]
Syntax:
\begin{blah} ... \end{blah}
You have already met some of them
\begin{document} ... \end{document}
$...$
\[...\]
Equations with numbers (math mode)
\begin{align}
(x+y)^{n+1} &= (x+y) (x+y)^{n} \nonumber \\
&= (x+y) \sum_{k=1}^{n} \binom{n}{k} x^{k}.
\end{align}
\[ \begin{align} (x+y)^{n+1} &= (x+y) (x+y)^{n} \nonumber \\ &= (x+y) \sum_{k=1}^{n} \binom{n}{k} x^{k}. \end{align} \]
Notice \\
is necessary to make a
new line.
Equations without numbers (math mode)
\begin{align*}
(x+y)^{n+1} &= (x+y) (x+y)^{n} \\
&= (x+y) \sum_{k=1}^{n} \binom{n}{k} x^{k}.
\end{align*}
\[ \begin{align*} (x+y)^{n+1} &= (x+y) (x+y)^{n} \\ &= (x+y) \sum_{k=1}^{n} \binom{n}{k} x^{k}. \end{align*} \]
Notice the little *
disables
numbering.
Proofs (text mode)
\begin{proof}
Let $\epsilon \gt 0$. Choose $\delta = \sqrt{\epsilon}$.
Then...
\end{proof}
Let $\epsilon \gt 0$. Choose $\delta = \sqrt{\epsilon}$. Then...
Lists (numbered) (text mode)
Use enumerate
environment for
numbered lists. Each item must be prefixed with
\item
command.
\begin{enumerate}
\item Look there's a number to my left!
\item Another one!
\end{enumerate}
Output:
Lists (bullets) (text mode)
Use itemize
environment for
unnumbered lists. Each item must be prefixed with
\item
command.
\begin{itemize}
\item This item has no number.
\item Just a lonely bullet.
\end{itemize}
Output:
Typical assignment
\begin{question}
You are on an island and there are three crates of fruit that
have washed up in front of you. ...
\end{question}
\begin{proof}
we claim ...
\end{proof}
\begin{question}
Determine whether the following statements are true or false ...
\end{question}
\begin{proof}
Part (1) is ...
\end{proof}
Questions (optional)(text mode)
Add to your preamble
\newtheorem{question}{Question}
Then just use it in your assignments to type up the question.
\begin{question}
You are on an island and there are three crates of fruit that
have washed up in front of you. ...
\end{question}
YOUR TURN! @ https://ktychan.gitlab.io/teaching/1200-latex/
Add to your file a
proof
environment with a
factorization of this polynomial.
\begin{align*} x^{3} + 2 x^{2} - x &= \cdots \\ &= \cdots. \end{align*}
Be sure to write out all details and use the
align
or
align*
to put each step in its
own line.
\(\LaTeX\) has its own spacing rule and most likely will ignore
spaces in your .tex
file. The precise rules are hard
to describe. But here is the gist.
Spacing (text mode)
\\
forces a line break
Spacing (math mode)
\[
x=3
\textrm{ and }
x=4.
\]
\[ x=3 \textrm{ and } x = 4. \]
Styling
% text mode
normal: \textrm{very normal}.
bold: \textbf{look at me!}.
italic: \textit{something that stands out}.
% math mode
normal: $\mathrm{very normal}$.
bold: $\mathbf{look at me!}$.
italic: $\mathit{something that stands out important}$.
% fonts
blackboard: $\mathbb{R}$
caligraphy: $\mathcal{S}$
Cross-referencing
\begin{align}
(x+y)^{n+1} &= (x+y) (x+y)^{n} \label{eq:1}
\end{align}
The above is Equation~\eqref{eq:1}.
\begin{align} (x+y)^{n+1} &= (x+y) (x+y)^{n} \label{eq:1} \end{align}
The above is Equation \eqref{eq:1}.
Table
They are notorisely complicated.
Use tablesgenerator.com (free!) instead.
Graphics
Put
\usepackage{graphicx,float}
in the preamble which provides
includegraphics
command.
% inside document body
\begin{figure}[H]
\centering
\includegraphics{path/to/your_image.png} % must be valid path
\caption{Your caption}
\label{fig:your_figure}
\end{figure}
Warning: This feature is disabled on my webiste.
Try out Overleaf for typesetting your own homework.
To learn more, check out
An assignment template
\documentclass[12pt,letterpaper,reqno]{amsart}
\usepackage{microtype,bm,enumitem,amssymb}
\usepackage{graphicx,float,tikz}
\usepackage[margin=1in]{geometry}
\newtheorem{question}{Question}
\title{Math 1200 - Assignment X}
\author{Your Name}
\date{\today}
\begin{document}
\maketitle % do not remove
%\begin{question}
% Optionally uncomment and put the question here.
%\end{question}
\begin{proof}[Solution for Question 1]
Your solution goes here.
\end{proof}
%\begin{question}
% Optionally uncomment and put the question here.
%\end{question}
\begin{proof}[Solution for Question 2]
Your solution goes here.
\end{proof}
\end{document}