| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% stdclsdv.dtx |
| 4 |
% Copyright 1999 Peter R. Wilson |
| 5 |
% |
| 6 |
% This program is provided under the terms of the |
| 7 |
% LaTeX Project Public License distributed from CTAN |
| 8 |
% archives in directory macros/latex/base/lppl.txt. |
| 9 |
% |
| 10 |
% Author: Peter Wilson, Herries Press |
| 11 |
% Maintainer: Will Robertson (will dot robertson at latex-project dot org) |
| 12 |
% |
| 13 |
%<*driver> |
| 14 |
\documentclass{ltxdoc} |
| 15 |
\EnableCrossrefs |
| 16 |
\CodelineIndex |
| 17 |
%%\OnlyDescription |
| 18 |
\setcounter{StandardModuleDepth}{1} |
| 19 |
\begin{document} |
| 20 |
\DocInput{stdclsdv.dtx} |
| 21 |
\end{document} |
| 22 |
%</driver> |
| 23 |
% |
| 24 |
% \fi |
| 25 |
% |
| 26 |
% \CheckSum{130} |
| 27 |
% |
| 28 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 29 |
% \DoNotIndex{\@centercr,\@cite} |
| 30 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 31 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 32 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 33 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 34 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 35 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 36 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 37 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 38 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 39 |
% \DoNotIndex{\bullet} |
| 40 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 41 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 42 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 43 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 44 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 45 |
% \DoNotIndex{\fbox} |
| 46 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 47 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 48 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 49 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 50 |
% \DoNotIndex{\input} |
| 51 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 52 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 53 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 54 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 55 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 56 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 57 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 58 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 59 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 60 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 61 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 62 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 63 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 64 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 65 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 66 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 67 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 68 |
% |
| 69 |
% \changes{v1.0}{1999/01/17}{First public release} |
| 70 |
% \changes{v1.1}{2000/07/16}{Added koma classes} |
| 71 |
% \changes{v1.1a}{2009/09/04}{New maintainer (Will Robertson)} |
| 72 |
% |
| 73 |
% \def\fileversion{v1.0} \def\filedate{1999/01/17} |
| 74 |
% \def\fileversion{v1.1} \def\filedate{2000/07/16} |
| 75 |
% \def\fileversion{v1.1a} \def\filedate{2009/09/04} |
| 76 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 77 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 78 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 79 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 80 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 81 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 82 |
% |
| 83 |
% \title{The \Lpack{stdclsdv} package\thanks{This |
| 84 |
% file has version number \fileversion, last revised |
| 85 |
% \filedate.}} |
| 86 |
% |
| 87 |
% \author{% |
| 88 |
% Peter Wilson, Herries Press\thanks{This work was originally |
| 89 |
% performed as |
| 90 |
% a Guest Researcher at the National Institute of Standards and Technology.}\\ |
| 91 |
% Maintainer: Will Robertson \\ |
| 92 |
% \texttt{will dot robertson at latex-project dot org} |
| 93 |
% } |
| 94 |
% \date{\filedate} |
| 95 |
% \maketitle |
| 96 |
% \begin{abstract} |
| 97 |
% The \Lpack{stdclsdv} package is intended to be used by the authors |
| 98 |
% of \LaTeX{} packages that need to know about the sectional divisions |
| 99 |
% provided by the document class. |
| 100 |
% \end{abstract} |
| 101 |
% \tableofcontents |
| 102 |
% |
| 103 |
% |
| 104 |
% |
| 105 |
% \section{Introduction} |
| 106 |
% |
| 107 |
% Several packages need to know the kind of sectional divisions |
| 108 |
% provided by the document class. |
| 109 |
% |
| 110 |
% The \Lpack{stdclsdv} package provides a solution for |
| 111 |
% for the case when the document class is one of the \LaTeX{} standard |
| 112 |
% classes (i.e., \Lpack{book}, \Lpack{report}, \Lpack{article}, |
| 113 |
% \Lpack{letter}, \Lpack{slides}, and classes derived from the |
| 114 |
% \Lpack{article} class, namely \Lpack{ltxdoc} and \Lpack{proc}). |
| 115 |
% It also handles the \Lpack{koma} classes.\footnote{Courtesy of |
| 116 |
% Joerg Jaspert \texttt{[email protected]}.} |
| 117 |
% |
| 118 |
% This manual is typeset according to the conventions of the |
| 119 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 120 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 121 |
% |
| 122 |
% Section~\ref{sec:usc} describes the usage of the package. |
| 123 |
% Commented source code for the package is in Section~\ref{sec:code}. |
| 124 |
% |
| 125 |
% \section{The \Lpack{stdclsdv} package} \label{sec:usc} |
| 126 |
% |
| 127 |
% The \Lpack{stdclsdv} package provides several |\if...| macros |
| 128 |
% which can be used to determine the kinds of sectional divisions |
| 129 |
% supported by the current (standard) |\documentclass|. |
| 130 |
% |
| 131 |
% The package is designed to work with the standard \LaTeX{} |
| 132 |
% document classes \Lpack{book}, \Lpack{report}, \Lpack{article}, \Lpack{proc} |
| 133 |
% and \Lpack{ltxdoc} class (which is based to a large extent on |
| 134 |
% the \Lpack{article} class). |
| 135 |
% |
| 136 |
% \DescribeMacro{\ifSCDknownclass} |
| 137 |
% |\ifSCDknownclass| is TRUE iff the document class is one of: |
| 138 |
% \Lpack{book}, \Lpack{report}, \Lpack{article}, \Lpack{letter}, |
| 139 |
% \Lpack{slides}, \Lpack{proc}, \Lpack{ltxdoc}, |
| 140 |
% \Lpack{scrbook}, \Lpack{scrreprt}, \Lpack{scrartcl} or \Lpack{scrlettr}. |
| 141 |
% Otherwise it is FALSE. |
| 142 |
% |
| 143 |
% \DescribeMacro{\ifSCDchapter} |
| 144 |
% |\ifSCDchapter| is TRUE iff the document class defines a |\chapter| |
| 145 |
% sectional division, otherwise it is FALSE. |
| 146 |
% |
| 147 |
% \DescribeMacro{\ifSCDpart} |
| 148 |
% |\ifSCDpart| is TRUE iff the document class defines a |\part| |
| 149 |
% sectional division, otherwise it is FALSE. |
| 150 |
% |
| 151 |
% \DescribeMacro{\ifSCDsection} |
| 152 |
% |\ifSCDsection| is TRUE iff the document class defines a |\section| |
| 153 |
% sectional division, otherwise it is FALSE. |
| 154 |
% |
| 155 |
% \DescribeMacro{\ifSCDnodivs} |
| 156 |
% |\ifSCDnodivs| is TRUE iff the document class has neither |\part| |
| 157 |
% nor |\chapter| |
| 158 |
% nor |\section| divisions, otherwise it is FALSE. |
| 159 |
% |
| 160 |
% \DescribeMacro{\SCDquit} |
| 161 |
% If the document class or divisioning is not handled by a package, it |
| 162 |
% can be useful to skip all futher package code. This could be done using: |
| 163 |
% \begin{verbatim} |
| 164 |
% ... |
| 165 |
% \ifSCDknownclass |
| 166 |
% % normal processing |
| 167 |
% \else % just before end of package file |
| 168 |
% % error/warning message about unknown class |
| 169 |
% \fi |
| 170 |
% \endinput |
| 171 |
% \end{verbatim} |
| 172 |
% Alternatively, using the |\SCDQuit| command provides a clearer means |
| 173 |
% of accomplishing this. The |\SCDquit| macro is defined to do nothing. |
| 174 |
% It is intended to |
| 175 |
% be used for prematurely ending a package file in the following manner: |
| 176 |
% \begin{verbatim} |
| 177 |
% \ifSCDknownclass\else |
| 178 |
% \renewcommand{\SCDquit}{\endinput} |
| 179 |
% % error/warning message about unknown class |
| 180 |
% \fi |
| 181 |
% \SCDquit % ends the file iff the class is unknown |
| 182 |
% % normal processing |
| 183 |
% ... |
| 184 |
% \endinput |
| 185 |
% \end{verbatim} |
| 186 |
% |
| 187 |
% \DescribeMacro{\SCDCheckCommand} |
| 188 |
% \DescribeMacro{\ifSCDSameDefinition} |
| 189 |
% |\SCDCheckCommand| takes the same arguments as |\newcommand|, that is:\\ |
| 190 |
% |\SCDCheckCommand{|\meta{command}|}[|\meta{nargs}|][|\meta{defarg}|]{|\meta{definition}|}| \\ |
| 191 |
% |\SCDCheckCommand| is |
| 192 |
% identical to the kernel |\CheckCommand| (see \file{ltdefns.dtx}) except |
| 193 |
% that it sets |\ifSCDSameDefinition| to TRUE iff the definition given |
| 194 |
% in |\SCDCheckCommand| is the same as the current definition, otherwise |
| 195 |
% |\ifSCDSameDefinition| is set to FALSE. |
| 196 |
% (|\CheckCommand| issues a warning if the definitions are different). |
| 197 |
% |
| 198 |
% |
| 199 |
% \StopEventually{ |
| 200 |
% \bibliographystyle{alpha} |
| 201 |
% \begin{thebibliography}{GMS94} |
| 202 |
% \bibitem[GMS94]{GOOSSENS94} |
| 203 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 204 |
% \newblock {\em The LaTeX Companion}. |
| 205 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 206 |
% \end{thebibliography} |
| 207 |
% } |
| 208 |
% |
| 209 |
% |
| 210 |
% \section{The package code} \label{sec:code} |
| 211 |
% |
| 212 |
% Announce the name and version of the package, which requires |
| 213 |
% \LaTeXe. |
| 214 |
% \begin{macrocode} |
| 215 |
%<*usc> |
| 216 |
\NeedsTeXFormat{LaTeX2e} |
| 217 |
\ProvidesPackage{stdclsdv}[2009/09/04 v1.1a Sectional divisions] |
| 218 |
% \end{macrocode} |
| 219 |
% |
| 220 |
% In order to try and avoid name clashes with other packages, each macro |
| 221 |
% name includes the character string |SCD| (Standard Class Division). |
| 222 |
% |
| 223 |
% \begin{macro}{\ifSCDknownclass} |
| 224 |
% \begin{macro}{\ifSCDpart} |
| 225 |
% \begin{macro}{\ifSCDchapter} |
| 226 |
% \begin{macro}{\ifSCDsection} |
| 227 |
% \begin{macro}{\ifSCDnodivs} |
| 228 |
% These are used when we need to decide what sectional |
| 229 |
% divisions are supported by the document's class. |
| 230 |
% We will assume assume an unknown class that has |\part| and |\section| |
| 231 |
% but not |
| 232 |
% |\chapter| divisions. |
| 233 |
% \begin{macrocode} |
| 234 |
\newif\ifSCDknownclass\SCDknownclassfalse |
| 235 |
\newif\ifSCDpart\SCDparttrue |
| 236 |
\newif\ifSCDchapter\SCDchapterfalse |
| 237 |
\newif\ifSCDsection\SCDsectiontrue |
| 238 |
\newif\ifSCDnodivs\SCDnodivsfalse |
| 239 |
% \end{macrocode} |
| 240 |
% Check the actual class.\footnote{Thanks to David Carlisle for |
| 241 |
% information on how to check on the class.} |
| 242 |
% \begin{macrocode} |
| 243 |
\@ifclassloaded{book}{\SCDknownclasstrue\SCDchaptertrue}{} |
| 244 |
\@ifclassloaded{report}{\SCDknownclasstrue\SCDchaptertrue}{} |
| 245 |
\@ifclassloaded{article}{\SCDknownclasstrue}{} |
| 246 |
\@ifclassloaded{proc}{\SCDknownclasstrue}{} |
| 247 |
\@ifclassloaded{ltxdoc}{\SCDknownclasstrue}{} |
| 248 |
\@ifclassloaded{slides}{\SCDknownclasstrue |
| 249 |
\SCDnodivstrue\SCDpartfalse\SCDsectionfalse}{} |
| 250 |
\@ifclassloaded{letter}{\SCDknownclasstrue |
| 251 |
\SCDnodivstrue\SCDpartfalse\SCDsectionfalse}{} |
| 252 |
% \end{macrocode} |
| 253 |
% Joerg Jaspert supplied, via Email on 2000/07/16, the following code |
| 254 |
% for the \Lpack{koma} classes. |
| 255 |
% \changes{v1.1}{2000/07/16}{Added checks for koma classes} |
| 256 |
% \begin{macrocode} |
| 257 |
\@ifclassloaded{scrbook}{\SCDknownclasstrue\SCDchaptertrue}{} |
| 258 |
\@ifclassloaded{scrreprt}{\SCDknownclasstrue\SCDchaptertrue}{} |
| 259 |
\@ifclassloaded{scrartcl}{\SCDknownclasstrue}{} |
| 260 |
\@ifclassloaded{scrlettr}{\SCDknownclasstrue |
| 261 |
\SCDnodivstrue\SCDpartfalse\SCDsectionfalse}{} |
| 262 |
% \end{macrocode} |
| 263 |
% |
| 264 |
% If the class is not one of the standard classes, check if |\part| or |
| 265 |
% |\chapter| or |\section| headings are provided. |
| 266 |
% \begin{macrocode} |
| 267 |
\ifSCDknownclass\else |
| 268 |
\SCDnodivstrue |
| 269 |
\ifx\part\undefined |
| 270 |
\SCDpartfalse |
| 271 |
\else |
| 272 |
\SCDnodivsfalse |
| 273 |
\fi |
| 274 |
\ifx\chapter\undefined\else |
| 275 |
\SCDchaptertrue \SCDnodivsfalse |
| 276 |
\fi |
| 277 |
\ifx\section\undefined |
| 278 |
\SCDsectionfalse |
| 279 |
\else |
| 280 |
\SCDnodivsfalse |
| 281 |
\fi |
| 282 |
\fi |
| 283 |
% \end{macrocode} |
| 284 |
% \end{macro} |
| 285 |
% \end{macro} |
| 286 |
% \end{macro} |
| 287 |
% \end{macro} |
| 288 |
% \end{macro} |
| 289 |
% |
| 290 |
% \begin{macro}{\SCDquit} |
| 291 |
% A macro that does nothing (see \S\ref{sec:usc} for its intended usage). |
| 292 |
% \begin{macrocode} |
| 293 |
\newcommand{\SCDquit}{} |
| 294 |
% \end{macrocode} |
| 295 |
% \end{macro} |
| 296 |
% |
| 297 |
% \begin{macro}{\ifSCDSameDefinition} |
| 298 |
% Used to store the result of |\SCDCheckCommand|. TRUE iff the command |
| 299 |
% has the given definition. |
| 300 |
% \begin{macrocode} |
| 301 |
\newif\ifSCDSameDefinition |
| 302 |
% \end{macrocode} |
| 303 |
% \end{macro} |
| 304 |
% |
| 305 |
% \begin{macro}{\SCDCheckCommand} |
| 306 |
% This is identical to the kernal |\CheckCommand| except that it sets |
| 307 |
% the |\ifSCDSameCommand| flag rather than issuing a warning. See |
| 308 |
% \file{ltdefns.dtx} for the coding for |\CheckCommand|. |
| 309 |
% \begin{macrocode} |
| 310 |
\def\SCDCheckCommand{\@star@or@long% |
| 311 |
\SCDSameDefinitiontrue% changed from CheckCommand |
| 312 |
\@SCD@check@command} |
| 313 |
\@onlypreamble\SCDCheckCommand |
| 314 |
% \end{macrocode} |
| 315 |
% \end{macro} |
| 316 |
% \begin{macro}{\@SCD@check@command} |
| 317 |
% \begin{macrocode} |
| 318 |
\def\@SCD@check@command#1#2#{\@SCD@check@c#1{#2}} |
| 319 |
\@onlypreamble\@SCD@check@command |
| 320 |
% \end{macrocode} |
| 321 |
% \end{macro} |
| 322 |
% \begin{macro}{\@SCD@check@c} |
| 323 |
% \begin{macrocode} |
| 324 |
\long\def\@SCD@check@c#1#2#3{% |
| 325 |
\expandafter\let\csname\string\reserved@a\endcsname\relax |
| 326 |
\renew@command\reserved@a#2{#3}% |
| 327 |
\@ifundefined{\string\reserved@a}% |
| 328 |
{\@SCD@check@eq#1\reserved@a}% |
| 329 |
{\expandafter\@SCD@check@eq |
| 330 |
\csname\string#1\expandafter\endcsname |
| 331 |
\csname\string\reserved@a\endcsname}} |
| 332 |
\@onlypreamble\@SCD@check@c |
| 333 |
% \end{macrocode} |
| 334 |
% \end{macro} |
| 335 |
% \begin{macro}{\@SCD@check@eq} |
| 336 |
% \begin{macrocode} |
| 337 |
\def\@SCD@check@eq#1#2{% |
| 338 |
\ifx#1#2\else |
| 339 |
\SCDSameDefinitionfalse % changed from CheckCommand |
| 340 |
\fi} |
| 341 |
\@onlypreamble\@SCD@check@eq |
| 342 |
% \end{macrocode} |
| 343 |
% \end{macro} |
| 344 |
% |
| 345 |
% The end of this package. |
| 346 |
% \begin{macrocode} |
| 347 |
%</usc> |
| 348 |
% \end{macrocode} |
| 349 |
% |
| 350 |
% |
| 351 |
% |
| 352 |
% \Finale |
| 353 |
% \PrintIndex |
| 354 |
% |
| 355 |
\endinput |
| 356 |
|
| 357 |
%% \CharacterTable |
| 358 |
%% {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 |
| 359 |
%% 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 |
| 360 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 361 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 362 |
%% Dollar \$ Percent \% Ampersand \& |
| 363 |
%% Acute accent \' Left paren \( Right paren \) |
| 364 |
%% Asterisk \* Plus \+ Comma \, |
| 365 |
%% Minus \- Point \. Solidus \/ |
| 366 |
%% Colon \: Semicolon \; Less than \< |
| 367 |
%% Equals \= Greater than \> Question mark \? |
| 368 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 369 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 370 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 371 |
%% Right brace \} Tilde \~} |
| 372 |
|
| 373 |
|