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> [2016/02/15 v2.1g
39 %<+package|shortvrb> Standard LaTeX documentation package (FMi)]
43 %\iffalse This is a METACOMMENT
44 % Everything up to the next `\ fi' (without a blank) will
45 % be ignored. This is necessary because `%' may no longer
46 % be a comment mark when this file is read in.
49 %% Package `doc' to use with LaTeX 2e
50 %% Copyright (C) 1989-1999 Frank Mittelbach, all rights reserved.
53 % Version: Date: Changes:
55 % 1.0a 5.5.88 This is nothing but a collection of tests and
56 % hacks. It is certainly going to be greatly
58 % Better not to use it!
59 % 1.5a and earlier... are not longer recorded
60 % 1.5b and higher... are documented with the (undocumented) \changes
63 % \changes{v1.5f}{1989/4/29}{Thanks to Brian who documented the
64 % \cs{changes} macro feature.}
65 % \changes{v1.5g}{1989/5/07}{MacroTopsep now called MacrocodeTopsep and
66 % new MacroTopsep added}
67 % \changes{v1.5h}{1989/05/17}{All lines shortened to <72 characters}
68 % \changes{v1.5j}{1989/06/09}{Corrections by Ron Whitney added}
69 % \changes{v1.5q}{1989/11/03}{`\ldots{}Listing macros renamed to
70 % `\ldots{}Input. Suggested by R. Wonneberger}
71 % \changes{v1.5w}{1990/02/05}{Counter codelineno renamed to CodelineNo}
72 % \changes{v1.9a}{1993/12/02}{Upgrade for LaTeX2e}
73 % \changes{v1.9d}{1993/12/20}{Protected changes entry.}
74 % \changes{v1.0p}{1994/05/21}{Use new error commands}
77 % \hyphenation{make-index}
79 % \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
80 % \DoNotIndex{\@flushglue,\@gobble,\@input}
81 % \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
82 % \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
83 % \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
84 % \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
85 % \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
86 % \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
87 % \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
88 % \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
89 % \DoNotIndex{\egroup}
90 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
91 % \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
92 % \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
93 % \DoNotIndex{\ifcase}
94 % \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
95 % \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
96 % \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
97 % \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
98 % \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
99 % \DoNotIndex{\strutbox}
100 % \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
101 % \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
102 % \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
103 % \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
104 % \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
105 % \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
106 % \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
107 % \DoNotIndex{\nopagebreak}
108 % \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
109 % \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
110 % \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
111 % \DoNotIndex{\[,\{,\},\]}
112 % \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
113 % \DoNotIndex{\baselineskip,\begin,\tw@}
114 % \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
115 % \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
116 % \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
117 % \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
118 % \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
119 % \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
120 % \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
121 % \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
122 % \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
123 % \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
124 % \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
125 % \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
126 % \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
127 % \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
128 % \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
129 % \DoNotIndex{\bfdefault}
132 % \setcounter{StandardModuleDepth}{1}
134 % {\catcode`\p=12 \catcode`\t=12 ^^A hack used later on to print
135 % \gdef\dimenvalue#1pt{$#1$pt}} ^^A a register value with a - sign
137 % \newcommand{\DOC}{\texttt{doc}}
139 % \changes{v1.9t}{1995/05/11}{Use \cs{GetFileInfo}}
140 % \GetFileInfo{doc.sty}
142 % \CheckSum{2202} ^^A % keep the checksum in this file
144 % \title{The \DOC{} and \texttt{shortvrb} Packages\thanks
145 % {This file has version number \fileversion{} dated \filedate{}.}}
146 % \author{Frank Mittelbach\thanks{Further commentary added at Royal
147 % Military College of Science by B. Hamilton Kelly; English
148 % translation of parts of the original German commentary
149 % provided by Andrew Mills; fairly substantial additions,
150 % particularly from \texttt{newdoc}, and
151 % documentation of post-v1.5q features added at v1.7a by Dave
152 % Love (SERC Daresbury Lab). Extraction of \texttt{shortvrb}
153 % package added by Joachim Schrod (TU~Darmstadt).}}
155 % \MaintainedByLaTeXTeam{latex}
159 % This package contains the definitions that are necessary to
160 % format the documentation of package files. The package was
161 % developed in Mainz in cooperation with the Royal Military College
162 % of Science. This is an update which documents various changes
163 % and new features in \DOC{} and integrates the features of
168 % \IfFileExists{multicol.sty}{\multicolstrue}{}
171 % \addtocontents{toc}{\protect\begin{multicols}{2}}
174 % {\parskip 0pt ^^A We have to reset \parskip
175 % ^^A (bug in \LaTeX)
179 % \changes{v1.7a}{1992/02/25}{Miscellaneous small changes to the text}
182 % \begin{multicols}{2}[\section*{Preface to version 1.7}]
183 % \else \section*{Preface to version 1.7} \fi
185 % This version of \texttt{doc.dtx} documents changes which have occurred
186 % since the last published version \cite{art:doc} but which have been
187 % present in distributed versions of \texttt{doc.sty} for some time. It
188 % also integrates the (undocumented) features of the distributed
189 % \texttt{newdoc.sty}.
191 % The following changes and additions have been made to the user
192 % interface since the published version~\cite{art:doc}. See
193 % \S\ref{sec:interface} for more details.
194 % \begin{description}
195 % \item[Driver mechanism] "\DocInput" is now used in the driver file
196 % to input possibly multiple independent \DOC{} files and \DOC{} no
197 % longer has to be the last package. "\IndexListing" is replaced
199 % \item[Indexing] is controlled by "\PageIndex" and "\CodelineIndex",
200 % one of which must be specified to produce an index---there is no
201 % longer a "\makeindex" in the default "\DocstyleParms";
202 % \item[The \texttt{macro} environment] now takes as argument the
203 % macro name {\em with\/} the backslash;
204 % \item[Verbatim text] Newlines are now forbidden inside "\verb" and
205 % commands "\MakeShortVerb" and "\DeleteShortVerb" are provided for
206 % verbatim shorthand;
207 % \item[\texttt{\bslash par}] can now be used in "\DoNotIndex";
208 % \item[Checksum/character table support] for ensuring the integrity
209 % of distributions is added;
210 % \item[\texttt{\bslash printindex}] becomes "\PrintIndex";
211 % \item[\texttt{multicol.sty}] is no longer necessary to use \DOC{} or
212 % print the documentation (although it is recommended);
213 % \item[`Docstrip' modules] are recognised and formatted specially.
216 % As well as adding some completely new stuff,
217 % the opportunity has been taken to add some commentary to the code
218 % formerly in \texttt{newdoc.sty} and that added after version 1.5k of
219 % \texttt{doc.sty}. Since (as noted in the sections concerned) this
220 % commentary wasn't written by Frank Mittelbach but the code was, it is
221 % probably {\em not\/} true in this case that ``if the code and
222 % comments disagree both are probably wrong''!
226 % There are some known bugs in this version:
228 % \item The "\DoNotIndex" command doesn't work for some single
229 % character commands most noticeable "\%".
230 % \item The `General changes' glossary entry would come out after
231 % macro names with a leading "!" and possibly a leading |"|;
232 % \item If you have an old version of \textsf{makeindex} long "\changes"
233 % entries will come out strangely and you may find the section
234 % header amalgamated with the first changes entry. Try to get an
235 % up-to-date one (see p.~\pageref{makeindex:version});
236 % \item Because the accompanying \textsf{makeindex} style files support
237 % the inconsistent attribute specifications of older and newer
238 % versions \textsf{makeindex} always complains about three `unknown
239 % specifier's when sorting the index and changes entries.
240 % \item If "\MakeShortVerb" and "\DeleteShortVerb" are used with
241 % single character arguments, e.g., "{|}" instead of "{\|}" chaos
244 % (Some `features' are documented below.)
246 % \subsection*{Wish list}
249 % \item Hooks to allow "\DescribeMacro" and "\DescribeEnv" to write
250 % out to a special file information about the package's `exported'
251 % definitions which they describe. This could subsequently be
252 % included in the \texttt{docstrip}ped \texttt{.sty} file in a
253 % suitable form for use by smart editors in command completion,
254 % spelling checking etc., based on the packages used in a document.
255 % This would need agreement on a `suitable form'. \item Indexing of
256 % the modules used in \texttt{docstrip}'s "%<" directives. I'm not
257 % sure how to index directives containing module combinations; \item
258 % Writing out bibliographic information about the package; \item Allow
259 % turning off use of the special font for, say, the next guarded
266 % \begin{multicols}{2}[\medskip \rule{\textwidth}{.3pt}
267 % \section{Introduction}]
269 % \section{Introduction}
272 % The \TeX{} macros which are described here allow definitions and
273 % documentation to be held in one and the same file. This has the
274 % advantage that normally very complicated instructions are made
275 % simpler to understand by comments inside the definition. In addition
276 % to this, updates are easier and only one source file needs to be
277 % changed. On the other hand, because of this, the package files are
278 % considerably longer: thus \TeX{} takes longer to load them. If this
279 % is a problem, there is an easy remedy: one needs only to run the
280 % \texttt{docstrip.tex} program that removes nearly all lines that begin
284 % The idea of integrated documentation was born with the development
285 % of the \TeX{} program; it was crystallized in Pascal with the \Web{}
286 % system. The advantages of this method are plain to see (it's easy
287 % to make comparisons \cite{art:Knuthliterat}). Since this
288 % development, systems similar to \Web{} have been developed for other
289 % programming languages. But for one of the most complicated
290 % programming languages (\TeX) the documentation has however been
291 % neglected. The \TeX{} world seems to be divided between:---
292 % \begin{itemize} \item a couple of ``wizards'', who produce many
293 % lines of completely unreadable code ``off the cuff'', and \item many
294 % users who are amazed that it works just how they want it to do. Or
295 % rather, who despair that certain macros refuse to do what is
296 % expected of them.\end{itemize}
298 % I do not think that the \Web{} system is {\em the\/} reference work;
299 % on the contrary, it is a prototype which suffices for the
300 % development of programs within the \TeX{} world. It is sufficient,
301 % but not totally sufficient.\footnote{I know that this will be seen
302 % differently by a few people, but this product should not be seen as
303 % the finished product, at least as far as applications concerning
304 % \TeX{} are concerned. The long-standing debate over `multiple
305 % change files' shows this well.} As a result of \Web, new programming
306 % perspectives have been demonstrated; unfortunately, though, they
307 % haven't been developed further for other programming languages.
309 % The method of documentation of \TeX{} macros which I have introduced
310 % here should also only be taken as a first sketch. It is designed
311 % explicitly to run under \LaTeX{} alone. Not because I was of the
312 % opinion that this was the best starting point, but because from this
313 % starting point it was the quickest to develop.\footnote{This
314 % argument is a bad one, however, it is all too often trotted out.} As
315 % a result of this design decision, I had to move away from the
316 % concept of modularization; this was certainly a step backward.
318 % I would be happy if this article could spark off discussion over
319 % \TeX\ documentation. I can only advise anyone who thinks that they
320 % can cope without documentation to ``Stop Time'' until he or she
321 % completely understands the \AmSTeX{} source code.
327 % \subsection{Using the \DOC{} package}
329 % Just like any other package, invoke it by requesting it with a
330 % |\usepackage| command in the preamble. \textsf{Doc}'s use of
331 % |\reversemarginpars| may make it incompatible with some classes.
332 % \changes{v1.7a}{1992/02/25}{Altered usage info}
335 % \ifmulticols\end{multicols}\fi
338 % \section{The User Interface}\label{sec:interface}
339 % \subsection{The driver file}
341 % If one is going to document a set of macros with the \DOC{}
342 % package one has to prepare a special driver file which produces the
343 % formatted document. This driver file has the following
346 % \noindent |\documentclass[|\meta{options}]^^A
347 % |{|\meta{document-class}|}|\\[1pt]
348 % |\usepackage{doc}|\\[3pt]
349 % \hspace*{10pt}\meta{preamble}\\[3pt]
350 % |\begin{document}|\\[3pt]
351 % \hspace*{10pt}\meta{special input commands}\\[3pt]
354 % The \meta{document-class} might be any document class, I normally
355 % use \texttt{article}.
357 % In the \meta{preamble} one should place declarations which
358 % manipulate the behavior of the \DOC{} package like
359 % |\DisableCrossrefs| or |\OnlyDescription|.
361 % \DescribeMacro\DocInput \DescribeMacro\IndexInput
362 % Finally the \meta{special input commands} part should contain one or
363 % more |\DocInput|\meta{file name} and/or
364 % |\IndexInput|\meta{file name} commands. The
365 % |\DocInput| command is used for files prepared for the
366 % \DOC{} package whereas |\IndexInput| can be used for all kinds of
367 % macro files. See page \pageref{..Input} for more details of
368 % "\IndexInput". Multiple "\DocInput"s can be used with a
369 % number of included files which are each self-contained
370 % self-documenting packages---for instance, each containing
373 % As an example, the driver file for the \DOC{} package itself is
374 % the following text surrounded by "%<*driver>" and "%</driver>".
375 % To produce the documentation you can simply run the \texttt{.dtx}
376 % file through \LaTeX{} in which case this code will be executed
377 % (loading the document class \texttt{ltxdoc}, etc.) or you can
378 % extract this into a separate file by using
379 % the \texttt{docstrip} program.
380 % The line numbers below are added by
381 % \DOC{}'s formatting.
382 % Note that the class \textsf{ltxdoc} has the \DOC{} package
384 % \changes{v1.7a}{1992/03/06}{Added
385 % docstrip-derivable driver file as example.}
386 % \changes{v1.7c}{1992/04/01}{Expurgated ltugboat.sty from driver.}
389 \documentclass{ltxdoc}
391 %\DisableCrossrefs % Say \DisableCrossrefs if index is ready
393 \RecordChanges % Gather update information
394 %\OnlyDescription % comment out for implementation details
395 %\OldMakeindex % use if your MakeIndex is pre-v2.9
396 \setlength\hfuzz{15pt} % dont make so many
397 \hbadness=7000 % over and under full box warnings
405 % \subsection{General conventions}
407 % A \TeX{} file prepared to be used with the `doc' package
408 % consists of `documentation parts' intermixed with `definition
411 % Every line of a `documentation part' starts with a percent sign
412 % (|%|) in column one. It may contain arbitrary \TeX{} or
413 % \LaTeX{} commands except that the character `|%|' cannot be
414 % used as a comment character.
415 % \SortIndex{\string^\string^A}{\string\verb\verbatimchar
416 % \string^\string^A\verbatimchar \encapchar usage} To allow user
417 % comments, the |^^A| character is defined as a comment character
418 % later on. Such `metacomments' may be also be included simply by
419 % surrounding them with "\iffalse" \ldots~"\fi".
421 % All other parts of the file are called `definition parts'. They
422 % contain fractions of the macros described in the `documentation
425 % If the file is used to define new macros (e.g.\ as a package file in
426 % the |\usepackage| macro), the `documentation parts' are
427 % bypassed at high speed and the macro definitions are pasted
428 % together, even if they are split into several `definition parts'.
430 % \DescribeEnv{macrocode}
431 % On the other hand, if the documentation of these macros is to be
432 % produced, the `definition parts' should be typeset verbatim. To
433 % achieve this, these parts are surrounded by the \textsf{macrocode}
435 % More exactly: before a `definition part' there should be a line
437 % \hspace*{\MacroIndent}\verb*+% \begin{macrocode}+\\
438 % and after this part a line\\
439 % \hspace*{\MacroIndent}\verb*+% \end{macrocode}+\\
440 % There must be {\em exactly\/} four spaces between the |%|
441 % and |\end{macrocode}| --- \TeX{} is looking for this string
442 % and not for the macro while processing a `definition part'.
444 % Inside a `definition part' all \TeX{} commands are allowed; even the
445 % percent sign could be used to suppress unwanted spaces etc.
447 % \DescribeEnv{macrocode*} Instead of the \textsf{macrocode}
448 % environment one can also use the \textsf{macrocode$*$} environment
449 % which produces the same results except that spaces are printed as
450 % \nopagebreak\verb*+ + characters.
454 % \subsection{Describing the usage of new macros}
456 % \DescribeMacro\DescribeMacro
457 % When you describe a new macro you may use |\DescribeMacro| to
458 % indicate that at this point the usage of a specific macro is
459 % explained. It takes one argument which will be printed in the margin
460 % and also produces a special index entry. For example, I used
461 % |\DescribeMacro{\DescribeMacro}| to make clear that this is the
462 % point where the usage of |\DescribeMacro| is explained.
464 % \DescribeMacro\DescribeEnv
465 % An analogous macro |\DescribeEnv| should be used to indicate
466 % that a \LaTeX{} environment is explained. It will produce a somewhat
467 % different index entry. Below I used |\DescribeEnv{verbatim}|.
469 % \DescribeEnv{verbatim}
470 % It is often a good idea to include examples of the usage of new macros
471 % in the text. Because of the |%| sign in the first column of every
472 % row, the \textsf{verbatim} environment is slightly altered to suppress
474 % characters.\footnote{These macros were written by Rainer
475 % Sch\"opf~\cite{art:verbatim}. He also
476 % provided a new \textsf{verbatim} environment
477 % which can be used inside of other macros.}
478 % \DescribeEnv{verbatim*}
479 % The \textsf{verbatim$*$} environment is changed in the same way.
480 % \changes{v1.7a}{1992/02/26}{Documented \cs{verb} change.}
481 % \DescribeMacro\verb
482 % The "\verb" command is re-implemented to give an error report if a
483 % newline appears in its argument.
484 % The \textsf{verbatim} and \textsf{verbatim$*$} environments set text
485 % in the style defined by "\MacroFont"~(\S\ref{sec:macrofont}).
489 % \subsection{Describing the definition of new macros}
491 % \DescribeEnv{macro}
492 % To describe the definition of a new macro we use the \textsf{macro}
493 % environment. It has one argument: the name of the new
494 % macro.\footnote{This is a change to the style design I described in
495 % ^^A \TUB ^^A removed in case ltugboat.sty not used
496 % \textsl{TUGboat\/}\ 10\#1 (Jan.~89). We finally decided
498 % be better to use the macro name {\em with\/} the
499 % backslash as an argument.}
500 % This argument is also used to print the name in the margin and to
501 % produce an index entry.
502 % Actually the index entries for usage and definition are different to
503 % allow an easy reference.
504 % This environment might be nested. In this case the
505 % labels in the margin are placed under each other.
506 % \changes{v1.7a}{1992/02/26}{Note on need for some text in macro env.}
507 % There should be some text---even if it's just an empty
508 % "\mbox{}"---in this environment before "\begin{macrocode}" or the
509 % marginal label won't print in the right place.
511 % \DescribeMacro\MacrocodeTopsep
512 % \DescribeMacro\MacroTopsep
513 % There also exist four style parameters: |\MacrocodeTopsep| and
514 % |\MacroTopsep| are used to control the vertical spacing above
515 % and below the \textsf{macrocode} and the \textsf{macro}
516 % \DescribeMacro\MacroIndent
517 % environment, |\MacroIndent| is used to indent the lines of code
519 % \DescribeMacro\MacroFont \label{sec:macrofont}
520 % |\MacroFont| holds the font and a possible size change command
521 % for the code lines, the "verbatim"["*"] environment and the macro
522 % names printed in the margin. If you want
523 % to change their default values in a
524 % class file (like \texttt{ltugboat.cls}) use the |\DocstyleParms|
525 % command described below. Starting with release 2.0a it can now
526 % be changed directly as long as the redefinition happens before
527 % the |\begin{document}|.
532 % \subsection{Formatting the margins}
534 % \DescribeMacro\PrintDescribeMacro
535 % \DescribeMacro\PrintDescribeEnv
536 % \DescribeMacro\PrintMacroName
537 % \DescribeMacro\PrintEnvName
538 % As mentioned earlier, some macros and the \textsf{macro} environment
539 % print their arguments in the margin. This is actually done by four
540 % macros which are user
541 % definable.\footnote{You may place the changed definitions in a
543 % file or at the beginning of the documentation
545 % For example, if you don't like any names in the
547 % but want a fine index you can simply
548 % \texttt{\bslash let}
549 % these macros equal \texttt{\bslash @gobble}.
550 % The doc package won't redefine any existing
551 % definitions of these macros.}
552 % They are named |\PrintDescribeMacro|, |\PrintDescribeEnv|,
553 % |\PrintMacroName| (called by the \textsf{macro} environment) and
554 % |\PrintEnvName| (called by the \textsf{environment} environment).
557 % \subsection{Using a special escape character}
559 % \DescribeMacro\SpecialEscapechar
560 % If one defines complicated macros it is sometimes necessary to
561 % introduce a new escape character because the `|\|' has got a
562 % special |\catcode|. In this case one can use
563 % |\SpecialEscapechar| to indicate which character is actually
564 % used to play the r\^ole of the `|\|'. A scheme like this is
565 % needed because the \textsf{macrocode} environment and its counterpart
566 % \textsf{macrocode$*$} produce an index entry for every occurrence of a
567 % macro name. They would be very confused if you didn't tell them that
568 % you'd changed |\catcode|$\,$s. The argument to
569 % |\SpecialEscapechar| is a single-letter control sequence, that
570 % is, one has to use "\|" for example to denote that `\verb+|+'
571 % is used as an escape character. |\SpecialEscapechar| only
572 % changes the behavior of the next \textsf{macrocode} or
573 % \textsf{macrocode$*$} environment.
575 % The actual index entries created will all be printed with |\|
576 % rather than \verb+|+, but this probably reflects their usage, if not
577 % their definition, and anyway must be preferable to not having any
578 % entry at all. The entries {\em could\/} be formatted appropriately,
579 % but the effort is hardly worth it, and the resulting index might be
580 % more confusing (it would certainly be longer!).
583 % \subsection{Cross-referencing all macros used}
585 % \DescribeMacro\DisableCrossrefs \DescribeMacro\EnableCrossrefs As
586 % already mentioned, every new macro name used within a
587 % \textsf{macrocode} or \textsf{macrocode$*$} environment will produce
588 % an index entry. In this way one can easily find out where a specific
589 % macro is used. Since \TeX{} is considerably slower when it has to
590 % produce such a bulk of index entries one can turn off this feature
591 % by using |\DisableCrossrefs| in the driver file. To turn it on again
592 % just use |\EnableCrossrefs|.\footnote{Actually, \texttt{\bslash
593 % EnableCrossrefs} changes things more drastically; any following
594 % \texttt{\bslash DisableCrossrefs} which might be present in the
595 % source will be ignored.}
598 % \DescribeMacro\DoNotIndex
599 % But also finer control is provided. The |\DoNotIndex| macro
600 % takes a list of macro names separated by commas. Those names won't
601 % show up in the index. You might use several |\DoNotIndex|
602 % commands: their lists will be concatenated. In this article I used
604 % all macros which are already defined in \LaTeX.
606 % All three above declarations are local to the current group.
608 % Production (or not) of the index (via the "\makeindex" commend) is
609 % controlled by using or omitting the following declarations in the
610 % driver file preamble; if neither is used, no index is produced.
611 % \DescribeMacro\PageIndex Using "\PageIndex" makes all index
612 % entries refer to their page number; with
613 % \DescribeMacro\CodelineIndex "\CodelineIndex", index entries
614 % produced by "\DescribeMacro" and "\DescribeEnv" refer to page number
615 % but those produced by the \textsf{macro} environment refer to the
616 % code lines, which will be numbered automatically.\footnote{The line
617 % number is actually that of the first line of the first
618 % \textsf{macrocode} environment in the \textsf{macro} environment.}
619 % \DescribeMacro\theCodelineNo
620 % The style of this numbering can be controlled by defining the macro
621 % "\theCodelineNo". Its default definition is to use scriptsize
622 % arabic numerals; a user-supplied definition won't be overwritten.
624 % \DescribeMacro\CodelineNumbered
625 % When you don't wish to get an index but want your code lines
626 % numbered use "\CodelineNumbered" instead of "\CodelineIndex". This
627 % prevents the generation of an unnecessary ".idx" file.
630 % \subsection{Producing the actual index entries}
632 % Several of the aforementioned macros will produce some sort of index
633 % entries. These entries have to be sorted by an external
634 % program---the current implementation assumes that the
635 % \textsf{makeindex} program by Chen~\cite{art:Chen} is used.
637 % But this isn't built in: one has only to redefine some of the
638 % following macros to be able to use any other index program. All
639 % macros which are installation
640 % dependent are defined in such a way that they won't overwrite a
641 % previous definition. Therefore it is safe to put the changed
642 % versions in a package file which might be read in before the doc
645 % To allow the user to change the specific characters recognized by
646 % his or her index program all characters which have special meaning
647 % in the \textsf{makeindex} program are given symbolic
648 % names.\footnote{I don't know if there exists a program which needs
649 % more command characters, but I hope not.}
650 % However, all characters used should be of |\catcode| other than
653 % \DescribeMacro{\actualchar}
654 % The |\actualchar| is used to separate the `key' and the actual
656 % \DescribeMacro{\quotechar}
657 % The |\quotechar| is used before a special index program
658 % character to suppress its special meaning.
659 % \DescribeMacro{\encapchar}
660 % The |\encapchar| separates the indexing information from a
661 % letter string which \textsf{makeindex} uses as a \TeX{} command to
662 % format the page number associated with a special entry. It is used
663 % in this package to apply the |\main| and the |\usage|
665 % \DescribeMacro{\levelchar}
666 % Additionally |\levelchar| is used to separate `item',
667 % `subitem' and `subsubitem' entries.
669 % It is a good idea to stick to these symbolic names even if you know
670 % which index program is used. In this way your files will be
673 % \DescribeMacro\SpecialMainIndex
674 % \DescribeMacro\SpecialMainEnvIndex
675 % To produce a main index entry for a macro the
676 % |\SpecialMainIndex| macro\footnote{This macro is called by the
677 % \textsf{macro} environment.} may be used. It is called `special'
678 % because it has to print its argument verbatim.
679 % A similar macro, called |\SpecialMainEnvIndex| is used for indexing
680 % the main definition point of an
681 % environment.\footnote{This macro is called by the
682 % \textsf{environment} environment.}
683 % \DescribeMacro\SpecialIndex
684 % If you want a normal index entry for a macro name
685 % |\SpecialIndex| might be used.\footnote{This macro is called
686 % within the \textsf{macrocode} environment when encountering a macro
688 % \DescribeMacro\SpecialUsageIndex
689 % \DescribeMacro\SpecialEnvIndex
690 % To index the usage of a macro or an environment
691 % |\SpecialUsageIndex| and |\SpecialEnvIndex| may be used.
692 % \DescribeMacro\SortIndex
693 % Additionally a |\SortIndex| command is provided. It takes two
694 % arguments---the sort key and the actual index entry.
696 % All these macros are normally used by other macros; you will need
697 % them only in an emergency.
699 % \DescribeMacro\verbatimchar
700 % But there is one characteristic worth mentioning: all macro names in
701 % the index are typeset with the |\verb*| command. Therefore one
702 % special character is needed to act as a delimiter for this command.
703 % To allow a change in this respect, again this character is
704 % referenced indirectly, by the macro |\verbatimchar|. It expands
705 % by default to \verb?+? but if your code lines contain macros with
706 % `\texttt{+}' characters in their names (e.g.\ when you use \verb?\+?)
707 % you will end up with an index entry containing \verb?\verb+\++?
708 % which will be typeset as `\verb+\++' and not as `\verb?\+?'. In this
709 % case you should redefine |\verbatimchar| globally or locally to
710 % overcome this problem.
713 % We also provide a |\*| macro. This is intended to be used for
717 % \hspace*{30pt} Special macros for \*
719 % Such an entry might be produced with the line:
721 % \index{index entries\levelchar Special macros for \*}
724 % \DescribeMacro\OldMakeindex
725 % Versions of \textsf{makeindex} prior to 2.9 had some bugs affecting
726 % \DOC{}. One of these,
727 % pertaining to the "%" character doesn't have a work-around
728 % appropriate for versions with and without the
729 % bug.\label{makeindex:version} If
730 % you have an old version, invoke "\OldMakeindex" in a
731 % package file or the driver file to prevent problems with index entries
732 % such as "\%", although you'll probably normally want to turn off
733 % indexing of "\%" anyway. Try to get an up-to-date \textsf{makeindex}
734 % from one of the \TeX{} repositories.
737 % \subsection{Setting the index entries}
739 % \changes{v1.7a}{1992/03/11}{Usage note on gind.ist.} After the first
740 % formatting pass through the \texttt{.dtx} file you need to sort the
741 % index entries written to the \texttt{.idx} file using
742 % \textsf{makeindex} or your favourite alternative. You need a
743 % suitable style file for \textsf{makeindex} (specified by the
744 % \texttt{-s} switch). A suitable one is supplied with \DOC{},
745 % called \texttt{gind.ist}.
747 % \DescribeMacro\PrintIndex
748 % To read in and print the sorted index, just put the
749 % |\PrintIndex| command as the last (commented-out, and thus
750 % executed during the documentation pass through the file) command
751 % in your package file. Precede it by any bibliography commands
752 % necessary for your citations.
753 % Alternatively, it may be more convenient to put all such calls
754 % amongst the arguments of the |\StopEventually| macro, in
755 % which case a |\Finale| command should appear at the end of
758 % \DescribeEnv{theindex}
759 % Contrary to standard \LaTeX, the index is typeset in three columns
760 % by default. This is controlled by the \LaTeX{} counter
761 % `\textsf{IndexColumns}' and can therefore be changed with a
762 % |\setcounter| declaration. Additionally one doesn't want to
763 % start a new page unnecessarily. Therefore the \textsf{theindex}
764 % environment is redefined.
765 % \DescribeMacro\IndexMin
766 % When the \textsf{theindex} environment starts it will measure how much
767 % space is left on the current page. If this is more than
768 % |\IndexMin| then the index will start on this page. Otherwise
769 % |\newpage| is called.
771 % Then a short introduction about the meaning of several index entries
772 % is typeset (still in onecolumn mode). Afterwards the actual index
773 % entries follow in multi-column mode.
774 % \DescribeMacro\IndexPrologue
775 % You can change this prologue with the help of the
776 % |\IndexPrologue| macro. Actually the section heading is also
777 % produced in this way, so you'd better write something like:
779 % \IndexPrologue{\section*{Index} The index entries underlined ...}
781 % When the \textsf{theindex} environment is finished the last page will
782 % be reformatted to produce balanced columns. This improves the layout
783 % and allows the next article to start on the same page.
784 % \DescribeMacro\IndexParms
785 % Formatting of the index columns (values for |\columnssep|
786 % etc.)\ is controlled by the |\IndexParms| macro. It assigns the
788 % \SpecialUsageIndex{\parindent}\SpecialUsageIndex{\columnsep}^^A
789 % \SpecialUsageIndex{\parskip}\SpecialUsageIndex{\rightskip}^^A
790 % \SpecialUsageIndex{\mathsurround}\SpecialUsageIndex{\parfillskip}
792 % \begin{tabular}{l@{\,=\,}ll@{\,=\,}l}
793 % |\parindent| & \IndexParms \the\parindent &
794 % |\columnsep| & \IndexParms \the\columnsep \\
795 % |\parskip| & \IndexParms \the\parskip &
796 % |\rightskip| & \IndexParms
797 % \expandafter\dimenvalue\the\rightskip \\
798 % |\mathsurround| & \IndexParms \the\mathsurround &
799 % |\parfillskip| & \IndexParms
800 % \expandafter\dimenvalue\the\parfillskip
803 % \DescribeMacro{\@idxitem}
804 % Additionally it defines |\@idxitem| (which will be used when an
805 % |\item| command is encountered) and selects |\small| size.
806 % If you want to change any of these values you have to define them
809 % \DescribeMacro\main
810 % \DescribeMacro\usage
811 % The page numbers for main index entries are encapsulated by the
812 % |\main| macro (underlining its argument) and the numbers
813 % denoting the description are encapsulated by the |\usage| macro
814 % (which produces {\em italics}). As usual these commands are user
818 % \subsection{Changing the default values of style parameters}
820 % \DescribeMacro\DocstyleParms If you want to overwrite some default
821 % settings made by the \DOC{} package, you can either put your
822 % declarations in the driver file (that is after \texttt{doc.sty} is
823 % read in) or use a separate package file for doing this work. In the
824 % latter case you can define the macro |\DocstyleParms| to contain all
825 % assignments. This indirect approach is necessary if your package file
826 % might be read before the \texttt{doc.sty}, when some of the
827 % registers are not allocated. Its default definition is null.
829 % The doc package currently assigns values to the following
831 % \SpecialUsageIndex{\IndexMin}\SpecialUsageIndex{\MacrocodeTopsep}^^A
832 % \SpecialUsageIndex{\MacroTopsep}^^A
833 % \SpecialUsageIndex{\MacroIndent}\SpecialUsageIndex{\marginparpush}^^A
834 % \SpecialUsageIndex{\marginparwidth}\SpecialUsageIndex{\tolerance}
836 % \begin{tabular}{l@{\,=\,}ll@{\,=\,}l}
837 % |\IndexMin| & \the\IndexMin &
838 % |\MacroTopsep| & \the\MacroTopsep \\
839 % |\marginparwidth|& \the\marginparwidth &
840 % |\MacroIndent| & \the\MacroIndent \\
841 % |\marginparpush| & \the\marginparpush &
842 % |\MacrocodeTopsep| & \the\MacrocodeTopsep \\
843 % |\tolerance| & \the\tolerance
848 % \subsection{Short input of verbatim text pieces}
850 % \DescribeMacro\MakeShortVerb
851 % \DescribeMacro{\MakeShortVerb*} \DescribeMacro\DeleteShortVerb It is
852 % awkward to have to type, say, "\verb|"\ldots"|" continually when
854 % verbatim bits (like macro names) in the text, so an abbreviation
855 % mechanism is provided. Pick a character \meta{c}---one which
856 % normally has catcode `other' unless you have very good reason not
857 % to---which you don't envisage using in the text, or not using often.
858 % (I like |"|, but you may prefer "|" if you have |"| active to do
859 % umlauts, for instance.) Then if you say
860 % "\MakeShortVerb{\"\meta{c}"}" you can subsequently use
861 % \meta{c}\meta{text}\meta{c} as the equivalent of
862 % "\verb"\meta{c}\meta{text}\meta{c}; analogously, the "*"-form
863 % "\MakeShortVerb*{\"\meta{c}"}" gives you the equivalent of
864 % "\verb*"\meta{c}\meta{text}\meta{c}. Use
865 % "\DeleteShortVerb{\"\meta{c}"}" if you subsequently want \meta{c} to
866 % revert to its previous meaning---you can always turn it on again
867 % after the unusual section. The `short verb' commands make global
868 % changes. The abbreviated "\verb" may not appear in the argument of
869 % another command just like "\verb". However the `short verb'
870 % character may be used freely in the \textsf{verbatim} and
871 % \textsf{macrocode} environments without ill effect.
872 % "\DeleteShortVerb" is silently ignored if its argument does not
873 % currently represent a short verb character. Both commands type a
874 % message to tell you the meaning of the character is being changed.
876 % Please remember that the command "\verb" cannot be used in arguments
877 % of other commands. Therefore abbreviation characters for "\verb"
878 % cannot be used there either.
880 % This feature is also available as a sole package, \texttt{shortvrb}.
883 % \subsection{Additional bells and whistles}
885 % We provide macros for logos such as \Web, \AmSTeX, \BibTeX,
886 % \SliTeX{} and \PlainTeX. Just type |\Web|, |\AmSTeX|,
887 % |\BibTeX|, |\SliTeX| or |\PlainTeX|, respectively.
888 % \LaTeX{} and \TeX{} are already defined in \texttt{latex.tex}.
890 % \DescribeMacro\meta
891 % Another useful macro is |\meta| which has one argument and
892 % produces something like \meta{dimen parameter}.
894 % \DescribeMacro\OnlyDescription
895 % \DescribeMacro\StopEventually
896 % You can use the |\OnlyDescription| declaration in the driver
897 % file to suppress the last part of your document (which presumably
898 % exhibits the code). To make this work
899 % you have to place the command |\StopEventually| at a suitable
900 % point in your file. This macro has one argument in which you put
901 % all information you want to see printed if your document ends at
902 % this point (for example a bibliography which is normally printed at
903 % the very end). When the |\OnlyDescription| declaration is
904 % missing the |\StopEventually|
905 % \DescribeMacro\Finale
906 % macro saves its argument in a macro called |\Finale| which can
907 % afterwards be used to get things back (usually at the very end).
908 % Such a scheme makes changes in two places unnecessary.
910 % Thus you can use this feature to produce a local guide for the
911 % \TeX{} users which describes only the usage of macros (most of them
912 % won't be interested in your definitions anyway). For the same
913 % reason the |\maketitle| \DescribeMacro\maketitle command is slightly
914 % changed to allow multiple titles in one document. So you can make
915 % one driver file reading in several articles at once.
916 % \DescribeMacro{\ps@titlepage} To avoid an unwanted
917 % \textsf{pagestyle} on the title page the |\maketitle| command issues
918 % a |\thispagestyle{titlepage}| declaration which produces a
919 % \textsf{plain} page if the \textsf{titlepage} page style is
920 % undefined. This allows class files like \textsf{ltugboat.cls} to
921 % define their own page styles for title pages.
923 % \DescribeMacro\AlsoImplementation
924 % Typesetting the whole document is the default. However, this default
925 % can also be explicitly selected using the declaration
926 % |\AlsoImplementation|. This overwrites any previous
927 % |\OnlyDescription| declaration. The \LaTeXe{} distribution, for
928 % example, is documented using the \texttt{ltxdoc} class which allows
929 % for a configuration file \texttt{ltxdoc.cfg}. In such a file one
930 % could then add the statement
932 % |\AtBeginDocument{\AlsoImplementation}|
934 % to make sure that all documents will show the code part.
936 % \DescribeMacro\IndexInput \label{..Input} Last but not least I
937 % defined an |\IndexInput| macro which takes a file name as an
938 % argument and produces a verbatim listing of the file, indexing every
939 % command as it goes along. This might be handy, if you want to learn
940 % something about macros without enough documentation. I used this
941 % feature to cross-reference \texttt{latex.tex} getting a verbatim
942 % copy with about 15 pages index.\footnote{It took quite a long time
943 % and the resulting \texttt{.idx} file was longer than the
944 % \texttt{.dvi} file. Actually too long to be handled by the
945 % \textsf{makeindex} program directly (on our MicroVAX) but the final
946 % result was worth the trouble.}
948 % \changes{v2.1d}{2006/02/02}{Corrected description of \cs{changes}
950 % \DescribeMacro\changes
951 % To maintain a change history within the file, the |\changes|
952 % command may be placed amongst the description part of the changed
953 % code. It takes three arguments, thus:
955 % |\changes{|\meta{version}|}{|\meta{date}|}{|^^A
958 % The changes may be used to produce an auxiliary file (\LaTeX's
959 % |\glossary| mechanism is used for this) which may be printed
960 % after suitable formatting. The |\changes| macro generates the
961 % printed entry in such a change history; because old
962 % versions\footnote{Before 2.6.} of the \textsf{makeindex}
963 % program limit such fields to 64 characters, care should be taken
964 % not to exceed this limit when describing the change. The actual
965 % entry consists of the \meta{version}, the |\actualchar|, the current
966 % macro name, a colon, the |\levelchar|, and, finally, the \meta{text}.
967 % The result is a glossaryentry for the \meta{version}, with the name of
968 % the current macro as subitem. Outside the |macro| environment, the
969 % text |\generalname| is used instead of the macro name. When
970 % referring to macros in change descriptions it is conventional to use
971 % |\cs{|\meta{macroname}|}| rather than attempting to format it properly
972 % and using up valuable characters in the entry with old \textsf{makeindex}
975 % \changes{v1.7a}{1992/02/26}{Description of \cs{RecordChanges} etc.
977 % to interface section.} \DescribeMacro\RecordChanges To cause the
978 % change information to be written out, include "\RecordChanges" in
979 % the driver file. \DescribeMacro\PrintChanges To read in and print
980 % the sorted change history (in two columns), just put the
981 % |\PrintChanges| command as the last (commented-out, and thus
982 % executed during the documentation pass through the file) command in
983 % your package file. Alternatively, this command may form one of the
984 % arguments of the |\StopEventually| command, although a change
985 % history is probably {\em not\/} required if only the description is
986 % being printed. The command assumes that \textsf{makeindex} or some
987 % other program has processed the \texttt{.glo} file to generate a
988 % sorted \texttt{.gls} file. You need a special \textsf{makeindex}
989 % style file; a suitable one is supplied with \DOC{}, called
990 % \texttt{gglo.ist}. \DescribeMacro\GlossaryMin
991 % \DescribeMacro\GlossaryPrologue \DescribeMacro\GlossaryParms The
992 % "\GlossaryMin", "\GlossaryPrologue" and "\GlossaryParms" macros are
993 % analagous to the "\Index"\ldots\ versions. (The \LaTeX{} `glossary'
994 % mechanism is used for the change entries.)
996 % \label{sec:checksum}
997 % \DescribeMacro\CharacterTable
998 % \DescribeMacro\CheckSum
999 % To overcome some of the problems of sending files over the networks
1000 % we developed two macros which should detect corrupted files. If one
1003 % \small\ttfamily ^^A \ttfamily to get the blanks between "..."s
1005 %"%%\CharacterTable"\\
1007 %"\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"\\
1009 %"\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"\\
1010 %"%% Digits \0\1\2\3\4\5\6\7\8\9"\\
1011 %"%% Exclamation \! Double quote "\verb=\"=
1012 %" Hash (number) \#"\\
1013 %"%% Dollar \$ Percent \% Ampersand \&"\\
1014 %"%% Acute accent \' Left paren \( Right paren \)"\\
1015 %"%% Asterisk \* Plus \+ Comma \,"\\
1016 %"%% Minus \- Point \. Solidus \/"\\
1017 %"%% Colon \: Semicolon \; Less than \<"\\
1018 %"%% Equals \= Greater than \> Question mark \?"\\
1019 %"%% Commercial at \@ Left bracket \[ Backslash \\"\\
1020 %"%% Right bracket \] Circumflex \^ Underscore \_"\\
1021 %"%% Grave accent \` Left brace \{ Vertical bar \|"\\
1022 %"%% Right brace \} Tilde \~}"\\
1025 % at the beginning of the file then character translation failures
1026 % will be detected, provided of course, that the used \DOC{}
1027 % package has a correct default table. The percent
1028 % signs\footnote{There are two percent signs in each line. This has
1029 % the effect that these lines are not removed by the
1030 % \texttt{docstrip.tex} program.} at the beginning of the lines should
1031 % be typed in, since only the \DOC{} package should look at this
1035 % Another problem of mailing files is possible truncation. To detect
1036 % these sort of errors we provide a |\CheckSum| macro. The check-sum
1037 % of a file is simply the number of backslashes in the code, i.e.\ all
1038 % lines between the \textsf{macrocode} environments. But don't be
1039 % afraid: you don't have count the code-lines yourself; this is done
1040 % by the \DOC{} package for you. You simply have add
1044 % near the beginning of the file and
1046 % the |\StopEventually| (which starts looking for backslashes) and the
1047 % |\Finale| command. The latter will inform you either that your file
1048 % has no check-sum (telling you the right number) or that your number
1049 % is incorrect if you put in anything other than zero but guessed wrong (this time
1050 % telling you both the correct and the
1051 % incorrect one). Then you go to the top of your file again and change the
1052 % line to the right number, i.e.
1055 % |% \CheckSum{|\meta{number}|}|
1059 % While |\CharacterTable| and |\CheckSum| have been important features
1060 % in the early days of the public internet when \DOC{} was written as
1061 % the mail gateways back then were rather unreliable and often mangled
1062 % files they are these days more a nuicance than any help. They are
1063 % therefore now fully optional and no longer recommended for use with new files.
1066 % \DescribeMacro\bslash
1067 % From time to time, it is necessary to print a |\| without
1068 % being able to use the |\verb| command because the
1069 % |\catcode|$\,$s of the symbols are already firmly
1070 % established. In this instance we can use the command
1071 % |\bslash| presupposing, of course, that the actual font in
1072 % use at this point contains a `backslash' as a symbol. Note that
1073 % this definition of |\bslash| is expandable; it inserts a
1074 % $"\"_{12}$. This means that you have to |\protect|
1075 % it if it is used in `moving arguments'.
1077 % \DescribeMacro\MakePrivateLetters
1078 % \changes{v1.7a}{1992/02/26}{Documented \cs{MakePrivateLetters} in
1079 % interface section}^^A
1080 % If your macros "\catcode" anything other than "@" to `letter', you
1081 % should redefine "\MakePrivateLetters" so that it also makes the
1082 % relevant characters `letters' for the benefit of the indexing. The
1083 % default definition is just "\makeatletter".
1085 % \DescribeMacro\DontCheckModules \DescribeMacro\CheckModules
1086 % \DescribeMacro\Module \DescribeMacro\AltMacroFont The `module'
1087 % directives of the \textsf{docstrip} system \cite{art:docstrip} are
1088 % normally recognised and invoke special formatting. This can be
1089 % turned on and off in the \texttt{.dtx} file or the driver file using
1090 % "\CheckModules" and "\DontCheckModules". If checking for module
1091 % directives is on (the default) then code in the scope of the
1092 % directives is set as determined by the hook "\AltMacroFont", which
1093 % gives {\small\ttfamily\itshape small italic type\-writer\/} by
1094 % default in the New Font Selection Scheme but just ordinary
1095 % {\small\ttfamily small type\-writer} in the old one, where a font
1096 % such as italic typewriter can't be used portably (plug for NFSS);
1097 % you will need to override this if you don't have the italic
1098 % typewriter font available. Code is in such a scope if it's on a
1099 % line beginning with "%<" or is between lines starting with
1100 % "%<*"\meta{name list}">" and "%</"\meta{name list}">". The
1101 % directive is formatted by the macro "\Module" whose single argument
1102 % is the text of the directive between, but not including, the angle
1103 % brackets; this macro may be re-defined in the driver or package file
1104 % and by default produces results like \Module{+foo\string|bar} with no
1107 % \DescribeMacro{StandardModuleDepth} Sometimes (as in this file) the
1108 % whole code is surrounded by modules to produce several files from a
1109 % single source. In this case it is clearly not appropriate to format
1110 % all code lines in a special "\AltMacroFont". For this reason a
1111 % counter "StandardModuleDepth" is provided which defines the level of
1112 % module nesting which is still supposed to be formatted in
1113 % "\MacroFont" rather then "\AltMacroFont". The default setting is
1114 % "0", for this documentation it was set to
1116 % \setcounter{StandardModuleDepth}{1}
1118 % at the beginning of the file.
1121 % \subsection{Basic usage summary}
1122 % \changes{v1.7a}{1992/03/11}{Added basic usage summary to spell
1125 % To sum up, the basic structure of a \texttt{.dtx} file without any
1126 % refinements is like this:
1127 % \begin{verse}\small
1128 % "% "\meta{waffle}\ldots\\
1130 % "% \DescribeMacro{\fred}"\\
1131 % "% "\meta{description of fred's use}\\
1133 % "% \StopEventually{"\meta{finale code}"}"\\
1135 % "% \begin{macro}{\fred}"\\
1136 % "% "\meta{commentary on macro fred}\\
1137 % \verb*+% \begin{macrocode}+\\
1138 % \meta{code for macro fred}\\
1139 % \verb*+% \end{macrocode}+\\
1142 % "% \Finale \PrintIndex \PrintChanges"
1144 % For examples of the use of most---if not all---of the features
1145 % described above consult the \texttt{doc.dtx} source itself.
1147 % \subsection{Acknowledgements}
1149 % I would like to thank all folks at Mainz and at the Royal Military
1150 % College of Science for their help in this project. Especially Brian
1151 % and Rainer who pushed everything with their suggestions, bug fixes,
1154 % A big thank you to David Love who brought the documentation
1155 % up-to-date again, after I neglected this file for more than two
1156 % years. This was most certainly a tough job as many features added to
1157 % \texttt{doc.dtx} after its publication in \textsl{TUGboat\/} have
1158 % been never properly described. Beside this splendid work he kindly
1159 % provided additional code (like ``docstrip'' module formatting) which
1160 % I think every \textsf{doc.dtx} user will be grateful for.
1164 % \begin{thebibliography}{1}
1165 % \bibitem{book:Buerger} \textsc{G. A. B\"urger}.
1166 % \newblock Wunderbare Reisen zu Wasser und zu Lande, Feldz\"uge
1167 % und lustige Abenteuer des Freyherrn v.\ M\"unchhausen.
1168 % \newblock London, 1786 \& 1788.
1169 % \bibitem{art:Knuthliterat} \textsc{D. E. Knuth}.
1170 % \newblock Literate Programming.
1171 % \newblock Computer Journal, Vol.~27, \textit{pp}.~97--111,
1173 % \bibitem{book:KnuthA} \textsc{D. E. Knuth}.
1174 % \newblock Computers \& Typesetting (The \TeX book).
1175 % \newblock Addison-Wesley, Vol. A, 1986.
1176 % \bibitem{art:Chen} \textsc{L. Lamport}.
1177 % \newblock MakeIndex: An Index Processor for \LaTeX.
1178 % \newblock 17 February 1987.
1179 % \newblock (Taken from the file \texttt{makeindex.tex} provided
1181 % the program source code.)
1182 % \bibitem{art:doc} \textsc{Frank Mittelbach}.
1183 % \newblock The \DOC{}-option.
1184 % \newblock \textsl{TUGboat}, Vol.~10(2), \textit{pp}.~245--273,
1186 % \bibitem{art:docstrip} \textsc{Frank Mittelbach, Denys Duchier and
1188 % \newblock \texttt{docstrip.dtx} (to appear).
1189 % \newblock The file is part of the DOC package.
1190 % \bibitem{book:Raspe} \textsc{R. E. Raspe} (*1737, \dag 1797).
1191 % \newblock Baron M\"unchhausens narrative of his marvellous
1192 % travels and campaigns in Russia.
1193 % \newblock Oxford, 1785.
1194 % \bibitem{art:verbatim} \textsc{Rainer Sch\"opf}.
1195 % \newblock A New Implementation of \LaTeX's \texttt{verbatim} and
1196 % \texttt{verbatim*} Environments.
1197 % \newblock File \texttt{verbatim.doc}, version 1.4i.
1198 % \end{thebibliography}
1201 % \addtocontents{toc}{\protect\end{multicols}}
1204 % } ^^A end \StopEventually
1207 % \section{The Description of Macros}
1209 % Most of the following code is destined for \texttt{doc.sty} after
1210 % processing with \texttt{docstrip} to include the module
1211 % \textbf{style} indicated here. (All code in this file not
1212 % appropriate to \texttt{doc.sty} has to be included explicitly by
1213 % docstrip so that this \texttt{.dtx} file can be used as directly as
1214 % a package file rather than the stripped version.) The usual font
1215 % change for the conditionally-included lines between the
1216 % \Module{*style} and \Module{/style} directives is suppressed since
1217 % only the lines with an explicit directive are special in this file.
1221 % Under \LaTeXe{} the test to avoid reading
1222 % \DOC{} in twice is normally unnecessary. It was kept to only to
1223 % stay compatible with \LaTeX209 styles that |\input| \DOC{}
1225 % \changes{v1.5i}{1989/06/07}{Avoid reading the file twice.}
1227 \@ifundefined{macro@cnt}{}{\endinput}
1230 % \DescribeMacro\fileversion
1231 % \DescribeMacro\filedate
1232 % \DescribeMacro\docdate
1233 % As you can see I used macros like |\fileversion| to denote the
1234 % version number and the date. They are defined at the very beginning
1235 % of the package file (without a surrounding \textsf{macrocode}
1236 % environment), so I don't have to search for this place here when I
1237 % change the version number. You can see their actual outcome in a
1238 % footnote to the title.
1241 % The first thing that we do next is to get ourselves a new comment
1242 % sign. Because all sensible signs are already occupied, we will
1243 % choose one that can only be entered indirectly:
1244 % {\DoNotIndex{\^}^^A avoid misinterpretation !!!!! VERIFY
1248 % We repeat this statement at the beginning of the document in case
1249 % the \texttt{inputenc} package is used disabling it again.
1250 % \changes{v2.0b}{1998/05/19}{Init docs private comment char at begin
1251 % of document again (pr2581)}
1253 \AtBeginDocument{\catcode`\^^A=14\relax}
1255 % \SortIndex{\string^\string^A}{\string\verb\verbatimchar
1256 % \string^\string^A\verbatimchar
1261 % \subsection{Options supported by \DOC{}}
1263 % Not options available at the moment
1269 % \subsection{Macros surrounding the `definition parts'}
1271 % \begin{environment}{macrocode}
1272 % Parts of the macro definition will be surrounded by the
1273 % environment \textsf{macrocode}. Put more precisely, they will be
1274 % enclosed by a macro whose argument (the text to be set
1275 % `verbatim') is terminated by the string
1276 % \verb*+% \end{macrocode}+. Carefully note the number of spaces.
1277 % |\macrocode| is defined completely analogously to
1278 % |\verbatim|, but because a few small changes were carried
1279 % out, almost all internal macros have got new names. We start by
1280 % calling the macro |\macro@code|, the macro which bears the
1281 % brunt of most of the work, such as |\catcode| reassignments,
1283 % \changes{v1.5r}{1989/11/04}{Support for code line no. (Undoc)}
1285 \def\macrocode{\macro@code
1287 % Then we take care that all spaces have the same width, and that
1288 % they are not discarded.
1290 \frenchspacing \@vobeyspaces
1292 % Before closing, we need to call |\xmacro@code|. It is this
1293 % macro that expects an argument which is terminated by the above
1294 % string. This way it is possible to keep the |\catcode|
1296 % \changes{v1.5r}{1989/11/04}{Support for code line no. (Undoc)}
1297 % \changes{v1.5t}{1989/11/07}{Common code moved to \cs{macro@code}.}
1304 % \begin{macro}{\macro@code}
1305 % We will now begin with the macro that does the actual work:
1309 % In theory it should consist of a \textsf{trivlist} environment, but
1310 % the empty space before and after the environment should not be
1313 \topsep \MacrocodeTopsep
1315 % The next parameter we set is |\@beginparpenalty|, in order
1316 % to prevent a page break before such an environment.
1318 \@beginparpenalty \predisplaypenalty
1320 % We then start a |\trivlist|, set |\parskip| back to
1321 % zero and start an empty |\item|.
1322 % \changes{v1.9b}{1993/12/03}{Forcing any label from macro env.}
1324 \if@inlabel\leavevmode\fi
1325 \trivlist \parskip \z@ \item[]%
1327 % Additionally, everything should be set in \texttt{typewriter} font.
1328 % Some people might prefer it somewhat differently; because of this
1329 % the font choice is
1330 % macro-driven.\footnote{The font change has to be placed
1332 % the \texttt{\bslash item}. Otherwise a change to
1333 % \texttt{\bslash baselineskip} will affect the
1338 % Because |\item| sets various parameters, we have found it
1339 % necessary to alter some of these retrospectively.
1341 \leftskip\@totalleftmargin \advance\leftskip\MacroIndent
1342 \rightskip\z@ \parindent\z@ \parfillskip\@flushglue
1344 % The next line consists of the \LaTeX{} definition of |\par|
1345 % used in |\verbatim| and should result in blank lines being
1346 % shown as blank lines.
1347 % \changes{v1.5l}{1989/09/10}{Code line numbers supported.}
1348 % \changes{v1.5t}{1989/11/07}{Call \cs{leavevmode} to get \cs{everypar}
1350 % \changes{v1.7c}{1992/3/24}{Added \cs{interlinepenalty} to
1354 \blank@linefalse \def\par{\ifblank@line
1356 \blank@linetrue\@@par
1357 \penalty\interlinepenalty}
1359 % What use is this definition of |\par|\,? We use the macro
1360 % |\obeylines| of \cite{book:KnuthA} which changes all |^^M|
1361 % to |\par| so that each can control its own indentation.
1362 % Next we must also ensure that all special signs are normalized;
1363 % that is, they must be given |\catcode| $12$.
1364 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
1365 % which handles more ligatures.}
1368 \let\do\do@noligs \verbatim@nolig@list
1369 \let\do\@makeother \dospecials
1371 % \changes{v1.5t}{1989/11/07}{Common code added.}
1372 % \changes{v1.5w}{1990/02/05}{Skip of \cs{@totalleftmargin} added.} If
1373 % indexing by code lines is switched on the line number is incremented
1374 % and set appropriately. We also check whether the start of the next
1375 % line indicates a \texttt{docstrip} module directive and process it
1376 % appropriately if so using "\check@module".
1378 \global\@newlistfalse
1379 \global\@minipagefalse
1381 \everypar{\global\advance\c@CodelineNo\@ne
1382 \llap{\theCodelineNo\ \hskip\@totalleftmargin}%
1384 \else \everypar{\check@module}%
1387 % We also initialize the cross-referencing feature by calling
1388 % |\init@crossref|. This will start the scanning mechanism
1389 % when encountering an escape character.
1396 % \begin{macro}{\ifblank@line}
1397 % \begin{macro}{\blank@linetrue}
1398 % \begin{macro}{\blank@linefalse}
1399 % |\ifblank@line| is the switch used in the definition above.
1400 % In the original \textsf{verbatim} environment the |\if@tempswa|
1401 % switch is used. This is dangerous because its value may change
1402 % while processing lines in the \textsf{macrocode} environment.
1410 % \begin{macro}{\endmacrocode}
1411 % Because we have begun a \textsf{trivlist} environment in the
1412 % \textsf{macrocode} environment, we must also end it. We must
1413 % also act on the value of the "pm@module" flag (see below) and
1414 % empty "\everypar".
1415 % \changes{v1.5r}{1989/11/04}{Support for code line no. (Undoc)}
1418 \ifpm@module \endgroup \pm@modulefalse \fi
1420 \global\@inlabelfalse
1423 % Additionally |\close@crossref| is used to do anything needed
1424 % to end the cross-referencing mechanism.
1431 % \begin{macro}{\MacroFont}
1432 % Here is the default definition for the |\MacroFont| macro.
1433 % With the new math font handling in NFSS2 it isn't any longer
1434 % correct to suppress the math font setup since this is now handled
1435 % differently. But to keep the font change fast we use only a
1436 % single |\selectfont| (in |\small|) and do the rest by hand.
1437 % \changes{v1.5x}{1990/02/17}{\cs{math@fontsfalse} added for NFSS.}
1438 % \changes{v1.7a}{1992/03/13}{Added \cs{reset@font} for NFSS.}
1439 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1440 % \changes{v1.9t}{1995/05/26}{Removed \cs{math@fontsfalse} (different
1441 % math setup /pr1622}
1443 \@ifundefined{MacroFont}{%
1446 % Despite the above statement we will call |\small| first if
1447 % somebody is using a \LaTeX2.09 document with doc. I wouldn't have
1448 % bothered since doc-sources should be up-to-date but since the
1449 % request came from someone called David Carlisle \ldots :-)
1450 % \changes{v1.9y}{1996/01/26}{Support compat mode}
1452 \def\MacroFont{\small
1453 \usefont\encodingdefault
1459 \def\MacroFont{\fontencoding\encodingdefault
1460 \fontfamily\ttdefault
1461 \fontseries\mddefault
1462 \fontshape\updefault
1469 % \begin{macro}{\AltMacroFont}
1470 % \begin{macro}{\macro@font}
1471 % \changes{v1.7a}{1992/03/12}{Added to support distinction of modules.}
1472 % \changes{v1.7c}{1992/03/26}{Altered font change for OFSS.}
1473 % \changes{v1.7m}{1992/10/11}{Use sltt as default.}
1474 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1475 % \changes{v1.9t}{1995/05/26}{Removed \cs{math@fontsfalse} (different
1476 % math setup /pr1622}
1477 % Although most of the macro code is set in "\MacroFont" we want to be
1478 % able to switch to indicate module code set in "\AltMacroFont".
1479 % "\macro@font" keeps track of which one we're using. We can't do the
1480 % same thing sensibly in OFSS as in NFSS.
1482 \@ifundefined{AltMacroFont}{%
1485 % Again have |\small| first if we are in compat mode.
1486 % \changes{v1.9y}{1996/01/26}{Support compat mode}
1488 \def\AltMacroFont{\small
1489 \usefont\encodingdefault
1495 \def\AltMacroFont{\fontencoding\encodingdefault
1496 \fontfamily\ttdefault
1497 \fontseries\mddefault
1498 \fontshape\sldefault
1504 % To allow changing the "\MacroFont" in the preamble we defer
1505 % defining the internally used "\macro@font" until after the
1507 % \changes{v2.0a}{1998/05/16}{Support changing \cs{MacroFont} in
1510 \AtBeginDocument{\let\macro@font\MacroFont}
1515 % \begin{macro}{\check@module}
1516 % \begin{macro}{\ifpm@module}
1517 % \changes{v1.7a}{1992/03/12}{Added.}
1518 % This is inserted by "\everypar" at the start of each macrocode line to
1519 % check whether it starts with module information. (Such information is
1520 % of the form "%<"\meta{switch}">", where the "%" must be at the
1521 % start of the line and \meta{switch} comprises names with various
1522 % possible separators and a possible leading "+", "-", "*" or "/"
1523 % \cite{art:docstrip}. All that concerns us here is what the first
1524 % character of \meta{switch} is.) First it checks the "pm@module"
1525 % flag in case the previous line had a non-block module
1526 % directive i.e., not "%<*" or "%</"; if it did we need to close the
1527 % group it started and unset the flag. "\check@module" looks ahead at
1528 % the next token and then calls "\ch@percent" to take action depending
1529 % on whether or not it's a "%"; we don't want to expand the token at
1530 % this stage. This is all done conditionally so it can be turned off
1531 % if it causes problems with code that wasn't designed to be
1532 % \texttt{docstrip}ped.
1536 \ifpm@module \endgroup \pm@modulefalse \fi
1537 \expandafter\futurelet\expandafter\next\expandafter\ch@percent
1543 % \begin{macro}{\DontCheckModules}
1544 % \begin{macro}{\CheckModules}
1545 % \changes{v1.7a}{1992/03/12}{Added.}
1546 % \begin{macro}{\ifcheck@modules}
1547 % Here are two driver-file interface macros for turning the module
1548 % checking on and off using the "check@modules" switch.
1550 \def\DontCheckModules{\check@modulesfalse}
1551 \def\CheckModules{\check@modulestrue}
1552 \newif\ifcheck@modules \check@modulestrue
1557 % \begin{macro}{\ch@percent}
1558 % \changes{v1.7a}{1992/03/12}{Added.}
1559 % If the lookahead token in "\next" is $"%"_{12}$ we go on to check
1560 % whether the following one is "<" and otherwise do nothing. Note the
1561 % "\expandafter" to get past the "\fi".
1564 \if \percentchar\next
1565 \expandafter\check@angle
1570 % \begin{macro}{\check@angle}
1571 % \changes{v1.7a}{1992/03/12}{Added.}
1572 % Before looking ahead for the "<" the "%" is gobbled by the
1575 \def\check@angle#1{\futurelet\next\ch@angle}
1578 % \begin{macro}{\ch@angle}
1579 % \changes{v1.7a}{1992/03/12}{Added.}
1580 % \changes{v1.9k}{1994/02/22}{Have \texttt{<} active}
1581 % If the current lookahead token is "<" we are defined to be
1582 % processing a module directive can go on to look for "+" etc.;
1583 % otherwise we must put back the gobbled "%". With \LaTeXe{}
1584 % \texttt{<} is active so we have to be a bit careful.
1588 \gdef\ch@angle{\ifx<\next
1589 \expandafter\ch@plus@etc
1590 \else \percentchar \fi}
1594 % \begin{macro}{\ch@plus@etc}
1595 % \begin{macro}{\check@plus@etc}
1596 % \changes{v1.7a}{1992/03/12}{Added.}
1597 % We now have to decide what sort of a directive we're dealing with
1598 % and do the right thing with it.
1600 \gdef\ch@plus@etc<{\futurelet\next\check@plus@etc}
1601 \gdef\check@plus@etc{%
1607 \let\next\star@module
1609 \let\next\slash@module
1611 % At some point in the past the \texttt{docstrip} program was
1612 % partly rewritten and at that time it also got support for a very
1613 % special directive of the form |%<<| followed by an arbitrary
1614 % string. This is used for ``verbatim'' inclusion in case of
1615 % certain problem. We do not really attempt to pretty print that
1616 % case but we need at least account for it since otherwise we get
1617 % an error message since this is the only case where we will not
1618 % have a closing |>|.
1619 % \changes{v2.0n}{2001/05/16}{Partly support docstrip's ``verbatim''
1620 % directive (pr/3331)}
1632 % \begin{macro}{\pm@module}
1633 % If we're not dealing with a block
1634 % directive ("*" or "/") i.e., it's a single special line, we set
1635 % everything up to the next ">" appropriately and then change to the
1636 % special macro font inside a group which will be ended at the start
1637 % of the next line. If the apparent module directive is missing the
1638 % terminating ">" this will lose, but then so will the \texttt{docstrip}
1639 % implementation. An alternative strategy would be to have
1640 % "\pm@module" make ">" active and clear a flag set here to indicate
1641 % processing the directive. Appropriate action could then be taken if
1642 % the flag was found still to be set when processing the next line.
1643 % \changes{v1.7a}{1992/03/12}{Added.}
1644 % \changes{v1.7i}{1992/07/11}{Support for fonts depending on nesting.}
1649 \lowercase{\gdef\pm@module#1~}{\pm@moduletrue
1650 \Module{#1}\begingroup
1652 % We switch to a special font as soon the nesting is higher than
1653 % the current value of "\c@StandardModuleDepth". We do a local
1654 % update to the "\guard@level" here which will be restored after
1655 % the current input line.
1657 \advance\guard@level\@ne
1658 \ifnum\guard@level>\c@StandardModuleDepth\AltMacroFont\fi
1662 % \begin{macro}{\star@module}
1663 % \begin{macro}{\slash@module}
1664 % \changes{v1.7a}{1992/03/12}{Added.}
1665 % \changes{v1.7f}{1992/05/16}{Take account of nested guards.}
1666 % \changes{v1.7i}{1992/07/11}{Add counter to determine when to switch to
1668 % If the start or end of a module {\em block\/} is indicated, after
1669 % setting the guard we have to check whether a change in the macrocode
1670 % font should be done. This will be the case if we are already inside
1671 % a block or are ending the outermost block. If so, we globally
1672 % toggle the font for subsequent macrocode sections between the normal
1673 % and special form, switching to the new one immediately.
1674 % \changes{v1.7i}{1992/07/17}{Support for fonts depending on module
1677 \lowercase{\gdef\star@module#1~}{%
1679 \global \advance \guard@level\@ne
1680 \ifnum \guard@level>\c@StandardModuleDepth
1681 \global\let\macro@font=\AltMacroFont \macro@font
1684 \gdef\slash@module#1>{%
1686 \global \advance \guard@level\m@ne
1687 \ifnum \guard@level=\c@StandardModuleDepth
1688 \global\let\macro@font\MacroFont \macro@font
1697 % \begin{macro}{\c@StandardModuleDepth}
1698 % \changes{v1.7i}{1992/07/11}{Counter added.}
1699 % Counter defining up to which level modules are considered part of
1700 % the main code. If, for example, the whole code is surrounded by
1701 % a |%<*package>| module we better set this counter to |1| to avoid
1702 % getting the whole code be displayed in typewriter italic.
1704 \newcounter{StandardModuleDepth}
1709 % \begin{macro}{\guard@level}
1710 % \changes{v1.7f}{1992/05/16}{Added.}
1711 % We need a counter to keep track of the guard nesting.
1713 \newcount \guard@level
1716 % \begin{macro}{\Module}
1717 % \changes{v1.7a}{1992/03/12}{Added.}
1718 % \changes{v1.7d}{1992/04/25}{Use sans font for modules.}
1719 % This provides a hook to determine the way the module directive is
1720 % set. It gets as argument everything between the angle brackets.
1721 % The default is to set the contents in sans serif text between
1722 % $\langle\,\rangle$ with the special characters suitably "\mathcode"d
1723 % by "\mod@math@codes". (You can't just set it in a sans text font
1724 % because normally "|" will print as an em-dash.) This is done
1725 % differently depending on whether we have the NFSS or the old one. In
1726 % the latter case we can easily change "\fam" appropriately.
1727 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1729 \@ifundefined{Module}{%
1731 % With NFSS what we probably {\em should\/} do is change to a new
1732 % "\mathversion" but I (Dave Love) haven't spotted an easy way to
1733 % do so correctly if the document uses a version other than
1734 % "normal". (We need to know in what font to set the other
1735 % groups.) This uses a new math alphabet rather than version and
1736 % consequently has to worry about whether we're using
1737 % \textsf{oldlfnt} or not. I expect there's a better
1740 \def\Module#1{\mod@math@codes$\langle\mathsf{#1}\rangle$}
1745 % \begin{macro}{\mod@math@codes}
1746 % \changes{v1.7c}{1992/03/26}{Added.}
1747 % \changes{v2.1e}{2010/02/04}{Added mathcodes for +,-,:, and = (pr/4096)}
1748 % As well as `words', the module
1749 % directive text might contain any of the characters "*/+-,&|!()"
1750 % for the current version of \textsf{docstrip}. We only need
1751 % special action for two of them in the math code changing required
1752 % above: "|" is changed to a "\mathop" (it's normally |"026A|) and
1753 % "&" is also made a "\mathop", but in family 0. Remember that "&"
1754 % will not have a special catcode when it's encountered.
1756 \def\mod@math@codes{\mathcode`\|="226A \mathcode`\&="2026
1757 \mathcode`\-="702D \mathcode`\+="702B
1758 \mathcode`\:="703A \mathcode`\=="703D }
1762 % \begin{macro}{\mathsf}
1763 % \changes{v1.7c}{1992/03/26}{Added.}
1764 % \changes{v1.7d}{1992/04/25}{Use sans font for modules.}
1765 % \changes{v1.7n}{1993/02/21}{\cs{sfmath} Renamed to \cs{mathsf}.}
1766 % \changes{v1.8c}{1993/10/25}{NFSS standard}
1767 % If NFSS is in use we need a new math alphabet which uses a sans serif
1768 % font. To support both the release one and two of NFSS the alphabet
1769 % was renamed to "\mathsf" which is defined in NFSS2.
1771 %\ifx\selectfont\undefined
1773 % \ifx\mathsf\undefined
1774 % \newmathalphabet*{\mathsf}{\sfdefault}{m}{n}\fi
1781 % \begin{macro}{\MacrocodeTopsep}
1782 % \begin{macro}{\MacroIndent}
1783 % In the code above, we have used two registers. Therefore we have
1784 % to allocate them. The default values might be overwritten with
1785 % the help of the |\DocstyleParms| macro.
1786 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
1787 % \changes{v1.5y}{1990/02/24}{Default changed.}
1788 % \changes{v1.6b}{1990/06/15}{\cs{rm} moved before \cs{scriptsize} to
1789 % avoid unnecessary fontwarning.}
1791 \newskip\MacrocodeTopsep \MacrocodeTopsep = 3pt plus 1.2pt minus 1pt
1792 \newdimen\MacroIndent
1793 \settowidth\MacroIndent{\rmfamily\scriptsize 00\ }
1801 % \begin{environment}{macrocode*}
1802 % \begin{macro}{\endmacrocode*}
1803 % Just as in the \textsf{verbatim} environment, there is also a
1804 % `star' variant of the \textsf{macrocode} environment in which a
1805 % space is shown by the symbol \verb*+ +. Until this moment, I
1806 % have not yet used it (it will be used in the description of the
1807 % definition of |\xmacro@code| below) but it's exactly on this one
1808 % occasion {\em here\/} that you can't use it (cf.\ M\"unchhausens
1809 % Marsh problem)\footnote{Karl Friedrich Hieronymus Frhr.\ v.\
1810 % M\"unchhausen (*1720, \dag1797). Several books were written
1811 % about fantastic adventures supposedly told by him (see
1812 % \cite{book:Raspe} or \cite{book:Buerger}). In one story he
1813 % escaped from the marsh by pulling himself out by his hair.}
1814 % directly. Because of this, on this one occasion we'll cheat
1815 % around the problem with an additional comment character. But now
1816 % back to |\macrocode*|. We start with the macro |\macro@code|
1817 % which prepares everything and then call the macro |\sxmacro@code|
1818 % whose argument is terminated by the string
1819 %\verb*+% \end{macrocode*}+.
1821 \@namedef{macrocode*}{\macro@code\sxmacro@code}
1823 % As we know, |\sxmacro@code| and then |\end{macrocode*}|
1824 % (the macro, not the string), will be executed, so that for a
1825 % happy ending we still need to define the macro
1828 \expandafter\let\csname endmacrocode*\endcsname = \endmacrocode
1839 % \begin{macro}{\xmacro@code}
1840 \catcode`\!=\catcode`\% ^^A In this section there must not be
1841 ^^A any exclamation marks.
1843 % As already mentioned, the macro |\xmacro@code| expects an
1844 % argument delimited by the string \verb*+% \end{macrocode}+. At
1845 % the moment that this macro is called, the |\catcode| of
1846 % \TeX's special characters are 12 (`other') or 13 (`active').
1847 % Because of this we need to utilize a different escape character
1848 % during the definition. This happens locally.
1849 % \begin{macrocode*}
1851 \catcode`\|=\z@ \catcode`\[=\@ne \catcode`\]=\tw@
1853 % Additionally, we need to ensure that the symbols in the above
1854 % string contain the |\catcode|$\,$s which are available
1855 % within the \textsf{macrocode} environment.
1856 % \begin{macrocode*}
1857 \catcode`\{=12 \catcode`\}=12
1858 \catcode`\%=12 \catcode`\ =\active \catcode`\\=\active
1860 ! Next follows the actual definition of |\macro@code|;
1862 ! use of the new escape character. We manage to get the argument
1863 ! surrounded by the string |\end{macrocode}|, but at the end
1864 ! however, in spite of the actual characters used during the
1866 ! this macro, |\end| with the argument |{macrocode}|
1867 ! will be executed, to ensure a balanced environment.
1868 ! \begin{macrocode*}
1869 |gdef|xmacro@code#1% \end{macrocode}[#1|end[macrocode]]
1871 ! \begin{macro}{\sxmacro@code}
1872 ! The definition of |\sxmacro@code| is completely analogous,
1874 ! here a slightly different terminating string will be used.
1875 ! Note that the space is not active in this environment.
1878 |gdef|sxmacro@code#1% \end{macrocode*}[#1|end[macrocode*]]
1880 ! because the |\catcode| changes have been made local by
1882 ! new group, there now follows the matching |\endgroup|
1884 ! unusual style of writing.
1895 % \subsection{Macros for the `documentation parts'}
1898 % \begin{macro}{\DescribeMacro}
1899 % \begin{macro}{\Describe@Macro}
1900 % \changes{v1.5v}{1990/01/28}{Macro added.}
1901 % \changes{v1.5j}{1989/06/09}{\cs{ignorespaces} added as a temporary
1903 % \begin{macro}{\DescribeEnv}
1904 % \begin{macro}{\Describe@Env}
1905 % \changes{v1.5v}{1990/01/28}{Macro added.}
1906 % \changes{v1.5j}{1989/06/09}{\cs{ignorespaces} added as a temporary
1908 % The |\DescribeMacro| and |\DescribeEnv| macros should
1909 % print their arguments in the margin and produce an index entry.
1910 % We simply use |\marginpar| to get the desired result. This
1911 % is however not the best solution because the labels might be
1912 % slightly misplaced. One also might get a lot of `marginpar moved'
1913 % messages which are hard-wired into the \LaTeX{} output
1914 % routine.\footnote{It might be better to change these macros into
1915 % environments like the \textsf{macro} environment.} First we change
1916 % to horizontal mode if necessary. The \LaTeX{} macros
1917 % |\@bsphack| and |\@esphack| are used to make those
1918 % commands invisible (i.e.\ to normalize the surrounding space and
1919 % to make the |\spacefactor| transparent).
1920 % \changes{v1.5v}{1990/01/28}{\cs{MakePrivateLetters} added.}
1922 \def\DescribeMacro{\leavevmode\@bsphack
1924 % When documenting the code for the \texttt{amstex.sty} option we
1925 % encountered a bug: the |\catcode| of |@| was active and
1926 % therefore couldn't be used in command names. So we first have to
1927 % make sure that we get all |\catcode|s right by calling
1928 % |\MakePrivateLetters| inside a group. Then we call
1929 % |\Describe@Macro| to do the work.
1930 % \changes{v2.0g}{1999/03/22}{Parse backslash as letter in argument
1931 % to \cs{DescribeMacro}.}
1932 % \changes{v2.0h}{1999/03/25}{Correct errors introduced in v2.0g.}
1934 \begingroup\MakePrivateLetters\Describe@Macro}
1935 \def\Describe@Macro#1{\endgroup
1936 \marginpar{\raggedleft\PrintDescribeMacro{#1}}%
1938 % Note the use of |\raggedleft| to place the output flushed
1939 % right. Finally we call a macro which produces the actual index
1940 % entry and finish with |\@esphack| to leave no
1941 % trace.\footnote{The whole mechanism won't work because
1942 % of the \texttt{\bslash leavevmode} in front.
1943 % As a temporary change \texttt{\bslash ignorespaces}
1946 \SpecialUsageIndex{#1}\@esphack\ignorespaces}
1948 % The |\DescribeEnv| macro is completely analogous.
1949 % \changes{v1.5v}{1990/01/28}{\cs{MakePrivateLetters} added.}
1951 \def\DescribeEnv{\leavevmode\@bsphack\begingroup\MakePrivateLetters
1953 \def\Describe@Env#1{\endgroup
1954 \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
1955 \SpecialEnvIndex{#1}\@esphack\ignorespaces}
1957 % To put the labels in the left margin we have to use the
1958 % |\reversemarginpar| declaration. (This means that the
1959 % \texttt{doc.sty} can't be used with all classes or packages.)
1961 % make the |\marginparpush| zero and |\marginparwidth| suitably
1963 % \changes{v1.5d}{1989/4/28}{\cs{marginparwidth} setting added.}
1966 \setlength\marginparpush{0pt} \setlength\marginparwidth{8pc}
1973 % \begin{macro}{\bslash}
1974 % \changes{v1.7a}{1992/02/26}{Moved \cs{bslash} documentation to `user
1976 % We start a new group in which to hide the alteration of
1977 % |\catcode|$\,$s, and make \verb+|+ introduce commands,
1978 % whilst |\| becomes an `other' character.
1981 {\catcode`\|=\z@ \catcode`\\=12
1983 % Now we are able to define |\bslash| (globally) to generate a
1984 % backslash of |\catcode| `other'. We then close this group,
1985 % restoring original |\catcode|$\,$s.
1986 % \SpecialEscapechar{\|}
1994 % \begin{environment}{verbatim}
1995 % \begin{environment}{verbatim*}
1996 % \changes{v1.7i}{1992/07/12}{Added changed definition for verbatim!*.}
1997 % The \textsf{verbatim} environment holds no secrets; it consists of
1998 % the normal \LaTeX{} environment. We also set the
1999 % |\@beginparpenalty| and change to the font given by
2002 \def\verbatim{\@beginparpenalty \predisplaypenalty \@verbatim
2003 \MacroFont \frenchspacing \@vobeyspaces \@xverbatim}
2005 % We deal in a similar way with the star form of this environment.
2007 \@namedef{verbatim*}{\@beginparpenalty \predisplaypenalty \@verbatim
2008 \MacroFont \@sxverbatim}
2013 % \begin{macro}{\@verbatim}
2014 % Additionally we redefine the |\@verbatim| macro so that it
2015 % suppresses |%| characters at the beginning of the line. The
2016 % first lines are copied literally from \texttt{latex.tex}.
2017 % \changes{v1.7i}{1992/07/12}{Added \cs{@@par} to clear possible
2020 \def\@verbatim{\trivlist \item[]\if@minipage\else\vskip\parskip\fi
2021 \leftskip\@totalleftmargin\rightskip\z@
2022 \parindent\z@\parfillskip\@flushglue\parskip\z@
2026 % |\@verbatim| sets |^^M|, the end of line character, to
2027 % be equal to |\par|. This control sequence is redefined
2028 % here; |\@@par| is the paragraph primitive of \TeX.
2029 % \changes{v1.7c}{1992/3/24}{Added \cs{interlinepenalty} to
2030 % \cs{par} from verbatim.sty}
2032 \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par
2033 \penalty\interlinepenalty
2035 % We add a control sequence |\check@percent| to the definition
2036 % of |\par| whose task it is to check for a percent character.
2040 % The rest is again copied literally from \texttt{latex.tex} (less
2042 % \changes{v1.7a}{1992/02/26}{Removed redundant \cs{tt}.}
2043 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
2044 % which handles more ligatures.}
2047 \let\do\do@noligs \verbatim@nolig@list
2048 \let\do\@makeother \dospecials}
2052 % \begin{macro}{\check@percent}
2053 % Finally we define |\check@percent|. Since this must compare a
2054 % character with a percent sign we must first (locally) change
2055 % percent's |\catcode| so that it is seen by \TeX. The definition
2056 % itself is nearly trivial: grab the following character, check if
2057 % it is a |%|, and insert it again if not. At the end of the
2058 % \textsf{verbatim} environment this macro will peek at the next
2059 % input line. In that case the argument to |\check@percent| might
2060 % be a |\par| or a macro with arguments. Therefore we make the
2061 % definition |\long| (|\par| allowed) and use the normal |\next|
2062 % mechanism to reinsert the argument after the |\fi| if necessary.
2063 % \changes{v1.5i}{1989/06/07}{Definition changed to `long'}
2064 % \changes{v1.5i}{1989/06/07}{Macro \cs{next} used to guard against
2065 % macro with arguments}
2066 % There is a subtle problem here, the equal sign between
2067 % |\next| and |#1| is actually necessary. Do you see why?
2068 % The omission of this token once caused a funny error.
2069 % \changes{v1.5u}{1989/11/14}{equal sign added.}
2072 \long\gdef\check@percent#1{\ifx #1%\let\next\@empty \else
2073 \let\next=#1\fi \next}}
2077 % \begin{macro}{\verb}
2078 % \changes{v1.7a}{1992/02/27}{Now warns about newlines (from
2079 % newdoc with `@noligs added).}
2080 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX \cs{verb}}
2081 % We re-define "\verb" to check for newlines in its argument since a
2082 % missing delimiter is difficult to detect in \DOC{} source.
2083 % The code is the same as in \texttt{latex.tex} of September 19, 1993.
2084 % Perhaps there should be a font-changing
2085 % hook rather than just using "\ttfamily", but if so it probably should be
2086 % different from "\MacroFont" since that normally includes "\small"
2087 % and would look wrong inline.
2088 % \changes{v1.7a}{1992/02/28}{Added math mode check (from verbatim.sty)}
2090 \def\verb{\relax\ifmmode\hbox\else\leavevmode\null\fi
2091 \bgroup \let\do\do@noligs \verbatim@nolig@list
2092 \ttfamily \verb@eol@error \let\do\@makeother \dospecials
2093 \@ifstar{\@sverb}{\@vobeyspaces \frenchspacing \@sverb}}
2097 % \begin{macro}{\verb@balance@group}
2098 % \begin{macro}{\verb@egroup}
2099 % \begin{macro}{\verb@eol@error}
2100 % \changes{v1.8b}{1993/09/21}{Renamed \cs{verb@err} to
2101 % \cs{verb@eol@error}, as in new LaTeX verbatim.}
2103 \let\verb@balance@group\@empty
2105 \def\verb@egroup{\global\let\verb@balance@group\@empty\egroup}
2109 \gdef\verb@eol@error{\obeylines%
2110 \def^^M{\verb@egroup\@latex@error{%
2111 Text for \noexpand\verb command ended by end of line}\@ehc}}%
2118 % \begin{macro}{\@sverb}
2119 % \changes{v1.7a}{1992/02/27}{Added for \cs{verb} change.}
2120 % \changes{v1.7a}{1992/02/28}{Now same as in verbatim.sty.}
2121 % \changes{v1.8b}{1993/09/21}{Changed to conform to new LaTeX verbatim,
2122 % which has better error trapping.}
2123 % See \cite{art:verbatim} for commentary.
2126 \catcode`#1\active \lccode`\~`#1%
2127 \gdef\verb@balance@group{\verb@egroup
2128 \@latex@error{Illegal use of \noexpand\verb command}\@ehc}%
2129 \aftergroup\verb@balance@group
2130 \lowercase{\let~\verb@egroup}}
2135 % \begin{macro}{\verbatim@nolig@list}
2136 % \begin{macro}{\do@noligs}
2137 % These macros replace the old "\@noligs" mechanism by an
2138 % extensible version to allow more ligatures to be added.
2140 \def\verbatim@nolig@list{\do\`\do\<\do\>\do\,\do\'\do\-}
2144 \lccode`\~=`#1\relax
2145 \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1}}}
2151 % \begin{macro}{\macro}
2152 % \begin{macro}{\m@cro@}
2153 % \changes{v1.5v}{1990/01/28}{\cs{macro@} renamed to \cs{m@cro@}
2155 % defines another macro of the same name.}
2156 % \begin{macro}{\macro@cnt}
2157 % \label{page:macro} The \textsf{macro} environment is implemented as
2158 % a \textsf{trivlist} environment, whereby in order that the macro
2159 % names can be placed under one another in the margin
2160 % (corresponding to the macro's nesting depth), the macro
2161 % |\makelabel| must be altered. In order to store the nesting
2162 % depth, we use a counter. We also need a counter to count the
2163 % number of nested \textsf{macro} environments.
2164 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2165 % \changes{v1.9k}{1994/02/22}{Fix probably no longer necessary}
2167 \newcount\macro@cnt \macro@cnt=0
2169 % The environment takes an argument---the macro name to be
2170 % described. Since this name may contain special `letters' we have
2171 % to re-|\catcode| them before scanning the argument. This is done
2172 % by the |\MakePrivateLetters| macro.
2173 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2174 % \changes{v1.7a}{1992/02/26}{Catcode backslash to other (from newdoc).}
2175 % \changes{v1.9k}{1994/02/22}{Don't omit extra group}
2177 \def\macro{\begingroup
2179 \MakePrivateLetters \m@cro@ \iftrue}
2182 % \begin{environment}{environment}
2183 % \changes{v1.8c}{1993/10/25}{Environment added}
2184 % The ``environment'' envrionment will be implemented just like the
2185 % ``macro'' environment flagging any differences in the code by
2186 % passing |\iffalse| or |\iftrue| to the |\m@cro@| environment
2187 % doing the actual work.
2189 \def\environment{\begingroup
2191 \MakePrivateLetters \m@cro@ \iffalse}
2195 % After scanning the argument we close the group to get the normal
2196 % |\catcode|$\,$s back. Then we assign a special value to
2197 % |\topsep| and start a \textsf{trivlist} environment.
2198 % \changes{v1.5f}{1989/5/07}{MacroTopsep parameter added.}
2199 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2200 % \changes{v1.8c}{1993/10/25}{Support ``environment'' env}
2201 % \changes{v1.9k}{1994/02/22}{Remove \cs{macro@level}}
2203 \long\def\m@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist
2205 % We also save the name being described in |\saved@macroname| for
2206 % use in conjunction with the |\changes| macro.
2208 \edef\saved@macroname{\string#2}%
2211 % If documenting an environment we put is name in |\saved@indexname|
2212 % otherwise the name without the backslash.
2213 % \changes{v2.1g}{2016/02/15}{Use \cs{saved@indexname}}
2215 \let\saved@indexname\saved@macroname
2217 \edef\saved@indexname{\expandafter\@gobble\string#2}%
2220 % Now there follows a variation of |\makelabel| which is used
2221 % should the environment not be nested, or should it lie between
2222 % two successive |\begin{macro}| instructions or explanatory
2223 % text. One can recognize this with the switch |\if@inlabel|
2224 % which will be |true| in the case of successive |\item|
2227 \def\makelabel##1{\llap{##1}}%
2229 % If |@inlabel| is |true| and if $\verb=\macro@cnt= > 0$
2230 % then the above definition needs to be changed, because in this
2231 % case \LaTeX{} would otherwise put the labels all on the same line
2232 % and this would lead to them being overprinted on top of each
2233 % other. Because of this |\makelabel| needs to be redefined
2238 % If |\macro@cnt| has the value $1$, then we redefine
2239 % |\makelabel| so that the label will be positioned in the
2240 % second line of the margin. As a result of this, two macro names
2241 % appear correctly, one under the other. It's important whilst
2242 % doing this that the generated label box is not allowed to have
2243 % more depth than a normal line since otherwise the distance
2244 % between the first two text lines of \TeX{} will be incorrectly
2245 % calculated. The definition should then look like:
2247 % \def\makelabel##1{\llap{\vtop to \baselineskip
2248 % {\hbox{\strut}\hbox{##1}\vss}}}
2250 % Completely analogous to this is the case where labels need to be
2251 % placed one under the other. The lines above are only an example
2252 % typeset with the \textsf{verbatim} environment. To produce the real
2253 % definition we save the value of |\macro@cnt| in
2254 % |\count@| and empty the temp macro |\@tempa| for later
2257 \let\@tempa\@empty \count@\macro@cnt
2259 % In the following loop we append for every already typeset label
2260 % an |\hbox{\strut}| to the definition of |\@tempa|.
2262 \loop \ifnum\count@>\z@
2263 \edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat
2265 % Now be put the definition of |\makelabel| together.
2266 % \changes{v1.5b}{1989/04/27}{vbox to vtop changed in makelabel (test)}
2267 % \changes{v1.5e}{1989/04/28}{ht strutbox changed to baselineskip
2270 \edef\makelabel##1{\llap{\vtop to\baselineskip
2271 {\@tempa\hbox{##1}\vss}}}%
2273 % Next we increment the value of the nesting depth counter. This
2274 % value inside the \textsf{macro} environment is always at least one
2275 % after this point, but its toplevel definition is zero. Provided
2276 % this environment has been used correctly, $|\macro@cnt|=0$
2277 % should not occur when |@inlabel|=\textsf{true}. It is
2278 % however possible if this environment is used within other list
2279 % environments (but this would have little point).
2281 \advance \macro@cnt \@ne
2283 % If |@inlabel| is false we reset |\macro@cnt| assuming
2284 % that there is enough room to print the macro name without
2287 \else \macro@cnt\@ne \fi
2289 % Now the label will be produced using |\item|. The following
2290 % line is only a hack saving the day until a better solution is
2291 % implemented. We have to face two problems: the argument might be
2292 % a |\par| which is forbidden in the argument of other macros
2293 % if they are not defined as |\long|, or it is something like
2294 % |\iffalse| or |\else|, i.e.\ something which will be
2295 % misinterpreted when \TeX{} is skipping conditional text. In both
2296 % cases |\item| will bomb, so we protect the argument by using
2299 \edef\@tempa{\noexpand\item[%
2301 % Depending on whether we are inside a ``macro'' or ``environment''
2302 % environment we use |\PrintMacroName| or |\PrintEnvName| to
2306 \noexpand\PrintMacroName
2308 \noexpand\PrintEnvName
2313 % At this point we also produce an index entry. Because it is not
2314 % known which index sorting program will be used, we do not use the
2315 % command |\index|, but rather a command
2316 % |\SpecialMainIndex| after advancing the counter for indexing
2317 % by line number. This may be redefined by the user in
2318 % order to generate an index entry which will be understood by the
2319 % index program in use (note the definition of
2320 % |\SpecialMainIndex| for our installation).
2321 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
2322 % \changes{v1.9u}{1995/08/06}{Removed brace group which
2323 % killed \cs{DoNotIndex}}
2324 % We advance the current codeline number and after producing an
2325 % index entry revert to the original value
2327 \global\advance\c@CodelineNo\@ne
2329 % Again the macro to call depends on the environment we are
2333 \SpecialMainIndex{#2}\nobreak
2336 \SpecialMainEnvIndex{#2}\nobreak
2338 \global\advance\c@CodelineNo\m@ne
2340 % The |\nobreak| is needed to prevent a page break after the
2341 % |\write| produced by the |\SpecialMainIndex| macro. We
2342 % exclude the new macro in the cross-referencing feature, to
2343 % prevent spurious non-main entry references. Regarding possibly
2344 % problematic arguments, the implementation takes
2345 % care of |\par| and the conditionals are uncritical.
2346 % \changes{v1.7a}{1992/03/02}{Removed redundant code checking for
2349 % Because the space symbol should be ignored between the
2350 % |\begin{macro}{...}| and the following text we must take
2351 % care of this with |\ignorespaces|.
2361 % \begin{macro}{\endmacro}
2362 % \begin{macro}{\endenvironment}
2363 % Older releases of this environment omit the |\endgroup| token,
2364 % when being nested. This was done to avoid unnecessary stack usage.
2365 % However it does not work if \textsf{macro} and
2366 % \textsf{environment} environments are mixed, therefore we now
2367 % use a simpler approach.
2368 % \changes{v1.5k}{1989/08/17}{Fix for save stack problem.}
2369 % \changes{v1.9k}{1994/02/22}{Don't checkfor nesting}
2371 \let\endmacro \endtrivlist
2372 \let\endenvironment\endmacro
2377 % \begin{macro}{\MacroTopsep}
2378 % Here is the default value for the |\MacroTopsep| parameter
2381 \newskip\MacroTopsep \MacroTopsep = 7pt plus 2pt minus 2pt
2389 % \subsection{Formatting the margin}
2391 % The following three macros should be user definable.
2392 % Therefore we define those macros only if they have not already
2395 % \begin{macro}{\PrintMacroName}
2396 % \begin{macro}{\PrintEnvName}
2397 % \begin{macro}{\PrintDescribeMacro}
2398 % \begin{macro}{\PrintDescribeEnv}
2399 % The formatting of the macro name in the left margin is done by
2400 % these macros. We first set a |\strut| to get the height and
2401 % depth of the normal lines. Then we change to the
2402 % |\MacroFont| using |\string| to |\catcode| the
2403 % argument to other (assuming that it is a macro name). Finally we
2404 % print a space. The font change remains local since this macro
2405 % will be called inside an |\hbox|.
2407 \@ifundefined{PrintMacroName}
2408 {\def\PrintMacroName#1{\strut \MacroFont \string #1\ }}{}
2410 % We use the same formatting conventions when describing a macro.
2412 \@ifundefined{PrintDescribeMacro}
2413 {\def\PrintDescribeMacro#1{\strut \MacroFont \string #1\ }}{}
2415 % To format the name of a new environment there is no need to use
2418 \@ifundefined{PrintDescribeEnv}
2419 {\def\PrintDescribeEnv#1{\strut \MacroFont #1\ }}{}
2420 \@ifundefined{PrintEnvName}
2421 {\def\PrintEnvName#1{\strut \MacroFont #1\ }}{}
2430 % \subsection{Creating index entries by scanning `macrocode'}
2432 % The following macros ensure that index entries are created for each
2433 % occurrence of a \TeX-like command (something starting with
2434 % `|\|') providing indexing has been turned on with "\PageIndex"
2435 % or "\CodelineIndex". With the default definitions of
2436 % |\SpecialMainIndex|, etc., the index file generated is
2437 % intended to be processed by Chen's \textsf{makeindex} program
2441 % Of course, in {\em this\/} package file itself we've sometimes had to
2442 % make \verb+|+ take the r\^ole of \TeX's escape character to
2443 % introduce command names at places where |\| has to belong to
2444 % some other category. Therefore, we may also need to recognize
2445 % \verb+|+ as the introducer for a command when setting the text
2446 % inside the \textsf{macrocode} environment. Other users may have the
2447 % need to make similar reassignments for their macros.
2450 % \begin{macro}{\SpecialEscapechar}\label{sect:specialescapechar}
2451 % \begin{macro}{\active@escape@char}
2452 % \begin{macro}{\special@escape@char}
2453 % The macro |\SpecialEscapechar| is used to denote a special escape
2454 % character for the next \textsf{macrocode} environment. It has one
2455 % argument---the new escape character given as a `single-letter'
2456 % control sequence. Its main purpose is defining
2457 % |\special@escape@char| to produce the chosen escape character
2458 % |\catcode|$\,$d to 12 and |\active@escape@char| to produce the
2459 % same character but with |\catcode| 13.
2461 % The macro |\special@escape@char| is used to {\em print\/}
2462 % the escape character while |\active@escape@char| is needed
2463 % in the definition of |\init@crossref| to start the scanning
2466 % In the definition of |\SpecialEscapechar| we need an
2467 % arbitrary character with |\catcode| 13. We use `\~{}' and
2468 % ensure that it is active. The |\begingroup| is used to make
2469 % a possible change local to the expansion of
2470 % |\SpecialEscapechar|.
2471 % \changes{v1.7g}{1992/6/19}{Making tilde active moved outside
2476 \gdef\SpecialEscapechar#1{%
2479 % Now we are ready for the definition of
2480 % |\active@escape@char|. It's a little tricky: we first
2481 % define locally the uppercase code of `\~{}' to be the new escape
2486 % Around the definition of |\active@escape@char| we place an
2487 % |\uppercase| command. Recall that the expansion of
2488 % |\uppercase| changes characters according to their
2489 % |\uccode|, but leaves their |\catcode|$\,$s untouched
2490 % (cf.\ \TeX{}book page 41).
2492 \uppercase{\gdef\active@escape@char{~}}%
2494 % The definition of |\special@escape@char| is easier, we use
2495 % |\string| to |\catcode| the argument of
2496 % |\SpecialEscapechar| to 12 and suppress the preceding
2499 \escapechar\m@ne \xdef\special@escape@char{\string#1}%
2501 % Now we close the group and end the definition: the value of
2502 % |\escapechar| as well as the |\uccode| and
2503 % |\catcode| of `\~{}' will be restored.
2515 % \begin{macro}{\init@crossref}
2516 % The replacement text of |\init@crossref| should fulfill the
2521 % |\catcode| all characters used in macro names to
2522 % 11 (i.e.\ `letter').
2524 % |\catcode| the `|\|' character to 13
2527 % |\let| the `|\|' equal |\scan@macro|
2528 % (i.e.\ start the macro scanning mechanism) if there is
2529 % no special escape character (i.e.\ the
2530 % |\special@escape@char| is `|\|').
2532 % Otherwise |\let| it equal |\bslash|, i.e.\
2533 % produce a printable |\|.
2535 % Make the \meta{special escape character} active.
2537 % |\let| the active version of the special escape
2539 % (i.e.\ the expansion of |\active@escape@char|) equal
2542 % The reader might ask why we bother to |\catcode| the
2543 % `|\|' first to 12 (at the end of |\macro@code|) then
2544 % re-|\catcode| it to 13 in order to produce a $|\|_{12}$
2545 % in case 3b) above. This is done because we have to ensure that
2546 % `|\|' has |\catcode| 13 within the \textsf{macrocode}
2547 % environment. Otherwise the delimiter for the argument of
2548 % |\xmacro@code| would not be found (parameter matching
2549 % depends on |\catcode|$\,$s).
2551 % Therefore we first re-|\catcode| some characters.
2553 \begingroup \catcode`\|=\z@ \catcode`\\=\active
2555 % We carry out tasks 2) and 3b) first.
2556 % \SpecialEscapechar{\|}
2558 |gdef|init@crossref{|catcode`|\|active |let\|bslash
2560 % Because of the popularity of the `|@|' character as a
2561 % `letter' in macros, we normally have to change its
2562 % |\catcode| here, and thus fulfill task 1). But the macro
2563 % designer might use other characters as private letters as well,
2564 % so we use a macro to do the |\catcode| switching.
2565 % \SpecialEscapechar\|
2569 % Now we |\catcode| the special escape character to 13 and
2570 % |\let| it equal |\scan@macro|, i.e.\ fulfill tasks 4)
2571 % and 5). Note the use of |\expandafter| to insert the chosen
2572 % escape character saved in |\special@escape@char| and
2573 % |\active@escape@char|.
2574 % \SpecialEscapechar\|
2576 |catcode|expandafter`|special@escape@char|active
2577 |expandafter|let|active@escape@char|scan@macro}
2580 % If there is no special escape character, i.e.\ if
2581 % |\SpecialEscapechar| is |\\|, the second last line will
2582 % overwrite the previous definition of $|\|_{13}$. In this
2583 % way all tasks are fulfilled.
2585 % For happy documenting we give default values to
2586 % |\special@escape@char| and |\active@escape@char| with
2587 % the following line:
2589 \SpecialEscapechar{\\}
2595 % \begin{macro}{\MakePrivateLetters}
2596 % Here is the default definition of this command, which makes just
2597 % the |@| into a letter. The user may change it if he/she
2598 % needs more or other characters masquerading as letters.
2600 \@ifundefined{MakePrivateLetters}
2601 {\let\MakePrivateLetters\makeatletter}{}
2605 % \begin{macro}{\close@crossref}
2606 % At the end of a cross-referencing part we prepare ourselves for
2607 % the next one by setting the escape character to `|\|'.
2609 \def\close@crossref{\SpecialEscapechar\\}
2616 % \subsection{Macros for scanning macro names}
2618 % \begin{macro}{\scan@macro}
2619 % \changes{v1.5k}{1989/09/04}{Support for checksum added.}
2620 % \begin{macro}{\macro@namepart}
2621 % The |\init@crossref| will have made |\active| our
2622 % |\special@escape@char|, so that each
2623 % |\active@escape@char| will invoke |\scan@macro| when
2624 % within the \textsf{macrocode} environment. By this means, we can
2625 % automatically add index entries for every \TeX-like command which
2626 % is met whilst setting (in verbatim) the contents of
2627 % \textsf{macrocode} environments.
2631 % First we output the character which triggered this macro. Its
2632 % version |\catcode|$\,$d to 12 is saved in
2633 % |\special@escape@char|. We also call |\step@checksum|
2634 % to generate later on a proper check-sum (see section
2635 % \ref{sec:checksum} for details).
2637 \special@escape@char
2640 % If the \textsf{macrocode} environment contains, for example, the
2641 % command |\\|, the second |\| should not start the
2642 % scanning mechanism. Therefore we use a switch to decide if
2643 % scanning of macro names is allowed.
2647 % The macro assembles the letters forming a \TeX\ command in
2648 % |\macro@namepart| so this is initially cleared; we then set
2649 % |\next| to the \textit{first\/} character following the
2650 % |\| and call |\macro@switch| to determine whether that
2651 % character is a letter or not.
2653 \let\macro@namepart\@empty
2654 \def\next{\futurelet\next\macro@switch}%
2656 % As you recognize, we actually did something else, because we have
2657 % to defer the |\futurelet| call until after the final
2658 % |\fi|. If, on the other hand, the scanning is disabled we
2659 % simply |\let| |\next| equal `empty'.
2661 \else \let\next\@empty \fi
2663 % Now we invoke |\next| to carry out what's needed.
2671 % \begin{macro}{\ifscan@allowed}
2672 % \begin{macro}{\scan@allowedtrue}
2673 % \begin{macro}{\scan@allowedfalse}
2674 % |\ifscan@allowed| is the switch used above to determine if
2675 % the |\active@escape@char|\SpecialIndex{\active@escape@char}
2676 % should start the macro scanning mechanism.
2678 \newif\ifscan@allowed \scan@allowedtrue
2685 % \begin{macro}{\EnableCrossrefs}
2686 % \begin{macro}{\DisableCrossrefs}
2687 % At this point we might define two macros which allow the user to
2688 % disable or enable the cross-referencing mechanism. Processing of
2689 % files will be faster if only main index entries are generated
2690 % (i.e., if |\DisableCrossrefs| is in force).
2692 \def\DisableCrossrefs{\@bsphack\scan@allowedfalse\@esphack}
2694 % The macro |\EnableCrossrefs| will also disable any
2695 % |\DisableCrossrefs| command encountered afterwards.
2697 \def\EnableCrossrefs{\@bsphack\scan@allowedtrue
2698 \def\DisableCrossrefs{\@bsphack\@esphack}\@esphack}
2706 % \begin{macro}{\macro@switch}
2707 % Now that we have the character which follows the escape character
2708 % (in |\next|), we can determine whether it's a `letter'
2709 % (which probably includes |@|).
2711 % If it is, we let |\next| invoke a macro which assembles the
2712 % full command name.
2714 \def\macro@switch{\ifcat\noexpand\next a%
2715 \let\next\macro@name
2717 % Otherwise, we have a `single-character' command name. For all
2718 % those single-character names, we use |\short@macro| to
2719 % process them into suitable index entries.
2721 \else \let\next\short@macro \fi
2723 % Now that we know what macro to use to process the macro name, we
2731 % \begin{macro}{\short@macro}
2732 % \changes{v1.5c}{1989/4/27}{Corrected bad bug by putting the
2733 % scan@allowedfalse macro before printing
2735 % \changes{v1.7a}{1992/03/10}{Ensure character stored in
2736 % \cs{macro@namepart} as `letter' so index exclusion works.}
2737 % This macro will be invoked (with a single character as parameter)
2738 % when a single-character macro name has been spotted whilst
2739 % scanning within the \textsf{macrocode} environment.
2741 % First we take a look at the |\index@excludelist| to see
2742 % whether this macro name should produce an index entry. This is
2743 % done by the |\ifnot@excluded| macro which assumes that the
2744 % macro name is saved in |\macro@namepart|. The character
2745 % mustn't be stored with a special category code or exclusion from
2746 % the index won't work, so we employ the case-changing trick used
2747 % elsewhere. Since the argument might be an active character,
2748 % |\string| is used to normalize it.
2749 % \changes{v2.0e}{1998/12/28}{Correctly use the case-changing trick.}
2753 \gdef\short@macro#1{\begingroup
2754 \uccode`\&=\expandafter`\string#1%
2755 \uppercase{\def\x{\def\macro@namepart{&}}}%
2756 \expandafter\endgroup\x
2759 % If necessary the index entry is produced by the macro
2760 % |\produce@index|. Depending on the actual character seen,
2761 % this macro has to do different things, so we pass the character
2764 \produce@index{#1}\fi
2766 % Then we disable the cross-referencing mechanism with
2767 % |\scan@allowedfalse| and print the actual character. The
2768 % index entry was generated first to ensure that no page break
2769 % intervenes (recall that a |^^M| will start a new line).
2771 \scan@allowedfalse#1%
2773 % After typesetting the character we can safely enable the
2774 % cross-referencing feature again. Note that this macro won't be
2775 % called (since |\macro@switch| won't be called) if
2776 % cross-referencing is globally disabled.
2785 % \begin{macro}{\produce@index}
2786 % \changes{v1.4s}{1989/04/23}{Added noexpand to all
2788 % to avoid garbage produced by new active chars}
2789 % \changes{v1.4s}{1989/04/23}{Used \texttt{\protect\bslash string} for
2791 % \changes{v1.5c}{1989/4/27}{Corrected bad bug by placing the
2792 % scan@allowedfalse macro into short@macro}
2793 % This macro is supposed to generate a suitable |\SortIndex|
2794 % command for a given single-letter control sequence. We test
2795 % first for the cases which involve active characters (i.e.\ the
2796 % backslash, the special escape character (if any), the space and
2797 % the |^^M|). Using the |\if| test (testing for
2798 % character codes), we have to ensure that the argument isn't
2801 \def\produce@index#1{%
2802 \if\noexpand#1\special@escape@char
2804 % If the character is the special escape character (or the
2805 % `|\|' in case there was none) the |\it@is@a| macro is
2806 % used to produce the actual |\SortIndex| call.
2808 \scan@allowedfalse \it@is@a\special@escape@char \else
2810 % Next comes the test for a `|\|' which must be the
2811 % $|\|_{13}$ expanding to |\bslash|.
2813 \if\noexpand#1\bslash \it@is@a\bslash \else
2815 % Another possibility is \verb*+ +$_{13}$. Recall that |\space|
2816 % produces a \verb*+ +$_{10}$.
2818 \if\noexpand#1\space \it@is@a\space \else
2820 % The last\footnote{Well, it isn't the last active character after
2821 % all. I added \texttt{\bslash @noligs} some days ago and now
2822 % \texttt{`} too is active. So we have to make sure that such
2823 % characters don't get expanded in the index.} possibility of an
2824 % active character is |^^M|\@. In this case we don't test for
2825 % character codes, since it is easier to look if the character is
2826 % equal to |\par|. (We are inside the \textsf{macrocode}
2831 % If we end up here we have just scanned a |\^^M| or something
2832 % similar. Since this will be treated like \verb*+\ + by \TeX{} we
2833 % produce a corresponding index entry.
2835 \it@is@a\space \else
2837 % If it is the token |\relax| we do nothing. This can't happen
2838 % when the `doc' package is used in the way described here, but was
2839 % added to allow extensions like the \texttt{idxverb} option.
2840 % \changes{v1.5t}{1989/11/14}{Added \cs{relax} as a possible token to
2841 % allow extensions.}
2845 % The next three branches are needed because of bugs in
2846 % our \textsf{makeindex} program. You can't produce unbalanced index
2847 % entries\footnote{This is possible for \TeX{} if you use
2848 % \texttt{\string{$_{12}$ \rmfamily or
2849 % \ttfamily\string}$_{12}$},
2850 % but \textsf{makeindex} will complain.}
2851 % and you have to double a percent character. To get around these
2852 % restrictions we use special macros to produce the |\index|
2853 % calls.\footnote{Brian \textsc{Hamilton Kelly} has written fixes for
2855 % bugs. When they've found their way through all
2857 % the lines above will be removed. See
2858 % page~\pageref{bug:fixes} if you already have them.
2859 % (I'm not sure which versions incorporate these, but
2860 % 2.11 is OK. See also
2861 % \pageref{makeindex:version}.)}
2863 \if\noexpand#1\bgroup \LeftBraceIndex \else
2864 \if\noexpand#1\egroup \RightBraceIndex \else
2865 \if\noexpand#1\percentchar \PercentIndex \else
2867 % All remaining characters are used directly to produce their index
2868 % entries. This is possible even for the characters which have
2869 % special meanings in the index program, provided we quote the
2870 % characters. (This is correctly done in |\it@is@a|.)
2872 \it@is@a{\string#1}%
2874 % We now need a whole pile of |\fi|$\,$s to match up with
2877 \fi \fi \fi \fi \fi \fi \fi \fi}
2883 % \begin{macro}{\macro@name}
2884 % We now come to the macro which assembles command names which
2885 % consist of one or more `letters' (which might well include
2886 % |@| symbols, or anything else which has a |\catcode| of
2889 % To do this we add the `letter' to the existing definition of
2890 % |\macro@namepart| (which you will recall was originally set
2893 \def\macro@name#1{\edef\macro@namepart{\macro@namepart#1}%
2895 % Then we grab hold of the {\em next\/} single character and let
2896 % |\more@macroname| determine whether it belongs to the letter
2897 % string forming the command name or is a `non-letter'.
2899 \futurelet\next\more@macroname}
2907 % \begin{macro}{\more@macroname}
2909 % This causes another call of |\macro@name| to add in the next
2910 % character, if it is indeed a `letter'.
2912 \def\more@macroname{\ifcat\noexpand\next a%
2913 \let\next\macro@name
2915 % Otherwise, it finishes off the index entry by invoking
2918 \else \let\next\macro@finish \fi
2920 % Here's where we invoke whatever macro was |\let| equal to
2931 % \begin{macro}{\macro@finish}
2932 % When we've assembled the full `letter'-string which forms the
2933 % command name, we set the characters forming the entire command
2934 % name, and generate an appropriate |\index| command (provided
2935 % the command name is not on the list of exclusions). The
2936 % `|\|' is already typeset; therefore we only have to output
2937 % all `letters' saved in |\macro@namepart|.
2942 % Then we call |\ifnot@excluded| to decide whether we have to
2943 % produce an index entry. The construction with |\@tempa| is
2944 % needed because we want the expansion of |\macro@namepart| in
2945 % the |\index| command.\footnote{The \texttt{\bslash index}
2946 % command will expand its argument in the \texttt{\bslash output}
2947 % routine. At this time \texttt{\bslash macro@namepart} might have a
2951 \edef\@tempa{\noexpand\SpecialIndex{\bslash\macro@namepart}}%
2960 % \subsection[The index exclude list]{The index exclude
2961 % list\footnotemark}
2962 % \footnotetext{Warning: the incomplete commentary on
2963 % \texttt{\bslash DoNotIndex} and the macros it calls
2964 % was written by Dave Love.}
2966 % The internal form of the index exclude list is
2968 % \meta{macro name}|,|\meta{macro name}|,|
2971 % where \meta{macro name} is a macro name like
2972 % $"\"_{12}"p"{_{11}}"@"_{11}$ or $"\"_{12}"$"_{11}$. Note that the "\"
2973 % has category `other' and the other characters in the name are all
2974 % `letter', regardless of their normal category.
2976 % \begin{macro}{\DoNotIndex}
2977 % This macro is used to suppress macro names in the index. It
2978 % starts off with a new group because we have to change the
2979 % |\catcode|$\,$s of all characters which belong to `letters'
2980 % while macros are defined.
2982 \def\DoNotIndex{\begingroup \MakePrivateLetters
2985 % Then we call the macro which actually reads the argument given by
2994 % \begin{macro}{\do@not@index}
2995 % We make the |\do@not@index| macro |\long|
2996 % since the user might want to exclude the |\par|
2999 \long\def\do@not@index#1{%
3001 % It just adds to a token list after finishing the group in which
3002 % the catcodes were changed.
3003 % \changes{v1.7a}{1992/02/26}{Replaced with newdoc version.}
3006 \addto@hook\index@excludelist{#1,}}
3010 % \begin{macro}{\addto@hook}
3011 % The code for adding tokens (the second argument) to a token list
3012 % (the first argument) is taken from~\cite{art:verbatim}, but it needs
3013 % to be "\long" in case "\par" is amongst the tokens.
3015 \long\def\addto@hook#1#2{#1\expandafter{\the#1#2}}
3019 % \begin{macro}{\index@excludelist}
3020 % We need an initially-empty register for the excluded list.
3022 \newtoks\index@excludelist
3023 \index@excludelist{}
3027 % \begin{macro}{\ifnot@excluded}
3028 % \changes{v1.7a}{1992/02/26}{Replaced with newdoc version.}
3029 % \begin{macro}{\expanded@notin}
3030 % Now we take a look at the |\index@excludelist| to see
3031 % whether a macro name saved in |\macro@namepart| should
3032 % produce an index entry. This macro is a pseudo |\if|; it
3033 % should expand to |\iftrue| or |\iffalse| depending on
3034 % the contents of |\index@excludelist|.
3038 % First we change "\catcode"s so that "\" is `other' and "|" a
3039 % temporary for the escape character. This is necessary since our
3040 % macro names are stored that way in the "\index@excludelist".
3045 % Then we define "\ifnot@excluded" to call "\expanded@notin" with
3046 % two arguments: the first is the string "\" followed by the
3047 % contents of "\macro@namepart" followed by a "," and the second is
3048 % "\the" followed by "\index@excludelist". To achieve the expansion
3049 % of "\macro@namepart", i.e.\ to pass its contents, we need a
3050 % suitable number of "\expandafter"s.
3051 % \SpecialEscapechar{\|}
3053 |gdef|ifnot@excluded{|expandafter
3054 |expanded@notin|expandafter{|expandafter
3055 \|macro@namepart,}{|the|index@excludelist}}
3058 % The macro "\expanded@notin" now does the dirty work. It first
3059 % defines a macro "\in@@" with a very special parameter text. If
3060 % you look closely "\in@@" has three arguments, the first one is
3061 % delimited by the first argument of "\expanded@notin" (i.e.\ by
3062 % the string starting with a "\" and ending with a "," above), the
3063 % second is undelimited (which means that it will get the next
3064 % token after our string, and the third is delimited again and will
3065 % get the rest up to the token "\in@@". In other words the token
3066 % "\in@@" is also used as a delimiter.
3068 \def\expanded@notin#1#2{%
3069 \def\in@@##1#1##2##3\in@@{%
3071 % Now the replacement text simply compares the second argument
3072 % (i.e.\ the undelimited one after our string) to the token
3073 % "\expanded@notin". This is an unclosed "\ifx" statement which
3074 % means that this macro behaves similar to a normal \TeX{}
3077 \ifx\expanded@notin##2}%
3079 % After all these preparations we call "\in@@". First we expand the
3080 % token after "\in@@" (which is "\the" from the second argument to
3081 % "\expanded@notin"). As a result we get the contents of the
3082 % "\index@excludelist" inserted after "\in@@". After this contents
3083 % we add once more the string we are looking for, then the token
3084 % "\expanded@notin" and finally the token "\in@@".
3086 \expandafter\in@@#2#1\expanded@notin\in@@}
3088 % Now what happens when the macro "\in@@" above gets called? The
3089 % first argument to "\in@@" is delimited by our string. In other
3090 % words it will get everything from the contents of
3091 % "\index@excludelist" before this string. If the string is not in
3092 % "\index@excludelist" then it gets the whole contents, since after
3093 % it we had inserted the string one more. In this case the next
3094 % token is "\expanded@notin" which gets assigned to the second
3095 % argument and the third argument will be empty. If, on the other
3096 % hand, the string was inside "\index@excludelist" then the second
3097 % argument will not be the token "\expanded@notin" and the third
3098 % argument will be all the garbage up to "\in@@". Therefore testing
3099 % the seconded argument, as done in the definition of "\in@@" will
3100 % tell us whether or not the string is in "\index@includelist" and
3101 % this was exactly what we wanted. (Deep breath.) You got
3102 % that?\footnote{\TeX{}book page 125. The code described above is
3103 % originally due to Michael Spivak who used a similar method within
3104 % the \AmSTeX{} macros.}
3114 % \subsection{Macros for generating index entries}
3116 % Here we provide default definitions for the macros invoked to create
3117 % index entries; these are either invoked explicitly, or automatically
3118 % by |\scan@macro|. As already mentioned, the definitions given
3119 % here presuppose that the |.idx| file will be processed by
3120 % Chen's \textsf{makeindex} program --- they may be redefined for use
3121 % with the user's favourite such program.
3123 % To assist the reader in locating items in the index, all such
3124 % entries are sorted alphabetically {\em ignoring\/} the initial
3125 % `|\|'; this is achieved by issuing an |\index| command which
3126 % contains the `actual' operator for \textsf{makeindex}. The default
3127 % value for the latter operator is `|@|', but the latter character is
3128 % so popular in \LaTeX\ package files that it is necessary to substitute
3129 % another character. This is indicated to \textsf{makeindex} by means
3130 % of an `index style file'; the character selected for this function
3131 % is |=|, and therefore this character too must be specially treated
3132 % when it is met in a \TeX\ command. A suitable index style file is
3133 % provided amongst the supporting files for this style file in
3134 % \texttt{gind.ist} and is generated from this source by processing
3135 % with \texttt{docstrip} to extract the module \textbf{gind}. A
3136 % similar style file \texttt{gglo.ist} is supplied for sorting the
3137 % change information in the glossary file and is extracted as module
3138 % \textbf{gglo}. First of all we add some information to the front of
3139 % the \texttt{.ist} files. \changes{v1.7a}{1992/03/11}{glo.ist and
3140 % gind.ist now derivable from doc.dtx with docstrip.}
3143 %<+gind|gglo>%% This is a MAKEINDEX style file which should be used to
3144 %<+gind>%% generate the formatted index for use with the doc
3145 %<+gglo>%% generate the formatted change history for use with the doc
3146 %<+gind|gglo>%% package. The TeX commands used below are defined in
3147 %<+gind|gglo>%% doc.sty. The commands for MAKEINDEX like `level'
3148 %<+gind|gglo>%% `item_x1' are described in `` Makeindex, A General
3149 %<+gind|gglo>%% Purpose, Formatter-Independent Index Processor'' by
3150 %<+gind|gglo>%% Pehong Chen.
3154 % \begin{macro}{\actualchar}
3155 % \begin{macro}{\quotechar}
3156 % \begin{macro}{\levelchar}
3157 % First come the definitions of |\actualchar|,
3158 % |\quotechar| and |\levelchar|. Note, that our defaults
3159 % are not the ones used by the \textsf{makeindex} program without a
3163 \@ifundefined{actualchar}{\def\actualchar{=}}{}
3164 \@ifundefined{quotechar}{\def\quotechar{!}}{}
3165 \@ifundefined{levelchar}{\def\levelchar{>}}{}
3167 %<+gind|gglo>actual '='
3168 %<+gind|gglo>quote '!'
3169 %<+gind|gglo>level '>'
3177 % \begin{macro}{\encapchar}
3178 % The \textsf{makeindex} default for the |\encapchar| isn't
3181 \@ifundefined{encapchar}{\def\encapchar{|}}{}
3186 % \begin{macro}{\verbatimchar}
3187 % We also need a special character to be used as a delimiter for
3188 % the |\verb*| command used in the definitions below.
3190 \@ifundefined{verbatimchar}{\def\verbatimchar{+}}{}
3195 % \begin{macro}{\SpecialIndex}
3196 % The |\SpecialIndex| command creates index entries for
3197 % macros. If the argument is |\|$xyz$, the command produces
3198 % \verb|\indexentry{|$xyz$\verb|=\verb!*+\|$xyz$\verb|+}{|$n$\verb|}|
3199 % given the above defined defaults for |\actualchar|,
3200 % |\quotechar| and |\verbatimchar|. We first remove the
3201 % initial `|\|' to get a better index.
3202 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3204 \def\SpecialIndex#1{\@bsphack\special@index{\expandafter\@gobble
3205 \string#1\actualchar
3207 % Then follows the actual entry. A |\quotechar| is placed
3208 % before the |*| to allow its use as a special \textsf{makeindex}
3209 % character. Again |\@bsphack| and |\@esphack| are used
3210 % to make the macros invisible.
3212 \string\verb\quotechar*\verbatimchar\string#1\verbatimchar}%
3217 % \begin{macro}{\SpecialMainIndex}
3218 % \begin{macro}{\SpecialMainEnvIndex}
3219 % \begin{macro}{\SpecialUsageIndex}
3220 % The |\SpecialMainIndex| macro is used to cross-reference the
3221 % names introduced by the \textsf{macro} environment. The action is
3222 % as for |\SpecialIndex|, except that \textsf{makeindex} is
3223 % instructed to `encap'sulate the entry with the string
3224 % \verb=|main= to cause it to generate a call of the |\main|
3226 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3227 % \changes{v2.0c}{1998/08/22}{Correctly handle single character
3228 % control sequences like \cs{<}.}
3230 % |\SpecialMainIndex| passes the macro name to be indexed on to the
3231 % macro |\SpecialIndex@|.
3233 \def\SpecialMainIndex#1{\@bsphack\SpecialIndex@{#1}{\encapchar main}%
3237 % \begin{macro}{\SpecialIndex@}
3238 % \changes{v2.0c}{1998/08/22}{Macro added.}
3239 % \changes{v2.0f}{1999/02/27}{Temp fix to allow strange code in arg 1
3241 % The macro |\SpecialIndex@| does the real work for |\SpecialMainIndex|
3242 % and |\SpecialUsageIndex|. It takes two arguments: the macro to be
3243 % indexed (as a control sequence or list of character tokens) and the
3244 % additional text for the index.
3245 % \changes{v2.0g}{1999/03/22}{Correct so-called temp fix. I'm not going to
3251 |gdef|@SpecialIndexHelper@#1#2|@nil{%
3257 |expandafter|gdef|expandafter|@gtempa|expandafter{|string#1#2}%
3261 \def\SpecialIndex@#1#2{%
3263 % The first thing it does is to convert the macro into a list of
3264 % characters. Note that a character token list remains (mostly) unchanged.
3266 \@SpecialIndexHelper@#1\@nil
3268 % The macro name \verb*|\ | has to handled in a special way. The reason
3269 % is that the space token is skipped when \TeX\ is scanning macro
3270 % parameters, so that the trick used below will not work.
3271 % So, we check whether the replacement text of |\@tempa| starts with
3272 % a space token and write the appropriate index entry.
3275 \ifcat \@tempb\@gtempa
3276 \special@index{\quotechar\space\actualchar
3277 \string\verb\quotechar*\verbatimchar
3278 \quotechar\bslash\quotechar\space\verbatimchar#2}%
3281 % Having handled this special case we have to distinguish control
3282 % sequences consisting of one or more
3283 % letters and those that consists of exactly one nonletter. As character
3284 % tokens in the replacement text of the macro |\@gtempa| have all
3285 % category code $12$ (other), this is difficult. For simplicity, we treat
3286 % all single character control sequences alike, irregardless of whether
3287 % the character is a letter or not. This has the advantage that it works
3288 % even for strange settings of the category codes.
3290 % We define a utility macro |\@tempb| with two arguments, the second
3291 % delimited by |\relax|.
3292 % It will be called later so that the first argument is the first character
3293 % of the macro name, and the second argument receives the rest of the
3294 % characters. So we distinguish the two cases above by checking whether
3295 % the second argument is empty.
3297 \def\@tempb##1##2\relax{\ifx\relax##2\relax
3299 % If so, we define the helper macro |\@tempc| in a way that it
3300 % adds quotechars in critical places.
3302 \def\@tempc{\special@index{\quotechar##1\actualchar
3303 \string\verb\quotechar*\verbatimchar
3304 \quotechar\bslash\quotechar##1\verbatimchar#2}}%
3306 % Otherwise we write the characters as in |\SpecialIndex|.
3309 \def\@tempc{\special@index{##1##2\actualchar
3310 \string\verb\quotechar*\verbatimchar
3311 \bslash##1##2\verbatimchar#2}}%
3314 % Now pass the list of characters to \@tempb and call \@tempc to do the
3317 \expandafter\@tempb\@gtempa\relax
3323 % Slightly simpler is the main entry for environments
3324 % \changes{v1.9e}{1994/02/03}{use \cs{ttfamily} with \cs{string}}
3325 % \changes{v1.9f}{1994/02/07}{should have used \cs{noexpand}, sigh}
3326 % \changes{v1.9i}{1994/02/11}{should have used \cs{protect}}
3327 % \changes{v1.9j}{1994/02/16}{Back to string:-)}
3328 % \changes{v1.9s}{1994/10/14}{Added missing percent and changed to
3330 % \changes{v2.0d}{1998/12/20}{Correctly handle second index entry
3331 % by using \cs{special@index} not \cs{index} (PR/2928).}
3332 % \changes{v2.0e}{1998/12/28}{Use \cs{string}, not \cs{protect} in argument to
3333 % \cs{special@index}.}
3334 % \changes{v2.1c}{2004/07/23}{environment names incorrectly sorted in
3337 \def\SpecialMainEnvIndex#1{\@bsphack\special@index{%
3339 {\string\ttfamily\space#1}
3342 \special@index{environments:\levelchar#1\actualchar{%
3343 \string\ttfamily\space#1}\encapchar
3346 % The |\SpecialUsageIndex| is similar to |\SpecialMainIndex|, except
3347 % that it uses the standard |\index| command.
3348 % \texttt{usage} instead of \texttt{main}.
3350 \def\SpecialUsageIndex#1{\@bsphack
3351 {\let\special@index\index\SpecialIndex@{#1}{\encapchar usage}}%
3361 % \begin{macro}{\SpecialEnvIndex}
3362 % Indexing environments is done a little bit differently; we produce
3363 % two index entries with the |\SpecialEnvIndex| macro:
3364 % \changes{v1.9e}{1994/02/03}{The index needs protecting}
3365 % \changes{v1.9g}{1994/02/08}{should have used \cs{noexpand}, sigh}
3366 % \changes{v1.9i}{1994/02/11}{should have used \cs{protect}}
3368 \def\SpecialEnvIndex#1{\@bsphack
3370 % First we sort the environment under its own name stating in the
3371 % actual entry that this is an environment.
3373 \index{#1\actualchar{\protect\ttfamily#1}
3374 (environment)\encapchar usage}%
3376 % The second entry is sorted as a subitem under the key
3378 % \changes{v2.1b}{2004/02/09}{environment names incorrectly sorted in
3381 \index{environments:\levelchar#1\actualchar
3382 {\protect\ttfamily#1}\encapchar usage}\@esphack}
3384 % Because both entries correspond to `descriptions' of the
3385 % environment, we encapsulate the page numbers with the
3391 % \begin{macro}{\SortIndex}
3392 % This macro is used to generate the index entries for any
3393 % single-character command that |\scan@macro| encounters. The
3394 % first parameter specifies the lexical order for the character,
3395 % whilst the second gives the actual characters to be printed in
3396 % the entry. It can also be used directly to generate index entries
3397 % which differ in sort key and actual entry.
3399 \def\SortIndex#1#2{\index{#1\actualchar#2}}
3405 % \begin{macro}{\it@is@a}
3406 % This macro is supposed to produce a correct |\SortIndex|
3407 % entry for a given character. Since this character might be
3408 % recognised as a `command' character by the index program used,
3409 % all characters are quoted with the |\quotechar|.
3410 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3412 \def\it@is@a#1{\special@index{\quotechar #1\actualchar
3413 \string\verb\quotechar*\verbatimchar
3414 \quotechar\bslash\quotechar#1\verbatimchar}}
3420 % \begin{macro}{\LeftBraceIndex}
3421 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3422 % \begin{macro}{\RightBraceIndex}
3423 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)} These
3424 % two macros fix the problems with \textsf{makeindex}. Note the
3425 % `hack' with |\iffalse}\fi| to satisfy both \TeX{} and the
3426 % \textsf{makeindex} program. When this is written to the
3427 % \texttt{.idx} file \TeX{} will see both braces (so we get a
3428 % balanced text). \textsf{makeindex} will also see balanced braces
3429 % but when the actual index entry is again processed by \TeX{} the
3430 % brace in between |\iffalse| |\fi| will vanish.
3432 \@ifundefined{LeftBraceIndex}{\def\LeftBraceIndex{%
3433 \special@index{\bgroup\actualchar\string\verb\quotechar*\verbatimchar
3434 \quotechar\bslash{\verbatimchar\string\iffalse}\string\fi}}}{}
3436 \@ifundefined{RightBraceIndex}{\def\RightBraceIndex{%
3437 \special@index{\egroup\actualchar\string\iffalse{\string\fi\string\verb
3438 \quotechar*\verbatimchar\quotechar\bslash}\verbatimchar}}}{}
3444 % \begin{macro}{\PercentIndex}
3445 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
3446 % \changes{v1.7c}{1992/03/25}{Default now for bug-fixed makeindex}
3447 % By default we assume a version of \textsf{makeindex} without the
3448 % percent bug is being used.
3450 \@ifundefined{PercentIndex}
3451 {\def\PercentIndex{\it@is@a\percentchar}}{}
3454 % \begin{macro}{\OldMakeindex}
3455 % \changes{v1.7c}{1992/03/26}{Replaced \cs{NewMakeIndex}.}
3456 % \begin{macro}{\percentchar}
3457 % Here is one solution for the percent bug in \textsf{makeindex}.
3458 % The macro |\percentchar| denotes a |%|$_{12}$. Calling this from
3459 % a package or the driver file sets things up
3460 % appropriately.\label{bug:fixes}
3462 \def\OldMakeindex{\def\PercentIndex{%
3463 \special@index{\quotechar\percentchar\actualchar\string\verb
3464 \quotechar*\verbatimchar\quotechar\bslash
3465 \percentchar\percentchar\verbatimchar}}}
3466 {\catcode`\%=12 \gdef\percentchar{%}}
3476 % \subsection{Redefining the \textsf{index} environment}
3478 %\changes{v1.4r}{1989/04/22}{twocols env. placed into separate file}
3479 %\changes{v1.4?}{1989/04/19}{use DEK's algorithm and implement
3481 %\changes{v1.4?}{1989/04/16}{changes to the index env.}
3482 %\changes{v1.5a}{1989/04/26}{Now input multicol.sty instead of
3484 % \begin{macro}{\ifhave@multicol}
3485 % \changes{v1.7a}{1992/03/04}{Added to support avoiding multicol.sty} By
3486 % default the index is set in three columns, and will start on the
3487 % same page as, and underneath, the last part of the text of the
3488 % documented package file, if possible. The last page will be
3489 % reformatted with balanced columns. This requires the
3490 % \textsf{multicols} environment which is described elsewhere. So
3491 % that \DOC{} can be run independently of
3492 % \texttt{multicol.sty} we first check for its existence and set
3493 % the "have@multicol" flag appropriately for use below.
3494 % \changes{v1.9a}{1993/12/02}{Use \cs{IfFileExists}}
3495 % \changes{v1.9m}{1994/04/28}{Use \cs{RequirePackage} to load multicol}
3497 \newif\ifhave@multicol
3499 % If we found \texttt{multicol.sty} we use it. It would be nice to
3500 % delay this (and the re-definition of "theindex") until we knew
3501 % whether an index was actually required \ldots
3503 \IfFileExists{multicol.sty}{\have@multicoltrue
3504 \RequirePackage{multicol}%
3510 % \begin{macro}{\IndexMin}
3511 % \begin{macro}{\c@IndexColumns}
3512 % \changes{v1.4t}{1989/04/24}{Counter added.}
3513 % If \texttt{multicol} is in use,
3514 % when the index is started we compute the remaining space on the
3515 % current page; if it is greater than |\IndexMin|, the first
3516 % part of the index will then be placed in the available space.
3517 % The number of columns set is controlled by the counter
3518 % |\c@IndexColumns| which can be changed with a
3519 % |\setcounter| declaration.
3521 \newdimen\IndexMin \IndexMin = 80pt
3522 \newcount\c@IndexColumns \c@IndexColumns = 3
3528 % \begin{environment}{theindex}
3529 % Now we start the multi-column mechanism, if appropriate. We use the
3530 % \LaTeX{} counter |\c@IndexColumns| declared above to denote
3531 % the number of columns and insert the `index prologue' text (which
3532 % might contain a |\section| call, etc.). See the default
3533 % definition for an example.
3534 % \changes{v1.4t}{1989/04/24}{Incorporated new multicols env.}
3535 % \changes{v1.5a}{1989/04/26}{Call multicols first}
3536 % \changes{v1.6e}{1991/04/03}{Turned into env definition.}
3537 % \changes{v1.7a}{1992/03/04}{Include test for multicols.}
3540 \renewenvironment{theindex}
3541 {\begin{multicols}\c@IndexColumns[\index@prologue][\IndexMin]%
3543 % Then we make a few last minute assignments to read the individual
3544 % index |\item|$\,$s and finish off by ignoring any initial
3547 \IndexParms \let\item\@idxitem \ignorespaces}%
3550 % \begin{macro}{\endtheindex}
3551 % \changes{v1.4t}{1989/04/24}{Incorporated new multicols env.}
3552 % At the end of the index, we have only to end the \textsf{multicols}
3557 % If we can't use \textsf{multicols} we warn the user and use an
3558 % environment that's basically the one from \texttt{article.sty}.
3561 \typeout{Can't find multicol.sty -- will use normal index layout if
3563 \def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
3564 \columnseprule \z@ \columnsep 35\p@
3565 \twocolumn[\index@prologue]%
3566 \IndexParms \let\item\@idxitem \ignorespaces}
3567 \def\endtheindex{\if@restonecol\onecolumn\else\clearpage\fi}
3573 % Here are the necessary \textsf{makeindex} declarations. We disable
3574 % scanning of macro names inside the index with "\scan@allowedfalse\n"
3575 % to avoid recursion.
3579 %<+gind>"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
3581 %<+gind>"\n\n \\end{theindex}\n"
3586 % \begin{macro}{\IndexPrologue}
3587 % \begin{macro}{\index@prologue}
3588 % \changes{v1.9w}{1995/12/27}{Text changed}
3589 % \changes{v1.9x}{1996/01/11}{Text depends on code lines used}
3590 % The |\IndexPrologue| macro is used to place a short message
3591 % into the document above the index. It is implemented by
3592 % redefining |\index@prologue|, a macro which holds the
3593 % default text. We'd better make it a |\long| macro to allow
3594 % |\par| commands in its argument.
3596 \long\def\IndexPrologue#1{\@bsphack\def\index@prologue{#1}\@esphack}
3598 % Now we test whether the default is already defined by another
3599 % package file. If not we define it.
3600 % \changes{v2.0j}{2000/05/22}{Less obscure wording? (CAR pr/3202)}
3602 \@ifundefined{index@prologue}
3603 {\def\index@prologue{\section*{Index}%
3604 \markboth{Index}{Index}%
3605 Numbers written in italic refer to the page
3606 where the corresponding entry is described;
3607 numbers underlined refer to the
3611 definition; numbers in roman refer to the
3617 where the entry is used.
3625 % \begin{macro}{\IndexParms}
3626 % These are some last-minute assignments for formatting the index
3627 % entries. They are defined in a separate macro so that a user can
3628 % substitute different definitions. We start by defining the
3629 % various parameters controlling leading and the separation between
3630 % the two columns. The entire index is set in |\small| size.
3632 \@ifundefined{IndexParms}
3636 \parskip 0pt plus 1pt
3642 % \begin{macro}{\@idxitem}
3643 % \begin{macro}{\subitem}
3644 % \begin{macro}{\subsubitem}
3645 % Index items are formatted with hanging indentation for any items
3646 % which may require more than one line.
3648 \def\@idxitem{\par\hangindent 30pt}%
3650 % Any sub-item in the index is formatted with a 15pt indentation
3651 % under its main heading.
3653 \def\subitem{\@idxitem\hspace*{15pt}}%
3655 % Whilst sub-sub-items go in a further 10pt.
3657 \def\subsubitem{\@idxitem\hspace*{25pt}}%
3659 % \begin{macro}{\indexspace}
3660 % The \textsf{makeindex} program generates an |\indexspace|
3661 % before each new alphabetic section commences. After this final
3662 % definition we end the |\@ifundefined| and the definition of
3665 \def\indexspace{\par\vspace{10pt plus 2pt minus 3pt}}%
3675 % \begin{macro}{\efill}
3676 % This definition of |\efill| is intended to be used after index
3677 % items which have no following text (for example, ``\textit{
3678 % see\/}'' entries). It just ensures that the current line is
3679 % filled, preventing ``|Underfull \hbox|'' messages.
3681 \def\efill{\hfill\nopagebreak}%
3683 %<+gind|gglo>item_x1 "\\efill \n \\subitem "
3684 %<+gglo>item_x2 "\\ "
3685 %<+gind>item_x2 "\\efill \n \\subsubitem "
3692 % \begin{macro}{\pfill}
3693 % \begin{macro}{\dotfil}
3694 % \begin{macro}{\dotfill}
3695 % The following definitions provide the |\pfill| command; if
3696 % this is specified in the index style file to \textsf{makeindex} as
3697 % the delimiter to appear after index items, then the intervening
3698 % space before the referenced page numbers will be filled with
3699 % dots, with a little white space interpolated at each end of the
3700 % dots. If the line is broken the dots will show up on both lines.
3702 \def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill}%
3703 \def\dotfil{\leaders\hbox to.6em{\hss .\hss}\hfil}%
3704 \def\pfill{\unskip~\dotfill\penalty500\strut\nobreak
3705 \dotfil~\ignorespaces}%
3707 %<+gind|gglo>delim_0 "\\pfill "
3708 %<+gind|gglo>delim_1 "\\pfill "
3709 %<+gind|gglo>delim_2 "\\pfill "
3719 % Here is the definition for the |\*| macro. It isn't used in
3720 % this set of macros.
3722 \def\*{\leavevmode\lower.8ex\hbox{$\,\widetilde{\ }\,$}}
3727 % \begin{macro}{\main}
3728 % The \textit{defining\/} entry for a macro name is flagged with
3729 % the string \texttt{\encapchar main}\footnote{With the current
3730 % definition of \texttt{\bslash encapchar} substituted for
3731 % \texttt{\encapchar}} in the |\index| command; \textsf{makeindex}
3732 % processes this so that the |\main| macro will be invoked to
3733 % underline the page number(s) on which the {\em definition\/} of
3734 % the macro will be found.
3736 \@ifundefined{main}{\def\main#1{\underline{#1}}}{}
3740 % \begin{macro}{\usage}
3741 % The |\usage| macro is used to indicate entries describing
3742 % the usage of a macro. The corresponding page number(s) will be
3743 % set in \textit{italics}.
3745 \@ifundefined{usage}{\def\usage#1{\textit{#1}}}{}
3750 % \begin{macro}{\PrintIndex}
3751 % \changes{v1.5k}{1989/09/04}{\cs{printindex} changed to
3753 % \changes{v1.7a}{1992/02/26}{Documentation moved to interface section.}
3754 % \changes{v1.9h}{1994/02/10}{Use \cs{@input@} instead of \cs{@input}.}
3755 % \changes{v1.9w}{1995/12/29}{Turn the cmd into a noop after use.}
3756 % This is the same as "\printindex" in the \textsf{makeidx} package.
3758 \def\PrintIndex{\@input@{\jobname.ind}%
3759 \global\let\PrintIndex\@empty}
3763 % \begin{macro}{\printindex}
3764 % Since the above macro was called |\printindex| in older versions
3765 % of \texttt{doc.sty} the following definition was provided up to
3767 % \changes{v1.9z}{1996/04/17}{Commented out}
3769 %\def\printindex{\typeout{\string\printindex\space is obsolete!}%
3770 % \typeout{Please use \string\PrintIndex\space
3771 % if you are a macro implementor^^J
3772 % or get a newer version of the documented
3773 % software if you are a user}%
3778 % We want headings in the index (and changes list) according to the
3779 % initial character of the next block of entries and have to instruct
3780 % \textsf{makeindex} appropriately. Unfortunately the specification
3781 % for this changed sometime between versions 2.4 and 2.11 of
3782 % \textsf{makeindex}. We provide both ways of doing it but
3783 % unfortunately this will always produce a warning message from
3784 % \textsf{makeindex}. This is for older versions:
3785 % \changes{v1.7h}{1992/07/01}{Turn off headings in gls file}
3788 %<+gind,gglo>% The next lines will produce some warnings when
3789 %<+gind,gglo>% running Makeindex as they try to cover two different
3790 %<+gind,gglo>% versions of the program:
3791 %<+gind,gglo>lethead_prefix "{\\bfseries\\hfil "
3792 %<+gind,gglo>lethead_suffix "\\hfil}\\nopagebreak\n"
3793 %<+gind>lethead_flag 1
3794 %<+gglo>lethead_flag 0
3796 % This works for newer ones:
3798 %<+gind,gglo>heading_prefix "{\\bfseries\\hfil "
3799 %<+gind,gglo>heading_suffix "\\hfil}\\nopagebreak\n"
3800 %<+gind>headings_flag 1
3801 %<+gglo>headings_flag 0
3807 % \subsection[Dealing with the change history]
3808 % {Dealing with the change history\footnotemark}
3809 % \footnotetext{The whole section was proposed by Brian \textsc{Hamilton
3810 % Kelly}. He also documented and debugged the macros as
3811 % well as many other parts of this package.}
3813 % To provide a change history log, the |\changes| command has
3814 % been introduced. This takes three arguments, respectively, the
3815 % version number of the file, the date of the change, and some detail
3816 % regarding what change has been made. The second of these arguments
3817 % is otherwise ignored, but the others are written out and may be used
3818 % to generate a history of changes, to be printed at the end of the
3819 % document. However, note that older versions of Chen's standard
3820 % \textsf{makeindex}
3821 % program limit any textual field to just 64 characters; therefore,
3822 % is important that the number of characters in the second and third
3823 % parameters should not exceed 61 altogether (to allow for the
3824 % parentheses placed around the date).
3826 % \begin{macro}{\changes}
3827 % \changes{BHK}{1989/04/26}{Documented \texttt{\protect\bslash changes}
3829 % \changes{BHK}{1989/04/26}{Changed definition of
3830 % \texttt{\protect\bslash protect}.} The output of the |\changes|
3831 % command goes into the \meta{Glossary\_File} and therefore uses
3832 % the normal |\glossaryentry| commands.\footnote{Note that a recent
3833 % change in \LaTeX{} 2.09 changed the command name in the
3834 % \texttt{.glo} file from \texttt{\bslash indexentry} to
3835 % \texttt{\bslash glossaryentry}. It is therefore necessary to
3836 % have a special \textsf{makeindex} style file called
3837 % \texttt{gglo.ist} to process this file correctly.} Thus
3838 % \textsf{makeindex} or a similar program can be used to process
3839 % the output into a sorted ``glossary''. The |\changes| command
3840 % commences by taking the usual measures to hide its spacing, and
3841 % then redefines |\protect| for use within the argument of the
3842 % generated |\indexentry| command.
3844 % We re-code nearly all chars found in |\sanitize| to letter
3845 % since the use of special package which make some characters
3846 % active might upset the |\changes| command when writing its
3847 % entries to the file. However we have to leave |%| as comment
3848 % and \verb*+ + as \meta{space} otherwise chaos will happen.
3849 % And, of course the |\| should be available as escape
3851 % \changes{v1.5v}{1990/01/28}{`Re-code a lot of chars.}
3852 % \changes{v1.5m}{1989/09/20}{\cs{actualchar} in second level removed.}
3853 % \changes{v1.5o}{1989/09/24}{New sorting.}
3854 % \changes{v1.6c}{1990/06/29}{Again new sorting.}
3855 % \changes{v1.9u}{1995/08/06}{Use \cs{protected@edef}}
3857 \def\changes{\@bsphack\begingroup\@sanitize
3858 \catcode`\\\z@ \catcode`\ 10 \MakePercentIgnore
3860 \def\changes@#1#2#3{%
3861 \protected@edef\@tempa{\noexpand\glossary{#1\levelchar
3863 % \changes{v1.9u}{1995/08/06}{Use value of \cs{saved@macroname} to
3864 % find out about change entries at outer level}
3865 % If the macro "\saved@macroname" doesn't contain any macro name
3866 % (ie is empty) the current changes entry was done at top-level.
3867 % In this case we precede it by "\generalname".
3869 \ifx\saved@macroname\@empty
3875 % \changes{v2.1g}{2016/02/15}{Use \cs{saved@indexname}}
3879 \string\verb\quotechar*%
3880 \verbatimchar\saved@macroname
3884 \@tempa\endgroup\@esphack}
3887 % \begin{macro}{\saved@macroname}
3888 % \changes{BHK}{1989/04/26}{Provided for sorting outside \textsf{macro}
3889 % environment} The entries are sorted for convenience by the name
3890 % of the most recently introduced macroname (i.e., that in the most
3891 % recent |\begin{macro}| command). We therefore provide
3892 % |\saved@macroname| to record that argument, and provide a default
3893 % definition in case |\changes| is used outside a \textsf{macro}
3894 % environment. (This is a {\em wicked\/} hack to get such entries
3895 % at the beginning of the sorted list! It works providing no macro
3896 % names start with "!" or |"|.) \changes{v1.7a}{1992/03/02}{Changed
3897 % string used for better sorting.}
3898 % \changes{v1.9u}{1995/08/06}{Now empty by default}
3900 \def\saved@macroname{}
3904 % \begin{macro}{\saved@indexname}
3905 % \changes{v2.1g}{2016/02/15}{Use \cs{saved@indexname}}
3906 % The macroname being document without a backslash for the index
3907 % (or the environment name which doesn't have one in the first place).
3909 \def\saved@indexname{}
3913 % \begin{macro}{\generalname}
3914 % \changes{v1.9u}{1995/08/06}{Macro added}
3915 % This macro holds the string placed before changes entries on
3918 \def\generalname{General}
3923 % \begin{macro}{\RecordChanges}
3924 % \changes{BHK}{1989/04/26}{Renames former \texttt{\protect\bslash
3925 % PrintChanges} command.}
3926 % To cause the changes to be written (to a \texttt{.glo}) file, we
3927 % define |\RecordChanges| to invoke \LaTeX's usual
3928 % |\makeglossary| command.
3930 \let\RecordChanges\makeglossary
3936 % \begin{macro}{\GlossaryMin}
3937 % \changes{BHK}{1989/04/26}{Added to support
3938 % \texttt{\protect\bslash changes}.}
3939 % \begin{macro}{\c@GlossaryColumns}
3940 % \changes{BHK}{1989/04/26}{Added to support \texttt{\protect\bslash
3941 % changes}.} The remaining macros are all analogues of those used
3942 % for the \textsf{theindex} environment. When the glossary is
3943 % started we compute the space which remains at the bottom of the
3944 % current page; if this is greater than |\GlossaryMin| then the
3945 % first part of the glossary will be placed in the available space.
3946 % The number of columns set are controlled by the counter
3947 % |\c@GlossaryColumns| which can be changed with a |\setcounter|
3950 \newdimen\GlossaryMin \GlossaryMin = 80pt
3951 \newcount\c@GlossaryColumns \c@GlossaryColumns = 2
3957 % \begin{environment}{theglossary}
3958 % \changes{BHK}{1989/04/26}{Added to support
3959 % \texttt{\protect\bslash changes}.}
3960 % \changes{v1.5p}{1989/09/28}{Now call \cs{multicols} first.}
3961 % \changes{v1.6e}{1991/04/03}{Turned into env definition.}
3962 % \changes{v1.7a}{1992/03/10}{Changed to work without multicols if
3964 % \begin{macro}{\endglossary}
3965 % \changes{BHK}{1989/04/26}{Added to support
3966 % \texttt{\protect\bslash changes}.}
3967 % The environment \textsf{theglossary} is defined in the same manner
3968 % as the \textsf{theindex} environment.
3971 \newenvironment{theglossary}{%
3972 \begin{multicols}\c@GlossaryColumns
3973 [\glossary@prologue][\GlossaryMin]%
3974 \GlossaryParms \let\item\@idxitem \ignorespaces}%
3977 \newenvironment{theglossary}{%
3978 \@restonecoltrue\if@twocolumn\@restonecolfalse\fi
3979 \columnseprule \z@ \columnsep 35\p@
3980 \twocolumn[\glossary@prologue]%
3981 \GlossaryParms \let\item\@idxitem \ignorespaces}
3982 {\if@restonecol\onecolumn\else\clearpage\fi}
3988 % Here are the necessary \textsf{makeindex} declarations with scanning
3989 % disabled as for the index.
3993 %<+gglo>"\n \\begin{theglossary} \n
3994 %<+gglo> \\makeatletter\\scan@allowedfalse\n"
3996 %<+gglo>"\n\n \\end{theglossary}\n"
3998 % This difference from \texttt{gind.ist} is necessary if you have an
3999 % up-to-date \LaTeX.
4001 %<+gglo>keyword "\\glossaryentry"
4006 % \begin{macro}{\GlossaryPrologue}
4007 % \changes{BHK}{1989/04/26}{Added to support
4008 % \texttt{\protect\bslash changes}.}
4009 % \begin{macro}{\glossary@prologue}
4010 % \changes{BHK}{1989/04/26}{Added to support
4011 % \texttt{\protect\bslash changes}.}
4012 % The |\GlossaryPrologue| macro is used to place a short
4013 % message above the glossary into the document. It is implemented
4014 % by redefining |\glossary@prologue|, a macro which holds the
4015 % default text. We better make it a long macro to allow
4016 % |\par| commands in its argument.
4018 \long\def\GlossaryPrologue#1{\@bsphack
4019 \def\glossary@prologue{#1}%
4022 % Now we test whether the default is already defined by another
4023 % package file. If not we define it.
4025 \@ifundefined{glossary@prologue}
4026 {\def\glossary@prologue{\section*{{Change History}}%
4027 \markboth{{Change History}}{{Change History}}%
4033 % \begin{macro}{\GlossaryParms}
4034 % \changes{BHK}{1989/04/26}{Added to support
4035 % \texttt{\protect\bslash changes}.}
4036 % Unless the user specifies otherwise, we set the change history
4037 % using the same parameters as for the index except that we make it sort
4038 % of ragged right as it contains text that often doesn't break nicely in
4040 % \changes{v2.1g}{2016/02/15}{Use ragged setting by default}
4042 \@ifundefined{GlossaryParms}{\let\GlossaryParms\IndexParms
4043 \expandafter\def\expandafter\GlossaryParms\expandafter{\GlossaryParms
4044 \rightskip 15pt plus 1fil
4045 \parfillskip -15pt plus -1fil\relax}
4049 % \begin{macro}{\PrintChanges}
4050 % \changes{BHK}{1989/04/26}{Added to support
4051 % \texttt{\protect\bslash changes}.}
4052 % To read in and print the sorted change history, just put the
4053 % |\PrintChanges| command as the last (commented-out, and thus
4054 % executed during the documentation pass through the file) command
4055 % in your package file. Alternatively, this command may form one of
4056 % the arguments of the |\StopEventually| command, although a
4057 % change history is probably {\em not\/} required if only the
4058 % description is being printed.
4060 % The command assumes that \textsf{makeindex} or some other program
4061 % has processed the \texttt{.glo} file to generate a sorted
4062 % \texttt{.gls} file.
4063 % \changes{v1.9h}{1994/02/10}{Use \cs{@input@} instead of \cs{@input}.}
4064 % \changes{v1.9w}{1995/12/29}{Turn the cmd into a noop after use.}
4066 \def\PrintChanges{\@input@{\jobname.gls}%
4067 \global\let\PrintChanges\@empty}
4075 % \subsection{Bells and whistles}
4077 % \begin{macro}{\StopEventually}
4078 % \changes{v1.5k}{1989/09/04}{Support for checksum.}
4079 % \begin{macro}{\Finale}
4080 % \changes{v1.5k}{1989/09/04}{Support for checksum.}
4081 % \changes{v1.5z}{1990/04/22}{Define \cs{Finale} globally.}
4082 % \begin{macro}{\AlsoImplementation}
4083 % \changes{v1.9w}{1995/12/27}{Macro added}
4084 % \begin{macro}{\OnlyDescription}
4085 % If |\AlsoImplementation| is in force the whole documentation
4086 % including the code part will be typeset. This is the default.
4088 \newcommand\AlsoImplementation{%
4090 % To make this happen we have to define
4091 % |\StopEventually| in a way that its argument is typeset at the
4092 % very end or more exactly at |\Finale|. For this we
4093 % save its argument in the macro |\Finale|.
4095 \long\def\StopEventually##1{\@bsphack\gdef\Finale{##1%
4097 % But |\Finale| will be called at the very end of a file. This
4098 % is exactly the point were we want to know if the file is
4099 % uncorrupted. Therefore we also call |\check@checksum| at this
4104 % On the other hand: |\StopEventually| is more or less a
4105 % dividing point between description and code. So we start to look
4106 % for the check-sum of the documented file by calling
4114 % Since |\AlsoImplementation| should be the default we execute it
4115 % and thus |\StopEventually| gets the desired meaning.
4119 % When the user places an |\OnlyDescription| declaration in
4120 % the driver file the document should only be typeset up to
4121 % |\StopEventually|. We therefore have to redefine this macro.
4123 \def\OnlyDescription{\@bsphack\long\def\StopEventually##1{%
4125 % In this case the argument of |\StopEventually| should be set
4126 % and afterwards \TeX{} should stop reading from this file.
4127 % Therefore we finish this macro with
4129 ##1\endinput}\@esphack}
4131 % If no |\StopEventually| command is given we silently ignore a
4133 % \changes{v1.9n}{1994/04/28}{Ignore \cs{Finale} if no
4134 % \cs{StopEventually} is given}
4143 % \begin{macro}{\meta}
4144 % \changes{v1.4t}{1989/04/24}{Macro added.}
4145 % \changes{v1.5w}{1990/02/03}{Breaks at space allowed.}
4146 % \changes{v1.6a}{1990/05/24}{Extra space bug corrected.}
4147 % The |\meta| macro is a bit tricky. We want to allow line
4148 % breaks at blanks in the argument but we don't want a break
4149 % in between. In the past this was done by defining |\meta| in a way that a
4150 % \verb*+ + is active when the argument is scanned. Words are then
4151 % scanned into |\hbox|es. The active \verb*+ + will end the
4152 % preceding |\hbox| add an ordinary space and open a new
4153 % |\hbox|. In this way breaks are only possible at spaces. The
4154 % disadvantage of this method was that |\meta| was neither robust
4155 % nor could it be |\protect|ed. The new implementation fixes this
4156 % problem by defining |\meta| in a radically different way: we
4157 % prevent hyphenation by defining a |\language| which has no
4158 % patterns associated with it and use this to typeset the words
4159 % within the angle brackets.
4160 % \changes{v2.0i}{2000/05/21}{New implementation (pr/3170)}
4162 \ifx\l@nohyphenation\undefined
4163 \newlanguage\l@nohyphenation
4168 \DeclareRobustCommand\meta[1]{%
4170 % Since the old implementation of |\meta| could be used in math we
4171 % better ensure that this is possible with the new one as
4172 % well. So we use |\ensuremath| around |\langle| and
4173 % |\rangle|. However this is not enough: if |\meta@font@select|
4174 % below expands to |\itshape| it will fail if used in math
4175 % mode. For this reason we hide the whole thing inside an
4176 % |\nfss@text| box in that case.
4177 % \changes{v2.0l}{2000/06/10}{Fixing changes for (pr/3170)}
4180 \ifmmode \expandafter \nfss@text \fi
4184 % Need to keep track of what we changed just in case the user
4185 % changes font inside the argument so we store the font explicitly.
4186 % \changes{v2.0m}{2000/07/04}{More fixing changes for (pr/3170)}
4188 \edef\meta@hyphen@restore
4189 {\hyphenchar\the\font\the\hyphenchar\font}%
4190 \hyphenchar\font\m@ne
4191 \language\l@nohyphenation
4193 \meta@hyphen@restore
4200 % \begin{macro}{\meta@font@select}
4201 % \changes{v2.0k}{2000/05/26}{Macro added (pr/3170)}
4202 % Maske font used inside |\meta| customizable.
4204 \def\meta@font@select{\itshape}
4209 % \begin{macro}{\IndexInput}
4210 % This next macro may be used to read in a separate file (possibly
4211 % a package file that is {\em not\/} documented by this means) and
4212 % set it verbatim, whilst scanning for macro names and indexing the
4213 % latter. This could be a useful first pass in preparing to
4214 % generate documentation for the file read.
4218 % We commence by setting up a group, and initializing a
4219 % |\trivlist| as is normally done by a
4220 % |\begin{macrocode}| command.
4222 \begingroup \macro@code
4224 % We also make spacing behave as in the \textsf{macrocode}
4225 % environment, because otherwise all the spaces will be shown
4228 \frenchspacing \@vobeyspaces
4230 % Then it only remains to read in the specified file, and finish
4231 % off the |\trivlist|.
4232 % \changes{v1.5t}{1989/11/07}{Call \cs{endmacrocode} instead
4233 % of \cs{endtrivlist}.}
4235 \input{#1}\endmacrocode
4237 % Of course, we need to finish off the group as well.
4244 % \begin{macro}{\maketitle}
4245 % The macro to generate titles is easily altered in order that it
4246 % can be used more than once (an article with many titles). In the
4247 % original, diverse macros were concealed after use with
4248 % |\relax|. We must cancel anything that may have been put
4249 % into |\@thanks|, etc., otherwise {\em all\/} titles will
4250 % carry forward any earlier such setting!
4251 % \changes{v1.5j}{1989/06/09}{thispagestyle plain removed}
4252 % \changes{v1.9r}{1994/06/09}{Added new definitions of
4253 % \cs{@makefnmark} and \cs{@makefntext}}
4256 \begingroup \def \thefootnote {\fnsymbol {footnote}}%
4257 \setcounter {footnote}\z@
4258 \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
4259 \long\def\@makefntext##1{\parindent 1em\noindent
4260 \hbox to1.8em{\hss$\m@th^{\@thefnmark}$}##1}%
4261 \if@twocolumn \twocolumn [\@maketitle ]%
4262 \else \newpage \global \@topnum \z@ \@maketitle \fi
4264 % \changes{v1.5k}{1989/09/04}{Added \cs{ps@titlepage}}
4265 % For special formatting requirements (such as in TUGboat), we use
4266 % pagestyle |titlepage| for this; this is later defined to be
4267 % |plain|, unless already defined, as, for example, by
4270 \thispagestyle{titlepage}\@thanks \endgroup
4272 % If the driver file documents many files, we don't want parts of a
4273 % title of one to propagate to the next, so we have to cancel
4276 \setcounter {footnote}\z@
4277 \gdef\@date{\today}\gdef\@thanks{}%
4278 \gdef\@author{}\gdef\@title{}}
4283 % \begin{macro}{\ps@titlepage}
4284 % \changes{v1.5k}{1989/09/04}{Added \texttt{\protect\bslash
4285 % ps@titlepage}} When a number of articles are concatenated into a
4286 % journal, for example, it is not usual for the title pages of such
4287 % documents to be formatted differently. Therefore, a class
4288 % such as \textsf{ltugboat} can define this macro in advance.
4289 % However, if no such definition exists, we use pagestyle
4290 % \texttt{plain} for title pages.
4292 \@ifundefined{ps@titlepage}
4293 {\let\ps@titlepage=\ps@plain}{}
4297 % \begin{macro}{\MakeShortVerb}
4298 % \changes{v1.7a}{1992/02/27}{Added (from newdoc but now alters
4299 % \cs{dospecials}, \cs{@sanitize}).}
4300 % This arranges an abbreviation for "\verb" such that if you say
4301 % "\MakeShortVerb{\"\meta{c}"}" subsequently using
4302 % \meta{c}\meta{text}\meta{c} is equivalent to
4303 % "\verb"\meta{c}\meta{text}\meta{c}.\footnote{Warning:
4304 % the commentary in the rest of this section was written by Dave
4305 % Love.} In addition, the fact
4306 % that \meta{c} is made active is recorded for the benefit of the
4307 % \textsf{verbatim} and \textsf{macrocode} environments.
4308 % Note particularly that the definitions below are global.
4309 % The first thing we do (it needn't be first) is to record
4310 % the---presumably new---special character in "\dospecials" and
4311 % "\@sanitize" using "\add@special".
4313 % \changes{v1.9e.2}{1994/02/07}{-js: Check if \protect\meta{c} is
4315 % abbreviation for \cs{verb}.}
4316 % Some unwary user might issue "\MakeShortVerb" for a second time, we
4317 % better protect against this. We assume that this happened if a
4318 % control sequence "\cc\"\meta{c} is bound, the probability that this
4319 % name is used by another module is low. We will output a warning
4320 % below, so that a possible error might be noticed by the programmer
4321 % if he reads the "LOG" file. (Should have used module internal names,
4324 % \begin{macro}{\MakeShortVerb*}
4325 % \changes{v2.1a}{2003/12/09}{(HjG) Added \texttt{*} form}
4326 % This arranges an abbreviation for "\verb*" such that if you say
4327 % "\MakeShortVerb*{\"\meta{c}"}" subsequently using
4328 % \meta{c}\meta{text}\meta{c} is equivalent to
4329 % "\verb*"\meta{c}\meta{text}\meta{c}.
4332 %<*package|shortvrb>
4333 \def\MakeShortVerb{%
4335 {\def\@shortvrbdef{\verb*}\@MakeShortVerb}%
4336 {\def\@shortvrbdef{\verb}\@MakeShortVerb}}
4340 \def\@MakeShortVerb#1{%
4341 \expandafter\ifx\csname cc\string#1\endcsname\relax
4343 % \changes{v1.9v}{1995/11/03}{(DPC) Use \cs{@shortvrbinfo}}
4345 \@shortvrbinfo{Made }{#1}\@shortvrbdef
4348 % Then the character's current catcode is stored in "\cc\"\meta{c}.
4351 \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
4353 % The character is spliced into the definition using the same trick as
4354 % used in "\verb" (for instance), having activated "~" in a group.
4357 \catcode`\~\active \lccode`\~`#1%
4360 % The character's old meaning is recorded in "\ac\"\meta{c} prior to
4361 % assigning it a new one.
4363 \global\expandafter\let
4364 \csname ac\string#1\endcsname~%
4365 \expandafter\gdef\expandafter~\expandafter{\@shortvrbdef~}}%
4368 % Finally the character is made active.
4370 \global\catcode`#1\active
4372 % If we suspect that \meta{c} is already a short reference, we tell
4373 % the user. Now he or she is responsible if anything goes wrong\,\dots
4377 % \changes{v1.9v}{1995/11/03}{(DPC) Use \cs{@shortvrbinfo}}
4379 \@shortvrbinfo\@empty{#1 already}{\@empty\verb(*)}%
4383 % \begin{macro}{\DeleteShortVerb}
4384 % \changes{v1.7a}{1992/02/27}{Added (from newdoc but now alters
4385 % \cs{dospecials}, \cs{@sanitize}).}
4386 % Here's the means of undoing a "\MakeShortVerb", for instance in a
4387 % region where you need to use the character outside a verbatim
4388 % environment. It arranges for "\dospecials" and "\@sanitize" to be
4389 % altered appropriately, restores the saved catcode and, if necessary,
4390 % the character's meaning (as stored by
4391 % "\MakeShortVerb"). If the catcode wasn't stored in
4392 % "\cc\"\meta{c} (by "\MakeShortVerb") the command is silently
4394 % \changes{v1.7a}{1992/02/28}{Check for previous matched
4395 % \cs{MakeShortVerb}
4398 \def\DeleteShortVerb#1{%
4399 \expandafter\ifx\csname cc\string#1\endcsname\relax
4401 % \changes{v2.1a}{2003/12/10}{(HjG) Notify user
4402 % if it's not a short verb character}
4404 \@shortvrbinfo\@empty{#1 not}{\@empty\verb(*)}%
4407 % \changes{v1.9v}{1995/11/03}{(DPC) Use \cs{@shortvrbinfo}}
4409 \@shortvrbinfo{Deleted }{#1 as}{\@empty\verb(*)}%
4411 \global\catcode`#1\csname cc\string#1\endcsname
4413 % \changes{v1.9e.2}{1994/02/07}{-js: Reset `cc`\protect\meta{c} in
4414 % in \cs{DeleteShortVerb}}
4415 % We must not forget to reset "\cc\"\meta{c}, otherwise the check in
4416 % "\MakeShortVerb" for a repeated definition will not work.
4418 \global \expandafter\let \csname cc\string#1\endcsname \relax
4419 \ifnum\catcode`#1=\active
4421 \catcode`\~\active \lccode`\~`#1%
4423 \global\expandafter\let\expandafter~%
4424 \csname ac\string#1\endcsname}%
4429 % \begin{macro}{\@shortvrbinfo}
4430 % \changes{v1.9v}{1995/11/03}{(DPC) Macro added}
4431 % \changes{v2.1a}{2003/12/10}{(HjG) Third argument added
4432 % on behalf of \cmd{\MakeShortVerb*}}
4433 % Helper function for info messages.
4435 \def\@shortvrbinfo#1#2#3{%
4436 %<shortvrb> \PackageInfo{shortvrb}{%
4437 %<!shortvrb> \PackageInfo{doc}{%
4438 #1\expandafter\@gobble\string#2 a short reference
4439 for \expandafter\string#3}}
4443 % \begin{macro}{\add@special}
4444 % \changes{v1.7a}{1992/02/27}{Added for short verb facility.}
4445 % This helper macro adds its argument to the
4446 % "\dospecials" macro which is conventionally used by verbatim macros
4447 % to alter the catcodes of the currently active characters. We need
4448 % to add "\do\"\meta{c} to the expansion of "\dospecials" after
4449 % removing the character if it was already there to avoid multiple
4450 % copies building up should "\MakeShortVerb" not be balanced by
4451 % "\DeleteShortVerb" (in case anything that uses "\dospecials" cares
4452 % about repetitions).
4454 \def\add@special#1{%
4456 \expandafter\gdef\expandafter\dospecials\expandafter
4457 {\dospecials \do #1}%
4459 % Similarly we have to add "\@makeother\"\meta{c} to "\@sanitize"
4460 % (which is used in things like "\index" to re-catcode all special
4461 % characters except braces).
4463 \expandafter\gdef\expandafter\@sanitize\expandafter
4464 {\@sanitize \@makeother #1}}
4467 % \begin{macro}{\rem@special}
4468 % \changes{v1.7a}{1992/02/27}{Added for short verb facility.}
4469 % The inverse of "\add@special" is slightly trickier. "\do" is
4470 % re-defined to expand to nothing if its argument is the character of
4471 % interest, otherwise to expand simply to the argument. We can then
4472 % re-define "\dospecials" to be the expansion of itself. The space
4473 % after "=`##1" prevents an expansion to "\relax"!
4475 \def\rem@special#1{%
4477 \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
4478 \xdef\dospecials{\dospecials}%
4480 % Fixing "\@sanitize" is the same except that we need to re-define
4481 % "\@makeother" which obviously needs to be done in a group.
4484 \def\@makeother##1{%
4485 \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
4486 \xdef\@sanitize{\@sanitize}%
4488 %</package|shortvrb>
4492 % \begin{macro}{\MakeShortverb}
4493 % \begin{macro}{\DeleteShortverb}
4494 % \changes{v1.7a}{1992/02/27}{Added (from newdoc).}
4495 % These commands from \textsf{newdoc} are now obsolete.
4497 \def\MakeShortverb{\typeout{*** Switch to \noexpand\MakeShortVerb
4498 syntax, this is obsolete ***}\MakeShortVerb}
4499 \def\DeleteShortverb{\typeout{*** Switch to \noexpand\DeleteShortVerb
4500 syntax, this is obsolete ***}\DeleteShortVerb}
4507 % \subsection[Providing a checksum and character table]
4508 % {Providing a checksum and character table\footnotemark}
4509 % \footnotetext{Warning: the commentary in this section was
4510 % written by Dave Love. }
4513 % \begin{macro}{\init@checksum}
4514 % The checksum mechanism works by counting backslashes in the
4515 % macrocode. This initialises the count (when called from
4516 % "\StopEventually").
4517 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4519 \def\init@checksum{\relax
4520 \global\bslash@cnt\z@}
4525 % \begin{macro}{\check@checksum}
4526 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4527 % This reports the sum compared with the value ("\bslash@cnt") the
4528 % file advertises. It's called from "\Finale" (if that hasn't been
4530 % \changes{v2.1f}{2016/02/12}{Suppress \cs{CheckSum} check if no checksum
4531 % is specified in the file}
4533 \def\check@checksum{\relax
4534 \ifnum\check@sum>\m@ne
4536 % We do nothing if the checksum in the file is negative (or not given as
4537 % it is initialized with -1).
4539 \ifnum\check@sum=\z@
4540 \typeout{**********************************}%
4541 \typeout{* This macro file has no checksum!}%
4542 \typeout{* The checksum should be \the\bslash@cnt!}%
4543 \typeout{**********************************}%
4545 \ifnum\check@sum=\bslash@cnt
4546 \typeout{*******************}%
4547 \typeout{* Checksum passed *}%
4548 \typeout{*******************}%
4550 \PackageError{doc}{Checksum not passed
4551 (\the\check@sum<>\the\bslash@cnt)}%
4552 {The file currently documented seems to be wrong.^^J%
4553 Try to get a correct version.}%
4557 \global\check@sum\m@ne}
4562 % \begin{macro}{\check@sum}
4563 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4564 % \begin{macro}{\bslash@cnt}
4565 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4566 % We need to define counters, "\bslash@cnt" for the number of
4567 % backslashes counted and "\check@sum" for the value advertised by the
4568 % file if any. A negative value means there is no checksum checking which is the default.
4569 % \changes{v2.1f}{2016/02/12}{Suppress \cs{CheckSum} check if no checksum
4570 % is specified in the file}
4572 \newcount\check@sum \check@sum = \m@ne
4573 \newcount\bslash@cnt \bslash@cnt = \z@
4579 % \begin{macro}{\CheckSum}
4580 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4581 % This is the interface to setting "\check@sum".
4583 \def\CheckSum#1{\@bsphack\global\check@sum#1\relax\@esphack}
4589 % \begin{macro}{\step@checksum}
4590 % \changes{v1.5k}{1989/09/04}{Macro added to support checksum.}
4591 % This advances the count when a backslash is encountered in the
4594 \def\step@checksum{\global\advance\bslash@cnt\@ne}
4598 % \begin{macro}{\CharacterTable}
4599 % The user interface to the character table-checking does some
4600 % "\catcode"ing and then compares the following table with the
4601 % stored version. We need to have "@" of type ``other'' within the
4602 % table since this is the way it is usually returned when reading
4603 % in a normal document. To nevertheless have a private letter we
4604 % use "~" for this purpose. "~" does no harm as a ``letter'' as it
4605 % comes last in the table and therefore will not gobble following
4607 % \changes{v1.5m}{1989/09/20}{Macro added to check character translation
4609 % \changes{v1.5q}{1989/11/01}{Made character table more readable.}
4610 % \changes{v1.5t}{1989/11/07}{Make \string\~{} letter in chartable
4612 % \changes{v1.5u}{1989/11/14}{Made @ other in default table.}
4614 \def\CharacterTable{\begingroup \CharTableChanges \character@table}
4617 % \def\MakePrivateLetters{\catcode`\~=11\makeatletter}
4618 % \begin{macro}{\character@table}
4619 % This does the work of comparing the tables and reporting the result.
4620 % Note that the following code is enclosed in a group
4621 % with "~" catcoded to letter.
4625 \gdef\character@table#1{\def\used~table{#1}%
4626 \ifx\used~table\default~table
4627 \typeout{***************************}%
4628 \typeout{* Character table correct *}%
4629 \typeout{***************************}%
4631 \PackageError{doc}{Character table corrupted}
4640 % \begin{macro}{\CharTableChanges}
4641 % When the character table is read in we need to scan it with a
4642 % fixed set of "\catcode"s. The reference table below was defined by
4643 % assuming the normal "\catcode"s of \TeX{}, i.e.\ "@" is of type
4644 % other and the only token of type ``letter'' are the usual letters
4645 % of the alphabet. If, for some reason, other characters are made
4646 % ``letters'' then their "\catcode"s need to be restored before
4647 % checking the table. Otherwise spaces in the table are gobbled and
4648 % we get the information that the tables are different, even if
4649 % they are actually equal. For this reason "\CharTableChanges" can
4650 % be set up to locally restore the "\catcode"s of such ``letters''
4653 \global\let\CharTableChanges\@empty
4657 % \begin{macro}{\default~table}
4658 % Here's what the table {\em should\/} look like (modulo spaces).
4662 {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
4663 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
4664 Digits \0\1\2\3\4\5\6\7\8\9
4665 Exclamation \! Double quote \" Hash (number) \#
4666 Dollar \$ Percent \% Ampersand \&
4667 Acute accent \' Left paren \( Right paren \)
4668 Asterisk \* Plus \+ Comma \,
4669 Minus \- Point \. Solidus \/
4670 Colon \: Semicolon \; Less than \<
4671 Equals \= Greater than \> Question mark \?
4672 Commercial at \@ Left bracket \[ Backslash \\
4673 Right bracket \] Circumflex \^ Underscore \_
4674 Grave accent \` Left brace \{ Vertical bar \|
4675 Right brace \} Tilde \~}
4679 % \let\MakePrivateLetters=\makeatletter
4681 % \begin{macro}{\wrong@table}
4682 % \changes{v1.7a}{1992/02/28}{Moved to where the catcodes are right
4684 % We need a help message in case of problems.
4686 \newhelp\wrong@table{Some of the ASCII characters are corrupted.^^J
4687 I now \string\show\space you both tables for comparison.}
4692 % \subsection[Attaching line numbers to code lines]
4693 % {Attaching line numbers to code lines\footnotemark}
4694 % \footnotetext{Warning: the commentary was written by Dave
4698 % The code in this section allows index entries to refer to code line
4699 % numbers---the number of the first line of macrocode in the
4700 % \textsf{macro} environment.
4703 % \begin{macro}{\codeline@index}
4704 % Indexing by code line is controlled by the "codeline@index" switch.
4705 % \changes{v1.5s}{1989/11/05}{Support for code line no. (Undoc)}
4706 % \changes{v1.7a}{1992/02/24}{Documented code line no. support.}
4707 % \begin{macro}{\CodelineNumbered}
4708 % \changes{v1.8a}{1993/05/19}{Macro added}
4710 \newif\ifcodeline@index \codeline@indexfalse
4711 \let\CodelineNumbered\codeline@indextrue
4715 % \begin{macro}{\codeline@wrindex}
4716 % The code index entries are written out by "\special@index". If
4717 % indexing is by code line this is "\let" to "\codeline@wrindex";
4718 % if indexing is by page it is just "\index". However, if
4719 % "\nofiles" is given, we omit writing such an index entry at all.
4720 % \changes{v1.7j}{1992/08/14}{Added \cs{if@filesw}.}
4722 \def\codeline@wrindex#1{\if@filesw
4723 \immediate\write\@indexfile
4724 {\string\indexentry{#1}%
4725 {\number\c@CodelineNo}}\fi}
4728 % \begin{macro}{\special@index}
4729 % By default no index entries are written out.
4731 \let\special@index = \@gobble
4734 % \begin{macro}{\CodelineIndex}
4735 % \changes{v1.5u}{1989/11/14}{Added \cs{PageIndex} and
4736 % \cs{CodelineIndex} (Undoc)}
4737 % This switches on use of the index file with "\makeindex", sets the
4738 % switch to indicate code line numbering and defines "\special@index"
4741 \def\CodelineIndex{\makeindex
4743 \let\special@index\codeline@wrindex}
4746 % \begin{macro}{\PageIndex}
4747 % "\PageIndex" is similar.
4749 \def\PageIndex{\makeindex
4750 \codeline@indexfalse
4751 \let\special@index\index}
4756 % \begin{macro}{\c@CodelineNo}
4757 % \changes{v1.5l}{1989/09/10}{Counter added to support code line
4759 % \changes{v1.5y}{1990/02/24}{Default changed.}
4760 % \changes{v1.6b}{1990/06/15}{\cs{rm} moved before \cs{scriptsize} to
4761 % avoid unnecessary fontwarning.}
4762 % We need a counter to keep track of the line number.
4764 \newcount\c@CodelineNo \c@CodelineNo\z@
4767 % \begin{macro}{\theCodelineNo}
4768 % \changes{v1.7a}{1992/02/25}{Existing definition not overwritten.}
4769 % \changes{v1.7a}{1992/03/12}{Use \cs{reset@font} for NFSS.}
4770 % This provides a hook to control the format of line numbers which may
4771 % be defined in a class file.
4773 \@ifundefined{theCodelineNo}
4774 {\ifx\selectfont\undefined
4775 \def\theCodelineNo{\rmfamily\scriptsize\arabic{CodelineNo}}%
4777 \def\theCodelineNo{\reset@font\scriptsize\arabic{CodelineNo}}%
4786 % \subsection{Layout Parameters for documenting package files}
4788 % \begin{macro}{\tolerance}
4789 % People documenting package files would probably rather have things
4790 % ``sticking out'' in overfull |\hbox|es and poorish spacing,
4791 % because they probably don't want to spend a lot of time on making
4792 % all the line breaks perfect!
4794 \tolerance=1000\relax
4798 % \DeleteShortVerb{\"}
4800 % The following |\mathcode| definitions allow the characters
4802 % and `\texttt{@}' to appear in |\ttfamily| font when invoked in math
4803 % mode;\footnote{You may wonder why the definitions state that both
4804 % characters belong to the {\em variable family\/}
4805 % (i.e.\ the number 7 in front). The reason is this:
4806 % Originally the \texttt{\bslash mathcode} of
4807 % \texttt{\bslash} was defined to be \texttt{"075C},
4808 % i.e.\ ordinary character number 92 (hex 5C) in
4809 % math family number 7 which is the typewriter family in
4811 % But this file should not depend on this specific
4812 % setting, so I changed these
4813 % \texttt{\bslash mathcode}$\,$s
4814 % to work with any family assignments. For an example
4815 % see the article about the new font selection scheme.}
4816 % particularly for something like $|\@abc|=1$.
4818 % If an {\em old\/} version of the \textsf{german} package is in
4819 % force, then the `|"|' character is active and would upset the
4820 % definition of the \meta{16-bit number} quantities below, therefore
4821 % we change the |\catcode| of |"| inside a group, and use
4825 \global\mathcode`\\="705C \global\mathcode`\@="7040 }
4827 % \MakeShortVerb{\"}
4829 % \begin{macro}{\DocstyleParms}
4830 % This macro can be used, for example, to assign new values to
4831 % |\MacrocodeTopsep| and |\MacroIndent| and some other internal
4832 % registers. If it is already defined, the default definition
4833 % won't be carried out. Note that it is necessary to assign new
4834 % values via this macro if it should be done in a class file (like
4835 % \texttt{ltugboat.cls} for example) since the registers are
4836 % undefined before \texttt{doc.sty} is read in. The default values
4837 % for the internal registers are scattered over this file.
4838 % \changes{v1.5u}{1989/11/14}{\cs{DocStyleParms} now empty}
4840 \@ifundefined{DocstyleParms}{}{}
4842 % Now we allow overwriting the values by calling
4845 \DocstyleParms \let\DocstyleParms\relax
4851 % \begin{macro}{\AmSTeX}
4852 % \changes{v1.5j}{1989/06/09}{Macro AmsTeX renamed to AmSTeX}
4853 % \begin{macro}{\BibTeX}
4854 % \begin{macro}{\SliTeX}
4855 % Here are a few definitions which can usefully be employed when
4856 % documenting package files: now we can readily refer to \AmSTeX,
4857 % \BibTeX\ and \SliTeX, as well as the usual \TeX\ and \LaTeX.
4859 \@ifundefined{AmSTeX}
4860 {\def\AmSTeX{\leavevmode\hbox{$\mathcal A\kern-.2em\lower.376ex%
4861 \hbox{$\mathcal M$}\kern-.2em\mathcal S$-\TeX}}}{}
4862 \@ifundefined{BibTeX}
4863 {\def\BibTeX{{\rmfamily B\kern-.05em%
4864 \textsc{i\kern-.025em b}\kern-.08em%
4865 T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}}{}
4866 \@ifundefined{SliTeX}
4867 {\def\SliTeX{{\rmfamily S\kern-.06emL\kern-.18em\raise.32ex\hbox
4868 {\scshape i}\kern -.03em\TeX}}}{}
4873 % \begin{macro}{\PlainTeX}
4874 % \changes{v1.5g}{1989/05/07}{space between plain and TeX changed.}
4875 % \begin{macro}{\Web}
4876 % There's even a \PlainTeX{} and a \Web.
4878 \@ifundefined{PlainTeX}{\def\PlainTeX{\textsc{Plain}\kern2pt\TeX}}{}
4879 \@ifundefined{Web}{\def\Web{\textsc{Web}}}{}
4885 % \subsection{Changing the \texttt{\protect\bslash catcode} of \%}
4887 % \begin{macro}{\MakePercentIgnore}
4888 % \begin{macro}{\MakePercentComment}
4889 % And finally the most important bit: we change the |\catcode|
4890 % of `|%|' so that it is ignored (which is how we are able to
4891 % produce this document!). We provide two commands to do the actual
4893 %^^A The |\MakePercentIgnore| is then called as the
4894 %^^A last command in this file.
4896 \def\MakePercentIgnore{\catcode`\%9\relax}
4897 \def\MakePercentComment{\catcode`\%14\relax}
4902 % \begin{macro}{\DocInput}
4903 % The two macros above are now used to define the |\DocInput| macro
4904 % which was introduced in version v1.5l (or so) of the \DOC{}
4905 % package. In older versions |\MakePercentIgnore| was placed
4906 % at the very end of \texttt{doc.sty}.
4908 \def\DocInput#1{\MakePercentIgnore\input{#1}\MakePercentComment}
4912 % \subsection{GetFileInfo}
4914 % \begin{macro}{\GetFileInfo}
4915 % \changes{v1.9o}{1994/05/08}{Macro added}
4916 % \changes{v1.9z}{1997/02/05}{Missing percent latex/2404}
4917 % Define |\filedate| and friends from info in the
4918 % |\ProvidesPackage| etc.\ commands.
4920 \def\GetFileInfo#1{%
4922 \def\@tempb##1 ##2 ##3\relax##4\relax{%
4924 \def\fileversion{##2}%
4925 \def\fileinfo{##3}}%
4926 \edef\@tempa{\csname ver@#1\endcsname}%
4927 \expandafter\@tempb\@tempa\relax? ? \relax\relax}
4931 % We can now finish the \texttt{docstrip} main module.
4938 % \PrintIndex \PrintChanges