1 % \iffalse meta-comment
4 % The LaTeX3 Project and any individual authors listed elsewhere
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
10 % It may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either version 1.3c
12 % of this license or (at your option) any later version.
13 % The latest version of this license is in
14 % http://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2005/12/01 or later.
18 % This file has the LPPL maintenance status "maintained".
20 % The list of all files belonging to the LaTeX base distribution is
21 % given in the file `manifest.txt'. See also `legal.txt' for additional
24 % The list of derived (unpacked) files belonging to the distribution
25 % and covered by LPPL is defined by the unpacking scripts (with
26 % extension .ins) which are part of the distribution.
31 % ^^A These shouldn't come out in .ist files, hence the module
32 % ^^A comments, or in the printed version, hence temporary comment
33 % ^^A category for `<'
35 %<+package|shortvrb>\NeedsTeXFormat{LaTeX2e}[1994/12/01]
36 %<+package> \ProvidesPackage{doc}
37 %<+shortvrb>\ProvidesPackage{shortvrb}
38 %<+package|shortvrb> [2014/09/29 v2.1e
39 %<+package|shortvrb> Standard LaTeX documentation package (FMi)]
44 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
45 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
46 %% Digits \0\1\2\3\4\5\6\7\8\9
47 %% Exclamation \! Double quote \" Hash (number) \#
48 %% Dollar \$ Percent \% Ampersand \&
49 %% Acute accent \' Left paren \( Right paren \)
50 %% Asterisk \* Plus \+ Comma \,
51 %% Minus \- Point \. Solidus \/
52 %% Colon \: Semicolon \; Less than \<
53 %% Equals \= Greater than \> Question mark \?
54 %% Commercial at \@ Left bracket \[ Backslash \\
55 %% Right bracket \] Circumflex \^ Underscore \_
56 %% Grave accent \` Left brace \{ Vertical bar \|
57 %% Right brace \} Tilde \~}
59 %\iffalse This is a METACOMMENT
60 % Everything up to the next `\ fi' (without a blank) will
61 % be ignored. This is necessary because `%' may no longer
62 % be a comment mark when this file is read in.
65 %% Package `doc' to use with LaTeX 2e
66 %% Copyright (C) 1989-1999 Frank Mittelbach, all rights reserved.
69 % Version: Date: Changes:
71 % 1.0a 5.5.88 This is nothing but a collection of tests and
72 % hacks. It is certainly going to be greatly
74 % Better not to use it!
75 % 1.5a and earlier... are not longer recorded
76 % 1.5b and higher... are documented with the (undocumented) \changes
79 % \changes{v1.5f}{1989/4/29}{Thanks to Brian who documented the
80 % \cs{changes} macro feature.}
81 % \changes{v1.5g}{1989/5/07}{MacroTopsep now called MacrocodeTopsep and
82 % new MacroTopsep added}
83 % \changes{v1.5h}{1989/05/17}{All lines shortened to <72 characters}
84 % \changes{v1.5j}{1989/06/09}{Corrections by Ron Whitney added}
85 % \changes{v1.5q}{1989/11/03}{`\ldots{}Listing macros renamed to
86 % `\ldots{}Input. Suggested by R. Wonneberger}
87 % \changes{v1.5w}{1990/02/05}{Counter codelineno renamed to CodelineNo}
88 % \changes{v1.9a}{1993/12/02}{Upgrade for LaTeX2e}
89 % \changes{v1.9d}{1993/12/20}{Protected changes entry.}
90 % \changes{v1.0p}{1994/05/21}{Use new error commands}
93 % \hyphenation{make-index}
95 % \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
96 % \DoNotIndex{\@flushglue,\@gobble,\@input}
97 % \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
98 % \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
99 % \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
100 % \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
101 % \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
102 % \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
103 % \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
104 % \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
105 % \DoNotIndex{\egroup}
106 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
107 % \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
108 % \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
109 % \DoNotIndex{\ifcase}
110 % \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
111 % \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
112 % \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
113 % \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
114 % \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
115 % \DoNotIndex{\strutbox}
116 % \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
117 % \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
118 % \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
119 % \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
120 % \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
121 % \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
122 % \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
123 % \DoNotIndex{\nopagebreak}
124 % \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
125 % \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
126 % \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
127 % \DoNotIndex{\[,\{,\},\]}
128 % \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
129 % \DoNotIndex{\baselineskip,\begin,\tw@}
130 % \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
131 % \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
132 % \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
133 % \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
134 % \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
135 % \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
136 % \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
137 % \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
138 % \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
139 % \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
140 % \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
141 % \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
142 % \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
143 % \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
144 % \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
145 % \DoNotIndex{\bfdefault}
148 % \setcounter{StandardModuleDepth}{1}
150 % {\catcode`\p=12 \catcode`\t=12 ^^A hack used later on to print
151 % \gdef\dimenvalue#1pt{$#1$pt}} ^^A a register value with a - sign
153 % \newcommand{\DOC}{\texttt{doc}}
155 % \changes{v1.9t}{1995/05/11}{Use \cs{GetFileInfo}}
156 % \GetFileInfo{doc.sty}
158 % \title{The \DOC{} and \texttt{shortvrb} Packages\thanks
159 % {This file has version number \fileversion{} dated \filedate{}.}}
160 % \author{Frank Mittelbach\thanks{Further commentary added at Royal
161 % Military College of Science by B. Hamilton Kelly; English
162 % translation of parts of the original German commentary
163 % provided by Andrew Mills; fairly substantial additions,
164 % particularly from \texttt{newdoc}, and
165 % documentation of post-v1.5q features added at v1.7a by Dave
166 % Love (SERC Daresbury Lab). Extraction of \texttt{shortvrb}
167 % package added by Joachim Schrod (TU~Darmstadt).}}
169 % \MaintainedByLaTeXTeam{latex}
173 % This package contains the definitions that are necessary to
174 % format the documentation of package files. The package was
175 % developed in Mainz in cooperation with the Royal Military College
176 % of Science. This is an update which documents various changes
177 % and new features in \DOC{} and integrates the features of
182 % \IfFileExists{multicol.sty}{\multicolstrue}{}
185 % \addtocontents{toc}{\protect\begin{multicols}{2}}
188 % {\parskip 0pt ^^A We have to reset \parskip
189 % ^^A (bug in \LaTeX)
193 % \changes{v1.7a}{1992/02/25}{Miscellaneous small changes to the text}
196 % \begin{multicols}{2}[\section*{Preface to version 1.7}]
197 % \else \section*{Preface to version 1.7} \fi
199 % This version of \texttt{doc.dtx} documents changes which have occurred
200 % since the last published version \cite{art:doc} but which have been
201 % present in distributed versions of \texttt{doc.sty} for some time. It
202 % also integrates the (undocumented) features of the distributed
203 % \texttt{newdoc.sty}.
205 % The following changes and additions have been made to the user
206 % interface since the published version~\cite{art:doc}. See
207 % \S\ref{sec:interface} for more details.
208 % \begin{description}
209 % \item[Driver mechanism] "\DocInput" is now used in the driver file
210 % to input possibly multiple independent \DOC{} files and \DOC{} no
211 % longer has to be the last package. "\IndexListing" is replaced
213 % \item[Indexing] is controlled by "\PageIndex" and "\CodelineIndex",
214 % one of which must be specified to produce an index---there is no
215 % longer a "\makeindex" in the default "\DocstyleParms";
216 % \item[The \texttt{macro} environment] now takes as argument the
217 % macro name {\em with\/} the backslash;
218 % \item[Verbatim text] Newlines are now forbidden inside "\verb" and
219 % commands "\MakeShortVerb" and "\DeleteShortVerb" are provided for
220 % verbatim shorthand;
221 % \item[\texttt{\bslash par}] can now be used in "\DoNotIndex";
222 % \item[Checksum/character table support] for ensuring the integrity
223 % of distributions is added;
224 % \item[\texttt{\bslash printindex}] becomes "\PrintIndex";
225 % \item[\texttt{multicol.sty}] is no longer necessary to use \DOC{} or
226 % print the documentation (although it is recommended);
227 % \item[`Docstrip' modules] are recognised and formatted specially.
230 % As well as adding some completely new stuff,
231 % the opportunity has been taken to add some commentary to the code
232 % formerly in \texttt{newdoc.sty} and that added after version 1.5k of
233 % \texttt{doc.sty}. Since (as noted in the sections concerned) this
234 % commentary wasn't written by Frank Mittelbach but the code was, it is
235 % probably {\em not\/} true in this case that ``if the code and
236 % comments disagree both are probably wrong''!
240 % There are some known bugs in this version:
242 % \item The "\DoNotIndex" command doesn't work for some single
243 % character commands most noticeable "\%".
244 % \item The `General changes' glossary entry would come out after
245 % macro names with a leading "!" and possibly a leading |"|;
246 % \item If you have an old version of \textsf{makeindex} long "\changes"
247 % entries will come out strangely and you may find the section
248 % header amalgamated with the first changes entry. Try to get an
249 % up-to-date one (see p.~\pageref{makeindex:version});
250 % \item Because the accompanying \textsf{makeindex} style files support
251 % the inconsistent attribute specifications of older and newer
252 % versions \textsf{makeindex} always complains about three `unknown
253 % specifier's when sorting the index and changes entries.
254 % \item If "\MakeShortVerb" and "\DeleteShortVerb" are used with
255 % single character arguments, e.g., "{|}" instead of "{\|}" chaos
258 % (Some `features' are documented below.)
260 % \subsection*{Wish list}
263 % \item Hooks to allow "\DescribeMacro" and "\DescribeEnv" to write
264 % out to a special file information about the package's `exported'
265 % definitions which they describe. This could subsequently be
266 % included in the \texttt{docstrip}ped \texttt{.sty} file in a
267 % suitable form for use by smart editors in command completion,
268 % spelling checking etc., based on the packages used in a document.
269 % This would need agreement on a `suitable form'. \item Indexing of
270 % the modules used in \texttt{docstrip}'s "%<" directives. I'm not
271 % sure how to index directives containing module combinations; \item
272 % Writing out bibliographic information about the package; \item Allow
273 % turning off use of the special font for, say, the next guarded
280 % \begin{multicols}{2}[\medskip \rule{\textwidth}{.3pt}
281 % \section{Introduction}]
283 % \section{Introduction}
286 % The \TeX{} macros which are described here allow definitions and
287 % documentation to be held in one and the same file. This has the
288 % advantage that normally very complicated instructions are made
289 % simpler to understand by comments inside the definition. In addition
290 % to this, updates are easier and only one source file needs to be
291 % changed. On the other hand, because of this, the package files are
292 % considerably longer: thus \TeX{} takes longer to load them. If this
293 % is a problem, there is an easy remedy: one needs only to run the
294 % \texttt{docstrip.tex} program that removes nearly all lines that begin
298 % The idea of integrated documentation was born with the development
299 % of the \TeX{} program; it was crystallized in Pascal with the \Web{}
300 % system. The advantages of this method are plain to see (it's easy
301 % to make comparisons \cite{art:Knuthliterat}). Since this
302 % development, systems similar to \Web{} have been developed for other
303 % programming languages. But for one of the most complicated
304 % programming languages (\TeX) the documentation has however been
305 % neglected. The \TeX{} world seems to be divided between:---
306 % \begin{itemize} \item a couple of ``wizards'', who produce many
307 % lines of completely unreadable code ``off the cuff'', and \item many
308 % users who are amazed that it works just how they want it to do. Or
309 % rather, who despair that certain macros refuse to do what is
310 % expected of them.\end{itemize}
312 % I do not think that the \Web{} system is {\em the\/} reference work;
313 % on the contrary, it is a prototype which suffices for the
314 % development of programs within the \TeX{} world. It is sufficient,
315 % but not totally sufficient.\footnote{I know that this will be seen
316 % differently by a few people, but this product should not be seen as
317 % the finished product, at least as far as applications concerning
318 % \TeX{} are concerned. The long-standing debate over `multiple
319 % change files' shows this well.} As a result of \Web, new programming
320 % perspectives have been demonstrated; unfortunately, though, they
321 % haven't been developed further for other programming languages.
323 % The method of documentation of \TeX{} macros which I have introduced
324 % here should also only be taken as a first sketch. It is designed
325 % explicitly to run under \LaTeX{} alone. Not because I was of the
326 % opinion that this was the best starting point, but because from this
327 % starting point it was the quickest to develop.\footnote{This
328 % argument is a bad one, however, it is all too often trotted out.} As
329 % a result of this design decision, I had to move away from the
330 % concept of modularization; this was certainly a step backward.
332 % I would be happy if this article could spark off discussion over
333 % \TeX\ documentation. I can only advise anyone who thinks that they
334 % can cope without documentation to ``Stop Time'' until he or she
335 % completely understands the \AmSTeX{} source code.
341 % \subsection{Using the \DOC{} package}
343 % Just like any other package, invoke it by requesting it with a
344 % |\usepackage| command in the preamble. \textsf{Doc}'s use of
345 % |\reversemarginpars| may make it incompatible with some classes.
346 % \changes{v1.7a}{1992/02/25}{Altered usage info}
349 % \ifmulticols\end{multicols}\fi
352 % \section{The User Interface}\label{sec:interface}
353 % \subsection{The driver file}
355 % If one is going to document a set of macros with the \DOC{}
356 % package one has to prepare a special driver file which produces the
357 % formatted document. This driver file has the following
360 % \noindent |\documentclass[|\meta{options}]^^A
361 % |{|\meta{document-class}|}|\\[1pt]
362 % |\usepackage{doc}|\\[3pt]
363 % \hspace*{10pt}\meta{preamble}\\[3pt]
364 % |\begin{document}|\\[3pt]
365 % \hspace*{10pt}\meta{special input commands}\\[3pt]
368 % The \meta{document-class} might be any document class, I normally
369 % use \texttt{article}.
371 % In the \meta{preamble} one should place declarations which
372 % manipulate the behavior of the \DOC{} package like
373 % |\DisableCrossrefs| or |\OnlyDescription|.
375 % \DescribeMacro\DocInput \DescribeMacro\IndexInput
376 % Finally the \meta{special input commands} part should contain one or
377 % more |\DocInput|\meta{file name} and/or
378 % |\IndexInput|\meta{file name} commands. The
379 % |\DocInput| command is used for files prepared for the
380 % \DOC{} package whereas |\IndexInput| can be used for all kinds of
381 % macro files. See page \pageref{..Input} for more details of
382 % "\IndexInput". Multiple "\DocInput"s can be used with a
383 % number of included files which are each self-contained
384 % self-documenting packages---for instance, each containing
387 % As an example, the driver file for the \DOC{} package itself is
388 % the following text surrounded by "%<*driver>" and "%</driver>".
389 % To produce the documentation you can simply run the \texttt{.dtx}
390 % file through \LaTeX{} in which case this code will be executed
391 % (loading the document class \texttt{ltxdoc}, etc.) or you can
392 % extract this into a separate file by using
393 % the \texttt{docstrip} program.
394 % The line numbers below are added by
395 % \DOC{}'s formatting.
396 % Note that the class \textsf{ltxdoc} has the \DOC{} package
398 % \changes{v1.7a}{1992/03/06}{Added
399 % docstrip-derivable driver file as example.}
400 % \changes{v1.7c}{1992/04/01}{Expurgated ltugboat.sty from driver.}
403 \documentclass{ltxdoc}
405 %\DisableCrossrefs % Say \DisableCrossrefs if index is ready
407 \RecordChanges % Gather update information
408 %\OnlyDescription % comment out for implementation details
409 %\OldMakeindex % use if your MakeIndex is pre-v2.9
410 \setlength\hfuzz{15pt} % dont make so many
411 \hbadness=7000 % over and under full box warnings
419 % \subsection{General conventions}
421 % A \TeX{} file prepared to be used with the `doc' package
422 % consists of `documentation parts' intermixed with `definition
425 % Every line of a `documentation part' starts with a percent sign
426 % (|%|) in column one. It may contain arbitrary \TeX{} or
427 % \LaTeX{} commands except that the character `|%|' cannot be
428 % used as a comment character.
429 % \SortIndex{\string^\string^A}{\string\verb\verbatimchar
430 % \string^\string^A\verbatimchar \encapchar usage} To allow user
431 % comments, the |^^A| character is defined as a comment character
432 % later on. Such `metacomments' may be also be included simply by
433 % surrounding them with "\iffalse" \ldots~"\fi".
435 % All other parts of the file are called `definition parts'. They
436 % contain fractions of the macros described in the `documentation
439 % If the file is used to define new macros (e.g.\ as a package file in
440 % the |\usepackage| macro), the `documentation parts' are
441 % bypassed at high speed and the macro definitions are pasted
442 % together, even if they are split into several `definition parts'.
444 % \DescribeEnv{macrocode}
445 % On the other hand, if the documentation of these macros is to be
446 % produced, the `definition parts' should be typeset verbatim. To
447 % achieve this, these parts are surrounded by the \textsf{macrocode}
449 % More exactly: before a `definition part' there should be a line
451 % \hspace*{\MacroIndent}\verb*+% \begin{macrocode}+\\
452 % and after this part a line\\
453 % \hspace*{\MacroIndent}\verb*+% \end{macrocode}+\\
454 % There must be {\em exactly\/} four spaces between the |%|
455 % and |\end{macrocode}| --- \TeX{} is looking for this string
456 % and not for the macro while processing a `definition part'.
458 % Inside a `definition part' all \TeX{} commands are allowed; even the
459 % percent sign could be used to suppress unwanted spaces etc.
461 % \DescribeEnv{macrocode*} Instead of the \textsf{macrocode}
462 % environment one can also use the \textsf{macrocode$*$} environment
463 % which produces the same results except that spaces are printed as
464 % \nopagebreak\verb*+ + characters.
468 % \subsection{Describing the usage of new macros}
470 % \DescribeMacro\DescribeMacro
471 % When you describe a new macro you may use |\DescribeMacro| to
472 % indicate that at this point the usage of a specific macro is
473 % explained. It takes one argument which will be printed in the margin
474 % and also produces a special index entry. For example, I used
475 % |\DescribeMacro{\DescribeMacro}| to make clear that this is the
476 % point where the usage of |\DescribeMacro| is explained.
478 % \DescribeMacro\DescribeEnv
479 % An analogous macro |\DescribeEnv| should be used to indicate
480 % that a \LaTeX{} environment is explained. It will produce a somewhat
481 % different index entry. Below I used |\DescribeEnv{verbatim}|.
483 % \DescribeEnv{verbatim}
484 % It is often a good idea to include examples of the usage of new macros
485 % in the text. Because of the |%| sign in the first column of every
486 % row, the \textsf{verbatim} environment is slightly altered to suppress
488 % characters.\footnote{These macros were written by Rainer
489 % Sch\"opf~\cite{art:verbatim}. He also
490 % provided a new \textsf{verbatim} environment
491 % which can be used inside of other macros.}
492 % \DescribeEnv{verbatim*}
493 % The \textsf{verbatim$*$} environment is changed in the same way.
494 % \changes{v1.7a}{1992/02/26}{Documented \cs{verb} change.}
495 % \DescribeMacro\verb
496 % The "\verb" command is re-implemented to give an error report if a
497 % newline appears in its argument.
498 % The \textsf{verbatim} and \textsf{verbatim$*$} environments set text
499 % in the style defined by "\MacroFont"~(\S\ref{sec:macrofont}).
503 % \subsection{Describing the definition of new macros}
505 % \DescribeEnv{macro}
506 % To describe the definition of a new macro we use the \textsf{macro}
507 % environment. It has one argument: the name of the new
508 % macro.\footnote{This is a change to the style design I described in
509 % ^^A \TUB ^^A removed in case ltugboat.sty not used
510 % \textsl{TUGboat\/}\ 10\#1 (Jan.~89). We finally decided
512 % be better to use the macro name {\em with\/} the
513 % backslash as an argument.}
514 % This argument is also used to print the name in the margin and to
515 % produce an index entry.
516 % Actually the index entries for usage and definition are different to
517 % allow an easy reference.
518 % This environment might be nested. In this case the
519 % labels in the margin are placed under each other.
520 % \changes{v1.7a}{1992/02/26}{Note on need for some text in macro env.}
521 % There should be some text---even if it's just an empty
522 % "\mbox{}"---in this environment before "\begin{macrocode}" or the
523 % marginal label won't print in the right place.
525 % \DescribeMacro\MacrocodeTopsep
526 % \DescribeMacro\MacroTopsep
527 % There also exist four style parameters: |\MacrocodeTopsep| and
528 % |\MacroTopsep| are used to control the vertical spacing above
529 % and below the \textsf{macrocode} and the \textsf{macro}
530 % \DescribeMacro\MacroIndent
531 % environment, |\MacroIndent| is used to indent the lines of code
533 % \DescribeMacro\MacroFont \label{sec:macrofont}
534 % |\MacroFont| holds the font and a possible size change command
535 % for the code lines, the "verbatim"["*"] environment and the macro
536 % names printed in the margin. If you want
537 % to change their default values in a
538 % class file (like \texttt{ltugboat.cls}) use the |\DocstyleParms|
539 % command described below. Starting with release 2.0a it can now
540 % be changed directly as long as the redefinition happens before
541 % the |\begin{document}|.
546 % \subsection{Formatting the margins}
548 % \DescribeMacro\PrintDescribeMacro
549 % \DescribeMacro\PrintDescribeEnv
550 % \DescribeMacro\PrintMacroName
551 % \DescribeMacro\PrintEnvName
552 % As mentioned earlier, some macros and the \textsf{macro} environment
553 % print their arguments in the margin. This is actually done by four
554 % macros which are user
555 % definable.\footnote{You may place the changed definitions in a
557 % file or at the beginning of the documentation
559 % For example, if you don't like any names in the
561 % but want a fine index you can simply
562 % \texttt{\bslash let}
563 % these macros equal \texttt{\bslash @gobble}.
564 % The doc package won't redefine any existing
565 % definitions of these macros.}
566 % They are named |\PrintDescribeMacro|, |\PrintDescribeEnv|,
567 % |\PrintMacroName| (called by the \textsf{macro} environment) and
568 % |\PrintEnvName| (called by the \textsf{environment} environment).
571 % \subsection{Using a special escape character}
573 % \DescribeMacro\SpecialEscapechar
574 % If one defines complicated macros it is sometimes necessary to
575 % introduce a new escape character because the `|\|' has got a
576 % special |\catcode|. In this case one can use
577 % |\SpecialEscapechar| to indicate which character is actually
578 % used to play the r\^ole of the `|\|'. A scheme like this is
579 % needed because the \textsf{macrocode} environment and its counterpart
580 % \textsf{macrocode$*$} produce an index entry for every occurrence of a
581 % macro name. They would be very confused if you didn't tell them that
582 % you'd changed |\catcode|$\,$s. The argument to
583 % |\SpecialEscapechar| is a single-letter control sequence, that
584 % is, one has to use "\|" for example to denote that `\verb+|+'
585 % is used as an escape character. |\SpecialEscapechar| only
586 % changes the behavior of the next \textsf{macrocode} or
587 % \textsf{macrocode$*$} environment.
589 % The actual index entries created will all be printed with |\|
590 % rather than \verb+|+, but this probably reflects their usage, if not
591 % their definition, and anyway must be preferable to not having any
592 % entry at all. The entries {\em could\/} be formatted appropriately,
593 % but the effort is hardly worth it, and the resulting index might be
594 % more confusing (it would certainly be longer!).
597 % \subsection{Cross-referencing all macros used}
599 % \DescribeMacro\DisableCrossrefs \DescribeMacro\EnableCrossrefs As
600 % already mentioned, every new macro name used within a
601 % \textsf{macrocode} or \textsf{macrocode$*$} environment will produce
602 % an index entry. In this way one can easily find out where a specific
603 % macro is used. Since \TeX{} is considerably slower when it has to
604 % produce such a bulk of index entries one can turn off this feature
605 % by using |\DisableCrossrefs| in the driver file. To turn it on again
606 % just use |\EnableCrossrefs|.\footnote{Actually, \texttt{\bslash
607 % EnableCrossrefs} changes things more drastically; any following
608 % \texttt{\bslash DisableCrossrefs} which might be present in the
609 % source will be ignored.}
612 % \DescribeMacro\DoNotIndex
613 % But also finer control is provided. The |\DoNotIndex| macro
614 % takes a list of macro names separated by commas. Those names won't
615 % show up in the index. You might use several |\DoNotIndex|
616 % commands: their lists will be concatenated. In this article I used
618 % all macros which are already defined in \LaTeX.
620 % All three above declarations are local to the current group.
622 % Production (or not) of the index (via the "\makeindex" commend) is
623 % controlled by using or omitting the following declarations in the
624 % driver file preamble; if neither is used, no index is produced.
625 % \DescribeMacro\PageIndex Using "\PageIndex" makes all index
626 % entries refer to their page number; with
627 % \DescribeMacro\CodelineIndex "\CodelineIndex", index entries
628 % produced by "\DescribeMacro" and "\DescribeEnv" refer to page number
629 % but those produced by the \textsf{macro} environment refer to the
630 % code lines, which will be numbered automatically.\footnote{The line
631 % number is actually that of the first line of the first
632 % \textsf{macrocode} environment in the \textsf{macro} environment.}
633 % \DescribeMacro\theCodelineNo
634 % The style of this numbering can be controlled by defining the macro
635 % "\theCodelineNo". Its default definition is to use scriptsize
636 % arabic numerals; a user-supplied definition won't be overwritten.
638 % \DescribeMacro\CodelineNumbered
639 % When you don't wish to get an index but want your code lines
640 % numbered use "\CodelineNumbered" instead of "\CodelineIndex". This
641 % prevents the generation of an unnecessary ".idx" file.
644 % \subsection{Producing the actual index entries}
646 % Several of the aforementioned macros will produce some sort of index
647 % entries. These entries have to be sorted by an external
648 % program---the current implementation assumes that the
649 % \textsf{makeindex} program by Chen~\cite{art:Chen} is used.
651 % But this isn't built in: one has only to redefine some of the
652 % following macros to be able to use any other index program. All
653 % macros which are installation
654 % dependent are defined in such a way that they won't overwrite a
655 % previous definition. Therefore it is safe to put the changed
656 % versions in a package file which might be read in before the doc
659 % To allow the user to change the specific characters recognized by
660 % his or her index program all characters which have special meaning
661 % in the \textsf{makeindex} program are given symbolic
662 % names.\footnote{I don't know if there exists a program which needs
663 % more command characters, but I hope not.}
664 % However, all characters used should be of |\catcode| other than
667 % \DescribeMacro{\actualchar}
668 % The |\actualchar| is used to separate the `key' and the actual
670 % \DescribeMacro{\quotechar}
671 % The |\quotechar| is used before a special index program
672 % character to suppress its special meaning.
673 % \DescribeMacro{\encapchar}
674 % The |\encapchar| separates the indexing information from a
675 % letter string which \textsf{makeindex} uses as a \TeX{} command to
676 % format the page number associated with a special entry. It is used
677 % in this package to apply the |\main| and the |\usage|
679 % \DescribeMacro{\levelchar}
680 % Additionally |\levelchar| is used to separate `item',
681 % `subitem' and `subsubitem' entries.
683 % It is a good idea to stick to these symbolic names even if you know
684 % which index program is used. In this way your files will be
687 % \DescribeMacro\SpecialMainIndex
688 % \DescribeMacro\SpecialMainEnvIndex
689 % To produce a main index entry for a macro the
690 % |\SpecialMainIndex| macro\footnote{This macro is called by the
691 % \textsf{macro} environment.} may be used. It is called `special'
692 % because it has to print its argument verbatim.
693 % A similar macro, called |\SpecialMainEnvIndex| is used for indexing
694 % the main definition point of an
695 % environment.\footnote{This macro is called by the
696 % \textsf{environment} environment.}
697 % \DescribeMacro\SpecialIndex
698 % If you want a normal index entry for a macro name
699 % |\SpecialIndex| might be used.\footnote{This macro is called
700 % within the \textsf{macrocode} environment when encountering a macro
702 % \DescribeMacro\SpecialUsageIndex
703 % \DescribeMacro\SpecialEnvIndex
704 % To index the usage of a macro or an environment
705 % |\SpecialUsageIndex| and |\SpecialEnvIndex| may be used.
706 % \DescribeMacro\SortIndex
707 % Additionally a |\SortIndex| command is provided. It takes two
708 % arguments---the sort key and the actual index entry.
710 % All these macros are normally used by other macros; you will need
711 % them only in an emergency.
713 % \DescribeMacro\verbatimchar
714 % But there is one characteristic worth mentioning: all macro names in
715 % the index are typeset with the |\verb*| command. Therefore one
716 % special character is needed to act as a delimiter for this command.
717 % To allow a change in this respect, again this character is
718 % referenced indirectly, by the macro |\verbatimchar|. It expands
719 % by default to \verb?+? but if your code lines contain macros with
720 % `\texttt{+}' characters in their names (e.g.\ when you use \verb?\+?)
721 % you will end up with an index entry containing \verb?\verb+\++?
722 % which will be typeset as `\verb+\++' and not as `\verb?\+?'. In this
723 % case you should redefine |\verbatimchar| globally or locally to
724 % overcome this problem.
727 % We also provide a |\*| macro. This is intended to be used for
731 % \hspace*{30pt} Special macros for \*
733 % Such an entry might be produced with the line:
735 % \index{index entries\levelchar Special macros for \*}
738 % \DescribeMacro\OldMakeindex
739 % Versions of \textsf{makeindex} prior to 2.9 had some bugs affecting
740 % \DOC{}. One of these,
741 % pertaining to the "%" character doesn't have a work-around
742 % appropriate for versions with and without the
743 % bug.\label{makeindex:version} If
744 % you have an old version, invoke "\OldMakeindex" in a
745 % package file or the driver file to prevent problems with index entries
746 % such as "\%", although you'll probably normally want to turn off
747 % indexing of "\%" anyway. Try to get an up-to-date \textsf{makeindex}
748 % from one of the \TeX{} repositories.
751 % \subsection{Setting the index entries}
753 % \changes{v1.7a}{1992/03/11}{Usage note on gind.ist.} After the first
754 % formatting pass through the \texttt{.dtx} file you need to sort the
755 % index entries written to the \texttt{.idx} file using
756 % \textsf{makeindex} or your favourite alternative. You need a
757 % suitable style file for \textsf{makeindex} (specified by the
758 % \texttt{-s} switch). A suitable one is supplied with \DOC{},
759 % called \texttt{gind.ist}.
761 % \DescribeMacro\PrintIndex
762 % To read in and print the sorted index, just put the
763 % |\PrintIndex| command as the last (commented-out, and thus
764 % executed during the documentation pass through the file) command
765 % in your package file. Precede it by any bibliography commands
766 % necessary for your citations.
767 % Alternatively, it may be more convenient to put all such calls
768 % amongst the arguments of the |\StopEventually| macro, in
769 % which case a |\Finale| command should appear at the end of
772 % \DescribeEnv{theindex}
773 % Contrary to standard \LaTeX, the index is typeset in three columns
774 % by default. This is controlled by the \LaTeX{} counter
775 % `\textsf{IndexColumns}' and can therefore be changed with a
776 % |\setcounter| declaration. Additionally one doesn't want to
777 % start a new page unnecessarily. Therefore the \textsf{theindex}
778 % environment is redefined.
779 % \DescribeMacro\IndexMin
780 % When the \textsf{theindex} environment starts it will measure how much
781 % space is left on the current page. If this is more than
782 % |\IndexMin| then the index will start on this page. Otherwise
783 % |\newpage| is called.
785 % Then a short introduction about the meaning of several index entries
786 % is typeset (still in onecolumn mode). Afterwards the actual index
787 % entries follow in multi-column mode.
788 % \DescribeMacro\IndexPrologue
789 % You can change this prologue with the help of the
790 % |\IndexPrologue| macro. Actually the section heading is also
791 % produced in this way, so you'd better write something like:
793 % \IndexPrologue{\section*{Index} The index entries underlined ...}
795 % When the \textsf{theindex} environment is finished the last page will
796 % be reformatted to produce balanced columns. This improves the layout
797 % and allows the next article to start on the same page.
798 % \DescribeMacro\IndexParms
799 % Formatting of the index columns (values for |\columnssep|
800 % etc.)\ is controlled by the |\IndexParms| macro. It assigns the
802 % \SpecialUsageIndex{\parindent}\SpecialUsageIndex{\columnsep}^^A
803 % \SpecialUsageIndex{\parskip}\SpecialUsageIndex{\rightskip}^^A
804 % \SpecialUsageIndex{\mathsurround}\SpecialUsageIndex{\parfillskip}
806 % \begin{tabular}{l@{\,=\,}ll@{\,=\,}l}
807 % |\parindent| & \IndexParms \the\parindent &
808 % |\columnsep| & \IndexParms \the\columnsep \\
809 % |\parskip| & \IndexParms \the\parskip &
810 % |\rightskip| & \IndexParms
811 % \expandafter\dimenvalue\the\rightskip \\
812 % |\mathsurround| & \IndexParms \the\mathsurround &
813 % |\parfillskip| & \IndexParms
814 % \expandafter\dimenvalue\the\parfillskip
817 % \DescribeMacro{\@idxitem}
818 % Additionally it defines |\@idxitem| (which will be used when an
819 % |\item| command is encountered) and selects |\small| size.
820 % If you want to change any of these values you have to define them
823 % \DescribeMacro\main
824 % \DescribeMacro\usage
825 % The page numbers for main index entries are encapsulated by the
826 % |\main| macro (underlining its argument) and the numbers
827 % denoting the description are encapsulated by the |\usage| macro
828 % (which produces {\em italics}). As usual these commands are user
832 % \subsection{Changing the default values of style parameters}
834 % \DescribeMacro\DocstyleParms If you want to overwrite some default
835 % settings made by the \DOC{} package, you can either put your
836 % declarations in the driver file (that is after \texttt{doc.sty} is
837 % read in) or use a separate package file for doing this work. In the
838 % latter case you can define the macro |\DocstyleParms| to contain all
839 % assignments. This indirect approach is necessary if your package file
840 % might be read before the \texttt{doc.sty}, when some of the
841 % registers are not allocated. Its default definition is null.
843 % The doc package currently assigns values to the following
845 % \SpecialUsageIndex{\IndexMin}\SpecialUsageIndex{\MacrocodeTopsep}^^A
846 % \SpecialUsageIndex{\MacroTopsep}^^A
847 % \SpecialUsageIndex{\MacroIndent}\SpecialUsageIndex{\marginparpush}^^A
848 % \SpecialUsageIndex{\marginparwidth}\SpecialUsageIndex{\tolerance}
850 % \begin{tabular}{l@{\,=\,}ll@{\,=\,}l}
851 % |\IndexMin| & \the\IndexMin &
852 % |\MacroTopsep| & \the\MacroTopsep \\
853 % |\marginparwidth|& \the\marginparwidth &
854 % |\MacroIndent| & \the\MacroIndent \\
855 % |\marginparpush| & \the\marginparpush &
856 % |\MacrocodeTopsep| & \the\MacrocodeTopsep \\
857 % |\tolerance| & \the\tolerance
862 % \subsection{Short input of verbatim text pieces}
864 % \DescribeMacro\MakeShortVerb
865 % \DescribeMacro{\MakeShortVerb*} \DescribeMacro\DeleteShortVerb It is
866 % awkward to have to type, say, "\verb|"\ldots"|" continually when
868 % verbatim bits (like macro names) in the text, so an abbreviation
869 % mechanism is provided. Pick a character \meta{c}---one which
870 % normally has catcode `other' unless you have very good reason not
871 % to---which you don't envisage using in the text, or not using often.
872 % (I like |"|, but you may prefer "|" if you have |"| active to do
873 % umlauts, for instance.) Then if you say
874 % "\MakeShortVerb{\"\meta{c}"}" you can subsequently use
875 % \meta{c}\meta{text}\meta{c} as the equivalent of
876 % "\verb"\meta{c}\meta{text}\meta{c}; analogously, the "*"-form
877 % "\MakeShortVerb*{\"\meta{c}"}" gives you the equivalent of
878 % "\verb*"\meta{c}\meta{text}\meta{c}. Use
879 % "\DeleteShortVerb{\"\meta{c}"}" if you subsequently want \meta{c} to
880 % revert to its previous meaning---you can always turn it on again
881 % after the unusual section. The `short verb' commands make global
882 % changes. The abbreviated "\verb" may not appear in the argument of
883 % another command just like "\verb". However the `short verb'
884 % character may be used freely in the \textsf{verbatim} and
885 % \textsf{macrocode} environments without ill effect.
886 % "\DeleteShortVerb" is silently ignored if its argument does not
887 % currently represent a short verb character. Both commands type a
888 % message to tell you the meaning of the character is being changed.
890 % Please remember that the command "\verb" cannot be used in arguments
891 % of other commands. Therefore abbreviation characters for "\verb"
892 % cannot be used there either.
894 % This feature is also available as a sole package, \texttt{shortvrb}.
897 % \subsection{Additional bells and whistles}
899 % We provide macros for logos such as \Web, \AmSTeX, \BibTeX,
900 % \SliTeX{} and \PlainTeX. Just type |\Web|, |\AmSTeX|,
901 % |\BibTeX|, |\SliTeX| or |\PlainTeX|, respectively.
902 % \LaTeX{} and \TeX{} are already defined in \texttt{latex.tex}.
904 % \DescribeMacro\meta
905 % Another useful macro is |\meta| which has one argument and
906 % produces something like \meta{dimen parameter}.
908 % \DescribeMacro\OnlyDescription
909 % \DescribeMacro\StopEventually
910 % You can use the |\OnlyDescription| declaration in the driver
911 % file to suppress the last part of your document (which presumably
912 % exhibits the code). To make this work
913 % you have to place the command |\StopEventually| at a suitable
914 % point in your file. This macro has one argument in which you put
915 % all information you want to see printed if your document ends at
916 % this point (for example a bibliography which is normally printed at
917 % the very end). When the |\OnlyDescription| declaration is
918 % missing the |\StopEventually|
919 % \DescribeMacro\Finale
920 % macro saves its argument in a macro called |\Finale| which can
921 % afterwards be used to get things back (usually at the very end).
922 % Such a scheme makes changes in two places unnecessary.
924 % Thus you can use this feature to produce a local guide for the
925 % \TeX{} users which describes only the usage of macros (most of them
926 % won't be interested in your definitions anyway). For the same
927 % reason the |\maketitle| \DescribeMacro\maketitle command is slightly
928 % changed to allow multiple titles in one document. So you can make
929 % one driver file reading in several articles at once.
930 % \DescribeMacro{\ps@titlepage} To avoid an unwanted
931 % \textsf{pagestyle} on the title page the |\maketitle| command issues
932 % a |\thispagestyle{titlepage}| declaration which produces a
933 % \textsf{plain} page if the \textsf{titlepage} page style is
934 % undefined. This allows class files like \textsf{ltugboat.cls} to
935 % define their own page styles for title pages.
937 % \DescribeMacro\AlsoImplementation
938 % Typesetting the whole document is the default. However, this default
939 % can also be explicitly selected using the declaration
940 % |\AlsoImplementation|. This overwrites any previous
941 % |\OnlyDescription| declaration. The \LaTeXe{} distribution, for
942 % example, is documented using the \texttt{ltxdoc} class which allows
943 % for a configuration file \texttt{ltxdoc.cfg}. In such a file one
944 % could then add the statement
946 % |\AtBeginDocument{\AlsoImplementation}|
948 % to make sure that all documents will show the code part.
950 % \DescribeMacro\IndexInput \label{..Input} Last but not least I
951 % defined an |\IndexInput| macro which takes a file name as an
952 % argument and produces a verbatim listing of the file, indexing every
953 % command as it goes along. This might be handy, if you want to learn
954 % something about macros without enough documentation. I used this
955 % feature to cross-reference \texttt{latex.tex} getting a verbatim
956 % copy with about 15 pages index.\footnote{It took quite a long time
957 % and the resulting \texttt{.idx} file was longer than the
958 % \texttt{.dvi} file. Actually too long to be handled by the
959 % \textsf{makeindex} program directly (on our MicroVAX) but the final
960 % result was worth the trouble.}
962 % \changes{v2.1d}{2006/02/02}{Corrected description of \cs{changes}
964 % \DescribeMacro\changes
965 % To maintain a change history within the file, the |\changes|
966 % command may be placed amongst the description part of the changed
967 % code. It takes three arguments, thus:
969 % |\changes{|\meta{version}|}{|\meta{date}|}{|^^A
972 % The changes may be used to produce an auxiliary file (\LaTeX's
973 % |\glossary| mechanism is used for this) which may be printed
974 % after suitable formatting. The |\changes| macro generates the
975 % printed entry in such a change history; because old
976 % versions\footnote{Before 2.6.} of the \textsf{makeindex}
977 % program limit such fields to 64 characters, care should be taken
978 % not to exceed this limit when describing the change. The actual
979 % entry consists of the \meta{version}, the |\actualchar|, the current
980 % macro name, a colon, the |\levelchar|, and, finally, the \meta{text}.
981 % The result is a glossaryentry for the \meta{version}, with the name of
982 % the current macro as subitem. Outside the |macro| environment, the
983 % text |\generalname| is used instead of the macro name. When
984 % referring to macros in change descriptions it is conventional to use
985 % |\cs{|\meta{macroname}|}| rather than attempting to format it properly
986 % and using up valuable characters in the entry with old \textsf{makeindex}
989 % \changes{v1.7a}{1992/02/26}{Description of \cs{RecordChanges} etc.
991 % to interface section.} \DescribeMacro\RecordChanges To cause the
992 % change information to be written out, include "\RecordChanges" in
993 % the driver file. \DescribeMacro\PrintChanges To read in and print
994 % the sorted change history (in two columns), just put the
995 % |\PrintChanges| command as the last (commented-out, and thus
996 % executed during the documentation pass through the file) command in
997 % your package file. Alternatively, this command may form one of the
998 % arguments of the |\StopEventually| command, although a change
999 % history is probably {\em not\/} required if only the description is
1000 % being printed. The command assumes that \textsf{makeindex} or some
1001 % other program has processed the \texttt{.glo} file to generate a
1002 % sorted \texttt{.gls} file. You need a special \textsf{makeindex}
1003 % style file; a suitable one is supplied with \DOC{}, called
1004 % \texttt{gglo.ist}. \DescribeMacro\GlossaryMin
1005 % \DescribeMacro\GlossaryPrologue \DescribeMacro\GlossaryParms The
1006 % "\GlossaryMin", "\GlossaryPrologue" and "\GlossaryParms" macros are
1007 % analagous to the "\Index"\ldots\ versions. (The \LaTeX{} `glossary'
1008 % mechanism is used for the change entries.)
1010 % \label{sec:checksum}
1011 % \DescribeMacro\CharacterTable
1012 % \DescribeMacro\CheckSum
1013 % To overcome some of the problems of sending files over the networks
1014 % we developed two macros which should detect corrupted files. If one
1017 % \small\ttfamily ^^A \ttfamily to get the blanks between "..."s
1019 %"%%\CharacterTable"\\
1021 %"\A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z"\\
1023 %"\a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z"\\
1024 %"%% Digits \0\1\2\3\4\5\6\7\8\9"\\
1025 %"%% Exclamation \! Double quote "\verb=\"=
1026 %" Hash (number) \#"\\
1027 %"%% Dollar \$ Percent \% Ampersand \&"\\
1028 %"%% Acute accent \' Left paren \( Right paren \)"\\
1029 %"%% Asterisk \* Plus \+ Comma \,"\\
1030 %"%% Minus \- Point \. Solidus \/"\\
1031 %"%% Colon \: Semicolon \; Less than \<"\\
1032 %"%% Equals \= Greater than \> Question mark \?"\\
1033 %"%% Commercial at \@ Left bracket \[ Backslash \\"\\
1034 %"%% Right bracket \] Circumflex \^ Underscore \_"\\
1035 %"%% Grave accent \` Left brace \{ Vertical bar \|"\\
1036 %"%% Right brace \} Tilde \~}"\\
1039 % at the beginning of the file then character translation failures
1040 % will be detected, provided of course, that the used \DOC{}
1041 % package has a correct default table. The percent
1042 % signs\footnote{There are two percent signs in each line. This has
1043 % the effect that these lines are not removed by the
1044 % \texttt{docstrip.tex} program.} at the beginning of the lines should
1045 % be typed in, since only the \DOC{} package should look at this
1048 % Another problem of mailing files is possible truncation. To detect
1049 % these sort of errors we provide a |\CheckSum| macro. The check-sum
1050 % of a file is simply the number of backslashes in the code, i.e.\ all
1051 % lines between the \textsf{macrocode} environments. But don't be
1052 % afraid: you don't have count the code-lines yourself; this is done
1053 % by the \DOC{} package for you. You simply have to use
1054 % the |\StopEventually| (which starts looking for backslashes) and the
1055 % |\Finale| command. The latter will inform you either that your file
1056 % has no check-sum (telling you the right number) or that your number
1057 % is incorrect (this time telling you both the correct and the
1058 % incorrect one). Then you go to the top of your file inserting the
1061 % |%% \CheckSum{|\meta{number}|}|
1063 % and that's all. If you precede it only with one percent then the
1064 % line will not show up in \texttt{docstrip} versions of the file.
1065 % You should do so whenever you are using conditional code (see
1066 % \texttt{docstrip} documentation) since then the check-sum will not
1067 % reflect the number of backslashes in the stripped of versions.
1069 % \DescribeMacro\bslash
1070 % From time to time, it is necessary to print a |\| without
1071 % being able to use the |\verb| command because the
1072 % |\catcode|$\,$s of the symbols are already firmly
1073 % established. In this instance we can use the command
1074 % |\bslash| presupposing, of course, that the actual font in
1075 % use at this point contains a `backslash' as a symbol. Note that
1076 % this definition of |\bslash| is expandable; it inserts a
1077 % $"\"_{12}$. This means that you have to |\protect|
1078 % it if it is used in `moving arguments'.
1080 % \DescribeMacro\MakePrivateLetters
1081 % \changes{v1.7a}{1992/02/26}{Documented \cs{MakePrivateLetters} in
1082 % interface section}^^A
1083 % If your macros "\catcode" anything other than "@" to `letter', you
1084 % should redefine "\MakePrivateLetters" so that it also makes the
1085 % relevant characters `letters' for the benefit of the indexing. The
1086 % default definition is just "\makeatletter".
1088 % \DescribeMacro\DontCheckModules \DescribeMacro\CheckModules
1089 % \DescribeMacro\Module \DescribeMacro\AltMacroFont The `module'
1090 % directives of the \textsf{docstrip} system \cite{art:docstrip} are
1091 % normally recognised and invoke special formatting. This can be
1092 % turned on and off in the \texttt{.dtx} file or the driver file using
1093 % "\CheckModules" and "\DontCheckModules". If checking for module
1094 % directives is on (the default) then code in the scope of the
1095 % directives is set as determined by the hook "\AltMacroFont", which
1096 % gives {\small\ttfamily\itshape small italic type\-writer\/} by
1097 % default in the New Font Selection Scheme but just ordinary
1098 % {\small\ttfamily small type\-writer} in the old one, where a font
1099 % such as italic typewriter can't be used portably (plug for NFSS);
1100 % you will need to override this if you don't have the italic
1101 % typewriter font available. Code is in such a scope if it's on a
1102 % line beginning with "%<" or is between lines starting with
1103 % "%<*"\meta{name list}">" and "%</"\meta{name list}">". The
1104 % directive is formatted by the macro "\Module" whose single argument
1105 % is the text of the directive between, but not including, the angle
1106 % brackets; this macro may be re-defined in the driver or package file
1107 % and by default produces results like \Module{+foo\string|bar} with no
1110 % \DescribeMacro{StandardModuleDepth} Sometimes (as in this file) the
1111 % whole code is surrounded by modules to produce several files from a
1112 % single source. In this case it is clearly not appropriate to format
1113 % all code lines in a special "\AltMacroFont". For this reason a
1114 % counter "StandardModuleDepth" is provided which defines the level of
1115 % module nesting which is still supposed to be formatted in
1116 % "\MacroFont" rather then "\AltMacroFont". The default setting is
1117 % "0", for this documentation it was set to
1119 % \setcounter{StandardModuleDepth}{1}
1121 % at the beginning of the file.
1124 % \subsection{Basic usage summary}
1125 % \changes{v1.7a}{1992/03/11}{Added basic usage summary to spell
1128 % To sum up, the basic structure of a \texttt{.dtx} file without any
1129 % refinements is like this:
1130 % \begin{verse}\small
1131 % "% "\meta{waffle}\ldots\\
1133 % "% \DescribeMacro{\fred}"\\
1134 % "% "\meta{description of fred's use}\\
1136 % "% \StopEventually{"\meta{finale code}"}"\\
1138 % "% \begin{macro}{\fred}"\\
1139 % "% "\meta{commentary on macro fred}\\
1140 % \verb*+% \begin{macrocode}+\\
1141 % \meta{code for macro fred}\\
1142 % \verb*+% \end{macrocode}+\\
1145 % "% \Finale \PrintIndex \PrintChanges"
1147 % For examples of the use of most---if not all---of the features
1148 % described above consult the \texttt{doc.dtx} source itself.
1150 % \subsection{Acknowledgements}
1152 % I would like to thank all folks at Mainz and at the Royal Military
1153 % College of Science for their help in this project. Especially Brian
1154 % and Rainer who pushed everything with their suggestions, bug fixes,
1157 % A big thank you to David Love who brought the documentation
1158 % up-to-date again, after I neglected this file for more than two
1159 % years. This was most certainly a tough job as many features added to
1160 % \texttt{doc.dtx} after its publication in \textsl{TUGboat\/} have
1161 % been never properly described. Beside this splendid work he kindly
1162 % provided additional code (like ``docstrip'' module formatting) which
1163 % I think every \textsf{doc.dtx} user will be grateful for.
1167 % \begin{thebibliography}{1}
1168 % \bibitem{book:Buerger} \textsc{G. A. B\"urger}.
1169 % \newblock Wunderbare Reisen zu Wasser und zu Lande, Feldz\"uge
1170 % und lustige Abenteuer des Freyherrn v.\ M\"unchhausen.
1171 % \newblock London, 1786 \& 1788.
1172 % \bibitem{art:Knuthliterat} \textsc{D. E. Knuth}.
1173 % \newblock Literate Programming.
1174 % \newblock Computer Journal, Vol.~27, \textit{pp}.~97--111,
1176 % \bibitem{book:KnuthA} \textsc{D. E. Knuth}.
1177 % \newblock Computers \& Typesetting (The \TeX book).
1178 % \newblock Addison-Wesley, Vol. A, 1986.
1179 % \bibitem{art:Chen} \textsc{L. Lamport}.
1180 % \newblock MakeIndex: An Index Processor for \LaTeX.
1181 % \newblock 17 February 1987.
1182 % \newblock (Taken from the file \texttt{makeindex.tex} provided
1184 % the program source code.)
1185 % \bibitem{art:doc} \textsc{Frank Mittelbach}.
1186 % \newblock The \DOC{}-option.
1187 % \newblock \textsl{TUGboat}, Vol.~10(2), \textit{pp}.~245--273,
1189 % \bibitem{art:docstrip} \textsc{Frank Mittelbach, Denys Duchier and
1191 % \newblock \texttt{docstrip.dtx} (to appear).
1192 % \newblock The file is part of the DOC package.
1193 % \bibitem{book:Raspe} \textsc{R. E. Raspe} (*1737, \dag 1797).
1194 % \newblock Baron M\"unchhausens narrative of his marvellous
1195 % travels and campaigns in Russia.
1196 % \newblock Oxford, 1785.
1197 % \bibitem{art:verbatim} \textsc{Rainer Sch\"opf}.
1198 % \newblock A New Implementation of \LaTeX's \texttt{verbatim} and
1199 % \texttt{verbatim*} Environments.
1200 % \newblock File \texttt{verbatim.doc}, version 1.4i.
1201 % \end{thebibliography}
1206 % \addtocontents{toc}{\protect\end{multicols}}
1209 % } ^^A end \StopEventually
1212 % \section{The Description of Macros}
1214 % Most of the following code is destined for \texttt{doc.sty} after
1215 % processing with \texttt{docstrip} to include the module
1216 % \textbf{style} indicated here. (All code in this file not
1217 % appropriate to \texttt{doc.sty} has to be included explicitly by
1218 % docstrip so that this \texttt{.dtx} file can be used as directly as
1219 % a package file rather than the stripped version.) The usual font
1220 % change for the conditionally-included lines between the
1221 % \Module{*style} and \Module{/style} directives is suppressed since
1222 % only the lines with an explicit directive are special in this file.
1226 % Under \LaTeXe{} the test to avoid reading
1227 % \DOC{} in twice is normally unnecessary. It was kept to only to
1228 % stay compatible with \LaTeX209 styles that |\input| \DOC{}
1230 % \changes{v1.5i}{1989/06/07}{Avoid reading the file twice.}
1232 \@ifundefined{macro@cnt}{}{\endinput}
1235 % \DescribeMacro\fileversion
1236 % \DescribeMacro\filedate
1237 % \DescribeMacro\docdate
1238 % As you can see I used macros like |\fileversion| to denote the
1239 % version number and the date. They are defined at the very beginning
1240 % of the package file (without a surrounding \textsf{macrocode}
1241 % environment), so I don't have to search for this place here when I
1242 % change the version number. You can see their actual outcome in a
1243 % footnote to the title.
1246 % The first thing that we do next is to get ourselves a new comment
1247 % sign. Because all sensible signs are already occupied, we will
1248 % choose one that can only be entered indirectly:
1249 % {\DoNotIndex{\^}^^A avoid misinterpretation !!!!! VERIFY
1253 % We repeat this statement at the beginning of the document in case
1254 % the \texttt{inputenc} package is used disabling it again.
1255 % \changes{v2.0b}{1998/05/19}{Init docs private comment char at begin
1256 % of document again (pr2581)}
1258 \AtBeginDocument{\catcode`\^^A=14\relax}
1260 % \SortIndex{\string^\string^A}{\string\verb\verbatimchar
1261 % \string^\string^A\verbatimchar
1266 % \subsection{Options supported by \DOC{}}
1268 % Not options available at the moment
1274 % \subsection{Macros surrounding the `definition parts'}
1276 % \begin{macro}{\macrocode}
1277 % Parts of the macro definition will be surrounded by the
1278 % environment \textsf{macrocode}. Put more precisely, they will be
1279 % enclosed by a macro whose argument (the text to be set
1280 % `verbatim') is terminated by the string
1281 % \verb*+% \end{macrocode}+. Carefully note the number of spaces.
1282 % |\macrocode| is defined completely analogously to
1283 % |\verbatim|, but because a few small changes were carried
1284 % out, almost all internal macros have got new names. We start by
1285 % calling the macro |\macro@code|, the macro which bears the
1286 % brunt of most of the work, such as |\catcode| reassignments,
1288 % \changes{v1.5r}{1989/11/04}{Support for code line no. (Undoc)}
1290 \def\macrocode{\macro@code
1292 % Then we take care that all spaces have the same width, and that
1293 % they are not discarded.
1295 \frenchspacing \@vobeyspaces
1297 % Before closing, we need to call |\xmacro@code|. It is this
1298 % macro that expects an argument which is terminated by the above
1299 % string. This way it is possible to keep the |\catcode|
1301 % \changes{v1.5r}{1989/11/04}{Support for code line no. (Undoc)}
1302 % \changes{v1.5t}{1989/11/07}{Common code moved to \cs{macro@code}.}
1309 % \begin{macro}{\macro@code}
1310 % We will now begin with the macro that does the actual work:
1314 % In theory it should consist of a \textsf{trivlist} environment, but
1315 % the empty space before and after the environment should not be
1318 \topsep \MacrocodeTopsep
1320 % The next parameter we set is |\@beginparpenalty|, in order
1321 % to prevent a page break before such an environment.
1323 \@beginparpenalty \predisplaypenalty
1325 % We then start a |\trivlist|, set |\parskip| back to
1326 % zero and start an empty |\item|.
1327 % \changes{v1.9b}{1993/12/03}{Forcing any label from macro env.}
1329 \if@inlabel\leavevmode\fi
1330 \trivlist \parskip \z@ \item[]%
1332 % Additionally, everything should be set in \texttt{typewriter} font.
1333 % Some people might prefer it somewhat differently; because of this
1334 % the font choice is
1335 % macro-driven.\footnote{The font change has to be placed
1337 % the \texttt{\bslash item}. Otherwise a change to
1338 % \texttt{\bslash baselineskip} will affect the
1343 % Because |\item| sets various parameters, we have found it
1344 % necessary to alter some of these retrospectively.
1346 \leftskip\@totalleftmargin \advance\leftskip\MacroIndent
1347 \rightskip\z@ \parindent\z@ \parfillskip\@flushglue
1349 % The next line consists of the \LaTeX{} definition of |\par|
1350 % used in |\verbatim| and should result in blank lines being
1351 % shown as blank lines.
1352 % \changes{v1.5l}{1989/09/10}{Code line numbers supported.}
1353 % \changes{v1.5t}{1989/11/07}{Call \cs{leavevmode} to get \cs{everypar}
1355 % \changes{v1.7c}{1992/3/24}{Added \cs{interlinepenalty} to
1359 \blank@linefalse \def\par{\ifblank@line
1361 \blank@linetrue\@@par
1362 \penalty\interlinepenalty}
1364 % What use is this definition of |\par|\,? We use the macro
1365 % |\obeylines| of \cite{book:KnuthA} which changes all |^^M|
1366 % to |\par| so that each can control its own indentation.
1367 % Next we must also ensure that all special signs are normalized;
1368 % that is, they must be given |\catcode| $12$.
1369 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
1370 % which handles more ligatures.}
1373 \let\do\do@noligs \verbatim@nolig@list
1374 \let\do\@makeother \dospecials
1376 % \changes{v1.5t}{1989/11/07}{Common code added.}
1377 % \changes{v1.5w}{1990/02/05}{Skip of \cs{@totalleftmargin} added.} If
1378 % indexing by code lines is switched on the line number is incremented
1379 % and set appropriately. We also check whether the start of the next
1380 % line indicates a \texttt{docstrip} module directive and process it
1381 % appropriately if so using "\check@module".
1383 \global\@newlistfalse
1384 \global\@minipagefalse
1386 \everypar{\global\advance\c@CodelineNo\@ne
1387 \llap{\theCodelineNo\ \hskip\@totalleftmargin}%
1389 \else \everypar{\check@module}%
1392 % We also initialize the cross-referencing feature by calling
1393 % |\init@crossref|. This will start the scanning mechanism
1394 % when encountering an escape character.
1401 % \begin{macro}{\ifblank@line}
1402 % \begin{macro}{\blank@linetrue}
1403 % \begin{macro}{\blank@linefalse}
1404 % |\ifblank@line| is the switch used in the definition above.
1405 % In the original \textsf{verbatim} environment the |\if@tempswa|
1406 % switch is used. This is dangerous because its value may change
1407 % while processing lines in the \textsf{macrocode} environment.
1415 % \begin{macro}{\endmacrocode}
1416 % Because we have begun a \textsf{trivlist} environment in the
1417 % \textsf{macrocode} environment, we must also end it. We must
1418 % also act on the value of the "pm@module" flag (see below) and
1419 % empty "\everypar".
1420 % \changes{v1.5r}{1989/11/04}{Support for code line no. (Undoc)}
1423 \ifpm@module \endgroup \pm@modulefalse \fi
1425 \global\@inlabelfalse
1428 % Additionally |\close@crossref| is used to do anything needed
1429 % to end the cross-referencing mechanism.
1436 % \begin{macro}{\MacroFont}
1437 % Here is the default definition for the |\MacroFont| macro.
1438 % With the new math font handling in NFSS2 it isn't any longer
1439 % correct to suppress the math font setup since this is now handled
1440 % differently. But to keep the font change fast we use only a
1441 % single |\selectfont| (in |\small|) and do the rest by hand.
1442 % \changes{v1.5x}{1990/02/17}{\cs{math@fontsfalse} added for NFSS.}
1443 % \changes{v1.7a}{1992/03/13}{Added \cs{reset@font} for NFSS.}
1444 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1445 % \changes{v1.9t}{1995/05/26}{Removed \cs{math@fontsfalse} (different
1446 % math setup /pr1622}
1448 \@ifundefined{MacroFont}{%
1451 % Despite the above statement we will call |\small| first if
1452 % somebody is using a \LaTeX2.09 document with doc. I wouldn't have
1453 % bothered since doc-sources should be up-to-date but since the
1454 % request came from someone called David Carlisle \ldots :-)
1455 % \changes{v1.9y}{1996/01/26}{Support compat mode}
1457 \def\MacroFont{\small
1458 \usefont\encodingdefault
1464 \def\MacroFont{\fontencoding\encodingdefault
1465 \fontfamily\ttdefault
1466 \fontseries\mddefault
1467 \fontshape\updefault
1474 % \begin{macro}{\AltMacroFont}
1475 % \begin{macro}{\macro@font}
1476 % \changes{v1.7a}{1992/03/12}{Added to support distinction of modules.}
1477 % \changes{v1.7c}{1992/03/26}{Altered font change for OFSS.}
1478 % \changes{v1.7m}{1992/10/11}{Use sltt as default.}
1479 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1480 % \changes{v1.9t}{1995/05/26}{Removed \cs{math@fontsfalse} (different
1481 % math setup /pr1622}
1482 % Although most of the macro code is set in "\MacroFont" we want to be
1483 % able to switch to indicate module code set in "\AltMacroFont".
1484 % "\macro@font" keeps track of which one we're using. We can't do the
1485 % same thing sensibly in OFSS as in NFSS.
1487 \@ifundefined{AltMacroFont}{%
1490 % Again have |\small| first if we are in compat mode.
1491 % \changes{v1.9y}{1996/01/26}{Support compat mode}
1493 \def\AltMacroFont{\small
1494 \usefont\encodingdefault
1500 \def\AltMacroFont{\fontencoding\encodingdefault
1501 \fontfamily\ttdefault
1502 \fontseries\mddefault
1503 \fontshape\sldefault
1509 % To allow changing the "\MacroFont" in the preamble we defer
1510 % defining the internally used "\macro@font" until after the
1512 % \changes{v2.0a}{1998/05/16}{Support changing \cs{MacroFont} in
1515 \AtBeginDocument{\let\macro@font\MacroFont}
1520 % \begin{macro}{\check@module}
1521 % \begin{macro}{\ifpm@module}
1522 % \changes{v1.7a}{1992/03/12}{Added.}
1523 % This is inserted by "\everypar" at the start of each macrocode line to
1524 % check whether it starts with module information. (Such information is
1525 % of the form "%<"\meta{switch}">", where the "%" must be at the
1526 % start of the line and \meta{switch} comprises names with various
1527 % possible separators and a possible leading "+", "-", "*" or "/"
1528 % \cite{art:docstrip}. All that concerns us here is what the first
1529 % character of \meta{switch} is.) First it checks the "pm@module"
1530 % flag in case the previous line had a non-block module
1531 % directive i.e., not "%<*" or "%</"; if it did we need to close the
1532 % group it started and unset the flag. "\check@module" looks ahead at
1533 % the next token and then calls "\ch@percent" to take action depending
1534 % on whether or not it's a "%"; we don't want to expand the token at
1535 % this stage. This is all done conditionally so it can be turned off
1536 % if it causes problems with code that wasn't designed to be
1537 % \texttt{docstrip}ped.
1541 \ifpm@module \endgroup \pm@modulefalse \fi
1542 \expandafter\futurelet\expandafter\next\expandafter\ch@percent
1548 % \begin{macro}{\DontCheckModules}
1549 % \begin{macro}{\CheckModules}
1550 % \changes{v1.7a}{1992/03/12}{Added.}
1551 % \begin{macro}{\ifcheck@modules}
1552 % Here are two driver-file interface macros for turning the module
1553 % checking on and off using the "check@modules" switch.
1555 \def\DontCheckModules{\check@modulesfalse}
1556 \def\CheckModules{\check@modulestrue}
1557 \newif\ifcheck@modules \check@modulestrue
1562 % \begin{macro}{\ch@percent}
1563 % \changes{v1.7a}{1992/03/12}{Added.}
1564 % If the lookahead token in "\next" is $"%"_{12}$ we go on to check
1565 % whether the following one is "<" and otherwise do nothing. Note the
1566 % "\expandafter" to get past the "\fi".
1569 \if \percentchar\next
1570 \expandafter\check@angle
1575 % \begin{macro}{\check@angle}
1576 % \changes{v1.7a}{1992/03/12}{Added.}
1577 % Before looking ahead for the "<" the "%" is gobbled by the
1580 \def\check@angle#1{\futurelet\next\ch@angle}
1583 % \begin{macro}{\ch@angle}
1584 % \changes{v1.7a}{1992/03/12}{Added.}
1585 % \changes{v1.9k}{1994/02/22}{Have \texttt{<} active}
1586 % If the current lookahead token is "<" we are defined to be
1587 % processing a module directive can go on to look for "+" etc.;
1588 % otherwise we must put back the gobbled "%". With \LaTeXe{}
1589 % \texttt{<} is active so we have to be a bit careful.
1593 \gdef\ch@angle{\ifx<\next
1594 \expandafter\ch@plus@etc
1595 \else \percentchar \fi}
1599 % \begin{macro}{\ch@plus@etc}
1600 % \begin{macro}{\check@plus@etc}
1601 % \changes{v1.7a}{1992/03/12}{Added.}
1602 % We now have to decide what sort of a directive we're dealing with
1603 % and do the right thing with it.
1605 \gdef\ch@plus@etc<{\futurelet\next\check@plus@etc}
1606 \gdef\check@plus@etc{%
1612 \let\next\star@module
1614 \let\next\slash@module
1616 % At some point in the past the \texttt{docstrip} program was
1617 % partly rewritten and at that time it also got support for a very
1618 % special directive of the form |%<<| followed by an arbitrary
1619 % string. This is used for ``verbatim'' inclusion in case of
1620 % certain problem. We do not really attempt to pretty print that
1621 % case but we need at least account for it since otherwise we get
1622 % an error message since this is the only case where we will not
1623 % have a closing |>|.
1624 % \changes{v2.0n}{2001/05/16}{Partly support docstrip's ``verbatim''
1625 % directive (pr/3331)}
1637 % \begin{macro}{\pm@module}
1638 % If we're not dealing with a block
1639 % directive ("*" or "/") i.e., it's a single special line, we set
1640 % everything up to the next ">" appropriately and then change to the
1641 % special macro font inside a group which will be ended at the start
1642 % of the next line. If the apparent module directive is missing the
1643 % terminating ">" this will lose, but then so will the \texttt{docstrip}
1644 % implementation. An alternative strategy would be to have
1645 % "\pm@module" make ">" active and clear a flag set here to indicate
1646 % processing the directive. Appropriate action could then be taken if
1647 % the flag was found still to be set when processing the next line.
1648 % \changes{v1.7a}{1992/03/12}{Added.}
1649 % \changes{v1.7i}{1992/07/11}{Support for fonts depending on nesting.}
1654 \lowercase{\gdef\pm@module#1~}{\pm@moduletrue
1655 \Module{#1}\begingroup
1657 % We switch to a special font as soon the nesting is higher than
1658 % the current value of "\c@StandardModuleDepth". We do a local
1659 % update to the "\guard@level" here which will be restored after
1660 % the current input line.
1662 \advance\guard@level\@ne
1663 \ifnum\guard@level>\c@StandardModuleDepth\AltMacroFont\fi
1667 % \begin{macro}{\star@module}
1668 % \begin{macro}{\slash@module}
1669 % \changes{v1.7a}{1992/03/12}{Added.}
1670 % \changes{v1.7f}{1992/05/16}{Take account of nested guards.}
1671 % \changes{v1.7i}{1992/07/11}{Add counter to determine when to switch to
1673 % If the start or end of a module {\em block\/} is indicated, after
1674 % setting the guard we have to check whether a change in the macrocode
1675 % font should be done. This will be the case if we are already inside
1676 % a block or are ending the outermost block. If so, we globally
1677 % toggle the font for subsequent macrocode sections between the normal
1678 % and special form, switching to the new one immediately.
1679 % \changes{v1.7i}{1992/07/17}{Support for fonts depending on module
1682 \lowercase{\gdef\star@module#1~}{%
1684 \global \advance \guard@level\@ne
1685 \ifnum \guard@level>\c@StandardModuleDepth
1686 \global\let\macro@font=\AltMacroFont \macro@font
1689 \gdef\slash@module#1>{%
1691 \global \advance \guard@level\m@ne
1692 \ifnum \guard@level=\c@StandardModuleDepth
1693 \global\let\macro@font\MacroFont \macro@font
1702 % \begin{macro}{\c@StandardModuleDepth}
1703 % \changes{v1.7i}{1992/07/11}{Counter added.}
1704 % Counter defining up to which level modules are considered part of
1705 % the main code. If, for example, the whole code is surrounded by
1706 % a |%<*package>| module we better set this counter to |1| to avoid
1707 % getting the whole code be displayed in typewriter italic.
1709 \newcounter{StandardModuleDepth}
1714 % \begin{macro}{\guard@level}
1715 % \changes{v1.7f}{1992/05/16}{Added.}
1716 % We need a counter to keep track of the guard nesting.
1718 \newcount \guard@level
1721 % \begin{macro}{\Module}
1722 % \changes{v1.7a}{1992/03/12}{Added.}
1723 % \changes{v1.7d}{1992/04/25}{Use sans font for modules.}
1724 % This provides a hook to determine the way the module directive is
1725 % set. It gets as argument everything between the angle brackets.
1726 % The default is to set the contents in sans serif text between
1727 % $\langle\,\rangle$ with the special characters suitably "\mathcode"d
1728 % by "\mod@math@codes". (You can't just set it in a sans text font
1729 % because normally "|" will print as an em-dash.) This is done
1730 % differently depending on whether we have the NFSS or the old one. In
1731 % the latter case we can easily change "\fam" appropriately.
1732 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1734 \@ifundefined{Module}{%
1736 % With NFSS what we probably {\em should\/} do is change to a new
1737 % "\mathversion" but I (Dave Love) haven't spotted an easy way to
1738 % do so correctly if the document uses a version other than
1739 % "normal". (We need to know in what font to set the other
1740 % groups.) This uses a new math alphabet rather than version and
1741 % consequently has to worry about whether we're using
1742 % \textsf{oldlfnt} or not. I expect there's a better
1745 \def\Module#1{\mod@math@codes$\langle\mathsf{#1}\rangle$}
1750 % \begin{macro}{\mod@math@codes}
1751 % \changes{v1.7c}{1992/03/26}{Added.}
1752 % \changes{v2.1e}{2010/02/04}{Added mathcodes for +,-,:, and = (pr/4096)}
1753 % As well as `words', the module
1754 % directive text might contain any of the characters "*/+-,&|!()"
1755 % for the current version of \textsf{docstrip}. We only need
1756 % special action for two of them in the math code changing required
1757 % above: "|" is changed to a "\mathop" (it's normally |"026A|) and
1758 % "&" is also made a "\mathop", but in family 0. Remember that "&"
1759 % will not have a special catcode when it's encountered.
1761 \def\mod@math@codes{\mathcode`\|="226A \mathcode`\&="2026
1762 \mathcode`\-="702D \mathcode`\+="702B
1763 \mathcode`\:="703A \mathcode`\=="703D }
1767 % \begin{macro}{\mathsf}
1768 % \changes{v1.7c}{1992/03/26}{Added.}
1769 % \changes{v1.7d}{1992/04/25}{Use sans font for modules.}
1770 % \changes{v1.7n}{1993/02/21}{\cs{sfmath} Renamed to \cs{mathsf}.}
1771 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1772 % If NFSS is in use we need a new math alphabet which uses a sans serif
1773 % font. To support both the release one and two of NFSS the alphabet
1774 % was renamed to "\mathsf" which is defined in NFSS2.
1776 %\ifx\selectfont\undefined
1778 % \ifx\mathsf\undefined
1779 % \newmathalphabet*{\mathsf}{\sfdefault}{m}{n}\fi
1786 % \begin{macro}{\MacrocodeTopsep}
1787 % \begin{macro}{\MacroIndent}
1788 % In the code above, we have used two registers. Therefore we have
1789 % to allocate them. The default values might be overwritten with
1790 % the help of the |\DocstyleParms| macro.
1791 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
1792 % \changes{v1.5y}{1990/02/24}{Default changed.}
1793 % \changes{v1.6b}{1990/06/15}{\cs{rm} moved before \cs{scriptsize} to
1794 % avoid unnecessary fontwarning.}
1796 \newskip\MacrocodeTopsep \MacrocodeTopsep = 3pt plus 1.2pt minus 1pt
1797 \newdimen\MacroIndent
1798 \settowidth\MacroIndent{\rmfamily\scriptsize 00\ }
1806 % \begin{macro}{\macrocode*}
1807 % \begin{macro}{\endmacrocode*}
1808 % Just as in the \textsf{verbatim} environment, there is also a
1809 % `star' variant of the \textsf{macrocode} environment in which a
1810 % space is shown by the symbol \verb*+ +. Until this moment, I
1811 % have not yet used it (it will be used in the description of the
1812 % definition of |\xmacro@code| below) but it's exactly on this one
1813 % occasion {\em here\/} that you can't use it (cf.\ M\"unchhausens
1814 % Marsh problem)\footnote{Karl Friedrich Hieronymus Frhr.\ v.\
1815 % M\"unchhausen (*1720, \dag1797). Several books were written
1816 % about fantastic adventures supposedly told by him (see
1817 % \cite{book:Raspe} or \cite{book:Buerger}). In one story he
1818 % escaped from the marsh by pulling himself out by his hair.}
1819 % directly. Because of this, on this one occasion we'll cheat
1820 % around the problem with an additional comment character. But now
1821 % back to |\macrocode*|. We start with the macro |\macro@code|
1822 % which prepares everything and then call the macro |\sxmacro@code|
1823 % whose argument is terminated by the string
1824 %\verb*+% \end{macrocode*}+.
1826 \@namedef{macrocode*}{\macro@code\sxmacro@code}
1828 % As we know, |\sxmacro@code| and then |\end{macrocode*}|
1829 % (the macro, not the string), will be executed, so that for a
1830 % happy ending we still need to define the macro
1833 \expandafter\let\csname endmacrocode*\endcsname = \endmacrocode
1844 % \begin{macro}{\xmacro@code}
1845 \catcode`\!=\catcode`\% ^^A In this section there must not be
1846 ^^A any exclamation marks.
1848 % As already mentioned, the macro |\xmacro@code| expects an
1849 % argument delimited by the string \verb*+% \end{macrocode}+. At
1850 % the moment that this macro is called, the |\catcode| of
1851 % \TeX's special characters are 12 (`other') or 13 (`active').
1852 % Because of this we need to utilize a different escape character
1853 % during the definition. This happens locally.
1854 % \begin{macrocode*}
1856 \catcode`\|=\z@ \catcode`\[=\@ne \catcode`\]=\tw@
1858 % Additionally, we need to ensure that the symbols in the above
1859 % string contain the |\catcode|$\,$s which are available
1860 % within the \textsf{macrocode} environment.
1861 % \begin{macrocode*}
1862 \catcode`\{=12 \catcode`\}=12
1863 \catcode`\%=12 \catcode`\ =\active \catcode`\\=\active
1865 ! Next follows the actual definition of |\macro@code|;
1867 ! use of the new escape character. We manage to get the argument
1868 ! surrounded by the string |\end{macrocode}|, but at the end
1869 ! however, in spite of the actual characters used during the
1871 ! this macro, |\end| with the argument |{macrocode}|
1872 ! will be executed, to ensure a balanced environment.
1873 ! \begin{macrocode*}
1874 |gdef|xmacro@code#1% \end{macrocode}[#1|end[macrocode]]
1876 ! \begin{macro}{\sxmacro@code}
1877 ! The definition of |\sxmacro@code| is completely analogous,
1879 ! here a slightly different terminating string will be used.
1880 ! Note that the space is not active in this environment.
1883 |gdef|sxmacro@code#1% \end{macrocode*}[#1|end[macrocode*]]
1885 ! because the |\catcode| changes have been made local by
1887 ! new group, there now follows the matching |\endgroup|
1889 ! unusual style of writing.
1900 % \subsection{Macros for the `documentation parts'}
1903 % \begin{macro}{\DescribeMacro}
1904 % \begin{macro}{\Describe@Macro}
1905 % \changes{v1.5v}{1990/01/28}{Macro added.}
1906 % \changes{v1.5j}{1989/06/09}{\cs{ignorespaces} added as a temporary
1908 % \begin{macro}{\DescribeEnv}
1909 % \begin{macro}{\Describe@Env}
1910 % \changes{v1.5v}{1990/01/28}{Macro added.}
1911 % \changes{v1.5j}{1989/06/09}{\cs{ignorespaces} added as a temporary
1913 % The |\DescribeMacro| and |\DescribeEnv| macros should
1914 % print their arguments in the margin and produce an index entry.
1915 % We simply use |\marginpar| to get the desired result. This
1916 % is however not the best solution because the labels might be
1917 % slightly misplaced. One also might get a lot of `marginpar moved'
1918 % messages which are hard-wired into the \LaTeX{} output
1919 % routine.\footnote{It might be better to change these macros into
1920 % environments like the \textsf{macro} environment.} First we change
1921 % to horizontal mode if necessary. The \LaTeX{} macros
1922 % |\@bsphack| and |\@esphack| are used to make those
1923 % commands invisible (i.e.\ to normalize the surrounding space and
1924 % to make the |\spacefactor| transparent).
1925 % \changes{v1.5v}{1990/01/28}{\cs{MakePrivateLetters} added.}
1927 \def\DescribeMacro{\leavevmode\@bsphack
1929 % When documenting the code for the \texttt{amstex.sty} option we
1930 % encountered a bug: the |\catcode| of |@| was active and
1931 % therefore couldn't be used in command names. So we first have to
1932 % make sure that we get all |\catcode|s right by calling
1933 % |\MakePrivateLetters| inside a group. Then we call
1934 % |\Describe@Macro| to do the work.
1935 % \changes{v2.0g}{1999/03/22}{Parse backslash as letter in argument
1936 % to \cs{DescribeMacro}.}
1937 % \changes{v2.0h}{1999/03/25}{Correct errors introduced in v2.0g.}
1939 \begingroup\MakePrivateLetters\Describe@Macro}
1940 \def\Describe@Macro#1{\endgroup
1941 \marginpar{\raggedleft\PrintDescribeMacro{#1}}%
1943 % Note the use of |\raggedleft| to place the output flushed
1944 % right. Finally we call a macro which produces the actual index
1945 % entry and finish with |\@esphack| to leave no
1946 % trace.\footnote{The whole mechanism won't work because
1947 % of the \texttt{\bslash leavevmode} in front.
1948 % As a temporary change \texttt{\bslash ignorespaces}
1951 \SpecialUsageIndex{#1}\@esphack\ignorespaces}
1953 % The |\DescribeEnv| macro is completely analogous.
1954 % \changes{v1.5v}{1990/01/28}{\cs{MakePrivateLetters} added.}
1956 \def\DescribeEnv{\leavevmode\@bsphack\begingroup\MakePrivateLetters
1958 \def\Describe@Env#1{\endgroup
1959 \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
1960 \SpecialEnvIndex{#1}\@esphack\ignorespaces}
1962 % To put the labels in the left margin we have to use the
1963 % |\reversemarginpar| declaration. (This means that the
1964 % \texttt{doc.sty} can't be used with all classes or packages.)
1966 % make the |\marginparpush| zero and |\marginparwidth| suitably
1968 % \changes{v1.5d}{1989/4/28}{\cs{marginparwidth} setting added.}
1971 \setlength\marginparpush{0pt} \setlength\marginparwidth{8pc}
1978 % \begin{macro}{\bslash}
1979 % \changes{v1.7a}{1992/02/26}{Moved \cs{bslash} documentation to `user
1981 % We start a new group in which to hide the alteration of
1982 % |\catcode|$\,$s, and make \verb+|+ introduce commands,
1983 % whilst |\| becomes an `other' character.
1986 {\catcode`\|=\z@ \catcode`\\=12
1988 % Now we are able to define |\bslash| (globally) to generate a
1989 % backslash of |\catcode| `other'. We then close this group,
1990 % restoring original |\catcode|$\,$s.
1991 % \SpecialEscapechar{\|}
1999 % \begin{macro}{\verbatim}
2000 % \begin{macro}{\verbatim*}
2001 % \changes{v1.7i}{1992/07/12}{Added changed definition for verbatim!*.}
2002 % The \textsf{verbatim} environment holds no secrets; it consists of
2003 % the normal \LaTeX{} environment. We also set the
2004 % |\@beginparpenalty| and change to the font given by
2007 \def\verbatim{\@beginparpenalty \predisplaypenalty \@verbatim
2008 \MacroFont \frenchspacing \@vobeyspaces \@xverbatim}
2010 % We deal in a similar way with the star form of this environment.
2012 \@namedef{verbatim*}{\@beginparpenalty \predisplaypenalty \@verbatim
2013 \MacroFont \@sxverbatim}
2018 % \begin{macro}{\@verbatim}
2019 % Additionally we redefine the |\@verbatim| macro so that it
2020 % suppresses |%| characters at the beginning of the line. The
2021 % first lines are copied literally from \texttt{latex.tex}.
2022 % \changes{v1.7i}{1992/07/12}{Added \cs{@@par} to clear possible
2025 \def\@verbatim{\trivlist \item[]\if@minipage\else\vskip\parskip\fi
2026 \leftskip\@totalleftmargin\rightskip\z@
2027 \parindent\z@\parfillskip\@flushglue\parskip\z@
2031 % |\@verbatim| sets |^^M|, the end of line character, to
2032 % be equal to |\par|. This control sequence is redefined
2033 % here; |\@@par| is the paragraph primitive of \TeX.
2034 % \changes{v1.7c}{1992/3/24}{Added \cs{interlinepenalty} to
2035 % \cs{par} from verbatim.sty}
2037 \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par
2038 \penalty\interlinepenalty
2040 % We add a control sequence |\check@percent| to the definition
2041 % of |\par| whose task it is to check for a percent character.
2045 % The rest is again copied literally from \texttt{latex.tex} (less
2047 % \changes{v1.7a}{1992/02/26}{Removed redundant \cs{tt}.}
2048 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
2049 % which handles more ligatures.}
2052 \let\do\do@noligs \verbatim@nolig@list
2053 \let\do\@makeother \dospecials}
2057 % \begin{macro}{\check@percent}
2058 % Finally we define |\check@percent|. Since this must compare a
2059 % character with a percent sign we must first (locally) change
2060 % percent's |\catcode| so that it is seen by \TeX. The definition
2061 % itself is nearly trivial: grab the following character, check if
2062 % it is a |%|, and insert it again if not. At the end of the
2063 % \textsf{verbatim} environment this macro will peek at the next
2064 % input line. In that case the argument to |\check@percent| might
2065 % be a |\par| or a macro with arguments. Therefore we make the
2066 % definition |\long| (|\par| allowed) and use the normal |\next|
2067 % mechanism to reinsert the argument after the |\fi| if necessary.
2068 % \changes{v1.5i}{1989/06/07}{Definition changed to `long'}
2069 % \changes{v1.5i}{1989/06/07}{Macro \cs{next} used to guard against
2070 % macro with arguments}
2071 % There is a subtle problem here, the equal sign between
2072 % |\next| and |#1| is actually necessary. Do you see why?
2073 % The omission of this token once caused a funny error.
2074 % \changes{v1.5u}{1989/11/14}{equal sign added.}
2077 \long\gdef\check@percent#1{\ifx #1%\let\next\@empty \else
2078 \let\next=#1\fi \next}}
2082 % \begin{macro}{\verb}
2083 % \changes{v1.7a}{1992/02/27}{Now warns about newlines (from
2084 % newdoc with `@noligs added).}
2085 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX \cs{verb}}
2086 % We re-define "\verb" to check for newlines in its argument since a
2087 % missing delimiter is difficult to detect in \DOC{} source.
2088 % The code is the same as in \texttt{latex.tex} of September 19, 1993.
2089 % Perhaps there should be a font-changing
2090 % hook rather than just using "\ttfamily", but if so it probably should be
2091 % different from "\MacroFont" since that normally includes "\small"
2092 % and would look wrong inline.
2093 % \changes{v1.7a}{1992/02/28}{Added math mode check (from verbatim.sty)}
2095 \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
2096 \bgroup \let\do\do@noligs \verbatim@nolig@list
2097 \ttfamily \verb@eol@error \let\do\@makeother \dospecials
2098 \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}}
2102 % \begin{macro}{\verb@balance@group}
2103 % \begin{macro}{\verb@egroup}
2104 % \begin{macro}{\verb@eol@error}
2105 % \changes{v1.8b}{1993/09/21}{Renamed \cs{verb@err} to
2106 % \cs{verb@eol@error}, as in new LaTeX verbatim.}
2108 \let\verb@balance@group\@empty
2110 \def\verb@egroup{\global\let\verb@balance@group\@empty\egroup}
2114 \gdef\verb@eol@error{\obeylines%
2115 \def^^M{\verb@egroup\@latex@error{%
2116 Text for \noexpand\verb command ended by end of line}\@ehc}}%
2123 % \begin{macro}{\@sverb}
2124 % \changes{v1.7a}{1992/02/27}{Added for \cs{verb} change.}
2125 % \changes{v1.7a}{1992/02/28}{Now same as in verbatim.sty.}
2126 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
2127 % which has better error trapping.}
2128 % See \cite{art:verbatim} for commentary.
2131 \catcode`#1\active \lccode`\~`#1%
2132 \gdef\verb@balance@group{\verb@egroup
2133 \@latex@error{Illegal use of \noexpand\verb command}\@ehc}%
2134 \aftergroup\verb@balance@group
2135 \lowercase{\let~\verb@egroup}}
2140 % \begin{macro}{\verbatim@nolig@list}
2141 % \begin{macro}{\do@noligs}
2142 % These macros replace the old "\@noligs" mechanism by an
2143 % extensible version to allow more ligatures to be added.
2145 \def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-}
2149 \lccode`\~=`#1\relax
2150 \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}}
2156 % \begin{macro}{\macro}
2157 % \begin{macro}{\m@cro@}
2158 % \changes{v1.5v}{1990/01/28}{\cs{macro@} renamed to \cs{m@cro@}
2160 % defines another macro of the same name.}
2161 % \begin{macro}{\macro@cnt}
2162 % \label{page:macro} The \textsf{macro} environment is implemented as
2163 % a \textsf{trivlist} environment, whereby in order that the macro
2164 % names can be placed under one another in the margin
2165 % (corresponding to the macro's nesting depth), the macro
2166 % |\makelabel| must be altered. In order to store the nesting
2167 % depth, we use a counter. We also need a counter to count the
2168 % number of nested \textsf{macro} environments.
2169 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2170 % \changes{v1.9k}{1994/02/22}{Fix probably no longer necessary}
2172 \newcount\macro@cnt \macro@cnt=0
2174 % The environment takes an argument---the macro name to be
2175 % described. Since this name may contain special `letters' we have
2176 % to re-|\catcode| them before scanning the argument. This is done
2177 % by the |\MakePrivateLetters| macro.
2178 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2179 % \changes{v1.7a}{1992/02/26}{Catcode backslash to other (from newdoc).}
2180 % \changes{v1.9k}{1994/02/22}{Don't omit extra group}
2182 \def\macro{\begingroup
2184 \MakePrivateLetters \m@cro@ \iftrue}
2187 % \begin{macro}{\environment}
2188 % \changes{v1.8c}{1993/10/25}{Environment added}
2189 % The ``environment'' envrionment will be implemented just like the
2190 % ``macro'' environment flagging any differences in the code by
2191 % passing |\iffalse| or |\iftrue| to the |\m@cro@| environment
2192 % doing the actual work.
2194 \def\environment{\begingroup
2196 \MakePrivateLetters \m@cro@ \iffalse}
2200 % After scanning the argument we close the group to get the normal
2201 % |\catcode|$\,$s back. Then we assign a special value to
2202 % |\topsep| and start a \textsf{trivlist} environment.
2203 % \changes{v1.5f}{1989/5/07}{MacroTopsep parameter added.}
2204 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2205 % \changes{v1.8c}{1993/10/25}{Support ``environment'' env}
2206 % \changes{v1.9k}{1994/02/22}{Remove \cs{macro@level}}
2208 \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
2210 % We also save the name being described in |\saved@macroname| for
2211 % use in conjunction with the |\changes| macro.
2213 \edef\saved@macroname{\string#2}%
2215 % Now there follows a variation of |\makelabel| which is used
2216 % should the environment not be nested, or should it lie between
2217 % two successive |\begin{macro}| instructions or explanatory
2218 % text. One can recognize this with the switch |\if@inlabel|
2219 % which will be |true| in the case of successive |\item|
2222 \def\makelabel##1{\llap{##1}}%
2224 % If |@inlabel| is |true| and if $\verb=\macro@cnt= > 0$
2225 % then the above definition needs to be changed, because in this
2226 % case \LaTeX{} would otherwise put the labels all on the same line
2227 % and this would lead to them being overprinted on top of each
2228 % other. Because of this |\makelabel| needs to be redefined
2233 % If |\macro@cnt| has the value $1$, then we redefine
2234 % |\makelabel| so that the label will be positioned in the
2235 % second line of the margin. As a result of this, two macro names
2236 % appear correctly, one under the other. It's important whilst
2237 % doing this that the generated label box is not allowed to have
2238 % more depth than a normal line since otherwise the distance
2239 % between the first two text lines of \TeX{} will be incorrectly
2240 % calculated. The definition should then look like:
2242 % \def\makelabel##1{\llap{\vtop to \baselineskip
2243 % {\hbox{\strut}\hbox{##1}\vss}}}
2245 % Completely analogous to this is the case where labels need to be
2246 % placed one under the other. The lines above are only an example
2247 % typeset with the \textsf{verbatim} environment. To produce the real
2248 % definition we save the value of |\macro@cnt| in
2249 % |\count@| and empty the temp macro |\@tempa| for later
2252 \let\@tempa\@empty \count@\macro@cnt
2254 % In the following loop we append for every already typeset label
2255 % an |\hbox{\strut}| to the definition of |\@tempa|.
2257 \loop \ifnum\count@>\z@
2258 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
2260 % Now be put the definition of |\makelabel| together.
2261 % \changes{v1.5b}{1989/04/27}{vbox to vtop changed in makelabel (test)}
2262 % \changes{v1.5e}{1989/04/28}{ht strutbox changed to baselineskip
2265 \edef\makelabel##1{\llap{\vtop to\baselineskip
2266 {\@tempa\hbox{##1}\vss}}}%
2268 % Next we increment the value of the nesting depth counter. This
2269 % value inside the \textsf{macro} environment is always at least one
2270 % after this point, but its toplevel definition is zero. Provided
2271 % this environment has been used correctly, $|\macro@cnt|=0$
2272 % should not occur when |@inlabel|=\textsf{true}. It is
2273 % however possible if this environment is used within other list
2274 % environments (but this would have little point).
2276 \advance \macro@cnt \@ne
2278 % If |@inlabel| is false we reset |\macro@cnt| assuming
2279 % that there is enough room to print the macro name without
2282 \else \macro@cnt\@ne \fi
2284 % Now the label will be produced using |\item|. The following
2285 % line is only a hack saving the day until a better solution is
2286 % implemented. We have to face two problems: the argument might be
2287 % a |\par| which is forbidden in the argument of other macros
2288 % if they are not defined as |\long|, or it is something like
2289 % |\iffalse| or |\else|, i.e.\ something which will be
2290 % misinterpreted when \TeX{} is skipping conditional text. In both
2291 % cases |\item| will bomb, so we protect the argument by using
2294 \edef\@tempa{\noexpand\item[%
2296 % Depending on whether we are inside a ``macro'' or ``environment''
2297 % environment we use |\PrintMacroName| or |\PrintEnvName| to
2301 \noexpand\PrintMacroName
2303 \noexpand\PrintEnvName
2308 % At this point we also produce an index entry. Because it is not
2309 % known which index sorting program will be used, we do not use the
2310 % command |\index|, but rather a command
2311 % |\SpecialMainIndex| after advancing the counter for indexing
2312 % by line number. This may be redefined by the user in
2313 % order to generate an index entry which will be understood by the
2314 % index program in use (note the definition of
2315 % |\SpecialMainIndex| for our installation).
2316 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
2317 % \changes{v1.9u}{1995/08/06}{Removed brace group which
2318 % killed \cs{DoNotIndex}}
2319 % We advance the current codeline number and after producing an
2320 % index entry revert to the original value
2322 \global\advance\c@CodelineNo\@ne
2324 % Again the macro to call depends on the environment we are
2328 \SpecialMainIndex{#2}\nobreak
2331 \SpecialMainEnvIndex{#2}\nobreak
2333 \global\advance\c@CodelineNo\m@ne
2335 % The |\nobreak| is needed to prevent a page break after the
2336 % |\write| produced by the |\SpecialMainIndex| macro. We
2337 % exclude the new macro in the cross-referencing feature, to
2338 % prevent spurious non-main entry references. Regarding possibly
2339 % problematic arguments, the implementation takes
2340 % care of |\par| and the conditionals are uncritical.
2341 % \changes{v1.7a}{1992/03/02}{Removed redundant code checking for
2344 % Because the space symbol should be ignored between the
2345 % |\begin{macro}{...}| and the following text we must take
2346 % care of this with |\ignorespaces|.
2356 % \begin{macro}{\endmacro}
2357 % \begin{macro}{\endenvironment}
2358 % Older releases of this environment omit the |\endgroup| token,
2359 % when being nested. This was done to avoid unnecessary stack usage.
2360 % However it does not work if \textsf{macro} and
2361 % \textsf{environment} environments are mixed, therefore we now
2362 % use a simpler approach.
2363 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2364 % \changes{v1.9k}{1994/02/22}{Don't checkfor nesting}
2366 \let\endmacro \endtrivlist
2367 \let\endenvironment\endmacro
2372 % \begin{macro}{\MacroTopsep}
2373 % Here is the default value for the |\MacroTopsep| parameter
2376 \newskip\MacroTopsep \MacroTopsep = 7pt plus 2pt minus 2pt
2384 % \subsection{Formatting the margin}
2386 % The following three macros should be user definable.
2387 % Therefore we define those macros only if they have not already
2390 % \begin{macro}{\PrintMacroName}
2391 % \begin{macro}{\PrintEnvName}
2392 % \begin{macro}{\PrintDescribeMacro}
2393 % \begin{macro}{\PrintDescribeEnv}
2394 % The formatting of the macro name in the left margin is done by
2395 % these macros. We first set a |\strut| to get the height and
2396 % depth of the normal lines. Then we change to the
2397 % |\MacroFont| using |\string| to |\catcode| the
2398 % argument to other (assuming that it is a macro name). Finally we
2399 % print a space. The font change remains local since this macro
2400 % will be called inside an |\hbox|.
2402 \@ifundefined{PrintMacroName}
2403 {\def\PrintMacroName#1{\strut \MacroFont \string #1\ }}{}
2405 % We use the same formatting conventions when describing a macro.
2407 \@ifundefined{PrintDescribeMacro}
2408 {\def\PrintDescribeMacro#1{\strut \MacroFont \string #1\ }}{}
2410 % To format the name of a new environment there is no need to use
2413 \@ifundefined{PrintDescribeEnv}
2414 {\def\PrintDescribeEnv#1{\strut \MacroFont #1\ }}{}
2415 \@ifundefined{PrintEnvName}
2416 {\def\PrintEnvName#1{\strut \MacroFont #1\ }}{}
2425 % \subsection{Creating index entries by scanning `macrocode'}
2427 % The following macros ensure that index entries are created for each
2428 % occurrence of a \TeX-like command (something starting with
2429 % `|\|') providing indexing has been turned on with "\PageIndex"
2430 % or "\CodelineIndex". With the default definitions of
2431 % |\SpecialMainIndex|, etc., the index file generated is
2432 % intended to be processed by Chen's \textsf{makeindex} program
2436 % Of course, in {\em this\/} package file itself we've sometimes had to
2437 % make \verb+|+ take the r\^ole of \TeX's escape character to
2438 % introduce command names at places where |\| has to belong to
2439 % some other category. Therefore, we may also need to recognize
2440 % \verb+|+ as the introducer for a command when setting the text
2441 % inside the \textsf{macrocode} environment. Other users may have the
2442 % need to make similar reassignments for their macros.
2445 % \begin{macro}{\SpecialEscapechar}\label{sect:specialescapechar}
2446 % \begin{macro}{\active@escape@char}
2447 % \begin{macro}{\special@escape@char}
2448 % The macro |\SpecialEscapechar| is used to denote a special escape
2449 % character for the next \textsf{macrocode} environment. It has one
2450 % argument---the new escape character given as a `single-letter'
2451 % control sequence. Its main purpose is defining
2452 % |\special@escape@char| to produce the chosen escape character
2453 % |\catcode|$\,$d to 12 and |\active@escape@char| to produce the
2454 % same character but with |\catcode| 13.
2456 % The macro |\special@escape@char| is used to {\em print\/}
2457 % the escape character while |\active@escape@char| is needed
2458 % in the definition of |\init@crossref| to start the scanning
2461 % In the definition of |\SpecialEscapechar| we need an
2462 % arbitrary character with |\catcode| 13. We use `\~{}' and
2463 % ensure that it is active. The |\begingroup| is used to make
2464 % a possible change local to the expansion of
2465 % |\SpecialEscapechar|.
2466 % \changes{v1.7g}{1992/6/19}{Making tilde active moved outside
2471 \gdef\SpecialEscapechar#1{%
2474 % Now we are ready for the definition of
2475 % |\active@escape@char|. It's a little tricky: we first
2476 % define locally the uppercase code of `\~{}' to be the new escape
2481 % Around the definition of |\active@escape@char| we place an
2482 % |\uppercase| command. Recall that the expansion of
2483 % |\uppercase| changes characters according to their
2484 % |\uccode|, but leaves their |\catcode|$\,$s untouched
2485 % (cf.\ \TeX{}book page 41).
2487 \uppercase{\gdef\active@escape@char{~}}%
2489 % The definition of |\special@escape@char| is easier, we use
2490 % |\string| to |\catcode| the argument of
2491 % |\SpecialEscapechar| to 12 and suppress the preceding
2494 \escapechar\m@ne \xdef\special@escape@char{\string#1}%
2496 % Now we close the group and end the definition: the value of
2497 % |\escapechar| as well as the |\uccode| and
2498 % |\catcode| of `\~{}' will be restored.
2510 % \begin{macro}{\init@crossref}
2511 % The replacement text of |\init@crossref| should fulfill the
2516 % |\catcode| all characters used in macro names to
2517 % 11 (i.e.\ `letter').
2519 % |\catcode| the `|\|' character to 13
2522 % |\let| the `|\|' equal |\scan@macro|
2523 % (i.e.\ start the macro scanning mechanism) if there is
2524 % no special escape character (i.e.\ the
2525 % |\special@escape@char| is `|\|').
2527 % Otherwise |\let| it equal |\bslash|, i.e.\
2528 % produce a printable |\|.
2530 % Make the \meta{special escape character} active.
2532 % |\let| the active version of the special escape
2534 % (i.e.\ the expansion of |\active@escape@char|) equal
2537 % The reader might ask why we bother to |\catcode| the
2538 % `|\|' first to 12 (at the end of |\macro@code|) then
2539 % re-|\catcode| it to 13 in order to produce a $|\|_{12}$
2540 % in case 3b) above. This is done because we have to ensure that
2541 % `|\|' has |\catcode| 13 within the \textsf{macrocode}
2542 % environment. Otherwise the delimiter for the argument of
2543 % |\xmacro@code| would not be found (parameter matching
2544 % depends on |\catcode|$\,$s).
2546 % Therefore we first re-|\catcode| some characters.
2548 \begingroup \catcode`\|=\z@ \catcode`\\=\active
2550 % We carry out tasks 2) and 3b) first.
2551 % \SpecialEscapechar{\|}
2553 |gdef|init@crossref{|catcode`|\|active |let\|bslash
2555 % Because of the popularity of the `|@|' character as a
2556 % `letter' in macros, we normally have to change its
2557 % |\catcode| here, and thus fulfill task 1). But the macro
2558 % designer might use other characters as private letters as well,
2559 % so we use a macro to do the |\catcode| switching.
2560 % \SpecialEscapechar\|
2564 % Now we |\catcode| the special escape character to 13 and
2565 % |\let| it equal |\scan@macro|, i.e.\ fulfill tasks 4)
2566 % and 5). Note the use of |\expandafter| to insert the chosen
2567 % escape character saved in |\special@escape@char| and
2568 % |\active@escape@char|.
2569 % \SpecialEscapechar\|
2571 |catcode|expandafter`|special@escape@char|active
2572 |expandafter|let|active@escape@char|scan@macro}
2575 % If there is no special escape character, i.e.\ if
2576 % |\SpecialEscapechar| is |\\|, the second last line will
2577 % overwrite the previous definition of $|\|_{13}$. In this
2578 % way all tasks are fulfilled.
2580 % For happy documenting we give default values to
2581 % |\special@escape@char| and |\active@escape@char| with
2582 % the following line:
2584 \SpecialEscapechar{\\}
2590 % \begin{macro}{\MakePrivateLetters}
2591 % Here is the default definition of this command, which makes just
2592 % the |@| into a letter. The user may change it if he/she
2593 % needs more or other characters masquerading as letters.
2595 \@ifundefined{MakePrivateLetters}
2596 {\let\MakePrivateLetters\makeatletter}{}
2600 % \begin{macro}{\close@crossref}
2601 % At the end of a cross-referencing part we prepare ourselves for
2602 % the next one by setting the escape character to `|\|'.
2604 \def\close@crossref{\SpecialEscapechar\\}
2611 % \subsection{Macros for scanning macro names}
2613 % \begin{macro}{\scan@macro}
2614 % \changes{v1.5k}{1989/09/04}{Support for checksum added.}
2615 % \begin{macro}{\macro@namepart}
2616 % The |\init@crossref| will have made |\active| our
2617 % |\special@escape@char|, so that each
2618 % |\active@escape@char| will invoke |\scan@macro| when
2619 % within the \textsf{macrocode} environment. By this means, we can
2620 % automatically add index entries for every \TeX-like command which
2621 % is met whilst setting (in verbatim) the contents of
2622 % \textsf{macrocode} environments.
2626 % First we output the character which triggered this macro. Its
2627 % version |\catcode|$\,$d to 12 is saved in
2628 % |\special@escape@char|. We also call |\step@checksum|
2629 % to generate later on a proper check-sum (see section
2630 % \ref{sec:checksum} for details).
2632 \special@escape@char
2635 % If the \textsf{macrocode} environment contains, for example, the
2636 % command |\\|, the second |\| should not start the
2637 % scanning mechanism. Therefore we use a switch to decide if
2638 % scanning of macro names is allowed.
2642 % The macro assembles the letters forming a \TeX\ command in
2643 % |\macro@namepart| so this is initially cleared; we then set
2644 % |\next| to the \textit{first\/} character following the
2645 % |\| and call |\macro@switch| to determine whether that
2646 % character is a letter or not.
2648 \let\macro@namepart\@empty
2649 \def\next{\futurelet\next\macro@switch}%
2651 % As you recognize, we actually did something else, because we have
2652 % to defer the |\futurelet| call until after the final
2653 % |\fi|. If, on the other hand, the scanning is disabled we
2654 % simply |\let| |\next| equal `empty'.
2656 \else \let\next\@empty \fi
2658 % Now we invoke |\next| to carry out what's needed.
2666 % \begin{macro}{\ifscan@allowed}
2667 % \begin{macro}{\scan@allowedtrue}
2668 % \begin{macro}{\scan@allowedfalse}
2669 % |\ifscan@allowed| is the switch used above to determine if
2670 % the |\active@escape@char|\SpecialIndex{\active@escape@char}
2671 % should start the macro scanning mechanism.
2673 \newif\ifscan@allowed \scan@allowedtrue
2680 % \begin{macro}{\EnableCrossrefs}
2681 % \begin{macro}{\DisableCrossrefs}
2682 % At this point we might define two macros which allow the user to
2683 % disable or enable the cross-referencing mechanism. Processing of
2684 % files will be faster if only main index entries are generated
2685 % (i.e., if |\DisableCrossrefs| is in force).
2687 \def\DisableCrossrefs{\@bsphack\scan@allowedfalse\@esphack}
2689 % The macro |\EnableCrossrefs| will also disable any
2690 % |\DisableCrossrefs| command encountered afterwards.
2692 \def\EnableCrossrefs{\@bsphack\scan@allowedtrue
2693 \def\DisableCrossrefs{\@bsphack\@esphack}\@esphack}
2701 % \begin{macro}{\macro@switch}
2702 % Now that we have the character which follows the escape character
2703 % (in |\next|), we can determine whether it's a `letter'
2704 % (which probably includes |@|).
2706 % If it is, we let |\next| invoke a macro which assembles the
2707 % full command name.
2709 \def\macro@switch{\ifcat\noexpand\next a%
2710 \let\next\macro@name
2712 % Otherwise, we have a `single-character' command name. For all
2713 % those single-character names, we use |\short@macro| to
2714 % process them into suitable index entries.
2716 \else \let\next\short@macro \fi
2718 % Now that we know what macro to use to process the macro name, we
2726 % \begin{macro}{\short@macro}
2727 % \changes{v1.5c}{1989/4/27}{Corrected bad bug by putting the
2728 % scan@allowedfalse macro before printing
2730 % \changes{v1.7a}{1992/03/10}{Ensure character stored in
2731 % \cs{macro@namepart} as `letter' so index exclusion works.}
2732 % This macro will be invoked (with a single character as parameter)
2733 % when a single-character macro name has been spotted whilst
2734 % scanning within the \textsf{macrocode} environment.
2736 % First we take a look at the |\index@excludelist| to see
2737 % whether this macro name should produce an index entry. This is
2738 % done by the |\ifnot@excluded| macro which assumes that the
2739 % macro name is saved in |\macro@namepart|. The character
2740 % mustn't be stored with a special category code or exclusion from
2741 % the index won't work, so we employ the case-changing trick used
2742 % elsewhere. Since the argument might be an active character,
2743 % |\string| is used to normalize it.
2744 % \changes{v2.0e}{1998/12/28}{Correctly use the case-changing trick.}
2748 \gdef\short@macro#1{\begingroup
2749 \uccode`\&=\expandafter`\string#1%
2750 \uppercase{\def\x{\def\macro@namepart{&}}}%
2751 \expandafter\endgroup\x
2754 % If necessary the index entry is produced by the macro
2755 % |\produce@index|. Depending on the actual character seen,
2756 % this macro has to do different things, so we pass the character
2759 \produce@index{#1}\fi
2761 % Then we disable the cross-referencing mechanism with
2762 % |\scan@allowedfalse| and print the actual character. The
2763 % index entry was generated first to ensure that no page break
2764 % intervenes (recall that a |^^M| will start a new line).
2766 \scan@allowedfalse#1%
2768 % After typesetting the character we can safely enable the
2769 % cross-referencing feature again. Note that this macro won't be
2770 % called (since |\macro@switch| won't be called) if
2771 % cross-referencing is globally disabled.
2780 % \begin{macro}{\produce@index}
2781 % \changes{v1.4s}{1989/04/23}{Added noexpand to all
2783 % to avoid garbage produced by new active chars}
2784 % \changes{v1.4s}{1989/04/23}{Used \texttt{\protect\bslash string} for
2786 % \changes{v1.5c}{1989/4/27}{Corrected bad bug by placing the
2787 % scan@allowedfalse macro into short@macro}
2788 % This macro is supposed to generate a suitable |\SortIndex|
2789 % command for a given single-letter control sequence. We test
2790 % first for the cases which involve active characters (i.e.\ the
2791 % backslash, the special escape character (if any), the space and
2792 % the |^^M|). Using the |\if| test (testing for
2793 % character codes), we have to ensure that the argument isn't
2796 \def\produce@index#1{%
2797 \if\noexpand#1\special@escape@char
2799 % If the character is the special escape character (or the
2800 % `|\|' in case there was none) the |\it@is@a| macro is
2801 % used to produce the actual |\SortIndex| call.
2803 \scan@allowedfalse \it@is@a\special@escape@char \else
2805 % Next comes the test for a `|\|' which must be the
2806 % $|\|_{13}$ expanding to |\bslash|.
2808 \if\noexpand#1\bslash \it@is@a\bslash \else
2810 % Another possibility is \verb*+ +$_{13}$. Recall that |\space|
2811 % produces a \verb*+ +$_{10}$.
2813 \if\noexpand#1\space \it@is@a\space \else
2815 % The last\footnote{Well, it isn't the last active character after
2816 % all. I added \texttt{\bslash @noligs} some days ago and now
2817 % \texttt{`} too is active. So we have to make sure that such
2818 % characters don't get expanded in the index.} possibility of an
2819 % active character is |^^M|\@. In this case we don't test for
2820 % character codes, since it is easier to look if the character is
2821 % equal to |\par|. (We are inside the \textsf{macrocode}
2826 % If we end up here we have just scanned a |\^^M| or something
2827 % similar. Since this will be treated like \verb*+\ + by \TeX{} we
2828 % produce a corresponding index entry.
2830 \it@is@a\space \else
2832 % If it is the token |\relax| we do nothing. This can't happen
2833 % when the `doc' package is used in the way described here, but was
2834 % added to allow extensions like the \texttt{idxverb} option.
2835 % \changes{v1.5t}{1989/11/14}{Added \cs{relax} as a possible token to
2836 % allow extensions.}
2840 % The next three branches are needed because of bugs in
2841 % our \textsf{makeindex} program. You can't produce unbalanced index
2842 % entries\footnote{This is possible for \TeX{} if you use
2843 % \texttt{\string{$_{12}$ \rmfamily or
2844 % \ttfamily\string}$_{12}$},
2845 % but \textsf{makeindex} will complain.}
2846 % and you have to double a percent character. To get around these
2847 % restrictions we use special macros to produce the |\index|
2848 % calls.\footnote{Brian \textsc{Hamilton Kelly} has written fixes for
2850 % bugs. When they've found their way through all
2852 % the lines above will be removed. See
2853 % page~\pageref{bug:fixes} if you already have them.
2854 % (I'm not sure which versions incorporate these, but
2855 % 2.11 is OK. See also
2856 % \pageref{makeindex:version}.)}
2858 \if\noexpand#1\bgroup \LeftBraceIndex \else
2859 \if\noexpand#1\egroup \RightBraceIndex \else
2860 \if\noexpand#1\percentchar \PercentIndex \else
2862 % All remaining characters are used directly to produce their index
2863 % entries. This is possible even for the characters which have
2864 % special meanings in the index program, provided we quote the
2865 % characters. (This is correctly done in |\it@is@a|.)
2867 \it@is@a{\string#1}%
2869 % We now need a whole pile of |\fi|$\,$s to match up with
2872 \fi \fi \fi \fi \fi \fi \fi \fi}
2878 % \begin{macro}{\macro@name}
2879 % We now come to the macro which assembles command names which
2880 % consist of one or more `letters' (which might well include
2881 % |@| symbols, or anything else which has a |\catcode| of
2884 % To do this we add the `letter' to the existing definition of
2885 % |\macro@namepart| (which you will recall was originally set
2888 \def\macro@name#1{\edef\macro@namepart{\macro@namepart#1}%
2890 % Then we grab hold of the {\em next\/} single character and let
2891 % |\more@macroname| determine whether it belongs to the letter
2892 % string forming the command name or is a `non-letter'.
2894 \futurelet\next\more@macroname}
2902 % \begin{macro}{\more@macroname}
2904 % This causes another call of |\macro@name| to add in the next
2905 % character, if it is indeed a `letter'.
2907 \def\more@macroname{\ifcat\noexpand\next a%
2908 \let\next\macro@name
2910 % Otherwise, it finishes off the index entry by invoking
2913 \else \let\next\macro@finish \fi
2915 % Here's where we invoke whatever macro was |\let| equal to
2926 % \begin{macro}{\macro@finish}
2927 % When we've assembled the full `letter'-string which forms the
2928 % command name, we set the characters forming the entire command
2929 % name, and generate an appropriate |\index| command (provided
2930 % the command name is not on the list of exclusions). The
2931 % `|\|' is already typeset; therefore we only have to output
2932 % all `letters' saved in |\macro@namepart|.
2937 % Then we call |\ifnot@excluded| to decide whether we have to
2938 % produce an index entry. The construction with |\@tempa| is
2939 % needed because we want the expansion of |\macro@namepart| in
2940 % the |\index| command.\footnote{The \texttt{\bslash index}
2941 % command will expand its argument in the \texttt{\bslash output}
2942 % routine. At this time \texttt{\bslash macro@namepart} might have a
2946 \edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}%
2955 % \subsection[The index exclude list]{The index exclude
2956 % list\footnotemark}
2957 % \footnotetext{Warning: the incomplete commentary on
2958 % \texttt{\bslash DoNotIndex} and the macros it calls
2959 % was written by Dave Love.}
2961 % The internal form of the index exclude list is
2963 % \meta{macro name}|,|\meta{macro name}|,|
2966 % where \meta{macro name} is a macro name like
2967 % $"\"_{12}"p"{_{11}}"@"_{11}$ or $"\"_{12}"$"_{11}$. Note that the "\"
2968 % has category `other' and the other characters in the name are all
2969 % `letter', regardless of their normal category.
2971 % \begin{macro}{\DoNotIndex}
2972 % This macro is used to suppress macro names in the index. It
2973 % starts off with a new group because we have to change the
2974 % |\catcode|$\,$s of all characters which belong to `letters'
2975 % while macros are defined.
2977 \def\DoNotIndex{\begingroup \MakePrivateLetters
2980 % Then we call the macro which actually reads the argument given by
2989 % \begin{macro}{\do@not@index}
2990 % We make the |\do@not@index| macro |\long|
2991 % since the user might want to exclude the |\par|
2994 \long\def\do@not@index#1{%
2996 % It just adds to a token list after finishing the group in which
2997 % the catcodes were changed.
2998 % \changes{v1.7a}{1992/02/26}{Replaced with newdoc version.}
3001 \addto@hook\index@excludelist{#1,}}
3005 % \begin{macro}{\addto@hook}
3006 % The code for adding tokens (the second argument) to a token list
3007 % (the first argument) is taken from~\cite{art:verbatim}, but it needs
3008 % to be "\long" in case "\par" is amongst the tokens.
3010 \long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
3014 % \begin{macro}{\index@excludelist}
3015 % We need an initially-empty register for the excluded list.
3017 \newtoks\index@excludelist
3018 \index@excludelist{}
3022 % \begin{macro}{\ifnot@excluded}
3023 % \changes{v1.7a}{1992/02/26}{Replaced with newdoc version.}
3024 % \begin{macro}{\expanded@notin}
3025 % Now we take a look at the |\index@excludelist| to see
3026 % whether a macro name saved in |\macro@namepart| should
3027 % produce an index entry. This macro is a pseudo |\if|; it
3028 % should expand to |\iftrue| or |\iffalse| depending on
3029 % the contents of |\index@excludelist|.
3033 % First we change "\catcode"s so that "\" is `other' and "|" a
3034 % temporary for the escape character. This is necessary since our
3035 % macro names are stored that way in the "\index@excludelist".
3040 % Then we define "\ifnot@excluded" to call "\expanded@notin" with
3041 % two arguments: the first is the string "\" followed by the
3042 % contents of "\macro@namepart" followed by a "," and the second is
3043 % "\the" followed by "\index@excludelist". To achieve the expansion
3044 % of "\macro@namepart", i.e.\ to pass its contents, we need a
3045 % suitable number of "\expandafter"s.
3046 % \SpecialEscapechar{\|}
3048 |gdef|ifnot@excluded{|expandafter
3049 |expanded@notin|expandafter{|expandafter
3050 \|macro@namepart,}{|the|index@excludelist}}
3053 % The macro "\expanded@notin" now does the dirty work. It first
3054 % defines a macro "\in@@" with a very special parameter text. If
3055 % you look closely "\in@@" has three arguments, the first one is
3056 % delimited by the first argument of "\expanded@notin" (i.e.\ by
3057 % the string starting with a "\" and ending with a "," above), the
3058 % second is undelimited (which means that it will get the next
3059 % token after our string, and the third is delimited again and will
3060 % get the rest up to the token "\in@@". In other words the token
3061 % "\in@@" is also used as a delimiter.
3063 \def\expanded@notin#1#2{%
3064 \def\in@@##1#1##2##3\in@@{%
3066 % Now the replacement text simply compares the second argument
3067 % (i.e.\ the undelimited one after our string) to the token
3068 % "\expanded@notin". This is an unclosed "\ifx" statement which
3069 % means that this macro behaves similar to a normal \TeX{}
3072 \ifx\expanded@notin##2}%
3074 % After all these preparations we call "\in@@". First we expand the
3075 % token after "\in@@" (which is "\the" from the second argument to
3076 % "\expanded@notin"). As a result we get the contents of the
3077 % "\index@excludelist" inserted after "\in@@". After this contents
3078 % we add once more the string we are looking for, then the token
3079 % "\expanded@notin" and finally the token "\in@@".
3081 \expandafter\in@@#2#1\expanded@notin\in@@}
3083 % Now what happens when the macro "\in@@" above gets called? The
3084 % first argument to "\in@@" is delimited by our string. In other
3085 % words it will get everything from the contents of
3086 % "\index@excludelist" before this string. If the string is not in
3087 % "\index@excludelist" then it gets the whole contents, since after
3088 % it we had inserted the string one more. In this case the next
3089 % token is "\expanded@notin" which gets assigned to the second
3090 % argument and the third argument will be empty. If, on the other
3091 % hand, the string was inside "\index@excludelist" then the second
3092 % argument will not be the token "\expanded@notin" and the third
3093 % argument will be all the garbage up to "\in@@". Therefore testing
3094 % the seconded argument, as done in the definition of "\in@@" will
3095 % tell us whether or not the string is in "\index@includelist" and
3096 % this was exactly what we wanted. (Deep breath.) You got
3097 % that?\footnote{\TeX{}book page 125. The code described above is
3098 % originally due to Michael Spivak who used a similar method within
3099 % the \AmSTeX{} macros.}
3109 % \subsection{Macros for generating index entries}
3111 % Here we provide default definitions for the macros invoked to create
3112 % index entries; these are either invoked explicitly, or automatically
3113 % by |\scan@macro|. As already mentioned, the definitions given
3114 % here presuppose that the |.idx| file will be processed by
3115 % Chen's \textsf{makeindex} program --- they may be redefined for use
3116 % with the user's favourite such program.
3118 % To assist the reader in locating items in the index, all such
3119 % entries are sorted alphabetically {\em ignoring\/} the initial
3120 % `|\|'; this is achieved by issuing an |\index| command which
3121 % contains the `actual' operator for \textsf{makeindex}. The default
3122 % value for the latter operator is `|@|', but the latter character is
3123 % so popular in \LaTeX\ package files that it is necessary to substitute
3124 % another character. This is indicated to \textsf{makeindex} by means
3125 % of an `index style file'; the character selected for this function
3126 % is |=|, and therefore this character too must be specially treated
3127 % when it is met in a \TeX\ command. A suitable index style file is
3128 % provided amongst the supporting files for this style file in
3129 % \texttt{gind.ist} and is generated from this source by processing
3130 % with \texttt{docstrip} to extract the module \textbf{gind}. A
3131 % similar style file \texttt{gglo.ist} is supplied for sorting the
3132 % change information in the glossary file and is extracted as module
3133 % \textbf{gglo}. First of all we add some information to the front of
3134 % the \texttt{.ist} files. \changes{v1.7a}{1992/03/11}{glo.ist and
3135 % gind.ist now derivable from doc.dtx with docstrip.}
3138 %<+gind|gglo>%% This is a MAKEINDEX style file which should be used to
3139 %<+gind>%% generate the formatted index for use with the doc
3140 %<+gglo>%% generate the formatted change history for use with the doc
3141 %<+gind|gglo>%% package. The TeX commands used below are defined in
3142 %<+gind|gglo>%% doc.sty. The commands for MAKEINDEX like `level'
3143 %<+gind|gglo>%% `item_x1' are described in `` Makeindex, A General
3144 %<+gind|gglo>%% Purpose, Formatter-Independent Index Processor'' by
3145 %<+gind|gglo>%% Pehong Chen.
3149 % \begin{macro}{\actualchar}
3150 % \begin{macro}{\quotechar}
3151 % \begin{macro}{\levelchar}
3152 % First come the definitions of |\actualchar|,
3153 % |\quotechar| and |\levelchar|. Note, that our defaults
3154 % are not the ones used by the \textsf{makeindex} program without a
3158 \@ifundefined{actualchar}{\def\actualchar{=}}{}
3159 \@ifundefined{quotechar}{\def\quotechar{!}}{}
3160 \@ifundefined{levelchar}{\def\levelchar{>}}{}
3162 %<+gind|gglo>actual '='
3163 %<+gind|gglo>quote '!'
3164 %<+gind|gglo>level '>'
3172 % \begin{macro}{\encapchar}
3173 % The \textsf{makeindex} default for the |\encapchar| isn't
3176 \@ifundefined{encapchar}{\def\encapchar{|}}{}
3181 % \begin{macro}{\verbatimchar}
3182 % We also need a special character to be used as a delimiter for
3183 % the |\verb*| command used in the definitions below.
3185 \@ifundefined{verbatimchar}{\def\verbatimchar{+}}{}
3190 % \begin{macro}{\SpecialIndex}
3191 % The |\SpecialIndex| command creates index entries for
3192 % macros. If the argument is |\|$xyz$, the command produces
3193 % \verb|\indexentry{|$xyz$\verb|=\verb!*+\|$xyz$\verb|+}{|$n$\verb|}|
3194 % given the above defined defaults for |\actualchar|,
3195 % |\quotechar| and |\verbatimchar|. We first remove the
3196 % initial `|\|' to get a better index.
3197 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3199 \def\SpecialIndex#1{\@bsphack\special@index{\expandafter\@gobble
3200 \string#1\actualchar
3202 % Then follows the actual entry. A |\quotechar| is placed
3203 % before the |*| to allow its use as a special \textsf{makeindex}
3204 % character. Again |\@bsphack| and |\@esphack| are used
3205 % to make the macros invisible.
3207 \string\verb\quotechar*\verbatimchar\string#1\verbatimchar}%
3212 % \begin{macro}{\SpecialMainIndex}
3213 % \begin{macro}{\SpecialMainEnvIndex}
3214 % \begin{macro}{\SpecialUsageIndex}
3215 % The |\SpecialMainIndex| macro is used to cross-reference the
3216 % names introduced by the \textsf{macro} environment. The action is
3217 % as for |\SpecialIndex|, except that \textsf{makeindex} is
3218 % instructed to `encap'sulate the entry with the string
3219 % \verb=|main= to cause it to generate a call of the |\main|
3221 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3222 % \changes{v2.0c}{1998/08/22}{Correctly handle single character
3223 % control sequences like \cs{<}.}
3225 % |\SpecialMainIndex| passes the macro name to be indexed on to the
3226 % macro |\SpecialIndex@|.
3228 \def\SpecialMainIndex#1{\@bsphack\SpecialIndex@{#1}{\encapchar main}%
3232 % \begin{macro}{\SpecialIndex@}
3233 % \changes{v2.0c}{1998/08/22}{Macro added.}
3234 % \changes{v2.0f}{1999/02/27}{Temp fix to allow strange code in arg 1
3236 % The macro |\SpecialIndex@| does the real work for |\SpecialMainIndex|
3237 % and |\SpecialUsageIndex|. It takes two arguments: the macro to be
3238 % indexed (as a control sequence or list of character tokens) and the
3239 % additional text for the index.
3240 % \changes{v2.0g}{1999/03/22}{Correct so-called temp fix. I'm not going to
3246 |gdef|@SpecialIndexHelper@#1#2|@nil{%
3252 |expandafter|gdef|expandafter|@gtempa|expandafter{|string#1#2}%
3256 \def\SpecialIndex@#1#2{%
3258 % The first thing it does is to convert the macro into a list of
3259 % characters. Note that a character token list remains (mostly) unchanged.
3261 \@SpecialIndexHelper@#1\@nil
3263 % The macro name \verb*|\ | has to handled in a special way. The reason
3264 % is that the space token is skipped when \TeX\ is scanning macro
3265 % parameters, so that the trick used below will not work.
3266 % So, we check whether the replacement text of |\@tempa| starts with
3267 % a space token and write the appropriate index entry.
3270 \ifcat \@tempb\@gtempa
3271 \special@index{\quotechar\space\actualchar
3272 \string\verb\quotechar*\verbatimchar
3273 \quotechar\bslash\quotechar\space\verbatimchar#2}%
3276 % Having handled this special case we have to distinguish control
3277 % sequences consisting of one or more
3278 % letters and those that consists of exactly one nonletter. As character
3279 % tokens in the replacement text of the macro |\@gtempa| have all
3280 % category code $12$ (other), this is difficult. For simplicity, we treat
3281 % all single character control sequences alike, irregardless of whether
3282 % the character is a letter or not. This has the advantage that it works
3283 % even for strange settings of the category codes.
3285 % We define a utility macro |\@tempb| with two arguments, the second
3286 % delimited by |\relax|.
3287 % It will be called later so that the first argument is the first character
3288 % of the macro name, and the second argument receives the rest of the
3289 % characters. So we distinguish the two cases above by checking whether
3290 % the second argument is empty.
3292 \def\@tempb##1##2\relax{\ifx\relax##2\relax
3294 % If so, we define the helper macro |\@tempc| in a way that it
3295 % adds quotechars in critical places.
3297 \def\@tempc{\special@index{\quotechar##1\actualchar
3298 \string\verb\quotechar*\verbatimchar
3299 \quotechar\bslash\quotechar##1\verbatimchar#2}}%
3301 % Otherwise we write the characters as in |\SpecialIndex|.
3304 \def\@tempc{\special@index{##1##2\actualchar
3305 \string\verb\quotechar*\verbatimchar
3306 \bslash##1##2\verbatimchar#2}}%
3309 % Now pass the list of characters to \@tempb and call \@tempc to do the
3312 \expandafter\@tempb\@gtempa\relax
3318 % Slightly simpler is the main entry for environments
3319 % \changes{v1.9e}{1994/02/03}{use \cs{ttfamily} with \cs{string}}
3320 % \changes{v1.9f}{1994/02/07}{should have used \cs{noexpand}, sigh}
3321 % \changes{v1.9i}{1994/02/11}{should have used \cs{protect}}
3322 % \changes{v1.9j}{1994/02/16}{Back to string:-)}
3323 % \changes{v1.9s}{1994/10/14}{Added missing percent and changed to
3325 % \changes{v2.0d}{1998/12/20}{Correctly handle second index entry
3326 % by using \cs{special@index} not \cs{index} (PR/2928).}
3327 % \changes{v2.0e}{1998/12/28}{Use \cs{string}, not \cs{protect} in argument to
3328 % \cs{special@index}.}
3329 % \changes{v2.1c}{2004/07/23}{environment names incorrectly sorted in
3332 \def\SpecialMainEnvIndex#1{\@bsphack\special@index{%
3334 {\string\ttfamily\space#1}
3337 \special@index{environments:\levelchar#1\actualchar{%
3338 \string\ttfamily\space#1}\encapchar
3341 % The |\SpecialUsageIndex| is similar to |\SpecialMainIndex|, except
3342 % that it uses the standard |\index| command.
3343 % \texttt{usage} instead of \texttt{main}.
3345 \def\SpecialUsageIndex#1{\@bsphack
3346 {\let\special@index\index\SpecialIndex@{#1}{\encapchar usage}}%
3356 % \begin{macro}{\SpecialEnvIndex}
3357 % Indexing environments is done a little bit differently; we produce
3358 % two index entries with the |\SpecialEnvIndex| macro:
3359 % \changes{v1.9e}{1994/02/03}{The index needs protecting}
3360 % \changes{v1.9g}{1994/02/08}{should have used \cs{noexpand}, sigh}
3361 % \changes{v1.9i}{1994/02/11}{should have used \cs{protect}}
3363 \def\SpecialEnvIndex#1{\@bsphack
3365 % First we sort the environment under its own name stating in the
3366 % actual entry that this is an environment.
3368 \index{#1\actualchar{\protect\ttfamily#1}
3369 (environment)\encapchar usage}%
3371 % The second entry is sorted as a subitem under the key
3373 % \changes{v2.1b}{2004/02/09}{environment names incorrectly sorted in
3376 \index{environments:\levelchar#1\actualchar
3377 {\protect\ttfamily#1}\encapchar usage}\@esphack}
3379 % Because both entries correspond to `descriptions' of the
3380 % environment, we encapsulate the page numbers with the
3386 % \begin{macro}{\SortIndex}
3387 % This macro is used to generate the index entries for any
3388 % single-character command that |\scan@macro| encounters. The
3389 % first parameter specifies the lexical order for the character,
3390 % whilst the second gives the actual characters to be printed in
3391 % the entry. It can also be used directly to generate index entries
3392 % which differ in sort key and actual entry.
3394 \def\SortIndex#1#2{\index{#1\actualchar#2}}
3400 % \begin{macro}{\it@is@a}
3401 % This macro is supposed to produce a correct |\SortIndex|
3402 % entry for a given character. Since this character might be
3403 % recognised as a `command' character by the index program used,
3404 % all characters are quoted with the |\quotechar|.
3405 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3407 \def\it@is@a#1{\special@index{\quotechar #1\actualchar
3408 \string\verb\quotechar*\verbatimchar
3409 \quotechar\bslash\quotechar#1\verbatimchar}}
3415 % \begin{macro}{\LeftBraceIndex}
3416 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3417 % \begin{macro}{\RightBraceIndex}
3418 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)} These
3419 % two macros fix the problems with \textsf{makeindex}. Note the
3420 % `hack' with |\iffalse}\fi| to satisfy both \TeX{} and the
3421 % \textsf{makeindex} program. When this is written to the
3422 % \texttt{.idx} file \TeX{} will see both braces (so we get a
3423 % balanced text). \textsf{makeindex} will also see balanced braces
3424 % but when the actual index entry is again processed by \TeX{} the
3425 % brace in between |\iffalse| |\fi| will vanish.
3427 \@ifundefined{LeftBraceIndex}{\def\LeftBraceIndex{%
3428 \special@index{\bgroup\actualchar\string\verb\quotechar*\verbatimchar
3429 \quotechar\bslash{\verbatimchar\string\iffalse}\string\fi}}}{}
3431 \@ifundefined{RightBraceIndex}{\def\RightBraceIndex{%
3432 \special@index{\egroup\actualchar\string\iffalse{\string\fi\string\verb
3433 \quotechar*\verbatimchar\quotechar\bslash}\verbatimchar}}}{}
3439 % \begin{macro}{\PercentIndex}
3440 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3441 % \changes{v1.7c}{1992/03/25}{Default now for bug-fixed makeindex}
3442 % By default we assume a version of \textsf{makeindex} without the
3443 % percent bug is being used.
3445 \@ifundefined{PercentIndex}
3446 {\def\PercentIndex{\it@is@a\percentchar}}{}
3449 % \begin{macro}{\OldMakeindex}
3450 % \changes{v1.7c}{1992/03/26}{Replaced \cs{NewMakeIndex}.}
3451 % \begin{macro}{\percentchar}
3452 % Here is one solution for the percent bug in \textsf{makeindex}.
3453 % The macro |\percentchar| denotes a |%|$_{12}$. Calling this from
3454 % a package or the driver file sets things up
3455 % appropriately.\label{bug:fixes}
3457 \def\OldMakeindex{\def\PercentIndex{%
3458 \special@index{\quotechar\percentchar\actualchar\string\verb
3459 \quotechar*\verbatimchar\quotechar\bslash
3460 \percentchar\percentchar\verbatimchar}}}
3461 {\catcode`\%=12 \gdef\percentchar{%}}
3471 % \subsection{Redefining the \textsf{index} environment}
3473 %\changes{v1.4r}{1989/04/22}{twocols env. placed into separate file}
3474 %\changes{v1.4?}{1989/04/19}{use DEK's algorithm and implement
3476 %\changes{v1.4?}{1989/04/16}{changes to the index env.}
3477 %\changes{v1.5a}{1989/04/26}{Now input multicol.sty instead of
3479 % \begin{macro}{\ifhave@multicol}
3480 % \changes{v1.7a}{1992/03/04}{Added to support avoiding multicol.sty} By
3481 % default the index is set in three columns, and will start on the
3482 % same page as, and underneath, the last part of the text of the
3483 % documented package file, if possible. The last page will be
3484 % reformatted with balanced columns. This requires the
3485 % \textsf{multicols} environment which is described elsewhere. So
3486 % that \DOC{} can be run independently of
3487 % \texttt{multicol.sty} we first check for its existence and set
3488 % the "have@multicol" flag appropriately for use below.
3489 % \changes{v1.9a}{1993/12/02}{Use \cs{IfFileExists}}
3490 % \changes{v1.9m}{1994/04/28}{Use \cs{RequirePackage} to load multicol}
3492 \newif\ifhave@multicol
3494 % If we found \texttt{multicol.sty} we use it. It would be nice to
3495 % delay this (and the re-definition of "theindex") until we knew
3496 % whether an index was actually required \ldots
3498 \IfFileExists{multicol.sty}{\have@multicoltrue
3499 \RequirePackage{multicol}%
3505 % \begin{macro}{\IndexMin}
3506 % \begin{macro}{\c@IndexColumns}
3507 % \changes{v1.4t}{1989/04/24}{Counter added.}
3508 % If \texttt{multicol} is in use,
3509 % when the index is started we compute the remaining space on the
3510 % current page; if it is greater than |\IndexMin|, the first
3511 % part of the index will then be placed in the available space.
3512 % The number of columns set is controlled by the counter
3513 % |\c@IndexColumns| which can be changed with a
3514 % |\setcounter| declaration.
3516 \newdimen\IndexMin \IndexMin = 80pt
3517 \newcount\c@IndexColumns \c@IndexColumns = 3
3523 % \begin{macro}{\theindex}
3524 % Now we start the multi-column mechanism, if appropriate. We use the
3525 % \LaTeX{} counter |\c@IndexColumns| declared above to denote
3526 % the number of columns and insert the `index prologue' text (which
3527 % might contain a |\section| call, etc.). See the default
3528 % definition for an example.
3529 % \changes{v1.4t}{1989/04/24}{Incorporated new multicols env.}
3530 % \changes{v1.5a}{1989/04/26}{Call multicols first}
3531 % \changes{v1.6e}{1991/04/03}{Turned into env definition.}
3532 % \changes{v1.7a}{1992/03/04}{Include test for multicols.}
3535 \renewenvironment{theindex}
3536 {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]%
3538 % Then we make a few last minute assignments to read the individual
3539 % index |\item|$\,$s and finish off by ignoring any initial
3542 \IndexParms \let\item\@idxitem \ignorespaces}%
3545 % \begin{macro}{\endtheindex}
3546 % \changes{v1.4t}{1989/04/24}{Incorporated new multicols env.}
3547 % At the end of the index, we have only to end the \textsf{multicols}
3552 % If we can't use \textsf{multicols} we warn the user and use an
3553 % environment that's basically the one from \texttt{article.sty}.
3556 \typeout{Can't find multicol.sty -- will use normal index layout if
3558 \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
3559 \columnseprule \z@ \columnsep 35\p@
3560 \twocolumn[\index@prologue]%
3561 \IndexParms \let\item\@idxitem \ignorespaces}
3562 \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
3566 % Here are the necessary \textsf{makeindex} declarations. We disable
3567 % scanning of macro names inside the index with "\scan@allowedfalse\n"
3568 % to avoid recursion.
3572 %<+gind>"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
3574 %<+gind>"\n\n \\end{theindex}\n"
3579 % \begin{macro}{\IndexPrologue}
3580 % \begin{macro}{\index@prologue}
3581 % \changes{v1.9w}{1995/12/27}{Text changed}
3582 % \changes{v1.9x}{1996/01/11}{Text depends on code lines used}
3583 % The |\IndexPrologue| macro is used to place a short message
3584 % into the document above the index. It is implemented by
3585 % redefining |\index@prologue|, a macro which holds the
3586 % default text. We'd better make it a |\long| macro to allow
3587 % |\par| commands in its argument.
3589 \long\def\IndexPrologue#1{\@bsphack\def\index@prologue{#1}\@esphack}
3591 % Now we test whether the default is already defined by another
3592 % package file. If not we define it.
3593 % \changes{v2.0j}{2000/05/22}{Less obscure wording? (CAR pr/3202)}
3595 \@ifundefined{index@prologue}
3596 {\def\index@prologue{\section*{Index}%
3597 \markboth{Index}{Index}%
3598 Numbers written in italic refer to the page
3599 where the corresponding entry is described;
3600 numbers underlined refer to the
3604 definition; numbers in roman refer to the
3610 where the entry is used.
3618 % \begin{macro}{\IndexParms}
3619 % These are some last-minute assignments for formatting the index
3620 % entries. They are defined in a separate macro so that a user can
3621 % substitute different definitions. We start by defining the
3622 % various parameters controlling leading and the separation between
3623 % the two columns. The entire index is set in |\small| size.
3625 \@ifundefined{IndexParms}
3629 \parskip 0pt plus 1pt
3635 % \begin{macro}{\@idxitem}
3636 % \begin{macro}{\subitem}
3637 % \begin{macro}{\subsubitem}
3638 % Index items are formatted with hanging indentation for any items
3639 % which may require more than one line.
3641 \def\@idxitem{\par\hangindent 30pt}%
3643 % Any sub-item in the index is formatted with a 15pt indentation
3644 % under its main heading.
3646 \def\subitem{\@idxitem\hspace*{15pt}}%
3648 % Whilst sub-sub-items go in a further 10pt.
3650 \def\subsubitem{\@idxitem\hspace*{25pt}}%
3652 % \begin{macro}{\indexspace}
3653 % The \textsf{makeindex} program generates an |\indexspace|
3654 % before each new alphabetic section commences. After this final
3655 % definition we end the |\@ifundefined| and the definition of
3658 \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}%
3668 % \begin{macro}{\efill}
3669 % This definition of |\efill| is intended to be used after index
3670 % items which have no following text (for example, ``\textit{
3671 % see\/}'' entries). It just ensures that the current line is
3672 % filled, preventing ``|Underfull \hbox|'' messages.
3674 \def\efill{\hfill\nopagebreak}%
3676 %<+gind|gglo>item_x1 "\\efill \n \\subitem "
3677 %<+gglo>item_x2 "\\ "
3678 %<+gind>item_x2 "\\efill \n \\subsubitem "
3685 % \begin{macro}{\pfill}
3686 % \begin{macro}{\dotfil}
3687 % \begin{macro}{\dotfill}
3688 % The following definitions provide the |\pfill| command; if
3689 % this is specified in the index style file to \textsf{makeindex} as
3690 % the delimiter to appear after index items, then the intervening
3691 % space before the referenced page numbers will be filled with
3692 % dots, with a little white space interpolated at each end of the
3693 % dots. If the line is broken the dots will show up on both lines.
3695 \def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill}%
3696 \def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hfil}%
3697 \def\pfill{\unskip~\dotfill\penalty500\strut\nobreak
3698 \dotfil~\ignorespaces}%
3700 %<+gind|gglo>delim_0 "\\pfill "
3701 %<+gind|gglo>delim_1 "\\pfill "
3702 %<+gind|gglo>delim_2 "\\pfill "
3712 % Here is the definition for the |\*| macro. It isn't used in
3713 % this set of macros.
3715 \def\*{\leavevmode\lower.8ex\hbox{$\,\widetilde{\ }\,$}}
3720 % \begin{macro}{\main}
3721 % The \textit{defining\/} entry for a macro name is flagged with
3722 % the string \texttt{\encapchar main}\footnote{With the current
3723 % definition of \texttt{\bslash encapchar} substituted for
3724 % \texttt{\encapchar}} in the |\index| command; \textsf{makeindex}
3725 % processes this so that the |\main| macro will be invoked to
3726 % underline the page number(s) on which the {\em definition\/} of
3727 % the macro will be found.
3729 \@ifundefined{main}{\def\main#1{\underline{#1}}}{}
3733 % \begin{macro}{\usage}
3734 % The |\usage| macro is used to indicate entries describing
3735 % the usage of a macro. The corresponding page number(s) will be
3736 % set in \textit{italics}.
3738 \@ifundefined{usage}{\def\usage#1{\textit{#1}}}{}
3743 % \begin{macro}{\PrintIndex}
3744 % \changes{v1.5k}{1989/09/04}{\cs{printindex} changed to
3746 % \changes{v1.7a}{1992/02/26}{Documentation moved to interface section.}
3747 % \changes{v1.9h}{1994/02/10}{Use \cs{@input@} instead of \cs{@input}.}
3748 % \changes{v1.9w}{1995/12/29}{Turn the cmd into a noop after use.}
3749 % This is the same as "\printindex" in the \textsf{makeidx} package.
3751 \def\PrintIndex{\@input@{\jobname.ind}%
3752 \global\let\PrintIndex\@empty}
3756 % \begin{macro}{\printindex}
3757 % Since the above macro was called |\printindex| in older versions
3758 % of \texttt{doc.sty} the following definition was provided up to
3760 % \changes{v1.9z}{1996/04/17}{Commented out}
3762 %\def\printindex{\typeout{\string\printindex\space is obsolete!}%
3763 % \typeout{Please use \string\PrintIndex\space
3764 % if you are a macro implementor^^J
3765 % or get a newer version of the documented
3766 % software if you are a user}%
3771 % We want headings in the index (and changes list) according to the
3772 % initial character of the next block of entries and have to instruct
3773 % \textsf{makeindex} appropriately. Unfortunately the specification
3774 % for this changed sometime between versions 2.4 and 2.11 of
3775 % \textsf{makeindex}. We provide both ways of doing it but
3776 % unfortunately this will always produce a warning message from
3777 % \textsf{makeindex}. This is for older versions:
3778 % \changes{v1.7h}{1992/07/01}{Turn off headings in gls file}
3781 %<+gind,gglo>% The next lines will produce some warnings when
3782 %<+gind,gglo>% running Makeindex as they try to cover two different
3783 %<+gind,gglo>% versions of the program:
3784 %<+gind,gglo>lethead_prefix "{\\bfseries\\hfil "
3785 %<+gind,gglo>lethead_suffix "\\hfil}\\nopagebreak\n"
3786 %<+gind>lethead_flag 1
3787 %<+gglo>lethead_flag 0
3789 % This works for newer ones:
3791 %<+gind,gglo>heading_prefix "{\\bfseries\\hfil "
3792 %<+gind,gglo>heading_suffix "\\hfil}\\nopagebreak\n"
3793 %<+gind>headings_flag 1
3794 %<+gglo>headings_flag 0
3800 % \subsection[Dealing with the change history]
3801 % {Dealing with the change history\footnotemark}
3802 % \footnotetext{The whole section was proposed by Brian \textsc{Hamilton
3803 % Kelly}. He also documented and debugged the macros as
3804 % well as many other parts of this package.}
3806 % To provide a change history log, the |\changes| command has
3807 % been introduced. This takes three arguments, respectively, the
3808 % version number of the file, the date of the change, and some detail
3809 % regarding what change has been made. The second of these arguments
3810 % is otherwise ignored, but the others are written out and may be used
3811 % to generate a history of changes, to be printed at the end of the
3812 % document. However, note that older versions of Chen's standard
3813 % \textsf{makeindex}
3814 % program limit any textual field to just 64 characters; therefore,
3815 % is important that the number of characters in the second and third
3816 % parameters should not exceed 61 altogether (to allow for the
3817 % parentheses placed around the date).
3819 % \begin{macro}{\changes}
3820 % \changes{BHK}{1989/04/26}{Documented \texttt{\protect\bslash changes}
3822 % \changes{BHK}{1989/04/26}{Changed definition of
3823 % \texttt{\protect\bslash protect}.} The output of the |\changes|
3824 % command goes into the \meta{Glossary\_File} and therefore uses
3825 % the normal |\glossaryentry| commands.\footnote{Note that a recent
3826 % change in \LaTeX{} 2.09 changed the command name in the
3827 % \texttt{.glo} file from \texttt{\bslash indexentry} to
3828 % \texttt{\bslash glossaryentry}. It is therefore necessary to
3829 % have a special \textsf{makeindex} style file called
3830 % \texttt{gglo.ist} to process this file correctly.} Thus
3831 % \textsf{makeindex} or a similar program can be used to process
3832 % the output into a sorted ``glossary''. The |\changes| command
3833 % commences by taking the usual measures to hide its spacing, and
3834 % then redefines |\protect| for use within the argument of the
3835 % generated |\indexentry| command.
3837 % We re-code nearly all chars found in |\sanitize| to letter
3838 % since the use of special package which make some characters
3839 % active might upset the |\changes| command when writing its
3840 % entries to the file. However we have to leave |%| as comment
3841 % and \verb*+ + as \meta{space} otherwise chaos will happen.
3842 % And, of course the |\| should be available as escape
3844 % \changes{v1.5v}{1990/01/28}{`Re-code a lot of chars.}
3845 % \changes{v1.5m}{1989/09/20}{\cs{actualchar} in second level removed.}
3846 % \changes{v1.5o}{1989/09/24}{New sorting.}
3847 % \changes{v1.6c}{1990/06/29}{Again new sorting.}
3848 % \changes{v1.9u}{1995/08/06}{Use \cs{protected@edef}}
3850 \def\changes{\@bsphack\begingroup\@sanitize
3851 \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore
3853 \def\changes@#1#2#3{%
3854 \protected@edef\@tempa{\noexpand\glossary{#1\levelchar
3856 % \changes{v1.9u}{1995/08/06}{Use value of \cs{saved@macroname} to
3857 % find out about change entries at outer level}
3858 % If the macro "\saved@macroname" doesn't contain any macro name
3859 % (ie is empty) the current changes entry was done at top-level.
3860 % In this case we precede it by "\generalname".
3862 \ifx\saved@macroname\@empty
3867 \expandafter\@gobble
3870 \string\verb\quotechar*%
3871 \verbatimchar\saved@macroname
3875 \@tempa\endgroup\@esphack}
3878 % \begin{macro}{\saved@macroname}
3879 % \changes{BHK}{1989/04/26}{Provided for sorting outside \textsf{macro}
3880 % environment} The entries are sorted for convenience by the name
3881 % of the most recently introduced macroname (i.e., that in the most
3882 % recent |\begin{macro}| command). We therefore provide
3883 % |\saved@macroname| to record that argument, and provide a default
3884 % definition in case |\changes| is used outside a \textsf{macro}
3885 % environment. (This is a {\em wicked\/} hack to get such entries
3886 % at the beginning of the sorted list! It works providing no macro
3887 % names start with "!" or |"|.) \changes{v1.7a}{1992/03/02}{Changed
3888 % string used for better sorting.}
3889 % \changes{v1.9u}{1995/08/06}{Now empty by default}
3891 \def\saved@macroname{}
3896 % \begin{macro}{\generalname}
3897 % \changes{v1.9u}{1995/08/06}{Macro added}
3898 % This macro holds the string placed before changes entries on
3901 \def\generalname{General}
3906 % \begin{macro}{\RecordChanges}
3907 % \changes{BHK}{1989/04/26}{Renames former \texttt{\protect\bslash
3908 % PrintChanges} command.}
3909 % To cause the changes to be written (to a \texttt{.glo}) file, we
3910 % define |\RecordChanges| to invoke \LaTeX's usual
3911 % |\makeglossary| command.
3913 \let\RecordChanges\makeglossary
3919 % \begin{macro}{\GlossaryMin}
3920 % \changes{BHK}{1989/04/26}{Added to support
3921 % \texttt{\protect\bslash changes}.}
3922 % \begin{macro}{\c@GlossaryColumns}
3923 % \changes{BHK}{1989/04/26}{Added to support \texttt{\protect\bslash
3924 % changes}.} The remaining macros are all analogues of those used
3925 % for the \textsf{theindex} environment. When the glossary is
3926 % started we compute the space which remains at the bottom of the
3927 % current page; if this is greater than |\GlossaryMin| then the
3928 % first part of the glossary will be placed in the available space.
3929 % The number of columns set are controlled by the counter
3930 % |\c@GlossaryColumns| which can be changed with a |\setcounter|
3933 \newdimen\GlossaryMin \GlossaryMin = 80pt
3934 \newcount\c@GlossaryColumns \c@GlossaryColumns = 2
3940 % \begin{macro}{\theglossary}
3941 % \changes{BHK}{1989/04/26}{Added to support
3942 % \texttt{\protect\bslash changes}.}
3943 % \changes{v1.5p}{1989/09/28}{Now call \cs{multicols} first.}
3944 % \changes{v1.6e}{1991/04/03}{Turned into env definition.}
3945 % \changes{v1.7a}{1992/03/10}{Changed to work without multicols if
3947 % \begin{macro}{\endglossary}
3948 % \changes{BHK}{1989/04/26}{Added to support
3949 % \texttt{\protect\bslash changes}.}
3950 % The environment \textsf{theglossary} is defined in the same manner
3951 % as the \textsf{theindex} environment.
3954 \newenvironment{theglossary}{%
3955 \begin{multicols}\c@GlossaryColumns
3956 [\glossary@prologue][\GlossaryMin]%
3957 \GlossaryParms \let\item\@idxitem \ignorespaces}%
3960 \newenvironment{theglossary}{%
3961 \@restonecoltrue\if@twocolumn\@restonecolfalse\fi
3962 \columnseprule \z@ \columnsep 35\p@
3963 \twocolumn[\glossary@prologue]%
3964 \GlossaryParms \let\item\@idxitem \ignorespaces}
3965 {\if@restonecol\onecolumn\else\clearpage\fi}
3970 % Here are the necessary \textsf{makeindex} declarations with scanning
3971 % disabled as for the index.
3975 %<+gglo>"\n \\begin{theglossary} \n
3976 %<+gglo> \\makeatletter\\scan@allowedfalse\n"
3978 %<+gglo>"\n\n \\end{theglossary}\n"
3980 % This difference from \texttt{gind.ist} is necessary if you have an
3981 % up-to-date \LaTeX.
3983 %<+gglo>keyword "\\glossaryentry"
3988 % \begin{macro}{\GlossaryPrologue}
3989 % \changes{BHK}{1989/04/26}{Added to support
3990 % \texttt{\protect\bslash changes}.}
3991 % \begin{macro}{\glossary@prologue}
3992 % \changes{BHK}{1989/04/26}{Added to support
3993 % \texttt{\protect\bslash changes}.}
3994 % The |\GlossaryPrologue| macro is used to place a short
3995 % message above the glossary into the document. It is implemented
3996 % by redefining |\glossary@prologue|, a macro which holds the
3997 % default text. We better make it a long macro to allow
3998 % |\par| commands in its argument.
4000 \long\def\GlossaryPrologue#1{\@bsphack
4001 \def\glossary@prologue{#1}%
4004 % Now we test whether the default is already defined by another
4005 % package file. If not we define it.
4007 \@ifundefined{glossary@prologue}
4008 {\def\glossary@prologue{\section*{{Change History}}%
4009 \markboth{{Change History}}{{Change History}}%
4015 % \begin{macro}{\GlossaryParms}
4016 % \changes{BHK}{1989/04/26}{Added to support
4017 % \texttt{\protect\bslash changes}.}
4018 % Unless the user specifies otherwise, we set the change history
4019 % using the same parameters as for the index.
4021 \@ifundefined{GlossaryParms}{\let\GlossaryParms\IndexParms}{}
4024 % \begin{macro}{\PrintChanges}
4025 % \changes{BHK}{1989/04/26}{Added to support
4026 % \texttt{\protect\bslash changes}.}
4027 % To read in and print the sorted change history, just put the
4028 % |\PrintChanges| command as the last (commented-out, and thus
4029 % executed during the documentation pass through the file) command
4030 % in your package file. Alternatively, this command may form one of
4031 % the arguments of the |\StopEventually| command, although a
4032 % change history is probably {\em not\/} required if only the
4033 % description is being printed.
4035 % The command assumes that \textsf{makeindex} or some other program
4036 % has processed the \texttt{.glo} file to generate a sorted
4037 % \texttt{.gls} file.
4038 % \changes{v1.9h}{1994/02/10}{Use \cs{@input@} instead of \cs{@input}.}
4039 % \changes{v1.9w}{1995/12/29}{Turn the cmd into a noop after use.}
4041 \def\PrintChanges{\@input@{\jobname.gls}%
4042 \global\let\PrintChanges\@empty}
4050 % \subsection{Bells and whistles}
4052 % \begin{macro}{\StopEventually}
4053 % \changes{v1.5k}{1989/09/04}{Support for checksum.}
4054 % \begin{macro}{\Finale}
4055 % \changes{v1.5k}{1989/09/04}{Support for checksum.}
4056 % \changes{v1.5z}{1990/04/22}{Define \cs{Finale} globally.}
4057 % \begin{macro}{\AlsoImplementation}
4058 % \changes{v1.9w}{1995/12/27}{Macro added}
4059 % \begin{macro}{\OnlyDescription}
4060 % If |\AlsoImplementation| is in force the whole documentation
4061 % including the code part will be typeset. This is the default.
4063 \newcommand\AlsoImplementation{%
4065 % To make this happen we have to define
4066 % |\StopEventually| in a way that its argument is typeset at the
4067 % very end or more exactly at |\Finale|. For this we
4068 % save its argument in the macro |\Finale|.
4070 \long\def\StopEventually##1{\@bsphack\gdef\Finale{##1%
4072 % But |\Finale| will be called at the very end of a file. This
4073 % is exactly the point were we want to know if the file is
4074 % uncorrupted. Therefore we also call |\check@checksum| at this
4079 % On the other hand: |\StopEventually| is more or less a
4080 % dividing point between description and code. So we start to look
4081 % for the check-sum of the documented file by calling
4089 % Since |\AlsoImplementation| should be the default we execute it
4090 % and thus |\StopEventually| gets the desired meaning.
4094 % When the user places an |\OnlyDescription| declaration in
4095 % the driver file the document should only be typeset up to
4096 % |\StopEventually|. We therefore have to redefine this macro.
4098 \def\OnlyDescription{\@bsphack\long\def\StopEventually##1{%
4100 % In this case the argument of |\StopEventually| should be set
4101 % and afterwards \TeX{} should stop reading from this file.
4102 % Therefore we finish this macro with
4104 ##1\endinput}\@esphack}
4106 % If no |\StopEventually| command is given we silently ignore a
4108 % \changes{v1.9n}{1994/04/28}{Ignore \cs{Finale} if no
4109 % \cs{StopEventually} is given}
4118 % \begin{macro}{\meta}
4119 % \changes{v1.4t}{1989/04/24}{Macro added.}
4120 % \changes{v1.5w}{1990/02/03}{Breaks at space allowed.}
4121 % \changes{v1.6a}{1990/05/24}{Extra space bug corrected.}
4122 % The |\meta| macro is a bit tricky. We want to allow line
4123 % breaks at blanks in the argument but we don't want a break
4124 % in between. In the past this was done by defining |\meta| in a way that a
4125 % \verb*+ + is active when the argument is scanned. Words are then
4126 % scanned into |\hbox|es. The active \verb*+ + will end the
4127 % preceding |\hbox| add an ordinary space and open a new
4128 % |\hbox|. In this way breaks are only possible at spaces. The
4129 % disadvantage of this method was that |\meta| was neither robust
4130 % nor could it be |\protect|ed. The new implementation fixes this
4131 % problem by defining |\meta| in a radically different way: we
4132 % prevent hyphenation by defining a |\language| which has no
4133 % patterns associated with it and use this to typeset the words
4134 % within the angle brackets.
4135 % \changes{v2.0i}{2000/05/21}{New implementation (pr/3170)}
4137 \ifx\l@nohyphenation\undefined
4138 \newlanguage\l@nohyphenation
4143 \DeclareRobustCommand\meta[1]{%
4145 % Since the old implementation of |\meta| could be used in math we
4146 % better ensure that this is possible with the new one as
4147 % well. So we use |\ensuremath| around |\langle| and
4148 % |\rangle|. However this is not enough: if |\meta@font@select|
4149 % below expands to |\itshape| it will fail if used in math
4150 % mode. For this reason we hide the whole thing inside an
4151 % |\nfss@text| box in that case.
4152 % \changes{v2.0l}{2000/06/10}{Fixing changes for (pr/3170)}
4155 \ifmmode \expandafter \nfss@text \fi
4159 % Need to keep track of what we changed just in case the user
4160 % changes font inside the argument so we store the font explicitly.
4161 % \changes{v2.0m}{2000/07/04}{More fixing changes for (pr/3170)}
4163 \edef\meta@hyphen@restore
4164 {\hyphenchar\the\font\the\hyphenchar\font}%
4165 \hyphenchar\font\m@ne
4166 \language\l@nohyphenation
4168 \meta@hyphen@restore
4175 % \begin{macro}{\meta@font@select}
4176 % \changes{v2.0k}{2000/05/26}{Macro added (pr/3170)}
4177 % Maske font used inside |\meta| customizable.
4179 \def\meta@font@select{\itshape}
4184 % \begin{macro}{\IndexInput}
4185 % This next macro may be used to read in a separate file (possibly
4186 % a package file that is {\em not\/} documented by this means) and
4187 % set it verbatim, whilst scanning for macro names and indexing the
4188 % latter. This could be a useful first pass in preparing to
4189 % generate documentation for the file read.
4193 % We commence by setting up a group, and initializing a
4194 % |\trivlist| as is normally done by a
4195 % |\begin{macrocode}| command.
4197 \begingroup \macro@code
4199 % We also make spacing behave as in the \textsf{macrocode}
4200 % environment, because otherwise all the spaces will be shown
4203 \frenchspacing \@vobeyspaces
4205 % Then it only remains to read in the specified file, and finish
4206 % off the |\trivlist|.
4207 % \changes{v1.5t}{1989/11/07}{Call \cs{endmacrocode} instead
4208 % of \cs{endtrivlist}.}
4210 \input{#1}\endmacrocode
4212 % Of course, we need to finish off the group as well.
4219 % \begin{macro}{\maketitle}
4220 % The macro to generate titles is easily altered in order that it
4221 % can be used more than once (an article with many titles). In the
4222 % original, diverse macros were concealed after use with
4223 % |\relax|. We must cancel anything that may have been put
4224 % into |\@thanks|, etc., otherwise {\em all\/} titles will
4225 % carry forward any earlier such setting!
4226 % \changes{v1.5j}{1989/06/09}{thispagestyle plain removed}
4227 % \changes{v1.9r}{1994/06/09}{Added new definitions of
4228 % \cs{@makefnmark} and \cs{@makefntext}}
4231 \begingroup \def \thefootnote {\fnsymbol {footnote}}%
4232 \setcounter {footnote}\z@
4233 \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
4234 \long\def\@makefntext##1{\parindent 1em\noindent
4235 \hbox to1.8em{\hss$\m@th^{\@thefnmark}$}##1}%
4236 \if@twocolumn \twocolumn [\@maketitle ]%
4237 \else \newpage \global \@topnum \z@ \@maketitle \fi
4239 % \changes{v1.5k}{1989/09/04}{Added \cs{ps@titlepage}}
4240 % For special formatting requirements (such as in TUGboat), we use
4241 % pagestyle |titlepage| for this; this is later defined to be
4242 % |plain|, unless already defined, as, for example, by
4245 \thispagestyle{titlepage}\@thanks \endgroup
4247 % If the driver file documents many files, we don't want parts of a
4248 % title of one to propagate to the next, so we have to cancel
4251 \setcounter {footnote}\z@
4252 \gdef\@date{\today}\gdef\@thanks{}%
4253 \gdef\@author{}\gdef\@title{}}
4258 % \begin{macro}{\ps@titlepage}
4259 % \changes{v1.5k}{1989/09/04}{Added \texttt{\protect\bslash
4260 % ps@titlepage}} When a number of articles are concatenated into a
4261 % journal, for example, it is not usual for the title pages of such
4262 % documents to be formatted differently. Therefore, a class
4263 % such as \textsf{ltugboat} can define this macro in advance.
4264 % However, if no such definition exists, we use pagestyle
4265 % \texttt{plain} for title pages.
4267 \@ifundefined{ps@titlepage}
4268 {\let\ps@titlepage=\ps@plain}{}
4272 % \begin{macro}{\MakeShortVerb}
4273 % \changes{v1.7a}{1992/02/27}{Added (from newdoc but now alters
4274 % \cs{dospecials}, \cs{@sanitize}).}
4275 % This arranges an abbreviation for "\verb" such that if you say
4276 % "\MakeShortVerb{\"\meta{c}"}" subsequently using
4277 % \meta{c}\meta{text}\meta{c} is equivalent to
4278 % "\verb"\meta{c}\meta{text}\meta{c}.\footnote{Warning:
4279 % the commentary in the rest of this section was written by Dave
4280 % Love.} In addition, the fact
4281 % that \meta{c} is made active is recorded for the benefit of the
4282 % \textsf{verbatim} and \textsf{macrocode} environments.
4283 % Note particularly that the definitions below are global.
4284 % The first thing we do (it needn't be first) is to record
4285 % the---presumably new---special character in "\dospecials" and
4286 % "\@sanitize" using "\add@special".
4288 % \changes{v1.9e.2}{1994/02/07}{-js: Check if \protect\meta{c} is
4290 % abbreviation for \cs{verb}.}
4291 % Some unwary user might issue "\MakeShortVerb" for a second time, we
4292 % better protect against this. We assume that this happened if a
4293 % control sequence "\cc\"\meta{c} is bound, the probability that this
4294 % name is used by another module is low. We will output a warning
4295 % below, so that a possible error might be noticed by the programmer
4296 % if he reads the "LOG" file. (Should have used module internal names,
4299 % \begin{macro}{\MakeShortVerb*}
4300 % \changes{v2.1a}{2003/12/09}{(HjG) Added \texttt{*} form}
4301 % This arranges an abbreviation for "\verb*" such that if you say
4302 % "\MakeShortVerb*{\"\meta{c}"}" subsequently using
4303 % \meta{c}\meta{text}\meta{c} is equivalent to
4304 % "\verb*"\meta{c}\meta{text}\meta{c}.
4307 %<*package|shortvrb>
4308 \def\MakeShortVerb{%
4310 {\def\@shortvrbdef{\verb*}\@MakeShortVerb}%
4311 {\def\@shortvrbdef{\verb}\@MakeShortVerb}}
4315 \def\@MakeShortVerb#1{%
4316 \expandafter\ifx\csname cc\string#1\endcsname\relax
4318 % \changes{v1.9v}{1995/11/03}{(DPC) Use \cs{@shortvrbinfo}}
4320 \@shortvrbinfo{Made }{#1}\@shortvrbdef
4323 % Then the character's current catcode is stored in "\cc\"\meta{c}.
4326 \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
4328 % The character is spliced into the definition using the same trick as
4329 % used in "\verb" (for instance), having activated "~" in a group.
4332 \catcode`\~\active \lccode`\~`#1%
4335 % The character's old meaning is recorded in "\ac\"\meta{c} prior to
4336 % assigning it a new one.
4338 \global\expandafter\let
4339 \csname ac\string#1\endcsname~%
4340 \expandafter\gdef\expandafter~\expandafter{\@shortvrbdef~}}%
4343 % Finally the character is made active.
4345 \global\catcode`#1\active
4347 % If we suspect that \meta{c} is already a short reference, we tell
4348 % the user. Now he or she is responsible if anything goes wrong\,\dots
4352 % \changes{v1.9v}{1995/11/03}{(DPC) Use \cs{@shortvrbinfo}}
4354 \@shortvrbinfo\@empty{#1 already}{\@empty\verb(*)}%
4358 % \begin{macro}{\DeleteShortVerb}
4359 % \changes{v1.7a}{1992/02/27}{Added (from newdoc but now alters
4360 % \cs{dospecials}, \cs{@sanitize}).}
4361 % Here's the means of undoing a "\MakeShortVerb", for instance in a
4362 % region where you need to use the character outside a verbatim
4363 % environment. It arranges for "\dospecials" and "\@sanitize" to be
4364 % altered appropriately, restores the saved catcode and, if necessary,
4365 % the character's meaning (as stored by
4366 % "\MakeShortVerb"). If the catcode wasn't stored in
4367 % "\cc\"\meta{c} (by "\MakeShortVerb") the command is silently
4369 % \changes{v1.7a}{1992/02/28}{Check for previous matched
4370 % \cs{MakeShortVerb}
4373 \def\DeleteShortVerb#1{%
4374 \expandafter\ifx\csname cc\string#1\endcsname\relax
4376 % \changes{v2.1a}{2003/12/10}{(HjG) Notify user
4377 % if it's not a short verb character}
4379 \@shortvrbinfo\@empty{#1 not}{\@empty\verb(*)}%
4382 % \changes{v1.9v}{1995/11/03}{(DPC) Use \cs{@shortvrbinfo}}
4384 \@shortvrbinfo{Deleted }{#1 as}{\@empty\verb(*)}%
4386 \global\catcode`#1\csname cc\string#1\endcsname
4388 % \changes{v1.9e.2}{1994/02/07}{-js: Reset `cc`\protect\meta{c} in
4389 % in \cs{DeleteShortVerb}}
4390 % We must not forget to reset "\cc\"\meta{c}, otherwise the check in
4391 % "\MakeShortVerb" for a repeated definition will not work.
4393 \global \expandafter\let \csname cc\string#1\endcsname \relax
4394 \ifnum\catcode`#1=\active
4396 \catcode`\~\active \lccode`\~`#1%
4398 \global\expandafter\let\expandafter~%
4399 \csname ac\string#1\endcsname}%
4404 % \begin{macro}{\@shortvrbinfo}
4405 % \changes{v1.9v}{1995/11/03}{(DPC) Macro added}
4406 % \changes{v2.1a}{2003/12/10}{(HjG) Third argument added
4407 % on behalf of \cmd{\MakeShortVerb*}}
4408 % Helper function for info messages.
4410 \def\@shortvrbinfo#1#2#3{%
4411 %<shortvrb> \PackageInfo{shortvrb}{%
4412 %<!shortvrb> \PackageInfo{doc}{%
4413 #1\expandafter\@gobble\string#2 a short reference
4414 for \expandafter\string#3}}
4418 % \begin{macro}{\add@special}
4419 % \changes{v1.7a}{1992/02/27}{Added for short verb facility.}
4420 % This helper macro adds its argument to the
4421 % "\dospecials" macro which is conventionally used by verbatim macros
4422 % to alter the catcodes of the currently active characters. We need
4423 % to add "\do\"\meta{c} to the expansion of "\dospecials" after
4424 % removing the character if it was already there to avoid multiple
4425 % copies building up should "\MakeShortVerb" not be balanced by
4426 % "\DeleteShortVerb" (in case anything that uses "\dospecials" cares
4427 % about repetitions).
4429 \def\add@special#1{%
4431 \expandafter\gdef\expandafter\dospecials\expandafter
4432 {\dospecials \do #1}%
4434 % Similarly we have to add "\@makeother\"\meta{c} to "\@sanitize"
4435 % (which is used in things like "\index" to re-catcode all special
4436 % characters except braces).
4438 \expandafter\gdef\expandafter\@sanitize\expandafter
4439 {\@sanitize \@makeother #1}}
4442 % \begin{macro}{\rem@special}
4443 % \changes{v1.7a}{1992/02/27}{Added for short verb facility.}
4444 % The inverse of "\add@special" is slightly trickier. "\do" is
4445 % re-defined to expand to nothing if its argument is the character of
4446 % interest, otherwise to expand simply to the argument. We can then
4447 % re-define "\dospecials" to be the expansion of itself. The space
4448 % after "=`##1" prevents an expansion to "\relax"!
4450 \def\rem@special#1{%
4452 \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
4453 \xdef\dospecials{\dospecials}%
4455 % Fixing "\@sanitize" is the same except that we need to re-define
4456 % "\@makeother" which obviously needs to be done in a group.
4459 \def\@makeother##1{%
4460 \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
4461 \xdef\@sanitize{\@sanitize}%
4463 %</package|shortvrb>
4467 % \begin{macro}{\MakeShortverb}
4468 % \begin{macro}{\DeleteShortverb}
4469 % \changes{v1.7a}{1992/02/27}{Added (from newdoc).}
4470 % These commands from \textsf{newdoc} are now obsolete.
4472 \def\MakeShortverb{\typeout{*** Switch to \noexpand\MakeShortVerb
4473 syntax, this is obsolete ***}\MakeShortVerb}
4474 \def\DeleteShortverb{\typeout{*** Switch to \noexpand\DeleteShortVerb
4475 syntax, this is obsolete ***}\DeleteShortVerb}
4482 % \subsection[Providing a checksum and character table]
4483 % {Providing a checksum and character table\footnotemark}
4484 % \footnotetext{Warning: the commentary in this section was
4485 % written by Dave Love. }
4488 % \begin{macro}{\init@checksum}
4489 % The checksum mechanism works by counting backslashes in the
4490 % macrocode. This initialises the count (when called from
4491 % "\StopEventually").
4492 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4494 \def\init@checksum{\relax
4495 \global\bslash@cnt\z@}
4500 % \begin{macro}{\check@checksum}
4501 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4502 % This reports the sum compared with the value ("\bslash@cnt") the
4503 % file advertises. It's called from "\Finale" (if that hasn't been
4506 \def\check@checksum{\relax
4507 \ifnum\check@sum=\z@
4508 \typeout{**********************************}%
4509 \typeout{* This macro file has no checksum!}%
4510 \typeout{* The checksum should be \the\bslash@cnt!}%
4511 \typeout{**********************************}%
4513 \ifnum\check@sum=\bslash@cnt
4514 \typeout{*******************}%
4515 \typeout{* Checksum passed *}%
4516 \typeout{*******************}%
4518 \PackageError{doc}{Checksum not passed
4519 (\the\check@sum<>\the\bslash@cnt)}%
4520 {The file currently documented seems to be wrong.^^J%
4521 Try to get a correct version.}%
4524 \global\check@sum\z@}
4529 % \begin{macro}{\check@sum}
4530 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4531 % \begin{macro}{\bslash@cnt}
4532 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4533 % We need to define counters, "\bslash@cnt" for the number of
4534 % backslashes counted and "\check@sum" for the value advertised by the
4537 \newcount\check@sum \check@sum = \z@
4538 \newcount\bslash@cnt \bslash@cnt = \z@
4544 % \begin{macro}{\CheckSum}
4545 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4546 % This is the interface to setting "\check@sum".
4548 \def\CheckSum#1{\@bsphack\global\check@sum#1\relax\@esphack}
4554 % \begin{macro}{\step@checksum}
4555 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4556 % This advances the count when a backslash is encountered in the
4559 \def\step@checksum{\global\advance\bslash@cnt\@ne}
4563 % \begin{macro}{\CharacterTable}
4564 % The user interface to the character table-checking does some
4565 % "\catcode"ing and then compares the following table with the
4566 % stored version. We need to have "@" of type ``other'' within the
4567 % table since this is the way it is usually returned when reading
4568 % in a normal document. To nevertheless have a private letter we
4569 % use "~" for this purpose. "~" does no harm as a ``letter'' as it
4570 % comes last in the table and therefore will not gobble following
4572 % \changes{v1.5m}{1989/09/20}{Macro added to check character translation
4574 % \changes{v1.5q}{1989/11/01}{Made character table more readable.}
4575 % \changes{v1.5t}{1989/11/07}{Make \string\~{} letter in chartable
4577 % \changes{v1.5u}{1989/11/14}{Made @ other in default table.}
4579 \def\CharacterTable{\begingroup \CharTableChanges \character@table}
4582 % \def\MakePrivateLetters{\catcode`\~=11\makeatletter}
4583 % \begin{macro}{\character@table}
4584 % This does the work of comparing the tables and reporting the result.
4585 % Note that the following code is enclosed in a group
4586 % with "~" catcoded to letter.
4590 \gdef\character@table#1{\def\used~table{#1}%
4591 \ifx\used~table\default~table
4592 \typeout{***************************}%
4593 \typeout{* Character table correct *}%
4594 \typeout{***************************}%
4596 \PackageError{doc}{Character table corrupted}
4605 % \begin{macro}{\CharTableChanges}
4606 % When the character table is read in we need to scan it with a
4607 % fixed set of "\catcode"s. The reference table below was defined by
4608 % assuming the normal "\catcode"s of \TeX{}, i.e.\ "@" is of type
4609 % other and the only token of type ``letter'' are the usual letters
4610 % of the alphabet. If, for some reason, other characters are made
4611 % ``letters'' then their "\catcode"s need to be restored before
4612 % checking the table. Otherwise spaces in the table are gobbled and
4613 % we get the information that the tables are different, even if
4614 % they are actually equal. For this reason "\CharTableChanges" can
4615 % be set up to locally restore the "\catcode"s of such ``letters''
4618 \global\let\CharTableChanges\@empty
4622 % \begin{macro}{\default~table}
4623 % Here's what the table {\em should\/} look like (modulo spaces).
4627 {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
4628 Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
4629 Digits \0\1\2\3\4\5\6\7\8\9
4630 Exclamation \! Double quote \" Hash (number) \#
4631 Dollar \$ Percent \% Ampersand \&
4632 Acute accent \' Left paren \( Right paren \)
4633 Asterisk \* Plus \+ Comma \,
4634 Minus \- Point \. Solidus \/
4635 Colon \: Semicolon \; Less than \<
4636 Equals \= Greater than \> Question mark \?
4637 Commercial at \@ Left bracket \[ Backslash \\
4638 Right bracket \] Circumflex \^ Underscore \_
4639 Grave accent \` Left brace \{ Vertical bar \|
4640 Right brace \} Tilde \~}
4644 % \let\MakePrivateLetters=\makeatletter
4646 % \begin{macro}{\wrong@table}
4647 % \changes{v1.7a}{1992/02/28}{Moved to where the catcodes are right
4649 % We need a help message in case of problems.
4651 \newhelp\wrong@table{Some of the ASCII characters are corrupted.^^J
4652 I now \string\show\space you both tables for comparison.}
4657 % \subsection[Attaching line numbers to code lines]
4658 % {Attaching line numbers to code lines\footnotemark}
4659 % \footnotetext{Warning: the commentary was written by Dave
4663 % The code in this section allows index entries to refer to code line
4664 % numbers---the number of the first line of macrocode in the
4665 % \textsf{macro} environment.
4668 % \begin{macro}{\codeline@index}
4669 % Indexing by code line is controlled by the "codeline@index" switch.
4670 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
4671 % \changes{v1.7a}{1992/02/24}{Documented code line no. support.}
4672 % \begin{macro}{\CodelineNumbered}
4673 % \changes{v1.8a}{1993/05/19}{Macro added}
4675 \newif\ifcodeline@index \codeline@indexfalse
4676 \let\CodelineNumbered\codeline@indextrue
4680 % \begin{macro}{\codeline@wrindex}
4681 % The code index entries are written out by "\special@index". If
4682 % indexing is by code line this is "\let" to "\codeline@wrindex";
4683 % if indexing is by page it is just "\index". However, if
4684 % "\nofiles" is given, we omit writing such an index entry at all.
4685 % \changes{v1.7j}{1992/08/14}{Added \cs{if@filesw}.}
4687 \def\codeline@wrindex#1{\if@filesw
4688 \immediate\write\@indexfile
4689 {\string\indexentry{#1}%
4690 {\number\c@CodelineNo}}\fi}
4693 % \begin{macro}{\special@index}
4694 % By default no index entries are written out.
4696 \let\special@index = \@gobble
4699 % \begin{macro}{\CodelineIndex}
4700 % \changes{v1.5u}{1989/11/14}{Added \cs{PageIndex} and
4701 % \cs{CodelineIndex} (Undoc)}
4702 % This switches on use of the index file with "\makeindex", sets the
4703 % switch to indicate code line numbering and defines "\special@index"
4706 \def\CodelineIndex{\makeindex
4708 \let\special@index\codeline@wrindex}
4711 % \begin{macro}{\PageIndex}
4712 % "\PageIndex" is similar.
4714 \def\PageIndex{\makeindex
4715 \codeline@indexfalse
4716 \let\special@index\index}
4721 % \begin{macro}{\c@CodelineNo}
4722 % \changes{v1.5l}{1989/09/10}{Counter added to support code line
4724 % \changes{v1.5y}{1990/02/24}{Default changed.}
4725 % \changes{v1.6b}{1990/06/15}{\cs{rm} moved before \cs{scriptsize} to
4726 % avoid unnecessary fontwarning.}
4727 % We need a counter to keep track of the line number.
4729 \newcount\c@CodelineNo \c@CodelineNo\z@
4732 % \begin{macro}{\theCodelineNo}
4733 % \changes{v1.7a}{1992/02/25}{Existing definition not overwritten.}
4734 % \changes{v1.7a}{1992/03/12}{Use \cs{reset@font} for NFSS.}
4735 % This provides a hook to control the format of line numbers which may
4736 % be defined in a class file.
4738 \@ifundefined{theCodelineNo}
4739 {\ifx\selectfont\undefined
4740 \def\theCodelineNo{\rmfamily\scriptsize\arabic{CodelineNo}}%
4742 \def\theCodelineNo{\reset@font\scriptsize\arabic{CodelineNo}}%
4751 % \subsection{Layout Parameters for documenting package files}
4753 % \begin{macro}{\tolerance}
4754 % People documenting package files would probably rather have things
4755 % ``sticking out'' in overfull |\hbox|es and poorish spacing,
4756 % because they probably don't want to spend a lot of time on making
4757 % all the line breaks perfect!
4759 \tolerance=1000\relax
4763 % \DeleteShortVerb{\"}
4765 % The following |\mathcode| definitions allow the characters
4767 % and `\texttt{@}' to appear in |\ttfamily| font when invoked in math
4768 % mode;\footnote{You may wonder why the definitions state that both
4769 % characters belong to the {\em variable family\/}
4770 % (i.e.\ the number 7 in front). The reason is this:
4771 % Originally the \texttt{\bslash mathcode} of
4772 % \texttt{\bslash} was defined to be \texttt{"075C},
4773 % i.e.\ ordinary character number 92 (hex 5C) in
4774 % math family number 7 which is the typewriter family in
4776 % But this file should not depend on this specific
4777 % setting, so I changed these
4778 % \texttt{\bslash mathcode}$\,$s
4779 % to work with any family assignments. For an example
4780 % see the article about the new font selection scheme.}
4781 % particularly for something like $|\@abc|=1$.
4783 % If an {\em old\/} version of the \textsf{german} package is in
4784 % force, then the `|"|' character is active and would upset the
4785 % definition of the \meta{16-bit number} quantities below, therefore
4786 % we change the |\catcode| of |"| inside a group, and use
4790 \global\mathcode`\\="705C \global\mathcode`\@="7040 }
4792 % \MakeShortVerb{\"}
4794 % \begin{macro}{\DocstyleParms}
4795 % This macro can be used, for example, to assign new values to
4796 % |\MacrocodeTopsep| and |\MacroIndent| and some other internal
4797 % registers. If it is already defined, the default definition
4798 % won't be carried out. Note that it is necessary to assign new
4799 % values via this macro if it should be done in a class file (like
4800 % \texttt{ltugboat.cls} for example) since the registers are
4801 % undefined before \texttt{doc.sty} is read in. The default values
4802 % for the internal registers are scattered over this file.
4803 % \changes{v1.5u}{1989/11/14}{\cs{DocStyleParms} now empty}
4805 \@ifundefined{DocstyleParms}{}{}
4807 % Now we allow overwriting the values by calling
4810 \DocstyleParms \let\DocstyleParms\relax
4816 % \begin{macro}{\AmSTeX}
4817 % \changes{v1.5j}{1989/06/09}{Macro AmsTeX renamed to AmSTeX}
4818 % \begin{macro}{\BibTeX}
4819 % \begin{macro}{\SliTeX}
4820 % Here are a few definitions which can usefully be employed when
4821 % documenting package files: now we can readily refer to \AmSTeX,
4822 % \BibTeX\ and \SliTeX, as well as the usual \TeX\ and \LaTeX.
4824 \@ifundefined{AmSTeX}
4825 {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex%
4826 \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{}
4827 \@ifundefined{BibTeX}
4828 {\def\BibTeX{{\rmfamily B\kern-.05em%
4829 \textsc{i\kern-.025em b}\kern-.08em%
4830 T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}}{}
4831 \@ifundefined{SliTeX}
4832 {\def\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox
4833 {\scshape i}\kern -.03em\TeX}}}{}
4838 % \begin{macro}{\PlainTeX}
4839 % \changes{v1.5g}{1989/05/07}{space between plain and TeX changed.}
4840 % \begin{macro}{\Web}
4841 % There's even a \PlainTeX{} and a \Web.
4843 \@ifundefined{PlainTeX}{\def\PlainTeX{\textsc{Plain}\kern2pt\TeX}}{}
4844 \@ifundefined{Web}{\def\Web{\textsc{Web}}}{}
4850 % \subsection{Changing the \texttt{\protect\bslash catcode} of \%}
4852 % \begin{macro}{\MakePercentIgnore}
4853 % \begin{macro}{\MakePercentComment}
4854 % And finally the most important bit: we change the |\catcode|
4855 % of `|%|' so that it is ignored (which is how we are able to
4856 % produce this document!). We provide two commands to do the actual
4858 %^^A The |\MakePercentIgnore| is then called as the
4859 %^^A last command in this file.
4861 \def\MakePercentIgnore{\catcode`\%9\relax}
4862 \def\MakePercentComment{\catcode`\%14\relax}
4867 % \begin{macro}{\DocInput}
4868 % The two macros above are now used to define the |\DocInput| macro
4869 % which was introduced in version v1.5l (or so) of the \DOC{}
4870 % package. In older versions |\MakePercentIgnore| was placed
4871 % at the very end of \texttt{doc.sty}.
4873 \def\DocInput#1{\MakePercentIgnore\input{#1}\MakePercentComment}
4877 % \subsection{GetFileInfo}
4879 % \begin{macro}{\GetFileInfo}
4880 % \changes{v1.9o}{1994/05/08}{Macro added}
4881 % \changes{v1.9z}{1997/02/05}{Missing percent latex/2404}
4882 % Define |\filedate| and friends from info in the
4883 % |\ProvidesPackage| etc.\ commands.
4885 \def\GetFileInfo#1{%
4887 \def\@tempb##1 ##2 ##3\relax##4\relax{%
4889 \def\fileversion{##2}%
4890 \def\fileinfo{##3}}%
4891 \edef\@tempa{\csname ver@#1\endcsname}%
4892 \expandafter\@tempb\@tempa\relax? ? \relax\relax}
4896 % We can now finish the \texttt{docstrip} main module.
4903 % \PrintIndex \PrintChanges