Tx · LaTeX & TikZ

Why Does mathtools Hide Parts of Appendix Equation Numbers?

Published By the 9to5Science editorial team

At a glance

  1. 1. Check the numbering

    Use numberwithin to make equation numbers include the appendix section, such as A.1.

  2. 2. Turn off filtering

    Set showonlyrefs=false before the appendix equations if you want every equation numbered.

  3. 3. Check references

    If numbers are still malformed, test without showonlyrefs and inspect custom numbering commands or package interactions.

When equations in an appendix appear to have missing pieces in their numbers, the issue may be the showonlyrefs setting from mathtools. That setting hides numbers for equations that are not referenced; it is not a command for changing the format of equation numbers.

If you want every appendix equation numbered, switch off the setting before those equations. If you want numbers such as A.1, also make sure the equation counter is numbered within the section counter.

Show all appendix equation numbers

The following minimal example numbers the appendix equation as (A.1) and keeps its number visible even though the equation is not referenced:

\documentclass{article}
\usepackage[showonlyrefs]{mathtools}
\numberwithin{equation}{section}

\begin{document}

\section{Main text}
\begin{equation}
a=b
\end{equation}

\appendix
\section{Proof}
\mathtoolsset{showonlyrefs=false}

\begin{equation}
x+y=z
\end{equation}

\end{document}

mathtools loads the equation tools needed for \numberwithin. In an article document, \appendix changes section labels to letters. Since the equation counter is numbered within the section, the appendix equation number includes the lettered section label. The \mathtoolsset line disables reference-based filtering, so the equation number is printed even without a reference.

Put \mathtoolsset{showonlyrefs=false} before the first equation whose number you want displayed. You can use it for the entire appendix, or switch it back on later if you specifically want unreferenced equations hidden again.

If you want only referenced equations numbered

Leave showonlyrefs enabled, but make sure each equation whose number should appear is actually referenced. For example:

\begin{equation}\label{eq:result}
x+y=z
\end{equation}

Equation~\eqref{eq:result} gives the result.

A \label records an equation number for later use; it does not itself refer to the equation. If you want its number shown under showonlyrefs, use a reference such as \eqref{eq:result} in the document.

If parts of the number are still missing

Temporarily turn off showonlyrefs and compile again. If the number is still malformed, the problem is likely elsewhere: check custom definitions of \theequation, manual tags, counter-reset commands, and other packages that modify equation numbering. Also verify that \numberwithin{equation}{section} is in effect and that appendix sections are being created normally.

For a document-specific bug, reduce the source to a small example containing the document class, relevant packages, numbering commands, one appendix section, and one equation. This helps distinguish a showonlyrefs interaction from a separate numbering-format issue.

Common mistakes

  • Expecting a label to display a number: \label stores a reference target but is not itself a reference.
  • Changing the number format to fix filtering: \numberwithin controls the counter format and reset behavior; showonlyrefs controls whether numbers are displayed.
  • Switching off the option too late: Set showonlyrefs=false before the appendix equations you want numbered.
  • Assuming the workaround fixes every malformed number: If the number is still broken with filtering off, investigate the document’s counter definitions or package interactions.

References

  1. The mathtools package

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.