Debian Codegraph @

texmf-dist/source/latex-dev/base/ltxdoc.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 1993-2026
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 % \iffalse
30 %
31 %<class>\NeedsTeXFormat{LaTeX2e}
32 %<class>\ProvidesClass{ltxdoc}
33 %<class> [2026/04/06 v2.1l Standard LaTeX documentation class]
34 %
35 %<*driver>
36 \documentclass{ltxdoc}
37 \GetFileInfo{ltxdoc.cls}
38 \providecommand\dst{\expandafter{\normalfont\scshape docstrip}}
39 \title{The file \texttt{ltxdoc.dtx} for use with
40 \LaTeXe.\thanks{This file has version
41 number \fileversion, dated \filedate.}\\[2pt]
42 It contains the code for \texttt{ltxdoc.cls}}
43 \date{\filedate}
44 \author{David Carlisle}
45 \begin{document}
46 \MaintainedByLaTeXTeam{latex}
47 \maketitle
48 \DocInput{ltxdoc.dtx}
49 \end{document}
50 %</driver>
51 %
52 % \fi
53 %
54 % \providecommand\pkg[1]{\texttt{#1}}
55 %
56 %
57 % \changes{v2.0i}{1994/04/29}{Update the documentation.}
58 % \changes{v2.0s}{1998/08/17}{(RmS) Documentation fixes.}
59 % \changes{v2.1a}{2020/08/21}{Integration of new hook management interface}
60 %
61 % \section{Documentation of the \LaTeX\ sources}
62 %
63 % This class file is designed for documenting the \LaTeX\ source files.
64 % You may however find it generally useful as a class for typesetting
65 % the documentation of files produced in `doc' format.
66 %
67 % Each documented file in the standard distribution comes with extension
68 % |dtx|. The appropriate class package or initex file will be extracted
69 % from the source by the docstrip system. Each |dtx| file may be
70 % directly processed with \LaTeXe, for example
71 %\begin{verbatim}
72 % latex2e docclass.dtx
73 %\end{verbatim}
74 % would produce the documentation of the class and package interface.
75 %
76 % Each file that is used in producing the \LaTeXe\ format (ie not
77 % including the standard class and packages) will be printed together in
78 % one document if you \LaTeX\ the file |sources2e.tex|. This has the
79 % advantage that one can produce a full index of macro usage across all
80 % the source files.
81 %
82 % If you need to customise the typesetting of any of these files, there
83 % are two options:
84 % \begin{itemize}
85 % \item You can use \dst\ with the module `driver' to extract a small
86 % \LaTeX\ file that you may edit to use whatever class or package
87 % options you require, before inputting the source file.
88 % \item You can create a file |ltxdoc.cfg|. This configuration file will
89 % be read whenever the |ltxdoc| class is used, and so can be used to
90 % customise the typesetting of all the source files, without having to
91 % edit lots of small driver files.
92 %\end{itemize}
93 %
94 % The second option is usually more convenient. Various possibilities
95 % are discussed in the next section.
96 %
97 % \section{Customisation}
98 %
99 % The simplest form of customisation is to pass more options to the
100 % |article| class which is loaded by |ltxdoc|. For instance if you wish
101 % all the documentation to be formatted for A4 paper, add the following
102 % line to |ltxdoc.cfg|:
103 %\begin{verbatim}
104 % \PassOptionsToClass{a4paper}{article}
105 %\end{verbatim}
106 %
107 % All the source files are in two parts, separated by |\MaybeStop|.
108 % The first part (should) contain `user' documentation. The second part
109 % is a full documented listing of the source code. The |doc| package
110 % provides the command |\OnlyDescription| which suppresses the code
111 % listings. This may also be used in the configuration file, but as the
112 % |doc| package is read later, you must delay the execution of
113 % |\OnlyDescription| until after the |doc| package has been read. The
114 % simplest way is to use |\AtBeginDocument|. Thus you could put the
115 % following in your |ltxdoc.cfg|.
116 %\begin{verbatim}
117 % \AtBeginDocument{\OnlyDescription}
118 %\end{verbatim}
119 %
120 % If your document relies on using the old \pkg{doc} version, you can
121 % request that the class loads \pkg{doc} version~2 by passing the
122 % option \texttt{doc2}.
123 %
124 % If the full source listing |sources2e.tex| is processed, then an index
125 % and change history are produced by default, however indexes are normally
126 % not produced for individual files.
127 %
128 % As an example, consider |ltclass.dtx|, which contains the sources for
129 % the new class and package interface commands. With no |cfg|
130 % file, a 19~pages document is produced. With the above configuration
131 % a slightly more readable document (4~pages) is produced.
132 %
133 % Conversely, if you really want to read the source listings in detail,
134 % you will want to have an index. Again the index commands provided by
135 % the doc package may be used, but their execution must be delayed.
136 %\begin{verbatim}
137 % \AtBeginDocument{\CodelineIndex\EnableCrossrefs}
138 % \AtEndDocument{\PrintIndex}
139 %\end{verbatim}
140 %
141 % The |doc| package writes index files to be sorted using MakeIndex with
142 % the |gind| style, so one would then use a command such as
143 %\begin{verbatim}
144 % makeindex -s gind.ist ltclass.idx
145 %\end{verbatim}
146 % and re-run \LaTeX.
147 %
148 % Similarly to print a Change history, you would add
149 %\begin{verbatim}
150 % \AtBeginDocument{\RecordChanges}
151 % \AtEndDocument{\PrintChanges}
152 %\end{verbatim}
153 % to |ltxdoc.cfg|, and use MakeIndex with a command such as
154 %\begin{verbatim}
155 % makeindex -s gglo.ist -o ltclass.gls ltclass.glo
156 %\end{verbatim}
157 %
158 % Finally if you do not want to list all the sections of |source2e.tex|,
159 % you can use |\includeonly| in the |cfg| file:
160 %\begin{verbatim}
161 % \includeonly{ltvers,ltboxes}
162 %\end{verbatim}
163 %
164 % \MaybeStop{}
165 %
166 %
167 % \section{Options}
168 %
169 % \begin{macrocode}
170 %<*class>
171 % \end{macrocode}
172 %
173 % \begin{macrocode}
174 \DeclareOption{a5paper}{\@latexerr{Option not supported}%
175 {}}
176 % \end{macrocode}
177 % Prevent loading of a config file.
178 % \begin{macrocode}
179 \newif\ifltxdoc@load@cfg@ \ltxdoc@load@cfg@true
180 \DeclareOption{nocfg}{\ltxdoc@load@cfg@false}
181 % \end{macrocode}
182 %
183 % Support rolling back \pkg{doc} to version 2:
184 % \changes{v2.1e}{2022/05/27}{Support rolling back doc to version 2}
185 % \changes{v2.1j}{2023/03/28}{Define \cs{cs} if doc is rolled back to v2 (gh/981)}
186 % \begin{macrocode}
187 \let\ltxdoc@doc@version\@empty % use current version by default
188 \DeclareOption{doc2}{%
189 \def\ltxdoc@doc@version{=v2}%
190 \DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}%
191 }
192 % \end{macrocode}
193 %
194 % \begin{macrocode}
195 \DeclareOption*{%
196 \PassOptionsToClass {\CurrentOption}{article}}
197 % \end{macrocode}
198 %
199 % \section{Option Processing}
200 %
201 % \begin{macrocode}
202 \ProcessOptions
203 % \end{macrocode}
204 %
205 % \section{Local configuration}
206 % Input a local configuration file, if it exists.
207 % \begin{macrocode}
208 \ifltxdoc@load@cfg@
209 \InputIfFileExists{ltxdoc.cfg}
210 {\typeout{*************************************^^J%
211 * Local config file ltxdoc.cfg used^^J%
212 *************************************}}
213 {}
214 \else
215 \typeout{*************************************^^J%
216 * Local config file ignored^^J%
217 *************************************}
218 \fi
219 % \end{macrocode}
220 %
221 %
222 % \section{Loading article and doc}
223 %
224 % \begin{macrocode}
225 \LoadClass{article}
226 % \end{macrocode}
227 %
228 % By default, load the current \pkg{doc} version
229 % (\cs{ltxdoc@doc@version} is empty). If option
230 % \texttt{doc2} is given version 2 is loaded
231 % (\cs{ltxdoc@doc@version} contains \texttt{=v2}).
232 % \changes{v2.1e}{2022/05/27}{Support rolling back doc to version 2}
233 % \begin{macrocode}
234 \RequirePackage{doc}[\ltxdoc@doc@version]
235 % \end{macrocode}
236 %
237 % Make \verb+|+ be a `short verb' character, but not in the document
238 % preamble, where an active character may interfere with packages that
239 % are loaded.
240 % \begin{macrocode}
241 \AtBeginDocument{\MakeShortVerb{\|}}
242 % \end{macrocode}
243 %
244 % As `doc' documents tend to have a lot of monospaced material,
245 % set up some |tt| substitutions to occur silently.
246 % \changes{v2.0p}{1995/11/02}{Add font substitutions}
247 % \changes{v2.0t}{1999/04/17}{Replaced octal number, CAR}
248 % \begin{macrocode}
249 \DeclareFontShape{OT1}{cmtt}{bx}{n}{<-> ssub * cmtt/m/n}{}
250 \DeclareFontFamily{OMS}{cmtt}{\skewchar\font 48} % '60
251 \DeclareFontShape{OMS}{cmtt}{m}{n}{<-> ssub * cmsy/m/n}{}
252 \DeclareFontShape{OMS}{cmtt}{bx}{n}{<-> ssub * cmsy/b/n}{}
253 % \end{macrocode}
254 % This substitution is in the standard fd file, but not silent.
255 % \begin{macrocode}
256 \DeclareFontShape{OT1}{cmss}{m}{it}{<->ssub*cmss/m/sl}{}
257 % \end{macrocode}
258 %
259 % \begin{macrocode}
260 \CodelineNumbered
261 \DisableCrossrefs
262 % \end{macrocode}
263 %
264 % Increase the text width slightly so that with the standard fonts
265 % 72 columns of code may appear in a |macrocode| environment.
266 % \changes{v2.0c}{1994/03/15}{Set \cs{textwidth}.}
267 % \begin{macrocode}
268 \setlength{\textwidth}{355pt}
269 % \end{macrocode}
270 %
271 % Increase the marginpar width slightly, for long command names.
272 % And increase the left margin by a similar amount
273 % \changes{v2.0l}
274 % {1994/05/25}{Increase \cs{marginparwidth}}
275 % \changes{v2.0q}{1995/11/28}
276 % {Increase \cs{marginparwidth} and page margin.}
277 % \begin{macrocode}
278 \addtolength\marginparwidth{30pt}
279 \addtolength\oddsidemargin{20pt}
280 \addtolength\evensidemargin{20pt}
281 % \end{macrocode}
282 %
283 %
284 % \begin{macrocode}
285 \setcounter{StandardModuleDepth}{1}
286 % \end{macrocode}
287 %
288 % \section{Useful abbreviations}
289 %
290 % |\cmd{\foo}| prints |\foo| verbatim. It may be used inside moving
291 % arguments. It can \emph{not} be used to record commands that are defined as
292 % ``|\outer|'' nor is it possible to use it on conditionals such as
293 % |\iftrue| or defined by |\newif|.
294 % |\cs{foo}| already available with the \texttt{doc} package and also prints |\foo|,
295 % for those who prefer that
296 % syntax. (This second form can be used to record all types of command so the
297 % above restrictions do not apply.)
298 % \begin{macro}{\cmd}
299 % \changes{v2.0k}{1994/05/21}{New definition, so \cmd\{ works.}
300 % \begin{macro}{\cs}
301 % \changes{v2.0d}{1994/03/17}{Add \cs{cs}}
302 % \changes{v2.1h}{2022/06/22}{Update \cs{cmd} definition to work with new \cs{cs}}
303 % \changes{v2.1k}{2025/11/18}{Handle \cs{cmd} in bookmarks, gh/877}
304 % \begin{macrocode}
305 %\DeclareRobustCommand\cs[1]... % defined later
306 %\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} % can't use with new \cs
307 \def\cmd#1{\texttt{\char`\\\expandafter\cmd@to@cs\string#1}}
308 % \end{macrocode}
309 % hyperref allow to fill the pdfstringdef-hook before the package is loaded:
310 % \begin{macrocode}
311 \providecommand\pdfstringdefPreHook{}
312 \g@addto@macro\pdfstringdefPreHook{%
313 \def\cmd#1{\textbackslash\expandafter\@gobble\string#1}}%
314 \def\cmd@to@cs#1#2{\char\number`#2\relax}
315 % \end{macrocode}
316 % \end{macro}
317 % \end{macro}
318 %
319 % \changes{v2.0r}{1996/01/11}{Removed \cs{star} since useless pr/2039}
320 %
321 % \begin{macro}{\marg}
322 % \changes{v2.0d}{1994/03/17}{Add \cs{marg}}
323 % |\marg{text}| prints \marg{text}, `mandatory argument'.
324 % \begin{macrocode}
325 \providecommand\marg[1]{%
326 {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
327 % \end{macrocode}
328 % \end{macro}
329 %
330 % \begin{macro}{\oarg}
331 % |\oarg{text}| prints \oarg{text}, `optional argument'.
332 % \begin{macrocode}
333 \providecommand\oarg[1]{%
334 {\ttfamily[}\meta{#1}{\ttfamily]}}
335 % \end{macrocode}
336 % \end{macro}
337 %
338 % \begin{macro}{\parg}
339 % |\parg{te,xt}| prints \parg{te,xt}, `picture mode argument'.
340 % \changes{v2.0h}{1994/04/28}{Add \cs{parg}}
341 % \changes{v2.0o}{1995/08/09}{Use \cs{meta} when showing arguments}
342 % \begin{macrocode}
343 \providecommand\parg[1]{%
344 {\ttfamily(}\meta{#1}{\ttfamily)}}
345 % \end{macrocode}
346 % \end{macro}
347 %
348 %
349 % \section{Old Comments}
350 %
351 % The \LaTeXe\ sources contain a lot of code inherited from
352 % \LaTeX2.09. The comments in this code were not designed to be
353 % typeset, and do not contain the necessary \LaTeX\ markup. The
354 % \texttt{oldcomments} environment typesets these comments,
355 % automatically sensing when any control sequence appears, and
356 % implicitly adding the |\verb|. This procedure does not produce
357 % particularly beautiful pages, but it allows us to fully document new
358 % sections, and have some form of typeset comments on all the old
359 % code.
360 % \changes{v2.0e}{1994/03/18}{Use a fixed font.}
361 %
362 % Scan control names and put them in tt.
363 % Will actually (incorrectly) scan past |\\| but this does not matter as
364 % this is almost never followed by a letter in practice.
365 % (ie |\\foo|) would put |foo| in |\ttfamily|.
366 % \begin{macrocode}
367 \def\oc@scan#1{%
368 \ifx\oc@bslash#1%
369 \egroup\let\next\oc@bslash\else
370 \ifcat a\noexpand#1%
371 #1\let\next\oc@scan\else
372 \ifx\oc@percent#1%
373 \def\next{\char`\%\egroup}%
374 \else
375 #1\let\next\egroup
376 \fi\fi\fi\next}
377 % \end{macrocode}
378 %
379 % \begin{macrocode}
380 \def\oc@bslash{\bgroup\oc@ttf\char`\\\oc@scan}%
381 % \end{macrocode}
382 %
383 % \begin{macrocode}
384 \def\oc@verb#1{%
385 \catcode`#1\active
386 \uccode`\~`#1%
387 \uppercase{\def~{{\oc@ttf\char`#1}}}}
388 % \end{macrocode}
389 %
390 % \begin{macrocode}
391 \begingroup
392 \obeyspaces%
393 \catcode`\/=\catcode`\\
394 /catcode`/\/active
395 /catcode`<=/catcode`{%
396 /catcode`>=/catcode`}%
397 /catcode`/{/active%
398 /catcode`/}/active%
399 /gdef/oldc< \end{oldcomments}>%
400 /gdef/begmac< \begin{macrocode}>%
401 /gdef/obs</def <</oc@ttf/ >>>%
402 /endgroup%
403 % \end{macrocode}
404 %
405 % \changes{v2.0y}{2019/09/16}{Say that oldcomments may not be accurate (gh/180)}
406 % \begin{macrocode}
407 \begingroup
408 \catcode`\/=\catcode`\\
409 \catcode`\\=13
410 /catcode`/|=/catcode`/%
411 /catcode`/%=13
412 /gdef/oldcomments{|
413 /makeatletter
414 /let/do/oc@verb/dospecials
415 /frenchspacing/@vobeyspaces/obs
416 /raggedright
417 /oc@verb/>|
418 /oc@verb/<|
419 /let\/oc@bslash
420 /let%/oc@percent
421 /obeylines
422 /parindent/z@
423 /ttfamily/expandafter/let/expandafter/oc@ttf/the/font
424 /rmfamily
425 /textit{Historical /LaTeX/,2.09 comments (not necessarily accurate any more):}
426 /hfuzz/maxdimen
427 }
428 /endgroup
429 % \end{macrocode}
430 %
431 % \begin{macrocode}
432 \begingroup
433 \sloppy%
434 \obeylines%
435 \gdef\oc@percent#1^^M{%
436 \ifvmode%
437 \def\commentline{#1}%
438 \ifx\commentline\oldc%
439 \textit{End of historical \LaTeX\,2.09 comments.}
440 \end{oldcomments}%
441 \else%
442 \ifx\commentline\begmac%
443 \begin{macrocode}%
444 \else%
445 \leavevmode%
446 #1^^M%
447 \fi\fi%
448 \else%
449 {\oc@ttf\char`\%}#1^^M%
450 \fi}%
451 \endgroup%
452 % \end{macrocode}
453 %
454 %
455 % \section{DocInclude}
456 %
457 % \begin{macrocode}
458 \@addtoreset{CodelineNo}{part}
459 % \end{macrocode}
460 %
461 % \begin{macro}{\DocInclude}
462 % More or less exactly the same as |\include|, but uses |\DocInput|
463 % on a |dtx| file, not |\input| on a |tex| file.
464 % \changes{v2.0b}{1994/03/14}{Rename from \cs{docinclude}}
465 % \changes{v2.0f}{1994/03/25}{Use \cs{part}}
466 % \changes{v2.0u}{1999/08/08}{Also works for .fdd (M. Schroeder)}
467 % \begin{macrocode}
468 \def\partname{File}
469 % \end{macrocode}
470 %
471 %
472 %
473 % \changes{v2.0z}{2020/05/17}{Support spaces \emph{within} filenames
474 % (gh/218)}
475 % \begin{macrocode}
476 \newcommand*{\DocInclude}[1]{%
477 \relax
478 \clearpage
479 \docincludeaux
480 \IfFileExists{#1.fdd}%
481 {\def\currentfile{#1.fdd}}%
482 {\def\currentfile{#1.dtx}}%
483 \ifnum\@auxout=\@partaux
484 \@latexerr{\string\include\space cannot be nested}\@eha
485 \else
486 \set@curr@file{#1}%
487 \edef\@curr@file{\@strip@tex@ext\@curr@file}%
488 \expandafter\@docinclude\expandafter{\@curr@file}
489 \fi}
490 \def\@docinclude#1 {\clearpage
491 % \end{macrocode}
492 %
493 % \changes{v2.1bj}{2020/10/04}{Quotes around the aux file name removed,
494 % they are no longer needed and upset BibTeX (gh/400)}
495 % \begin{macrocode}
496 \if@filesw \immediate\write\@mainaux{\string\@input{#1.aux}}\fi
497 \@tempswatrue\if@partsw \@tempswafalse\edef\@tempb{#1}\@for
498 \@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}\fi
499 \if@tempswa \let\@auxout\@partaux \if@filesw
500 \immediate\openout\@partaux "#1.aux"
501 \immediate\write\@partaux{\relax}\fi
502 \@filehook@set@CurrentFile
503 % \end{macrocode}
504 % We need to save (and later restore) various index-related
505 % commands which might be changed by the included file.
506 % \begin{macrocode}
507 \let\@ltxdoc@PrintIndex\PrintIndex
508 \let\PrintIndex\relax
509 \let\@ltxdoc@PrintChanges\PrintChanges
510 \let\PrintChanges\relax
511 \let\@ltxdoc@theglossary\theglossary
512 \let\@ltxdoc@endtheglossary\endtheglossary
513 \part{\currentfile}%
514 {\let\ttfamily\relax
515 \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}%
516 \DocInput{\currentfile}%
517 \let\PrintIndex\@ltxdoc@PrintIndex
518 \let\PrintChanges\@ltxdoc@PrintChanges
519 \let\theglossary\@ltxdoc@theglossary
520 \let\endtheglossary\@ltxdoc@endtheglossary
521 \clearpage
522 \@writeckpt{#1}\if@filesw \immediate\closeout\@partaux \fi
523 \else\@nameuse{cp@#1}\fi\let\@auxout\@mainaux}
524 % \end{macrocode}
525 %
526 % \changes{v2.0x}{2018/03/15}{Set up \cs{protect} in index entries}
527 % \begin{macrocode}
528 \gdef\codeline@wrindex#1{\if@filesw
529 % \end{macrocode}
530 % Set \cs{protect} to a suitable value in the index entries (we
531 % can't use |\set@display@protect| as that would result in different
532 % number of spaces after a command depending on the number of
533 % expansion happening prior to writing the index).
534 % \begin{macrocode}
535 \begingroup
536 \let\protect\noexpand
537 \immediate\write\@indexfile
538 {\string\indexentry{#1}%
539 {\filesep\number\c@CodelineNo}}%
540 \endgroup\fi}
541 % \end{macrocode}
542 % \end{macro}
543 %
544 % \begin{macrocode}
545 \let\filesep\@empty
546 % \end{macrocode}
547 %
548 %
549 % \begin{macro}{\aalph}
550 % Special form of |\alph| as currently |source2e.tex|
551 % includes more than 26 files
552 % \changes{v2.0n}{1994/05/27}{Use uppercase letters, for makeindex}.
553 % \begin{macrocode}
554 \def\aalph#1{\@aalph{\csname c@#1\endcsname}}
555 \def\@aalph#1{%
556 \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or
557 j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or
558 t\or u\or v\or w\or x\or y\or z\or A\or B\or C\or
559 D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
560 N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or
561 X\or Y\or Z\else\@ctrerr\fi}
562 % \end{macrocode}
563 % \end{macro}
564 %
565 % \begin{macro}{\docincludeaux}
566 % \changes{v2.06}{1994/03/31}{Use \cs{footnotesize} in file key.}
567 % \changes{v2.0k}{1994/05/21}{Use \cs{aalph}}
568 % \changes{v2.0v}{2017/03/13}{Use \cs{parbox}[t] in file
569 % key to maintain space between the text block and the page foot.}
570 % \begin{macrocode}
571 \def\docincludeaux{%
572 \def\thepart{\aalph{part}}\def\filesep{\thepart-}%
573 \let\filekey\@gobble
574 \g@addto@macro\index@prologue{%
575 \gdef\@oddfoot{\parbox[t]{\textwidth}{\strut\footnotesize
576 \raggedright{\bfseries File Key:} \filekey}}%
577 \let\@evenfoot\@oddfoot}%
578 \global\let\docincludeaux\relax
579 \gdef\@oddfoot{%
580 \expandafter\ifx\csname ver@\currentfile\endcsname\relax
581 File \thepart: {\ttfamily\currentfile} %
582 \else
583 \GetFileInfo{\currentfile}%
584 File \thepart: {\ttfamily\filename} %
585 Date: \filedate\ %
586 Version \fileversion
587 \fi
588 \hfill\thepage}%
589 \let\@evenfoot\@oddfoot}%
590 % \end{macrocode}
591 % \end{macro}
592 %
593 % \begin{macro}{\MaintainedByLaTeXTeam}
594 % \changes{v2.0v}{2015/03/25}{macro added}
595 % \changes{v2.0w}{2015/03/25}{use display block not footnote text}
596 % Generate boilerplate reference to bug database.
597 % \begin{macrocode}
598 \def\MaintainedBy#1{\gdef\@maintainedby{#1}}
599 % \end{macrocode}
600 %
601 % \begin{macrocode}
602 \let\@maintainedby\@empty
603 % \end{macrocode}
604 %
605 % \begin{macrocode}
606 \def\MaintainedByLaTeXTeam#1{%
607 {\gdef\@maintainedby{%
608 This file is maintained by the \LaTeX{} Project team.\\%
609 Bug reports can be opened (category \texttt{#1}) at\\%
610 \url{https://latex-project.org/bugs.html}.}}}
611 % \end{macrocode}
612 %
613 % \begin{macrocode}
614 \def\@maketitle{%
615 \newpage
616 \null
617 \vskip 2em%
618 \begin{center}%
619 \let \footnote \thanks
620 {\LARGE \@title \par}%
621 \vskip 1.5em%
622 {\large
623 \lineskip .5em%
624 \begin{tabular}[t]{c}%
625 \@author
626 \end{tabular}\par}%
627 \vskip 1em%
628 {\large \@date}%
629 \ifx\@maintainedby\@empty
630 \else
631 \vskip 1em%
632 \fbox{\fbox{\begin{tabular}{@{}l@{}}\@maintainedby\end{tabular}}}%
633 \fi
634 \end{center}%
635 \par
636 \vskip 1.5em}
637 % \end{macrocode}
638 % \end{macro}
639 %
640 %
641 % \begin{macrocode}
642 \def\task#1#2{}
643 % \end{macrocode}
644 %
645 %
646 % \changes{v2.1f}{2022/06/03}{define \cs{pkg} and other commands}
647 % \changes{v2.1f}{2022/06/03}{allow \_ in macro names}
648 % Some features from l3doc.cls
649 % \changes{v2.1g}{2022/06/14}{define \cs{pkg} but delay until begin document}
650 % \changes{v2.1i}{2022/11/28}{Revert 2.1f and not use \cs{detokenize} for now (gh/962)}
651 % Eventually, \cs{cs} should get the definition from \pkg{l3doc} but for now we
652 % revert to the simple one from \pkg{doc}.
653 % \begin{macrocode}
654 %\DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}% -- def in doc.sty
655 \AtBeginDocument{%
656 % \renewcommand\PrintMacroName[1]{\MacroFont\string #1\ }% -- def in doc.sty
657 % \end{macrocode}
658 % We provide those delated in case somebody has loaded \texttt{csquotes}
659 % or makes some definitions in the preamble.
660 % \begin{macrocode}
661 \providecommand\LuaTeX{Lua\TeX}
662 \providecommand\cls{\textsf}
663 \providecommand\pkg{\textsf}
664 \providecommand\enquote[1]{``#1''}
665 \providecommand\url{\texttt}
666 }
667 % \end{macrocode}
668 %
669 %
670 %
671 % \begin{macrocode}
672 %</class>
673 % \end{macrocode}
674 %
675 %
676 % \section{Document elements for new style documentation}
677 %
678 % The next block defines commands and environments that we use in newer
679 % code documentation. This is put into a separate file, because we also
680 % need it in \texttt{source2edoc.cls} and in other places.
681 %
682 % \begin{macrocode}
683 %<*ltx>
684 % \end{macrocode}
685 %
686 % If the ltxdoc class is loaded with option \texttt{doc2} the \pkg{doc}
687 % commands from version 3 are unavailable, in that case we do
688 % nothing in this section!
689 % \begin{macrocode}
690 \ifcsname NewDocElement\endcsname
691 % \end{macrocode}
692 %
693 % It is helpful though no longer essential if this file can be
694 % loaded several times, for example, to redeclare
695 % the doc elements for tagging. At the moment \pkg{doc} doesn't
696 % offer an unconditional \cs{DeclareDocElement} so we do this
697 % below.
698 %
699 % \subsection{Hooks, Sockets, and Plugs}
700 %
701 %
702 % \begin{macrocode}
703 \providecommand\hook[1]{\texttt{#1\DescribeHook[noprint]{#1}}}
704 \providecommand\socket[1]{\texttt{#1\DescribeSocket[noprint]{#1}}}
705 \providecommand\plug[1]{\texttt{#1\DescribePlug[noprint]{#1}}}
706 % \end{macrocode}
707 %
708 % This should probably go into \pkg{doc}.
709 % \begin{macrocode}
710 \providecommand\DeclareDocElement[3][]{\@NewDocElement{#1}{#2}{#3}}
711 % \end{macrocode}
712 %
713 % \begin{macrocode}
714 \DeclareDocElement[printtype=\textit{socket},idxtype=socket,idxgroup=Sockets]{Socket}{socketdecl}
715 \DeclareDocElement[printtype=\textit{hook},idxtype=hook,idxgroup=Hooks]{Hook}{hookdecl}
716 \DeclareDocElement[printtype=\textit{plug},idxtype=plug,idxgroup=Plugs]{Plug}{plugdecl}
717 % \end{macrocode}
718 % For templates, used in block and sec-template code:
719 % \begin{macrocode}
720 \DeclareDocElement[envlike, idxtype=type, idxgroup=template types,
721 printtype=\textit{type}] {TemplateType}{templatetype}
722 \DeclareDocElement[envlike, idxtype=template, idxgroup=templates,
723 printtype=\textit{templ.}] {Template}{template}
724 \DeclareDocElement[envlike, idxtype=instance, idxgroup=instances,
725 printtype=\textit{inst.}] {Instance}{instance}
726 % \end{macrocode}
727 %
728 % \begin{macrocode}
729 \DeclareDocElement[printtype=\textit{tag socket},idxtype=tag socket,
730 idxgroup=Tagging Sockets]{TaggingSocket}{taggingsocketdecl}
731 \DeclareDocElement[printtype=\textit{tag plug},idxtype=tag plug,
732 idxgroup=Tagging Plugs]{TaggingPlug}{taggingplugdecl}
733 % \end{macrocode}
734 %
735 % \begin{macrocode}
736 \fi % end of \ifcsname NewDocElement\endcsname
737 % \end{macrocode}
738 %
739 % \begin{macrocode}
740 %</ltx>
741 % \end{macrocode}
742 %
743 %
744 %
745 % \section{Configuration file}
746 %
747 %
748 % \begin{macrocode}
749 %<*cfg>
750 %
751 % This is the ltxdoc configuration file we use to format the LaTeX
752 % kernel sources.
753 %
754 %
755 % Copyright 2006, 2007, 2011
756 % Heiko Oberdiek
757 % Copyright (C) 2014-2026
758 % The LaTeX Project
759 %
760
761 \ProvidesFile{ltxdoc.cfg}%
762 [2022/06/14 v2.0d ltxdoc.cls configuration (LaTeX Project)]
763 \PassOptionsToClass{a4paper}{article}
764
765 % hyperref and hypdoc are now loaded late (or by the user) so we have to wait
766 % with any adjustments until that has happened
767
768 \AddToHook{package/hyperref/after}{%
769 %% \RequirePackage{hypdoc}% % this is now triggered by doc
770 \RequirePackage{pdftexcmds}\relax
771 \ifnum\pdf@strcmp{\jobname}{inputenc}=0 %
772 \hypersetup{pdfencoding=auto}%
773 \pdfstringdefDisableCommands{%
774 \def\meta#1{% inputenc.dtx
775 \9060\010#1\9060\011%
776 }%
777 }%
778 \else
779 \fi
780 \pdfstringdefDisableCommands{%
781 \let\env\relax % longtable.dtx
782 \let\mytt\relax % tabularx.dtx
783 }%
784 }
785
786 % This should work well for documentation of packages outside the
787 % LaTeX kernel, but if not, you can prevent the loading with the
788 % option "nocfg", i.e.,
789 %
790 % \documentclass[nocfg]{ltxdoc]
791 %
792 % or by providing your own config file
793
794 \endinput
795 %</cfg>
796 % \end{macrocode}
797 % \Finale
798 %