LaTeX Guide

LaTeX Equation Numbering

equation for numbered, equation* for unnumbered. \eqref to reference. \nonumber to skip individual lines.

Numbered equation with reference

\usepackage{amsmath}     % needed for \eqref

\begin{equation}
  E = m c^2
  \label{eq:einstein}
\end{equation}

% Reference in body text:
% "Equation~\eqref{eq:einstein} expresses..."
% Renders: "Equation (1) expresses..."

Unnumbered equation

% Three ways to display unnumbered:

\begin{equation*}        % using equation*
  a^2 + b^2 = c^2
\end{equation*}

\[
  a^2 + b^2 = c^2         % \[ ... \] shorthand
\]

\begin{align*}           % unnumbered align (note the *)
  a &= 1 \\
  b &= 2
\end{align*}

Selective numbering (in align)

\begin{align}
  a &= 1 \label{eq:first} \\
  b &= 2 \nonumber \\
  c &= 3 \label{eq:third}
\end{align}

Lines 1 and 3 numbered; line 2 has \nonumber so it's skipped. \notag is an alias.

Number by section (1.1, 1.2)

\usepackage{amsmath}
\numberwithin{equation}{section}

% Now equations are numbered as 1.1, 1.2, 1.3 in section 1
% Then 2.1, 2.2 in section 2, etc.
% Restarts at each section automatically.

Custom tag (instead of (1))

\begin{equation}
  E = m c^2 \tag{*}
\end{equation}

\begin{equation}
  F = m a \tag{$\dagger$}
\end{equation}

\begin{equation}
  PV = nRT \tag{ideal gas}
\end{equation}

Sub-equations (1a, 1b, 1c)

\begin{subequations}
  \label{eqs:laws}
  \begin{align}
    F &= ma \label{eq:newton-second} \\
    F &= G\frac{m_1 m_2}{r^2} \label{eq:newton-gravity} \\
    p &= mv \label{eq:newton-momentum}
  \end{align}
\end{subequations}

% Renders as (1a), (1b), (1c)
% \eqref{eqs:laws} → (1)
% \eqref{eq:newton-second} → (1a)

Common mistakes

  • Using \ref instead of \eqref. \ref gives '1', not '(1)'. Use \eqref.
  • Forgetting \usepackage{amsmath}. Required for \eqref, \numberwithin, subequations, align/gather/split.
  • Trailing \\ on last align line. Causes "Misplaced \noalign" error. Remove it.
  • Label outside the equation environment. \label must be INSIDE \begin{equation}...\end{equation}.
  • Two equations same label. Causes duplicate-label error. Use unique labels: eq:foo, eq:bar.
Typst equation numbering: one set rule
#set math.equation(numbering: "(1)")

$ E = m c^2 $ <einstein>

// Reference: see @einstein
// Skip numbering for one equation:
$ E = m c^2 $              // no label = no number
Try TypeTeX free

Frequently Asked Questions

How do I number equations in LaTeX?

Use the equation environment for automatic numbering: \begin{equation} E = mc^2 \end{equation} produces 'E = mc² (1)'. The number appears on the right by default. Each equation environment increments the counter automatically.

How do I suppress numbering on an equation?

Use the starred form: \begin{equation*} ... \end{equation*} (or \[ ... \]). Both produce centered display math without a number. For one line in a multi-line align, use \nonumber or \notag at the end of that line.

How do I cross-reference an equation?

Add \label{eq:name} inside the equation environment, then use \eqref{eq:name} in body text. \eqref produces (1) automatically with parentheses. \ref{eq:name} gives just '1' without parens — usually you want \eqref. Both auto-update as equations are added/removed.

What's the difference between \eqref and \ref?

\eqref{eq:name} produces '(1)' with parentheses — proper for equation references. \ref{eq:name} produces '1' without — same as referencing a section. Use \eqref for equations, \ref for sections/figures/tables. \eqref requires the amsmath package.

How do I number equations by section (1.1, 1.2 instead of 1, 2)?

Add \numberwithin{equation}{section} (from amsmath) to your preamble. Now equation 1 in section 2 numbers as (2.1), 2.2, etc. Numbering restarts each section. Same trick for figures and tables: \numberwithin{figure}{section}, \numberwithin{table}{section}.

How do I add a custom tag to an equation?

Use \tag{X} inside the equation environment: \begin{equation} E = mc^2 \tag{*} \end{equation} produces (*) instead of (1). Useful for labeling specific equations with a name like 'main equation' or '\dagger' for a footnote-style label.

How do I reset equation numbering?

\setcounter{equation}{0} resets to 0 (next equation will be 1). Combined with \numberwithin, this happens automatically at section boundaries. Manual reset: useful for restarting at appendix or in a new chapter.

How do I number sub-equations?

Use the subequations environment from amsmath: \begin{subequations} \begin{align} a &= 1 \\ b &= 2 \end{align} \end{subequations} produces (1a), (1b). Reference the whole group with \label{eqs:group}, individual lines with their own labels.

How do I put the equation number on the left?

Pass leqno to documentclass: \documentclass[leqno]{article}. Now all equation numbers appear on the left side. Some journals/conferences require this — check the call for papers.

More LaTeX guides