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
\refinstead of\eqref.\refgives '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.
\labelmust be INSIDE\begin{equation}...\end{equation}. - Two equations same label. Causes duplicate-label error. Use unique labels: eq:foo, eq:bar.
#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 numberTry TypeTeX free Frequently Asked Questions
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.
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.
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.
\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.
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}.
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.
\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.
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.
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.