How to Write Equations in LaTeX
Updated June 2026
To write equations in LaTeX, use $...$ for inline math (e.g. $E=mc^2$) and the equation environment for numbered display math: \begin{equation} ... \end{equation}. Load amsmath with \usepackage{amsmath} for fractions (\frac), alignment (align), and advanced symbols. LetX renders math live as you type.
Step by step
- 1
Load amsmath
Add \usepackage{amsmath} for the best math support.
- 2
Inline math
Wrap math in $...$ to keep it in the text line, e.g. $a^2 + b^2 = c^2$.
- 3
Display math
Use \begin{equation} ... \end{equation} for a centered, numbered equation.
- 4
Align multiple lines
Use the align environment with & alignment points and \\ between lines.
- 5
Compile
Compile to PDF; LetX shows rendered math in the live preview in seconds.
Example
\usepackage{amsmath}
% Inline: the identity $e^{i\pi} + 1 = 0$.
\begin{equation}
\frac{\partial f}{\partial x} = 2x
\end{equation}
\begin{align}
a &= b + c \\
&= d
\end{align}Use \frac{a}{b} for fractions, x^{2} for superscripts, x_{i} for subscripts, and \sum, \int, \sqrt{} for common operators.
Frequently asked questions
What is the difference between equation and align?
equation is for a single numbered equation; align is for multiple equations aligned at a chosen point (the &), each numbered unless you use align*.
How do I write an unnumbered equation?
Use the starred version: \begin{equation*} ... \end{equation*}, or use \[ ... \] for quick display math.
How do I write a fraction in LaTeX?
Use \frac{numerator}{denominator}, e.g. \frac{1}{2}. For inline fractions in text, \tfrac gives a smaller, text-sized fraction.
Try this in LetX now
Open the editor, paste the example, and compile in 1–2 seconds — free, in your browser.
Start Writing Free