I have a document which I want to print in several (let's say 10) different versions. Some parts are just a draft, others are more or less finished, some are ready for publication and so on. I would like to associate a number between 1 and 10, called Release Level, to each part of the text. In the beginning I would like to specify a global Publication Level, let's say 5, and I want all parts of the text printed, which have a Release Level >=5.
Since there are already multiple packages available dealing with conditional printing I would like to use them to solve the problem. The following code uses comment
.
Using \rlcheckstatus
and rltext
works fine as described below, but the environment rlctxt
, which just combines both commands produces the error: ! File ended while scanning use of \next.<inserted text> \par
I tried to use versions
instead, but this produces the same problem. Is there any way around that problem?
\documentclass{scrartcl}
\usepackage{ifthen}
\usepackage{comment}
\newcounter{rlpublvl} %this counter stores the publication level
\newcommand{\rlstetpublvl}[1]{\setcounter{rlpublvl}{#1}} %sets the publication level to #1
\newenvironment{rltext}{}{}
\newcommand{\rlcheckstatus}[1]{ %activates the environment rltext if #1 >= rlpublvl
\addtocounter{rlpublvl}{-1}
\ifthenelse{#1 > \value{rlpublvl}}
{\includecomment{rltext}}
{\excludecomment{rltext}}
\addtocounter{rlpublvl}{1}
}
\newenvironment{rlctxt}[1]{\rlcheckstatus{#1}
\begin{rltext}}{\end{rltext}}
\begin{document}
\rlstetpublvl{5} %global publication level set to 5
\rlcheckstatus{5} %this is printed
\begin{rltext}
This is ready for publication.
\end{rltext}
\rlcheckstatus{0} %this is not printed
\begin{rltext}
This part is still under construction.
\end{rltext}
\rlcheckstatus{7} %this is again printed
\begin{rltext}
This part is good again.
\end{rltext}
\begin{rlctxt}{3} %this does not work
foo
\end{rlctxt}
\end{document}