writing equations in latex

Writing Equations in LaTeX: A Beginners Guide to Perfect Math Typesetting

By Laura Robinson
AD

Writing equations in LaTeX is one of the most reliable ways to produce clean, professional mathematical typesetting. Whether you are drafting a research paper, a homework assignment, a technical blog post, or lecture notes, LaTeX gives you precise control over fractions, integrals, matrices, and multi-line derivations.

The learning curve is real, but it is shorter than many people expect. Once you understand math mode, a handful of environments, and a few habits for organizing code, you can move from messy plain-text formulas to publication-ready notation without fighting your word processor.

Writing Equations in LaTeX: Math Modes and Core Syntax

At the heart of writing equations in LaTeX is math mode. Math mode tells the compiler that the characters between the delimiters are mathematical notation, not ordinary text, so variables are italicized, spacing is adjusted, and symbols such as Greek letters are rendered correctly.

AD
an image of a black and white diagram with two circles in the center, and one circle
an image of a black and white diagram with two circles in the center, and one circle
the word alex written in black on a white background
the word alex written in black on a white background
Intro to LaTeX : Learn to write beautiful math equations || Part 1
Intro to LaTeX : Learn to write beautiful math equations || Part 1

LaTeX offers two main modes: inline math, which sits within a sentence, and display math, which is set apart on its own line. Choosing the right mode affects readability, numbering, and how much vertical space the equation consumes.

Inline vs Display Equations

Inline equations are wrapped in single dollar signs, such as $E = mc^2$, or in escaped parentheses, such as \(E = mc^2\). They are ideal for short expressions, variable references, and simple symbols that belong inside the flow of a paragraph.

LaTeX in 24 Hours : A Practical Guide for Scientific Writing
LaTeX in 24 Hours : A Practical Guide for Scientific Writing
Text and Math into LaTeX : A Quick Guide to LaTeX Mathematical Symbols, Equations, and F
Text and Math into LaTeX : A Quick Guide to LaTeX Mathematical Symbols, Equations, and F
some type of handwriting that is written in different languages
some type of handwriting that is written in different languages

Display equations are wrapped in escaped brackets, such as \[ \int_0^1 x^2 \, dx = \frac{1}{3} \], or placed inside an equation environment. They are better for important results, long formulas, and equations that need numbering or alignment.

Essential Math Commands and Symbols

Most equations are built from a small set of commands. Superscripts use the caret, subscripts use the underscore, and fractions use \frac{numerator}{denominator}. For example, x^2, a_{i,j}, and \frac{\pi}{2} cover a large amount of everyday notation.

AD

Greek letters, operators, and relations follow predictable names: \alpha, \beta, \sum, \prod, \leq, \geq, and \neq. Packages such as amsmath and amssymb extend the available symbols, so you rarely need to search far for the notation your field requires.

"Web Equation" which recognizes handwritten mathematical expressions automatically to LaTeX or MathML
"Web Equation" which recognizes handwritten mathematical expressions automatically to LaTeX or MathML
12 Best LaTeX Editors
12 Best LaTeX Editors
LaTeX Math Symbols
LaTeX Math Symbols
"Web Equation" which recognizes handwritten mathematical expressions automatically to LaTeX or MathML
"Web Equation" which recognizes handwritten mathematical expressions automatically to LaTeX or MathML
a computer screen with some data on it's side and the keyboard in front
a computer screen with some data on it's side and the keyboard in front
Agora o Facebook Messenger permite que você escreva fórmulas matemáticas básicas em Latex
Agora o Facebook Messenger permite que você escreva fórmulas matemáticas básicas em Latex

Advanced Techniques for Writing Equations in LaTeX

Once the basics are comfortable, the real power of LaTeX appears in multi-line equations, aligned derivations, matrices, cases, and custom operators. These features make complex mathematical writing easier to read and easier to maintain.

A clean workflow matters just as much as syntax. Keeping equations in logical blocks, using consistent delimiters, and compiling often can prevent small typos from turning into confusing error messages.

AD

Aligning Multi-Line Equations

The align environment from amsmath is the standard tool for multi-line equations that share a common alignment point. You place an ampersand before the symbol you want aligned, usually the equals sign, and use double backslashes to start a new line.

The Ultimate LaTeX Reference Guide | Math Vault
The Ultimate LaTeX Reference Guide | Math Vault
a black background with green text and some white writing on it's side, in the center is an image of a number of numbers
a black background with green text and some white writing on it's side, in the center is an image of a number of numbers
Taking My University Course Computer Science Notes in LaTeX
Taking My University Course Computer Science Notes in LaTeX
How I take notes as a Math major using Vim + LaTeX
How I take notes as a Math major using Vim + LaTeX

For example, an align block might show several steps of a derivation with the equals signs stacked vertically. If you do not want equation numbers on every line, use align* or add \notag to specific lines. This keeps long proofs and calculations readable.

Packages, Tools, and Troubleshooting

The amsmath package is almost mandatory for serious equation writing because it provides align, gather, split, cases, and better spacing. Other useful packages include mathtools for enhanced cases and tag forms, and siunitx for consistent units and numbers.

AD

Common problems include missing braces, using a reserved character without escaping, and forgetting to load a package. When an error appears, check the line number, confirm that every \left has a matching \right, and compile a minimal example to isolate the issue.

With a little practice, writing equations in LaTeX becomes less about memorizing commands and more about expressing mathematical ideas clearly. Keep a personal cheat sheet of the symbols and environments you use most, and revisit your code when a formula feels cluttered. The next time you need to document a derivation, open a blank .tex file, try one inline equation, then one display equation, and let the compiler guide you from there.

AD