% \iffalse meta-comment % % Copyright 1994 the LaTeX3 project and the individual authors. % All rights reserved. For further copyright information see the file % legal.txt, and any other copyright indicated in this file. % % This file is part of the LaTeX2e system. % ---------------------------------------- % % This system is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. % % % IMPORTANT NOTICE: % % For error reports in case of UNCHANGED versions see bugs.txt. % % Please do not request updates from us directly. Distribution is % done through Mail-Servers and TeX organizations. % % You are not allowed to change this file. % % You are allowed to distribute this file under the condition that % it is distributed together with all files mentioned in manifest.txt. % % If you receive only some of these files from someone, complain! % % You are NOT ALLOWED to distribute this file alone. You are NOT % ALLOWED to take money for the distribution or use of either this % file or a changed version, except for a nominal charge for copying % etc. % \fi % % \iffalse % %\NeedsTeXFormat{LaTeX2e} %\ProvidesClass{ltxdoc} % [1994/05/27 v2.0n Standard LaTeX documentation class] % %<*driver> \documentclass{ltxdoc} \GetFileInfo{ltxdoc.cls} \providecommand\dst{\expandafter{\normalfont\scshape docstrip}} \title{The file \texttt{ltxdoc.dtx} for use with \LaTeXe.\thanks{This file has version number \fileversion, dated \filedate.}\\[2pt] It contains the code for \texttt{ltxdoc.cls}} \date{\filedate} \author{David Carlisle} \begin{document} \maketitle \DocInput{ltxdoc.dtx} \end{document} % % % \fi % % \CheckSum{376} % % \changes{v2.0i}{1994/04/29}{Update the documentation.} % % \section{Documentation of the \LaTeX\ sources} % % This class file is designed for documenting the \LaTeX\ source files. % You may however find it generally useful as a class for typesetting % the documentation of files produced in `doc' format. % % Each documented file in the standard distribution comes with extension % |dtx|. The appropriate class package or initex file will be extracted % from the source by the docstrip system. Each |dtx| file may be % directly processed with \LaTeXe, for example %\begin{verbatim} % latex2e docclass.dtx %\end{verbatim} % would produce the documentation of the Class and package interface. % % Each file that is used in producing the \LaTeXe\ format (ie not % including the standard class and packages) will be printed together in % one document if you \LaTeX\ the file |sources2e.tex|. This has the % advantage that one can produce a full index of macro usage across all % the source files. % % If you need to customise the typesetting of any of these files, there % are two options: % \begin{itemize} % \item You can use \dst\ with the module `driver' to extract a small % \LaTeX\ file that you may edit to use whatever class or package % options you require, before inputting the source file. % \item You can create a file |ltxdoc.cfg|. This configuration file will % be read whenever the |ltxdoc| class is used, and so can be used to % customise the typesetting of all the source files, without having to % edit lots of small driver files. %\end{itemize} % % The second option is usually more convenient. various possibilities % are discussed in the next section. % % \section{Customisation} % % The simplest form of customisation is to pass more options to the % |article| class which is loaded by |ltxdoc|. For instance if you wish % all the documentation to be formated for A4 paper, add the following % line to |ltxdoc.cfg|: %\begin{verbatim} % \PassOptionsToClass{a4paper}{article} %\end{verbatim} % % All the source files are in two parts, separated by |\StopEventually|. % The first part (should) contain `user' documentation. The second part % is a full documented listing of the source code. The |doc| package % provides the command |\OnlyDescription| which suppresses the code % listings. This may also be used in the configuration file, but as the % |doc| package is read later, you must delay the execution of % |\OnlyDescription| until after the |doc| package has been read. The % simplest way is to use |\AtBeginDocument|. Thus you could put the % following in your |ltxdoc.cfg|. %\begin{verbatim} % \AtBeginDocument{\OnlyDescription} %\end{verbatim} % % % If the full source listing |sources2e.tex| is processed, then an index % and change history are produced by default, however indices are not % normally produced for individual files. % % As an example, consider |ltclass.dtx|, which contains the sources for % the new class and package interface commands. With no |cfg| % file, a 19~page document is produced. With the above configuration % a slightly more readable document (4~pages) is produced. % % Conversely, If you really want to read the source listings in detail, % You will want to have an index. Again the index commands provided by % the doc package may be used, but their execution must be delayed. %\begin{verbatim} % \AtBeginDocument{\CodelineIndex\EnableCrossrefs} % \AtEndDocument{\PrintIndex} %\end{verbatim} % % The |doc| package writes index files to be sorted using MakeIndex with % the |gind| style, so one would then use a command such as %\begin{verbatim} % makeindex -s gind.ist ltclass.idx %\end{verbatim} % and re-run \LaTeX. % % Similarly to print a Change history, you would add %\begin{verbatim} % \AtBeginDocument{\RecordChanges} % \AtEndDocument{\PrintChanges} %\end{verbatim} % to |ltxdoc.cfg|, and use MakeIndex with a comand such as %\begin{verbatim} % makeindex -s gglo.ist -o ltclass.gls ltclass.glo %\end{verbatim} % % Finally if you do not want to list all the sections of |source2e.tex|, % you can use |\includeonly| in the |cfg| file: %\begin{verbatim} % \includeonly{ltvers,ltboxes} %\end{verbatim} % % \StopEventually % % % \section{Options} % % \begin{macrocode} %<*class> \DeclareOption{a5paper}{\@latexerr{Option not supported}% {}} % \end{macrocode} % % \begin{macrocode} \DeclareOption*{% \PassOptionsToClass {\CurrentOption}{article}} % \end{macrocode} % % \section{Configuration} % Input a local configuration file, if it exists. % \begin{macrocode} \InputIfFileExists{ltxdoc.cfg} {\typeout{*************************************^^J% * Local config file ltxdoc.cfg used^^J% *************************************}} {} % \end{macrocode} % % % \section{Option Processing} % % \begin{macrocode} \ProcessOptions % \end{macrocode} % % \section{Loading article and doc} % % \begin{macrocode} \LoadClass{article} % \end{macrocode} % % \begin{macrocode} \RequirePackage{doc} % \end{macrocode} % % Make \verb+|+ be a `short verb' character, but not in the document % preamble, where an active character may interfere with packages that % are loaded. % \begin{macrocode} \AtBeginDocument{\MakeShortVerb{\|}} % \end{macrocode} % % \begin{macrocode} \CodelineNumbered \DisableCrossrefs % \end{macrocode} % % Increase the text width slightly so that width the standard fonts % 72 columns of code may appear in a |macrocode| environment. % \changes{v2.0c}{1994/03/15}{Set \cmd{\textwidth}} % \begin{macrocode} \setlength{\textwidth}{355pt} % \end{macrocode} % % Increase the marginpar width slightly, for long command names. % \changes{v2.0l}{1994/05/25}{Increase \cmd{\marginparwidth}} % \begin{macrocode} \addtolength\marginparwidth{5pt} % \end{macrocode} % % Silently substitute normal tt for bold. % \changes{v2.0m}{1994/05/26}{Add font substition} % \begin{macrocode} \DeclareFontShape{OT1}{cmtt}{bx}{n} {<->ssub * cmtt/m/n}{} % \end{macrocode} % % \begin{macrocode} \setcounter{StandardModuleDepth}{1} % \end{macrocode} % % \section{Useful abbreviations} % % |\cmd{\foo}| Prints |\foo| verbatim. It may be used inside moving % arguments. |\cs{foo}| also prints |\foo|, for those who prefer that % syntax. (This second form may even be used when |\foo| is |\outer|). % \begin{macro}{\cmd} % \changes{v2.0k}{1994/05/21}{New definition, so \cmd\{ works.} % \begin{macro}{\cs} % \changes{v2.0d}{1994/03/17}{Add \cs{cs}} % \begin{macrocode} \def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}} \def\cmd@to@cs#1#2{\char\number`#2\relax} \DeclareRobustCommand\cs[1]{\texttt{\char`\\#1}} % \end{macrocode} % \end{macro} % \end{macro} % % |\star| prints |*| for use in documenting star-forms of commands. % |\marg{text}| prints \marg{text}, `mandatory argument'. % |\oarg{text}| prints \oarg{text}, `optional argument'. % |\parg{te,xt}| prints \parg{te,xt}, `picture mode argument'. % \changes{v2.0d}{1994/03/17}{Add \cs{marg}} % \changes{v2.0h}{1994/04/28}{Add \cs{parg}} % \begin{macrocode} \providecommand\star{% \ttfamily*} \providecommand\marg[1]{% {\ttfamily\char`\{}{\em#1\/}{\ttfamily\char`\}}} \providecommand\oarg[1]{% {\ttfamily[}{\em#1\/}{\ttfamily]}} \providecommand\parg[1]{% {\ttfamily(}{\em#1\/}{\ttfamily)}} % \end{macrocode} % % \section{Old Comments} % % The \LaTeXe\ sources contain a lot of code inherited from % \LaTeX2.09. The comments in this code were not designed to be % typeset, and do not contain the necessary \LaTeX\ markup. The % \texttt{oldcomments} environment typesets these comments, % automatically sensing when any control sequence appears, and % implicitly adding the |\verb|. This procedure does not produce % particularly beautiful pages, but it allows us to fully document new % sections, and have some form of typeset comments on all the old % code. % \changes{v2.0e}{1994/03/18}{Use a fixed font.} % % Scan control names and put them in tt. % will actually (incorrectly) scan past |\\| but this does not matter as % this is almost never followed by a letter in practice. % (ie |\\foo|) would put |foo| in |\ttfamily|. % \begin{macrocode} \def\oc@scan#1{% \ifx\oc@bslash#1% \egroup\let\next\oc@bslash\else \ifcat a\noexpand#1% #1\let\next\oc@scan\else \ifx\oc@percent#1% \def\next{\char`\%\egroup}% \else #1\let\next\egroup \fi\fi\fi\next} % \end{macrocode} % % \begin{macrocode} \def\oc@bslash{\bgroup\oc@ttf\char`\\\oc@scan}% % \end{macrocode} % % \begin{macrocode} \def\oc@verb#1{% \catcode`#1\active \uccode`\~`#1% \uppercase{\def~{{\oc@ttf\char`#1}}}} % \end{macrocode} % % \begin{macrocode} \begingroup \obeyspaces% \catcode`\/=\catcode`\\ /catcode`/\/active /catcode`<=/catcode`{% /catcode`>=/catcode`}% /catcode`/{/active% /catcode`/}/active% /gdef/oldc< \end{oldcomments}>% /gdef/begmac< \begin{macrocode}>% /gdef/obs>>% /endgroup% % \end{macrocode} % % \begin{macrocode} \begingroup \catcode`\/=\catcode`\\ \catcode`\\=13 /catcode`/|=/catcode`/% /catcode`/%=13 /gdef/oldcomments{| /makeatletter /let/do/oc@verb/dospecials /frenchspacing/@vobeyspaces/obs /raggedright /oc@verb/>| /oc@verb/<| /let\/oc@bslash /let%/oc@percent /obeylines /parindent/z@ /ttfamily/expandafter/let/expandafter/oc@ttf/the/font /rmfamily /hfuzz/maxdimen } /endgroup % \end{macrocode} % % \begin{macrocode} \begingroup \sloppy% \obeylines% \gdef\oc@percent#1^^M{% \ifvmode% \def\commentline{#1}% \ifx\commentline\oldc% \end{oldcomments}% \else% \ifx\commentline\begmac% \begin{macrocode}% \else% \leavevmode% #1^^M% \fi\fi% \else% {\oc@ttf\char`\%}#1^^M% \fi}% \endgroup% % \end{macrocode} % % % \section{DocInclude} % % \begin{macrocode} \@addtoreset{CodelineNo}{part} % \end{macrocode} % % \begin{macro}{\DocInclude} % More or less exactly the same as |\include|, but uses |\DocInput| % on a |dtx| file, not |\input| on a |tex| file. % \changes{v2.0b}{1994/03/14}{Rename from \cmd{\docinclude}} % \changes{v2.0f}{1994/03/25}{Use \cmd{\part}} % \begin{macrocode} \def\partname{File} % \end{macrocode} % % \begin{macrocode} \def\DocInclude#1{% \relax \clearpage \docincludeaux \def\currentfile{#1.dtx}% \ifnum\@auxout=\@partaux \@latexerr{\string\include\space cannot be nested}\@eha \else \@docinclude#1 \fi} \def\@docinclude#1 {\clearpage \if@filesw \immediate\write\@mainaux{\string\@input{#1.aux}}\fi \@tempswatrue\if@partsw \@tempswafalse\edef\@tempb{#1}\@for \@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}\fi \if@tempswa \let\@auxout\@partaux \if@filesw \immediate\openout\@partaux #1.aux \immediate\write\@partaux{\relax}\fi \part{#1.dtx}% {\let\ttfamily\relax \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}% \DocInput{#1.dtx}% \clearpage \@writeckpt{#1}\if@filesw \immediate\closeout\@partaux \fi \else\@nameuse{cp@#1}\fi\let\@auxout\@mainaux} % \end{macrocode} % % \begin{macrocode} \gdef\codeline@wrindex#1{\if@filesw \immediate\write\@indexfile {\string\indexentry{#1}% {\filesep\number\c@CodelineNo}}\fi}% % \end{macrocode} % \end{macro} % % \begin{macrocode} \let\filesep\@empty % \end{macrocode} % % % \begin{macro}{\aalph} % Special form of |\alph| as currently |source2e.tex| % includes more than 26 files % \changes{v2.0n}{1994/05/27}{Use uppercase letters, for makeindex}. % \begin{macrocode} \def\aalph#1{\@aalph{\csname c@#1\endcsname}} \def\@aalph#1{% \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else\@ctrerr\fi} % \end{macrocode} % \end{macro} % % \begin{macro}{\docincludeaux} % \changes{v2.06}{1994/03/31}{Use \cmd{\footnotesize} in file key.} % \changes{v2.0k}{1994/05/21}{Use \cmd{\aalph}} % \begin{macrocode} \def\docincludeaux{% \def\thepart{\aalph{part}}\def\filesep{\thepart-}% \let\filekey\@gobble \g@addto@macro\index@prologue{% \gdef\@oddfoot{\parbox{\textwidth}{\strut\footnotesize \raggedright{\bfseries File Key:} \filekey}}% \let\@evenfoot\@oddfoot}% \global\let\docincludeaux\relax \gdef\@oddfoot{% \expandafter\ifx\csname ver@\currentfile\endcsname\relax File \thepart: {\ttfamily\currentfile} % \else \GetFileInfo{\currentfile}% File \thepart: {\ttfamily\filename} % Date: \filedate\ % Version \fileversion \fi \hfill\thepage}% \let\@evenfoot\@oddfoot}% % \end{macrocode} % \end{macro} % % % \begin{macrocode} \def\task#1#2{} % % \end{macrocode} % \Finale %