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:




%\hideproofstrue%uncomment to hide proofs

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


  Some proof.
    Ax = b

  Ax = c


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.

  • 2
    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. Commented Mar 20, 2019 at 23:21

1 Answer 1


You could input the contents of the environment into a box that is never used. So every macro inside the environment is expanded (including counters) but never printed:

  \NewEnviron{hide}{\noindent\textbf{Beweis.}\hspace*{1em} In der Vorlesung.\hfill $\qed$\\[.5ex]%
    \setbox0\vbox{\BODY}% execute env without printing anything
  • That's exactly what I wanted, thank you Commented Mar 21, 2019 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .