% \iffalse THIS IS A META-COMMENT %<*dtx> \ProvidesFile %======================================================================== {APPENDIX.DTX} %======================================================================== % %% Copyright 1993-2005 Patrick W Daly %% Max-Planck-Institut f\"ur Aeronomie %% Max-Planck-Str. 2 %% D-37191 Katlenburg-Lindau %% Germany %% E-mail: daly@linmpi.mpg.de % % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % % This is a contributed file to the LaTeX2e system. % ------------------------------------------------- % This is a LaTeX package to make the appendix in an article subnumber % figures, equations, tables, and possibly plates. % Installation: % LaTeX this file: creates docstrip installation file appendix.ins % AND the (LaTeX2e) documentation % (La)TeX appendix.ins: creates package files appendix.sty, and optionally % documentation driver appendix.drv % (appendix.ins may be edited as needed) % Docstrip options available: % package - to produce a (LaTeX2e) package .sty file % plates - to add plates to the subnumbered counters % driver - to produce a driver file to print the documentation % 209 - (with package) for package that runs under LaTeX 2.09 % subpack - (with package) for coding included in other packages % agu - (with package,subpack) for inclusion in aguplus package % egs - (with package,subpack) for inclusion in egs package %-------------------------------------------------------------------------- %<*!subpack> %\def\ProvidesPackage#1#2] % {\typeout{Style option `#1'#2]}} % % *** Identify the package file:- %\NeedsTeXFormat{LaTeX2e}[1994/06/01] %\ProvidesPackage{appendix} % % % *** Provide command to dislay module version %\def\ModuleVersion#1[#2]{} % \ModuleVersion{appendix} % % *** Identify the driver file:- %\NeedsTeXFormat{LaTeX2e} %\ProvidesFile{appendix.drv} % % *** The DATE, VERSION, and other INFO %\fi %\ProvidesFile{appendix} [2005/10/30 2.2 (PWD)] % \changes{1.0}{1993 Oct 20}{First release.} % \changes{1.1}{1993 Nov 20}{Add specific coding for new AGU supplement} % \changes{2.0}{1994 May 17}{Convert to \LaTeXe.} % \changes{2.0a}{1994 Jun 22}{Update to first official release of \LaTeXe} % \changes{2.0b}{1995 Jan 3}{Update documentation to PWD standard} % \changes{2.0c}{1996 Jun 27}{Change \texttt{nlinproc} option to \texttt{egs}} % \changes{2.0d}{1996 Oct 15}{Change for EGS \texttt{inbook} option} % \changes{2.0e}{1997 Mar 16}{Fix copyright with subpack} % \changes{2.0f}{1997 Apr 29}{Conform to new \texttt{docstrip}} % \changes{2.1}{1999 Feb 23}{Update copyright notice} % \changes{2.2}{2005 Oct 30}{Fix new definition of \cs{@Alph} to fit in with current \LaTeX} % % \CheckSum{201} % \CharacterTable % {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 % 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 % Digits \0\1\2\3\4\5\6\7\8\9 % Exclamation \! Double quote \" Hash (number) \# % Dollar \$ Percent \% Ampersand \& % Acute accent \' Left paren \( Right paren \) % Asterisk \* Plus \+ Comma \, % Minus \- Point \. Solidus \/ % Colon \: Semicolon \; Less than \< % Equals \= Greater than \> Question mark \? % Commercial at \@ Left bracket \[ Backslash \\ % Right bracket \] Circumflex \^ Underscore \_ % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} % % \iffalse %<*install> %^^A ============================================= %^^A Here is the docstrip installation file %^^A It is written on first LaTeX run if it %^^A does not already exist %^^A ============================================= \begin{filecontents*}{appendix.ins} % File: appendix.ins % Copyright 1999 Patrick W. Daly % % This file can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % % It is an installation file for extracting package and driver % files from the original source file. Simply process it under % TeX or LaTeX. \input docstrip \preamble ============================================= IMPORTANT NOTICE: This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version. This is a generated file. It may not be distributed without the original source file \inFileName. Full documentation can be obtained by LaTeXing that original file. Only a few abbreviated comments remain here to describe the usage. ============================================= \endpreamble \postamble <<<<< End of generated file <<<<<< \endpostamble \declarepreamble\driver ============================================ This is the driver file to produce the LaTeX documentation from the original source file \inFileName. Make changes to it as needed. (Never change the file \inFileName!) ============================================ \endpreamble \declarepostamble\driverq End of documentation driver file. \endpostamble \keepsilent \askforoverwritefalse \generate{\file{appendix.sty}{\from{appendix.dtx}{package}} \file{appendix.drv}{\usepreamble\driver\usepostamble\driverq \from{appendix.dtx}{driver}} } \obeyspaces \Msg{*******************************************}% \Msg{* For documentation, process appendix.dtx *}% \Msg{* or the driver file appendix.drv *}% \Msg{*******************************************} \endbatchfile \end{filecontents*} % %<*driver> \documentclass{ltxdoc} %%\documentclass[twoside]{ltxdoc} %%\documentclass[a4paper]{ltxdoc} %%\documentclass[twoside,a4paper]{ltxdoc} \raggedbottom %** To include the detailed explanation of the coding, comment out %** the next line \OnlyDescription %** To produce a command index: add the following line for one run, %** then run makeindex -s gind.ist natbib %** and reprocess, with or without this line (much faster without) %% \EnableCrossrefs\CodelineIndex %** To produce a change history: add the following line for one run, %** then run makeindex -s gglo.ist -o appendix.gls appendix.glo %** and reprocess, with or without this line (faster without) %% \RecordChanges \DisableCrossrefs %May stay; zapped by \EnableCrossrefs \CodelineNumbered %May stay \begin{document} \DocInput{appendix.dtx} \end{document} % %\fi % % \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs} % \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} % \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} % \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} % \DoNotIndex{\LoadClass,\PassOptionsToClass,\PassOptionsToPackage} % \DoNotIndex{\DeclareOption,\CurrentOption,\ProcessOptions,\ExecuteOptions} % \DoNotIndex{\AtEndOfClass,\AtEndOfPackage,\AtBeginDocument,\AtEndDocument} % \DoNotIndex{\InputIfFileExists,\IfFileExists,\ClassError,\PackageError} % \DoNotIndex{\ClassWarning,\PackageWarning,\ClassWarningNoLine} % \DoNotIndex{\PackageWarningNoLine,\ClassInfo,\PackageInfo,\MessageBreak} % \DoNotIndex{\space,\protect,\DeclareRobustCommand,\CheckCommand} % \DoNotIndex{\newcommand,\renewcommand,\providecommand,\newenvironment} % \DoNotIndex{\renewenvironment,\newif,\newlength,\newcounter,\setlength} % \DoNotIndex{\setcounter,\if,\ifx,\ifcase,\ifnum,\ifdim,\else,\fi} % \DoNotIndex{\texttt,\textbf,\textrm,\textsl,\textsc} % \DoNotIndex{\textup,\textit,\textmd,\textsf,\emph} % \DoNotIndex{\ttfamily,\rmfamily,\sffamily,\mdseries,\bfseries,\upshape} % \DoNotIndex{\slshape,\scshape,\itshape,\em,\LaTeX,\LaTeXe} % \DoNotIndex{\filename,\fileversion,\filedate,\let} % \DoNotIndex{\@@warning,\@Ialph,\@empty,\@ifundefined,\@startsection} % \DoNotIndex{\arabic,\bf,\gdef,\global,\noindent,\normalsize,\or} % \DoNotIndex{\par,\relax,\unskip,\z@} % % \setcounter{IndexColumns}{2} % \setlength{\IndexMin}{10cm} % \setcounter{StandardModuleDepth}{1} % % \GetFileInfo{appendix} % % \title{\bfseries Appendices with Subnumbered Figures, Equations, Tables} % % \author{Patrick W. Daly} % % \date{This paper describes package \texttt{\filename}\\ % version \fileversion{} from \filedate\\[1ex] % \textsl{It is part of the \texttt{preprint} collection of packages} % } % % \maketitle % % \pagestyle{myheadings} % \markboth{P. W. Daly}{APPENDICES WITH SUBNUMBERED FIGURES, ETC.} % %^^A In order to keep all marginal notes on the one (left) side: %^^A (otherwise they switch sides disasterously with twoside option) % \makeatletter \@mparswitchfalse \makeatother % %\begin{small}\begin{center}\textbf{Summary}\end{center} % The stripped version of this file contains the following brief description: %\iffalse %<*package&!subpack> %\fi % \begin{verbatim} % Adding this package redefines \appendix so that main counters for % figures, tables, equations are subnumbered under the appendix. % % The plate counter is also subnumbered. % A \noappendix command is included so that things like bibliographies % may be called after the appendix with \section*. It resets the sectioning % commands. There should be no \section commands after this though. % % The appendix is formatted for AGU journals. % % The appendix is formatted for EGS journals. %<*!209> % % LaTeX2e options: % mylang (default) -> keeps current \appendixname % english, american -> sets \appendixname to `Appendix' % german, austrian, french, esperanto -> translates \appendixname % blank -> suppresses the word `Appendix' with \appendix % Options processed in order given, default is mylang (no change) % % \end{verbatim} %\iffalse %----------------------------------------------------------- % %\fi %\end{small} % % \section{Introduction} % The appendices in standard \LaTeX{} \texttt{article} class are fairly % weak. There is no title for them and the numbering of figures, equations, % etc.\ continue as normal within them. In \texttt{book} and \texttt{report} % things are different, but that is because these objects are subnumbered % under the chapters anyway. % % \section{Invoking the Package} % The macros in this package are included in the main document % with the |\usepackage| command of \LaTeXe, % \begin{quote} % |\documentclass[..]{...}|\\ % |\usepackage[|\emph{options}|]{|\texttt{\filename}|}| % \end{quote} % where the possible \emph{options} are described below. % % Alternatively, the name of the package is added as an option to the % |\documentstyle| command in \LaTeX~2.09 compatibility mode, as % \begin{quote} % |\documentstyle[..|\texttt{\filename}|..]{...}| % \end{quote} % % \DescribeMacro{\appendix} % With the package loaded, the standard command |\appendix| is redefined % accordingly. There is really nothing more to do. % % \DescribeMacro{\noappendix} % An additional command also exists, |\noappendix| to undo the effects of % |\appendix|. This only makes sense for certain listings like % |thebibliography| environment that use |\section*| after the appendix. % There really should be no figures, etc.\ called after |\noappendix| is % given, nor any |\section| commands. It is only provided for |\section*|, % and then only when |\appendix| has altered the sectioning commands so % that they print text (the word `Appendix' for example) even with the % starred version. % % \section{Extra Features} % In its default coding, \texttt{\filename} not only subnumbers figures, tables, % and equations within appendices, it also writes the word `Appendix' % when |\appendix| is called. This is done with |\section*|, so it will be % formatted accordingly. The appendix titles that are printed with % |\section| consist of the appendix letter plus title, as in standard % \LaTeX. The |\section| command is not redefined. The subappendices (with % |\subsection|) are numbered without the dot, as A1, A2, etc. This deviates % from standard \LaTeX. % % \DescribeMacro{\appendixname} % In fact, it is the command |\appendixname| that is printed as a title % when |\appendix| is issued. This text may be redefined with % |\renewcommand| as one pleases. If it is defined to be blank, then no % title is printed, not even a blank line. (See Section~\ref{opts2e} for % other ways of changing this text.) % % \section{\LaTeXe{} Options}\label{opts2e} % Under \LaTeXe, \emph{options} may be added to the |\usepackage| command % that loads the package. The available options with this package alter the % default definition of |\appendixname| for other languages. % \begin{description} % \item[\tt mylang] (default) keeps the current value of |\appendixname|, or % if it is undefined, sets it to `Appendix'; % \item[\tt english, american] set |\appendixname| unconditionally to % `Appendix'; % \item[\tt german, austrian, french, esperanto] set |\appendixname| to the % translation of the given language; % \item[\tt blank] suppresses the printing of the appendix title with the % |\appendix| command. % \end{description} % The options are processed in the order they are given, so it is the last one % always dominates. % % Of course, it is always possible to redefine |\appendixname| to any % desired text, even in \LaTeX~2.09. % % \StopEventually{\PrintIndex\PrintChanges} % % \section{Options with \texttt{docstrip}} % It is also intended that this package be included in the package coding % for particular journals, in which case the form of the appendix may be % different. Some of the \texttt{docstrip} options in the source % \texttt{.dtx} file account for this. These and other \texttt{docstrip} % options are: % \begin{description} % \item[\tt package] to produce a \texttt{.sty} package file with most % comments removed; % \item[\tt plates] to subnumber the \texttt{plate} counter as well; the % float environment for plates must be defined elsewhere; % \item[\tt 209] for a package file that will also run under the older % \LaTeX~2.09 and not just under the newer (mid-1994) \LaTeXe; % \item[\tt subpack] (together with \texttt{package}) for coding that is to % be included inside a larger package; even more comments are removed, % as well as \LaTeXe{} option handling and identification; % \item[\tt agu] (with \texttt{package,subpack}) for special coding for % the \textsl{AGU$^{++}$} package; % \item[\tt egs] (with \texttt{package,subpack}) for special coding for % journals of the European Geophysical Society; % \item[\tt driver] to produce a driver \texttt{.drv} file that will print % out the documentation under \LaTeXe. The documentation cannot be % printed under \LaTeX~2.09. % \end{description} % The source file \texttt{\filename.dtx} is itself a driver file and can % be processed directly by \LaTeXe. % % \section{The Coding} % This section presents and explains the actual coding of the macros. % It is nested between |%<*package>| and |%|, which % are indicators to \texttt{docstrip} that this coding belongs to the package % file. % % The \texttt{docstrip} option || should only be called if the % coding is to be included as part of another package, in which case the % announcement text and \LaTeXe{} options are suppressed. % % An inferior version of this coding is provided for running as a % style file under \LaTeX~2.09. Code lines belonging to this are % indicated with guard |<209>|; those for LaTeXe{} only with ||. % % There is a problem if \texttt{\filename} is used with the package % \texttt{figcaps}, which makes modifications to the sublabelling % commands. Thus \texttt{\filename} must be read in \emph{before} % \texttt{figcaps}. This is tested with the existence of the command % |\iffigcaps|, which should not be defined at this point. % \begin{macrocode} %<*package> \@ifundefined{iffigcaps}{} %<*!209> {\PackageWarningNoLine{appendix} {***********************************\MessageBreak This package read in after `figcaps'\MessageBreak There could be problems with sublabelled\MessageBreak figure and table numbers.\MessageBreak ***********************************}} % %<*209> {\@@warning {^^J ********************************^^J `appendix' read in after `figcaps'^^J There could be problems with sublabelled^^J figure and table numbers.^^J ********************************}} % % \end{macrocode} % % \begin{macro}{\appendixname} % We start by defining the word for `Appendix' as a command so that it may % be altered for other languages. It is possible that it has already been % defined or even redefined, so it is only defined here if it does not exist % already. % \begin{macrocode} %<209>\@ifundefined{appendixname}{\def\appendixname{Appendix}}{} %\providecommand{\appendixname}{Appendix} % \end{macrocode} % % \begin{macro}{\DeclareOption} % \changes{2.0}{1994 May 17}{Add language and suppression options for % \LaTeXe} % In \LaTeXe, the initial value of |\appendixname| can be set with options % to the |\usepackage| command. They are processed in the order given, not % in the order defined (starred version of |\ProcessOptions|). % \begin{macrocode} %<*!subpack&!209> \DeclareOption{english}{\def\appendixname{Appendix}} \DeclareOption{american}{\def\appendixname{Appendix}} \DeclareOption{german}{\def\appendixname{Anhang}} \DeclareOption{austrian}{\def\appendixname{Anhang}} \DeclareOption{french}{\def\appendixname{Annexe}} \DeclareOption{esperanto}{\def\appendixname{Apendico}} \DeclareOption{blank}{\def\appendixname{}} \DeclareOption{mylang}{\providecommand{\appendixname}{Appendix}} \ExecuteOptions{mylang} \ProcessOptions* % % \end{macrocode} % \end{macro}\end{macro} % %\begin{macro}{\appendix} % \changes{1.1}{1993 Nov 20}{Special coding for AGU, replacing obsolete JGR % and GRL} % \changes{2.0}{1994 May 17}{Suppress \cmd{\section*} if \cmd{\appendixname} % is blank.} % Begin the definition of |\appendix|. Print out the |\appendixname| as a % |\section*| if it is not blank (but not for the specific journals). % \begin{macrocode} \let\orisection=\section \let\theolds=\thesection \let\theoldss=\thesubsection %\let\orisubsection=\subsection \def\appendix{\par %<*!agu&!egs> \if\@empty\appendixname \else \section*{\appendixname} \fi % % \end{macrocode} % Set the |section| and |subsection| counters to zero. I do not know why % |subsection| needs to be reset, but this is actually standard \LaTeX. I % can only imagine it being useful if someone calls |\subsection| first % before |\section| after |\appendix|. I maintain it anyway. % \begin{macrocode} \setcounter{section}{0} \setcounter{subsection}{0} % \end{macrocode} % Redefine |\thesection| to be alphabetical instead of numerical (standard % \LaTeX). What is not standard is that |\thesubsection| is also redefined % so that the dot is removed. In standard \LaTeX, the subappendices are % A.1, A.2, etc. % \begin{macrocode} \def\thesection{\Alph{section}} \def\thesubsection{\thesection\arabic{subsection}} % \end{macrocode} % The |secnumdepth| counter determines how deeply sections are numbered % automatically. It is possible that this has been set to 0 to suppress % section numbering (this is standard in AGU journals). However, for the % appendices, this must be reactivated so that the appendix letters appear. % There is no need to store the old value since there should not be any % |\section| commands after |\noappendix| is given. % \begin{macrocode} %<*!agu> \setcounter{secnumdepth}{4} % % \setcounter{secnumdepth}{3} % \end{macrocode} % Now for each of the counters |equation|, |figure|, |table|, and % optionally |plate|, make them a subnumber of |section| (i.e., they are % reset when |section| stepped) and redefine the |\the| command. % \begin{macrocode} \@addtoreset{equation}{section} \setcounter{equation}{0} \def\theequation{\thesection\arabic{equation}} \@addtoreset{figure}{section} \setcounter{figure}{0} \def\thefigure{\thesection\arabic{figure}} \@addtoreset{table}{section} \def\thetable{\thesection\arabic{table}} \setcounter{table}{0} %<*plates> \@ifundefined{c@plate}{\newcounter{plate}}{} \@addtoreset{plate}{section} \def\theplate{\thesection\arabic{plate}} \setcounter{plate}{0} % % \end{macrocode} % We also redefine the |\@Alph| command that outputs counter values as % uppercase letters. If the counter is zero, it should also print the % letter A, for `Appendix'. This is intended for the case where there is % only a single appendix; it should be introduced with |\section*| and not % |\section|. This prints `Appendix' rather than `Appendix A'. However, we % want the counters to be prefixed with `A' still. In this case, the % |section| counter is 0 and so normally nothing is printed with |\@Alph|. % \changes{2.3}{2005 Oct 30}{Repair \cs{@Alph} to conform with current \LaTeX} % \begin{macrocode} \def\@Alph##1{% \ifcase##1A\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} % % The specific journals all redefine |\section| to add the word `Appendix'. % The actual formats are all differing, but correspond to the original % |\section| definition for each one. % The word `Appendix' is not given explicitly even though these journals % publish only in English, because \texttt{figcaps} makes use of the command % |\appendixname|. % In the case of AGU, the word is added via the command |\sectype| that is % normally empty. % \begin{macrocode} % \def\section{\@startsection {section}{1}{\z@}{-2em plus % -1ex minus-.2ex}{1em plus.2ex}{\reset@font % \if@egsbook\large\else\normalsize\fi % \bfseries\noindent \appendixname~}} % \bf\noindent \appendixname~}} % \def\section{\@sectiontrue\orisection} % \def\sectype{\if@section\appendixname~\fi} % \end{macrocode} % For AGU, there are some special characters used in the section % numbering (they insist on the period being kept in section titles) that % change for appendices. Furthermore, they are different for the |\section| % and |\subsection| (in appendices). Thus appendix numbers should appear as % \begin{quote} % A: B: C: C1. C2. C2.1. % \end{quote} % To achieve this, a flag is used to tell whether |\section| or lower % has been called. % \begin{macrocode} % \def\sectchar{\if@section:\else.\fi} % \def\ssectchar{\if@section\unskip:~\else\fi} % \def\subsection{\@sectionfalse\orisubsection} } %\newif\if@section \@sectionfalse % \end{macrocode} % \end{macro} % % \begin{macro}{\noappendix} % To turn off the appendix, or rather to restore the |\section| definition, % use |\noappendix|. This is needed so that |\section*| later will not % print the word `Appendix'. The |secnumdepth| counter can be set to 0, % although it does not really matter. The command |\section|, without % star, should never be given again after this point. % \begin{macrocode} \def\noappendix{\setcounter{secnumdepth}{0} \global\let\section=\orisection \global\let\thesection=\theolds \global\let\thesubsection=\theoldss % \gdef\sectchar{.} \gdef\ssectchar{} % \gdef\sectype{} % \global\let\subsection=\orisubsection } % \end{macrocode} % \end{macro} % % \begin{macro}{\reset@font} % For older implementations of \LaTeX~2.09 (before December, 1991) the % |\reset@font| command does not exist. It is defined to be |\relax| under % normal \LaTeX{}, but does more under NFSS. In case it is not defined, add % it here. % \begin{macrocode} %<209>\@ifundefined{reset@font}{\let\reset@font=\relax}{} % % \end{macrocode} % \end{macro} % % \Finale