Debian Codegraph @

texmf-dist/source/latex/revtex/ltxdocext.dtx

raw
1 % \iffalse meta-comment balanced on line 108
2 % ltxdocext.dtx: package to extend the ltxdoc class of standard LaTeX
3 % Copyright (c) 2008 Arthur Ogawa
4 %
5 % Disclaimer
6 % This file is distributed WITHOUT ANY WARRANTY;
7 % without even the implied warranty of
8 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 % License
10 % You may distribute this file under the conditions of the
11 % LaTeX Project Public License 1.3c or later
12 % (http://www.latex-project.org/lppl.txt).
13 % ReadMe
14 % For the documentation and more detailed instructions for
15 % installation, typeset this document with \LaTeX.
16 % Maintenance Status
17 % This work has the LPPL maintenance status "maintained";
18 % Current Maintainer of this work is Arthur Ogawa.
19 %
20 % This work consists of the main source file ltxdocext.dtx
21 % and the derived files
22 % ltxdocext.sty, ltxdocext.pdf, ltxdocext.ins, ltxdocext.drv.
23 % Distribution:
24 % CTAN:macros/latex/contrib/revtex/
25 %
26 % Unpacking:
27 % tex ltxdocext.dtx
28 %
29 % Documentation:
30 % latex ltxdocext.dtx; ...
31 %
32 % Program calls to get the documentation (example):
33 % pdflatex ltxdocext.dtx
34 % makeindex -s gind.ist ltxdocext.idx
35 % makeindex -s gglo.ist -o ltxdocext.gls ltxdocext.glo
36 % pdflatex ltxdocext.dtx
37 % makeindex -s gind.ist ltxdocext.idx
38 % pdflatex ltxdocext.dtx
39 %
40 % Installation:
41 % TDS:doc/latex/revtex/
42 % TDS:source/latex/revtex/
43 % TDS:tex/latex/revtex/
44 %
45 % Thanks, Heiko!
46 % This method of letting a single .dtx file serve as both
47 % documentation (via latex) and installer (via tex) follows
48 % the example of Heiko Oberdiek. Thanks!
49 %<*ignore>
50 \begingroup
51 \def\x{LaTeX2e}%
52 \expandafter\endgroup
53 \ifcase
54 0\expandafter\ifx\csname processbatchFile\endcsname\relax\else1\fi\ifx\fmtname\x\else 1\fi
55 \relax
56 \else
57 \csname fi\endcsname
58 %</ignore>
59 %<*install>
60 \input docstrip
61 \preamble
62
63 This is a generated file;
64 altering it directly is inadvisable;
65 instead, modify the original source file.
66 See the URL in the file README.
67
68 License
69 You may distribute this file under the conditions of the
70 LaTeX Project Public License 1.3c or later
71 (http://www.latex-project.org/lppl.txt).
72
73 This file is distributed WITHOUT ANY WARRANTY;
74 without even the implied warranty of MERCHANTABILITY
75 or FITNESS FOR A PARTICULAR PURPOSE.
76
77 \endpreamble
78 \askforoverwritefalse
79 \keepsilent
80 \generate{%
81 %{ignore}
82 %\usedir{tex/latex/revtex}%
83 \file{ltxdocext.sty}{%
84 \from{ltxdocext.dtx}{package,kernel}%
85 }%
86 % \file{acrofont.sty}{\from{ltxdocext.dtx}{fonts}}%
87 }%
88 \ifToplevel{
89 \Msg{***********************************************************}
90 \Msg{*}
91 \Msg{* To finish the installation, please move}
92 \Msg{* ltxdocext.sty}
93 \Msg{* into a directory searched by TeX;}
94 \Msg{* in a TDS-compliant installation:}
95 \Msg{* texmf/tex/macros/latex/revtex/.}
96 \Msg{*}
97 \Msg{* To produce the documentation,
98 run ltxdocext.dtx through LaTeX.}
99 \Msg{*}
100 \Msg{* Happy TeXing}
101 \Msg{***********************************************************}
102 }
103 \endbatchfile
104 %</install>
105 %<*ignore>
106 \fi
107 %</ignore>
108 % \fi
109 %
110 % \GetFileInfo{ltxdocext.dtx}
111 %
112 % \iffalse ltxdoc klootch
113 %<*ltxdocext>
114 %%% @LaTeX-file{
115 %%% filename = "ltxdocext.dtx",
116 %%% version = "1.0a",
117 %%% date = "2018/12/26",
118 %%% author = "Arthur Ogawa (mailto:arthur_ogawa at sbcglobal.net),
119 %%% commissioned by the American Physical Society.
120 %%% ",
121 %%% copyright = "Copyright (C) 1999, 2008 Arthur Ogawa,
122 %%% distributed under the terms of the
123 %%% LaTeX Project Public License, see
124 %%% ftp://ctan.tug.org/macros/latex/base/lppl.txt
125 %%% ",
126 %%% address = "Arthur Ogawa,
127 %%% USA",
128 %%% telephone = "",
129 %%% FAX = "",
130 %%% email = "mailto colon arthur_ogawa at sbcglobal.net",
131 %%% codetable = "ISO/ASCII",
132 %%% keywords = "latex, ltxdoc",
133 %%% supported = "yes",
134 %%% abstract = "extensions to the ltxdoc class",
135 %%% }
136 %</ltxdocext>
137 % \fi
138 %
139 % \iffalse ltxdoc klootch
140 % The following references the \file{README-LTXDOCEXT} file,
141 % which contains basic information about this package.
142 % The contents of this file are generated when
143 % you typeset the programmer's documentation.
144 % Search on "{filecontents*}{README-LTXDOCEXT}" to locate it.
145 % \fi\input{README-LTXDOCEXT}%
146 %
147 % \subsection{Bill of Materials}
148 %
149 % Following is a list of the files in this distribution arranged
150 % according to provenance.
151 %
152 % \subsubsection{Primary Source}%
153 % One single file generates all.
154 %\begin{verbatim}
155 %ltxdocext.dtx
156 %\end{verbatim}
157 %
158 % \subsubsection{Generated by \texttt{latex ltxdocext.dtx}}%
159 % Typesetting the source file under pdflatex
160 % generates the readme and the documentation.
161 %\begin{verbatim}
162 %README ltxdocext.pdf
163 %\end{verbatim}
164 %
165 % \subsubsection{Generated by \texttt{tex ltxdocext.ins}}%
166 % Typesetting this file with \TeX\ generates
167 % the package file.
168 %\begin{verbatim}
169 %ltxdocext.sty acrofont.sty
170 %\end{verbatim}
171 %
172 % \subsubsection{Documentation}%
173 % The following are the online documentation:
174 % \begin{verbatim}
175 %ltxdocext.pdf
176 % \end{verbatim}
177 %
178 % \subsubsection{Auxiliary}%
179 % The following are auxiliary files generated
180 % in the course of running \LaTeX:
181 % \begin{verbatim}
182 %ltxdocext.aux ltxdocext.idx ltxdocext.ind ltxdocext.log ltxdocext.toc
183 % \end{verbatim}
184 %
185 % \section{Code common to all modules}%
186 %
187 % We want to require only one place in this file
188 % where the version number is stated,
189 % and we also want to ensure that the version
190 % number is embedded into every generated file.
191 %
192 % Now we declare that
193 % these files can only be used with \LaTeXe.
194 % An appropriate message is displayed if
195 % a different \TeX{} format is used.
196 % \begin{macrocode}
197 %<*driver|package|fonts>
198 \NeedsTeXFormat{LaTeX2e}[1995/12/01]%
199 %</driver|package|fonts>
200 % \end{macrocode}
201 % As desired, the following modules all
202 % take common version information:
203 % \begin{macrocode}
204 %<package>\ProvidesFile{ltxdocext.sty}%
205 %<fonts>\ProvidesFile{acrofont.sty}%
206 %<*driver>
207 \expandafter\ProvidesFile\expandafter{\jobname.dtx}%
208 %</driver>
209 % \end{macrocode}
210 %
211 % The following line contains, for once and for all,
212 % the version and date information.
213 % By various means, this information is reproduced
214 % consistently in all generated files and in the
215 % typeset documentation.
216 % \begin{macrocode}
217 %<version>
218 [2018/12/26 1.0a ltxdoc extensions package]% \fileversion
219 % \end{macrocode}
220 %
221 %
222 % \section{The driver module \texttt{doc}}
223 %
224 % This module, consisting of the present section,
225 % typesets the programmer's documentation,
226 % generating the \file{README-LTXDOCEXT} as required.
227 %
228 % Because the only uncommented-out lines of code at the beginning of
229 % this file constitute the \file{doc} module itself,
230 % we can simply typeset the \file{.dtx} file directly,
231 % and there is thus rarely any need to
232 % generate the ``doc'' {\sc docstrip} module.
233 % Module delimiters are nonetheless required so that
234 % this code does not find its way into the other modules.
235 %
236 % The \enve{document} command concludes the typesetting run.
237 %
238 % \begin{macrocode}
239 %<*driver>
240 % \end{macrocode}
241 %
242 % \subsection{The Preamble}
243 % The programmers documentation is formatted
244 % with the \classname{ltxdoc} document class, with local customizations,
245 % and with the usual code line indexing.
246 % \begin{macrocode}
247 \documentclass[draft]{ltxdoc}
248 \RequirePackage{ltxdocext}%
249 \RequirePackage[colorlinks=true,linkcolor=blue]{hyperref}%
250 %\expandafter\ifx\csname package@font\endcsname\@undefined\else
251 % \expandafter\RequirePackage\expandafter{\csname package@font\endcsname}%
252 %\fi
253 \CodelineIndex\EnableCrossrefs % makeindex -s gind.ist ltxdocext
254 \RecordChanges % makeindex -s gglo.ist -o ltxdocext.gls ltxdocext.glo
255 % \end{macrocode}
256 %
257 % \subsubsection{Docstrip and info directives}
258 % We use so many {\sc docstrip} modules that we set the
259 % \texttt{StandardModuleDepth} counter to 1.
260 % \begin{macrocode}
261 \setcounter{StandardModuleDepth}{1}
262 % \end{macrocode}
263 % The following command retrieves the date and version information
264 % from this file.
265 % \begin{macrocode}
266 \expandafter\GetFileInfo\expandafter{\jobname.dtx}%
267 % \end{macrocode}
268 %
269 % \subsection{The ``Read Me'' File}
270 % As promised above, here is the contents of the
271 % ``Read Me'' file. That file serves a double purpose,
272 % since it also constitutes the beginining of the
273 % programmer's documentation. What better thing, after
274 % all, to have appear at the beginning of the
275 % typeset documentation?
276 %
277 % A good discussion of how to write a ReadMe file can be found in
278 % Engst, Tonya, ``Writing a ReadMe File? Read This''
279 % \emph{MacTech} October 1998, p. 58.
280 %
281 % Note the appearance of the
282 % \cmd\StopEventually\ command, which marks the
283 % dividing line between the user documentation
284 % and the programmer documentation.
285 %
286 % The usual user will not be asked to
287 % do a full build, not to speak
288 % of the bootstrap.
289 % Instructions for carrying these processes
290 % begin the programmer's manual.
291 %
292 % \begin{macrocode}
293 \begin{filecontents*}{README-LTXDOCEXT}
294 \title{%
295 Extensions to the \classname{ltxdoc} class%
296 \thanks{%
297 This file has version number \fileversion,
298 last revised \filedate.%
299 }%
300 \thanks{%
301 Version \fileversion\ \copyright\ 2019 American Physical Society
302 }%
303 }%
304 \author{%
305 Arthur Ogawa%
306 \thanks{\texttt{mailto:arthur\_ogawa at sbcglobal.net}}%
307 }%
308 %\iffalse
309 % For version number and date,
310 % search on "\fileversion" in the .dtx file,
311 % or see the end of the README file.
312 %\fi
313
314 \maketitle
315
316 This file embodies the \classname{ltxdocext} package,
317 the implementation and its user documentation.
318
319 The distribution point for this work is
320 \url{journals.aps.org/revtex},
321 which contains prebuilt runtime files, documentation, and full source,
322 ready to add to a TDS-compliant \TeX\ installation.
323
324 The \classname{ltxdocext} package was commissioned by the American Physical Society
325 and is distributed under the terms of the \LaTeX\ Project Public License,
326 the same license under which all the portions of \LaTeX\ itself are distributed.
327 Please see \url{http://ctan.tug.org/macros/latex/base/lppl.txt} for details.
328
329 To use this document class, you must have a working
330 \TeX\ installation equipped with \LaTeXe\
331 and possibly pdftex and Adobe Acrobat Reader or equivalent.
332
333 To install, retrieve the distribution,
334 unpack it into a directory on the target computer,
335 and move the files \file{ltxdocext.sty} and \file{acrofont.sty}
336 into a location in your filesystem where they will be found by \LaTeX.
337
338 If you will be using the \classname{acrofont} package, you must
339 also install the virtual fonts
340 \file{zpsynocmrv}, \file{zptmnocmr},
341 \file{zptmnocmrm}, and \file{zpzcnocmry}.
342 The corresponding \file{.tfm}, \file{.vf}, and \file{.vpl}
343 files are part of this distribution.
344
345 To use, read the user documentation \file{ltxdocext.pdf}.
346 The \file{.dtx} file, \file{ltxdocext.dtx}, constitutes
347 in itself an instance of use of the \classname{ltxdocext}
348 package and the \classname{acrofont} package.
349
350 \tableofcontents
351
352 \section{Processing Instructions}
353
354 The package files \file{ltxdocext.sty} and \file{acrofont.sty}
355 are generated from this file, \file{ltxdocext.dtx},
356 using the {\sc docstrip} facility of \LaTeX
357 via |tex ltxdocext.dtx| (Note: do \emph{not} use \LaTeX\ for this step).
358 The typeset documentation that you are now reading is generated from
359 the same file by typesetting it with \LaTeX\ or pdftex
360 via |latex ltxdocext.dtx| or |pdflatex ltxdocext.dtx|.
361
362 \subsection{Build Instructions}
363
364 You may bootstrap this suite of files solely from \file{ltxdocext.dtx}.
365 Prepare by installing \LaTeXe\ (and either tex or pdftex) on your computer,
366 then carry out the following steps:
367 \begin{enumerate}
368 \item
369 Within an otherwise empty directory,
370 typeset \file{ltxdocext.dtx} with \TeX\ or pdftex;
371 thereby generating the package file \file{ltxdocext.sty},
372 and the package file \file{acrofont.sty}.
373 Make sure that {\sc docstrip} receives permission
374 to overwrite existing versions of these packages.
375 \item
376 Now
377 typeset \file{ltxdocext.dtx} with \LaTeX\ or pdflatex;
378 you will obtain the typeset documentation you are now reading,
379 along with
380 the file \file{README}.
381
382 Note: you will have to run \LaTeX, then
383 \file{makeindex} \texttt{-s gind.ist ltxdocext.idx}, then
384 \file{makeindex} \texttt{-s gglo.ist -o ltxdocext.gls ltxdocext.glo}, then
385 \LaTeX\ again in order to obtain a valid index and table of contents.
386 \item
387 Install the following files into indicated locations within your
388 TDS-compliant \texttt{texmf} tree (you may need root access):
389 \begin{itemize}
390 \item
391 \file{$TEXMF/}\file{tex/}\file{latex/}\file{revtex/}\classname{ltxdocext.sty} and
392 \file{$TEXMF/}\file{tex/}\file{latex/}\file{revtex/}\classname{acrofont.sty}
393 \item
394 \file{$TEXMF/}\file{source/}\file{latex/}\file{revtex/}\classname{ltxdocext.dtx}
395 \item
396 \file{$TEXMF/}\file{doc/}\file{latex/}\file{revtex/}\classname{ltxdocext.pdf}
397 \end{itemize}
398 where \file{$TEXMF/} stands for \file{texmf-local/}, or some other \texttt{texmf} tree
399 in your installation.
400 \item
401 Run \texttt{mktexlsr} on \file{$TEXMF/} (you may need root access).
402 \item
403 Build and installation are now complete;
404 now put a \cmd\usepackage\texttt{\{ltxutil\}} in your document preamble!
405 \end{enumerate}
406
407 \subsection{Change Log}
408 \changes{1.0a}{2018/12/12}{(MD) Updated name of README file and use standard fonts when typesetting}%
409
410
411 \end{filecontents*}
412 % \end{macrocode}
413 %
414 % \subsection{The Document Body}
415 %
416 % Here is the document body, containing only a
417 % \cmd\DocInput\ directive---referring to this very file.
418 % This very cute self-reference is a common \classname{ltxdoc} idiom.
419 % \begin{macrocode}
420 \begin{document}%
421 \expandafter\DocInput\expandafter{\jobname.dtx}%
422 \PrintChanges
423 \end{document}
424 %</driver>
425 % \end{macrocode}
426 %
427 % \section{Using the \classname{ltxdoc} and \classname{acrofont} packages}%
428 % These packages are an adjunct to the
429 % standard \LaTeX\ \classname{ltxdoc} class and may be
430 % simply invoked as follows:
431 %\begin{verbatim}
432 %\documentclass[draft]{ltxdoc}
433 %\RequirePackage{ltxdocext}%
434 %\RequirePackage{acrofont}%
435 %\CodelineIndex\EnableCrossrefs
436 %\end{verbatim}
437 %
438 % Your document should simply cleave to the standards of the
439 % \classname{ltxdoc} class, with extensions and alterations as noted.
440 %
441 % \subsection{Extensions to the \classname{ltxdoc} class}%
442 %
443 % \subsubsection{Extensions to the \env{verbatim} environment and \cs{verb} command}%
444 %
445 % The delimiters \verb$<<$ and \verb$>>$ within the scope of the verbatim environment
446 % or within the argument of the \cmd\verb\ command produce
447 % italics surrounded by angle brackets.
448 % This typographic convention usually indicates
449 % \emph{metalanguage}, i.e., a placeholder.
450 %
451 % To obtain the angle bracket character per se,
452 % double the character, viz., ``\verb$the delimiter \verb+<<<<+$''.
453 %
454 % \subsubsection{The -\texttt{matter} Commands Work}
455 % The sectioning commands \cmd\frontmatter, \cmd\mainmatter, and \cmd\backmatter
456 % of the standard \LaTeX\ \classname{book} class are operative in the
457 % \classname{ltxdoc} class.
458 %
459 % \subsubsection{The \cs{GetFileInfo} command}\label{sec:GetFileInfo}
460 % You can use the \cmd\GetFileInfo\ command to extract
461 % the date, version, and file info of a file which has registered itself
462 % via the \cmd\ProvidesFile\ or \cmd\ProvidesClass\ command
463 % (employing the optional argument thereto).
464 %
465 % For instance, if your document contains the following:
466 %\begin{verbatim}
467 %\RequirePackage{ltxdocext}%
468 %\GetFileInfo{ltxdocext.sty}%
469 %\end{verbatim}
470 % then the following control sequence names will have
471 % a value corresponding to that package's \cmd\ProvidesFile\
472 % command:
473 % \cmd\filedate: the file's date,
474 % \cmd\fileversion: the file's version, and
475 % \cmd\fileinfo: the file's info.
476 %
477 % \subsubsection{Self-Indexing Commands}%
478 % Certain commands automatically produce an index entry
479 % (or several related entries) according to the meaning.
480 %
481 % \begin{unnumtable}
482 % \begin{tabular}{ll}
483 % meta-text &\cmd\marg\arg{text}\\
484 % command &\cmd\cmd\cmd\csname\\
485 % environment name &\cmd\env\arg{name}\\
486 % \cmd\begin\verb`{foo}`&\cmd\envb\arg{foo}\\
487 % \cmd\end\verb`{foo}` &\cmd\enve\arg{foo}\\
488 % argument &\cmd\arg\arg{name}\\
489 % optional &\cmd\oarg\arg{name}\\
490 % filename &\cmd\file\arg{name}\\
491 % url &\cmd\url\arg{name}\\
492 % document class &\cmd\classname\arg{name}\\
493 % document substyle &\cmd\substyle\arg{name}\\
494 % class option &\cmd\classoption\arg{name}
495 % \end{tabular}
496 % \end{unnumtable}
497 %
498 % \subsubsection{Unnumbered Tables}%
499 %
500 % When your documentation requires the use of an unnumbered table,
501 % use the \env{unnumtable} environment:
502 % \begin{verbatim}
503 %\begin{unnumtable}
504 %\begin{tabular}{ll}
505 %<table rows>
506 %\end{tabular}
507 %\end{unnumtable}
508 % \end{verbatim}
509 %
510 % \subsubsection{Structuring Tables}%
511 % The commands \cmd\toprule, \cmd\colrule, and \cmd\botrule
512 % allow you to mark the beginning of the column heads
513 % the beginning of the table body, and the end of
514 % the table body, respectively.
515 % In context,
516 % \begin{verbatim}
517 %\begin{tabular}{ll}
518 %\toprule
519 %<table head rows>
520 %\colrule
521 %<table rows>
522 %\botrule
523 %\end{tabular}
524 % \end{verbatim}
525 %
526 % \subsubsection{A Sectioning Command Below \cs{subsection}}%
527 % The \cmd\subsubsection\ command is defined.
528 %
529 %
530 % \subsection{Alterations to the \classname{ltxdoc} class}%
531 % The following involve no new markup, but they
532 % do change the appearance of your formatted documentation:
533 % \begin{enumerate}
534 % \item
535 % Using the \classname{acrofont} package causes your
536 % document to be formatted using the standard
537 % Acrobat fonts to the greatest extent possible.
538 % This means that for most documents, Computer Modern
539 % is not used at all.
540 % Math that unavoidable must use CM still exists, however.
541 % \item
542 % An index will be produced at the end of the document
543 % without your needing to explicitly mark it up, and
544 % it will have an entry in the TOC.
545 % \item
546 % The \env{quote} environment has a slightly smaller left margin.
547 % \item
548 % Array columns are set tight by default.
549 % \item
550 % A host of \cmd\DoNotIndex\ directives are invoked.
551 % I intend this list to grow to encompass
552 % even more commands. Send me your suggestions.
553 % \end{enumerate}
554 %
555 %
556 %
557 %\StopEventually{}
558 %
559 % \section{Extensions to the ltxdoc class}
560 % The \file{package} {\sc docstrip} module comprises the
561 % package \classname{ltxdocext.sty}, which provides extensions
562 % to the standard \LaTeX\ \classname{ltxdoc} class.
563 %
564 % \subsection{Beginning of the \file{package} {\sc docstrip} module}
565 % This portion of code is only present in the \LaTeX\ package (\texttt{.sty} file),
566 % not in the kernel portion.
567 % \begin{macrocode}
568 %<*package>
569 \def\class@name{ltxdocext}%
570 \expandafter\PackageInfo\expandafter{\class@name}{%
571 An extension to the \protect\LaTeXe\space ltxdoc class
572 by A. Ogawa (arthur\_ogawa sbcglobal.net)%
573 }%
574 %</package>
575 % \end{macrocode}
576 %
577 % \subsection{Beginning of the \file{kernel} {\sc docstrip} module}
578 %
579 % The bulk of the code is the kernel portion; a brief tail of \file{package} code then follows.
580 % \begin{macrocode}
581 %<*kernel>
582 % \end{macrocode}
583 %
584 % \subsection{Incorporate \classname{ltxguide.cls} extensions}
585 %
586 % Code extracted from \classname{ltxguide.cls}, by Alan Jeffrey.
587 % ``This code stolen from \classname{ltxguide.cls}:
588 % Some hacks with verbatim... NB: this would be better done with the
589 % verbatim package, but this document has to run on any \LaTeX
590 % installation.''
591 % \begin{macrocode}
592 \RequirePackage{verbatim}%
593 \let\o@verbatim\verbatim
594 \def\verbatim{%
595 \ifhmode\unskip\par\fi
596 % \nopagebreak % Overridden by list penalty
597 \ifx\@currsize\normalsize
598 \small
599 \fi
600 \o@verbatim
601 }%
602 % \end{macrocode}
603 %
604 % Here we extend the font-setting command to include making \texttt{<>} active
605 % (i.e., adjusting the input encoding).
606 % \begin{macrocode}
607 \renewcommand \verbatim@font {%
608 \normalfont \ttfamily
609 \catcode`\<=\active
610 \catcode`\>=\active
611 }%
612 % \end{macrocode}
613 %
614 % Make \verb$|...|$ a synonym for \cmd\verb\verb$|...|$.
615 % \begin{macrocode}
616 \RequirePackage{shortvrb}
617 \AtBeginDocument{%
618 \MakeShortVerb{\|}%
619 }%
620 % \end{macrocode}
621 %
622 % Make active bracket characters produce italics surrounded by angle brackets
623 % (used in \env{verbatim} and \cmd\verb).
624 % \verb|<<| produces a less-than, and \verb|>>| produces a greater-than.
625 % \begin{macrocode}
626 \begingroup
627 \catcode`\<=\active
628 \catcode`\>=\active
629 \gdef<{\@ifnextchar<\@lt\@meta}
630 \gdef>{\@ifnextchar>\@gt\@gtr@err}
631 \gdef\@meta#1>{\marg{#1}}
632 \gdef\@lt<{\char`\<}
633 \gdef\@gt>{\char`\>}
634 \endgroup
635 \def\@gtr@err{%
636 \ClassError{ltxguide}{%
637 Isolated \protect>%
638 }{%
639 In this document class, \protect<...\protect>
640 is used to indicate a parameter.\MessageBreak
641 I've just found a \protect> on its own.
642 Perhaps you meant to type \protect>\protect>?
643 }%
644 }
645 \def\verbatim@nolig@list{\do\`\do\,\do\'\do\-}
646 % \end{macrocode}
647 % End of code stolen from \file{ltxguide.cls}. Thanks, Alan.
648 %
649 % Add functionality from doc.dtx:
650 % (code stolen from doc.dtx):
651 % \begin{macrocode}
652 \def\GetFileInfo#1{%
653 \def\filename{#1}%
654 \def\@tempb##1 ##2 ##3\relax##4\relax{%
655 \def\filedate{##1}%
656 \def\fileversion{##2}%
657 \def\fileinfo{##3}}%
658 \edef\@tempa{\csname ver@#1\endcsname}%
659 \expandafter\@tempb\@tempa\relax? ? \relax\relax}
660 % \end{macrocode}
661 % (end of code stolen from doc.dtx. Thanks FMi.)
662 %
663 % Various forms of self-indexing commands:
664 % \begin{macrocode}
665 \DeclareRobustCommand{\marg}[1]{%
666 \meta{#1}%
667 \index{#1=\string\meta{#1} placeholder}\index{placeholder>#1=\string\meta{#1}}%
668 }%
669 \DeclareRobustCommand\meta[1]{%
670 \mbox{\LANGLE\itshape#1\/\RANGLE}%
671 }%
672 \def\LANGLE{$\langle$}%
673 \def\RANGLE{$\rangle$}%
674 \DeclareRobustCommand{\arg}[1]{%
675 {\ttfamily\string{}\meta{#1}{\ttfamily\string}}%
676 \index{#1=\string\ttt{#1}, argument}\index{argument>#1=\string\ttt{#1}}%
677 }%
678 \let\oarg\undefined
679 \DeclareRobustCommand{\oarg}[1]{%
680 {\ttfamily[%]
681 }\meta{#1}{\ttfamily%[
682 ]}%
683 \index{#1=\string\ttt{#1}, optional argument}%
684 \index{argument, optional>#1=\string\ttt{#1}}%
685 }%
686 \DeclareRobustCommand\cmd{\begingroup\makeatletter\@cmd}%
687 \long\def\@cmd#1{%
688 \endgroup
689 \cs{\expandafter\cmd@to@cs\string#1}%
690 \expandafter\cmd@to@index\string#1\@nil
691 }%
692 \def\cmd@to@cs#1#2{\char\number`#2\relax}%
693 \def\cmd@to@index#1#2\@nil{%
694 \index{#2=\string\cmd#1#2}%\index{command>#2=\string\cmd#1#2}%
695 }%
696 \DeclareRobustCommand\cs[1]{{\ttfamily\char`\\#1}}%
697 \def\scmd#1{%
698 \cs{\expandafter\cmd@to@cs\string#1}%
699 \expandafter\scmd@to@index\string#1\@nil
700 }%
701 \def\scmd@to@index#1#2\@nil#3{%
702 \index{\string$#3=\string\cmd#1#2---#3}%
703 %\index{command>\string$#3=\string\cmd#1#2---#3}%
704 }%
705 \DeclareRobustCommand\env{\name@idx{environment}}%
706 \DeclareRobustCommand\envb[1]{%
707 {\ttfamily\string\begin\string{}\env{#1}{\ttfamily\string}}%
708 }%
709 \DeclareRobustCommand\enve[1]{{\ttfamily\string\end\string{}\env{#1}{\ttfamily\string}}}%
710 \DeclareRobustCommand{\file}{\begingroup\@sanitize\@file}%
711 \long\def\@file#1{\endgroup
712 {\ttfamily#1}%
713 \index{#1=\string\ttt{#1}}\index{file>#1=\string\ttt{#1}}%
714 }%
715 \DeclareRobustCommand\substyle{\name@idx{document substyle}}%
716 \DeclareRobustCommand\classoption{\name@idx{document class option}}%
717 \DeclareRobustCommand\classname{\name@idx{document class}}%
718 \def\name@idx#1#2{%
719 {\ttfamily#2}%
720 \index{#2\space#1=\string\ttt{#2}\space#1}\index{#1>#2=\string\ttt{#2}}%
721 }%
722 \DeclareRobustCommand\url@ltxdocext{\begingroup\catcode`\/\active\catcode`\.\active\catcode`\:\active\@url}%
723 \AtBeginDocument{%
724 \ifx\url\undefined\let\url\url@ltxdocext\fi
725 }%
726 \def\@url#1{%
727 \url@break{\ttfamily#1}%
728 \url@char\edef\@tempa{#1=\string\url{#1}}%
729 \expandafter\index\expandafter{\@tempa}%
730 \expandafter\index\expandafter{\expandafter u\expandafter r\expandafter l\expandafter >\@tempa}%
731 \endgroup
732 }%
733 {\catcode`\:\active\aftergroup\def\aftergroup:}{\active@colon}%
734 \def\colon@break{\colon@char\allowbreak}%
735 \def\colon@char{:}%
736 {\catcode`\/\active\aftergroup\def\aftergroup/}{\active@slash}%
737 \def\slash@break{\slash@char\allowbreak}%
738 \def\slash@char{/}%
739 {\catcode`\.\active\aftergroup\def\aftergroup.}{\active@dot}%
740 \def\dot@break{\dot@char\allowbreak}%
741 \def\dot@char{.}%
742 \def\url@break{\let\active@slash\slash@break\let\active@dot\dot@break\let\active@colon\colon@break}%
743 \def\url@char{\let\active@slash\slash@char\let\active@dot\dot@char\let\active@colon\colon@char}%
744 % \end{macrocode}
745 %
746 % \subsection{Changes to the base class of the ltxdoc class}
747 % Modify \env{theindex} environment so that it produces a TOC entry
748 % \begin{macrocode}
749 \renewenvironment{theindex}
750 {\if@twocolumn
751 \@restonecolfalse
752 \else
753 \@restonecoltrue
754 \fi
755 \columnseprule \z@
756 \columnsep 35\p@
757 \def\see##1##2{\textit{See} ##1}%
758 \def\seealso##1##2{\textit{See also} ##1}%
759 \long\def\cmd##1{\cs{\expandafter\cmd@to@cs\string##1}}%
760 \def\@url##1{\url@break\ttt{##1}\endgroup}%
761 \def\ttt{\begingroup\@sanitize\ttfamily\@ttt}%
762 \def\@ttt##1{##1\endgroup}%
763 \mathchardef\save@secnumdepth\c@secnumdepth
764 \c@secnumdepth\m@ne
765 \twocolumn[\section{\indexname}]%
766 % \@mkboth{\MakeUppercase\indexname}%
767 % {\MakeUppercase\indexname}%
768 \c@secnumdepth\save@secnumdepth
769 \thispagestyle{plain}\parindent\z@
770 \parskip\z@ \@plus .3\p@\relax
771 \let\item\@idxitem}
772 {\if@restonecol\onecolumn\else\clearpage\fi}
773 \renewenvironment{quote}
774 {\list{}{%
775 \leftmargin1em\relax
776 \rightmargin\leftmargin
777 }%
778 \item\relax}
779 {\endlist}
780 % \end{macrocode}
781 %
782 % \subsection{Extensions to the base class of \classname{ltxdoc.cls}}
783 %
784 % Matter commands from \classname{book.cls}
785 % \begin{macrocode}
786 \newif\if@mainmatter
787 \newif\if@openright
788 \@openrighttrue
789 \DeclareRobustCommand\frontmatter{%
790 \cleartorecto
791 \@mainmatterfalse
792 \pagenumbering{roman}%
793 }%
794 \DeclareRobustCommand\mainmatter{%
795 \cleartorecto
796 \@mainmattertrue
797 \pagenumbering{arabic}%
798 }%
799 \DeclareRobustCommand\backmatter{%
800 \if@openright
801 \cleartorecto
802 \else
803 \clearpage
804 \fi
805 \@mainmatterfalse
806 }%
807 \ifx\undefined\cleartorecto
808 \def\cleartorecto{\cleardoublepage}%
809 \fi
810 % \end{macrocode}
811 %
812 % Unnumbered tables
813 %
814 % \begin{environment}{unnumtable}
815 % An unnumbered table does not float.
816 % \begin{macrocode}
817 \def\@to{to}%
818 \newenvironment{unnumtable}{%
819 \par
820 \addpenalty\predisplaypenalty
821 \addvspace\abovedisplayskip
822 \hbox\@to\hsize\bgroup\hfil\ignorespaces
823 \let\@Hline\@empty
824 }{%
825 \unskip\hfil\egroup
826 \penalty\postdisplaypenalty
827 \vskip\belowdisplayskip
828 \aftergroup\ignorespaces
829 \@endpetrue
830 }%
831 % \end{macrocode}
832 % \end{environment}
833 %
834 % Emulate \cmd\toprule\ and friends
835 % \begin{macrocode}
836 \providecommand\toprule{\hline\hline}%
837 \providecommand\colrule{\\\hline}%
838 \providecommand\botrule{\\\hline\hline}%
839 % \end{macrocode}
840 %
841 % Define sectioning command below \cmd\subsubsection.
842 % \begin{macrocode}
843 \DeclareRobustCommand\subsubsubsection{%
844 \@startsection{subsubsection}{4}%
845 {\z@}{-15\p@\@plus-5\p@\@minus-2\p@}%
846 {5\p@}{\normalfont\normalsize\itshape}%
847 }%
848 % \end{macrocode}
849 %
850 % \subsection{In lieu of \file{ltxdoc.cfg}}
851 % We don't want everything to appear in the index
852 % \begin{macrocode}
853 \DoNotIndex{\',\.,\@M,\@@input,\@Alph,\@alph,\@addtoreset,\@arabic}
854 \DoNotIndex{\@badmath,\@centercr,\@cite}
855 \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
856 \DoNotIndex{\@input,\@ixpt,\@m,\@minus,\@mkboth}
857 \DoNotIndex{\@ne,\@nil,\@nomath,\@plus,\roman,\@set@topoint}
858 \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
859 \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
860 \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
861 \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
862 \DoNotIndex{\advance,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
863 \DoNotIndex{\bullet}
864 \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
865 \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
866 \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
867 \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
868 \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
869 \DoNotIndex{\fbox}
870 \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
871 \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
872 \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
873 \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
874 \DoNotIndex{\input}
875 \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
876 \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
877 \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
878 \DoNotIndex{\NeedsTeXFormat,\newdimen}
879 \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
880 \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
881 \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
882 \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
883 \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
884 \DoNotIndex{\refstepcounter,\relax,\renewcommand}
885 \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily}
886 \DoNotIndex{\secdef,\selectfont,\setbox,\setcounter,\setlength}
887 \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
888 \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
889 \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
890 \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
891 \DoNotIndex{\wd,\xiipt,\year,\z@}
892 \DoNotIndex{\next}
893 % \end{macrocode}
894 %
895 % Direct \classname{ltxdoc} to produce an index.
896 % \begin{macrocode}
897 \AtEndDocument{\PrintIndex\PrintChanges}%
898 % \end{macrocode}
899 %
900 % \subsection{Extension to \LaTeX's \env{filecontents} Environment}
901 % We want to
902 % coax the version number into \env{filecontents}-generated files.
903 % Note that we expect \cmd\fileversion\ and \cmd\filedate\ to
904 % hold the needed information. For this to be the case,
905 % your document should execute the \cmd\GetFileInfo\ command
906 % (as documented in section~\ref{sec:GetFileInfo}) before
907 % any instances of \env{filecontents}.
908 % \begin{macrocode}
909 \makeatletter
910 \def\endfilecontents{%
911 \immediate\write\reserved@c{%
912 \string\iffalse\space ltxdoc klootch^^J%
913 \ifx\undefined\fileversion\else
914 \ifx\undefined\filedate\else
915 This file has version number \fileversion, last revised \filedate.%
916 \fi\fi
917 \string\fi
918 }%
919 \immediate\closeout\reserved@c
920 \def\T##1##2##3{%
921 \ifx##1\@undefined\else
922 \@latex@warning@no@line{##2 has been converted to Blank ##3e}%
923 \fi
924 }%
925 \T\L{Form Feed}{Lin}%
926 \T\I{Tab}{Spac}%
927 \immediate\write\@unused{}%
928 }%
929 \expandafter\let\csname endfilecontents*\endcsname\endfilecontents
930 \makeatother
931 % \end{macrocode}
932 %
933 % Alter formatting in arrays; set them tight.
934 % \begin{macrocode}
935 \setlength\arraycolsep{0pt}%
936 % \end{macrocode}
937 %
938 % \subsection{End of the \file{kernel} {\sc docstrip} module}
939 %
940 % \begin{macrocode}
941 %</kernel>
942 % \end{macrocode}
943 %
944 % \subsection{Tail of the \file{package} {\sc docstrip} module}
945 % Here is the remainder of the package code.
946 % \begin{macrocode}
947 %<*package>
948 % \end{macrocode}
949 % Currently, there is little.
950 % \begin{macrocode}
951 %</package>
952 % \end{macrocode}
953 %
954 %
955 % \section{Font Package for Acrobat Compatability}%
956 % The package \classname{acrofont}
957 % substitutes Acrobat-standard fonts for Computer Modern where possible,
958 % even in math mode.
959 % Documents typeset with this package in effect will require as little
960 % downloaded font data as possible, but will not be exemplars of
961 % fine math typesetting.
962 %
963 % \subsection{Beginning of the \file{fonts} {\sc docstrip} module}
964 % The document class module comprises this and the next
965 % four sections.
966 % \begin{macro}{\class@base}
967 % We define in exactly one spot the base class.
968 % Typically that class will be one of \classname{book},
969 % \classname{article}, or \classname{report}.
970 % The base class effectively defines the use and the markup scheme
971 % of the class of documents to be handled by this class.
972 %
973 % This class is a variant of the standard \LaTeX\ book class:
974 % \url{ftp://ctan.tug.org/tex-archive/macros/latex/unpacked}.
975 % \begin{macrocode}
976 %<*fonts>
977 \def\class@name{ltxdocext}%
978 \expandafter\ClassInfo\expandafter{\class@name}{%
979 Written for \protect\LaTeXe\space
980 by A. Ogawa (arthur_ogawa at sbcglobal.net)%
981 }%
982 % \end{macrocode}
983 % \end{macro}
984 %
985 % \subsection{Variants on psfonts packages}%
986 % The following uses \file{times.sty} from \url{/packages/psnfss/psfonts.dtx}
987 % \begin{macrocode}
988 \RequirePackage{times}%
989 % \end{macrocode}
990 %
991 % The following uses \file{mathptm.sty} from \url{/packages/psnfss/psfonts.dtx}
992 % \begin{macrocode}
993 \RequirePackage{mathptm}%
994 % \end{macrocode}
995 %
996 % The following is a customization of \file{ot1ptmcm.fd}.
997 % The virtual font referred to here \file{zptmnocmr} is
998 % a variant of Sebastian Rahtz's \file{zptmcmr}, but with
999 % even more glyphs moved from CM to Acrobat-standard fonts.
1000 % \begin{macrocode}
1001 \DeclareFontFamily{OT1}{ptmcm}{}
1002 \DeclareFontShape{OT1}{ptmcm}{m}{n}{
1003 <-> zptmnocmr
1004 }{}
1005 \DeclareFontShape{OT1}{ptmcm}{l}{n}{<->ssub * ptmnocm/m/n}{}
1006 % \end{macrocode}
1007 %
1008 % The following is a customization of \file{omlptmcm.fd}
1009 % The virtual font referred to here \file{zptmnocmrm} is
1010 % a variant of Sebastian Rahtz's \file{zptmcmrm}, but with
1011 % even more glyphs moved from CM to Acrobat-standard fonts.
1012 % \begin{macrocode}
1013 \DeclareFontFamily{OML}{ptmcm}{\skewchar \font =127}
1014 \DeclareFontShape{OML}{ptmcm}{m}{it}{
1015 <-> zptmnocmrm
1016 }{}
1017 \DeclareFontShape{OML}{ptmcm}{l}{it}{<->ssub * ptmcm/m/it}{}
1018 \DeclareFontShape{OML}{ptmcm}{m}{sl}{<->ssub * ptmcm/m/it}{}
1019 \DeclareFontShape{OML}{ptmcm}{l}{sl}{<->ssub * ptmcm/m/sl}{}
1020 % \end{macrocode}
1021 %
1022 % The following is a customization of \file{omspzccm.fd}
1023 % The virtual font referred to here \file{zpzcnocmry} is
1024 % a variant of Sebastian Rahtz's \file{zpzccmry}, but with
1025 % even more glyphs moved from CM to Acrobat-standard fonts.
1026 % \begin{macrocode}
1027 \DeclareFontFamily{OMS}{pzccm}{}
1028 \DeclareFontShape{OMS}{pzccm}{m}{n}{
1029 <-> zpzcnocmry
1030 }{}% cmsy10 Symbol Zapf Chancery Medium-Italic Times-Roman
1031 \DeclareFontShape{OMS}{pzccm}{l}{n}{<->ssub * pzccm/m/n}{}
1032 % \end{macrocode}
1033 %
1034 % The following is a customization of \file{omxpsycm.fd}
1035 % The virtual font referred to here \file{zpsynocmrv} is
1036 % a variant of Sebastian Rahtz's \file{zpsycmrv}, but with
1037 % even more glyphs moved from CM to Acrobat-standard fonts.
1038 % \begin{macrocode}
1039 \DeclareFontFamily{OMX}{psycm}{}
1040 \DeclareFontShape{OMX}{psycm}{m}{n}{
1041 <-> zpsynocmrv
1042 }{}
1043 \DeclareFontShape{OMX}{psycm}{l}{n}{<->ssub * psycm/m/n}{}
1044 %
1045 \DeclareFontEncoding{8r}{}{}% from file: 8renc.def
1046 \DeclareFontFamily{8r}{cmr}{\hyphenchar\font45 }% from file: 8rcmr.fd
1047 \DeclareFontShape{8r}{cmr}{m}{n}{
1048 <-> cmr10
1049 }{}
1050 % \end{macrocode}
1051 %
1052 % \subsection{Font definition files}%
1053 %
1054 % The following forces \LaTeX\ to do now what it would do anyway:
1055 % load the `font definition' information for the fonts that we
1056 % use. In this way, we prepare for faster processing through
1057 % the \cmd\dump\ of a preformatted macro package that will not
1058 % need to read in any packages or font definitions from disk.
1059 % \begin{macrocode}
1060 \input{8rphv.fd}%
1061 \input{8rptm.fd}%
1062 \input{ot1phv.fd}%
1063 \input{ot1ptm.fd}%
1064 \input{t1ptm.fd}%
1065 % \end{macrocode}
1066 %
1067 % \subsection{More math substitutions}%
1068 %
1069 % The following definitions arrange to get certain glyphs from the
1070 % text font instead of out of math pi fonts.
1071 % In particular, the copyright and registered symbols
1072 % are single glyphs instead of composites involving
1073 % the big circle from the \file{cmsy} font.
1074 % \begin{macrocode}
1075 \def\eightRChar#1{{\def\encodingdefault{8r}\fontencoding\encodingdefault\selectfont\char"#1}}%
1076 \def\LANGLE{$<$}%{\eightRChar{8B}}%
1077 \def\RANGLE{$>$}%{\eightRChar{9B}}%
1078 %\def\ASTER{\eightRChar{2A}}%
1079 %\def\DAGGER{\eightRChar{86}}%
1080 %\def\DDAGGER{\eightRChar{87}}%
1081 \def\BULLET{\eightRChar{95}}%
1082 %\def\SECTION{\eightRChar{A7}}%
1083 %\def\PARAGRAPH{\eightRChar{B6}}%
1084 \def\VERTBAR{\eightRChar{7C}}%
1085 \def\COPYRIGHT{\eightRChar{A9}}%
1086 \def\REGISTERED{\eightRChar{AE}}%
1087 % \end{macrocode}
1088 %
1089 % \begin{macrocode}
1090 \def\textbar{\VERTBAR}%
1091 \def\textbullet{\BULLET}%
1092 \def\textcopyright{\COPYRIGHT}%
1093 \def\textregistered{\REGISTERED}%
1094 % \end{macrocode}
1095 %
1096 % I have removed \cmd\ensuremath\ from the following definition, and
1097 % all commands like \cmd\mathsection have been converted to
1098 % e.g., \cmd\textsection.
1099 % \begin{macrocode}
1100 \def\@makefnmark{\@thefnmark}%
1101 \def\@fnsymbol#1{{\ifcase#1\or *\or \dagger\or \ddagger\or
1102 \textsection\or \textparagraph\or \|\or **\or \dagger\dagger
1103 \or \ddagger\ddagger \else\@ctrerr\fi}}
1104 % \end{macrocode}
1105 %
1106 % \subsection{End of the \file{fonts} {\sc docstrip} module}
1107 % Here ends the module.
1108 % \begin{macrocode}
1109 %</fonts>
1110 % \end{macrocode}
1111 %
1112 %
1113 % \section{Programming Conventions}%
1114 % In writing the above code, I cleave to certain conventions, noted
1115 % here.
1116 % My goal in explaining them is to encourage others maintaining this
1117 % body of code to consider following them as well.
1118 % The benefits are twofold:
1119 % Some of the coding conventions aim to avoid programming pitfalls;
1120 % following them reduces maintenance costs.
1121 % Others make the code easier to read; following these eases the
1122 % process of understanding how the code works.
1123 %
1124 % And, for my part, I prefer to read code of this type.
1125 %
1126 % \subsection{Whitespace Conventions}%
1127 % Exactly where code lines break and indent, and where additional
1128 % whitespace is inserted is explained here.
1129 % \begin{itemize}
1130 % \item
1131 % Each new macro definition or register assignment begins a new line.
1132 % Therefore, \cmd\def, \cmd\newcommand, and their ilk will start in column~1.
1133 % \item
1134 % Code is indented one space for each level of nesting within braces
1135 % \verb|{}|.
1136 % \item
1137 % Likewise, if possible, for \cmd\if\dots and matching \cmd\fi.
1138 % \item
1139 % However, the closing brace or \cmd\fi\ is outdented by one so that it
1140 % falls
1141 % at the same level of indentation as its matching brace or \cmd\if,
1142 % and it appears alone on its line.
1143 % \item
1144 % Use of the |tab| character is deprecated
1145 % (tabs are not standardized across all applications and operating
1146 % systems).
1147 % \item
1148 % Lines of code are limited to 72 characters.
1149 % I follow this convention mostly to ease the transmission of files
1150 % via email (a deprecated practice) and to accomodate people with
1151 % small monitors.
1152 % But \classname{ltxdoc} output looks better with the shorter lines, too.
1153 % \item
1154 % Extraneous whitespace in the replacement part of a macro definition
1155 % is avoided by using the comment character |%|.
1156 % In most cases, if falling at the end of a line of code,
1157 % a brace will be immediately followed by a comment character,
1158 % as will the macro parameter |#1| and any one-letter control sequence,
1159 % like |\\|.
1160 % \item
1161 % Extraneous whitespace in the package file is also avoided.
1162 % When \TeX\ reads in the .sty file, it will process \cmd\def s, and other commands,
1163 % but will not process blank spaces.
1164 % This practice is simply a discipline. You don't need to do this.
1165 % But sometimes \TeX\ has to read in a file while it is in horizontal mode,
1166 % at which point this practice is essential.
1167 % \end{itemize}
1168 % These conventions taken together are illustrated by the following:
1169 % \begin{verbatim}
1170 %\def\prepdef#1#2{%
1171 % \@ifxundefined#1{\toks@{}}{\toks@\expandafter{#1}}%
1172 % \toks@ii{#2}%
1173 % \edef#1{\the\toks@ii\the\toks@}%
1174 %}%
1175 % \end{verbatim}
1176 % In the above, the definition of \cmd\prepdef\ would not fit on a single
1177 % line,
1178 % and required breaking. The first and last lines have matching braces,
1179 % and are a the same level of indentation, with the last line containing
1180 % a single brace.
1181 %
1182 % Each of the three intervening lines has balanced braces and is
1183 % indented by one space. Each line that would otherwise end in a single
1184 % brace character is terminated by a comment character.
1185 %
1186 % Some coders rely on the fact that a space character seen by \TeX's
1187 % scanner while in vertical mode is a no-op.
1188 % Be that as it may, I eliminate them unless actually intentional.
1189 %
1190 % \subsection{Conventions For Procedures}%
1191 % Here are some of my preferences when writing procedures:
1192 % \begin{itemize}
1193 %
1194 % \item
1195 % I dislike defining a macro within another macro, especially when the
1196 % pattern part is non-nil.
1197 % You know, you are not saving much space in |mem| when you do this,
1198 % right?
1199 % You do save space in the hash table and the string pool, though.
1200 % On the other hand, we are not dealing with small \TeX\ engines
1201 % anymore; Team \LaTeX\ has made sure of this.
1202 %
1203 % \item
1204 % If two or more macros have very similar replacement parts, consider
1205 % layering.
1206 %
1207 % \item
1208 % Macros may perform parsing, may maintain tokens or registers, or may
1209 % set type (produce marks). I try to avoid combining the three functions
1210 % in a single macro.
1211 %
1212 % \item
1213 % When a procedure both does assignments and sets type, I try to have a
1214 % clean separations between the two activities. Try to avoid:
1215 % \begin{verbatim}
1216 % \vskip10pt
1217 % \parindent=0pt
1218 % \leavevmode
1219 % \end{verbatim}
1220 %
1221 % \item
1222 % The Boolean calculus (cf. \cmd\@ifx)
1223 % is very useful and produces code that executes nicely.
1224 % Using it also helps avoid your having to debug problems where
1225 % \cmd\if\dots\ and \cmd\fi\ are not properly balanced
1226 % (a nightmare, in case you have not already experienced it).
1227 %
1228 % \end{itemize}
1229 %
1230 % \subsection{Conventions For \LaTeX}%
1231 % Team \LaTeX\ make certain recommendations in \file{clsguide.tex}.
1232 % Ones that I particularly pay attention to are:
1233 % \begin{itemize}
1234 %
1235 % \item
1236 % For the sake of ``color safety'',
1237 % use \cmd\sbox\ rather than \cmd\setbox, \cmd\mbox\ rather than \cmd\hbox, and
1238 % \cmd\parbox\ or \env{minipage} rather than \cmd\vbox.
1239 %
1240 % \item
1241 % Use \cmd\newcommand\ and \cmd\newenvironment\ to declare user-level commands
1242 % and environments. Avoid the idiom \cmd\def\cmd\foo, \cmd\def\cmd\endfoo\ to define
1243 % an environment.
1244 % Ideally, all user-level markup could be extracted from the
1245 % document class by grepping on \cmd\newcommand\ and \cmd\newenvironment.
1246 %
1247 % \item
1248 % Prefer to use \cmd\setlength\ to assign registers.
1249 %
1250 % \end{itemize}
1251 % I cannot help but notice that much of the code of \LaTeX\ itself fails
1252 % to comply with many of the coding recommendations of Team \LaTeX.
1253 %
1254 % \Finale
1255 % \iffalse Here ends the programmer's documentation.\fi
1256 % \endinput
1257 %
1258 \endinput
1259 %%EOF