Introduction

Welcome back to Advanced Math Notation! You have reached lesson five of six, which means only one lesson remains after this one. So far in this course, you have added accents to math symbols, auto-sized delimiters, combined multiple notation elements into layered expressions, and typeset big operators like sums, products, and integrals. That is an impressive toolkit.

Up to this point, every display equation we wrote used the \[ ... \] shorthand. That approach works well for standalone formulas, but it never assigns the equation a number. In real papers, textbooks, and reports, important equations are numbered so they can be referred to later in the text. This lesson teaches you how to create numbered display equations, suppress the number when you do not need it, and cross-reference equations by label so the numbers stay correct even as your document changes.

Why Numbered Equations Matter

Imagine reading a physics paper that says "substituting the result from the energy equation above into the momentum relation two pages back." Without equation numbers, the reader has to hunt through the document to find the right formula. Numbered equations solve this problem by giving every key result a clear address — the same way street numbers help you find a specific building.

LaTeX goes one step further: it can automatically manage those numbers for you. If you insert a new equation in the middle of your document, every number after it updates on the next compilation. Combined with a labeling system, you can write references like "see Equation (3)" and trust that the number will always point to the correct formula, no matter how many edits you make.

The `equation` Environment
Unnumbered Equations with `equation*`
Labeling and Cross-Referencing Equations

Assigning a number to an equation is only half the story. The real power comes from labels and cross-references, which let you mention an equation by number anywhere in your document without hard-coding the value. If equations are added or removed, every reference updates automatically on the next compilation — no manual renumbering required.

The workflow has two parts:

  1. Label the equation with \label{...} inside the equation environment.
  2. Reference it later with \eqref{...} wherever you need the number.

Here is a complete example:

\begin{equation}
\label{eq:energy}
E = mc^2
\end{equation}

Equation~\eqref{eq:energy} shows the mass-energy equivalence.

In the compiled output, \eqref{eq:energy} is replaced by the equation's number wrapped in parentheses, such as (1). The sentence would read: "Equation (1) shows the mass-energy equivalence."

There are a few practical points to keep in mind:

  • Label names are free-form text, but the convention is to start with eq: followed by a short descriptive tag, like eq:energy or eq:main. This makes labels easy to recognize in a large document.
  • The \label command must appear inside the equation environment, either before or after the formula itself.
  • The \eqref command, provided by amsmath, automatically adds parentheses around the number. A plain \ref command also exists and prints the bare number without parentheses, but \eqref is preferred for equations because parenthesized numbers match standard mathematical convention.
  • After adding or changing labels, you may need to compile twice. The first pass records the label, and the second pass fills in the correct number at every \eqref location. This two-pass behavior is similar to what you saw with the table of contents earlier in the learning path.

One last typographic detail: the tilde (~) before \eqref in the example inserts a non-breaking space. It prevents LaTeX from placing a line break between the word "Equation" and the number, keeping them together on the same line. This small touch is standard practice in professional documents and well worth making a habit.

Conclusion and Next Steps

In this lesson, you learned how to produce numbered display equations with the equation environment, suppress numbering with equation*, and build a label-and-reference workflow using \label and \eqref. These tools let LaTeX manage equation numbers for you, so your references stay accurate no matter how much your document grows or changes.

Up next, you will put all of this into practice by writing numbered and unnumbered equations, attaching labels, and building cross-references that update automatically. Let LaTeX handle the bookkeeping while you focus on the math — and in the next lesson, we will take things further with multi-line aligned equations!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal