A package for recursive embedding of versionsDidier Rémy |
Abstract: This package provides macros for organizing serveral versions of a same file. This defined a \version environment with a boolean expression argument that is used to decide whether the version is to be part of the current compilation. Version environments may be embedding, and the depth of the environment is visible in the evaluation of the condition.
As a default, simple case, versions can be used to simply comment out code—with as opposed to other packages allows embedding of comments.
The Boolean expression package can be used to combine several booleans on the fly driving the compilation.
will render as:\sf Here is some outer text, followed by \begin{version}{\TRUE} \em some middle text, which itself contains some \begin{version}{\TRUE} \it inner text. \end{version} We continue with middle text, \end{version} and finish with outer text.
Here is some outer text, followed by some middle text, which itself contains some inner text. We continue with middle text, and finish with outer text.While setting the inner flag to
\FALSE
will produce.
Here is some outer text, followed by some middle text, which itself contains some inner text. We continue with middle text, and finish with outer text.The argument of
\begin{version}
is passed to the command
\VersionEval
, which by default pass its argument to \ORL
.
Hence several comma-separated boolean expressions can actually be passed
as argument and will be interpreted as OR
.
Hence, one may wirte
and the code will appear only if either boolean\newcommand{\LONG}{\TRUE} \newcommand{\DRAFT}{\FALSE} \begin{version}{\LONG,\DRAFT} This is visible if and only if \verb"\ORL{\LONG,\DRAFT}" evaluates to \verb"\TRUE". \end{version}
\LONG
or \DRAFT
is true:
, This is visible if and only ifThe command "" may be changed, as long as it evaluates its argument to a Church boolean, i.e. to a command that expect two arguments and return either one.\ORL{\LONG,\DRAFT}
evaluates to\TRUE
.
\ifversion
that expect an argument of the
same form and two arguments to be evaluated if the condition is true or
false respectively. Note that \ifversion
simply calls
\VersionEval
, which returns a Church Numeral.\VersionDepth
, which can be questioned.
The value during the evaluation of the argument is the outer value,
i.e. 0 for the outer most one.This document was translated from LATEX by HEVEA.