When I use the versions package to conditionally exclude content like this:
\documentclass{article}
\usepackage{color}% just as example
\usepackage[tracing]{versions}
\excludeversion{vers}% opposite to \includeversion{vers}
\newenvironment{test}{%
START%
\vers%
\color{red}%
}{%
\endvers%
END% is excluded but should not be excluded
}
\begin{document}
before
\begin{test}
% content is excluded for \excludeversion{vers}
% and included for \includeversion{vers} above
inside
\end{test}
after
\end{document}
I can exclude the content of the vers
environment, as intended by the use of the versions
package. But also END
gets excluded (after \endvers
), opposed to my intention. With \includeversion{vers}
also END
gets included (as intended). What do I do wrong, and how do I fix it?
It is possible to define
\newcommand{\afterendvers}{%
END% and all other stuff I want to have executed here
}
and replace \end{test}
by \end{test}\afterendvers
in the whole document, but a more "TeXnical" solution would be nice.
Related issue: With \includeversion{vers}
END
is printed in red, although
environments processed as if
\begin{<version>}
and\end{<version>}
just were not present, however they form groups like\begin{relax} <code> \end{relax}
or\begingroup <code> \endgroup
(from the versions manual), but
\vers%
\bgroup%
\color{red}%
}{%
\egroup%
\endvers%
END%
leads to END
being written in black, as expected. I.e.: \vers
and \endvers
do not appear to act as \begingroup
and \endgroup
in this case.
\vers
contains a\let \end \fi
and\iffalse
, so will ignore everything until the next\end{<current environment>}
, where the current environment is set by the last\begin
, i.e.test
here. I don't think this\end
is expanded, so the\endvers%
andEND
is never seen.version
doesn't support such a usage.versions
author) to either improve the package to support such nesting (without an idea how to do so) or to write a warning into the documentation - if no ingenious answer is given later.versions
maintainer, and will give feed-back when I got an answer.