| 1 |
% \iffalse THIS IS A META-COMMENT |
| 2 |
%<*dtx> |
| 3 |
\ProvidesFile |
| 4 |
%======================================================================== |
| 5 |
{SUBLABEL.DTX} |
| 6 |
%======================================================================== |
| 7 |
%</dtx> |
| 8 |
%% Copyright 1993-1999 Patrick W Daly |
| 9 |
%% Max-Planck-Institut f\"ur Aeronomie |
| 10 |
%% Max-Planck-Str. 2 |
| 11 |
%% D-37191 Katlenburg-Lindau |
| 12 |
%% Germany |
| 13 |
%% E-mail: [email protected] |
| 14 |
% |
| 15 |
% This program can be redistributed and/or modified under the terms |
| 16 |
% of the LaTeX Project Public License Distributed from CTAN |
| 17 |
% archives in directory macros/latex/base/lppl.txt; either |
| 18 |
% version 1 of the License, or any later version. |
| 19 |
% |
| 20 |
% This is a contributed file to the LaTeX2e system. |
| 21 |
% ------------------------------------------------- |
| 22 |
% This is a LaTeX package to permit figures, equations etc to be subnumbered |
| 23 |
% as 4a, 4b, 4c etc. |
| 24 |
% Installation: |
| 25 |
% LaTeX this file: creates docstrip installation file sublabel.ins |
| 26 |
% AND the (LaTeX2e) documentation |
| 27 |
% (La)TeX sublabel.ins: creates package files sublabel.sty, and optionally |
| 28 |
% documentation driver sublabel.drv |
| 29 |
% (sublabel.ins may be edited as needed) |
| 30 |
% Docstrip options available: |
| 31 |
% package - to produce a (LaTeX2e) package .sty file |
| 32 |
% driver - to produce a driver file to print the documentation |
| 33 |
% 209 - (with package) for package that runs under LaTeX 2.09 |
| 34 |
% subpack - (with package) for coding included in other packages |
| 35 |
% agu - (with package,subpack) for inclusion in aguplus package |
| 36 |
%-------------------------------------------------------------------------- |
| 37 |
%<*!subpack> |
| 38 |
%<package&209>\def\ProvidesPackage#1#2] |
| 39 |
%<package&209> {\typeout{Style option `#1'#2]}} |
| 40 |
% |
| 41 |
% *** Identify the package file:- |
| 42 |
%<package&!209>\NeedsTeXFormat{LaTeX2e}[1995/06/01] |
| 43 |
%<package>\ProvidesPackage{sublabel} |
| 44 |
%</!subpack> |
| 45 |
% |
| 46 |
% *** Provide command to dislay module version |
| 47 |
%<package&subpack>\def\ModuleVersion#1[#2]{} |
| 48 |
%<package&subpack> \ModuleVersion{sublabel} |
| 49 |
% |
| 50 |
% *** Identify the driver file:- |
| 51 |
%<driver>\NeedsTeXFormat{LaTeX2e} |
| 52 |
%<driver>\ProvidesFile{sublabel.drv} |
| 53 |
% |
| 54 |
% *** The DATE, VERSION, and other INFO |
| 55 |
%\fi |
| 56 |
%\ProvidesFile{sublabel} |
| 57 |
[1999/02/23 4.5 (PWD)] |
| 58 |
% \changes{4.0}{1993 Jun 7}{Completely replacing the version based on |
| 59 |
% art-jgr; made more general and flexible} |
| 60 |
% \changes{4.1}{1993 July 20}{Initial release with {\tt docstrip}} |
| 61 |
% \changes{4.1}{1993 Jul 20}{Discover bug; sub labels previously prefixed |
| 62 |
% with `sub', but conflict with `subsection'} |
| 63 |
% \changes{4.1}{1993 Jul 20}{\cs{stepcounter} tests if subfoo exists} |
| 64 |
% \changes{4.2}{1993 Dec 17}{Adjust \cs{addtocounter} to step subcounter } |
| 65 |
% \changes{4.2a}{1994 Feb 25}{Must use the old \cs{addtocounter} in |
| 66 |
% \cs{endeqnarray}} |
| 67 |
% \changes{4.3}{1994 May 16}{Convert to \LaTeXe} |
| 68 |
% \changes{4.3a}{1994 Jun 22}{Update to first official release of \LaTeXe} |
| 69 |
% \changes{4.3b}{1995 Jan 3}{Update documentation to PWD standard} |
| 70 |
% \changes{4.3c}{1995 Sep 18}{Fix \cs{DeclareOption} for \LaTeX\ of June 1995} |
| 71 |
% \changes{4.3d}{1997 Mar 16}{Fix copyright for subpackage and other minor |
| 72 |
% things} |
| 73 |
% \changes{4.4}{1997 Apr 28}{Fix so it works with other packages that change |
| 74 |
% \texttt{eqnarray}, like \texttt{amsmath}} |
| 75 |
% \changes{4.5}{1999 Feb 23}{Update copyright notice} |
| 76 |
% |
| 77 |
% \CheckSum{209} |
| 78 |
% \CharacterTable |
| 79 |
% {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 |
| 80 |
% 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 |
| 81 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 82 |
% Exclamation \! Double quote \" Hash (number) \# |
| 83 |
% Dollar \$ Percent \% Ampersand \& |
| 84 |
% Acute accent \' Left paren \( Right paren \) |
| 85 |
% Asterisk \* Plus \+ Comma \, |
| 86 |
% Minus \- Point \. Solidus \/ |
| 87 |
% Colon \: Semicolon \; Less than \< |
| 88 |
% Equals \= Greater than \> Question mark \? |
| 89 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 90 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 91 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 92 |
% Right brace \} Tilde \~} |
| 93 |
% |
| 94 |
% \iffalse |
| 95 |
%<*install> |
| 96 |
%^^A ============================================= |
| 97 |
%^^A Here is the docstrip installation file |
| 98 |
%^^A It is written on first LaTeX run if it |
| 99 |
%^^A does not already exist |
| 100 |
%^^A ============================================= |
| 101 |
\begin{filecontents*}{sublabel.ins} |
| 102 |
% File: sublabel.ins |
| 103 |
% Copyright 1999 Patrick W. Daly |
| 104 |
% |
| 105 |
% This file can be redistributed and/or modified under the terms |
| 106 |
% of the LaTeX Project Public License Distributed from CTAN |
| 107 |
% archives in directory macros/latex/base/lppl.txt; either |
| 108 |
% version 1 of the License, or any later version. |
| 109 |
% |
| 110 |
% It is an installation file for extracting package and driver |
| 111 |
% files from the original source file. Simply process it under |
| 112 |
% TeX or LaTeX. |
| 113 |
|
| 114 |
\input docstrip |
| 115 |
|
| 116 |
\preamble |
| 117 |
============================================= |
| 118 |
IMPORTANT NOTICE: |
| 119 |
|
| 120 |
This program can be redistributed and/or modified under the terms |
| 121 |
of the LaTeX Project Public License Distributed from CTAN |
| 122 |
archives in directory macros/latex/base/lppl.txt; either |
| 123 |
version 1 of the License, or any later version. |
| 124 |
|
| 125 |
This is a generated file. |
| 126 |
It may not be distributed without the original source file \inFileName. |
| 127 |
|
| 128 |
Full documentation can be obtained by LaTeXing that original file. |
| 129 |
Only a few abbreviated comments remain here to describe the usage. |
| 130 |
============================================= |
| 131 |
\endpreamble |
| 132 |
\postamble |
| 133 |
|
| 134 |
<<<<< End of generated file <<<<<< |
| 135 |
\endpostamble |
| 136 |
|
| 137 |
\declarepreamble\driver |
| 138 |
============================================ |
| 139 |
This is the driver file to produce the LaTeX documentation |
| 140 |
from the original source file \inFileName. |
| 141 |
|
| 142 |
Make changes to it as needed. (Never change the file \inFileName!) |
| 143 |
============================================ |
| 144 |
\endpreamble |
| 145 |
|
| 146 |
\declarepostamble\driverq |
| 147 |
|
| 148 |
End of documentation driver file. |
| 149 |
\endpostamble |
| 150 |
|
| 151 |
\keepsilent |
| 152 |
\askforoverwritefalse |
| 153 |
|
| 154 |
\generate{\file{sublabel.sty}{\from{sublabel.dtx}{package}} |
| 155 |
\file{sublabel.drv}{\usepreamble\driver\usepostamble\driverq |
| 156 |
\from{sublabel.dtx}{driver}} |
| 157 |
} |
| 158 |
|
| 159 |
\obeyspaces |
| 160 |
\Msg{*******************************************}% |
| 161 |
\Msg{* For documentation, process sublabel.dtx *}% |
| 162 |
\Msg{* or the driver file sublabel.drv *}% |
| 163 |
\Msg{*******************************************} |
| 164 |
|
| 165 |
\endbatchfile |
| 166 |
\end{filecontents*} |
| 167 |
%</install> |
| 168 |
%<*driver> |
| 169 |
\documentclass{ltxdoc} |
| 170 |
%<driver>%\documentclass[twoside]{ltxdoc} |
| 171 |
%<driver>%\documentclass[a4paper]{ltxdoc} |
| 172 |
%<driver>%\documentclass[twoside,a4paper]{ltxdoc} |
| 173 |
\raggedbottom |
| 174 |
|
| 175 |
%** To include the detailed explanation of the coding, comment out |
| 176 |
%** the next line |
| 177 |
\OnlyDescription |
| 178 |
|
| 179 |
%** To produce a command index: add the following line for one run, |
| 180 |
%** then run makeindex -s gind.ist natbib |
| 181 |
%** and reprocess, with or without this line (much faster without) |
| 182 |
%<driver>% \EnableCrossrefs\CodelineIndex |
| 183 |
|
| 184 |
%** To produce a change history: add the following line for one run, |
| 185 |
%** then run makeindex -s gglo.ist -o natbib.gls natbib.glo |
| 186 |
%** and reprocess, with or without this line (faster without) |
| 187 |
%<driver>% \RecordChanges |
| 188 |
|
| 189 |
\DisableCrossrefs %May stay; zapped by \EnableCrossrefs |
| 190 |
\CodelineNumbered %May stay |
| 191 |
|
| 192 |
\begin{document} |
| 193 |
\DocInput{sublabel.dtx} |
| 194 |
\end{document} |
| 195 |
%</driver> |
| 196 |
%\fi |
| 197 |
% |
| 198 |
% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs} |
| 199 |
% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} |
| 200 |
% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} |
| 201 |
% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} |
| 202 |
% \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage} |
| 203 |
% \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions} |
| 204 |
% \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument} |
| 205 |
% \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError} |
| 206 |
% \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine} |
| 207 |
% \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak} |
| 208 |
% \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand} |
| 209 |
% \DoNotIndex{\newcommand,\renewcommand,\providecommand\newenvironment} |
| 210 |
% \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength} |
| 211 |
% \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi} |
| 212 |
% \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc} |
| 213 |
% \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph} |
| 214 |
% \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape} |
| 215 |
% \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe} |
| 216 |
% \DoNotIndex{\filename,\fileversion,\filedate,\let} |
| 217 |
% \DoNotIndex{\@@warning,\@bsphack,\@currenvir,\@eha,\@esphack,\@ifundefined} |
| 218 |
% \DoNotIndex{\@latexerr,\@nameuse,\@tempa,\@warning,\alph,\bf,\endcsname} |
| 219 |
% \DoNotIndex{\expandafter,\gdef,\global,\it,\newcount,\null,\relax,\thepage} |
| 220 |
% |
| 221 |
% \setcounter{IndexColumns}{2} |
| 222 |
% \setlength{\IndexMin}{10cm} |
| 223 |
% \setcounter{StandardModuleDepth}{1} |
| 224 |
% |
| 225 |
% \GetFileInfo{sublabel} |
| 226 |
% |
| 227 |
% \title{\bfseries A Package to Subnumber \LaTeX{} Counters} |
| 228 |
% |
| 229 |
% \author{Patrick W. Daly} |
| 230 |
% |
| 231 |
% \date{This paper describes package \texttt{\filename}\\ |
| 232 |
% version \fileversion{} from \filedate\\[1ex] |
| 233 |
% \textsl{It is part of the \texttt{preprint} collection of packages} |
| 234 |
% } |
| 235 |
% |
| 236 |
% \maketitle |
| 237 |
% |
| 238 |
% \pagestyle{myheadings} |
| 239 |
% \markboth{P. W. Daly}{SUBNUMBERING FIGURES, TABLES, EQUATIONS} |
| 240 |
% |
| 241 |
%^^A In order to keep all marginal notes on the one (left) side: |
| 242 |
%^^A (otherwise they switch sides disasterously with twoside option) |
| 243 |
% \makeatletter \@mparswitchfalse \makeatother |
| 244 |
% |
| 245 |
%\begin{small}\begin{center}\textbf{Summary}\end{center} |
| 246 |
% The stripped version of this file contains the following brief description: |
| 247 |
%\iffalse |
| 248 |
%<*package&!subpack> |
| 249 |
%\fi |
| 250 |
% \begin{verbatim} |
| 251 |
% To change a counter foo so that it has sublabels (4a 4b 4c ...) |
| 252 |
% give the command \sublabon{foo}... \sublaboff{foo} |
| 253 |
% |
| 254 |
% The style of the sublabel is given by command \substyle, which takes one |
| 255 |
% argument, a counter. It may be redefined in the document to be whatever |
| 256 |
% style is wanted. |
| 257 |
%<209> % Default is {\it\alph{#1}}, ie italic lowercase numbers. |
| 258 |
%<*!209> |
| 259 |
% Default is {\itshape\alph{#1}}, ie italic lowercase numbers. |
| 260 |
% |
| 261 |
% Options for LaTeX2e: |
| 262 |
% roman the style of sublabels is small roman letter |
| 263 |
% italic the style is small italic letter (default) |
| 264 |
%</!209> |
| 265 |
% \end{verbatim} |
| 266 |
%\iffalse |
| 267 |
%----------------------------------------------------------- |
| 268 |
%</package&!subpack> |
| 269 |
%\fi |
| 270 |
%\end{small} |
| 271 |
% |
| 272 |
% \section{Introduction} |
| 273 |
% The macros in this package allow all counters to be subnumbered, as for |
| 274 |
% example 4{\itshape a}, 4{\itshape b}, 4{\itshape c}, simply by |
| 275 |
% bracketting the objects to be so numbered with appropriate on/off |
| 276 |
% commands. These commands specify which counters are to be subnumbered, |
| 277 |
% and they are of global effect. This means that they will work with any |
| 278 |
% user-defined counters too, and that their effect goes beyond any current |
| 279 |
% environment. |
| 280 |
% |
| 281 |
% \section{Invoking the Package} |
| 282 |
% The macros in this package are included in the main document |
| 283 |
% with the |\usepackage| command of \LaTeXe, |
| 284 |
% \begin{quote} |
| 285 |
% |\documentclass[..]{...}|\\ |
| 286 |
% |\usepackage[|\emph{options}|]{|\texttt{\filename}|}| |
| 287 |
% \end{quote} |
| 288 |
% where the possible \emph{options} are: |
| 289 |
% \begin{description} |
| 290 |
% \item[\tt italic] to have subnumbers as italic lowercase letters |
| 291 |
% (default); |
| 292 |
% \item[\tt roman] to have the subnumbers as Roman lowercase letters, as |
| 293 |
% 4{\rmfamily a}. |
| 294 |
% \end{description} |
| 295 |
% |
| 296 |
% Alternatively, the name of the package is added as an option to the |
| 297 |
% |\documentstyle| command in \LaTeX~2.09 compatibility mode, as |
| 298 |
% \begin{quote} |
| 299 |
% |\documentstyle[..|\texttt{\filename}|..]{...}| |
| 300 |
% \end{quote} |
| 301 |
% In this case, no options are possible. |
| 302 |
% |
| 303 |
% \section{Usage} |
| 304 |
% \DescribeMacro{\sublabon} |
| 305 |
% \DescribeMacro{\sublaboff} |
| 306 |
% In order to number equations, figures, plates, and tables automatically |
| 307 |
% with subnumbers (e.g.\ 4{\itshape a}, 4{\itshape b}, 4{\itshape c}) use |
| 308 |
% the commands |\sublabon| and |\sublaboff|. These commands take as |
| 309 |
% argument the name of the counter that is to be subnumbered, i.e. |
| 310 |
% \texttt{equation}, \texttt{figure}, or \texttt{table}. The on and off |
| 311 |
% versions bracket the objects that are to be labelled with the same number |
| 312 |
% but different letters. For example, |
| 313 |
% |
| 314 |
% \begin{quote} |
| 315 |
% \begin{verbatim} |
| 316 |
% \sublabon{figure} |
| 317 |
% \begin{figure} |
| 318 |
% \caption{Text of Fig. 4a} |
| 319 |
% \end{figure} |
| 320 |
% \begin{figure} |
| 321 |
% \caption{Text of Fig. 4b} |
| 322 |
% \end{figure} |
| 323 |
% \sublaboff{figure} |
| 324 |
% \end{verbatim} |
| 325 |
% \end{quote} |
| 326 |
% |
| 327 |
% These commands also work for the |equation| environment in the same way. |
| 328 |
% For the |eqnarray| environment, some care must be taken. The |
| 329 |
% |\sublabon| command is to be given {\em in} the first equation to be |
| 330 |
% bracketted, before the |\label| and |\\| commands, while the |
| 331 |
% |\sublaboff| command is given after the |\\| of the last equation |
| 332 |
% in the group. If necessary, it must come after |\end{eqnarray}|. |
| 333 |
% \begin{quote} |
| 334 |
% \begin{verbatim} |
| 335 |
% \begin{eqnarray} |
| 336 |
% x & = & a \label{eq:x}\\%--> 1 |
| 337 |
% \sublabon{equation} |
| 338 |
% y & = & b \label{eq:y}\\%--> 2a |
| 339 |
% z & = & c \label{eq:z}\\%--> 2b |
| 340 |
% \sublaboff{equation} |
| 341 |
% w & = & d \label{eq:w} %--> 3 |
| 342 |
% \end{eqnarray} |
| 343 |
% \end{verbatim} |
| 344 |
% \end{quote} |
| 345 |
% |
| 346 |
% If two groups appear adjacently, it is only necessary to give |
| 347 |
% |\sublabon| between them. |
| 348 |
% |
| 349 |
% \DescribeMacro{\substyle} |
| 350 |
% The style in which the sublabels are written is determined by a command |
| 351 |
% |\substyle|. Its default definition is as italic lowercase |
| 352 |
% letters.\footnote{In \LaTeXe, if the option \texttt{roman} is added to |
| 353 |
% the \texttt{\bslash usepackage} command, then the default is upright |
| 354 |
% lowercase letters.} If |
| 355 |
% one wishes, this may be changed in the document itself. It must take an |
| 356 |
% argument that is a counter. For example, to change the style of sublabels |
| 357 |
% to be as 5--A, 5--B, 5--C, give |
| 358 |
% \begin{quote} |
| 359 |
% |\renewcommand{\substyle}[1]{--\Alph{#1}}| |
| 360 |
% \end{quote} |
| 361 |
% \section{Interference with Other Options} |
| 362 |
% If both |sublabel| and |figcaps| packages are to be used together, then |
| 363 |
% |sublabel| must be input first. This is because |
| 364 |
% |figcaps| makes modifications so that the sublabelling also works on the page |
| 365 |
% of figure captions. |
| 366 |
% |
| 367 |
% Other packages (like \texttt{amsmath}) also modify some of the commands |
| 368 |
% redefined here. As of version~4.4, the redefinitions are delayed until |
| 369 |
% after all packages are loaded, so that this conflict is avoided. For |
| 370 |
% earlier versions, things went wrong if \texttt{amsmath} were loaded after |
| 371 |
% \texttt{filename}. |
| 372 |
% |
| 373 |
% \StopEventually{\PrintIndex\PrintChanges} |
| 374 |
% |
| 375 |
% \section{Options with \texttt{docstrip}} |
| 376 |
% The source \texttt{.dtx} file is meant to be processed with |
| 377 |
% \texttt{docstrip}, for which a number of options are available: |
| 378 |
% \begin{description} |
| 379 |
% \item[\tt package] to produce a \texttt{.sty} package file with most |
| 380 |
% comments removed; |
| 381 |
% \item[\tt 209] for a package file that will also run under the older |
| 382 |
% \LaTeX~2.09 and not just under the newer (mid-1994) \LaTeXe; |
| 383 |
% \item[\tt subpack] (together with \texttt{package}) for coding that is to |
| 384 |
% be included inside a larger package; even more comments are removed, |
| 385 |
% as well as \LaTeXe{} option handling and identification; |
| 386 |
% \item[\tt agu] (with \texttt{package,subpack}) for special coding for |
| 387 |
% the \textsl{AGU$^{++}$} package; |
| 388 |
% \item[\tt driver] to produce a driver \texttt{.drv} file that will print |
| 389 |
% out the documentation under \LaTeXe. The documentation cannot be |
| 390 |
% printed under \LaTeX~2.09. |
| 391 |
% \end{description} |
| 392 |
% The source file \texttt{\filename.dtx} is itself a driver file and can |
| 393 |
% be processed directly by \LaTeXe. |
| 394 |
% |
| 395 |
% \section{The Coding} |
| 396 |
% This section presents and explains the actual coding of the macros. |
| 397 |
% It is nested between |%<*package>| and |%</package>|, which |
| 398 |
% are indicators to \texttt{docstrip} that this coding belongs to the package |
| 399 |
% file. |
| 400 |
% |
| 401 |
% The \texttt{docstrip} option |<subpack>| should only be called if the |
| 402 |
% coding is to be included as part of another package, in which case the |
| 403 |
% announcement text and \LaTeXe{} options are suppressed. |
| 404 |
% |
| 405 |
% An inferior version of this coding is provided for running as a |
| 406 |
% style file under \LaTeX~2.09. Code lines belonging to this are |
| 407 |
% indicated with guard |<209>|; those for LaTeXe{} only with |<!209>|. |
| 408 |
% |
| 409 |
% There is a problem if \texttt{\filename} is used with the package |
| 410 |
% \texttt{figcaps}, which makes modifications to the sublabelling |
| 411 |
% commands. Thus \texttt{\filename} must be read in \emph{before} |
| 412 |
% \texttt{figcaps}. This is tested with the existence of the command |
| 413 |
% |\iffigcaps|, which should not be defined at this point. |
| 414 |
% \begin{macrocode} |
| 415 |
%<*package> |
| 416 |
\@ifundefined{iffigcaps}{} |
| 417 |
%<*!209> |
| 418 |
{\PackageWarningNoLine{sublabel} |
| 419 |
{***********************************\MessageBreak |
| 420 |
This package read in after `figcaps'\MessageBreak |
| 421 |
There could be problems with sublabelled\MessageBreak |
| 422 |
figure and table numbers.\MessageBreak |
| 423 |
***********************************}} |
| 424 |
%</!209> |
| 425 |
%<*209> |
| 426 |
{\@@warning |
| 427 |
{^^J ********************************^^J |
| 428 |
`sublabel' read in after `figcaps'^^J |
| 429 |
There could be problems with sublabelled^^J |
| 430 |
figure and table numbers.^^J |
| 431 |
********************************}} |
| 432 |
%</209> |
| 433 |
% \end{macrocode} |
| 434 |
% |
| 435 |
% \begin{macro}{\substyle} |
| 436 |
% \changes{4.3d}{1997 Mar 16}{Remove some superfluous lines} |
| 437 |
% The style of the sublabel, or subnumbering, is defined by |\substyle|. A |
| 438 |
% default definition is provided as italic lowercase letters: 4{\itshape |
| 439 |
% a}, 4{\itshape b}, 4{\itshape b}, etc. This command may be redefined by |
| 440 |
% the user in the document or in a calling style. |
| 441 |
% |
| 442 |
% For the \textsl{AGU$^{++}$} package, the default is upright letters. |
| 443 |
% |
| 444 |
% \begin{macrocode} |
| 445 |
\newcommand{\substyle}{} |
| 446 |
%<*!subpack> |
| 447 |
%<209>\def\substyle#1{\it\alph{#1}} |
| 448 |
% \end{macrocode} |
| 449 |
% |
| 450 |
% \begin{macro}{\DeclareOption} |
| 451 |
% \changes{4.3}{1994 May 16}{Add options \texttt{roman} and \texttt{italic}.} |
| 452 |
% \changes{4.3c}{1995 Sep 18}{Fix options \texttt{roman} and \texttt{italic} |
| 453 |
% for kernel changes of 1995/06/01} |
| 454 |
% In \LaTeXe, the default depends on the option in the |\usepackage| command. |
| 455 |
% |
| 456 |
% Prior to \LaTeX\ of 1995/06/01, one needed |##| to specify arguments in the |
| 457 |
% |\DeclareOption| statement, but now only a single |#| is needed. |
| 458 |
% \begin{macrocode} |
| 459 |
%<*!209> |
| 460 |
\DeclareOption{italic}{\def\substyle#1{\itshape\alph{#1}}} |
| 461 |
\DeclareOption{roman}{\def\substyle#1{\alph{#1}}} |
| 462 |
\ExecuteOptions{italic} |
| 463 |
\ProcessOptions |
| 464 |
%</!209> |
| 465 |
%</!subpack> |
| 466 |
%<subpack&!agu&209>\def\substyle#1{\it\alph{#1}} |
| 467 |
%<subpack&!agu&!209>\def\substyle#1{\itshape\alph{#1}} |
| 468 |
%<subpack&agu>\def\substyle#1{\alph{#1}} |
| 469 |
% \end{macrocode} |
| 470 |
% \end{macro}\end{macro} |
| 471 |
% |
| 472 |
% \begin{macro}{\sublabon} |
| 473 |
% \changes{4.3a}{1994 Jun 22}{Use \cs{newcommand}} |
| 474 |
% The basic principle of this macro is that when |\sublabon{|\emph{ctr}|}| |
| 475 |
% is called, then a new counter called |sb@|\emph{ctr} is created, if it |
| 476 |
% does not already exist. That is, its internal name is |\c@sb@|\emph{ctr}, |
| 477 |
% as is standard for \LaTeX{} counters. Its value is set to $0$ and the main |
| 478 |
% counter \emph{ctr} is incremented. The command that formats and prints |
| 479 |
% out the value of the main counter, |\the|\emph{ctr} is redefined to be |
| 480 |
% \begin{quote} |
| 481 |
% |\@ldthe|\emph{ctr}|{\substyle{sb@|\emph{ctr}|}}| |
| 482 |
% \end{quote} |
| 483 |
% where |\@ldthe|\emph{ctr} is the stored definition |\the|\emph{ctr} and |
| 484 |
% |\substyle| is a command that operates on a counter to format it. |
| 485 |
% |
| 486 |
% First |\sublabon| tests if there really is a counter with the given |
| 487 |
% name. |
| 488 |
% \begin{macrocode} |
| 489 |
\newcommand{\sublabon}[1]{\@bsphack |
| 490 |
\@ifundefined{c@#1}{% |
| 491 |
%<209> \@latexerr |
| 492 |
%<!209> \PackageError{sublabel} |
| 493 |
{\protect\sublabon\space called for a non-existent counter}{\@eha}} |
| 494 |
% \end{macrocode} |
| 495 |
% Now test for the subcounter |sb@|\emph{ctr} and if it does not exist, |
| 496 |
% create it and set its value to $-1$. |
| 497 |
% \begin{macrocode} |
| 498 |
{\@ifundefined{c@sb@#1}{\expandafter\newcount\csname c@sb@#1\endcsname |
| 499 |
\setcounter{sb@#1}{-1}}{}% |
| 500 |
% \end{macrocode} |
| 501 |
% The value $-1$ means that the subcounter has not yet been used. This |
| 502 |
% value is set on creation, or by |\sublaboff| if the subcounter was never |
| 503 |
% stepped. This is the trick that allows multiple calls to |\sublabon| |
| 504 |
% without intervening |\sublaboff| calls. We have to avoid calling |
| 505 |
% |\sublaboff| when there was no stepping. Call it only if the current |
| 506 |
% value of the subcounter is 0 or more. |
| 507 |
% \begin{macrocode} |
| 508 |
\ifnum\@nameuse{c@sb@#1}<0\else\sublaboff{#1}\fi |
| 509 |
% \end{macrocode} |
| 510 |
% Set the counters \emph{ctr} and |sb@|\emph{ctr}. |
| 511 |
% \begin{macrocode} |
| 512 |
\stepcounter{#1}% |
| 513 |
\setcounter{sb@#1}{0}% |
| 514 |
% \end{macrocode} |
| 515 |
% A correction must be made for the |eqnarray| environment which |
| 516 |
% increments the |equation| counter immediately on entry and then after |
| 517 |
% each equation. That is, the |equation| counter already holds the value of |
| 518 |
% the \emph{next} equation. Thus we must set the two counters to the |
| 519 |
% values that they should have for the next equation. For example, let us |
| 520 |
% suppose the following: |
| 521 |
% \begin{quote} |
| 522 |
% We are outside the |eqnarray| environment, the last equation was |
| 523 |
% number~3, so the |equation| counter has the value |3|. |
| 524 |
% |
| 525 |
% We enter |eqnarray|; the |equation| counter is incremented immediately to |
| 526 |
% |4|. |
| 527 |
% |
| 528 |
% We write an equation; it obtains the number~4, and |equation| goes to |
| 529 |
% |5|. |
| 530 |
% |
| 531 |
% We call |\sublabon{equation}|, and |equation| is set to |6| and |
| 532 |
% |sb@equation| to |0| (so far). Since the counter is stepped only |
| 533 |
% \emph{after} the equation in this environment, this would mean that the next |
| 534 |
% equation would be numbered 6-0 instead of the desired 5-1. |
| 535 |
% |
| 536 |
% Hence the correction: decrement |equation| and set |sb@equation| to 1. |
| 537 |
% \end{quote} |
| 538 |
% \begin{macrocode} |
| 539 |
\def\@tempa{eqnarray}\ifx \@tempa\@currenvir |
| 540 |
\addtocounter{equation}{-1}\setcounter{sb@equation}{1}\fi |
| 541 |
% \end{macrocode} |
| 542 |
% Note that the above does not test if |#1| really is |equation|. However, |
| 543 |
% if |\sublabon| is used within |eqnarray|, then it only makes sense to |
| 544 |
% subnumber equations. |
| 545 |
% |
| 546 |
% Now save the definition of |\the|\emph{ctr} as |\@ldthe|\emph{ctr}. |
| 547 |
% (This combination of |\expandafter| is necessary. I have experimented |
| 548 |
% with many other variations.) |
| 549 |
% \begin{macrocode} |
| 550 |
\global\expandafter\let\csname @ldthe#1\expandafter\endcsname |
| 551 |
\csname the#1\endcsname |
| 552 |
% \end{macrocode} |
| 553 |
% and redefine |\the|\emph{ctr} to add |\substyle| with the subcounter. |
| 554 |
% \begin{macrocode} |
| 555 |
\expandafter\gdef\csname the#1\endcsname{% |
| 556 |
\@nameuse{@ldthe#1}{\substyle{sb@#1}}} |
| 557 |
}\@esphack} |
| 558 |
% \end{macrocode} |
| 559 |
% \end{macro} |
| 560 |
% |
| 561 |
% \begin{macro}{\sublaboff} |
| 562 |
% \changes{4.3a}{1994 Jun 22}{Use \cs{newcommand}} |
| 563 |
% The command that turns off the sublabelling tests if there is such a |
| 564 |
% counter, and if there exists a subcounter for it. If both tests pass, |
| 565 |
% then it checks that the subcounter has a non-negative value, for if it |
| 566 |
% does not, then there was no corresponding |\sublabon| command. That is, |
| 567 |
% the on/off commands are not nested properly. These tests are necessary to |
| 568 |
% check for typing errors. |
| 569 |
% \begin{macrocode} |
| 570 |
\newcommand{\sublaboff}[1]{\@bsphack |
| 571 |
\@ifundefined{c@#1}{% |
| 572 |
%<209> \@latexerr |
| 573 |
%<!209> \PackageError{sublabel} |
| 574 |
{\protect\sublaboff\space called for a non-existent counter}{\@eha}} |
| 575 |
{\@ifundefined{c@sb@#1}{% |
| 576 |
%<209> \@warning |
| 577 |
%<!209> \PackageWarning{sublabel} |
| 578 |
{\protect\sublaboff{#1} called without any previous |
| 579 |
%<209> ^^J |
| 580 |
%<!209> \MessageBreak |
| 581 |
\protect\sublabon{#1} command}} |
| 582 |
{\ifnum\@nameuse{c@sb@#1}<0 |
| 583 |
%<209> \@warning |
| 584 |
%<!209> \PackageWarning{sublabel} |
| 585 |
{\protect\sublaboff{#1} called without a previous |
| 586 |
%<209> ^^J |
| 587 |
%<!209> \MessageBreak |
| 588 |
\protect\sublabon{#1} command being active}\else |
| 589 |
% \end{macrocode} |
| 590 |
% However, if the subcounter has a 0 value, then |\sublabon| was indeed |
| 591 |
% called, but the counter was never stepped with |\stepcounter|. This is |
| 592 |
% not an error, but it means that the old value of \emph{ctr} should be |
| 593 |
% restored. The subcounter is set to $-1$ to indicate this to the next |
| 594 |
% call to |\sublabon|. The numbering goes on as if |\sublabon| and |
| 595 |
% |\sublaboff| had never been given. |
| 596 |
% \begin{macrocode} |
| 597 |
\ifnum\@nameuse{c@sb@#1}=0\addtocounter{#1}{-1}\fi |
| 598 |
\setcounter{sb@#1}{-1}% |
| 599 |
% \end{macrocode} |
| 600 |
% Re-establish the definition of |\the|\emph{ctr} stored in |
| 601 |
% |\@ldthe|\emph{ctr}. |
| 602 |
% \begin{macrocode} |
| 603 |
\global\expandafter\let\csname the#1\expandafter\endcsname |
| 604 |
\csname @ldthe#1\endcsname |
| 605 |
% \end{macrocode} |
| 606 |
% Finally, if |\sublaboff| is called within the |eqnarray| environment, |
| 607 |
% then the |equation| counter must be corrected again, to hold the number |
| 608 |
% for the next equation. |
| 609 |
% \begin{macrocode} |
| 610 |
\def\@tempa{eqnarray}\ifx \@tempa\@currenvir |
| 611 |
\stepcounter{equation}\fi |
| 612 |
\fi}}\@esphack} |
| 613 |
% \end{macrocode} |
| 614 |
% \end{macro} |
| 615 |
% |
| 616 |
% \begin{macro}{\ref} |
| 617 |
% \changes{4.3}{1994 May 16}{Use definition from \LaTeXe{} for NFSS with 2.09} |
| 618 |
% \begin{macro}{\pageref} |
| 619 |
% \changes{4.3}{1994 May 16}{Use definition from \LaTeXe{} for NFSS with 2.09} |
| 620 |
% |
| 621 |
% The font command within |\substyle| means that it is transferred to the |
| 622 |
% auxiliary file in a |\newlabel| command. This causes problems under the |
| 623 |
% New Font Selection Scheme (NFSS) when all the tokens are expanded too |
| 624 |
% early. This problem does not exist with \LaTeX~2.09 without NFSS, nor |
| 625 |
% with the NFSS in \LaTeXe. To get around this, I add the revised |
| 626 |
% definitions of |\ref| and |\pageref| from \LaTeXe, but implement them |
| 627 |
% only for NFSS under 2.09. |
| 628 |
% \begin{macrocode} |
| 629 |
%<*209> |
| 630 |
\@ifundefined{selectfont}{}{% |
| 631 |
\def\@setref#1#2#3{% |
| 632 |
\ifx#1\relax {\reset@font\bf ??}% |
| 633 |
\@warning{Reference `#3' on page \thepage \space undefined}% |
| 634 |
\else |
| 635 |
\expandafter#2#1\null |
| 636 |
\fi} |
| 637 |
\def\ref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}} |
| 638 |
\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname |
| 639 |
\@secondoftwo{#1}} |
| 640 |
\def\@firstoftwo#1#2{#1} |
| 641 |
\def\@secondoftwo#1#2{#2} |
| 642 |
} |
| 643 |
% \end{macrocode} |
| 644 |
% \end{macro}\end{macro} |
| 645 |
% |
| 646 |
% \begin{macro}{\reset@font} |
| 647 |
% For older implementations of \LaTeX~2.09 (before December, 1991) the |
| 648 |
% |\reset@font| command does not exist. It is defined to be |\relax| under |
| 649 |
% normal \LaTeX{}, but does more under NFSS. In case it is not defined, add |
| 650 |
% it here. |
| 651 |
% \begin{macrocode} |
| 652 |
\@ifundefined{reset@font}{\def\reset@font{\relax}}{} |
| 653 |
%</209> |
| 654 |
% \end{macrocode} |
| 655 |
% \end{macro} |
| 656 |
% |
| 657 |
% \begin{macro}{\stepcounter} |
| 658 |
% \changes{4.3a}{1994 Jun 22}{Use \cs{renewcommand}} |
| 659 |
% \changes{4.4}{1997 Apr 28}{Put into \cs{AtBeginDocument}} |
| 660 |
% A very important matter has still to be done: redefine |\stepcounter| so |
| 661 |
% that it increments the subcounter and not the main one. It is not |
| 662 |
% necessary to redefine |\refstepcounter| since it calls |\stepcounter| |
| 663 |
% itself. The existing definition of |\stepcounter| is saved and used in |
| 664 |
% the new definition. |
| 665 |
% |
| 666 |
% This is done at the start of the document, not immediately, in case some |
| 667 |
% other package is loaded that alters |\setcounter|. This also applies to |
| 668 |
% |\addtocounter| and |\endeqnarray|. For example, the \texttt{amsmath} |
| 669 |
% package makes such changes, so if it is loaded after \texttt{\filename} |
| 670 |
% it clobbers these new definitions if they are not delayed. (This used to |
| 671 |
% happen when \textsl{AGU$^{++}$} is used with \texttt{amsmath}.) |
| 672 |
% Do this only for \LaTeXe. |
| 673 |
% |
| 674 |
% \begin{macrocode} |
| 675 |
%<!209>\AtBeginDocument{% |
| 676 |
\let\@ldstepcounter=\stepcounter |
| 677 |
\renewcommand{\stepcounter}[1] |
| 678 |
{\@ifundefined{c@sb@#1}{\@ldstepcounter{#1}}{\ifnum |
| 679 |
\@nameuse{c@sb@#1}<0\relax |
| 680 |
\@ldstepcounter{#1}\else \@ldstepcounter{sb@#1}\fi}% |
| 681 |
} |
| 682 |
% \end{macrocode} |
| 683 |
% \end{macro} |
| 684 |
% |
| 685 |
% \begin{macro}{\addtocounter} |
| 686 |
% \changes{4.2}{1993 Dec 17}{Add to allow for macros that might fiddle with |
| 687 |
% counters} |
| 688 |
% \changes{4.3a}{1994 Jun 22}{Use \cs{renewcommand}} |
| 689 |
% \changes{4.4}{1997 Apr 28}{Put into \cs{AtBeginDocument}} |
| 690 |
% A similar refinement must be done to |\addtocounter| to allow for any |
| 691 |
% macros that fiddle with counters. (The \texttt{planotable} environment of |
| 692 |
% the AGU styles does this, for example.) If the fiddling is done |
| 693 |
% explicitly (by giving |\c@|\emph{ctr} a new value) then we are lost. |
| 694 |
% It might also be necessary to refine |\setcounter|, but at the moment I |
| 695 |
% cannot foresee any reason for using that command where sublabels might be |
| 696 |
% used. |
| 697 |
% \begin{macrocode} |
| 698 |
\let\@ldaddtoctr=\addtocounter |
| 699 |
\renewcommand{\addtocounter}[2] |
| 700 |
{\@ifundefined{c@sb@#1}{\@ldaddtoctr{#1}{#2}}{\ifnum |
| 701 |
\@nameuse{c@sb@#1}<0\relax |
| 702 |
\@ldaddtoctr{#1}{#2}\else \@ldaddtoctr{sb@#1}{#2}\fi}% |
| 703 |
} |
| 704 |
% \end{macrocode} |
| 705 |
% \end{macro} |
| 706 |
% |
| 707 |
% \begin{macro}{\endeqnarray} |
| 708 |
% Lastly, the |eqnarray| environment itself must be altered to allow for |
| 709 |
% the case where it is ended while |\sublabon{equation}| is |
| 710 |
% active. (The example above was for when |\sublabon| is given within the |
| 711 |
% environment.) The normal |\endeqnarray| command explicitly decrements the |
| 712 |
% |equation| counter (not with |\stepcounter|) so that it now points to the |
| 713 |
% last equation, as usual. However if the subnumbering is on at this point, |
| 714 |
% the |equation| must be re-incremented and |sb@equation| decremented |
| 715 |
% instead. |
| 716 |
% \changes{4.2a}{1994 Feb 25}{Use original \cs{addtocounter}} |
| 717 |
% \changes{4.3a}{1994 Jun 22}{Use \cs{renewcommand}} |
| 718 |
% \changes{4.4}{1997 Apr 28}{Put into \cs{AtBeginDocument}} |
| 719 |
% \begin{macrocode} |
| 720 |
\let\@ldendeqnarray=\endeqnarray |
| 721 |
\renewcommand{\endeqnarray}{\@ldendeqnarray |
| 722 |
\@ifundefined{c@sb@equation}{}{\ifnum\c@sb@equation<0\else |
| 723 |
\@ldaddtoctr{equation}{1}\@ldaddtoctr{sb@equation}{-1}\fi}} |
| 724 |
%<!209>} |
| 725 |
%</package> |
| 726 |
% \end{macrocode} |
| 727 |
% \end{macro} |
| 728 |
% |
| 729 |
% \Finale |