I just found out about the versions
package here and am interested in using it to hide solutions in a problem set document. Recall that, to create versions block, in the preamble, you need
\usepackage{versions}
\excludeversion{sol}
%\includeversion{sol}
and, in the document,
\begin{sol} ... \end{sol}
Here, the blocks labeled "sol" will be excluded.
In my document, I define a new environment "Solution" as
\newenvironment{Solution}{\begin{sol} \\ \textbf{Solution: }}{\end{sol}}
This construction works perfectly if I instruct LaTeX to include the "sol" blocks, but chokes if I try to exclude them. For example, the following code chokes and gives an Incomplete \iffalse
error:
\documentclass{article}
\usepackage{versions}
\excludeversion{sol}
%\includeversion{sol}
\newenvironment{Solution}{
\begin{sol}\\ \textbf{Solution: }}{
\end{sol}}
\begin{document}
\section{Question 1}
What is $2+2$?
\begin{Solution}
It is $2+2=4$.
\end{Solution}
\end{document}
If I change the commenting and include "sol", then this code works as expected. I'm guessing that there's something going on with the way that the versions package works. Any suggestions?