# Environment to hide number from numbered equations

I'd like to create an environment that hides equation numbers from numbered equations. I'd should work like this:

\documentclass{article}
\begin{document}
% ---------------------------
% \begin{nonumber}
$$a + b = c \quad \text{this equation should be unnumbered}$$
% \end{nonumber}

$$a + b = c \quad \text{this equation should be numbered}$$
\end{document}

• why not simply use equation* ? (amsmath, or $) – David Carlisle Mar 22 at 18:10 • To make a long story short, I'm inputting them from an external text file which I load with a command, so the intended use would be like \begin{nonumber}\thatcommand\end{nonumber}. – noibe Mar 22 at 18:47 ## 1 Answer If you're only using equations, then the following will suffice: \documentclass{article} \newenvironment{noeqnumber} {\renewenvironment{equation}{\[}{$}}
{}

\begin{document}

\begin{noeqnumber}
$$a + b = c \quad \mbox{this equation should be unnumbered}$$
\end{noeqnumber}

$$a + b = c \quad \mbox{this equation should be numbered}$$

\end{document}


Note that \nonumber already exists, so you'd have to use a different environment name, like noeqnumber.

If you're using aligns, then we can adjust the counter stepping and tag printing mechanism:

\documentclass{article}

\usepackage{mathtools}
\makeatletter
% New tag form that gobbles the number
\newtagform{gobble}[\@gobble]{}{}
\makeatother

\let\oldrefstepcounter\refstepcounter

\newenvironment{noeqnumber}
{\renewcommand{\refstepcounter}[1]{%
% Only step counter if it is not equation
\ifnum\pdfstrcmp{##1}{equation}=0\else
\oldrefstepcounter{##1}%
\fi
}%
\usetagform{gobble}}
{}

\begin{document}

\begin{noeqnumber}
\begin{align}
a + b &= c     \quad \text{this equation should be unnumbered} \\
d &= e + f \quad \text{this equation should be unnumbered}
\end{align}
\end{noeqnumber}

$$a + b = c \quad \text{this equation should be numbered}$$

\end{document}