If you are writing an assignment, a journal paper or an MS/PhD thesis in mathematics, LaTeX is the tool almost every mathematician uses. It produces beautifully typeset equations, numbers everything for you and keeps references consistent, so you can concentrate on the mathematics. This guide takes you from a blank file to a well-structured paper, with worked examples you can copy and adapt.
Why LaTeX Instead of a Word Processor?
- Quality: equations look professional, with correct spacing and fonts.
- Automation: equation, theorem, section and citation numbers update themselves.
- Structure: you describe what something is (a theorem, a section) and LaTeX decides how it looks.
- Acceptance: most mathematics journals and many universities provide LaTeX templates.
You can work online with Overleaf (no installation, easy sharing with your supervisor) or install a distribution such as TeX Live or MiKTeX with an editor like TeXstudio or VS Code.
A Minimal Paper Skeleton
Every LaTeX document has a preamble (settings and packages) and a body between \begin{document} and \end{document}.
```latex \documentclass[11pt]{article} \usepackage{amsmath, amssymb, amsthm} \usepackage{hyperref}
\newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition}
\title{A Note on Fixed Points} \author{Your Name}
\begin{document} \maketitle \begin{abstract} We prove ... \end{abstract}
\section{Introduction} Text goes here.
\bibliographystyle{plain} \bibliography{refs} \end{document} ```
The three AMS packages are essential: amsmath for advanced equation layouts, amssymb for symbols such as \(\mathbb{R}\), and amsthm for theorem environments.
Inline and Display Mathematics
Use \( ... \) for maths inside a sentence and \[ ... \] or the equation environment for displayed formulas. The equation environment numbers the formula; equation* does not.
latex
The function \( f(x) = x^2 \) is convex. Its integral is
\begin{equation}\label{eq:int}
\int_0^1 x^2 \, dx = \frac{1}{3}.
\end{equation}
By \eqref{eq:int}, the average value of \( f \) on [0,1] is 1/3.
Avoid the old double-dollar display syntax inside your source; \[ ... \] and equation give consistent spacing and work properly with packages.
Essential Commands
- Fractions and roots:
\frac{a}{b},\sqrt{x},\sqrt[3]{x}. - Sub- and superscripts:
x_{n+1},e^{i\pi}. - Sums, integrals, limits:
\sum_{k=1}^{n},\int_a^b,\lim_{x \to 0}. - Greek letters:
\alpha,\varepsilon,\Omega. - Number sets:
\mathbb{N},\mathbb{Z},\mathbb{R},\mathbb{C}. - Auto-sized brackets:
\left( ... \right). - Operators:
\sin,\log,\max, and your own via\DeclareMathOperator{\Res}{Res}.
Worked Example 1: Typesetting the Quadratic Formula Derivation
Suppose you want to present the derivation of the quadratic formula with aligned equals signs.
Step 1: Choose the environment. For a multi-line derivation aligned at "=", use align (numbered) or align* (unnumbered) from amsmath. The & marks the alignment point and \\ ends a line.
Step 2: Write the source.
latex
\begin{align*}
ax^2 + bx + c &= 0 \\
x^2 + \frac{b}{a}x &= -\frac{c}{a} \\
\left(x + \frac{b}{2a}\right)^2 &= \frac{b^2 - 4ac}{4a^2} \\
x &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.
\end{align*}
Step 3: Check the output. The compiled result looks like this:
$$ \begin{aligned} ax^2 + bx + c &= 0 \\ x^2 + \frac{b}{a}x &= -\frac{c}{a} \\ \left(x + \frac{b}{2a}\right)^2 &= \frac{b^2 - 4ac}{4a^2} \\ x &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. \end{aligned} $$
Step 4: Verify the mathematics, not just the typesetting. Test with \(x^2 - 5x + 6 = 0\): \(a = 1\), \(b = -5\), \(c = 6\), so \(b^2 - 4ac = 25 - 24 = 1\) and \(x = (5 \pm 1)/2\), giving \(x = 3\) or \(x = 2\). Both satisfy the equation (\(9 - 15 + 6 = 0\) and \(4 - 10 + 6 = 0\)). LaTeX will happily typeset a wrong formula beautifully, so always check.
Worked Example 2: A Theorem, a Proof and a Cross-Reference
Now let's write a short result with a labelled theorem, a proof and a matrix.
Step 1: Define environments in the preamble (as in the skeleton above).
Step 2: Write the theorem with a label.
```latex \begin{theorem}\label{thm:det} Let \( A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} \) with \( ad - bc \neq 0 \). Then \[ A^{-1} = \frac{1}{ad - bc} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix}. \] \end{theorem}
\begin{proof} Multiply directly: the product of \( A \) and the proposed inverse is the identity matrix. \end{proof}
Theorem~\ref{thm:det} gives the inverse of any invertible \( 2 \times 2 \) matrix. ```
Step 3: Understand what happens. amsthm prints "Theorem 2.1" (if it is in Section 2), sets the statement in italics, and the proof environment adds the end-of-proof square automatically. The ~ is a non-breaking space so "Theorem" and its number never split across lines.
Step 4: Check the theorem with numbers. For \(A = \begin{pmatrix} 4 & 7 \\ 2 & 6 \end{pmatrix}\), \(ad - bc = 24 - 14 = 10\), so
$$ A^{-1} = \frac{1}{10}\begin{pmatrix} 6 & -7 \\ -2 & 4 \end{pmatrix} = \begin{pmatrix} 0.6 & -0.7 \\ -0.2 & 0.4 \end{pmatrix}. $$
Check the first row of \(AA^{-1}\): \(4(0.6) + 7(-0.2) = 2.4 - 1.4 = 1\) and \(4(-0.7) + 7(0.4) = -2.8 + 2.8 = 0\). Correct. Including a checked numerical example after a theorem is good practice in any paper.
Other Useful Environments
casesfor piecewise functions:f(x) = \begin{cases} x, & x \ge 0 \\ -x, & x < 0 \end{cases}.pmatrix,bmatrixandvmatrixfor matrices with round, square or determinant brackets.gatherfor several centred equations without alignment.figureandtablefor floating figures and tables with\captionand\label.- The
tikzandpgfplotspackages for diagrams and graphs drawn directly in LaTeX.
Citations with BibTeX
Store references in a file such as refs.bib:
latex
@article{banach1922,
author = {Banach, Stefan},
title = {Sur les op{\'e}rations dans les ensembles abstraits},
journal = {Fundamenta Mathematicae},
volume = {3},
year = {1922},
pages = {133--181}
}
Cite it in the text with \cite{banach1922}. LaTeX builds the numbered reference list for you. Many journals require their own style file, and the biblatex package with biber offers more flexible formatting.
Common Mistakes and How to Fix Them
- Typing words in maths mode:
\( max \)prints italic m·a·x. Use\maxor\text{max}. - Wrong brackets size: use
\left(and\right)around tall fractions. - Forgetting to compile twice: cross-references and citations need two passes (or let Overleaf handle it).
- Hard-coding numbers: never type "equation (3)"; always use
\labeland\eqref. - Ignoring warnings: "undefined reference" warnings usually mean a misspelt label.
Did You Know?
- Donald Knuth created TeX in 1978 because he was unhappy with the typesetting of his book "The Art of Computer Programming".
- Leslie Lamport wrote LaTeX on top of TeX in the early 1980s; the "La" comes from his name.
- TeX's version number converges to \(\pi\): each update adds another digit, currently 3.141592653.
Key Takeaways
- Load
amsmath,amssymbandamsthmin every mathematics paper. - Use
\( \)for inline maths,equationandalignfor displayed and aligned derivations. - Label everything and refer with
\refand\eqref, so numbering never breaks. - Manage references with BibTeX, and always check the mathematics as carefully as the typesetting.
If you need help typesetting your thesis or paper in LaTeX, or step-by-step solutions to the mathematics inside it, Amathify's experts and PhD scholars are ready to help via WhatsApp or the Ask a Question form.
Stuck on a problem or assignment?
Our experts and PhD scholars solve maths, physics and chemistry — step by step.