| 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 |
% \iffalse |
| 30 |
% |
| 31 |
%<class>\NeedsTeXFormat{LaTeX2e} |
| 32 |
%<class>\ProvidesClass{ltxdoc} |
| 33 |
%<class> [2024/02/08 v2.1j 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~page 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, loadthe 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 |
% \begin{macrocode} |
| 304 |
%\DeclareRobustCommand\cs[1]... % defined later |
| 305 |
%\def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} % can't use with new \cs |
| 306 |
\def\cmd#1{\texttt{\char`\\\expandafter\cmd@to@cs\string#1}} |
| 307 |
\def\cmd@to@cs#1#2{\char\number`#2\relax} |
| 308 |
% \end{macrocode} |
| 309 |
% \end{macro} |
| 310 |
% \end{macro} |
| 311 |
% |
| 312 |
% \changes{v2.0r}{1996/01/11}{Removed \cs{star} since useless pr/2039} |
| 313 |
% |
| 314 |
% \begin{macro}{\marg} |
| 315 |
% \changes{v2.0d}{1994/03/17}{Add \cs{marg}} |
| 316 |
% |\marg{text}| prints \marg{text}, `mandatory argument'. |
| 317 |
% \begin{macrocode} |
| 318 |
\providecommand\marg[1]{% |
| 319 |
{\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}} |
| 320 |
% \end{macrocode} |
| 321 |
% \end{macro} |
| 322 |
% |
| 323 |
% \begin{macro}{\oarg} |
| 324 |
% |\oarg{text}| prints \oarg{text}, `optional argument'. |
| 325 |
% \begin{macrocode} |
| 326 |
\providecommand\oarg[1]{% |
| 327 |
{\ttfamily[}\meta{#1}{\ttfamily]}} |
| 328 |
% \end{macrocode} |
| 329 |
% \end{macro} |
| 330 |
% |
| 331 |
% \begin{macro}{\parg} |
| 332 |
% |\parg{te,xt}| prints \parg{te,xt}, `picture mode argument'. |
| 333 |
% \changes{v2.0h}{1994/04/28}{Add \cs{parg}} |
| 334 |
% \changes{v2.0o}{1995/08/09}{Use \cs{meta} when showing arguments} |
| 335 |
% \begin{macrocode} |
| 336 |
\providecommand\parg[1]{% |
| 337 |
{\ttfamily(}\meta{#1}{\ttfamily)}} |
| 338 |
% \end{macrocode} |
| 339 |
% \end{macro} |
| 340 |
% |
| 341 |
% |
| 342 |
% \section{Old Comments} |
| 343 |
% |
| 344 |
% The \LaTeXe\ sources contain a lot of code inherited from |
| 345 |
% \LaTeX2.09. The comments in this code were not designed to be |
| 346 |
% typeset, and do not contain the necessary \LaTeX\ markup. The |
| 347 |
% \texttt{oldcomments} environment typesets these comments, |
| 348 |
% automatically sensing when any control sequence appears, and |
| 349 |
% implicitly adding the |\verb|. This procedure does not produce |
| 350 |
% particularly beautiful pages, but it allows us to fully document new |
| 351 |
% sections, and have some form of typeset comments on all the old |
| 352 |
% code. |
| 353 |
% \changes{v2.0e}{1994/03/18}{Use a fixed font.} |
| 354 |
% |
| 355 |
% Scan control names and put them in tt. |
| 356 |
% Will actually (incorrectly) scan past |\\| but this does not matter as |
| 357 |
% this is almost never followed by a letter in practice. |
| 358 |
% (ie |\\foo|) would put |foo| in |\ttfamily|. |
| 359 |
% \begin{macrocode} |
| 360 |
\def\oc@scan#1{% |
| 361 |
\ifx\oc@bslash#1% |
| 362 |
\egroup\let\next\oc@bslash\else |
| 363 |
\ifcat a\noexpand#1% |
| 364 |
#1\let\next\oc@scan\else |
| 365 |
\ifx\oc@percent#1% |
| 366 |
\def\next{\char`\%\egroup}% |
| 367 |
\else |
| 368 |
#1\let\next\egroup |
| 369 |
\fi\fi\fi\next} |
| 370 |
% \end{macrocode} |
| 371 |
% |
| 372 |
% \begin{macrocode} |
| 373 |
\def\oc@bslash{\bgroup\oc@ttf\char`\\\oc@scan}% |
| 374 |
% \end{macrocode} |
| 375 |
% |
| 376 |
% \begin{macrocode} |
| 377 |
\def\oc@verb#1{% |
| 378 |
\catcode`#1\active |
| 379 |
\uccode`\~`#1% |
| 380 |
\uppercase{\def~{{\oc@ttf\char`#1}}}} |
| 381 |
% \end{macrocode} |
| 382 |
% |
| 383 |
% \begin{macrocode} |
| 384 |
\begingroup |
| 385 |
\obeyspaces% |
| 386 |
\catcode`\/=\catcode`\\ |
| 387 |
/catcode`/\/active |
| 388 |
/catcode`<=/catcode`{% |
| 389 |
/catcode`>=/catcode`}% |
| 390 |
/catcode`/{/active% |
| 391 |
/catcode`/}/active% |
| 392 |
/gdef/oldc< \end{oldcomments}>% |
| 393 |
/gdef/begmac< \begin{macrocode}>% |
| 394 |
/gdef/obs</def <</oc@ttf/ >>>% |
| 395 |
/endgroup% |
| 396 |
% \end{macrocode} |
| 397 |
% |
| 398 |
% \changes{v2.0y}{2019/09/16}{Say that oldcomments may not be accurate (gh/180)} |
| 399 |
% \begin{macrocode} |
| 400 |
\begingroup |
| 401 |
\catcode`\/=\catcode`\\ |
| 402 |
\catcode`\\=13 |
| 403 |
/catcode`/|=/catcode`/% |
| 404 |
/catcode`/%=13 |
| 405 |
/gdef/oldcomments{| |
| 406 |
/makeatletter |
| 407 |
/let/do/oc@verb/dospecials |
| 408 |
/frenchspacing/@vobeyspaces/obs |
| 409 |
/raggedright |
| 410 |
/oc@verb/>| |
| 411 |
/oc@verb/<| |
| 412 |
/let\/oc@bslash |
| 413 |
/let%/oc@percent |
| 414 |
/obeylines |
| 415 |
/parindent/z@ |
| 416 |
/ttfamily/expandafter/let/expandafter/oc@ttf/the/font |
| 417 |
/rmfamily |
| 418 |
/textit{Historical /LaTeX/,2.09 comments (not necessarily accurate any more):} |
| 419 |
/hfuzz/maxdimen |
| 420 |
} |
| 421 |
/endgroup |
| 422 |
% \end{macrocode} |
| 423 |
% |
| 424 |
% \begin{macrocode} |
| 425 |
\begingroup |
| 426 |
\sloppy% |
| 427 |
\obeylines% |
| 428 |
\gdef\oc@percent#1^^M{% |
| 429 |
\ifvmode% |
| 430 |
\def\commentline{#1}% |
| 431 |
\ifx\commentline\oldc% |
| 432 |
\textit{End of historical \LaTeX\,2.09 comments.} |
| 433 |
\end{oldcomments}% |
| 434 |
\else% |
| 435 |
\ifx\commentline\begmac% |
| 436 |
\begin{macrocode}% |
| 437 |
\else% |
| 438 |
\leavevmode% |
| 439 |
#1^^M% |
| 440 |
\fi\fi% |
| 441 |
\else% |
| 442 |
{\oc@ttf\char`\%}#1^^M% |
| 443 |
\fi}% |
| 444 |
\endgroup% |
| 445 |
% \end{macrocode} |
| 446 |
% |
| 447 |
% |
| 448 |
% \section{DocInclude} |
| 449 |
% |
| 450 |
% \begin{macrocode} |
| 451 |
\@addtoreset{CodelineNo}{part} |
| 452 |
% \end{macrocode} |
| 453 |
% |
| 454 |
% \begin{macro}{\DocInclude} |
| 455 |
% More or less exactly the same as |\include|, but uses |\DocInput| |
| 456 |
% on a |dtx| file, not |\input| on a |tex| file. |
| 457 |
% \changes{v2.0b}{1994/03/14}{Rename from \cs{docinclude}} |
| 458 |
% \changes{v2.0f}{1994/03/25}{Use \cs{part}} |
| 459 |
% \changes{v2.0u}{1999/08/08}{Also works for .fdd (M. Schroeder)} |
| 460 |
% \begin{macrocode} |
| 461 |
\def\partname{File} |
| 462 |
% \end{macrocode} |
| 463 |
% |
| 464 |
% |
| 465 |
% |
| 466 |
% \changes{v2.0z}{2020/05/17}{Support spaces \emph{within} filenames |
| 467 |
% (gh/218)} |
| 468 |
% \begin{macrocode} |
| 469 |
\newcommand*{\DocInclude}[1]{% |
| 470 |
\relax |
| 471 |
\clearpage |
| 472 |
\docincludeaux |
| 473 |
\IfFileExists{#1.fdd}% |
| 474 |
{\def\currentfile{#1.fdd}}% |
| 475 |
{\def\currentfile{#1.dtx}}% |
| 476 |
\ifnum\@auxout=\@partaux |
| 477 |
\@latexerr{\string\include\space cannot be nested}\@eha |
| 478 |
\else |
| 479 |
\set@curr@file{#1}% |
| 480 |
\edef\@curr@file{\@strip@tex@ext\@curr@file}% |
| 481 |
\expandafter\@docinclude\expandafter{\@curr@file} |
| 482 |
\fi} |
| 483 |
\def\@docinclude#1 {\clearpage |
| 484 |
% \end{macrocode} |
| 485 |
% |
| 486 |
% \changes{v2.1bj}{2020/10/04}{Quotes around the aux file name removed, |
| 487 |
% they are no longer needed and upset BibTeX (gh/400)} |
| 488 |
% \begin{macrocode} |
| 489 |
\if@filesw \immediate\write\@mainaux{\string\@input{#1.aux}}\fi |
| 490 |
\@tempswatrue\if@partsw \@tempswafalse\edef\@tempb{#1}\@for |
| 491 |
\@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}\fi |
| 492 |
\if@tempswa \let\@auxout\@partaux \if@filesw |
| 493 |
\immediate\openout\@partaux "#1.aux" |
| 494 |
\immediate\write\@partaux{\relax}\fi |
| 495 |
\@filehook@set@CurrentFile |
| 496 |
% \end{macrocode} |
| 497 |
% We need to save (and later restore) various index-related |
| 498 |
% commands which might be changed by the included file. |
| 499 |
% \begin{macrocode} |
| 500 |
\let\@ltxdoc@PrintIndex\PrintIndex |
| 501 |
\let\PrintIndex\relax |
| 502 |
\let\@ltxdoc@PrintChanges\PrintChanges |
| 503 |
\let\PrintChanges\relax |
| 504 |
\let\@ltxdoc@theglossary\theglossary |
| 505 |
\let\@ltxdoc@endtheglossary\endtheglossary |
| 506 |
\part{\currentfile}% |
| 507 |
{\let\ttfamily\relax |
| 508 |
\xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}% |
| 509 |
\DocInput{\currentfile}% |
| 510 |
\let\PrintIndex\@ltxdoc@PrintIndex |
| 511 |
\let\PrintChanges\@ltxdoc@PrintChanges |
| 512 |
\let\theglossary\@ltxdoc@theglossary |
| 513 |
\let\endtheglossary\@ltxdoc@endtheglossary |
| 514 |
\clearpage |
| 515 |
\@writeckpt{#1}\if@filesw \immediate\closeout\@partaux \fi |
| 516 |
\else\@nameuse{cp@#1}\fi\let\@auxout\@mainaux} |
| 517 |
% \end{macrocode} |
| 518 |
% |
| 519 |
% \changes{v2.0x}{2018/03/15}{Set up \cs{protect} in index entries} |
| 520 |
% \begin{macrocode} |
| 521 |
\gdef\codeline@wrindex#1{\if@filesw |
| 522 |
% \end{macrocode} |
| 523 |
% Set \cs{protect} to a suitable value in the index entries (we |
| 524 |
% can't use |\set@display@protect| as that would result in different |
| 525 |
% number of spaces after a command depending on the number of |
| 526 |
% expansion happening prior to writing the index). |
| 527 |
% \begin{macrocode} |
| 528 |
\begingroup |
| 529 |
\let\protect\noexpand |
| 530 |
\immediate\write\@indexfile |
| 531 |
{\string\indexentry{#1}% |
| 532 |
{\filesep\number\c@CodelineNo}}% |
| 533 |
\endgroup\fi} |
| 534 |
% \end{macrocode} |
| 535 |
% \end{macro} |
| 536 |
% |
| 537 |
% \begin{macrocode} |
| 538 |
\let\filesep\@empty |
| 539 |
% \end{macrocode} |
| 540 |
% |
| 541 |
% |
| 542 |
% \begin{macro}{\aalph} |
| 543 |
% Special form of |\alph| as currently |source2e.tex| |
| 544 |
% includes more than 26 files |
| 545 |
% \changes{v2.0n}{1994/05/27}{Use uppercase letters, for makeindex}. |
| 546 |
% \begin{macrocode} |
| 547 |
\def\aalph#1{\@aalph{\csname c@#1\endcsname}} |
| 548 |
\def\@aalph#1{% |
| 549 |
\ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or |
| 550 |
j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or |
| 551 |
t\or u\or v\or w\or x\or y\or z\or A\or B\or C\or |
| 552 |
D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or |
| 553 |
N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or |
| 554 |
X\or Y\or Z\else\@ctrerr\fi} |
| 555 |
% \end{macrocode} |
| 556 |
% \end{macro} |
| 557 |
% |
| 558 |
% \begin{macro}{\docincludeaux} |
| 559 |
% \changes{v2.06}{1994/03/31}{Use \cs{footnotesize} in file key.} |
| 560 |
% \changes{v2.0k}{1994/05/21}{Use \cs{aalph}} |
| 561 |
% \changes{v2.0v}{2017/03/13}{Use \cs{parbox}[t] in file |
| 562 |
% key to maintain space between the text block and the page foot.} |
| 563 |
% \begin{macrocode} |
| 564 |
\def\docincludeaux{% |
| 565 |
\def\thepart{\aalph{part}}\def\filesep{\thepart-}% |
| 566 |
\let\filekey\@gobble |
| 567 |
\g@addto@macro\index@prologue{% |
| 568 |
\gdef\@oddfoot{\parbox[t]{\textwidth}{\strut\footnotesize |
| 569 |
\raggedright{\bfseries File Key:} \filekey}}% |
| 570 |
\let\@evenfoot\@oddfoot}% |
| 571 |
\global\let\docincludeaux\relax |
| 572 |
\gdef\@oddfoot{% |
| 573 |
\expandafter\ifx\csname ver@\currentfile\endcsname\relax |
| 574 |
File \thepart: {\ttfamily\currentfile} % |
| 575 |
\else |
| 576 |
\GetFileInfo{\currentfile}% |
| 577 |
File \thepart: {\ttfamily\filename} % |
| 578 |
Date: \filedate\ % |
| 579 |
Version \fileversion |
| 580 |
\fi |
| 581 |
\hfill\thepage}% |
| 582 |
\let\@evenfoot\@oddfoot}% |
| 583 |
% \end{macrocode} |
| 584 |
% \end{macro} |
| 585 |
% |
| 586 |
% \begin{macro}{\MaintainedByLaTeXTeam} |
| 587 |
% \changes{v2.0v}{2015/03/25}{macro added} |
| 588 |
% \changes{v2.0w}{2015/03/25}{use display block not footnote text} |
| 589 |
% Generate boilerplate reference to bug database. |
| 590 |
% \begin{macrocode} |
| 591 |
\def\MaintainedBy#1{\gdef\@maintainedby{#1}} |
| 592 |
% \end{macrocode} |
| 593 |
% |
| 594 |
% \begin{macrocode} |
| 595 |
\let\@maintainedby\@empty |
| 596 |
% \end{macrocode} |
| 597 |
% |
| 598 |
% \begin{macrocode} |
| 599 |
\def\MaintainedByLaTeXTeam#1{% |
| 600 |
{\gdef\@maintainedby{% |
| 601 |
This file is maintained by the \LaTeX{} Project team.\\% |
| 602 |
Bug reports can be opened (category \texttt{#1}) at\\% |
| 603 |
\url{https://latex-project.org/bugs.html}.}}} |
| 604 |
% \end{macrocode} |
| 605 |
% |
| 606 |
% \begin{macrocode} |
| 607 |
\def\@maketitle{% |
| 608 |
\newpage |
| 609 |
\null |
| 610 |
\vskip 2em% |
| 611 |
\begin{center}% |
| 612 |
\let \footnote \thanks |
| 613 |
{\LARGE \@title \par}% |
| 614 |
\vskip 1.5em% |
| 615 |
{\large |
| 616 |
\lineskip .5em% |
| 617 |
\begin{tabular}[t]{c}% |
| 618 |
\@author |
| 619 |
\end{tabular}\par}% |
| 620 |
\vskip 1em% |
| 621 |
{\large \@date}% |
| 622 |
\ifx\@maintainedby\@empty |
| 623 |
\else |
| 624 |
\vskip 1em% |
| 625 |
\fbox{\fbox{\begin{tabular}{@{}l@{}}\@maintainedby\end{tabular}}}% |
| 626 |
\fi |
| 627 |
\end{center}% |
| 628 |
\par |
| 629 |
\vskip 1.5em} |
| 630 |
% \end{macrocode} |
| 631 |
% \end{macro} |
| 632 |
% |
| 633 |
% |
| 634 |
% \begin{macrocode} |
| 635 |
\def\task#1#2{} |
| 636 |
% \end{macrocode} |
| 637 |
% |
| 638 |
% |
| 639 |
% \changes{v2.1f}{2022/06/03}{define \cs{pkg} and other commands} |
| 640 |
% \changes{v2.1f}{2022/06/03}{allow \_ in macro names} |
| 641 |
% Some features from l3doc.cls |
| 642 |
% \changes{v2.1g}{2022/06/14}{define \cs{pkg} but delay until begin document} |
| 643 |
% \changes{v2.1i}{2022/11/28}{Revert 2.1f and not use \cs{detokenize} for now (gh/962)} |
| 644 |
% Eventually, \cs{cs} should get the definition from \pkg{l3doc} but for now we |
| 645 |
% revert to the simple one from \pkg{doc}. |
| 646 |
% \begin{macrocode} |
| 647 |
%\DeclareRobustCommand\cs[1]{\texttt{\bslash #1}}% -- def in doc.sty |
| 648 |
\AtBeginDocument{% |
| 649 |
% \renewcommand\PrintMacroName[1]{\MacroFont\string #1\ }% -- def in doc.sty |
| 650 |
% \end{macrocode} |
| 651 |
% We provide those delated in case somebody has loaded \texttt{csquotes} |
| 652 |
% or makes some definitions in the preamble. |
| 653 |
% \begin{macrocode} |
| 654 |
\providecommand\LuaTeX{Lua\TeX} |
| 655 |
\providecommand\cls{\textsf} |
| 656 |
\providecommand\pkg{\textsf} |
| 657 |
\providecommand\enquote[1]{``#1''} |
| 658 |
\providecommand\url{\texttt} |
| 659 |
} |
| 660 |
% \end{macrocode} |
| 661 |
% |
| 662 |
% \begin{macrocode} |
| 663 |
%</class> |
| 664 |
% \end{macrocode} |
| 665 |
% |
| 666 |
% |
| 667 |
% |
| 668 |
% \section{Configuration file} |
| 669 |
% |
| 670 |
% |
| 671 |
% \begin{macrocode} |
| 672 |
%<*cfg> |
| 673 |
% |
| 674 |
% This is the ltxdoc configuration file we use to format the LaTeX |
| 675 |
% kernel sources. |
| 676 |
% |
| 677 |
% |
| 678 |
% Copyright 2006, 2007, 2011 |
| 679 |
% Heiko Oberdiek |
| 680 |
% Copyright (C) 2014-2025 |
| 681 |
% The LaTeX Project |
| 682 |
% |
| 683 |
|
| 684 |
\ProvidesFile{ltxdoc.cfg}% |
| 685 |
[2022/06/14 v2.0d ltxdoc.cls configuration (LaTeX Project)] |
| 686 |
\PassOptionsToClass{a4paper}{article} |
| 687 |
|
| 688 |
% hyperref and hypdoc are now loaded late (or by the user) so we have to wait |
| 689 |
% with any adjustments until that has happened |
| 690 |
|
| 691 |
\AddToHook{package/hyperref/after}{% |
| 692 |
%% \RequirePackage{hypdoc}% % this is now triggered by doc |
| 693 |
\RequirePackage{pdftexcmds}\relax |
| 694 |
\ifnum\pdf@strcmp{\jobname}{inputenc}=0 % |
| 695 |
\hypersetup{pdfencoding=auto}% |
| 696 |
\pdfstringdefDisableCommands{% |
| 697 |
\def\meta#1{% inputenc.dtx |
| 698 |
\9060\010#1\9060\011% |
| 699 |
}% |
| 700 |
}% |
| 701 |
\else |
| 702 |
\fi |
| 703 |
\pdfstringdefDisableCommands{% |
| 704 |
\let\env\relax % longtable.dtx |
| 705 |
\let\mytt\relax % tabularx.dtx |
| 706 |
}% |
| 707 |
} |
| 708 |
|
| 709 |
% This should work well for documentation of packages outside the |
| 710 |
% LaTeX kernel, but if not, you can prevent the loading with the |
| 711 |
% option "nocfg", i.e., |
| 712 |
% |
| 713 |
% \documentclass[nocfg]{ltxdoc] |
| 714 |
% |
| 715 |
% or by providing your own config file |
| 716 |
|
| 717 |
\endinput |
| 718 |
%</cfg> |
| 719 |
% \end{macrocode} |
| 720 |
% \Finale |
| 721 |
% |