Debian Codegraph @

texmf-dist/doc/latex/base/source2e.tex

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2025
4 % The LaTeX Project and any individual authors listed elsewhere
5 % in this file.
6 %
7 % This file is part of the LaTeX base system.
8 % -------------------------------------------
9 %
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 % https://www.latex-project.org/lppl.txt
15 % and version 1.3c or later is part of all distributions of LaTeX
16 % version 2008 or later.
17 %
18 % This file has the LPPL maintenance status "maintained".
19 %
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
22 % information.
23 %
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.
27 %
28 % \fi
29
30 % This document will typeset the LaTeX sources as a single document.
31 % This will produce quite a large file (roughly 555 pages) and may
32 % take a long time.
33 %
34 % Some notes on processing this document are contained at the end
35 % of this document, after \end{document}
36 %
37 % DPC 1997/11/17
38 %
39 % First a special index style for makeindex
40 %
41
42 \begin{filecontents}{source2e.ist}
43 actual '='
44 quote '!'
45 level '>'
46 preamble
47 "\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
48 postamble
49 "\n\n \\end{theindex}\n"
50 item_x1 "\\efill \n \\subitem "
51 item_x2 "\\efill \n \\subsubitem "
52 delim_0 "\\pfill "
53 delim_1 "\\pfill "
54 delim_2 "\\pfill "
55 % The next lines will produce some warnings when
56 % running Makeindex as they try to cover two different
57 % versions of the program:
58 lethead_prefix "{\\bfseries\\hfil "
59 lethead_suffix "\\hfil}\\nopagebreak\n"
60 lethead_flag 1
61 heading_prefix "{\\bfseries\\hfil "
62 heading_suffix "\\hfil}\\nopagebreak\n"
63 headings_flag 1
64
65 % and just for source2e:
66 % Remove R so I is treated in sequence I J K not I II III
67 page_precedence "rnaA"
68 \end{filecontents}
69
70
71
72 \documentclass{source2edoc}
73
74 \listfiles
75
76 % Do not index some TeX primitives, and some common plain TeX commands.
77
78 \DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
79 \DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,%
80 \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi}
81 \DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,%
82 \vbox,\vtop,\vcenter}
83 \DoNotIndex{\@empty,\immediate,\write}
84 \DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup}
85 \DoNotIndex{\divide,\advance,\multiply,\count,\dimen}
86 \DoNotIndex{\relax,\space,\string}
87 \DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,%
88 \closein,\closeout}
89 \DoNotIndex{\catcode,\endinput}
90 \DoNotIndex{\jobname,\message,\read,\the,\m@ne,\noexpand}
91 \DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss}
92 \DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@}
93 \DoNotIndex{\dp,\wd,\ht,\vss,\unskip}
94
95 % Set up the Index and Change History to use \part
96 \IndexPrologue{\part*{Index}%
97 \markboth{Index}{Index}%
98 \addcontentsline{toc}{part}{Index}%
99 The italic numbers denote the pages where the
100 corresponding entry is described,
101 numbers underlined point to the definition,
102 all others indicate the places where it is used.}
103
104 \GlossaryPrologue{\part*{Change History}%
105 % Allow control names to be hyphenated here...
106 {\GlossaryParms\ttfamily\hyphenchar\font=`\-}%
107 \markboth{Change History}{Change History}%
108 \addcontentsline{toc}{part}{Change History}}
109
110 % The standard \changes command modified slightly to better cope with
111 % this multiple file document.
112 \makeatletter
113 \def\@changes@iso@date#1/#2/#3/#4\space{#1\if\relax#2\relax\else-#2-#3\fi\space}
114 \def\changes@#1#2#3{%
115 \let\protect\@unexpandable@protect
116 \edef\@tempa{\noexpand\glossary{\@changes@iso@date#2///\space
117 \currentfile\space#1\levelchar
118 \ifx\saved@macroname\@empty
119 \space
120 \actualchar
121 \generalname
122 \else
123 \expandafter\@gobble
124 \saved@macroname
125 \actualchar
126 \string\verb\quotechar*%
127 \verbatimchar\saved@macroname
128 \verbatimchar
129 \fi
130 :\levelchar #3}}%
131 \@tempa\endgroup\@esphack}
132
133 % Move whole block up so that the file key is not so close
134 % to bottom of US letter page.
135 \addtolength\topmargin{-2\baselineskip}
136
137
138 % Codelines are allowed to run over a bit without showing up as overfull
139 %
140 \renewcommand*\MacroFont{\fontencoding\encodingdefault
141 \fontfamily\ttdefault
142 \fontseries\mddefault
143 \fontshape\updefault
144 \small
145 \hfuzz 6pt\relax}
146
147 % Section numbers now reach eg 74.17.2 which need more space
148 \renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.8em}}
149 \renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.4em}}
150 \makeatother
151
152 % Produce a Change Log and (2 column) Index.
153 \RecordChanges
154 \CodelineIndex
155 \EnableCrossrefs
156 \setcounter{IndexColumns}{2}
157
158 % Needed for documentation in ltoutenc.dtx
159 % \usepackage{textcomp}
160
161 \begin{document}
162 \title{The \LaTeXe\ Sources}
163 \author{%
164 Johannes Braams\\
165 David Carlisle\\
166 Alan Jeffrey\\
167 Leslie Lamport\\
168 Frank Mittelbach\\
169 Chris Rowley\\
170 Rainer Sch\"opf}
171
172 % This command will be used to input the patch file
173 % if that file exists.
174 \newcommand{\includeltpatch}{%
175 \def\currentfile{ltpatch.ltx}
176 \part{ltpatch}
177 {\let\ttfamily\relax
178 \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}%
179 Things we did wrong\ldots
180 \IndexInput{ltpatch.ltx}}
181
182
183
184 % Get the date and patch level from ltvers.dtx
185 \makeatletter
186 \let\patchdate=\@empty
187 \begingroup
188 \def\ProvidesFile#1\fmtversion#2#3\patch@level#4{%
189 \date{#2}\xdef\patchdate{#4}\endinput}
190 \input{ltvers.dtx}
191 \global\let\X@date=\@date
192
193 % Add the patch version if available.
194 \long\def\Xdef#1#2#3\def#4#5{%
195 \xdef\X@date{#2}%
196 \xdef\patchdate{#5}%
197 \endinput}%
198 \InputIfFileExists{ltpatch.ltx}
199 {\let\def\Xdef}{\global\let\includeltpatch\relax}
200 \endgroup
201
202 \ifx\@date\X@date
203 \def\Xpatch{0}
204 \ifx\patchdate\Xpatch\else
205 \edef\@date{\@date\space Patch level \patchdate}
206 \fi
207 \else
208 \@warning{ltpatch.ltx does not match ltvers.dtx!}
209 \let\includeltpatch\relax
210 \fi
211 \makeatother
212
213 \pagenumbering{roman}
214
215 \MaintainedByLaTeXTeam{latex}
216 \maketitle
217 \renewcommand\maketitle{}
218
219 \tableofcontents
220
221 \clearpage
222
223 \pagenumbering{arabic}
224
225 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
226
227 % Each of the following \DocInclude lines includes a file with extension
228 % .dtx. Each of these files may be typeset separately. For instance
229 % latex ltboxes.dtx
230 % will typeset the source of the LaTeX box commands.
231 %
232 % If this file is processed, each of these separate dtx files will be
233 % contained as a part of a single document. Using ltxdoc.cfg you can
234 % then optionally produce a combined index and/or change history for
235 % the entire source of the format file. Note that such a document will
236 % be quite large (about 555 pages).
237 %
238
239 \DocInclude{ltdirchk} % System dependent initialisation
240
241 \DocInclude{ltplain} % LaTeX version of Knuth's plain.tex
242
243 \DocInclude{ltvers} % Current version date
244
245 \DocInclude{ltluatex} % luatex support
246
247 \DocInclude{ltexpl} % L3 programming layer integration
248
249 \DocInclude{ltdefns} % Initial definitions.
250
251 \DocInclude{ltcmd} % Document command creation (was xparse)
252
253 \DocInclude{lthooks} % Hook management (L3 module)
254
255 \DocInclude{ltcmdhooks}% Hook management for commands (L3 module)
256
257 \DocInclude{ltsockets}% Socket and plug management (L3 module)
258
259 \DocInclude{lttemplates} % Prototype document functions (was xtemplate)
260
261 \DocInclude{ltalloc} % Allocation of counters and others.
262
263 \DocInclude{ltcntrl} % Program control macros.
264
265 \DocInclude{lterror} % Error handling.
266
267 \DocInclude{ltpar} % Paragraphs.
268
269 \DocInclude{ltpara} % Paragraph hooks (L3 module)
270
271 \DocInclude{ltmeta} % Document Metadata interface (L3 module)
272
273 \DocInclude{ltspace} % Spacing, line and page breaking.
274
275 \DocInclude{ltlogos} % Logos.
276
277 \DocInclude{ltfiles} % \input files and related commands
278
279 \DocInclude{ltoutenc} % Output encoding interface
280
281 \DocInclude{ltcounts} % Counters
282
283 \DocInclude{ltlength} % Lengths
284
285 \DocInclude{ltfssbas} % NFSS Base macros
286
287 \DocInclude{ltfssaxes}% NFSS Axes handling (new in 2020)
288
289 \DocInclude{ltfsstrc} % NFSS Tracing (and tracefnt.sty)
290
291 \DocInclude{ltfsscmp} % NFSS1 Compatibility
292
293 \DocInclude{ltfssdcl} % NFSS Declarative interface
294
295 \DocInclude{ltfssini} % NFSS Initialisation
296
297 \DocInclude{fontdef} % fonttext.ltx/fontmath.ltx
298
299 \DocInclude{preload} % preload.ltx
300
301 \DocInclude{ltfntcmd} % \textrm etc
302
303 \DocInclude{lttextcomp} % companion symbols (new 2020)
304
305 \DocInclude{ltpageno} % Page numbering
306
307 \DocInclude{ltxref} % Cross referencing
308
309 \DocInclude{ltproperties} % Extended Cross referencing
310
311 \DocInclude{ltmiscen} % Miscellaneous environment definitions.
312
313 \DocInclude{ltmath} % Mathematics set up.
314
315 \DocInclude{ltlists} % List and related environments
316
317 \DocInclude{ltboxes} % Parbox and friends
318
319 \DocInclude{lttab} % Tabbing tabular and array
320
321 \DocInclude{ltpictur} % Picture mode
322
323 \DocInclude{ltthm} % Theorem environments
324
325 \DocInclude{ltsect} % Sectioning
326
327 \DocInclude{ltfloat} % Floats
328
329 \DocInclude{ltidxglo} % Index and Glossary
330
331 \DocInclude{ltbibl} % Bibliography
332
333 \DocInclude{ltmarks} % Output routine marks management (L3 module)
334
335 \DocInclude{ltpage} % \pagestyle \raggedbottom \sloppy
336
337 \DocInclude{ltclass} % Package & Class interface
338
339 \DocInclude{ltkeys} % Key-based option management (L3 module)
340
341 \DocInclude{ltfilehook} % Hook management for files (L3 module)
342
343 \DocInclude{ltshipout}% \shipout redefinition (L3 module)
344
345 \DocInclude{ltoutput} % Output routine
346
347 \DocInclude{lttagging}% Tagging support
348
349 \DocInclude{lthyphen} % Hyphenation (hyphen.ltx).
350
351 \DocInclude{ltfinal} % Last minute initialisations and dump
352
353 \includeltpatch % Corrections distributed after the full release
354
355 % Stop here if ltxdoc.cfg says \AtEndOfClass{\OnlyDescription}
356 \StopEventually{\end{document}}
357
358 \clearpage
359 \pagestyle{headings}
360
361 % Make TeX shut up.
362 \hbadness=10000
363 \newcount\hbadness
364 \hfuzz=\maxdimen
365
366 \typeout{%
367 \string # Produce change log with^^J%
368 makeindex -s gglo.ist -o source2e.gls source2e.glo}
369
370
371 \PrintChanges
372
373 \clearpage
374
375 % makeindex needs a symbol between the parts of composite page numbers
376 % but we dont want one, so:
377 \typeout{%
378 \string # Produce index with^^J%
379 makeindex -s source2e.ist source2e.idx}
380
381 \begingroup
382 \def\endash{--}
383 \catcode`\-\active
384 \def-{\futurelet\temp\indexdash}
385 \def\indexdash{\ifx\temp-\endash\else:\fi}
386
387 \PrintIndex
388 \endgroup
389
390 % Make sure that the index is not printed twice
391 % (ltxdoc.cfg might have a second \PrintIndex command)
392 \let\PrintChanges\relax
393 \let\PrintIndex\relax
394
395 \end{document}
396
397
398 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399
400 To use this file to produce a fully indexed source code
401 you need to execute the following (or equivalent) commands:
402
403 latex source2e.tex
404
405 makeindex -s source2e.ist source2e.idx
406 makeindex -s gglo.ist -o source2e.gls source2e.glo
407
408 latex source2e.tex
409 latex source2e.tex
410
411
412 The makeindex style source2e.ist is used in place of the usual
413 doc gind.ist to ensure that I is used in the sequence I J K
414 not I II II, which would be the default makeindex behaviour.
415
416 The third run with latex is only required to get the table of
417 contents entries for the change log and index. You may speed things up
418 by using the \includeonly mechanism so as not to typeset the source
419 files on the second run. This involves changing the file
420 ltxdoc.cfg
421 between the latex runs.
422
423 The following unix script automates this.
424 (It could easily be ported to scripts for DOS or VMS,
425 rm is ReMove a file, and echo "..." > file writes ... to "file".)
426
427
428 After this script (after the second ==============) is a similar script
429 that will produce the documentation for all the files in the base
430 distribution that are *not* included in source2e.dvi. This second script
431 was requested, but before using it, beware it will take a long time!
432 It may however be modified as required, eg to not typeset the fdd files
433 or whatever...
434
435 ==============
436 #!/bin/sh
437
438 rm -f source2e.gls source2e.ind source2e.toc
439
440 # First run:
441 # Create new standard ltxdoc.cfg file
442 # Pass the (possibly empty) list of arguments supplied on the
443 # command line to article class.
444 #
445 # If you use A4 paper, running this script with argument
446 # a4paper
447 # may save about 30 pages.
448 #
449 echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg
450
451
452 # Now LaTeX the file with this cfg file.
453 #
454 pdflatex source2e.tex
455
456
457 # Make the Change log and Glossary.
458 #
459 makeindex -s source2e.ist source2e.idx
460 makeindex -s gglo.ist -o source2e.gls source2e.glo
461
462
463 # Second run: append \includeonly{} to ltxdoc.cfg to speed up things
464 # (this run needed only to get changes and index listed in .toc file)
465 #
466 # Note that the index will not be made incorrect by the insertion
467 # of the table of contents as the front matter uses a different page
468 # numbering scheme.
469 #
470 echo "\includeonly{}" >> ltxdoc.cfg
471
472 pdflatex source2e.tex
473
474
475 # Third and final run, to put everything together.
476 # First restore the cfg file:
477 #
478 echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg
479 pdflatex source2e.tex
480
481
482 ==============
483 #!/bin/sh
484
485 # Running this script will process all the dtx fdd and *guide.tex
486 # and ltnews*.tex files in the LaTeX distribution, except the dtx
487 # files included in source2e.tex.
488 # (The shell first script in the comments of source2e.tex will
489 # process those.)
490
491 # Any command line arguments (eg a4paper) are taken as options to the
492 # article class.
493
494 # This script is likely to take ages!
495
496 echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg
497 echo "\batchmode" >> ltxdoc.cfg
498
499 # The next four lines produce full indexes and change logs
500 # you may not want those.
501 echo "\AtBeginDocument{\RecordChanges}" >> ltxdoc.cfg
502 echo "\AtEndDocument{\PrintChanges}" >> ltxdoc.cfg
503 echo "\AtBeginDocument{\CodelineIndex\EnableCrossrefs}" >> ltxdoc.cfg
504 echo "\AtEndDocument{\PrintIndex}" >> ltxdoc.cfg
505
506 # If you do not want any code listings, just documentation, then instead
507 # of the above four lines, uncomment the following:
508 # echo "\AtBeginDocument{\OnlyDescription}" >> ltxdoc.cfg
509
510
511 for i in *dtx *fdd
512 do
513 B=`basename $i .dtx`
514
515 if (grep "Include{$B}" source2e.tex >/dev/null ; )
516 then
517 echo In source2e: $i
518 else
519 echo pdflatex $i
520 if (pdflatex $i > /dev/null)
521 then
522 echo pdflatex $i
523 pdflatex $i > /dev/null
524 echo makeindex -s gind.ist $B.idx
525 makeindex -s gind.ist $B.idx > /dev/null 2> /dev/null
526 echo makeindex -s gglo.ist -o $B.gls $B.glo
527 makeindex -s gglo.ist -o $B.gls $B.glo > /dev/null 2> /dev/null
528 echo pdflatex $i
529 pdflatex $i > /dev/null
530 else
531 echo "!!! LaTeX ERROR: $i. (See $B.log.)"
532 fi
533 fi
534
535 done