# Hiding an environment but keeping equation labels and their numbers inside

I want to hide some of the proofs of some lecture notes that are given to students. I defined a new proof environment hiddenproof because I want to only hide some of the proofs. I can then hide this environment (actually I'm replacing its content with the text "Will be presented in the lecture") via the environ package. That's all working well. However I'm using many equations and I'm also numbering them, here's a MWE:

\documentclass{scrartcl}

\usepackage{amsmath,amsthm,amssymb}

\renewenvironment{proof}{\noindent\textbf{Beweis.}\hspace*{1em}}{\qed\\}
\newenvironment{hiddenproof}{\noindent\textbf{Beweis.}\hspace*{1em}}{\qed\\}

\newif\ifhideproofs%
%\hideproofstrue%uncomment to hide proofs

\ifhideproofs%
\usepackage{environ}
\NewEnviron{hide}{\noindent\textbf{Beweis.}\hspace*{1em} In der Vorlesung.\hfill $\qed$\\[.5ex]}
\let\hiddenproof\hide%
\let\endhiddenproof\endhide%
\fi

\begin{document}

\begin{hiddenproof}
Some proof.
$$% \label{eq:eq1} Ax = b$$
\end{hiddenproof}

$$\label{eq:eq2} Ax = c$$

\end{document}


As the equation numbers are referenced in the lecture, I would like to keep them the same - No matter the proofs are visible or hidden. When the hiddenproof is not hidden, everything's fine: eq:eq1 will be labeled with (1) and eq:eq2 will be labeled with (2). However if I hide the proofs (by uncommenting \hideproofstrue), the first equation environment doesn't even exist anymore, and the second equation will get the label (1).

Is there any way to "count" all the equation environments (and align and gather) and increment the equation counter accordingly? Or maybe there's another way to hide some of the proofs so that the equation environments are not removed but rather made invisible.

• Welcome to tex.sx. Without knowing how hiddenproof is defined, or what theorem package you're using, any attempt to answer this question is going to be pure speculation. Please add the needed information. – barbara beeton Mar 20 at 23:21

\ifhideproofs%
\NewEnviron{hide}{\noindent\textbf{Beweis.}\hspace*{1em} In der Vorlesung.\hfill $\qed$\\[.5ex]%