A pocket grimoire of mathematical typesetting — learn the fundamentals of LaTeX in under ten minutes, with everything live and visible.
In which we discover a typesetting language born to make beautiful equations.
LaTeX (pronounced "lay-tek" or "lah-tek") is a typesetting system. You write plain text with special commands, and it turns into beautifully formatted documents — especially for math, science, and academic papers. Microsoft Word lets you see formatting as you type. LaTeX, by contrast, makes you describe formatting with little instructions like \textbf{bold}, then renders the result.
Why bother? Because LaTeX produces the most beautiful equations and documents you've ever seen — the kind you find in physics textbooks and research papers. And once you know a handful of commands, it's actually faster than fighting with a word processor.
Everything in LaTeX is either regular text or a command. Commands start with a backslash \. Math goes between dollar signs $ ... $. That's basically it.
E = mc^2 to something else!That's the whole game: text + commands → polished output. Now let's actually learn the commands.
Of superscripts, subscripts, and the small punctuation that powers all of mathematics.
Two of the most useful tools in your kit are the caret ^ for superscripts (things that go up, like exponents) and the underscore _ for subscripts (things that go down, like indices).
Single characters need no braces: x^2 renders as $x^2$. But for anything longer than one character, wrap it in curly braces: x^{10} gives $x^{10}$, while x^10 would give $x^10$ — only the 1 goes up.
Fractions use \frac{top}{bottom}. Square roots use \sqrt{x}. For other roots, write \sqrt[3]{x}. Try them:
{...} braces. \frac{2}{3}, \sqrt{16}, \textbf{bold} — they all follow the same shape.Greek letters, operators, and the magical incantations that summon them.
Every Greek letter has a name in English, and that name is its LaTeX command. \alpha gives $\alpha$, \beta gives $\beta$, \pi gives $\pi$. Capital versions just capitalize the first letter: \Alpha... well, almost. The capital Greek letters that look like Latin letters (Α, Β, Ε...) aren't usually defined — but the distinct ones are: \Sigma $\Sigma$, \Omega $\Omega$, \Delta $\Delta$.
Click any symbol below to copy its command. Then paste into the editor and watch it render.
\quad adds a wide space. Math ignores normal spaces, so use \, (small), \; (medium), or \quad (large) when you need breathing room.The big operators that make mathematics look mathematical.
Sums, integrals, products, and limits are the showpieces of math typography. They all follow the same pattern: a command name, then _ for what's below, and ^ for what's above.
\sum_{i=1}^{n} i^2 becomes $\sum_{i=1}^{n} i^2$.
\int_0^\infty e^{-x} dx becomes $\int_0^\infty e^{-x} dx$.
\lim_{x \to 0} \frac{\sin x}{x} becomes $\lim_{x \to 0} \frac{\sin x}{x}$.
$...$ these are squished to fit one line. Inside $$...$$ they stretch out tall and beautiful. Try the same expression in both modes!Building grids of numbers, piecewise functions, and aligned equations.
Matrices live inside \begin{...} ... \end{...} blocks called environments. There are several flavors depending on which brackets you want around the matrix:
pmatrix — round parentheses
bmatrix — square brackets
vmatrix — vertical bars (for determinants)
matrix — no brackets at all
Inside, separate columns with & and rows with \\.
The cases environment is perfect for piecewise definitions. Same idea — & separates the value from its condition, \\ ends a row.
To stack equations and align them by their equals signs, use aligned with & placed where you want the alignment column.
& = column separator. \\ = row break. This pattern shows up everywhere in LaTeX — tables, matrices, alignments, cases. Learn it once, use it forever.The skeleton of every LaTeX paper, simplified to its essential bones.
Up until now we've focused on math snippets. But LaTeX shines brightest when typesetting whole documents. Every LaTeX file has the same basic shape:
Preamble — everything before \begin{document}. This is where you load packages (extensions), set the title, and configure the document.
Body — between \begin{document} and \end{document}. This is where the actual content lives.
\section{Title}, \subsection{Title}, \subsubsection{Title} — automatic numbering and a table of contents await.
\textbf{bold}, \textit{italic}, \underline{under}, \emph{emphasis} — text formatting.
\begin{itemize} for bullet lists, \begin{enumerate} for numbered lists, with \item for each entry.
amsmath — better math (the aligned environment, \text{} in math, etc.).
graphicx — include images with \includegraphics{file.png}.
hyperref — clickable links and references.
geometry — change margins easily.
Everything you've learned, in one cheat sheet — and a sandbox to test it all.
Click any equation to load it into the playground:
Mix and match. Build something beautiful.
You've journeyed through the seven chapters of the LaTeX Storybook. You can now write equations, structure documents, and decode the syntax that powers nearly every math paper, physics textbook, and academic publication in existence.
Total time: —