4

I'm using comment and amsthm packages for comments and theorems. I'd like to skip some theorems. I've tried to create a new environment with theorem nested in a comment:

\documentclass{book}
\usepackage{amsthm,comment}
\excludecomment{myblock}

\newtheorem{thDef}{Definition}
\newenvironment{envDef}%
{\begin{myblock}\begin{thDef}}%
{\end{thDef}\end{myblock}}

\begin{document}
\begin{envDef}My definition.\end{envDef}
\end{document}

But I've got an error:

! File ended while scanning use of \next.

Did I miss something?

UPDATE: When I comment out the theorem environment directly, then LaTeX emits exactly the same error:

\newtheorem{thDef}{Definition}
\excludecomment{thDef}

! File ended while scanning use of \next.
3

You can't hide an environment marked with \excludecomment inside another environment's definition. The and \end{myblock} tag must appear explicitly in the input, because it's taken as a literal delimiter.

The solution is simpler:

% \excludecomments{envDef} % uncomment for not showing `envDef`

\newtheorem{thDef}{Definition}
\newenvironment{envDef}
  {\begin{thDef}}
  {\end{thDef}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.