| 1 |
\documentclass[pagesize=auto]{scrartcl} |
| 2 |
|
| 3 |
\usepackage{fixltx2e} |
| 4 |
\usepackage{etex} |
| 5 |
\usepackage{lmodern} |
| 6 |
\usepackage[T1]{fontenc} |
| 7 |
\usepackage[utf8]{inputenc} |
| 8 |
\usepackage{textcomp} |
| 9 |
\usepackage{hologo} |
| 10 |
\usepackage{framed} |
| 11 |
\usepackage{microtype} |
| 12 |
\usepackage{hyperref} |
| 13 |
|
| 14 |
\newcommand*{\mail}[1]{\href{mailto:#1}{\texttt{#1}}} |
| 15 |
\newcommand*{\pkg}[1]{\textsf{#1}} |
| 16 |
\newcommand*{\cs}[1]{\texttt{\textbackslash#1}} |
| 17 |
\makeatletter |
| 18 |
\newcommand*{\cmd}[1]{\cs{\expandafter\@gobble\string#1}} |
| 19 |
\makeatother |
| 20 |
\newcommand*{\env}[1]{\texttt{#1}} |
| 21 |
\newcommand*{\opt}[1]{\texttt{#1}} |
| 22 |
\newcommand*{\meta}[1]{\textlangle\textsl{#1}\textrangle} |
| 23 |
\newcommand*{\marg}[1]{\texttt{\{}\meta{#1}\texttt{\}}} |
| 24 |
\newcommand*{\oarg}[1]{\texttt{[}\meta{#1}\texttt{]}} |
| 25 |
|
| 26 |
\addtokomafont{title}{\rmfamily} |
| 27 |
|
| 28 |
\title{The \pkg{versions} package\thanks{This manual corresponds to \pkg{versions.sty}~v0.55, dated~2005/04/28.}} |
| 29 |
\subtitle{Omit passages optionally under \LaTeX} |
| 30 |
\author{Uwe Lück\thanks{\url{http://contact-ednotes.sty.de.vu}}} |
| 31 |
\date{2005/04/28} |
| 32 |
|
| 33 |
|
| 34 |
\begin{document} |
| 35 |
|
| 36 |
\maketitle |
| 37 |
|
| 38 |
\section{Legal matters:} |
| 39 |
|
| 40 |
Released under the terms of the \LaTeX\ Project Public License |
| 41 |
(\url{ftp://ctan.tug.org/tex-archive/macros/latex/base/lppl.txt} |
| 42 |
version~1.3a; |
| 43 |
essentially: Free to use, copy, distribute [sell] and change, |
| 44 |
but, if changed, the name must be changed; \emph{no warranty}). |
| 45 |
For copyright see above. |
| 46 |
|
| 47 |
This file has the LPPL maintenance status ``author-maintained''. |
| 48 |
The Current Maintainer of this file is Uwe Lück. |
| 49 |
|
| 50 |
|
| 51 |
\section{Short description:} |
| 52 |
\label{sec:short} |
| 53 |
|
| 54 |
Varies Stephen Bellantoni's `\pkg{version.sty}' in optionally omitting |
| 55 |
environments, defining (among others) \cmd{\includeversion} and |
| 56 |
\cmd{\excludeversion} as well as a `\env{comment}' environment. (For comparison |
| 57 |
to `\pkg{version.sty}', see Section `\hyperref[sec:version]{Improvements}' below.) So |
| 58 |
multiple versions of a document may be printed from one source file. |
| 59 |
Cf.~packages `\pkg{comment}' (very similar functions and more, see |
| 60 |
\hyperref[sec:comment]{comparison} below), `\pkg{verbatim}', `\pkg{optional}' (on CTAN). |
| 61 |
---Needs \LaTeX, even should work with \LaTeX 2.09 |
| 62 |
(please tell me if not). |
| 63 |
|
| 64 |
|
| 65 |
\section{Usage:} |
| 66 |
|
| 67 |
\subsection{User commands:} |
| 68 |
\label{sec:user} |
| 69 |
|
| 70 |
In the document part of your source file, put into environments |
| 71 |
\cmd{\begin}\marg{version} \meta{code} \cmd{\end}\marg{version} |
| 72 |
passages \meta{code} (or other code) to be omitted optionally. \meta{version} may |
| 73 |
be any string consisting of character tokens (see \TeX book, p.~40: |
| 74 |
`\cmd{\csname}'), and the document may contain environments with several |
| 75 |
names of this kind (\env{VERSIONa}, \env{VERSIONb}, etc.). Preceding |
| 76 |
\cmd{\excludeversion}\marg{version}, \cmd{\includeversion}\marg{version}, |
| 77 |
\cmd{\markversion}\marg{version} |
| 78 |
(in the preamble or even later on) control how these environments |
| 79 |
behave. |
| 80 |
% |
| 81 |
\begin{labeling}{\cmd{\excludeversion}\marg{version}} |
| 82 |
\item[\cmd{\excludeversion}\marg{version}] `\meta{version}' environments just not |
| 83 |
processed (ignored, i.\,e.); |
| 84 |
\item[\cmd{\includeversion}\marg{version}] `\meta{version}' environments processed as |
| 85 |
if \cmd{\begin}\marg{version} and \cmd{\end}\marg{version} |
| 86 |
just were not present, however they |
| 87 |
form groups like |
| 88 |
\verb+\begin{relax}+\meta{code}\verb+\end{relax}+ |
| 89 |
or \cmd{\begingroup} \meta{code} \cmd{\endgroup}. |
| 90 |
\item[\cmd{\markversion}\marg{version}] `\meta{version}' environments processed, |
| 91 |
resulting text may be marked in |
| 92 |
printout---for comparison of |
| 93 |
variants of your document, e.\,g. |
| 94 |
\end{labeling} |
| 95 |
% |
| 96 |
By default, these three commands send a message to screen, and |
| 97 |
\cmd{\markversion}\marg{version} results in printed marks indicating start, |
| 98 |
\cmd{\end}, and `\meta{version}'. Cf.~subsection `\hyperref[sec:customize]{Customize}' below. |
| 99 |
A warning is sent to screen if `\meta{version}' has been defined earlier |
| 100 |
(by \LaTeX, e.\,g.). (A `\meta{version}' environment must not overlap with |
| 101 |
other environments, of course, must be balanced with respect to |
| 102 |
\cs{if\dots}\cs{fi}, and must not contain \cmd{\outer} macros. In \LaTeX\ the only |
| 103 |
\cmd{\outer} macro is \verb+^^L+---\textsc{ascii} form feed.) |
| 104 |
TODO: |
| 105 |
(`\pkg{comment.sty}' and \env{comment} environment from `\pkg{verbatim.sty}' |
| 106 |
are superior concerning \cmd{\outer} macros. On request, I could |
| 107 |
equip my \cmd{\processifversion} with that \cmd{\outer} feature.) |
| 108 |
|
| 109 |
However, \cmd{\begin}\marg{version}\dots\cmd{\end}\marg{version} breaks inside macro |
| 110 |
arguments, e.g. of \cmd{\footnote} (it is even fragile). So there is |
| 111 |
\cmd{\processifversion}\marg{version}\marg{code} |
| 112 |
working analogously (grouping as well), depending on \cmd{\excludeversion} |
| 113 |
etc.\ (it is even robust). (`\pkg{optional.sty}' works similarly.) |
| 114 |
|
| 115 |
A pre-installed instance of `\meta{version}' is `\env{comment}', which is |
| 116 |
ignored by default. So you may put rather long comments as \meta{code} |
| 117 |
in \verb+\begin{comment}+\meta{code}\verb+\end{comment}+. (This feature serves |
| 118 |
compatibility with Stephen Bellantoni's `\pkg{version.sty}'.) |
| 119 |
Note that alternative packages `\pkg{comment}' and `\pkg{verbatim}' define |
| 120 |
\cmd{\comment} as well. |
| 121 |
|
| 122 |
|
| 123 |
\subsection{Options:} |
| 124 |
|
| 125 |
\verb+\usepackage[tracing]{versions}+ |
| 126 |
causes (i)~checking package commands for undefinedness, |
| 127 |
(ii)~messages on screen indicating line numbers of single excluded |
| 128 |
environments (`Ignore \meta{version}, lines \meta{xx} to \meta{yy}]'). If final line |
| 129 |
number and closing bracket don't appear on screen, the environment |
| 130 |
presumably contains (implicit) \cs{fi} or \cs{if\dots} not matching each other |
| 131 |
within that environment. This package option needs \LaTeXe\ and |
| 132 |
\TeX\ version greater equal~3.0\@. (No change of \cmd{\processifversion}.) |
| 133 |
|
| 134 |
\verb+\usepackage[nogroup]{versions}+ |
| 135 |
provides a user command \cmd{\includeversionno\-group}\marg{version} working like |
| 136 |
\cmd{\includeversion}\marg{version}, but included `\meta{version}' will form no |
| 137 |
grouping. |
| 138 |
|
| 139 |
|
| 140 |
\subsection{Customize:} |
| 141 |
\label{sec:customize} |
| 142 |
|
| 143 |
\sloppy |
| 144 |
To change messages from \cmd{\excludeversion}, \cmd{\includeversion}, |
| 145 |
\cmd{\markversion}, or to change printed marks resulting from |
| 146 |
\cmd{\markversion}, take some of the following lines into your file, |
| 147 |
remove left hand comment marks (`\verb+%+'), and change the definition. |
| 148 |
(Must perhaps be enclosed in \cmd{\makeatletter}\dots\cmd{\makeatother} |
| 149 |
or \verb+\catcode`\@=12+ \dots \verb+\catcode`\@=11+.) |
| 150 |
% |
| 151 |
\begin{verbatim} |
| 152 |
\renewcommand\versionmessage[2]{\typeout{*** `#1' #2. ***}} |
| 153 |
\renewcommand\beginmarkversion{\@Vs@sffbox{\@currenvir$>$}} |
| 154 |
\renewcommand\endmarkversion{\@Vs@sffbox{$<$\@currenvir}} |
| 155 |
\end{verbatim} |
| 156 |
% |
| 157 |
(For \LaTeXe, replace \cmd{\renewcommand} by \cmd{\renewcommand*}.) |
| 158 |
|
| 159 |
\fussy |
| 160 |
\renewcommand*{\labelenumi}{(\theenumi)} |
| 161 |
\begin{enumerate} |
| 162 |
\item \cmd{\versionmessage} is the style of screen reports from |
| 163 |
\cmd{\excludeversion} etc. Any redefinition must use two arguments. |
| 164 |
The first is the version name (\meta{version}), the second is one out of |
| 165 |
`\texttt{excluded}', `\texttt{included}', `\texttt{included with marks}'. |
| 166 |
|
| 167 |
\item \cmd{\beginmarkversion} and \cmd{\endmarkversion} is the style of marks |
| 168 |
surrounding environments `\meta{version}' after \cmd{\markversion}\marg{version}. |
| 169 |
Any redefinition must use no argument. \cmd{\@currenvir} is `\meta{version}'. |
| 170 |
\cmd{\@Vs@sffbox}\marg{code} as in package definition typesets argument CODE |
| 171 |
as \cmd{\textsf}\marg{code} and puts into an \cmd{\fbox}. |
| 172 |
\end{enumerate} |
| 173 |
|
| 174 |
|
| 175 |
\subsection{General warnings:} |
| 176 |
|
| 177 |
(For legal warnings see top of file, for errors and requirements see `\hyperref[sec:short]{Short description}', |
| 178 |
option `\opt{tracing}' and `\hyperref[sec:user]{user commands}' above.) |
| 179 |
This package uses \cmd{\includeversion} and \cmd{\excludeversion} and thus |
| 180 |
cannot be used at the same time as Stephen Bellantoni's |
| 181 |
`\pkg{version.sty}'. |
| 182 |
|
| 183 |
\begin{framed} |
| 184 |
Please send bug reports and other comments to above e-mail address! |
| 185 |
\end{framed} |
| 186 |
|
| 187 |
|
| 188 |
\section{Comparison with Viktor Eijkhout's `\pkg{comment.sty}':} |
| 189 |
\label{sec:comment} |
| 190 |
|
| 191 |
`\pkg{Comment}' even works under \hologo{plainTeX} as well as \LaTeX, present package |
| 192 |
under \LaTeX\ only. \cmd{\specialcomment} in `\pkg{comment}' supports special |
| 193 |
surroundings---this is missing here (but could easily be supplied on |
| 194 |
request). |
| 195 |
Included environments never form groups in `\pkg{comment}', here user may |
| 196 |
choose whether they form groups or not, at least for simple including |
| 197 |
(not with marks). `\pkg{comment}' includes by writing on and reading from |
| 198 |
disk, present package needs no writing on disk. |
| 199 |
Unlike the present package, `\pkg{comment}' skips even \cmd{\outer} macros, |
| 200 |
\cs{if\dots}'s and \cs{fi}'s. (So `\pkg{comment}' is better for ``real'' comments. |
| 201 |
---Concerning \cmd{\outer}, this feature is important for \hologo{plainTeX}, while |
| 202 |
under \LaTeX\ the only \cmd{\outer} macro usually is \verb+^^L+.) |
| 203 |
`\pkg{Comment}' sometimes produces wrong spaces |
| 204 |
and discovers `\verb+\end{comment}+' only if nothing else is in the input |
| 205 |
line. |
| 206 |
|
| 207 |
|
| 208 |
\section{Improvements vis-a-vis Stephen Bellantoni's `\pkg{version.sty}':} |
| 209 |
\label{sec:version} |
| 210 |
|
| 211 |
\begin{itemize} |
| 212 |
\item \cmd{\processifversion} added for excluding text inside arguments of, |
| 213 |
e.\,g., \cmd{\footnote} (where excluding \emph{environment} would break). |
| 214 |
\cmd{\processifversion} is even robust. |
| 215 |
\item \cmd{\@Esphack} instead of \cmd{\@esphack} at \cs{end} of excluded environment; |
| 216 |
needed for properly processing input space symbols there. |
| 217 |
\item \cmd{\begin} and \cmd{\end} of included environment may appear in separate |
| 218 |
lines without doubling spaces (\cmd{\@bsphack} and \cmd{\@esphack} used). |
| 219 |
\item Screen messages sent by \cmd{\includeversion} and \cmd{\excludeversion}. |
| 220 |
\item Large passages don't fill main memory when excluded. |
| 221 |
(`s' in `\pkg{versions}' means `safe'!) |
| 222 |
\item Optional tracing of excluded environments added. |
| 223 |
\item Option of including without grouping. |
| 224 |
\item Original \cmd{\gdef} and \verb+\csname #1END@NOTE\endcsname+ in |
| 225 |
\cmd{\excludeversion} were superfluous. |
| 226 |
\end{itemize} |
| 227 |
|
| 228 |
|
| 229 |
\section{Version history:} |
| 230 |
|
| 231 |
\newcommand*{\ver}{} |
| 232 |
\def\ver#1.#2 #3.{\rlap{#1.#2}\hphantom{v0.00} #3} |
| 233 |
\begin{labeling}{\ver v0.55 2005/04/28.} |
| 234 |
\item[\ver v0.1 2003/09/29.] Very first; |
| 235 |
sent to Donald, Victor, Christian, Volker. |
| 236 |
\item[\ver v0.2 2003/09/30.] \cmd{\@sV@iffalse} replacing \verb+\csname iffalse\fi+; |
| 237 |
\cmd{\@sV@ex}: \cmd{\@Esphack} in group, extra \cmd{\ignorespaces}. |
| 238 |
\item[\ver v0.3 2003/10/01.] Documentation: added warnings about \cs{if\dots} \cs{fi} and |
| 239 |
\cmd{\outer}---thanks to Victor Eijkhout; sent it to him. |
| 240 |
\item[\ver v0.31 2003/10/03.] Documentation: added that `\pkg{comment.sty}' and |
| 241 |
`\pkg{verbatim.sty}' are superior in the respect |
| 242 |
discussed above; also added comparison with |
| 243 |
`\pkg{comment.sty}'. |
| 244 |
\item[\ver v0.4 2003/10/06.] Documentation: Replaced stupid proposal of |
| 245 |
\cmd{\aftergroup} for including (needs stack!); |
| 246 |
retreated offer of partially enable skipping \\ |
| 247 |
\cmd{\outer}/\cs{if\dots}/\cs{fi}. (\cmd{\process\dots} typically comes too |
| 248 |
late to change category codes.) \\ |
| 249 |
\cmd{\xdef} $\to$ \cmd{\gdef} for \cmd{\@sV@ex}. |
| 250 |
Then changed all `\texttt{@sV}' into `\texttt{@Vs}'. |
| 251 |
Documentation: Referred to \TeX book for character |
| 252 |
tokens in version names. |
| 253 |
Removed \cmd{\@Vs@sphgobble} from \cmd{\@Vs@iprocess} (leave |
| 254 |
spacing to user); now robust without \cmd{\Declare\dots} \\ |
| 255 |
Then `\texttt{phgobble}' $\to$ `\texttt{phnoop}'. |
| 256 |
Added option `\opt{nogroup}'. |
| 257 |
Added \cmd{\nor\-malfont} in \cmd{\@Vs@sffbox}. |
| 258 |
Sent to Victor E. 2005/10/05; minor changes in |
| 259 |
documentation afterwards. |
| 260 |
\item[\ver v0.5 2003/10/10.] \cmd{\@vS@iprocess} $\to$ \cmd{\@vS@iprocess}; |
| 261 |
\verb+\long\def\@Vs@iprocess+. Sent to CTAN. |
| 262 |
\item[\ver v0.51 2003/10/15.] Documentation: added `\pkg{comment}' drawback: |
| 263 |
\verb+\end{document}+ works in own line only. |
| 264 |
\item[\ver v0.52 2004/05/24.] One `makro' $\to$ `macro'. |
| 265 |
\item[\ver v0.53 2004/08/19.] Named LPPL~v1.3, added maintenance status. |
| 266 |
\item[\ver v0.54 2005/01/10.] \url{http://www.contact.uwe.lueck.de.vu}, LPPL v1.3a. |
| 267 |
\item[\ver v0.55 2005/04/28.] \url{http://contact-ednotes.sty.de.vu}; |
| 268 |
\verb+\global\@ignorefalse+. |
| 269 |
\end{labeling} |
| 270 |
|
| 271 |
\end{document} |