For section-based equation numbers such as (2.1), load amsmath and put \numberwithin{equation}{section} in the preamble. This guide helps Mac users choose a numbering scheme, configure resets, and check references across a long document. LaTeX equation-numbering documentation

Choose the numbering scheme before changing counters

Start with the document class and the number you want a reader to cite. The standard article class uses a continuous equation sequence. Standard report and book classes already reset equations at chapters and prefix their numbers with the chapter number. These defaults matter when adapting an existing document. Standard Document Classes for LaTeX

Desired result Configuration
Continuous numbers in standard article Keep the class default
Section numbers such as (2.1) Add \numberwithin{equation}{section}
Chapter numbers in standard report or book Keep the class default
Continuous numbers in standard report or book Remove the equation-to-chapter relationship with \counterwithout{equation}{chapter}
A related group such as (2.3a), (2.3b) Wrap its displays in subequations

These choices combine class defaults with the documented counter commands and the amsmath grouping environment. For a custom class, inspect its documentation before assuming the standard defaults apply. Standard class definitions, Counter relationship commands, Subequation examples

Treat numbering as three separate decisions: the stored counter value, its printed representation, and the event that resets it. For example, a section prefix alone does not establish a section reset. The \numberwithin command configures both the hierarchy and its printed form; current amsmath implements it through the kernel’s \counterwithin command. LaTeX equation-numbering implementation

Build a complete section-numbered example on your Mac

The following complete document assumes a working LaTeX installation and an editor configured for pdfLaTeX. Save it as numbering-demo.tex. In TeXShop, use your pdfLaTeX engine and press Command-T to typeset; the developer’s release notes document this shortcut. TeXShop changes

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

\begin{document}

\section{Algebraic identities}
\begin{equation}
  (a+b)^2=a^2+2ab+b^2
  \label{eq:square}
\end{equation}

\begin{subequations}\label{eq:pair}
\begin{align}
  (a+b)(a-b)&=a^2-b^2 \label{eq:difference}\\
  a(b+c)&=ab+ac \label{eq:distribute}
\end{align}
\end{subequations}

\begin{equation}
  (a+b)+c=a+(b+c)
  \label{eq:associate}
\end{equation}

The group is \eqref{eq:pair}; its first identity is
\eqref{eq:difference}.

\section{Polynomial identities}
\begin{equation}
  (x+y)^3=x^3+3x^2y+3xy^2+y^3
  \label{eq:cube}
\end{equation}

Compare \eqref{eq:square} and \eqref{eq:cube}.

\appendix
\section{Additional identity}
\begin{equation}
  x^2+2xy+y^2=(x+y)^2
  \label{eq:appendix-square}
\end{equation}

\end{document}

Typeset twice initially, and repeat if reference-change warnings remain. LaTeX passes label information between runs through its auxiliary file, so the first PDF can contain unresolved references. Keep labels inside the numbered display they identify. LaTeX cross-reference implementation

Here is the expected numbering trace, derived from the configuration above. Use it as a small acceptance check before transferring the setup to your manuscript; these are illustrative expected results, not a reported compilation.

Checkpoint Expected number
First identity (1.1)
Parent reference for the pair (1.2)
Two identities inside the pair (1.2a), (1.2b)
Identity following the pair (1.3)
First identity in section 2 (2.1)
First appendix identity (A.1)

The subequations wrapper reserves one parent number, then restores the main sequence when it ends. Its official examples demonstrate this return to ordinary numbering. The appendix result follows from standard article changing \thesection to letters while the equation format continues to use that section representation. Subequation examples, Standard appendix definitions

No LaTeX compiler was available in the research environment, so this document was inspected against the retrieved documentation rather than compiled.

Select an environment that supports the numbers you need

Counter configuration does not determine how many numbers a display receives. That depends on its environment. This distinction is especially useful when converting a long derivation into individually referenced steps. User’s Guide for the amsmath Package, displayed equations

Environment with amsmath loaded Numbering behavior
equation One number
equation* or \[ ... \] No automatic number
align, gather, alignat, flalign Automatic numbering by row
Their starred forms No automatic numbering
multline One number across a multiline expression
split inside equation One enclosing equation number
aligned inside equation One enclosing equation number

Use align when separate rows need references. For a derivation that should have one reference, use equation containing split. Do not put align inside equation: it is already a display structure. The following is a body fragment for a document loading amsmath. Supported display structures

\begin{equation}
\begin{split}
  (a+b)^2
    &= (a+b)(a+b)\\
    &= a^2+2ab+b^2
\end{split}
\label{eq:expanded-square}
\end{equation}

To suppress an individual align row, put \notag before its row ending. For an exceptional custom identifier, \tag{P} prints (P); \tag*{P} prints P without added parentheses. Place such a tag in the supporting display, rather than inside split. Number suppression and tags

Change reset relationships without leaving hidden dependencies

Modern LaTeX supplies \counterwithin and \counterwithout directly. They entered the kernel in the April 2018 release; an older installation requires the chngcntr package for these commands. The package manual documents their starred forms and formatting behavior. LaTeX News, Issue 28, The chngcntr package

For continuous equation numbers in a standard report or book, add this preamble fragment after loading packages. The unstarred command removes the chapter reset relationship and changes the printed equation number to an Arabic numeral. It does not change the current counter value. The chngcntr package

\counterwithout{equation}{chapter}

When replacing section-based numbering with chapter-based numbering, explicitly remove the old section relationship first. Adding a chapter relationship alone leaves the previous dependency in place. This preamble fragment assumes report or book, amsmath, and an earlier section-based configuration:

\counterwithout*{equation}{section}
\numberwithin{equation}{chapter}

The star preserves the existing printed format during removal; the following command establishes the intended format. Conversely, \counterwithin* adds a reset relationship without rewriting the printed representation. Use starred commands when you deliberately manage formatting separately. Counter relationship semantics

Restart at a specific number only when the document requires it

A one-time restart changes the stored value. Immediately before the next numbered display, \setcounter{equation}{0} makes that display number 1 within the active format. To make the next number 7, set the counter to 6. LaTeX’s counter documentation distinguishes assigning a value from stepping it by one. LaTeX counter implementation

This body fragment, for the section-numbered example, makes the next display end in .7:

\setcounter{equation}{6}
\begin{equation}
  a(b+c)=ab+ac
  \label{eq:restart-seven}
\end{equation}

Do this outside a subequations wrapper when you intend to change the main sequence. Inside that wrapper, the equation counter is being used for subordinate numbering and the parent value is restored on exit. Subequations implementation

Before introducing a manual restart, write down the last number already used in that section. Restarting at 1 under the same prefix can create repeated visible identifiers even when label names differ. Prefer a structural reset at the next section or chapter when that matches the document’s organization.

Diagnose numbering errors in a long manuscript

Use this sequence to locate the setting responsible for an unexpected number. It separates configuration problems from display choices and reference updates.

  1. Identify the governing class. Compare its documented behavior with the standard class defaults before changing the preamble.
  2. Search the source for numbering commands. Inspect occurrences of \numberwithin, \counterwithin, \counterwithout, \theequation, and \setcounter. Record both the printed format and each reset relationship.
  3. Check the display environment. A starred display has no automatic number; a multiline display can legitimately have only one.
  4. Check label placement. Keep each equation label inside its display, and each row label on its intended numbered row. Put a group label immediately after \begin{subequations}.
  5. Recompile until references settle. If a reference still fails, compare its key with the corresponding label and inspect the log for undefined or multiply defined labels.

The environment and group-label checks follow the amsmath guide; the reference checks follow LaTeX’s auxiliary-file mechanism. Equation numbering and labels, LaTeX cross-reference implementation

Finish by checking the first equation after every structural boundary you use: section, chapter, subequation group, and appendix. Compare those numbers with your chosen scheme, then check one reference to each. This gives you a focused way to verify the configuration before continuing work on the full document.

Sources