summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/source2e.tex
blob: e74c424d729a7a373c78ffd2703751b341c02711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
% \iffalse meta-comment
%
% Copyright (C) 1993-2020
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi

% This document will typeset the LaTeX sources as a single document.
% This will produce quite a large file (roughly 555 pages) and may
% take a long time.
%
% Some notes on processing this document are contained at the end
% of this document, after \end{document}
%
% DPC 1997/11/17
%
% First a special index style for makeindex
%

\begin{filecontents}{source2e.ist}
actual '='
quote '!'
level '>'
preamble
"\n \\begin{theindex} \n \\makeatletter\\scan@allowedfalse\n"
postamble
"\n\n \\end{theindex}\n"
item_x1   "\\efill \n \\subitem "
item_x2   "\\efill \n \\subsubitem "
delim_0   "\\pfill "
delim_1   "\\pfill "
delim_2   "\\pfill "
% The next lines will produce some warnings when
% running Makeindex as they try to cover two different
% versions of the program:
lethead_prefix   "{\\bfseries\\hfil "
lethead_suffix   "\\hfil}\\nopagebreak\n"
lethead_flag       1
heading_prefix   "{\\bfseries\\hfil "
heading_suffix   "\\hfil}\\nopagebreak\n"
headings_flag       1

% and just for source2e:
% Remove R so I is treated in sequence I J K not I II III
page_precedence "rnaA"
\end{filecontents}



\documentclass{source2edoc}

\listfiles

% Do not index some TeX primitives, and some common plain TeX commands.

\DoNotIndex{\def,\long,\edef,\xdef,\gdef,\let,\global}
\DoNotIndex{\if,\ifnum,\ifdim,\ifcat,\ifmmode,\ifvmode,\ifhmode,%
            \iftrue,\iffalse,\ifvoid,\ifx,\ifeof,\ifcase,\else,\or,\fi}
\DoNotIndex{\box,\copy,\setbox,\unvbox,\unhbox,\hbox,%
            \vbox,\vtop,\vcenter}
\DoNotIndex{\@empty,\immediate,\write}
\DoNotIndex{\egroup,\bgroup,\expandafter,\begingroup,\endgroup}
\DoNotIndex{\divide,\advance,\multiply,\count,\dimen}
\DoNotIndex{\relax,\space,\string}
\DoNotIndex{\csname,\endcsname,\@spaces,\openin,\openout,%
            \closein,\closeout}
\DoNotIndex{\catcode,\endinput}
\DoNotIndex{\jobname,\message,\read,\the,\m@ne,\noexpand}
\DoNotIndex{\hsize,\vsize,\hskip,\vskip,\kern,\hfil,\hfill,\hss}
\DoNotIndex{\m@ne,\z@,\z@skip,\@ne,\tw@,\p@}
\DoNotIndex{\dp,\wd,\ht,\vss,\unskip}

% Set up the Index and Change History to use \part
\IndexPrologue{\part*{Index}%
                 \markboth{Index}{Index}%
                 \addcontentsline{toc}{part}{Index}%
                 The italic numbers denote the pages where the
                 corresponding entry is described,
                 numbers underlined point to the definition,
                 all others indicate the places where it is used.}

\GlossaryPrologue{\part*{Change History}%
%                Allow control names to be hyphenated here...
                 {\GlossaryParms\ttfamily\hyphenchar\font=`\-}%
                 \markboth{Change History}{Change History}%
                 \addcontentsline{toc}{part}{Change History}}

% The standard \changes command modified slightly to better cope with
% this multiple file document.
\makeatletter
\def\@changes@iso@date#1/#2/#3/#4\space{#1\if\relax#2\relax\else-#2-#3\fi\space}
\def\changes@#1#2#3{%
  \let\protect\@unexpandable@protect
  \edef\@tempa{\noexpand\glossary{\@changes@iso@date#2///\space
                                 \currentfile\space#1\levelchar
                                 \ifx\saved@macroname\@empty
                                   \space
                                   \actualchar
                                   \generalname
                                 \else
                                   \expandafter\@gobble
                                   \saved@macroname
                                   \actualchar
                                   \string\verb\quotechar*%
                                   \verbatimchar\saved@macroname
                                   \verbatimchar
                                 \fi
                                 :\levelchar #3}}%
  \@tempa\endgroup\@esphack}

% Move whole block up so that the file key is not so close
% to bottom of US letter page.
\addtolength\topmargin{-2\baselineskip}


% Codelines are allowed to run over a bit without showing up as overfull
%
\renewcommand*\MacroFont{\fontencoding\encodingdefault
                   \fontfamily\ttdefault
                   \fontseries\mddefault
                   \fontshape\updefault
                   \small
                   \hfuzz 6pt\relax}

% Section numbers now reach eg 74.17.2 which need more space
\renewcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.8em}}
\renewcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.4em}}
\makeatother

% Produce a Change Log and (2 column) Index.
\RecordChanges
\CodelineIndex
\EnableCrossrefs
\setcounter{IndexColumns}{2}

% Needed for documentation in ltoutenc.dtx
% \usepackage{textcomp}

\begin{document}
 \title{The \LaTeXe\ Sources}
 \author{%
  Johannes Braams\\
  David Carlisle\\
  Alan Jeffrey\\
  Leslie Lamport\\
  Frank Mittelbach\\
  Chris Rowley\\
  Rainer Sch\"opf}

% This command will be used to input the patch file
% if that file exists.
\newcommand{\includeltpatch}{%
  \def\currentfile{ltpatch.ltx}
  \part{ltpatch}
  {\let\ttfamily\relax
    \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}%
  Things we did wrong\ldots
  \IndexInput{ltpatch.ltx}}



% Get the date and patch level from ltvers.dtx
\makeatletter
\let\patchdate=\@empty
\begingroup
   \def\ProvidesFile#1\fmtversion#2#3\patch@level#4{%
      \date{#2}\xdef\patchdate{#4}\endinput}
   \input{ltvers.dtx}
\global\let\X@date=\@date

% Add the patch version if available.
   \long\def\Xdef#1#2#3\def#4#5{%
    \xdef\X@date{#2}%
    \xdef\patchdate{#5}%
    \endinput}%
   \InputIfFileExists{ltpatch.ltx}
    {\let\def\Xdef}{\global\let\includeltpatch\relax}
\endgroup

\ifx\@date\X@date
   \def\Xpatch{0}
   \ifx\patchdate\Xpatch\else
     \edef\@date{\@date\space Patch level \patchdate}
   \fi
\else
   \@warning{ltpatch.ltx does not match ltvers.dtx!}
   \let\includeltpatch\relax
\fi
\makeatother

 \pagenumbering{roman}

 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \renewcommand\maketitle{}

 \tableofcontents

 \clearpage

 \pagenumbering{arabic}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Each of the following \DocInclude lines includes a file with extension
% .dtx. Each of these files may be typeset separately. For instance
% latex ltboxes.dtx
% will typeset the source of the LaTeX box commands.
%
% If this file is processed, each of these separate dtx files will be
% contained as a part of a single document. Using ltxdoc.cfg you can
% then optionally produce a combined index and/or change history for
% the entire source of the format file. Note that such a document will
% be quite large (about 555 pages).
%

 \DocInclude{ltdirchk} % System dependent initialisation

 \DocInclude{ltplain}  % LaTeX version of Knuth's plain.tex

 \DocInclude{ltvers}   % Current version date

 \DocInclude{ltluatex} % luatex support

 \DocInclude{ltexpl}   % L3 programming layer integration

 \DocInclude{ltdefns}  % Initial definitions.

 \DocInclude{lthooks}  % Hook management (L3 module)

 \DocInclude{ltalloc}  % Allocation of counters and others.

 \DocInclude{ltcntrl}  % Program control macros.

 \DocInclude{lterror}  % Error handling.

 \DocInclude{ltpar}    % Paragraphs.

 \DocInclude{ltspace}  % Spacing, line and page breaking.

 \DocInclude{ltlogos}  % Logos.

 \DocInclude{ltfiles}  % \input files and related commands

 \DocInclude{ltoutenc} % Output encoding interface

 \DocInclude{ltcounts} % Counters

 \DocInclude{ltlength} % Lengths

 \DocInclude{ltfssbas} % NFSS Base macros

 \DocInclude{ltfssaxes}% NFSS Axes handling (new in 2020)

 \DocInclude{ltfsstrc} % NFSS Tracing (and tracefnt.sty)

 \DocInclude{ltfsscmp} % NFSS1 Compatibility

 \DocInclude{ltfssdcl} % NFSS Declarative interface

 \DocInclude{ltfssini} % NFSS Initialisation

 \DocInclude{fontdef}  % fonttext.ltx/fontmath.ltx

 \DocInclude{preload}  % preload.ltx

 \DocInclude{ltfntcmd} % \textrm etc

 \DocInclude{lttextcomp} % companion symbols (new 2020)

 \DocInclude{ltpageno} % Page numbering

 \DocInclude{ltxref}   % Cross referencing

 \DocInclude{ltmiscen} % Miscellaneous environment definitions.

 \DocInclude{ltmath}   % Mathematics set up.

 \DocInclude{ltlists}  % List and related environments

 \DocInclude{ltboxes}  % Parbox and friends

 \DocInclude{lttab}    % Tabbing tabular and array

 \DocInclude{ltpictur} % Picture mode

 \DocInclude{ltthm}    % Theorem environments

 \DocInclude{ltsect}   % Sectioning

 \DocInclude{ltfloat}  % Floats

 \DocInclude{ltidxglo} % Index and Glossary

 \DocInclude{ltbibl}   % Bibliography

 \DocInclude{ltpage}   % \pagestyle \raggedbottom \sloppy

 \DocInclude{ltclass}  % Package & Class interface

 \DocInclude{ltfilehook}  % Hook management for files (L3 module)

 \DocInclude{ltshipout}% \shipout redefinition (L3 module)

 \DocInclude{ltoutput} % Output routine

 \DocInclude{lthyphen} % Hyphenation (hyphen.ltx).

 \DocInclude{ltfinal}  % Last minute initialisations and dump

 \includeltpatch       % Corrections distributed after the full release

% Stop here if ltxdoc.cfg says \AtEndOfClass{\OnlyDescription}
\StopEventually{\end{document}}

\clearpage
\pagestyle{headings}

% Make TeX shut up.
\hbadness=10000
\newcount\hbadness
\hfuzz=\maxdimen

\typeout{%
  \string # Produce change log with^^J%
  makeindex -s gglo.ist -o source2e.gls source2e.glo}


\PrintChanges

\clearpage

% makeindex needs a symbol between the parts of composite page numbers
% but we dont want one, so:
\typeout{%
  \string # Produce index with^^J%
  makeindex -s source2e.ist source2e.idx}

\begingroup
\def\endash{--}
\catcode`\-\active
\def-{\futurelet\temp\indexdash}
\def\indexdash{\ifx\temp-\endash\fi}

\PrintIndex
\endgroup

% Make sure that the index is not printed twice
% (ltxdoc.cfg might have a second \PrintIndex command)
\let\PrintChanges\relax
\let\PrintIndex\relax

\end{document}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

To use this file to produce a fully indexed source code
you need to execute the following (or equivalent) commands:

   latex source2e.tex

   makeindex -s source2e.ist source2e.idx
   makeindex -s gglo.ist -o source2e.gls source2e.glo

   latex source2e.tex
   latex source2e.tex


The makeindex style source2e.ist is used in place of the usual
doc gind.ist to ensure that I is used in the sequence I J K
not I II II, which would be the default makeindex behaviour.

The third run with latex is only required to get the table of
contents entries for the change log and index. You may speed things up
by using the \includeonly mechanism so as not to typeset the source
files on the second run. This involves changing the file
ltxdoc.cfg
between the latex runs.

The following unix script automates this.
  (It could easily be ported to scripts for DOS or VMS,
   rm is ReMove a file, and echo "..." > file writes ... to "file".)


After this script (after the second ==============) is a similar script
that will produce the documentation for all the files in the base
distribution that are *not* included in source2e.dvi. This second script
was requested, but before using it, beware it will take a long time!
It may however be modified as required, eg to not typeset the fdd files
or whatever...

==============
#!/bin/sh

rm  -f source2e.gls source2e.ind source2e.toc

# First run:
# Create new standard ltxdoc.cfg file
# Pass the (possibly empty) list of arguments supplied on the
# command line to article class.
#
# If you use A4 paper, running this script with argument
#    a4paper
# may save about 30 pages.
#
echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg


# Now LaTeX the file with this cfg file.
#
pdflatex source2e.tex


# Make the Change log and Glossary.
#
makeindex -s source2e.ist source2e.idx
makeindex -s gglo.ist -o source2e.gls source2e.glo


# Second run: append \includeonly{} to ltxdoc.cfg to speed up things
# (this run needed only to get changes and index listed in .toc file)
#
# Note that the index will not be made incorrect by the insertion
# of the table of contents as the front matter uses a different page
# numbering scheme.
#
echo "\includeonly{}" >> ltxdoc.cfg

pdflatex source2e.tex


# Third and final run, to put everything together.
# First restore the cfg file:
#
echo "\PassOptionsToClass{$*}{article}" > ltxdoc.cfg
pdflatex source2e.tex


==============
#!/bin/sh

# Running this script will process all the dtx fdd and *guide.tex
# and ltnews*.tex files in the LaTeX distribution, except the dtx
# files included in source2e.tex.
# (The shell first script in the comments of source2e.tex will
#  process those.)

# Any command line arguments (eg a4paper) are taken as options to the
# article class.

# This script is likely to take ages!

echo "\PassOptionsToClass{$*}{article}"                  > ltxdoc.cfg
echo "\batchmode"                                       >> ltxdoc.cfg

# The next four lines produce full indexes and change logs
# you may not want those.
echo "\AtBeginDocument{\RecordChanges}"                 >> ltxdoc.cfg
echo "\AtEndDocument{\PrintChanges}"                    >> ltxdoc.cfg
echo "\AtBeginDocument{\CodelineIndex\EnableCrossrefs}" >> ltxdoc.cfg
echo "\AtEndDocument{\PrintIndex}"                      >> ltxdoc.cfg

# If you do not want any code listings, just documentation, then instead
# of the above four lines, uncomment the following:
# echo "\AtBeginDocument{\OnlyDescription}"                >> ltxdoc.cfg


for i in *dtx *fdd
do
B=`basename $i .dtx`

if (grep "Include{$B}" source2e.tex >/dev/null ; )
then
echo In source2e: $i
else
echo pdflatex $i
  if (pdflatex $i > /dev/null)
  then
    echo pdflatex $i
    pdflatex $i > /dev/null
    echo makeindex -s gind.ist $B.idx
    makeindex -s gind.ist $B.idx > /dev/null 2> /dev/null
    echo makeindex -s gglo.ist -o $B.gls $B.glo
    makeindex -s gglo.ist -o $B.gls $B.glo > /dev/null 2> /dev/null
    echo pdflatex $i
    pdflatex $i > /dev/null
  else
    echo "!!! LaTeX ERROR: $i. (See $B.log.)"
  fi
fi

done