| 1 |
% \iffalse meta-comment |
| 2 |
% apendix.dtx |
| 3 |
% Author: Peter Wilson, Herries Press |
| 4 |
% Maintainer: Will Robertson (will dot robertson at latex-project dot org) |
| 5 |
% Copyright 1998--2004 Peter R. Wilson |
| 6 |
% Copyright 2009--2020 Will Robertson |
| 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 |
%<*driver> |
| 20 |
\documentclass{ltxdoc} |
| 21 |
\EnableCrossrefs |
| 22 |
\CodelineIndex |
| 23 |
\setcounter{StandardModuleDepth}{1} |
| 24 |
\begin{document} |
| 25 |
\DocInput{appendix.dtx} |
| 26 |
\end{document} |
| 27 |
%</driver> |
| 28 |
% |
| 29 |
% \fi |
| 30 |
% |
| 31 |
% \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath} |
| 32 |
% \DoNotIndex{\@centercr,\@cite} |
| 33 |
% \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue} |
| 34 |
% \DoNotIndex{\@input,\@ixpt,\@m} |
| 35 |
% \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint} |
| 36 |
% \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb} |
| 37 |
% \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt} |
| 38 |
% \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt} |
| 39 |
% \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace} |
| 40 |
% \DoNotIndex{\advance,\Alph,\alph} |
| 41 |
% \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box} |
| 42 |
% \DoNotIndex{\bullet} |
| 43 |
% \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption} |
| 44 |
% \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass} |
| 45 |
% \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist} |
| 46 |
% \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup} |
| 47 |
% \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter} |
| 48 |
% \DoNotIndex{\fbox} |
| 49 |
% \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef} |
| 50 |
% \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule} |
| 51 |
% \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi} |
| 52 |
% \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi} |
| 53 |
% \DoNotIndex{\input} |
| 54 |
% \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark} |
| 55 |
% \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright} |
| 56 |
% \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment} |
| 57 |
% \DoNotIndex{\NeedsTeXFormat,\newdimen} |
| 58 |
% \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number} |
| 59 |
% \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@} |
| 60 |
% \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip} |
| 61 |
% \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions} |
| 62 |
% \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright} |
| 63 |
% \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font} |
| 64 |
% \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman} |
| 65 |
% \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength} |
| 66 |
% \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space} |
| 67 |
% \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase} |
| 68 |
% \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt} |
| 69 |
% \DoNotIndex{\viipt,\vipt,\vskip,\vspace} |
| 70 |
% \DoNotIndex{\wd,\xiipt,\year,\z@} |
| 71 |
% |
| 72 |
% \changes{v1.0}{1998/11/29}{First public release} |
| 73 |
% \changes{v1.0a}{1999/07/28}{Added text about includes} |
| 74 |
% \changes{v1.1}{2000/02/29}{Extended appendices} |
| 75 |
% \changes{v1.1}{2000/02/29}{Added subappendices} |
| 76 |
% \changes{v1.1a}{2001/03/15}{Fixed problem with \cs{addappheadtotoc}} |
| 77 |
% \changes{v1.2}{2002/08/06}{Compatibility with hyperref bookmarks} |
| 78 |
% \changes{v1.2}{2002/08/06}{Don't need the ifthen package any more} |
| 79 |
% \changes{v1.2a}{2004/04/16}{Changed license and contact details} |
| 80 |
% \changes{v1.2b}{2009/09/02}{New maintainer (Will Robertson)} |
| 81 |
% \changes{v1.2c}{2020/02/08}{Fix clash with hyperref} |
| 82 |
% |
| 83 |
% \def\dtxfile{appendix.dtx} |
| 84 |
% \def\fileversion{v1.1} \def\filedate{2000/02/29} |
| 85 |
% \def\fileversion{v1.1a} \def\filedate{2001/03/15} |
| 86 |
% \def\fileversion{v1.2} \def\filedate{2002/08/06} |
| 87 |
% \def\fileversion{v1.2a} \def\filedate{2004/04/16} |
| 88 |
% \def\fileversion{v1.2b} \def\filedate{2009/09/02} |
| 89 |
% \def\fileversion{v1.2c} \def\filedate{2020/02/08} |
| 90 |
% |
| 91 |
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package |
| 92 |
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option |
| 93 |
% \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file |
| 94 |
% \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter |
| 95 |
% \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle |
| 96 |
% \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment |
| 97 |
% |
| 98 |
% \title{The \Lpack{appendix} package\thanks{This |
| 99 |
% file (\texttt{\dtxfile}) has version number \fileversion, last revised |
| 100 |
% \filedate.}} |
| 101 |
% |
| 102 |
% \author{ |
| 103 |
% Author: Peter Wilson, Herries Press\\ |
| 104 |
% Maintainer: Will Robertson\\ |
| 105 |
% \texttt{will dot robertson at latex-project dot org} |
| 106 |
% } |
| 107 |
% \date{\filedate} |
| 108 |
% \maketitle |
| 109 |
% \begin{abstract} |
| 110 |
% The \Lpack{appendix} package provides some facilities for modifying the |
| 111 |
% typesetting of appendix titles. Further, |(sub)appendices| environments |
| 112 |
% are available that can be used, for example, for per chapter/section |
| 113 |
% appendices. |
| 114 |
% |
| 115 |
% The package |
| 116 |
% is designed to work only with classes that have a |\chapter| and/or |
| 117 |
% |\section| command. It has not been tested with other packages |
| 118 |
% that change the definitions of the sectioning commands. |
| 119 |
% \end{abstract} |
| 120 |
% \tableofcontents |
| 121 |
% |
| 122 |
% |
| 123 |
% |
| 124 |
% |
| 125 |
% \section{Introduction} |
| 126 |
% |
| 127 |
% In the standard classes the |\appendix| command does the following: |
| 128 |
% \begin{itemize} |
| 129 |
% \item For classes with Chapters: |
| 130 |
% \begin{itemize} |
| 131 |
% \item Resets the chapter and section counters to zero |
| 132 |
% \item Sets |\@chapapp| to |\appendixname|. |
| 133 |
% \item Redefines |\thechapter| to produce alphabetic appendix numbers. |
| 134 |
% \end{itemize} |
| 135 |
% \item For the other classes |
| 136 |
% \begin{itemize} |
| 137 |
% \item Resets the section and subsection counters to zero. |
| 138 |
% \item Redefines |\thesection| to produce alphabetic appendix numbers. |
| 139 |
% \end{itemize} |
| 140 |
% \end{itemize} |
| 141 |
% |
| 142 |
% The \Lpack{appendix} package provides additional appendixing capabilities. |
| 143 |
% It cooperates with the \Lpack{hyperref} |
| 144 |
% package\footnote{With thanks to Hylke W. van Dijk |
| 145 |
% (\texttt{[email protected]}) who pointed out that version~1.1 did |
| 146 |
% not and set me on the track for supporting the \Lpack{hyperref} package.} |
| 147 |
% but may be problematic when used with packages that change the definition |
| 148 |
% of the sectioning commands. |
| 149 |
% |
| 150 |
% Portions of the package were developed as part of a class |
| 151 |
% and package bundle for typesetting ISO standards~\cite{PRW96i}. |
| 152 |
% This manual is typeset according to the conventions of the |
| 153 |
% \LaTeX{} \textsc{docstrip} utility which enables the automatic |
| 154 |
% extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}. |
| 155 |
% |
| 156 |
% Section~\ref{sec:usc} describes the usage of the package. |
| 157 |
% Commented source code for the package is in Section~\ref{sec:code}. |
| 158 |
% |
| 159 |
% \section{The \Lpack{appendix} package} \label{sec:usc} |
| 160 |
% |
| 161 |
% The \Lpack{appendix} package provides some commands that can be |
| 162 |
% used in addition to the |\appendix| command. It also provides |
| 163 |
% a new environment that can be used instead of the |\appendix| command. |
| 164 |
% The environment provides some additional actions with respect to |
| 165 |
% the simple |\appendix|. First the new commands will be described and |
| 166 |
% then the new environment will be discussed. |
| 167 |
% |
| 168 |
% \DescribeMacro{\appendixpage} |
| 169 |
% The |\appendixpage| command will typeset a heading in the style of |
| 170 |
% a |\part| heading for the class. The wording of the heading is |
| 171 |
% given by the value of |\appendixpagename|. |
| 172 |
% |
| 173 |
% \DescribeMacro{\addappheadtotoc} |
| 174 |
% This command will insert general heading into the Table of Contents (ToC). |
| 175 |
% The text is given by the value of |\appendixtocname|. If used, the command |
| 176 |
% must come before the first appendix, as it is meant to be used to introduce |
| 177 |
% the appendix titles in the ToC. |
| 178 |
% |
| 179 |
% \changes{v1.1a}{2001/03/15}{Added NOTE about \cs{addappheadtotoc} page number} |
| 180 |
% The above commands can be used in conjunction with the traditional |
| 181 |
% |\appendix| command, which they should immediately follow. For example: |
| 182 |
% \begin{verbatim} |
| 183 |
% \appendix |
| 184 |
% \appendixpage |
| 185 |
% \addappheadtotoc |
| 186 |
% \end{verbatim} |
| 187 |
% |
| 188 |
% \DescribeMacro{\noappendicestocpagenum} |
| 189 |
% \DescribeMacro{\appendicestocpagenum} |
| 190 |
% By default the |\addappheadtotoc| command puts a page number |
| 191 |
% in the ToC. This can be prevented by using |\noappendicestocpagenum|. |
| 192 |
% For symmetry, the |\appendicestocpagenum| command ensures that |
| 193 |
% a page number is put in the ToC. |
| 194 |
% |
| 195 |
% \textbf{NOTE:} Unless |\noappendicestocpagenum| is used |
| 196 |
% the |\addappheadtotoc| command uses the |
| 197 |
% current page number |
| 198 |
% when it makes the entry in the ToC. The |\appendixpage| command puts |
| 199 |
% a heading in the document like a |\part| heading; in un-chaptered documents |
| 200 |
% the |\part| heading appears in the ordinary run of the text like a |
| 201 |
% |\section| heading, but in chaptered documents it is on a page by itself. |
| 202 |
% That is, in chaptered documents |\appendixpage| does a |\clear[double]page| |
| 203 |
% typesets the heading, and then does another |\clear[double]page|. Therefore, |
| 204 |
% in a chaptered document the above sequence of |
| 205 |
% commands will use the page number |
| 206 |
% \emph{after} the |\appendixpage| as the ToC |
| 207 |
% entry\footnote{With thanks to Eduardo Jacob (\texttt{[email protected]}) |
| 208 |
% for pointing this out.} and if the ordering |
| 209 |
% is reversed (i.e., |\addappheadtotoc| |\appendixname|) then the page number |
| 210 |
% \emph{before} |\appendixname| will be used as the ToC entry. For chaptered |
| 211 |
% documents it is probably best to do: \\ |
| 212 |
% | \clearpage % or \cleardoublepage| \\ |
| 213 |
% | \addappheadtotoc| \\ |
| 214 |
% | \appendixpage| \\ |
| 215 |
% which will use the page number of |\appendixpage| as the ToC entry. |
| 216 |
% |
| 217 |
% |
| 218 |
% \DescribeMacro{\appendixname} |
| 219 |
% \DescribeMacro{\appendixtocname} |
| 220 |
% \DescribeMacro{\appendixpagename} |
| 221 |
% The |\appendixname| command is defined in those classes that provide |
| 222 |
% for chapters. It is provided in this package whether or not it has |
| 223 |
% been defined in the class. It's default value is `Appendix'. |
| 224 |
% The default value of both |\appendixtocname| and |\appendixpagename| is |
| 225 |
% `Appendices'. These names can all be changed via |\renewcommand|. |
| 226 |
% For example, |
| 227 |
% \begin{verbatim} |
| 228 |
% \renewcommand{\appendixtocname}{List of appendices} |
| 229 |
% \end{verbatim} |
| 230 |
% |
| 231 |
% \DescribeEnv{appendices} |
| 232 |
% The |appendices| environment can be used instead of the |\appendix| |
| 233 |
% command. It provides more functionality than is possible from the |
| 234 |
% combination of the |\appendix|, |\addappheadtotoc| and |\appendixpage| |
| 235 |
% commands. |
| 236 |
% The functions of the |appendices| environment are usually accessed through |
| 237 |
% the package options, but there are declarations that may be used instead. |
| 238 |
% The options are: |
| 239 |
% \begin{itemize} |
| 240 |
% \item \Lopt{toc} Put a header (e.g., `Appendices') into the Table |
| 241 |
% of Contents (the ToC) before listing the appendices. (This |
| 242 |
% is done by calling the |\addappheadtotoc| command.) |
| 243 |
% \item \Lopt{page} Puts a title (e.g., `Appendices') into the document |
| 244 |
% at the point where the |appendices| environment is begun. |
| 245 |
% (This is done by calling the |\appendixpage| command.) |
| 246 |
% \item \Lopt{title} Adds a name (e.g., `Appendix') before each appendix |
| 247 |
% title in the body of the document. |
| 248 |
% The name is given by the value of |\appendixname|. |
| 249 |
% Note that this is the default behaviour for classes that have |
| 250 |
% chapters. |
| 251 |
% \item \Lopt{titletoc} Adds a name (e.g., `Appendix') before each |
| 252 |
% appendix listed in the ToC. |
| 253 |
% The name is given by the value of |\appendixname|. |
| 254 |
% \item \Lopt{header} Adds a name (e.g., `Appendix') before each appendix |
| 255 |
% in page headers. |
| 256 |
% The name is given by the value of |\appendixname|. |
| 257 |
% Note that this is the default behaviour for classes that have |
| 258 |
% chapters. |
| 259 |
% \end{itemize} |
| 260 |
% |
| 261 |
% Depending on the particular package options that are set and the |
| 262 |
% document class, the |
| 263 |
% |appendices| environment may change the definition of elements of |
| 264 |
% the sectioning commands (e.g., |\chapter| or |\section|). |
| 265 |
% This may be a problem if the environment |
| 266 |
% is used in conjunction with any other package that makes changes to |
| 267 |
% these commands. If this is the case, then you will have to examine the |
| 268 |
% code for the |appendices| environment and make any necessary changes |
| 269 |
% to one or the other of the packages (via your own package file). |
| 270 |
% The changes to the sectional heading commands are discarded at the |
| 271 |
% end of the |appendices| environment. |
| 272 |
% |
| 273 |
% \DescribeMacro{\appendixtocon} |
| 274 |
% \DescribeMacro{\appendixtocoff} |
| 275 |
% |\appendixtocon| is a declaration equivalent to the \Lopt{toc} option. |
| 276 |
% The |\appendixtocoff| declaration is equivalent to not using that option. |
| 277 |
% |
| 278 |
% \DescribeMacro{\appendixpageon} |
| 279 |
% \DescribeMacro{\appendixpageoff} |
| 280 |
% |\appendixpagecon| is a declaration equivalent to the \Lopt{page} option. |
| 281 |
% The |\appendixpageoff| declaration is equivalent to not using |
| 282 |
% that option. |
| 283 |
% |
| 284 |
% \DescribeMacro{\appendixtitleon} |
| 285 |
% \DescribeMacro{\appendixtitleoff} |
| 286 |
% |\appendixtitleon| is a declaration equivalent to the \Lopt{title} option. |
| 287 |
% The |\appendixtitleoff| declaration is equivalent to not using |
| 288 |
% that option. |
| 289 |
% |
| 290 |
% \DescribeMacro{\appendixtitletocon} |
| 291 |
% \DescribeMacro{\appendixtitletocoff} |
| 292 |
% |\appendixtitletocon| is a declaration equivalent to the \Lopt{titletoc} option. |
| 293 |
% The |\appendixtitletocoff| declaration is equivalent to not using |
| 294 |
% that option. |
| 295 |
% |
| 296 |
% \DescribeMacro{\appendixheaderon} |
| 297 |
% \DescribeMacro{\appendixheaderoff} |
| 298 |
% |\appendixheaderon| is a declaration equivalent to the \Lopt{header} option. |
| 299 |
% The |\appendixheaderoff| declaration is equivalent to not using |
| 300 |
% that option. |
| 301 |
% |
| 302 |
% \DescribeMacro{\restoreapp} |
| 303 |
% The |appendices| environment restores the prior value of the |
| 304 |
% chapter/section counter at the end of the environment, so the |
| 305 |
% environment may be used between the main document divisions. By default, |
| 306 |
% the appendix counter value is saved and restored by the environment. That |
| 307 |
% means that appendices in a series of |appendices| environments will |
| 308 |
% be lettered sequentially. To make the lettering start from A each time, |
| 309 |
% put the following into the preamble: \\ |
| 310 |
% |\renewcommand{\restoreapp}{}| |
| 311 |
% |
| 312 |
% \DescribeEnv{subappendices} |
| 313 |
% Within the |subappendices| environment, an appendix is introduced by a |
| 314 |
% |\section| command in chaptered documents, otherwise it is introduced |
| 315 |
% by a |\subsection| command. Effectively, this provides for appendices |
| 316 |
% at the end of a main document division, as an integral |
| 317 |
% part of the division. The |subappendices| environment supports only |
| 318 |
% the \Lopt{title} and \Lopt{titletoc} options. |
| 319 |
% |
| 320 |
% \DescribeMacro{\setthesection} |
| 321 |
% \DescribeMacro{\setthesubsection} |
| 322 |
% By default, the `subappendices' are numbered like normal (sub)sections, |
| 323 |
% except that the (sub)section number itself is typeset as an uppercase |
| 324 |
% letter. This behaviour can be changed by redefining these |\setthe...| |
| 325 |
% commands. For example, to just have a letter not prepended by the main |
| 326 |
% division number, do: \\ |
| 327 |
% |\renewcommand{\setthesection}{\Alph{section}}| or \\ |
| 328 |
% |\renewcommand{\setthesubsection}{\Alph{subsection}}| as appropriate. |
| 329 |
% |
| 330 |
% \subsection{Known problems} |
| 331 |
% |
| 332 |
% There is an unfortunate interaction between the \LaTeX{} kernel commands |
| 333 |
% |\include| and |\addcontentsline|. If these are used like this: |
| 334 |
% \begin{verbatim} |
| 335 |
% \addcontentsline{toc}{...}{addtotoc} |
| 336 |
% \include{import} |
| 337 |
% \end{verbatim} |
| 338 |
% then the text of the |\addcontentsline| command (`addtotoc' in the example) |
| 339 |
% is not written to the |
| 340 |
% appropriate (toc) file until \textit{after} the included file has written all |
| 341 |
% its entries out to the (toc) file. As far as I can tell, there is no way |
| 342 |
% around this behaviour without rewriting parts of the \LaTeX{} kernel code. |
| 343 |
% |
| 344 |
% It is thus up to the author to avoid putting an |\addcontentsline| command |
| 345 |
% (or a command that internally uses |\addcontentsline|, as does the |
| 346 |
% |\addappheadtotoc| command) before |
| 347 |
% an |\include|d file that writes out to the same file. Things work as |
| 348 |
% expected if the |\addcontentsline| command is placed within the |\include|d |
| 349 |
% file, or if the imported file is |\input|ed instead of |\include|d. |
| 350 |
% |
| 351 |
% \StopEventually{} |
| 352 |
% |
| 353 |
% \section{The package code} \label{sec:code} |
| 354 |
% |
| 355 |
% Announce the name and version of the package, which requires |
| 356 |
% \LaTeXe. |
| 357 |
% \begin{macrocode} |
| 358 |
%<*usc> |
| 359 |
\NeedsTeXFormat{LaTeX2e} |
| 360 |
\ProvidesPackage{appendix}[2020/02/08 v1.2c extra appendix facilities] |
| 361 |
% \end{macrocode} |
| 362 |
% |
| 363 |
% Check that an \cs{appendix} command is actually defined and emit a warning |
| 364 |
% if not. |
| 365 |
% \begin{macrocode} |
| 366 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 367 |
\expandafter\ifx\csname appendix\endcsname\relax |
| 368 |
\PackageWarningNoLine{appendix}{% |
| 369 |
No \protect\appendix\space command in this document class!% |
| 370 |
\MessageBreak |
| 371 |
Trying to create an appendix will probably fail% |
| 372 |
}% |
| 373 |
\fi |
| 374 |
% \end{macrocode} |
| 375 |
% |
| 376 |
% |
| 377 |
% In order to try and avoid name clashes with other packages, each internal |
| 378 |
% name will include the character string |@pp|. |
| 379 |
% |
| 380 |
% |
| 381 |
% \begin{macro}{\if@knownclass@pp} |
| 382 |
% \begin{macro}{\if@chapter@pp} |
| 383 |
% These are used when we need to decide what appendix style is being used |
| 384 |
% for the document. Assume the \Lpack{article} class or other without |
| 385 |
% chapters. |
| 386 |
% \changes{v1.1a}{2001/03/15}{Checking on sectional commands, not classes} |
| 387 |
% \begin{macrocode} |
| 388 |
\newif\if@chapter@pp\@chapter@ppfalse |
| 389 |
\newif\if@knownclass@pp\@knownclass@ppfalse |
| 390 |
% \end{macrocode} |
| 391 |
% Check the sectioning commands. |
| 392 |
% \begin{macrocode} |
| 393 |
\@ifundefined{chapter}{% |
| 394 |
\@ifundefined{section}{}{\@knownclass@pptrue}}{% |
| 395 |
\@chapter@pptrue\@knownclass@pptrue} |
| 396 |
% \end{macrocode} |
| 397 |
% \end{macro} |
| 398 |
% \end{macro} |
| 399 |
% |
| 400 |
% \begin{macro}{\phantomsection} |
| 401 |
% \begin{macro}{\the@pps} |
| 402 |
% \begin{macro}{\if@pphyper} |
| 403 |
% We need to provide |\phantomsection| if \Lpack{hyperref} is not |
| 404 |
% used and, whether or not \Lpack{hyperref} is used, we need to define |
| 405 |
% a counter here to support potential hyperrefs (used to disambiguate |
| 406 |
% (sub)appendices). |
| 407 |
% |\if@pphyper| is TRUE if the \Lpack{hyperref} package is used. |
| 408 |
% \changes{v1.2}{2002/08/06}{Added the \texttt{@pps} counter} |
| 409 |
% \changes{v1.2}{2002/08/06}{Added \cs{if@pphyper}} |
| 410 |
% \begin{macrocode} |
| 411 |
\providecommand{\phantomsection}{} |
| 412 |
\newcounter{@pps} |
| 413 |
\renewcommand{\the@pps}{\alph{@pps}} |
| 414 |
\newif\if@pphyper |
| 415 |
\@pphyperfalse |
| 416 |
\AtBeginDocument{% |
| 417 |
\@ifpackageloaded{hyperref}{\@pphypertrue}{}} |
| 418 |
|
| 419 |
% \end{macrocode} |
| 420 |
% \end{macro} |
| 421 |
% \end{macro} |
| 422 |
% \end{macro} |
| 423 |
% |
| 424 |
% \begin{macro}{\if@dotoc@pp} |
| 425 |
% \begin{macro}{\if@dotitle@pp} |
| 426 |
% \begin{macro}{\if@dotitletoc@pp} |
| 427 |
% \begin{macro}{\if@dohead@pp} |
| 428 |
% \begin{macro}{\if@dopage@pp} |
| 429 |
% A set of booleans for the options. Default is the |appendices| |
| 430 |
% environment does nothing more than the |\appendix| command does |
| 431 |
% unless one or more options are set. |
| 432 |
% \begin{macrocode} |
| 433 |
\newif\if@dotoc@pp\@dotoc@ppfalse |
| 434 |
\newif\if@dotitle@pp\@dotitle@ppfalse |
| 435 |
\newif\if@dotitletoc@pp\@dotitletoc@ppfalse |
| 436 |
\newif\if@dohead@pp\@dohead@ppfalse |
| 437 |
\newif\if@dopage@pp\@dopage@ppfalse |
| 438 |
% \end{macrocode} |
| 439 |
% \end{macro} |
| 440 |
% \end{macro} |
| 441 |
% \end{macro} |
| 442 |
% \end{macro} |
| 443 |
% \end{macro} |
| 444 |
% |
| 445 |
% Now we can do the five options. |
| 446 |
% \begin{macrocode} |
| 447 |
\DeclareOption{toc}{\@dotoc@pptrue} |
| 448 |
\DeclareOption{title}{\@dotitle@pptrue} |
| 449 |
\DeclareOption{titletoc}{\@dotitletoc@pptrue} |
| 450 |
\DeclareOption{header}{\@dohead@pptrue} |
| 451 |
\DeclareOption{page}{\@dopage@pptrue} |
| 452 |
% \end{macrocode} |
| 453 |
% Process the options now. |
| 454 |
% \begin{macrocode} |
| 455 |
\ProcessOptions\relax |
| 456 |
% \end{macrocode} |
| 457 |
% |
| 458 |
% Issue a warning if |\chapter| and |\section| are undefined, then |
| 459 |
% quit. |
| 460 |
% \begin{macrocode} |
| 461 |
\newcommand{\@ppendinput}{} |
| 462 |
\if@knownclass@pp\else |
| 463 |
\PackageWarningNoLine{appendix}% |
| 464 |
{There is no \protect\chapter\space or \protect\section\space command.\MessageBreak |
| 465 |
The appendix package will not be used} |
| 466 |
\renewcommand{\@ppendinput}{\endinput} |
| 467 |
\fi |
| 468 |
\@ppendinput |
| 469 |
|
| 470 |
% \end{macrocode} |
| 471 |
% |
| 472 |
% \begin{macro}{\appendixtocon} |
| 473 |
% \begin{macro}{\appendixtocoff} |
| 474 |
% Declarative forms of the \Lopt{toc} option. |
| 475 |
% \changes{v1.2}{2002/08/06}{Added declarations for the options} |
| 476 |
% \begin{macrocode} |
| 477 |
\newcommand{\appendixtocon}{\@dotoc@pptrue} |
| 478 |
\newcommand{\appendixtocoff}{\@dotoc@ppfalse} |
| 479 |
% \end{macrocode} |
| 480 |
% \end{macro} |
| 481 |
% \end{macro} |
| 482 |
% |
| 483 |
% \begin{macro}{\appendixpageon} |
| 484 |
% \begin{macro}{\appendixpageoff} |
| 485 |
% Declarative forms of the \Lopt{page} option. |
| 486 |
% \begin{macrocode} |
| 487 |
\newcommand{\appendixpageon}{\@dopage@pptrue} |
| 488 |
\newcommand{\appendixpageoff}{\@dopage@ppfalse} |
| 489 |
% \end{macrocode} |
| 490 |
% \end{macro} |
| 491 |
% \end{macro} |
| 492 |
% |
| 493 |
% \begin{macro}{\appendixtitleon} |
| 494 |
% \begin{macro}{\appendixtitleoff} |
| 495 |
% Declarative forms of the \Lopt{title} option. |
| 496 |
% \begin{macrocode} |
| 497 |
\newcommand{\appendixtitleon}{\@dotitle@pptrue} |
| 498 |
\newcommand{\appendixtitleoff}{\@dotitle@ppfalse} |
| 499 |
% \end{macrocode} |
| 500 |
% \end{macro} |
| 501 |
% \end{macro} |
| 502 |
% |
| 503 |
% \begin{macro}{\appendixtitletocon} |
| 504 |
% \begin{macro}{\appendixtitletocoff} |
| 505 |
% Declarative forms of the \Lopt{titletoc} option. |
| 506 |
% \begin{macrocode} |
| 507 |
\newcommand{\appendixtitletocon}{\@dotitletoc@pptrue} |
| 508 |
\newcommand{\appendixtitletocoff}{\@dotitletoc@ppfalse} |
| 509 |
% \end{macrocode} |
| 510 |
% \end{macro} |
| 511 |
% \end{macro} |
| 512 |
% |
| 513 |
% \begin{macro}{\appendixheaderon} |
| 514 |
% \begin{macro}{\appendixheaderoff} |
| 515 |
% Declarative forms of the \Lopt{header} option. |
| 516 |
% \begin{macrocode} |
| 517 |
\newcommand{\appendixheaderon}{\@dohead@pptrue} |
| 518 |
\newcommand{\appendixheaderoff}{\@dohead@ppfalse} |
| 519 |
% \end{macrocode} |
| 520 |
% \end{macro} |
| 521 |
% \end{macro} |
| 522 |
% |
| 523 |
% \begin{macro}{\@ppsavesec} |
| 524 |
% \begin{macro}{\@pprestoresec} |
| 525 |
% \begin{macro}{\@ppsaveapp} |
| 526 |
% \begin{macro}{\restoreapp} |
| 527 |
% For the |appendices| environment we need to save and restore the |
| 528 |
% main document division number and the appendix number. The |\restoreapp| |
| 529 |
% command is the one for the user. |
| 530 |
% \changes{v1.1}{2000/02/29}{Added commands to save and restore sectional numbering} |
| 531 |
% \begin{macrocode} |
| 532 |
\newcounter{@ppsavesec} |
| 533 |
\newcounter{@ppsaveapp} |
| 534 |
\setcounter{@ppsaveapp}{0} |
| 535 |
\newcommand{\@ppsavesec}{% |
| 536 |
\if@chapter@pp \setcounter{@ppsavesec}{\value{chapter}} \else |
| 537 |
\setcounter{@ppsavesec}{\value{section}} \fi} |
| 538 |
\newcommand{\@pprestoresec}{% |
| 539 |
\if@chapter@pp \setcounter{chapter}{\value{@ppsavesec}} \else |
| 540 |
\setcounter{section}{\value{@ppsavesec}} \fi} |
| 541 |
\newcommand{\@ppsaveapp}{% |
| 542 |
\if@chapter@pp \setcounter{@ppsaveapp}{\value{chapter}} \else |
| 543 |
\setcounter{@ppsaveapp}{\value{section}} \fi} |
| 544 |
\newcommand{\restoreapp}{% |
| 545 |
\if@chapter@pp \setcounter{chapter}{\value{@ppsaveapp}} \else |
| 546 |
\setcounter{section}{\value{@ppsaveapp}} \fi} |
| 547 |
% \end{macrocode} |
| 548 |
% \end{macro} |
| 549 |
% \end{macro} |
| 550 |
% \end{macro} |
| 551 |
% \end{macro} |
| 552 |
% |
| 553 |
% \begin{macro}{\appendixname} |
| 554 |
% \begin{macro}{\appendixtocname} |
| 555 |
% \begin{macro}{\appendixpagename} |
| 556 |
% These commands hold the names that might be used. |\appendixname| |
| 557 |
% may have been defined in the class. The others are new. |
| 558 |
% \begin{macrocode} |
| 559 |
\providecommand{\appendixname}{Appendix} |
| 560 |
\newcommand{\appendixtocname}{Appendices} |
| 561 |
\newcommand{\appendixpagename}{Appendices} |
| 562 |
% \end{macrocode} |
| 563 |
% \end{macro} |
| 564 |
% \end{macro} |
| 565 |
% \end{macro} |
| 566 |
% |
| 567 |
% \begin{macro}{\appendixpage} |
| 568 |
% The command to typeset a page announcing the start of the appendices. |
| 569 |
% It is based on the |\part| definition (either from the \Lpack{book} |
| 570 |
% class or the \Lpack{article} class). |
| 571 |
% \begin{macrocode} |
| 572 |
\newcommand{\appendixpage}{% |
| 573 |
\if@chapter@pp \@chap@pppage \else \@sec@pppage \fi |
| 574 |
} |
| 575 |
% \end{macrocode} |
| 576 |
% \end{macro} |
| 577 |
% |
| 578 |
% \begin{macro}{\clear@ppage} |
| 579 |
% The non-chaptered classes do not define |\if@openright|, but we need to |
| 580 |
% use this for chaptered documents to clear the appropriate pages. |
| 581 |
% |\clear@ppage| does the right thing, but must only be called in |
| 582 |
% chapter related code, otherwise there will be error message like |
| 583 |
% |extra \else| or |extra \fi|. |
| 584 |
% \begin{macrocode} |
| 585 |
\newcommand{\clear@ppage}{% |
| 586 |
\if@openright\cleardoublepage\else\clearpage\fi} |
| 587 |
|
| 588 |
% \end{macrocode} |
| 589 |
% \end{macro} |
| 590 |
% |
| 591 |
% \begin{macro}{\@chap@pppage} |
| 592 |
% Do an appendix page in chapter style. |
| 593 |
% Copy code from the \Lpack{book} class |\part| command, but use |
| 594 |
% |\appendixpagename| as the title. |
| 595 |
% \begin{macrocode} |
| 596 |
\newcommand{\@chap@pppage}{% |
| 597 |
\clear@ppage |
| 598 |
\thispagestyle{plain}% |
| 599 |
\if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi |
| 600 |
\null\vfil |
| 601 |
\markboth{}{}% |
| 602 |
{\centering |
| 603 |
\interlinepenalty \@M |
| 604 |
\normalfont |
| 605 |
\Huge \bfseries \appendixpagename\par}% |
| 606 |
% \end{macrocode} |
| 607 |
% Add to ToC if requested |
| 608 |
% \begin{macrocode} |
| 609 |
\if@dotoc@pp |
| 610 |
\addappheadtotoc |
| 611 |
\fi |
| 612 |
% \end{macrocode} |
| 613 |
% In the \Lpack{book} class the |\part| command is finished off by calling |
| 614 |
% |\@endpart|. There are two problems with this in this package. (1) |
| 615 |
% |\@endpart| is not defined in \Lpack{article} style classes and (2) |
| 616 |
% it always throws a blank page which does not look good if the \Lopt{openany} |
| 617 |
% option is used. So, code it all up here. |
| 618 |
% \begin{macrocode} |
| 619 |
\vfil\newpage |
| 620 |
\if@twoside |
| 621 |
\if@openright |
| 622 |
\null |
| 623 |
\thispagestyle{empty}% |
| 624 |
\newpage |
| 625 |
\fi |
| 626 |
\fi |
| 627 |
\if@tempswa |
| 628 |
\twocolumn |
| 629 |
\fi |
| 630 |
} |
| 631 |
|
| 632 |
% \end{macrocode} |
| 633 |
% \end{macro} |
| 634 |
% |
| 635 |
% \begin{macro}{\@sec@pppage} |
| 636 |
% Copy code from the \Lpack{article} class |\part| command, but use |
| 637 |
% |\appendixpagename| as |
| 638 |
% the title. |
| 639 |
% \begin{macrocode} |
| 640 |
\newcommand{\@sec@pppage}{% |
| 641 |
\par |
| 642 |
\addvspace{4ex}% |
| 643 |
\@afterindentfalse |
| 644 |
{\parindent \z@ \raggedright |
| 645 |
\interlinepenalty \@M |
| 646 |
\normalfont |
| 647 |
\huge \bfseries \appendixpagename% |
| 648 |
\markboth{}{}\par}% |
| 649 |
% \end{macrocode} |
| 650 |
% Add to ToC if requested |
| 651 |
% \begin{macrocode} |
| 652 |
\if@dotoc@pp |
| 653 |
\addappheadtotoc |
| 654 |
\fi |
| 655 |
\nobreak |
| 656 |
\vskip 3ex |
| 657 |
\@afterheading |
| 658 |
} |
| 659 |
|
| 660 |
% \end{macrocode} |
| 661 |
% \end{macro} |
| 662 |
% |
| 663 |
% \begin{macro}{\if@pptocpage} |
| 664 |
% \begin{macro}{\noappendicestocpagenum} |
| 665 |
% \begin{macro}{\appendicestocpagenum} |
| 666 |
% \begin{macro}{\addappheadtotoc} |
| 667 |
% The |\addappheadtotoc| command adds an `appendices' line to the ToC. |
| 668 |
% The style is the same |
| 669 |
% as used in \Lpack{tocbibind} for the `List of figures' line. That is, |
| 670 |
% as a Chapter heading or a Section heading. |\if@pptocpage| controls |
| 671 |
% whether or not a page number is put into the ToC. |
| 672 |
% \changes{v1.2}{2002/08/06}{Added \cs{noappendicestocpagenum} and changed |
| 673 |
% \cs{addappheadtotoc}} |
| 674 |
% \begin{macrocode} |
| 675 |
\newif\if@pptocpage |
| 676 |
\@pptocpagetrue |
| 677 |
\newcommand{\noappendicestocpagenum}{\@pptocpagefalse} |
| 678 |
\newcommand{\appendicestocpagenum}{\@pptocpagetrue} |
| 679 |
\newcommand{\addappheadtotoc}{% |
| 680 |
\phantomsection |
| 681 |
\if@chapter@pp |
| 682 |
% \end{macrocode} |
| 683 |
% Chaptered document |
| 684 |
% \begin{macrocode} |
| 685 |
\if@pptocpage |
| 686 |
\addcontentsline{toc}{chapter}{\appendixtocname}% |
| 687 |
\else |
| 688 |
\if@pphyper |
| 689 |
\addtocontents{toc}% |
| 690 |
{\protect\contentsline{chapter}{\appendixtocname}{}{\@currentHref}}% |
| 691 |
\else |
| 692 |
\addtocontents{toc}% |
| 693 |
{\protect\contentsline{chapter}{\appendixtocname}{}}% |
| 694 |
\fi |
| 695 |
\fi |
| 696 |
\else |
| 697 |
% \end{macrocode} |
| 698 |
% Not a chaptered document |
| 699 |
% \begin{macrocode} |
| 700 |
\if@pptocpage |
| 701 |
\addcontentsline{toc}{section}{\appendixtocname}% |
| 702 |
\else |
| 703 |
\if@pphyper |
| 704 |
\addtocontents{toc}% |
| 705 |
{\protect\contentsline{section}{\appendixtocname}{}{\@currentHref}}% |
| 706 |
\else |
| 707 |
\addtocontents{toc}% |
| 708 |
{\protect\contentsline{section}{\appendixtocname}{}}% |
| 709 |
\fi |
| 710 |
\fi |
| 711 |
\fi |
| 712 |
} |
| 713 |
|
| 714 |
% \end{macrocode} |
| 715 |
% \end{macro} |
| 716 |
% \end{macro} |
| 717 |
% \end{macro} |
| 718 |
% \end{macro} |
| 719 |
% |
| 720 |
% For my reference, |
| 721 |
% here is the standard version of the |\appendix| macro, but modified for |
| 722 |
% both chaptered and unchaptered documents. |
| 723 |
% \begin{verbatim} |
| 724 |
% \newcommand{\appendix}{\par |
| 725 |
% \if@chapter@pp |
| 726 |
% \setcounter{chapter}{0}% |
| 727 |
% \setcounter{section}{0}% |
| 728 |
% \gdef\@chapapp{\appendixname}% |
| 729 |
% \gdef\thechapter{\@Alph\c@chapter} |
| 730 |
% \else |
| 731 |
% \setcounter{section}{0}% |
| 732 |
% \setcounter{subsection}{0}% |
| 733 |
% \gdef\thesection{\@Alph\c@section} |
| 734 |
% \fi |
| 735 |
% } |
| 736 |
% \end{verbatim} |
| 737 |
% |
| 738 |
% And this equivalently is what the \Lpack{hyperref} package does. |
| 739 |
% \begin{verbatim} |
| 740 |
% \def\Hy@chapterstring{chapter} |
| 741 |
% \def\Hy@appendixstring{appendix} |
| 742 |
% \def\Hy@chapapp{\Hy@chapterstring} |
| 743 |
% \let\Hy@org@appendix\appendix |
| 744 |
% \def\appendix{% |
| 745 |
% \Hy@org@appendix |
| 746 |
% \if@chapter@pp |
| 747 |
% \gdef\theHchapter{\Alph{chapter}}% |
| 748 |
% \else |
| 749 |
% \gdef\theHsection{\Alph{section}}% |
| 750 |
% \fi |
| 751 |
% \xdef\Hy@chapapp{\Hy@appendixstring}% |
| 752 |
% } |
| 753 |
% \end{verbatim} |
| 754 |
% |
| 755 |
% \begin{macro}{\theH@pps} |
| 756 |
% We are going to use |\theH@pps| to disambiguate contents of appendices |
| 757 |
% that might have the same hyperref marks. It is |\provide|d as if |
| 758 |
% the \Lpack{appendix} and \Lpack{hyperref} are in the `wrong' order |
| 759 |
% then somehow \Lpack{hyperref} defines it before \Lpack{appendix} |
| 760 |
% can get to it. |
| 761 |
% \changes{v1.2}{2002/08/06}{Added \cs{theH@pps}} |
| 762 |
% \begin{macrocode} |
| 763 |
\providecommand{\theH@pps}{\alph{@pps}} |
| 764 |
|
| 765 |
% \end{macrocode} |
| 766 |
% \end{macro} |
| 767 |
% |
| 768 |
% \begin{macro}{\@resets@pp} |
| 769 |
% Resets the appropriate sectioning counters and names. This does almost |
| 770 |
% exactly |
| 771 |
% what the default |\appendix| command does, except that it saves and |
| 772 |
% restores sectional numbering. It saves the sectional number at the start |
| 773 |
% and restores the appendix number at the end. |
| 774 |
% \changes{v1.1}{2000/02/29}{Added number save/restore to \cs{@reset@pp}} |
| 775 |
% \changes{v1.2}{2002/08/06}{Added hyperref code to \cs{@reset@pp}} |
| 776 |
% \begin{macrocode} |
| 777 |
\newcommand{\@resets@pp}{\par |
| 778 |
\@ppsavesec |
| 779 |
\stepcounter{@pps} |
| 780 |
\setcounter{section}{0}% |
| 781 |
\if@chapter@pp |
| 782 |
\setcounter{chapter}{0}% |
| 783 |
\renewcommand\@chapapp{\appendixname}% |
| 784 |
\renewcommand\thechapter{\@Alph\c@chapter}% |
| 785 |
\else |
| 786 |
\setcounter{subsection}{0}% |
| 787 |
\renewcommand\thesection{\@Alph\c@section}% |
| 788 |
\fi |
| 789 |
\if@pphyper |
| 790 |
% \end{macrocode} |
| 791 |
% Now handle the \Lpack{hyperref} tweaks. |
| 792 |
% \begin{macrocode} |
| 793 |
\if@chapter@pp |
| 794 |
\renewcommand{\theHchapter}{\theH@pps.\Alph{chapter}}% |
| 795 |
\else |
| 796 |
\renewcommand{\theHsection}{\theH@pps.\Alph{section}}% |
| 797 |
\fi |
| 798 |
\xdef\Hy@chapapp{\Hy@appendixstring}% |
| 799 |
\fi |
| 800 |
\restoreapp |
| 801 |
} |
| 802 |
|
| 803 |
% \end{macrocode} |
| 804 |
% \end{macro} |
| 805 |
% |
| 806 |
% \begin{environment}{appendices} |
| 807 |
% This is the heart of the package. Start it off by doing the resetting |
| 808 |
% done by the |\appendix| command. Then do the simple options before |
| 809 |
% getting into the complications of redefinitions. Remember to take care |
| 810 |
% of an interaction between |\addappheadtotoc| and |\appendixpage|. |
| 811 |
% \changes{v1.1a}{2001/03/15}{Changed implementation of easy options in \texttt{appendices} environment} |
| 812 |
% \begin{macrocode} |
| 813 |
\newenvironment{appendices}{% |
| 814 |
\@resets@pp |
| 815 |
\if@dotoc@pp |
| 816 |
\if@dopage@pp % both page and toc |
| 817 |
\if@chapter@pp % chapters |
| 818 |
\clear@ppage |
| 819 |
\fi |
| 820 |
\appendixpage |
| 821 |
\else % toc only |
| 822 |
\if@chapter@pp % chapters |
| 823 |
\clear@ppage |
| 824 |
\fi |
| 825 |
\addappheadtotoc |
| 826 |
\fi |
| 827 |
\else |
| 828 |
\if@dopage@pp % page only |
| 829 |
\appendixpage |
| 830 |
\fi |
| 831 |
\fi |
| 832 |
% \end{macrocode} |
| 833 |
% There is only one other option applicable to the chapter style, so do |
| 834 |
% it now and clear the way for doing the section style. To implement |
| 835 |
% the \Lopt{titletoc} option, we redefine the |\addcontentsline| command. |
| 836 |
% \begin{macrocode} |
| 837 |
\if@chapter@pp |
| 838 |
\if@dotitletoc@pp \@redotocentry@pp{chapter} \fi |
| 839 |
\else |
| 840 |
% \end{macrocode} |
| 841 |
% The rest of the code is specific to the section style. While we're in the |
| 842 |
% mood we might as well finish off doing the \Lopt{titletoc} option. |
| 843 |
% \begin{macrocode} |
| 844 |
\if@dotitletoc@pp \@redotocentry@pp{section} \fi |
| 845 |
% \end{macrocode} |
| 846 |
% The next piece of code implements the \Lopt{header} option by providing |
| 847 |
% a special version of |\sectionmark|. |
| 848 |
% \begin{macrocode} |
| 849 |
\if@dohead@pp |
| 850 |
\def\sectionmark##1{% |
| 851 |
\if@twoside |
| 852 |
\markboth{\@formatsecmark@pp{##1}}{} |
| 853 |
\else |
| 854 |
\markright{\@formatsecmark@pp{##1}}{} |
| 855 |
\fi} |
| 856 |
\fi |
| 857 |
% \end{macrocode} |
| 858 |
% The next piece of code implements the \Lopt{title} option by doing cunning |
| 859 |
% things with the |\@seccntformat|.\footnote{From a posting to |
| 860 |
% \texttt{comp.tex.tex} by Donald Arseneau on 13 August 1998.} |
| 861 |
% \begin{macrocode} |
| 862 |
\if@dotitle@pp |
| 863 |
\def\sectionname{\appendixname} |
| 864 |
\def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }% |
| 865 |
\csname the##1\endcsname\quad} |
| 866 |
\fi |
| 867 |
\fi}{% |
| 868 |
% \end{macrocode} |
| 869 |
% At the end of the environment, save the appendix number and restore the |
| 870 |
% sectional number. |
| 871 |
% \changes{v1.1}{2000/02/29}{Changed end of appendix environment} |
| 872 |
% \begin{macrocode} |
| 873 |
\@ppsaveapp\@pprestoresec} |
| 874 |
|
| 875 |
% \end{macrocode} |
| 876 |
% \end{environment} |
| 877 |
% |
| 878 |
% \begin{macro}{\setthesection} |
| 879 |
% \begin{macro}{\setthesubsection} |
| 880 |
% The user commands for specifying the numbering style for subappendices. |
| 881 |
% \changes{v1.1}{2000/02/29}{Added \cs{setthesection} and \cs{setthesubsection} commands} |
| 882 |
% \begin{macrocode} |
| 883 |
\newcommand{\setthesection}{\thechapter.\Alph{section}} |
| 884 |
\newcommand{\setthesubsection}{\thesection.\Alph{subsection}} |
| 885 |
|
| 886 |
% \end{macrocode} |
| 887 |
% \end{macro} |
| 888 |
% \end{macro} |
| 889 |
% |
| 890 |
% \begin{macro}{\@resets@ppsub} |
| 891 |
% Similar to |\@resets@pp| except that it is for use within the |
| 892 |
% |subappendices| environment; as such, it is a bit simpler. |
| 893 |
% \changes{v1.1}{2000/02/29}{Added \cs{@resets@ppsub} command} |
| 894 |
% \changes{v1.2}{2002/08/07}{Added hyperref code to \cs{@resets@ppsub}} |
| 895 |
% \begin{macrocode} |
| 896 |
\newcommand{\@resets@ppsub}{\par |
| 897 |
\stepcounter{@pps} |
| 898 |
\if@chapter@pp |
| 899 |
\setcounter{section}{0} |
| 900 |
\renewcommand{\thesection}{\setthesection} |
| 901 |
\else |
| 902 |
\setcounter{subsection}{0} |
| 903 |
\renewcommand{\thesubsection}{\setthesubsection} |
| 904 |
\fi |
| 905 |
\if@pphyper |
| 906 |
% \end{macrocode} |
| 907 |
% Now handle the \Lpack{hyperref} tweaks. |
| 908 |
% \begin{macrocode} |
| 909 |
\if@chapter@pp |
| 910 |
\renewcommand{\theHsection}{\theH@pps.\setthesection}% |
| 911 |
\else |
| 912 |
\renewcommand{\theHsubsection}{\theH@pps.\setthesubsection}% |
| 913 |
\fi |
| 914 |
\xdef\Hy@chapapp{\Hy@appendixstring}% |
| 915 |
\fi |
| 916 |
} |
| 917 |
|
| 918 |
% \end{macrocode} |
| 919 |
% \end{macro} |
| 920 |
% |
| 921 |
% \begin{environment}{subappendices} |
| 922 |
% The environment for subappendices. Start it off by doing the resetting |
| 923 |
% of the |\(sub)section| command. |
| 924 |
% \changes{v1.1}{2000/02/29}{Added subappendices environment} |
| 925 |
% \begin{macrocode} |
| 926 |
\newenvironment{subappendices}{% |
| 927 |
\@resets@ppsub |
| 928 |
% \end{macrocode} |
| 929 |
% There are two options applicable to the chapter style. To implement |
| 930 |
% the \Lopt{titletoc} option, we redefine the |\addcontentsline| command. |
| 931 |
% \begin{macrocode} |
| 932 |
\if@chapter@pp |
| 933 |
\if@dotitletoc@pp \@redotocentry@pp{section} \fi |
| 934 |
% \end{macrocode} |
| 935 |
% To implement the \Lopt{title} option we do cunning things with the |
| 936 |
% |\@seccntformat| command. |
| 937 |
% \begin{macrocode} |
| 938 |
\if@dotitle@pp |
| 939 |
\def\sectionname{\appendixname} |
| 940 |
\def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }% |
| 941 |
\csname the##1\endcsname\quad} |
| 942 |
\fi |
| 943 |
\else |
| 944 |
% \end{macrocode} |
| 945 |
% The rest of the code is for the section style. |
| 946 |
% \begin{macrocode} |
| 947 |
\if@dotitletoc@pp \@redotocentry@pp{subsection} \fi |
| 948 |
\if@dotitle@pp |
| 949 |
\def\subsectionname{\appendixname} |
| 950 |
\def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }% |
| 951 |
\csname the##1\endcsname\quad} |
| 952 |
\fi |
| 953 |
\fi}{} |
| 954 |
|
| 955 |
% \end{macrocode} |
| 956 |
% \end{environment} |
| 957 |
% |
| 958 |
% \begin{macro}{\@formatsecmark@pp} |
| 959 |
% Formats the page header for a redefined |\sectionmark|. |
| 960 |
% \begin{macrocode} |
| 961 |
\newcommand{\@formatsecmark@pp}[1]{% |
| 962 |
\MakeUppercase{\appendixname\space |
| 963 |
\ifnum \c@secnumdepth >\z@ |
| 964 |
\thesection\quad |
| 965 |
\fi |
| 966 |
#1}} |
| 967 |
% \end{macrocode} |
| 968 |
% \end{macro} |
| 969 |
% |
| 970 |
% \begin{macro}{\@redotocentry@pp} |
| 971 |
% In order to implement the \Lopt{titletoc} option we redefine the |
| 972 |
% |\addcontentsline| command which is used to put entries into the ToC. |
| 973 |
% |\@redotocentry@pp{|\meta{sect}|}| does the redefinition, where \meta{sect} |
| 974 |
% is the name of the sectional heading (i.e., either chapter or section). |
| 975 |
% \changes{v1.2}{2002/08/06}{Replaced ifthen package code in |
| 976 |
% \cs{@redotocentry@pp} by \cs{ifx} code.} |
| 977 |
% \changes{v1.2}{2002/08/06}{HW mods to \cs{@redotocentry@pp}} |
| 978 |
% \begin{macrocode} |
| 979 |
\newcommand{\@redotocentry@pp}[1]{% |
| 980 |
% \end{macrocode} |
| 981 |
% Save the original definition of |\addcontentsline|. Then start the |
| 982 |
% redefinition. |
| 983 |
% \begin{macrocode} |
| 984 |
\let\oldacl@pp=\addcontentsline |
| 985 |
\def\addcontentsline##1##2##3{% |
| 986 |
% \end{macrocode} |
| 987 |
% Check if writing to ToC and appropriate section. |
| 988 |
% \begin{macrocode} |
| 989 |
\def\@pptempa{##1}\def\@pptempb{toc}% |
| 990 |
\ifx\@pptempa\@pptempb |
| 991 |
% \end{macrocode} |
| 992 |
% Adding to the ToC file, so check on the sectioning command. |
| 993 |
% \begin{macrocode} |
| 994 |
\def\@pptempa{##2}\def\@pptempb{#1}% |
| 995 |
\ifx\@pptempa\@pptempb |
| 996 |
% \end{macrocode} |
| 997 |
% The sectioning command is the same as that specified by the argument to |
| 998 |
% |\@redotocentry@pp|, so get on with the redefinition. |
| 999 |
% \begin{macrocode} |
| 1000 |
\oldacl@pp{##1}{##2}{\appendixname\space ##3}% |
| 1001 |
\else |
| 1002 |
% \end{macrocode} |
| 1003 |
% The heading was different from the argument. No redefinition is required, so |
| 1004 |
% call the original |\addcontentsline|. |
| 1005 |
% \begin{macrocode} |
| 1006 |
\oldacl@pp{##1}{##2}{##3}% |
| 1007 |
\fi |
| 1008 |
\else |
| 1009 |
% \end{macrocode} |
| 1010 |
% Adding to a file that is not the ToC. No redefinition is required, so |
| 1011 |
% call the original |\addcontentsline|. |
| 1012 |
% \begin{macrocode} |
| 1013 |
\oldacl@pp{##1}{##2}{##3}% |
| 1014 |
\fi} |
| 1015 |
} |
| 1016 |
% \end{macrocode} |
| 1017 |
% \end{macro} |
| 1018 |
% |
| 1019 |
% |
| 1020 |
% |
| 1021 |
% The end of this package. |
| 1022 |
% \begin{macrocode} |
| 1023 |
%</usc> |
| 1024 |
% \end{macrocode} |
| 1025 |
% |
| 1026 |
% |
| 1027 |
% \bibliographystyle{alpha} |
| 1028 |
% |
| 1029 |
% \begin{thebibliography}{GMS94} |
| 1030 |
% |
| 1031 |
% \bibitem[GMS94]{GOOSSENS94} |
| 1032 |
% Michel Goossens, Frank Mittelbach, and Alexander Samarin. |
| 1033 |
% \newblock {\em The LaTeX Companion}. |
| 1034 |
% \newblock Addison-Wesley Publishing Company, 1994. |
| 1035 |
% |
| 1036 |
% \bibitem[Wil96]{PRW96i} |
| 1037 |
% Peter~R. Wilson. |
| 1038 |
% \newblock {\em {LaTeX for standards: The LaTeX package files user manual}}. |
| 1039 |
% \newblock NIST Report NISTIR, June 1996. |
| 1040 |
% |
| 1041 |
% \end{thebibliography} |
| 1042 |
% |
| 1043 |
% \PrintIndex |
| 1044 |
% \Finale |
| 1045 |
% |
| 1046 |
\endinput |
| 1047 |
|
| 1048 |
%% \CharacterTable |
| 1049 |
%% {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 |
| 1050 |
%% 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 |
| 1051 |
%% Digits \0\1\2\3\4\5\6\7\8\9 |
| 1052 |
%% Exclamation \! Double quote \" Hash (number) \# |
| 1053 |
%% Dollar \$ Percent \% Ampersand \& |
| 1054 |
%% Acute accent \' Left paren \( Right paren \) |
| 1055 |
%% Asterisk \* Plus \+ Comma \, |
| 1056 |
%% Minus \- Point \. Solidus \/ |
| 1057 |
%% Colon \: Semicolon \; Less than \< |
| 1058 |
%% Equals \= Greater than \> Question mark \? |
| 1059 |
%% Commercial at \@ Left bracket \[ Backslash \\ |
| 1060 |
%% Right bracket \] Circumflex \^ Underscore \_ |
| 1061 |
%% Grave accent \` Left brace \{ Vertical bar \| |
| 1062 |
%% Right brace \} Tilde \~} |
| 1063 |
|
| 1064 |
|