I would like to show and hide a verbatim or spverbatim environment based on a boolean condition (sth. like \showenv). I tried the solutions proposed at Hide custom environment content based on boolean, e.g. when using
\usepackage{environ}
\NewEnviron{myenv}{
\ifshow
\spverbatim{\BODY}
\fi}
...
\begin{myenv}
Test 1
Test 2
\end{myenv}
I get the following errors:
! Undefined control sequence.
\env@myenv@process -> \ifshow
! Extra \else.
! Extra \fi.
! Paragraph ended before \@tempa was complete.
! Paragraph ended before \verbatim@test was complete.
\NewEnvironfor processing verbatim material. There are already similar questions on the site. – egreg Sep 01 '14 at 16:49