| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% docmfp.dtx |
| 4 |
% Author: Peter Wilson (Herries Press) |
| 5 |
% Maintainer: Will Robertson (will dot robertson at latex-project dot org) |
| 6 |
% Copyright 1999--2005 Peter R. Wilson |
| 7 |
% |
| 8 |
% This work may be distributed and/or modified under the |
| 9 |
% conditions of the LaTeX Project Public License, either |
| 10 |
% version 1.3c of this license or (at your option) any |
| 11 |
% later version: <http://www.latex-project.org/lppl.txt> |
| 12 |
% |
| 13 |
% This work has the LPPL maintenance status "maintained". |
| 14 |
% The Current Maintainer of this work is Will Robertson. |
| 15 |
% |
| 16 |
% This work consists of the files listed in the README file. |
| 17 |
% |
| 18 |
% |
| 19 |
% |
| 20 |
%<*driver> |
| 21 |
\documentclass[twoside]{ltxdoc} |
| 22 |
%% %% %%\usepackage{docmfp} |
| 23 |
\usepackage{url} |
| 24 |
\usepackage[draft=false, |
| 25 |
plainpages=false, |
| 26 |
pdfpagelabels, |
| 27 |
bookmarksnumbered, |
| 28 |
hyperindex=false |
| 29 |
]{hyperref} |
| 30 |
\makeatletter |
| 31 |
\@mparswitchfalse |
| 32 |
\makeatother |
| 33 |
\renewcommand{\MakeUppercase}[1]{#1} |
| 34 |
\pagestyle{headings} |
| 35 |
\EnableCrossrefs |
| 36 |
\CodelineIndex |
| 37 |
%%% \OnlyDescription |
| 38 |
\setcounter{StandardModuleDepth}{1} |
| 39 |
\begin{document} |
| 40 |
\DocInput{docmfp.dtx} |
| 41 |
\end{document} |
| 42 |
%</driver> |
| 43 |
% |
| 44 |
% \fi |
| 45 |
% |
| 46 |
% \CheckSum{322} |
| 47 |
% |
| 48 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 49 |
% \DoNotIndex{\@centercr,\@cite} |
| 50 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 51 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 52 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 53 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 54 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 55 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 56 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 57 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 58 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 59 |
% \DoNotIndex{\bullet} |
| 60 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 61 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 62 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 63 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 64 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 65 |
% \DoNotIndex{\fbox} |
| 66 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 67 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 68 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 69 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 70 |
% \DoNotIndex{\input} |
| 71 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 72 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 73 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 74 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 75 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 76 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 77 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 78 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 79 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 80 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 81 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 82 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 83 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 84 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 85 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 86 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 87 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 88 |
% |
| 89 |
% \changes{v1.0}{1999/04/11}{First public release} |
| 90 |
% \changes{v1.1}{2000/10/28}{Added general marking commands} |
| 91 |
% \changes{v1.2}{2001/02/11}{Revised the doc check sum code} |
| 92 |
% \changes{v1.2a}{2004/04/22}{Changed license from LPPL v1.0 to v1.3} |
| 93 |
% \changes{v1.2b}{2004/05/14}{Minor fix for checksum} |
| 94 |
% \changes{v1.2c}{2005/03/26}{Fixed some typos in the description part, no code changes} |
| 95 |
% \changes{v1.2d}{2009/09/02}{New maintainer (Will Robertson)} |
| 96 |
% |
| 97 |
% \def\dtxfile{docmfp.dtx} |
| 98 |
% \def\fileversion{v1.0} \def\filedate{1999/04/11} |
| 99 |
% \def\fileversion{v1.1} \def\filedate{2000/10/28} |
| 100 |
% \def\fileversion{v1.2} \def\filedate{2001/02/11} |
| 101 |
% \def\fileversion{v1.2a} \def\filedate{2004/04/22} |
| 102 |
% \def\fileversion{v1.2b} \def\filedate{2004/05/14} |
| 103 |
% \def\fileversion{v1.2c} \def\filedate{2005/03/26} |
| 104 |
% \def\fileversion{v1.2d} \def\filedate{2009/09/02} |
| 105 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 106 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 107 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 108 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 109 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 110 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 111 |
% \newcommand*{\Mfp}{Metafont/post} |
| 112 |
% |
| 113 |
% \title{The \Lpack{docmfp} package\thanks{This |
| 114 |
% file (\texttt{\dtxfile}) has version number \fileversion, last revised |
| 115 |
% \filedate.}} |
| 116 |
% |
| 117 |
% \author{% |
| 118 |
% Author: Peter Wilson, Herries Press\\ |
| 119 |
% Maintainer: Will Robertson\\ |
| 120 |
% \texttt{will dot robertson at latex-project dot org} |
| 121 |
% } |
| 122 |
% \date{\filedate} |
| 123 |
% \maketitle |
| 124 |
% \begin{abstract} |
| 125 |
% The \Lpack{docmfp} package extends the \Lpack{doc} package to cater for |
| 126 |
% documentation of non-\LaTeX{} code, such as Metafont and Metapost code, |
| 127 |
% or C or Java code. |
| 128 |
% \end{abstract} |
| 129 |
% \tableofcontents |
| 130 |
% |
| 131 |
% |
| 132 |
% \section{Introduction} |
| 133 |
% |
| 134 |
% It is common practice to document \LaTeX{} packages using the |
| 135 |
% \Lpack{doc} system~\cite{GOOSSENS94}. |
| 136 |
% The \Lpack{docmfp} package extends the \Lpack{doc} |
| 137 |
% package so that similar facilities are provided for the documentation |
| 138 |
% of non-LaTeX{} code, such as Metafont and Metapost code, or code in |
| 139 |
% other more common programming languages. |
| 140 |
% For example, a single \file{.dtx} file |
| 141 |
% can contain the documented sources of both the Metafont code for a new |
| 142 |
% font, together with the documented \LaTeX{} code for the accompanying |
| 143 |
% package. |
| 144 |
% |
| 145 |
% This manual is typeset according to the conventions of the |
| 146 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 147 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 148 |
% |
| 149 |
% Section~\ref{sec:usc} describes the usage of the package. |
| 150 |
% Commented source code for the package is in Section~\ref{sec:code}. |
| 151 |
% |
| 152 |
% \section{The package} \label{sec:usc} |
| 153 |
% |
| 154 |
% I have assumed that if you are reading this then you are familiar with |
| 155 |
% the facilities provided by the \Lpack{doc} package. |
| 156 |
% |
| 157 |
% \DescribeMacro{\DescribeRoutine} |
| 158 |
% The |\DescribeRoutine{|\meta{name}|}| command is equivalent to the \Lpack{doc} |
| 159 |
% package |\DescribeEnv{|\meta{name}|}| command, except that it |
| 160 |
% is intended to introduce the description of a \Mfp{} macro (or |
| 161 |
% character or picture ). It typesets \meta{name} |
| 162 |
% in the margin and also generates an index entry for \meta{name}. |
| 163 |
% |
| 164 |
% \DescribeEnv{routine} |
| 165 |
% The |routine| environment is equivalent to the \Lpack{doc} package |
| 166 |
% |macro| environment. It takes one argument, which is the name of the |
| 167 |
% \Mfp{} macro (or character or picture) that is being defined. |
| 168 |
% It typesets the argument in the margin and makes an index entry for it. |
| 169 |
% |
| 170 |
% \DescribeMacro{\routinestring} |
| 171 |
% \DescribeMacro{\routineheadname} |
| 172 |
% These two commands contain the texts that are used in indexing |
| 173 |
% routine names. They can be changed via |\renewcommand|. Their default |
| 174 |
% definitions are: |
| 175 |
% \begin{verbatim} |
| 176 |
% \newcommand{\routinestring}{\space(routine)} |
| 177 |
% \newcommand{\routineheadname}{routines:} |
| 178 |
% \end{verbatim} |
| 179 |
% |
| 180 |
% \DescribeMacro{\DescribeVariable} |
| 181 |
% The |\DescribeVariable{|\meta{name}|}| is like the \Lpack{doc} |
| 182 |
% |\DescribeMacro{|\meta{name}|}| command, except that it is intended |
| 183 |
% to introduce the description, and definition, of a variable |
| 184 |
% or parameter. It typesets \meta{name} in the margin and makes an index entry |
| 185 |
% for it. |
| 186 |
% |
| 187 |
% \DescribeEnv{variable} |
| 188 |
% The |variable| environment is equivalent to the \Lpack{doc} package |
| 189 |
% |macro| environment. It takes one argument, which is the name of the |
| 190 |
% variable or parameter that is being defined. |
| 191 |
% It typesets the argument in the margin and makes an index entry for it. |
| 192 |
% |
| 193 |
% \DescribeMacro{\variablestring} |
| 194 |
% \DescribeMacro{\variableheadname} |
| 195 |
% These two commands contain the texts that are used in indexing |
| 196 |
% variable names. They can be changed via |\renewcommand|. Their default |
| 197 |
% definitions are: |
| 198 |
% \begin{verbatim} |
| 199 |
% \newcommand{\variablestring}{\space(variable)} |
| 200 |
% \newcommand{\variableheadname}{variables:} |
| 201 |
% \end{verbatim} |
| 202 |
% |
| 203 |
% A routine or variable \meta{name} can include the underscore and |
| 204 |
% hash characters (i.e., |_| and |#|), so that names like |a_variable#| can |
| 205 |
% be used. |
| 206 |
% |
| 207 |
% \DescribeMacro{\Describe} |
| 208 |
% This is a generalization of the |\Describe...| commands. |
| 209 |
% |
| 210 |
% |\Describe{|\meta{head}|}{|\meta{flag}|}{|\meta{name}|}| typesets |
| 211 |
% \meta{name} in the margin and makes index entries for it. One |
| 212 |
% entry will be a main entry as |name flag|, and the other will |
| 213 |
% be a subsidiary entry of |name| under the main heading |head|. |
| 214 |
% |
| 215 |
% Essentially, |\DescribeVariable{name}| is equivalent to: \\ |
| 216 |
% |\Describe{\variableheadname}{\variablestring}{name}| |
| 217 |
% |
| 218 |
% \DescribeEnv{Code} |
| 219 |
% This is a generalization of the |variable| and |routine| environments. |
| 220 |
% |
| 221 |
% |\begin{Code}{|\meta{head}|}{|\meta{flag}|}{|\meta{name}|}| typesets |
| 222 |
% \meta{name} in the margin and makes index entries for it. One |
| 223 |
% entry will be a main entry as |name flag|, and the other will |
| 224 |
% be a subsidiary entry of |name| under the main heading |head|. |
| 225 |
% |
| 226 |
% Essentially, |\begin{routine}{name}| is equivalent to: \\ |
| 227 |
% |\begin{Code}{\routineheadname}{\routinestring}{name}| |
| 228 |
% |
| 229 |
% For example, if you are documenting Java code, then you may wish |
| 230 |
% to use commands like: \\ |
| 231 |
% |\newcommand{\cvar}{class variables}| \\ |
| 232 |
% |\newcommand{\fcvar}{ (variable)}| \\ |
| 233 |
% |\newcommand{\ofield}{object fields}| \\ |
| 234 |
% |\newcommand{\ffield}{ (field)}| \\ |
| 235 |
% |\newcommand{\cmeth}{class methods}| \\ |
| 236 |
% |\newcommand{\ometh}{object methods}| \\ |
| 237 |
% |\newcommand{\meth}{ (method)}| \\ |
| 238 |
% |\Describe{\cvar}{\fcvar}{...}| for class variables \\ |
| 239 |
% |\Describe{\ofield}{\ffield}{...}| for object fields \\ |
| 240 |
% |\begin{Code}{\cmeth}{\meth}{...}| for class methods \\ |
| 241 |
% |\begin{Code}{\ometh}{\meth}{...}| for object methods. \\ |
| 242 |
% |
| 243 |
% |
| 244 |
% |
| 245 |
% \subsection{Usage with \file{.dtx} and \file{.ins} files} |
| 246 |
% |
| 247 |
% I assume that the major use of the \Lpack{docmfp} package will be in |
| 248 |
% \file{.dtx} file(s) that will be processed via a corresponding \file{.ins} file. |
| 249 |
% The \Lpack{ltxdoc} class also automatically calls the \Lpack{doc} package. |
| 250 |
% |
| 251 |
% As an example, if the \Lpack{docmfp} package was needed for the document |
| 252 |
% you are now reading, then I would have started it off like this (but look at |
| 253 |
% the start of the source for details that I ignore here): |
| 254 |
% \begin{verbatim} |
| 255 |
% %<*driver> |
| 256 |
% \documentclass{ltxdoc} |
| 257 |
% \usepackage{docmfp} |
| 258 |
% \EnableCrossrefs |
| 259 |
% \CodelineIndex |
| 260 |
% \setcounter{StandardModuleDepth}{1} |
| 261 |
% \begin{document} |
| 262 |
% \DocInput{docmfp.dtx} |
| 263 |
% \end{document} |
| 264 |
% %</driver> |
| 265 |
% \end{verbatim} |
| 266 |
% |
| 267 |
% The source of this document also includes several calls of the |
| 268 |
% \Lpack{docmfp} commands, which I have commented out (use your editor |
| 269 |
% to look for the occurences of the string |^^A| after this point). You can |
| 270 |
% edit the source to include the |\usepackage{docmfp}| command and uncomment |
| 271 |
% the \Lpack{docmfp} commands if you want to sample the package in use. |
| 272 |
% |
| 273 |
% ^^A \DescribeVariable{a_variable#} |
| 274 |
% ^^A \DescribeRoutine{an_mfp_macro} |
| 275 |
% ^^A \DescribeVariable{aN_variable#l9e[24]} |
| 276 |
% ^^A \DescribeRoutine{another_macro} |
| 277 |
% |
| 278 |
% |
| 279 |
% The source of an \file{.ins} file might look like this: |
| 280 |
% \begin{verbatim} |
| 281 |
% %% file myfile.ins |
| 282 |
% \def\batchfile{myfile.ins} |
| 283 |
% \input docstrip.tex |
| 284 |
% \preamble |
| 285 |
% Copyright and other notices |
| 286 |
% \endpreamble |
| 287 |
% \generate{\file{myfile.drv}{\from{myfile.dtx}{driver}}} |
| 288 |
% \generate{\file{mypackage.sty}{\from{myfile.dtx}{pack}}} |
| 289 |
% |
| 290 |
% \endinput |
| 291 |
% \end{verbatim} |
| 292 |
% By default, the documentation system will put an |\endinput| command |
| 293 |
% at the end of each file it generates (\file{myfile.drv} and \file{mypackage.sty} |
| 294 |
% in the example above). This is fine provided the generated files are to be |
| 295 |
% processed by \LaTeX{} which understands |\endinput|. If a generated file is |
| 296 |
% to be processed by something that treats |\endinput| as an error, as \Mfp{} |
| 297 |
% will, then there is a problem. |
| 298 |
% |
| 299 |
% \DescribeMacro{\usepostamble} |
| 300 |
% \DescribeMacro{\empty} |
| 301 |
% \DescribeMacro{\defaultpostamble} |
| 302 |
% The documentation system provides these three commands which can be used |
| 303 |
% within an \file{.ins} file to |
| 304 |
% either prevent or enable the addition of |\endinput| to the generated files. |
| 305 |
% Extending the above example \file{.ins} file to include both Metafont and |
| 306 |
% and \LaTeX{} files we can have: |
| 307 |
% \begin{verbatim} |
| 308 |
% %% file myfile.ins |
| 309 |
% \def\batchfile{myfile.ins} |
| 310 |
% \input docstrip.tex |
| 311 |
% \preamble |
| 312 |
% Copyright and other notices |
| 313 |
% \endpreamble |
| 314 |
% \generate{\file{myfile.drv}{\from{myfile.dtx}{driver}}} |
| 315 |
% \usepostamble\empty % switch off writing \endinput |
| 316 |
% \generate{\file{myfont.mf}{\from{myfile.dtx}{font}}} |
| 317 |
% \usepostamble\defaultpostamble % switch on writing \endinput |
| 318 |
% \generate{\file{mypackage.sty}{\from{myfile.dtx}{pack}}} |
| 319 |
% |
| 320 |
% \endinput |
| 321 |
% \end{verbatim} |
| 322 |
% |
| 323 |
% \DescribeMacro{\usepreamble} |
| 324 |
% \DescribeMacro{\defaultpreamble} |
| 325 |
% The documentation system provides these commands which can be used |
| 326 |
% within an \file{.ins} file to |
| 327 |
% either prevent or enable the addition of preamble information at the |
| 328 |
% beginning of the generated files. The preamble information is in |
| 329 |
% the form of LaTeX comment lines (i.e., lines starting with \%). |
| 330 |
% Other languages that you may wish to document probably have other |
| 331 |
% different commenting conventions, in which cases it is desireable |
| 332 |
% to inhibit the preamble output. |
| 333 |
% Extending the above example \file{.ins} file to turn off the preamble |
| 334 |
% for the driver file we can have: |
| 335 |
% \begin{verbatim} |
| 336 |
% %% file myfile.ins |
| 337 |
% \def\batchfile{myfile.ins} |
| 338 |
% \input docstrip.tex |
| 339 |
% \usepreamble\empty % switch off all preamble info |
| 340 |
% \generate{\file{myfile.drv}{\from{myfile.dtx}{driver}}} |
| 341 |
% \usepreamble\defaultpreamble % switch on normal preambling |
| 342 |
% \preamble |
| 343 |
% Copyright and other notices |
| 344 |
% \endpreamble |
| 345 |
% \usepostamble\empty % switch off writing \endinput |
| 346 |
% \generate{\file{myfont.mf}{\from{myfile.dtx}{font}}} |
| 347 |
% \usepostamble\defaultpostamble % switch on writing \endinput |
| 348 |
% \generate{\file{mypackage.sty}{\from{myfile.dtx}{pack}}} |
| 349 |
% |
| 350 |
% \endinput |
| 351 |
% \end{verbatim} |
| 352 |
% |
| 353 |
% There is no intrinsic reason why the use of this package should be limited |
| 354 |
% to documenting \Mfp{} code. It could just as well be used for documenting C, |
| 355 |
% C++, Java, or practically any other kind of code. |
| 356 |
% |
| 357 |
% \StopEventually{} |
| 358 |
% |
| 359 |
% |
| 360 |
% \section{The package code} \label{sec:code} |
| 361 |
% |
| 362 |
% Announce the name and version of the package, which requires |
| 363 |
% \LaTeXe. |
| 364 |
% \begin{macrocode} |
| 365 |
%<*usc> |
| 366 |
\NeedsTeXFormat{LaTeX2e} |
| 367 |
\ProvidesPackage{docmfp}[2009/09/02 v1.2d General coding extension to the doc package] |
| 368 |
|
| 369 |
% \end{macrocode} |
| 370 |
% |
| 371 |
% In order to try and avoid name clashes with other packages, each internal |
| 372 |
% name will include the character string \texttt{m@fp}. |
| 373 |
% |
| 374 |
% \begin{macro}{\m@fpmakeuscoreletter} |
| 375 |
% \begin{macro}{\m@fpmakehashletter} |
| 376 |
% \begin{macro}{\Makem@fpPrivateLetters} |
| 377 |
% \Mfp{} names can include underscores and hash characters. The special |
| 378 |
% meanings of these have to be turned off. |
| 379 |
% \begin{macrocode} |
| 380 |
\newcommand{\m@fpmakeuscoreletter}{\catcode`\_11\relax} |
| 381 |
\newcommand{\m@fpmakehashletter}{\catcode`\#11\relax} |
| 382 |
\newcommand{\Makem@fpPrivateLetters}{\m@fpmakeuscoreletter\m@fpmakehashletter} |
| 383 |
|
| 384 |
% \end{macrocode} |
| 385 |
% \end{macro} |
| 386 |
% \end{macro} |
| 387 |
% \end{macro} |
| 388 |
% |
| 389 |
% ^^A \begin{routine}{an_mfp_macro} |
| 390 |
% ^^A \begin{variable}{macro_variable} |
| 391 |
% ^^A \begin{routine}{nested_macro} |
| 392 |
% ^^A \end{routine} |
| 393 |
% ^^A \end{variable} |
| 394 |
% ^^A \end{routine} |
| 395 |
% |
| 396 |
% |
| 397 |
% \begin{environment}{routine} |
| 398 |
% The |routine| environment code is similar to the \Lpack{doc} package's |
| 399 |
% |environment| code. |
| 400 |
% \begin{macrocode} |
| 401 |
\def\routine{\begingroup |
| 402 |
\catcode`\\12 |
| 403 |
\Makem@fpPrivateLetters \m@fpm@cro@ \iffalse} |
| 404 |
\let\endroutine\endtrivlist |
| 405 |
|
| 406 |
% \end{macrocode} |
| 407 |
% \end{environment} |
| 408 |
% |
| 409 |
% \begin{environment}{variable} |
| 410 |
% The |variable| environment code is almost identical to the code for the |
| 411 |
% |routine| environment. |
| 412 |
% \begin{macrocode} |
| 413 |
\def\variable{\begingroup |
| 414 |
\catcode`\\12 |
| 415 |
\Makem@fpPrivateLetters \m@fpm@cro@ \iftrue} |
| 416 |
\let\endvariable\endroutine |
| 417 |
|
| 418 |
% \end{macrocode} |
| 419 |
% \end{environment} |
| 420 |
% |
| 421 |
% \begin{macro}{\m@fpm@cro@} |
| 422 |
% This command does all the work for both the |routine| and |variable| |
| 423 |
% environments. The first part is a straight copy of the \Lpack{doc} |
| 424 |
% package |\m@cro@| command. |
| 425 |
% \begin{macrocode} |
| 426 |
\long\def\m@fpm@cro@#1#2{\endgroup \topsep\MacroTopsep \trivlist |
| 427 |
\def\makelabel##1{\llap{##1}}% |
| 428 |
\if@inlabel |
| 429 |
\let\@tempa\@empty \count@\macro@cnt |
| 430 |
\loop \ifnum\count@>\z@ |
| 431 |
\edef\@tempa{\@tempa\hbox{\strut}}\advance\count@\m@ne \repeat |
| 432 |
\edef\makelabel##1{\llap{\vtop to\baselineskip |
| 433 |
{\@tempa\hbox{##1}\vss}}}% |
| 434 |
\advance \macro@cnt \@ne |
| 435 |
\else |
| 436 |
\macro@cnt\@ne |
| 437 |
\fi |
| 438 |
% \end{macrocode} |
| 439 |
% The rest of the code is for this package, and is a simplified and modified |
| 440 |
% version of the corresponding code for |\m@cro@|. |
| 441 |
% \begin{macrocode} |
| 442 |
\edef\@tempa{\noexpand\item[\noexpand\PrintMfpName{\string#2}]}% |
| 443 |
\@tempa |
| 444 |
\global\advance\c@CodelineNo\@ne |
| 445 |
#1% |
| 446 |
% \end{macrocode} |
| 447 |
% Do the indexing for the |variable| environment. |
| 448 |
% \begin{macrocode} |
| 449 |
\SpecialMainMfpIndex{#2}{\variablestring}{\variableheadname}\nobreak |
| 450 |
\else |
| 451 |
% \end{macrocode} |
| 452 |
% Do the indexing for the |routine| environment. |
| 453 |
% \begin{macrocode} |
| 454 |
\SpecialMainMfpIndex{#2}{\routinestring}{\routineheadname}\nobreak |
| 455 |
\fi |
| 456 |
% \end{macrocode} |
| 457 |
% and finish off the definition. |
| 458 |
% \begin{macrocode} |
| 459 |
\global\advance\c@CodelineNo\m@ne |
| 460 |
\ignorespaces} |
| 461 |
|
| 462 |
% \end{macrocode} |
| 463 |
% \end{macro} |
| 464 |
% |
| 465 |
% \begin{macro}{\routinestring} |
| 466 |
% \begin{macro}{\routineheadname} |
| 467 |
% These two commands store the default indexing strings for routines. |
| 468 |
% \begin{macrocode} |
| 469 |
\newcommand{\routinestring}{\space(routine)} |
| 470 |
\newcommand{\routineheadname}{routines:} |
| 471 |
|
| 472 |
% \end{macrocode} |
| 473 |
% \end{macro} |
| 474 |
% \end{macro} |
| 475 |
% |
| 476 |
% \begin{macro}{\variablestring} |
| 477 |
% \begin{macro}{\variableheadname} |
| 478 |
% These two commands store the default indexing strings for variables. |
| 479 |
% \begin{macrocode} |
| 480 |
\newcommand{\variablestring}{\space(variable)} |
| 481 |
\newcommand{\variableheadname}{variables:} |
| 482 |
|
| 483 |
% \end{macrocode} |
| 484 |
% \end{macro} |
| 485 |
% \end{macro} |
| 486 |
% |
| 487 |
% \begin{macro}{\Describe} |
| 488 |
% This is a generic description macro, and is similar to those |
| 489 |
% defined later. |
| 490 |
% \changes{v1.1}{2000/10/28}{Added Describe and Describem@fp macros} |
| 491 |
% \begin{macrocode} |
| 492 |
\def\Describe{\leavevmode\@bsphack\begingroup\Makem@fpPrivateLetters |
| 493 |
\Describem@fp} |
| 494 |
|
| 495 |
% \end{macrocode} |
| 496 |
% \end{macro} |
| 497 |
% |
| 498 |
% \begin{macro}{\Describem@fp} |
| 499 |
% The workhorse for |\Describe|. It processes the three apparent arguments |
| 500 |
% to |\Describe|. |
| 501 |
% \begin{macrocode} |
| 502 |
\def\Describem@fp#1#2#3{\endgroup |
| 503 |
\marginpar{\raggedleft\PrintMfpName{#3}}% |
| 504 |
\SpecialMfpIndex{#3}{#2}{#1}\@esphack\ignorespaces} |
| 505 |
|
| 506 |
% \end{macrocode} |
| 507 |
% \end{macro} |
| 508 |
% |
| 509 |
% \begin{environment}{Code} |
| 510 |
% This is a generalization of the previous environments. |
| 511 |
% \changes{v1.1}{2000/10/28}{Added m@fpm@c macro} |
| 512 |
% \begin{macrocode} |
| 513 |
\def\Code{\begingroup |
| 514 |
%% \catcode`\\12 |
| 515 |
\Makem@fpPrivateLetters \m@fpm@c} |
| 516 |
\let\endCode\endtrivlist |
| 517 |
|
| 518 |
% \end{macrocode} |
| 519 |
% \end{environment} |
| 520 |
% |
| 521 |
% \begin{macro}{\m@fpm@c} |
| 522 |
% This is the workhorse for the |Code| environment and processes |
| 523 |
% the 3 arguments apparently taken by the environment. |
| 524 |
% \begin{macrocode} |
| 525 |
\long\def\m@fpm@c#1#2#3{\endgroup \topsep\MacroTopsep \trivlist |
| 526 |
\def\makelabel##1{\llap{##1}}% |
| 527 |
\if@inlabel |
| 528 |
\let\@tempa\@empty \count@\macro@cnt |
| 529 |
\loop \ifnum\count@>\z@ |
| 530 |
\edef\@tempa{\@tempa\hbox{\strut}}% |
| 531 |
\advance\count@\m@ne \repeat |
| 532 |
\edef\makelabel##1{\llap{\vtop to\baselineskip |
| 533 |
{\@tempa\hbox{##1}\vss}}}% |
| 534 |
\advance\macro@cnt\@ne |
| 535 |
\else |
| 536 |
\macro@cnt\@ne |
| 537 |
\fi |
| 538 |
\edef\@tempa{\noexpand\item[\noexpand\PrintMfpName{\string#3}]}% |
| 539 |
\@tempa |
| 540 |
\global\advance\c@CodelineNo\@ne |
| 541 |
\SpecialMainMfpIndex{#3}{#2}{#1}\nobreak |
| 542 |
\global\advance\c@CodelineNo\m@ne |
| 543 |
\ignorespaces} |
| 544 |
|
| 545 |
% \end{macrocode} |
| 546 |
% \end{macro} |
| 547 |
% |
| 548 |
% |
| 549 |
% \begin{macro}{\PrintMfpName} |
| 550 |
% This typesets the name of a \Mfp{} routine or variable, or in general |
| 551 |
% \meta{name}. If there is a pre-existing |
| 552 |
% definition, then the package does not modify it. |
| 553 |
% \begin{macrocode} |
| 554 |
\providecommand{\PrintMfpName}[1]{\strut \MacroFont \string #1\ } |
| 555 |
|
| 556 |
% \end{macrocode} |
| 557 |
% \end{macro} |
| 558 |
% |
| 559 |
% Now for the command that writes out the index entries for the |routine| and |
| 560 |
% |variable| environments. It is also used for the |Code| environment. |
| 561 |
% |
| 562 |
% \begin{macro}{\SpecialMainMfpIndex} |
| 563 |
% The command |
| 564 |
% |\SpecialMainMfpIndex{|\meta{name}|}{|\meta{string}|}{|\meta{heading}|}| |
| 565 |
% writes \meta{name} to the \file{.idx} file, firstly as a `main' entry (flagged |
| 566 |
% with \meta{string}) and then as a subsidiary entry under \meta{heading}. |
| 567 |
% Both entries are treated as definitional. |
| 568 |
% \changes{v1.1}{2000/10/28}{Changed subsidiary environment index entry to be definitional} |
| 569 |
% \begin{macrocode} |
| 570 |
\newcommand{\SpecialMainMfpIndex}[3]{\@bsphack |
| 571 |
% \end{macrocode} |
| 572 |
% Here is the main index entry. |
| 573 |
% \begin{macrocode} |
| 574 |
\special@index{% |
| 575 |
\string#1\actualchar |
| 576 |
\string\verb\quotechar*\verbatimchar\string#1\verbatimchar |
| 577 |
#2 \encapchar main}% |
| 578 |
% \end{macrocode} |
| 579 |
% Here is the subsidiary index entry. |
| 580 |
% \begin{macrocode} |
| 581 |
\special@index{#3\levelchar |
| 582 |
\string#1\actualchar |
| 583 |
\string\verb\quotechar*\verbatimchar\string#1\verbatimchar |
| 584 |
\encapchar main} |
| 585 |
\@esphack} |
| 586 |
|
| 587 |
% \end{macrocode} |
| 588 |
% \end{macro} |
| 589 |
% |
| 590 |
% \begin{macro}{\DescribeRoutine} |
| 591 |
% The command |\DescribeRoutine{|\meta{name}|}| typesets a marginal heading and |
| 592 |
% an index entry for the description of a routine called \meta{name}. It |
| 593 |
% is based on the \Lpack{doc} |\DescribeMacro| command. |
| 594 |
% \begin{macrocode} |
| 595 |
\def\DescribeRoutine{\leavevmode\@bsphack\begingroup\Makem@fpPrivateLetters |
| 596 |
\Describem@fpRoutine} |
| 597 |
% \end{macrocode} |
| 598 |
% \end{macro} |
| 599 |
% |
| 600 |
% \begin{macro}{\Describem@fpRoutine} |
| 601 |
% This is the macro that does the work for |\DescribeRoutine|. |
| 602 |
% \begin{macrocode} |
| 603 |
\def\Describem@fpRoutine#1{\endgroup |
| 604 |
\marginpar{\raggedleft\PrintMfpName{#1}}% |
| 605 |
\SpecialMfpIndex{#1}{\routinestring}{\routineheadname}\@esphack\ignorespaces} |
| 606 |
|
| 607 |
% \end{macrocode} |
| 608 |
% \end{macro} |
| 609 |
% |
| 610 |
% \begin{macro}{\DescribeVariable} |
| 611 |
% The command |\DescribeVariable{|\meta{name}|}| typesets a marginal heading and |
| 612 |
% an index entry for the description of a variable called \meta{name}. It |
| 613 |
% is based on the |\DescribeRoutine| command. |
| 614 |
% \begin{macrocode} |
| 615 |
\def\DescribeVariable{\leavevmode\@bsphack\begingroup\Makem@fpPrivateLetters |
| 616 |
\Describem@fpVariable} |
| 617 |
% \end{macrocode} |
| 618 |
% \end{macro} |
| 619 |
% |
| 620 |
% \begin{macro}{\Describem@fpVariable} |
| 621 |
% This is the macro that does the work for |\DescribeVariable|. |
| 622 |
% \begin{macrocode} |
| 623 |
\def\Describem@fpVariable#1{\endgroup |
| 624 |
\marginpar{\raggedleft\PrintMfpName{#1}}% |
| 625 |
\SpecialMfpIndex{#1}{\variablestring}{\variableheadname}\@esphack\ignorespaces} |
| 626 |
|
| 627 |
% \end{macrocode} |
| 628 |
% \end{macro} |
| 629 |
% |
| 630 |
% \begin{macro}{\SpecialMfpIndex} |
| 631 |
% The command |
| 632 |
% |\SpecialMfpIndex{|\meta{name}|}{|\meta{string}|}{|\meta{heading}|}| |
| 633 |
% writes \meta{name} to the \file{.idx} file, firstly as a `main' entry (flagged |
| 634 |
% with \meta{string}) and then as a subsidiary entry under \meta{heading}. Both |
| 635 |
% entries are treated as `usages' of the \meta{name}. |
| 636 |
% \begin{macrocode} |
| 637 |
\newcommand{\SpecialMfpIndex}[3]{\@bsphack |
| 638 |
% \end{macrocode} |
| 639 |
% Here is the main index entry. |
| 640 |
% \begin{macrocode} |
| 641 |
\index{% |
| 642 |
\string#1\actualchar |
| 643 |
\string\verb\quotechar*\verbatimchar\string#1\verbatimchar |
| 644 |
#2 \encapchar usage}% |
| 645 |
% \end{macrocode} |
| 646 |
% Here is the subsidiary index entry. |
| 647 |
% \begin{macrocode} |
| 648 |
\index{#3\levelchar |
| 649 |
\string#1\actualchar |
| 650 |
\string\verb\quotechar*\verbatimchar\string#1\verbatimchar |
| 651 |
\encapchar usage} |
| 652 |
\@esphack} |
| 653 |
|
| 654 |
% \end{macrocode} |
| 655 |
% \end{macro} |
| 656 |
% |
| 657 |
% \begin{macro}{\check@checksum} |
| 658 |
% After some experience with using \Lpack{docmfp} for code that had |
| 659 |
% no resemblence at all to \LaTeX, I found that if there were no |
| 660 |
% backslashes present, then \Lpack{doc} whined about there being no |
| 661 |
% checksum and said that the |\CheckSum| should be set to zero, which |
| 662 |
% it was. This is the relevent code from the \Lpack{doc} package. |
| 663 |
% \changes{v1.2}{2001/02/11}{Redefined the \cs{check@checksum} command} |
| 664 |
% \changes{v1.2b}{2004/05/14}{Fixed \cs{checksum} typo, thanks to Dan Luecking} |
| 665 |
% \begin{verbatim} |
| 666 |
% \def\check@checksum{\relax |
| 667 |
% \ifnum\check@sum=\z@ |
| 668 |
% \typeout{**********************************}% |
| 669 |
% \typeout{* This macro file has no checksum!}% |
| 670 |
% \typeout{* The checksum should be \the\bslash@cnt!}% |
| 671 |
% \typeout{**********************************}% |
| 672 |
% \else |
| 673 |
% \ifnum\check@sum=\bslash@cnt |
| 674 |
% \typeout{*******************}% |
| 675 |
% \typeout{* Checksum passed *}% |
| 676 |
% \typeout{*******************}% |
| 677 |
% \else |
| 678 |
% \PackageError{doc}{Checksum not passed |
| 679 |
% (\the\check@sum<>\the\bslash@cnt)}% |
| 680 |
% {The file currently documented seems to be wrong.^^J% |
| 681 |
% Try to get a correct version.}% |
| 682 |
% \fi |
| 683 |
% \fi |
| 684 |
% \global\check@sum\z@} |
| 685 |
% \end{verbatim} |
| 686 |
% For the purposes of the \Lpack{docmfp} package this needs redefining |
| 687 |
% as a zero check sum is acceptable. |
| 688 |
% \begin{macrocode} |
| 689 |
\renewcommand{\check@checksum}{\relax |
| 690 |
\ifnum\check@sum=\bslash@cnt |
| 691 |
\typeout{*******************}% |
| 692 |
\typeout{* Checksum passed *}% |
| 693 |
\typeout{*******************}% |
| 694 |
\else |
| 695 |
\PackageError{docmfp}{Checksum not passed |
| 696 |
(\the\check@sum<>\the\bslash@cnt)}% |
| 697 |
{The file currently documented seems to be wrong.^^J% |
| 698 |
Try to get a correct version.}% |
| 699 |
\fi |
| 700 |
\global\check@sum\z@} |
| 701 |
|
| 702 |
% \end{macrocode} |
| 703 |
% \end{macro} |
| 704 |
% |
| 705 |
% |
| 706 |
% |
| 707 |
% The end of this package. |
| 708 |
% \begin{macrocode} |
| 709 |
%</usc> |
| 710 |
% \end{macrocode} |
| 711 |
% |
| 712 |
% |
| 713 |
% \bibliographystyle{alpha} |
| 714 |
% |
| 715 |
% \begin{thebibliography}{GMS94} |
| 716 |
% |
| 717 |
% \bibitem[GMS94]{GOOSSENS94} |
| 718 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 719 |
% \newblock {\em The LaTeX Companion}. |
| 720 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 721 |
% |
| 722 |
% \end{thebibliography} |
| 723 |
% |
| 724 |
% |
| 725 |
% \Finale |
| 726 |
% \PrintIndex |
| 727 |
% |
| 728 |
\endinput |
| 729 |
|
| 730 |
%% \CharacterTable |
| 731 |
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 732 |
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 733 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 734 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 735 |
%% Dollar \$ Percent \% Ampersand \& |
| 736 |
%% Acute accent \' Left paren \( Right paren \) |
| 737 |
%% Asterisk \* Plus \+ Comma \, |
| 738 |
%% Minus \- Point \. Solidus \/ |
| 739 |
%% Colon \: Semicolon \; Less than \< |
| 740 |
%% Equals \= Greater than \> Question mark \? |
| 741 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 742 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 743 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 744 |
%% Right brace \} Tilde \~} |
| 745 |
|
| 746 |
|