Skip to content
EasyLaTeXDocs

Equation Numbering and References

Use equation or align to number equations. Place \label{...} inside the equation and refer to it with \eqref{...} in the text. Numbers update automatically when equations move.

EasyLaTeX compiler setting: pdfLaTeX; load amsmath. After adding or moving labels, compile in EasyLaTeX and wait for the complete job.

Numbering a Single Equation

The equation environment assigns one number. Place \label inside the environment, usually just after the equation:

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

The label is not printed in the PDF; it provides a stable internal name.

Referring to an Equation

After loading amsmath, use \eqref:

latex
From Equation  \eqref{eq:mass-energy}, mass and energy are interchangeable.

\eqref prints the current number in parentheses, for example, “Equation (1).” Do not add another pair of parentheses. \ref prints only the number and is useful when you need to control the surrounding format.

Numbering Multiline Equations

By default, align numbers every line. Add a label to each line:

latex
\begin{align}
  a + b &= c \label{eq:sum}, \\
  a - b &= d \label{eq:difference}.
\end{align}

For a single number covering the whole derivation, wrap aligned in equation and place the label in the outer environment:

latex
\begin{equation}
\begin{aligned}
  f(x) &= x^2 + 2x + 1 \\
       &= (x+1)^2
\end{aligned}
\label{eq:complete-square}
\end{equation}

When No Number Is Needed

Use an unnumbered environment for temporary examples or equations that do not need a reference:

latex
\[
  x^2 + y^2 = r^2.
\]

Alternatively, use equation* or align*. Choose an unnumbered environment directly rather than generating and manually hiding a number; this keeps auxiliary files and numbering consistent.

Naming Labels

Choose searchable names that identify both the object type and its meaning:

latex
\label{eq:mass-energy}
\label{eq:navier-stokes}

Common prefixes include eq: for equations, fig: for figures, tab: for tables, and sec: for sections. Labels must be unique within a document. Check for duplicates when copying equations.

Common Problems

References Display ??

Compile the complete main file in EasyLaTeX and wait for the job to finish. The platform handles the passes needed for references. If ?? remains, check label spelling, duplicate names, placement, and the first log error.

Numbers Are Out of Order

Numbers follow equation order in the main file; do not type them manually. After moving equations, recompile the complete main file on the platform and inspect the log. Check labels for duplicate or incorrect references.

\label Is Outside the Equation

A label after \end{equation} may refer to the wrong counter or fail. Move it inside equation, align, or the relevant environment.

Complete Example

latex
\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}

\begin{document}

Einstein's mass-energy relation is shown in Equation  \eqref{eq:mass-energy}.

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

The square expands as in Equation  \eqref{eq:square}.

\begin{align}
  (x+1)^2 &= x^2 + 2x + 1
  \label{eq:square}
\end{align}

\end{document}
Equation Numbering and References | EasyLaTeX | EasyLaTeX