Debian Codegraph @

texmf-dist/source/latex/combine/combine.dtx

raw
1 % \iffalse meta-comment
2 %
3 % combine.dtx
4 % Author: Peter Wilson, Herries Press
5 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
6 % Copyright 2000, 2001, 2002, 2003, 2004 Peter R. Wilson
7 % Copyright 2010 Will Robertson
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either
11 % version 1.3c of this license or (at your option) any
12 % later version: <http://www.latex-project.org/lppl.txt>
13 %
14 % This work has the LPPL maintenance status "maintained".
15 % The Current Maintainer of this work is Will Robertson.
16 %
17 % This work consists of the files listed in the README file.
18 %
19 %<*driver>
20 \NeedsTeXFormat{LaTeX2e}
21 \ProvidesFile{combine.dtx}
22 %</driver>
23 %<usc>\ProvidesClass{combine}
24 %<pck>\ProvidesPackage{combinet}
25 %<natpack>\ProvidesPackage{combnat}
26 %<citepack>\ProvidesPackage{combcite}
27 %<*usc|pck|natpack|citepack>
28 [2010/07/10 v0.7a
29 %</usc|pck|natpack|citepack>
30 %<usc> collection of documents
31 %<pck> document titles in ToC
32 %<natpack> combine version of natbib package
33 %<citepack> combine version of cite package
34 %<*usc|pck|natpack|citepack>
35 ]
36 %</usc|pck|natpack|citepack>
37 %
38 %<*driver>
39 \documentclass[twoside]{ltxdoc}
40 \makeatletter \@mparswitchfalse \makeatother
41 \EnableCrossrefs
42 \CodelineIndex
43 %%\OnlyDescription
44 \renewcommand{\MakeUppercase}[1]{#1}
45 \pagestyle{headings}
46 \setcounter{StandardModuleDepth}{1}
47 \begin{document}
48 \DocInput{combine.dtx}
49 \end{document}
50 %</driver>
51 %
52 % \fi
53 %
54 % \CheckSum{3858}
55 %
56 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
57 % \DoNotIndex{\@centercr,\@cite}
58 % \DoNotIndex{\@dotsep,\@empty,\@float,\@gobble,\@gobbletwo,\@ignoretrue}
59 % \DoNotIndex{\@input,\@ixpt,\@m}
60 % \DoNotIndex{\@minus,\@mkboth,\@ne,\@nil,\@nomath,\@plus,\@set@topoint}
61 % \DoNotIndex{\@tempboxa,\@tempcnta,\@tempdima,\@tempdimb}
62 % \DoNotIndex{\@tempswafalse,\@tempswatrue,\@viipt,\@viiipt,\@vipt}
63 % \DoNotIndex{\@vpt,\@warning,\@xiipt,\@xipt,\@xivpt,\@xpt,\@xviipt}
64 % \DoNotIndex{\@xxpt,\@xxvpt,\\,\ ,\addpenalty,\addtolength,\addvspace}
65 % \DoNotIndex{\advance,\Alph,\alph}
66 % \DoNotIndex{\arabic,\ast,\begin,\begingroup,\bfseries,\bgroup,\box}
67 % \DoNotIndex{\bullet}
68 % \DoNotIndex{\cdot,\cite,\CodelineIndex,\cr,\day,\DeclareOption}
69 % \DoNotIndex{\def,\DisableCrossrefs,\divide,\DocInput,\documentclass}
70 % \DoNotIndex{\DoNotIndex,\egroup,\ifdim,\else,\fi,\em,\endtrivlist}
71 % \DoNotIndex{\EnableCrossrefs,\end,\end@dblfloat,\end@float,\endgroup}
72 % \DoNotIndex{\endlist,\everycr,\everypar,\ExecuteOptions,\expandafter}
73 % \DoNotIndex{\fbox}
74 % \DoNotIndex{\filedate,\filename,\fileversion,\fontsize,\framebox,\gdef}
75 % \DoNotIndex{\global,\halign,\hangindent,\hbox,\hfil,\hfill,\hrule}
76 % \DoNotIndex{\hsize,\hskip,\hspace,\hss,\if@tempswa,\ifcase,\or,\fi,\fi}
77 % \DoNotIndex{\ifhmode,\ifvmode,\ifnum,\iftrue,\ifx,\fi,\fi,\fi,\fi,\fi}
78 % \DoNotIndex{\input}
79 % \DoNotIndex{\jobname,\kern,\leavevmode,\let,\leftmark}
80 % \DoNotIndex{\list,\llap,\long,\m@ne,\m@th,\mark,\markboth,\markright}
81 % \DoNotIndex{\month,\newcommand,\newcounter,\newenvironment}
82 % \DoNotIndex{\NeedsTeXFormat,\newdimen}
83 % \DoNotIndex{\newlength,\newpage,\nobreak,\noindent,\null,\number}
84 % \DoNotIndex{\numberline,\OldMakeindex,\OnlyDescription,\p@}
85 % \DoNotIndex{\pagestyle,\par,\paragraph,\paragraphmark,\parfillskip}
86 % \DoNotIndex{\penalty,\PrintChanges,\PrintIndex,\ProcessOptions}
87 % \DoNotIndex{\protect,\ProvidesClass,\raggedbottom,\raggedright}
88 % \DoNotIndex{\refstepcounter,\relax,\renewcommand,\reset@font}
89 % \DoNotIndex{\rightmargin,\rightmark,\rightskip,\rlap,\rmfamily,\roman}
90 % \DoNotIndex{\roman,\secdef,\selectfont,\setbox,\setcounter,\setlength}
91 % \DoNotIndex{\settowidth,\sfcode,\skip,\sloppy,\slshape,\space}
92 % \DoNotIndex{\symbol,\the,\trivlist,\typeout,\tw@,\undefined,\uppercase}
93 % \DoNotIndex{\usecounter,\usefont,\usepackage,\vfil,\vfill,\viiipt}
94 % \DoNotIndex{\viipt,\vipt,\vskip,\vspace}
95 % \DoNotIndex{\wd,\xiipt,\year,\z@}
96 %
97 % \changes{v0.1}{2000/04/29}{First public release as `collection' class}
98 % \changes{v0.2}{2000/05/07}{First public release with class changed to `combine'}
99 % \changes{v0.3}{2000/05/20}{Fix newtheorem and letter class}
100 % \changes{v0.3}{2000/05/20}{Add title formatting}
101 % \changes{v0.4}{2000/05/27}{Reset counters, ToC formatting}
102 % \changes{v0.41}{2000/06/18}{Added and used \cs{appendiargdef}}
103 % \changes{v0.42}{2001/04/04}{Fixed(?) problem with fancyhdr package}
104 % \changes{v0.5}{2001/07/03}{Added the combnat package}
105 % \changes{v0.51}{2001/07/09}{Fixed problem with \cs{appendix} in imports}
106 % \changes{v0.51}{2001/07/09}{Fixed problem with ordering of
107 % \cs{coltocauthor} and \cs{coltoctitle}}
108 % \changes{v0.52}{2001/08/25}{Fixed problem with `wrapped class' imports}
109 % \changes{v0.53}{2001/09/05}{Fixed problem with spaces in ToC entries}
110 % \changes{v0.54}{2001/12/19}{Added text about exam class}
111 % \changes{v0.6}{2002/08/24}{Added option for single bibliography}
112 % \changes{v0.61}{2003/05/22}{Minimal tweak to combnat}
113 % \changes{v0.62}{2003/07/19}{Minimal addition to combine}
114 % \changes{v0.63}{2003/11/09}{Memoir option added to combine}
115 % \changes{v0.63}{2003/11/09}{Added the combcite package}
116 % \changes{v0.64}{2004/03/06}{Minor change to combinet package}
117 % \changes{v0.64a}{2004/05/07}{Minor change to the abstract}
118 % \changes{v0.64b}{2009/09/02}{New maintainer (Will Robertson)}
119 % \changes{v0.7}{2010/03/22}{Bug fix and new (simpler) file versioning scheme}
120 %
121 % \GetFileInfo{combine.dtx}
122 %
123 % \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
124 % \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
125 % \newcommand*{\file}[1]{\texttt {#1}} ^^A typeset a file
126 % \newcommand*{\Lcount}[1]{\textsl {\small#1}} ^^A typeset a counter
127 % \newcommand*{\pstyle}[1]{\textsl {#1}} ^^A typeset a pagestyle
128 % \newcommand*{\Lenv}[1]{\texttt {#1}} ^^A typeset an environment
129 %
130 % \title{The \Lpack{combine} class and the packages\\ \Lpack{combinet},
131 % \Lpack{combnat} and \Lpack{combcite}\thanks{This file (\texttt{combine.dtx})
132 % has version number \fileversion, last revised \filedate.}}
133 %
134 % \author{%
135 % Peter Wilson, Herries Press^^A
136 % \thanks{Dick Nickalls (\texttt{[email protected]})
137 % provided several requirements and suggestions.
138 % He also very helpfully tested earlier experimental versions.}\\
139 % \\~
140 % Maintainer: Will Robertson\\
141 % \texttt{will dot robertson at latex-project dot org}%
142 % }
143 % \date{\filedate}
144 % \maketitle
145 % \begin{abstract}
146 % The \Lpack{combine} class can be used to assemble a group
147 % of individual \LaTeX{} documents into a single document,
148 % such as required for a conference proceedings. Typically the documents
149 % are all of the same class, but with some limitations on ordering
150 % may be of different classes (e.g., several \Lpack{article}s with
151 % one \Lpack{letter}).
152 % The class requires the \Lpack{keyval} package.
153 %
154 % The accompanying \Lpack{combinet} and \Lpack{combnat} packages
155 % respectively let
156 % the titles of imported documents be added to the main ToC, and
157 % enable the \Lpack{combine} class and the \Lpack{natbib} package
158 % to cooperate. The \Lpack{combcite} package enables the \Lpack{cite}
159 % package to cooperate.
160 % \end{abstract}
161 % \tableofcontents
162 %
163 %
164 %
165 % \section{Introduction}
166 %
167 % Questions about making a collection of different articles into a single
168 % document
169 % seem to pop up fairly regularly on the
170 % \texttt{comp.text.tex} newsgroup.
171 % The \Lpack{combine} class provides a solution for this problem.
172 %
173 % This manual is typeset according to the conventions of the
174 % \LaTeX{} \textsc{docstrip} utility which enables the automatic
175 % extraction of the \LaTeX{} macro source files~\cite{GOOSSENS94}.
176 %
177 % Section~\ref{sec:usc} describes the usage of the \Lpack{combine} class and
178 % Sections~\ref{pack} and~\ref{natpack} describe the \Lpack{combinet}
179 % and \Lpack{combnat} packages. Section~\ref{citepack} describes
180 % the \Lpack{combcite} package.
181 % Commented source code for the class is in Section~\ref{sec:code}.
182 % The class requires the \Lpack{keyval} package to be available.
183 % Commented source code for the \Lpack{combinet} package is in
184 % Section~\ref{packcode}, for \Lpack{combnat} is in
185 % Section~\ref{natpackcode} and for \Lpack{combcite} is in
186 % Section~\ref{citepackcode}.
187 %
188 % Note that the version number and date given for this file does not
189 % necessarily match version numbers or dates for the class and packages.
190 %
191 % \section{The \Lpack{combine} class} \label{sec:usc}
192 %
193 % The \Lpack{combine} class enables a group of individual
194 % \LaTeX{} documents to be imported and assembled into a single document. All
195 % the individual documents should be of the same class (e.g., all
196 % \Lpack{article} or all \Lpack{report}).
197 %
198 % Sectioning, cross-referencing, bibliographies, etc., are local within
199 % each imported document. Various means are provided for controlling local
200 % Table of Contents, the format of |\maketitle|, and so on, without having
201 % to make any changes to the original of an imported document.
202 %
203 % Here is a simple example file which might be the skeleton for a
204 % conference proceedings.
205 % \begin{verbatim}
206 % \documentclass[11pt]{combine}
207 %
208 % \title{Proceedings of the ...}
209 % \author{A. N. Editor\thanks{Support ...}}
210 % \date{29 February, 2000}
211 %
212 % \begin{document}
213 % \pagestyle{combine} % use the combine page style
214 % \maketitle % main title
215 % \tableofcontents % main ToC
216 % \clearpage
217 %
218 % \section{Editor's introduction} \label{intro} % into main ToC (section 1)
219 %
220 % In the article by A.~N.~Author on page~\pageref{art1} ...
221 %
222 % \begin{papers} % start of individual articles/papers
223 % \coltoctitle{An article} % first article title into main ToC
224 % \coltocauthor{A.~N.~Author} % first authors into main ToC
225 % \label{art1}
226 % \import{art1} % first article, may have own ToC,
227 % % bibliography, etc.
228 % \coltoctitle{Another article}
229 % \coltocauthor{A.~N.~Other}
230 % \label{art2}
231 % \import{art2}
232 % \end{papers} % end of individual articles/papers
233 %
234 % \clearpage
235 % \section{Acknowledgements} % into main ToC (section 2)
236 %
237 % Among the many ...
238 %
239 % \end{document}
240 % \end{verbatim}
241 %
242 % \subsection{Class options}
243 %
244 % As well as providing all the class options appropriate for
245 % the class of the individual documents, the \Lpack{combine}
246 % class provides the following additional options:
247 % \begin{itemize}
248 % \item \Lopt{memoir}, \Lopt{book}, \Lopt{report}, and \Lopt{letter}.
249 % By default the \Lpack{article}
250 % class is assumed for both the main and the imported documents.
251 % These options change the class to \Lpack{memoir}, \Lpack{book}, \Lpack{report} or
252 % \Lpack{letter}, respectively.
253 % \item \Lopt{colclass=\meta{class}}. This option changes
254 % the `classes' to \meta{class}. For example, specifying
255 % |colclass=phdthesis| will use the \Lpack{phdthesis}
256 % class\footnote{Whatever that is.} definitions
257 % throughout the entire document.
258 %
259 % Note that if you use this option there are likely to be \LaTeX{}
260 % warnings about \texttt{Unused global option(s): [colclass=\ldots]}.
261 %
262 % \item \Lopt{classes}. This option enables the imported documents
263 % to be of different classes. For example, embedding a letter
264 % into a compendium of articles. Using this option may
265 % induce a plethora of \LaTeX{} errors and the printed results
266 % may be unpredictable. If this happens, try hitting `q' to
267 % put \LaTeX{} into
268 % its `quiet batch' processing mode and then examine the typeset result
269 % for usability.
270 %
271 % Different classes of imported documents should not be mixed
272 % within a single |papers| environment. Also, imported documents
273 % whose class is the same but which differs from the main class
274 % should be within a single |papers| environment. For example,
275 % if several letters are to be imported into a collection
276 % of articles, the letters must not be scattered between different
277 % |papers| environments, although the imported articles can be
278 % scattered.
279 %
280 % \item \Lopt{packages}. By default all |\usepackage| commands in
281 % imported documents are ignored. If this is not desired,
282 % then the \Lopt{packages} option will enable the imported
283 % |\usepackage| commands(s). If this option is used, then only
284 % the first occurrence of a package is actually used and is not
285 % available to any later imported documents.
286 %
287 % Generally speaking, it is advisable to put all |\usepackage|
288 % commands into the preamble of the main document.
289 %
290 % \item \Lopt{layouts}. By default, a single setting of the
291 % page layout is used throughout the document. The \Lopt{layouts}
292 % option takes account of any changes to the |\textwidth|,
293 % |\textheight|, etc., in the imported documents.
294 %
295 % \item \Lopt{folios}. The page numbers are sequential throughout
296 % the document. When the |plain| page style is used, the
297 % \Lopt{folios} option will display the
298 % local page numbers of imported documents as well as the
299 % the main page number. This may have unfortunate consequences
300 % on the page numbers in ToC, etc., entries as they may well
301 % refer to local rather than global page numbers.
302 %
303 % \item \Lopt{notoc}. Disables the inclusion of a Table of Contents
304 % in any imported document.
305 % \item \Lopt{nolof}. Disables the inclusion of a List of Figures
306 % in any imported document.
307 % \item \Lopt{nolot}. Disables the inclusion of a List of Tables
308 % in any imported document.
309 % \item \Lopt{maintoc}. Adds all imported documents ToC, LoF, LoT, etc.,
310 % entries to the main document ToC, LoF, \ldots
311 % \item \Lopt{notitle}. Disables title printing by any |\maketitle|
312 % in any imported document.
313 % \item \Lopt{noauthor}. Disables author printing by any |\maketitle|
314 % in any imported document.
315 % \item \Lopt{date}. By default, date printing by any |\maketitle|
316 % in any imported document is disabled. This option causes
317 % the date(s) to be printed.
318 % \item \Lopt{nomaketitle}. Disables all printing by any |\maketitle|
319 % in any imported document.
320 % \item \Lopt{nopubindoc}. Disables the printing of the |\published|
321 % information within an imported document.
322 % \item \Lopt{nopubintoc}. Disables the printing of the |\published|
323 % information within the main ToC.
324 % \item \Lopt{onebib}. Disables imported bibliographies and puts all
325 % citations in the main document's bibliography.
326 % \item \Lopt{combinedbib}. Individual imported bibliographies and
327 % also all citations put into the main document's bibliography.
328 % \end{itemize}
329 %
330 % The \Lpack{combine}
331 % class may be able to incorporate any class of imported documents by
332 % setting an appropriate value for the \Lopt{colclass} option and perhaps
333 % doing some additional work.
334 %
335 % For example, if you want to have a collection of examination papers
336 % which were each is originally produced using the \Lpack{exam} class,
337 % then start off with: \\
338 % |\documentclass[...,colclass=exam]{combine} | \\
339 % The \Lpack{exam} class, though, does a couple of things that prevent
340 % \Lpack{combine} and \Lpack{exam} from working well together:
341 % \begin{itemize}
342 % \item \Lpack{exam} has its own version of |\section| which is totally at
343 % odds with the normal \Lpack{article} definition, and |\section*| is
344 % used by the |\tableofcontents| command.
345 % \item \Lpack{exam} does wonderful things at the end of a document. This
346 % is alright for imported documents in a |papers| environment but is an
347 % abject failure at the final end of the main document.
348 % \end{itemize}
349 %
350 % To get round these problems, put the following in the preamble to
351 % the main document:
352 % \begin{verbatim}
353 % \makeatletter
354 % \let\oldsection\section % keep exam's definition of \section
355 % \renewcommand{\section}{% % article's definition of \section
356 % \@startsection{section}{1]{\z@}%
357 % {-3.5ex \@plus -1ex \@minus -.2ex}%
358 % {2.3ex \@plus .2ex}%
359 % {\normalfont\Large\bfseries}}
360 % \makeatletter
361 % \end{verbatim}
362 % and in the document put: \\
363 % |\let\section\oldsection| \\
364 % immediately before the first |papers| environment.
365 %
366 % For the end document problem, put:
367 % \begin{verbatim}
368 % \makeatletter
369 % \let\@enddocumenthook\@oldenddocumenthook
370 % \makeatother
371 % \end{verbatim}
372 % immediately before the main document's |\end{document}|.
373 %
374 %
375 % \subsection{Class commands and environments}
376 %
377 % Within a \Lpack{combine} class document you can use any commands
378 % that are supported by the selected class.
379 % The following additional commands and environments are also
380 % provided.
381 %
382 % \DescribeEnv{papers}
383 % The environment |\begin{papers}[|\meta{text/code}|]...\end{papers}|
384 % provides a wrapper around imported file(s). Effectively, it modifies
385 % any |\documentclass| command or |document| environment within an
386 % imported file so that \LaTeX{} does not stop with an error at meeting
387 % these, or preamble-only commands like |\usepackage|, in the middle
388 % of a document.
389 %
390 % The optional argument is executed immediately at the start of
391 % the environment and its default value is |\cleardoublepage|.
392 % To avoid any forced page breaking you can call the environment with
393 % an empty optional argument (e.g., |\begin{papers}[]|).
394 %
395 %
396 % \DescribeMacro{\import}
397 % The command |\import{|\meta{texfile}|}| is a cross between the |\input|
398 % and |\include| commands, and should only be used within a |papers|
399 % environment. \meta{texfile} is the name of a \LaTeX{} file \emph{without}
400 % the |.tex| extension. For example, |\import{fred}| will attempt to
401 % read in a file called |fred.tex|. The \meta{texfile} should be a
402 % complete \LaTeX{} document file, from |\documentclass...| to
403 % |\end{document}|. The contents of \meta{texfile} will be typeset in
404 % the document at the point where it is imported, including any document
405 % title (via a |\maketitle|), Table of Contents, \ldots, Bibliography, etc.
406 %
407 % \DescribeMacro{\maketitle}
408 % The \Lpack{combine} class provides a |\maketitle| command, together with
409 % |\title|, |\author| and |\date| commands like those in the
410 % \Lpack{book/report/article} classes. A \Lopt{titlepage} option is only
411 % supported if the main class has a \Lopt{titlepage} option. For example,
412 % if the main class is \Lpack{article} then both |\maketitle| and the
413 % \Lopt{titlepage} option are supported, but if the main class is
414 % \Lpack{letter} then only the |\maketitle| command is provided.
415 %
416 % \DescribeMacro{\maintitlefont}
417 % \DescribeMacro{\postmaintitle}
418 % \DescribeMacro{\mainauthorfont}
419 % \DescribeMacro{\postmainauthor}
420 % \DescribeMacro{\maindatefont}
421 % \DescribeMacro{\postmaindate}
422 % These commands control the typesetting of the main document's |\maketitle|
423 % command. The |\title| is processed between the |\maintitlefont| and
424 % |\postmaintitle| commands; that is, like: \\
425 % |{\maintitlefont \title \postmaintitle}| \\
426 % and similarly for the |\author| and |\date| commands. The |\...main...|
427 % commands are initialised to mimic the normal result of |\maketitle|
428 % typesetting in the \Lpack{article/report} classes.
429 % For example, the default definitions of the |\...maintitle...|
430 % and |\...mainauthor...| commands are:\par
431 % \begin{small}
432 % \begin{verbatim}
433 % \newcommand{\maintitlefont}{\begin{center}\LARGE}
434 % \newcommand{\postmaintitle}{\par\end{center}\vskip 0.5em}
435 % \newcommand{\mainauthorfont}{\begin{center}
436 % \large \lineskip 0.5em%
437 % \begin{tabular}[t]{c}}
438 % \newcommand{\postmainauthor}{\end{tabular}\par\end{center}}
439 % \end{verbatim}
440 % \end{small}\par
441 % They can be renewed to obtain different effects, for instance removing
442 % the |center| environment from |\...title...| will result in the title
443 % being typeset as a normal paragraph.
444 %
445 % \DescribeMacro{\importtitlefont}
446 % \DescribeMacro{\postimporttitle}
447 % \DescribeMacro{\importauthorfont}
448 % \DescribeMacro{\postimportauthor}
449 % \DescribeMacro{\importdatefont}
450 % \DescribeMacro{\postimportdate}
451 % Without any options, the |\title| and |\author| commands
452 % are typeset by |\maketitle| commands in imported documents.
453 % Like the main document's |\maketitle|, the typesetting is controlled
454 % by these |\...import...| commands. The default definition for
455 % the title and author differ a little from the main document style,
456 % and are:\par
457 % \begin{small}
458 % \begin{verbatim}
459 % \newcommand{\importtitlefont}{\begin{center}\LARGE\bfseries}
460 % \newcommand{\postimporttitle}{\par\end{center}}
461 % \newcommand{\importauthorfont}{\begin{center}
462 % \large\itshape \lineskip 0.5em%
463 % \begin{tabular}[t]{c}}
464 % \newcommand{\postimportauthor}{\end{tabular}\par\end{center}}
465 % \end{verbatim}
466 % \end{small}\par
467 % The commands can be renewed to obtain different formatting.
468 %
469 % Note that if the \Lpack{titling} package is used with the \Lpack{combine}
470 % class, the \Lpack{titling} maketitle typesetting commands are unavailable,
471 % being replaced by the corresponding \Lpack{combine} commands above. Other
472 % aspects of \Lpack{titling}, like the |\thetitle| command, are still
473 % available for use.
474 %
475 % \DescribeMacro{\bodytitle}
476 % The |\bodytitle[|\meta{short title}|]{|\meta{long title}|}| command
477 % is similar
478 % to a |\chapter| or |\section| command, depending on the \meta{class}
479 % of document. It may be used for adding a numbered title heading into
480 % the main
481 % document and ToC for the following |\import{|\meta{texfile}|}|. There
482 % is also a starred version of the command, which produces an unnumbered
483 % title heading and makes no entry in the ToC. The numbering used for
484 % |\bodytitle| is independent from any other numbering sequence.
485 %
486 % \DescribeMacro{\coltoctitle}
487 % \DescribeMacro{\coltocauthor}
488 % The two commands |\coltoctitle{|\meta{title}|}| and
489 % |\coltocauthor{|\meta{author}|}| are for adding \meta{title} and
490 % \meta{author} to the main ToC, where \meta{title} is the compiler's
491 % choice for the title of the following |\import{|\meta{texfile}|}|
492 % and \meta{author} is for the names of the authors.
493 %
494 % \DescribeMacro{\published}
495 % The command |\published[|\meta{short}|]{|\meta{long}|}| can be used
496 % for putting the \meta{long} text into the body of the main document.
497 % If the optional argument is not used, then \meta{long} is also added
498 % to the main ToC. If the optional argument is used, then \meta{short}
499 % instead of \meta{long} is added to the ToC. The expectation is that this
500 % will be used for noting the original publication information for an
501 % imported document.
502 %
503 % \DescribeMacro{\pubfont}
504 % In the document body the text of the |\published| command is typeset
505 % using |\pubfont|. By default this is defined as |{\normalfont\centering}| to
506 % give centered text in the normal font. If, for example, you wanted
507 % it to be typeset ragged right in an italic font you would do: \\
508 % |\renewcommand{\pubfont}{\itshape\raggedright}|
509 %
510 % \DescribeMacro{\toctitleindent}
511 % \DescribeMacro{\tocauthorindent}
512 % \DescribeMacro{\tocpubindent}
513 % \DescribeMacro{\toctocindent}
514 % These are all lengths, and their values can be changed using
515 % |\setlength|. They control the extra indentation of an imported
516 % document's title, authors, publication information and section
517 % headings within the main ToC. The default value of |\toctitleindent|
518 % is 0em and the default for the other four is 1.5em. If any values
519 % are changed, this must be
520 % done before the |\tableofcontents| command in the main document.
521 % For example, the title texts are aligned at the left margin;
522 % to align them with the default position of authors do: \\
523 % |\setlength{\toctitleindent}{1.5em}|
524 %
525 % \DescribeMacro{\toctitlefont}
526 % \DescribeMacro{\tocauthorfont}
527 % \DescribeMacro{\tocpubfont}
528 % These macros specify the fonts to be used for typesetting the
529 % imported titles, authors and publishing information within the main ToC.
530 % Their default definitions are: \\
531 % |\newcommand{\toctitlefont}{\bfseries}| % bold titles \\
532 % |\newcommand{\tocauthorfont}{\itshape}| % italic authors \\
533 % |\newcommand{\tocpubfont}{\normalfont}| % normal font for published
534 %
535 % The class tries to keep any group of title/author/published entries
536 % in the ToC on one page, but sometimes TeX will insert a pagebreak anyway.
537 % The way of combating this is to make sure that the ToC page is broken
538 % \emph{before} the group. You can do this like: \\
539 % |\addtocontents{toc}{\protect\pagebreak}| \\
540 % |\coltoctitle{...} \coltocauthor{...}| etc.
541 %
542 % \DescribeMacro{\erasetitling}
543 % This macro `undefines' any previous |\coltoctitle|, |\coltocauthor|
544 % and/or |\published| commands; it is principally provided for use with the
545 % \Lpack{combinet} package.
546 %
547 %
548 % \DescribeMacro{combine}
549 % A new |combine| pagestyle is provided. This is like the |plain|
550 % pagestyle except that page numbers are put at the bottom outside corner
551 % of the page. This is the default pagestyle for the \Lpack{combine}
552 % class.
553 %
554 % Provided a |plain| (or |combine|) page style is used the pages
555 % are numbered in sequence throughout the document. If an imported document
556 % has any |empty| page style pages these will not be numbered.
557 %
558 % Unless the \Lopt{folios} option is used, all references to page
559 % numbers will be to the global page number. With the \Lopt{folios}
560 % options some references will be to global page numbers and some to
561 % local page numbers.
562 %
563 % You can, of course, define your own heading styles; I recommend
564 % the \Lpack{fancyhdr} package~\cite{FANCYHDR} if you do this. For example,
565 % if you had a collection of papers and you wanted to have the
566 % headers on the lefthand pages to have the title of the collection
567 % and the righthand pages to have the name of the current author(s), you
568 % can do this along the following lines.
569 % \begin{verbatim}
570 % \documentclass[report,twoside]{combine}
571 % \usepackage{fancyhdr}
572 % \title{The collection}
573 % \author{A. N. Editor}
574 % \pagestyle{fancy}
575 % \fancyhead[RO]{A. N. Editor}
576 % \fancyhead[LE]{The collection}
577 % \fancyfoot{}
578 % \fancyfoot[LE,RO]{\thepage}
579 % \newcommand{\authortochead}[1]{%
580 % \coltocauthor{#1}
581 % \fancyhead[RO]{#1}
582 % }
583 % ...
584 % \begin{document}
585 % \maketitle
586 % %% Editors introduction, ToC, etc
587 % \begin{papers}
588 % \coltoctitle{Paper 1}
589 % \authortochead{A. N. Author}
590 % \import{paper1}
591 % \cleardoublepage
592 % \coltoctitle{Paper 2}
593 % \authortochead{A. N. Other}
594 % \import{paper2}
595 % ...
596 % \end{verbatim}
597 %
598 %
599 % In order to ensure that all the material in an imported document
600 % is typeset, there is an inbuilt |\clearpage| command within the
601 % imported document's |\end{document}|. Thus, any material after an
602 % |\import| command will start on a new page.
603 %
604 % Here is another example file which might be the skeleton for a
605 % thesis that includes a copy of a published paper.
606 % \begin{verbatim}
607 % %%\documentclass{thesis} % replace this by
608 % \documentclass[colclass=thesis,classes,layouts]{combine}
609 % ... packages etc.,
610 %
611 % \title{Observations on the ...}
612 % \author{A. Candidate}
613 % \date{1 April, 2000}
614 % \addtolength{\toctitleindent}{2.3em} % extra main ToC indentation
615 % \addtolength{\tocauthorindent}{2.3em}
616 % \addtolength{\tocpubindent}{2.3em}
617 %
618 % \begin{document}
619 % \pagestyle{combine} % use the combine page style
620 % \maketitle % main title
621 % \tableofcontents % main ToC
622 % \clearpage
623 % ...
624 % lots of remarkable research results
625 % ...
626 % \appendix
627 % ...
628 % \section{Publication}
629 % \begin{papers}[]
630 % \coltoctitle{...}
631 % \published{Originally published in the
632 % \textit{Journal of Irreproducible Results}, 1987}
633 % \import{mypaper}
634 % \end{papers}
635 % ...
636 %
637 % \bibliography{refs} % main bibliography
638 % \end{document}
639 % \end{verbatim}
640 %
641 % Each imported file generates its own \file{.aux}, \file{.toc}, etc.,
642 % files. If a BibTeX database is used for the literature references
643 % in an imported document, then BibTeX must be run against the imported
644 % document, \emph{not} the main document, to resolve the citations.
645 % Citations are local to each imported document. There can, of course,
646 % also be a bibliography for citations made in the main document, as shown
647 % in the example file above.
648 %
649 % \DescribeMacro{\provideenvironment}
650 % This macro is like the |\providecommand| macro except that it applies
651 % to an environment instead of a command. It is required internally
652 % by the \Lpack{combine} class.
653 %
654 % \DescribeMacro{\providelength}
655 % \DescribeMacro{\providecounter}
656 % These macros are used internally. They are |\provide...|
657 % versions of the |\newlength| and |\newcounter| commands.
658 %
659 % \DescribeMacro{\zeroextracounters}
660 % The class attempts to initialise the counters used by each imported
661 % document. For example, the figure, equation, etc., counters are zeroed
662 % for each document. The |\zeroextracounters| command can be redefined so
663 % that it includes the zeroing of any additional counters that might have
664 % been introduced in a package or defined by the author. For example,
665 % if two different imports both define a (new) counter called, say,
666 % |mycounter|, then redefine the command like:
667 % \begin{verbatim}
668 % \renewcommand{\zeroextracounters}{%
669 % \@ifundefined{c@mycounter}{}{\setcounter{mycounter}{0}}
670 % }
671 % \end{verbatim}
672 %
673 % \DescribeMacro{\appendiargdef}
674 % The (internal) command |\appendiargdef{|\meta{macro}|}{|\meta{stuff}|}|
675 % appends \meta{stuff} at the end of the current definition of \meta{macro},
676 % where \meta{macro} is the name of a macro (including the backslash)
677 % which takes one argument. For example the following are two equivalent
678 % definitions of |\mymacro|:
679 % \par\begin{small}\begin{verbatim}
680 % \newcommand{\mymacro}[1]{#1 is a bagpiper}
681 % \appendiargdef{\mymacro}{ and of course is tone deaf}
682 % % or
683 % \newcommand{\mymacro}[1]{#1 is a bagpiper and of course is tone deaf}
684 % \end{verbatim}
685 % \end{small}\par
686 %
687 % \DescribeMacro{\emptyAtBeginDocument}
688 % Some combinations of circumstances cause an infinite recursion at the
689 % start of an imported document; in particular the combination of
690 % \texttt{combine + graphicx + caption2 + pdflatex} causes this. In this case
691 % the solution was to put |\emptyAtBeginDocument| immediately after the
692 % initial |\begin{document}|. It may also have worked if it had been added
693 % after each |\begin{papers}| or before each |\import{}|. An error message
694 % about being out of stack space may indicate recursion. Judicious use
695 % of |\emptyAtBeginDocument| may resolve the problem.
696 %
697 % \subsection{Imports in subdirectories}
698 %
699 % Authors may find it convenient to put the LaTeX source files for imported
700 % documents into subdirectories of the directory for the main document.
701 % Perhaps the easiest way to make this work is to set an environment
702 % variable so that LaTeX will look in the subdirectories of the current
703 % working directory for files it can't find.
704 %
705 % I use a teTeX system and can only talk about that distribution.
706 % The relevant environment variable, at least for document files, is
707 % |TEXINPUTS|. An example setting for this is: \\
708 % |TEXINPUTS=.//:${LOCALTEX}//:| \\
709 % The fragment |.//| tells LaTeX to look for files in the current directory,
710 % and recursively in its subdirectories. The fragment |:${LOCALTEX}//| tells
711 % LaTeX to look for files in the place defined by the environment variable
712 % |LOCALTEX|, and recursively in its subdirectories. The final |:| tells
713 % LaTeX to look in the standard teTeX defined places.
714 %
715 % \section{The \Lpack{combinet} package} \label{pack}
716 %
717 % The \Lpack{combinet} (COMBINE Title) package,
718 % which should only be used in conjunction
719 % with the \Lpack{combine} class, modifies the |\maketitle| command of
720 % all imported documents so that the imported document's title and/or
721 % author, if
722 % defined, are automatically added to the main document's ToC.
723 %
724 % This is presented as a package rather than as part of the
725 % \Lpack{combine} class as some unfortunate side effects may become
726 % apparent.
727 %
728 % If a |\coltoctitle| or |\coltocauthor| command has been given
729 % immediately prior to the import, then these will be put into the main
730 % ToC instead of the |\maketitle| texts. The |\erasetitling| command can
731 % be used to disable any prior |\coltoctitle|, |\coltocauthor| and
732 % |\published| commands.
733 %
734 % The package takes the following options.
735 % \begin{itemize}
736 % \item \Lopt{nomtitle}. Disable the |\maketitle| title
737 % from being added to the main ToC.
738 % \item \Lopt{nomauthor}. Disable the |\maketitle| author
739 % from being added to the main ToC.
740 % \item \Lopt{nothanks}. By default, the contents of a |\thanks| command
741 % will be added to the main ToC. This option prevents that, but
742 % may have unfortunate side effects if any |\title| or |\author|
743 % command has any embedded commands within the text.
744 % \item \Lopt{pub}. Put the text of an immediately prior |\published|
745 % command after the |\maketitle| typesetting, and add the text to the
746 % main ToC after any title or author. Remember that the \Lpack{combine}
747 % class options \Lopt{nopubindoc} and \Lopt{nopubindoc} can be used
748 % to inhibit printing of |\published| information.
749 % \item \Lopt{pubtop}. Put the text of an immediately prior |\published|
750 % command at the top of the |\maketitle| typesetting, and add the
751 % text to the
752 % main ToC after any title or author.
753 % \end{itemize}
754 %
755 % As noted above, embedded commands within a |\title| or |\author| may
756 % not transform well if they appear in the main ToC. In such cases you can
757 % use |\coltoctitle| or |\coltocauthor| for adding appropriate text to
758 % the main ToC, not forgetting to disable these after the import via
759 % |\erasetitling|.
760 %
761 % \section{The \Lpack{combnat} package} \label{natpack}
762 %
763 % The \Lpack{combine} class and Patrick Daly's \Lpack{natbib}
764 % package~\cite{NATBIB}
765 % both redefine some of the same basic LaTeX macros, and naturally
766 % the redefinitions are incompatible\footnote{Discovered by
767 % Thomas Hertweck (\texttt{[email protected]}) in
768 % June 2001.}.
769 %
770 % The \Lpack{combnat} (COMBine NATbib) package hopefully resolves this
771 % problem. With the \Lpack{combine} class you use \Lpack{combnat} instead
772 % of \Lpack{natbib}. That is, instead of: \\
773 % |\usepackage[|\meta{natbib-options}|]{natbib}|, simply do \\
774 % |\usepackage[|\meta{natbib-options}|]{combnat}| \\
775 % in the preamble of the main document. The package automatically calls
776 % the \Lpack{natbib} package with the given \meta{natbib-options} and
777 % then redefines some of the \Lpack{natbib} redefinitions to ensure
778 % \Lpack{combine/natbib} compatibility.
779 %
780 % For details on the \meta{natbib-options} and the other facilities,
781 % read the \Lpack{natbib} documentation~\cite{NATBIB}.
782 %
783 % \section{The \Lpack{combcite} package} \label{citepack}
784 %
785 % The \Lpack{combine} class and Donald Aresneau's \Lpack{cite}
786 % package~\cite{CITE}
787 % both redefine some of the same basic LaTeX macros, and naturally
788 % the redefinitions are incompatible\footnote{Discovered by
789 % Marcilio Alves (\texttt{[email protected]}) in
790 % November 2003.}
791 %
792 % The \Lpack{combcite} (COMBine CITE) package hopefully resolves this
793 % problem. With the \Lpack{combine} class you use \Lpack{combcite} instead
794 % of \Lpack{cite}. That is, instead of: \\
795 % |\usepackage[|\meta{cite-options}|]{cite}|, simply do \\
796 % |\usepackage[|\meta{cite-options}|]{combcite}| \\
797 % in the preamble of the main document. The package automatically calls
798 % the \Lpack{cite} package with the given \meta{cite-options} and
799 % then redefines some of the \Lpack{cite} redefinitions to ensure
800 % \Lpack{combine/cite} compatibility.
801 %
802 % For details on the \meta{cite-options} and the other facilities,
803 % read the \Lpack{cite} documentation~\cite{CITE}.
804 %
805 % The \Lpack{combcite} package requires the November 2003 version 4.01
806 % of \Lpack{cite}. This version covers the functions provided by the
807 % \Lpack{overcite} package. More precisely \\
808 % \verb?\usepackage[...]{overcite}? is implemented as \\
809 % \verb?\usepackage[superscript,...]{cite}?
810 %
811 %
812 % \section{Caveats}
813 %
814 % \LaTeX{} was designed to typeset a single document, where the document
815 % has one and only one |\documentclass| command and one and only one
816 % |document| environment. The \Lpack{combine} class attempts to handle
817 % a document that has multiple |\documentclass| commands and multiple
818 % |document| environments. In order to do this certain parts of the
819 % \LaTeX{} kernel code has had to be modified. Unfortunately, to make
820 % the usage of \Lpack{combine} completely transparent to the user would
821 % require very major surgery, with a high probability that with my skills
822 % the patient would die; being able to remove a hangnail does not imply
823 % the ability to perform a heart transplant.
824 %
825 % It is, of course, assumed that each imported document processes without
826 % error as an individual document.
827 %
828 % Essentially, be prepared for the unexpected, usually indicated
829 % by a rash of \LaTeX{} error messages about undefined commands or about
830 % defining an already defined command. These are usually caused by incorrect
831 % grouping.
832 %
833 % Commands, etc., defined in the main document are available to
834 % all imported
835 % documents. The |papers| environment forms a group. Commands
836 % defined within a group are local to the group and are not visible outside
837 % it. Another point is that \LaTeX{} will read the code for any given
838 % class or package only once. These facts have some consequences.
839 %
840 % \begin{itemize}
841 % \item The facilities provided by any package that is used by an imported
842 % file are only available within the first |papers| environment
843 % in which the package is called for. This is why it is recommended
844 % that all packages should be called for in the main document.
845 %
846 % \item Similarly for a class that is not the main class. For example,
847 % if the main class is \Lpack{article} and some letters are to be
848 % imported, then they must all be in the same |papers| environment.
849 % If they are in multiple |papers| environments, then only the first
850 % of these will have access to commands like |\address| which are
851 % defined by the \Lpack{letter} class (which is only read once and
852 % whose facilities are then local to the first of the |papers|).
853 %
854 % \item An imported document does not form a group (if it did, then only
855 % a single letter could be imported into an article class collection).
856 % If two imports in a single |papers| seperately use |\new...|
857 % commands
858 % with the same \meta{name}, then these \meta{name}s will be
859 % visible throughout
860 % the environment. \LaTeX{} will then normally report trying to define a
861 % pre-existing \meta{name}. The solution to this is either: (a) put
862 % the imports into different |papers|, or (b) enclose each import
863 % within a |\begingroup| \ldots |\endgroup| pair.
864 %
865 % \end{itemize}
866 %
867 % Not all problems can be solved by the above methods. For example, consider
868 % the case again of importing letters into an article collection. If two
869 % letters both define the same \meta{name}, then adding additional grouping
870 % will only change the `defining a pre-existing \meta{name}' problem into
871 % the `undefined |\address|' problem. A potential solution in this
872 % particular case
873 % would be to define all the \Lpack{letter} class specific \meta{name}s in the
874 % main document.
875 %
876 % Within a |papers| environment all |\newcommand| and |\newenvironment|
877 % commands are replaced by |\providecommand| and |\provideenvironment|
878 % respectively. This should stop \LaTeX{} from reporting the pre-existing
879 % \meta{name} error from these commands, but one and only one of the
880 % definitions will be available. |\newlength| and |\newcounter| commands
881 % are handled in the same manner. There is no equivalent for |\newtheorem|,
882 % but instead the |\newtheorem| command has been made local instead
883 % of global, so cunning use of grouping should be able to circumvent the
884 % problem of two seperate authors creating identically named
885 % theorems.
886 %
887 %
888 %
889 % \StopEventually{
890 % \bibliographystyle{alpha}
891 % \begin{thebibliography}{GMS94}
892 %
893 % \bibitem[Ars03]{CITE}
894 % Donald Arseneau.
895 % \newblock \emph{Cite: Compressed, sorted lists of on-line
896 % or superscript numerical citations}.
897 % \newblock November 2003.
898 % \newblock (Available from CTAN in directory
899 % \texttt{macros/latex/contrib/cite})
900 %
901 % \bibitem[Dal99]{NATBIB}
902 % Patrick W. Daly.
903 % \newblock \emph{Natural Sciences Citations and References}.
904 % \newblock May 1999.
905 % \newblock (Available from CTAN in directory
906 % \texttt{macros/latex/contrib/natbib})
907 %
908 % \bibitem[GMS94]{GOOSSENS94}
909 % Michel Goossens, Frank Mittelbach, and Alexander Samarin.
910 % \newblock \emph{The LaTeX Companion}.
911 % \newblock Addison-Wesley Publishing Company, 1994.
912 %
913 % \bibitem[Oos96]{FANCYHDR}
914 % Piet van Oostrum.
915 % \newblock \emph{Page layout in LaTeX}.
916 % \newblock June 1996.
917 % \newblock (Available from CTAN in directory
918 % \texttt{macros/latex/contrib/fancyhdr})
919 %
920 %
921 % \end{thebibliography}
922 % }
923 %
924 %
925 % \section{The \Lpack{combine} class code} \label{sec:code}
926 %
927 % There are various difficulties to be overcome by the
928 % \Lpack{combine} code, some seemingly inherent in \TeX{} itself and
929 % others by the \LaTeX{} kernel code. These include, but are not limited to:
930 % \begin{itemize}
931 % \item TeX{} was not designed for processing multiple documents.
932 % \item There can only be one |\documentclass| command within
933 % a document.
934 % \item There are many \LaTeX{} commands that can only be used in
935 % the preamble, and the preamble is closed by the (first) |\begin{document}|.
936 % \item There is a single global page number, which may be reset to one
937 % at any point in any document. If this occurs in an imported document
938 % then the page numbering for the main document is similarly reset.
939 % \item |\label|s are global in nature, and with multiple imported
940 % documents there are likely to be labels with the same name in two
941 % or more of these.
942 % \item Many of the kernel (and standard classes) commands use
943 % the page number; sometimes the use is buried at the end of a chain
944 % of macros.
945 % \end{itemize}
946 %
947 % A design goal for \Lpack{combine} is that virtually any kind
948 % of document should be importable and should be processible without
949 % have to make any changes to it. To completely satisfy this would
950 % require a rewrite of much of the \LaTeX{} kernel, which is out
951 % of the question. Of necessity some changes have had to be made but
952 % these have been limited as far as possible. I think that a collection
953 % that consists of documents that are all of the same class should
954 % process without interruption.
955 %
956 % When there are mixed classes, \LaTeX{}
957 % reads in the code for each class. An example is importing a \Lpack{letter}
958 % class document into an \Lpack{article} class collection.
959 % If the same command is defined
960 % by |\newcommand| in two or more of these classes, then \LaTeX{}
961 % complains and I see no way of getting around this without rewriting
962 % all the classes and kernel to use |\def| instead of |\newcommand|.
963 % In any event, if this happens, try responding to the errors by hitting
964 % `q' to put \LaTeX{} into a batch mode. The typeset result may be useable.
965 %
966 % To try and avoid name clashes, all the internal commands include
967 % the string |c@l|.
968 %
969 % \section{Preliminaries}
970 %
971 % Announce the name and version of the class, which requires
972 % \LaTeXe{} and the \Lpack{keyval} package.
973 % (This now happens at the top of DTX file so doesn't appear here.)
974 % \changes{v0.53}{2001/09/05}{Class is now v0.45}
975 % \changes{v0.6}{2002/08/24}{Class is now v0.5}
976 % \changes{v0.63}{2003/11/09}{Class is now v0.52}
977 % \begin{macrocode}
978 %<*usc>
979 \RequirePackage{keyval}
980 % \end{macrocode}
981 %
982 % \begin{macro}{\c@lclass}
983 % |\c@lclass| stores the class name, which by default is |article|.
984 % \begin{macrocode}
985 \newcommand{\c@lclass}{article}
986 % \end{macrocode}
987 % \end{macro}
988 %
989 % \begin{macro}{\c@l@tempa}
990 % \begin{macro}{\c@l@getoptionname}
991 % The next code chunk is based on code posted to the \texttt{ctt} newsgroup
992 % by Heiko Oberdiek (\texttt{[email protected]}) on 18~April 2000.
993 % The code, by some miraculous means, sets up a keyed class option.
994 % \begin{macrocode}
995 \define@key{COLCLASS}{colclass}[article]%
996 {\renewcommand{\c@lclass}{#1}
997 \ClassWarningNoLine{combine}
998 {Expect warnings like:\MessageBreak
999 \space\space LaTeX Warning: Unused global option(s):\MessageBreak
1000 \space\space\space\space [colclass=#1]}}
1001 \let\c@l@tempa\@empty
1002 \def\c@l@getoptionname#1=#2\@nil{#1}
1003 \@for\CurrentOption:=\@classoptionslist\do{%
1004 \@ifundefined{%
1005 KV@COLCLASS@\expandafter\c@l@getoptionname\CurrentOption=\@nil
1006 }%
1007 {% other options
1008 }{%
1009 \edef\c@l@tempa{\c@l@tempa,\CurrentOption,}%
1010 }%
1011 }%
1012 \edef\c@l@tempa{%
1013 \noexpand\setkeys{COLCLASS}{\c@l@tempa}%
1014 }
1015 \c@l@tempa
1016
1017 % \end{macrocode}
1018 % \end{macro}
1019 % \end{macro}
1020 %
1021 % The following |\if...| commands are for implementing various options.
1022 % \changes{v0.4}{2000/05/27}{Unnested some macro environments to save save stack space}
1023 % \begin{macro}{\ifc@lclasses}
1024 % \begin{macrocode}
1025 \newif\ifc@lclasses
1026 \c@lclassesfalse
1027 % \end{macrocode}
1028 % \end{macro}
1029 % \begin{macro}{\ifc@lpackages}
1030 % \begin{macrocode}
1031 \newif\ifc@lpackages
1032 \c@lpackagesfalse
1033 % \end{macrocode}
1034 % \end{macro}
1035 % \begin{macro}{\ifc@llayouts}
1036 % \begin{macrocode}
1037 \newif\ifc@llayouts
1038 \c@llayoutsfalse
1039 % \end{macrocode}
1040 % \end{macro}
1041 % \begin{macro}{\ifc@lfolios}
1042 % \begin{macrocode}
1043 \newif\ifc@lfolios
1044 \c@lfoliosfalse
1045 % \end{macrocode}
1046 % \end{macro}
1047 % \begin{macro}{\ifc@lnotoc}
1048 % \begin{macrocode}
1049 \newif\ifc@lnotoc
1050 \c@lnotocfalse
1051 % \end{macrocode}
1052 % \end{macro}
1053 % \begin{macro}{\ifc@lnolof}
1054 % \begin{macrocode}
1055 \newif\ifc@lnolof
1056 \c@lnoloffalse
1057 % \end{macrocode}
1058 % \end{macro}
1059 % \begin{macro}{\ifc@lnolot}
1060 % \begin{macrocode}
1061 \newif\ifc@lnolot
1062 \c@lnolotfalse
1063 % \end{macrocode}
1064 % \end{macro}
1065 % \begin{macro}{\ifc@lmaintoc}
1066 % \begin{macrocode}
1067 \newif\ifc@lmaintoc
1068 \c@lmaintocfalse
1069 % \end{macrocode}
1070 % \end{macro}
1071 % \begin{macro}{\ifc@lnodate}
1072 % \begin{macrocode}
1073 \newif\ifc@lnodate
1074 \c@lnodatetrue
1075 % \end{macrocode}
1076 % \end{macro}
1077 % \begin{macro}{\ifc@lnoauthor}
1078 % \begin{macrocode}
1079 \newif\ifc@lnoauthor
1080 \c@lnoauthorfalse
1081 % \end{macrocode}
1082 % \end{macro}
1083 % \begin{macro}{\ifc@lnotitle}
1084 % \begin{macrocode}
1085 \newif\ifc@lnotitle
1086 \c@lnotitlefalse
1087 % \end{macrocode}
1088 % \end{macro}
1089 % \begin{macro}{\ifc@lnomaketitle}
1090 % \begin{macrocode}
1091 \newif\ifc@lnomaketitle
1092 \c@lnomaketitlefalse
1093 % \end{macrocode}
1094 % \end{macro}
1095 % \begin{macro}{\ifc@lnopubindoc}
1096 % \changes{v0.4}{2000/05/27}{Added nopubindoc and nopubintoc options}
1097 % \begin{macrocode}
1098 \newif\ifc@lnopubindoc
1099 \c@lnopubindocfalse
1100 % \end{macrocode}
1101 % \end{macro}
1102 % \begin{macro}{\ifc@lnopubintoc}
1103 % \begin{macrocode}
1104 \newif\ifc@lnopubintoc
1105 \c@lnopubintocfalse
1106 % \end{macrocode}
1107 % \end{macro}
1108 % \changes{v0.5}{2002/08/24}{Added onebib and combinedbib options}
1109 % \begin{macro}{\ifc@lonebib}
1110 % \begin{macrocode}
1111 \newif\ifc@lonebib
1112 \c@lonebibfalse
1113 % \end{macrocode}
1114 % \end{macro}
1115 % \begin{macro}{\ifc@lcombib}
1116 % \begin{macrocode}
1117 \newif\ifc@lcombib
1118 \c@lcombibfalse
1119 % \end{macrocode}
1120 % \end{macro}
1121 %
1122 %
1123 % Now declare and process the options.
1124 % \changes{v0.4}{2000/05/27}{Added book option}
1125 % \changes{v0.6}{2002/08/24}{Added onebib option}
1126 % \changes{v0.63}{2003/11/09}{Added memoir option}
1127 % \begin{macrocode}
1128
1129 \DeclareOption{book}{\def\c@lclass{book}}
1130 \DeclareOption{report}{\def\c@lclass{report}}
1131 \DeclareOption{letter}{\def\c@lclass{letter}}
1132 \DeclareOption{memoir}{\def\c@lclass{memoir}}
1133 \DeclareOption{classes}{\c@lclassestrue}
1134 \DeclareOption{packages}{\c@lpackagestrue}
1135 \DeclareOption{layouts}{\c@llayoutstrue}
1136 \DeclareOption{folios}{\c@lfoliostrue}
1137 \DeclareOption{notoc}{\c@lnotoctrue}
1138 \DeclareOption{nolof}{\c@lnoloftrue}
1139 \DeclareOption{nolot}{\c@lnolottrue}
1140 \DeclareOption{maintoc}{\c@lmaintoctrue}
1141 \DeclareOption{date}{\c@lnodatefalse}
1142 \DeclareOption{noauthor}{\c@lnoauthortrue}
1143 \DeclareOption{notitle}{\c@lnotitletrue}
1144 \DeclareOption{nomaketitle}{\c@lnomaketitletrue}
1145 \DeclareOption{nopubindoc}{\c@lnopubindoctrue}
1146 \DeclareOption{nopubintoc}{\c@lnopubintoctrue}
1147 \DeclareOption{onebib}{\c@lonebibtrue}
1148 \DeclareOption{combinedbib}{\c@lcombibtrue}
1149 \DeclareOption*{\PassOptionsToClass{\CurrentOption}{\c@lclass}}
1150 \ProcessOptions\relax
1151 \ifc@lcombib
1152 \c@lonebibtrue
1153 \fi
1154
1155 % \end{macrocode}
1156 %
1157 %
1158 % At this point, load the actual class (as specified by |\c@lclass|).
1159 % \begin{macrocode}
1160 \LoadClass{\c@lclass}
1161
1162 % \end{macrocode}
1163 %
1164 % \begin{macro}{\ifc@lhaschapter}
1165 % |\ifc@lhaschapter| is TRUE if the loaded class has chapters.
1166 % \begin{macrocode}
1167 \newif\ifc@lhaschapter
1168 \c@lhaschapterfalse
1169 \@ifundefined{chapter}{}{\c@lhaschaptertrue}
1170
1171 % \end{macrocode}
1172 % \end{macro}
1173 %
1174 % \begin{macro}{\if@titlepage}
1175 % The \Lpack{letter} class (and perhaps others) does not have a
1176 % |\maketitle| command, and therefor neither has a \Lopt{titlepage} option.
1177 % In this case we need a new |\if@titlepage| for later use when dealing
1178 % with |\maketitle|. A side effect of this implementation is that |\maketitle|
1179 % is available for any main document class.
1180 % \changes{v0.3}{2000/05/20}{Ensured \cs{if@titlepage} is defined}
1181 % \begin{macrocode}
1182 \@ifundefined{if@titlepage}{\newif\if@titlepage\@titlepagefalse}{}
1183 % \end{macrocode}
1184 % \end{macro}
1185 %
1186 % \begin{macro}{\ifc@ltoctitle}
1187 % \begin{macro}{\ifc@ltoctitle}
1188 % \begin{macro}{\ifc@lpub}
1189 % Boolean hooks for testing if |\coltoctitle|, |\coltocauthor| and
1190 % |\published| have been set.
1191 % \begin{macrocode}
1192 \newif\ifc@ltoctitle
1193 \c@ltoctitlefalse
1194 \newif\ifc@ltocauthor
1195 \c@ltocauthorfalse
1196 \newif\ifc@lpub
1197 \c@lpubfalse
1198
1199 % \end{macrocode}
1200 % \end{macro}
1201 % \end{macro}
1202 % \end{macro}
1203 %
1204 % \begin{macro}{colpage}
1205 % \begin{macro}{c@lctr}
1206 % \begin{macro}{\c@section}
1207 % |colpage| is a counter for storing the (current) page number for the
1208 % main document.
1209 % |c@lctr| is a counter for storing the current main document sectioning
1210 % number. A section counter (|\c@section|) is provided when the class
1211 % does not have sections.
1212 % \begin{macrocode}
1213 \newcounter{colpage} \setcounter{colpage}{1}
1214 \renewcommand{\thecolpage}{\arabic{colpage}}
1215 \newcounter{c@lctr}
1216 \@ifundefined{c@section}{\newcounter{section}}{}
1217
1218 % \end{macrocode}
1219 % \end{macro}
1220 % \end{macro}
1221 % \end{macro}
1222 %
1223 % \begin{macro}{\c@ltocfnum}
1224 % \begin{macro}{\c@lloffnum}
1225 % \begin{macro}{\c@llotfnum}
1226 % These are output stream numbers for local ToC, LoF and LoT files.
1227 % Allocating new streams for each imported file may cause \TeX{} to
1228 % run out of streams (there is a limit of 16).
1229 % \begin{macrocode}
1230 \newwrite\c@ltocfnum
1231 \newwrite\c@lloffnum
1232 \newwrite\c@llotfnum
1233
1234 % \end{macrocode}
1235 % \end{macro}
1236 % \end{macro}
1237 % \end{macro}
1238 %
1239 % \section{Kernel modifications (and potential additions)}
1240 %
1241 % Much of the class code consists of new versions of \LaTeX{} kernel commands.
1242 % Redefinitions starting with |\c@la...| are for commands in the main
1243 % document. Modifications starting |\c@lb...| are for commands within
1244 % imported documents.
1245 %
1246 %
1247 % \begin{macro}{\provideenvironment}
1248 % \begin{macro}{\c@lprovide@environment}
1249 % \begin{macro}{\c@lenvironment}
1250 % \begin{macro}{\c@lenva}
1251 % \begin{macro}{\c@lenvb}
1252 % \begin{macro}{\c@lthrowenv}
1253 % To stop \LaTeX{} whining when multiple classes are read which happen
1254 % to define commands (via |\newcommand|) or environments
1255 % (via |\newenvironment|) that have the same names, we need to be able
1256 % to make \LaTeX{} use |\providecommand| and |\provideenvironment|
1257 % instead. Unfortunately the kernel does not provide a |\provideenvironment|
1258 % command, so here is one based on the code in the \Lpack{makecmds} package.
1259 % \begin{macrocode}
1260 \def\provideenvironment{%
1261 \@star@or@long\c@lprovide@environment}
1262 \def\c@lprovide@environment#1{%
1263 \@ifundefined{#1}{%
1264 \expandafter\let\csname#1\endcsname\relax
1265 \expandafter\let\csname end#1\endcsname\relax
1266 \new@environment{#1}}{\c@lenvironment{#1}}
1267 }
1268 \def\c@lenvironment#1{%
1269 \@testopt{\c@lenva#1}0}
1270 \def\c@lenva#1[#2]{%
1271 \@ifnextchar [{\c@lenvb#1[#2]}{\c@lthrowenv{#1}{[#2]}}}
1272 \def\c@lenvb#1[#2][#3]{\c@lthrowenv{#1}{[#2][#3]}}
1273 \def\c@lthrowenv#1#2#3#4{}
1274
1275 % \end{macrocode}
1276 % \end{macro}
1277 % \end{macro}
1278 % \end{macro}
1279 % \end{macro}
1280 % \end{macro}
1281 % \end{macro}
1282 %
1283 % \begin{macro}{\c@lnamethm}
1284 % \begin{macro}{\@xnthm}
1285 % \begin{macro}{\@ynthm}
1286 % \begin{macro}{\@othm}
1287 % As pointed out by Hendri Hondrop\footnote{Email
1288 % from \texttt{[email protected]} on 16~May, 2000.}
1289 % |\newtheorem| commands in imported documents can interfere with each other.
1290 % My solution to this is to make the command local instead of global.
1291 % |\c@lnamethm| is a helper macro (removes the |\global| from the
1292 % |\@namedef|s in the original code), and the others are modifications
1293 % of the originals in \file{ltthm.dtx} (just removing any |\global| commands).
1294 % \changes{v0.3}{2000/05/20}{Added a local version of \cs{newtheorem}.}
1295 % \begin{macrocode}
1296 \@ifundefined{newtheorem}{}{%
1297 \newcommand{\c@lnamethm}[3]{%
1298 \@namedef{#1}{\@thm{#2}{#3}}%
1299 \@namedef{end#1}{\@endtheorem}}
1300 \def\@xnthm#1#2[#3]{%
1301 \expandafter\@ifdefinable\csname #1\endcsname
1302 {\@definecounter{#1}\@newctr{#1}[#3]%
1303 \expandafter\xdef\csname the#1\endcsname{%
1304 \expandafter\noexpand\csname the#3\endcsname \@thmcountersep
1305 \@thmcounter{#1}}%
1306 \c@lnamethm{#1}{#1}{#2}}}
1307 \def\@ynthm#1#2{%
1308 \expandafter\@ifdefinable\csname #1\endcsname
1309 {\@definecounter{#1}%
1310 \expandafter\xdef\csname the#1\endcsname{\@thmcounter{#1}}%
1311 \c@lnamethm{#1}{#1}{#2}}}
1312 \def\@othm#1[#2]#3{%
1313 \@ifundefined{c@#2}{\@nocounterr{#2}}%
1314 {\expandafter\@ifdefinable\csname #1\endcsname
1315 {\@namedef{the#1}{\@nameuse{the#2}}
1316 \c@lnamethm{#1}{#2}{#3}}}}
1317 }
1318
1319 % \end{macrocode}
1320 % \end{macro}
1321 % \end{macro}
1322 % \end{macro}
1323 % \end{macro}
1324 %
1325 % \begin{macro}{\providelength}
1326 % This is a |\provide...| version of |\newlength| (from \file{ltlength.dtx}).
1327 % \changes{v0.4}{2000/05/27}{Added \cs{providelength} and \cs{providecounter}
1328 % commands}
1329 % \changes{v0.63}{2003/11/09}{Used \cs{providecommand} for \cs{providelength}
1330 % and \cs{providecounter} as they are defined in the memoir class}
1331 % \begin{macrocode}
1332 \providecommand{\providelength}[1]{%
1333 \ifx #1\undefined
1334 \newlength{#1}
1335 \fi
1336 }
1337 % \end{macrocode}
1338 % \end{macro}
1339 %
1340 % \begin{macro}{\providecounter}
1341 % This is a |\provide...| version of |\newcounter| (from \file{ltcounts.dtx}).
1342 % \begin{macrocode}
1343 \providecommand{\providecounter}[1]{%
1344 \expandafter\ifx \csname c@#1\endcsname \undefined
1345 {\@definecounter{#1}}%
1346 \@ifnextchar[{\@newctr{#1}}{}
1347 \else
1348 \@ifnextchar[{\c@l@gobbleoptarg}{}
1349 \fi
1350 }
1351
1352 % \end{macrocode}
1353 % \end{macro}
1354 %
1355 % \begin{macro}{\c@l@gobbleoptarg}
1356 % A macro that discards an optional argument (i.e., the tokens |[optarg]|).
1357 % \changes{v0.4}{2000/05/27}{Added \cs{c@l@gobbleoptarg} command}
1358 % \begin{macrocode}
1359 \def\c@l@gobbleoptarg[#1]{}
1360
1361 % \end{macrocode}
1362 % \end{macro}
1363 %
1364 % \begin{macro}{\appendiargdef}
1365 % The code for this is copied from the \Lpack{abstract} package, hence
1366 % the use of |@bs| instead of |c@l| as a distinguishing substring.
1367 % \changes{v0.41}{2000/06/18}{Added \cs{appendiargdef} from the abstract package}
1368 % \begin{macrocode}
1369 \providecommand{\appendiargdef}[2]{\begingroup
1370 \toks@\expandafter{#1{##1}#2}%
1371 \edef\@bsx{\endgroup \def\noexpand#1####1{\the\toks@}}%
1372 \@bsx}
1373
1374 % \end{macrocode}
1375 % \end{macro}
1376 %
1377 %
1378 % \subsection{Document commands and environments}
1379 %
1380 % \begin{macro}{\c@lbdocumentclass}
1381 % The |\documentclass| in imported documents has to be changed so that
1382 % commands including the |@| sign are legal in the preamble. By default
1383 % the declared options and class are discarded. When the \Lopt{classes}
1384 % option is used, any potential new class file must be read.
1385 % |\documentclass|
1386 % is originally defined in \file{ltclass.dtx}.
1387 % \begin{macrocode}
1388 \ifc@lclasses
1389 \newcommand\c@lbdocumentclass{%
1390 \makeatletter %% added
1391 \let\newcommand\providecommand %% added
1392 \let\newenvironment\provideenvironment %% added
1393 %% \let\documentclass\@twoclasseserror
1394 %% \if@compatability\else\let\usepackage\RequirePackage\fi
1395 \@fileswithoptions\@clsextension
1396 }
1397 \else
1398 \newcommand{\c@lbdocumentclass}[2][\@empty]{%
1399 \makeatletter
1400 }
1401 \fi
1402
1403 % \end{macrocode}
1404 % \end{macro}
1405 %
1406 % \begin{macro}{\c@lbusepackage}
1407 % The |\usepackage| command (from \file{ltclass.dtx})
1408 % in imported documents is normally disabled.
1409 % This is the disabled version.
1410 % \begin{macrocode}
1411 \ifc@lpackages\else
1412 \newcommand{\c@lbusepackage}[2][\@empty]{}
1413 \fi
1414
1415 % \end{macrocode}
1416 % \end{macro}
1417 %
1418 % \begin{macro}{\c@lbLoadClass}
1419 % This is a copy of the |\LoadClass| from \file{ltclass.dtx}. I found it was
1420 % needed if an imported document used a class that in its turn used
1421 % |\LoadClass|.\footnote{Problem reported by Hans Fredrik Nordhaug
1422 % \texttt{[email protected]} on 2001/08/24.}
1423 % \changes{v0.52}{2001/08/25}{Added \cs{c@lbLoadClass}}
1424 % \begin{macrocode}
1425 \newcommand{\c@lbLoadClass}{%
1426 \ifx\@currext\@pkgextension
1427 \@latex@error{\noexpand\LoadClass in package file}%
1428 {You may only use \noexpand\LoadClass in a class file.}%
1429 \fi
1430 \@fileswithoptions\@clsextension}
1431
1432 % \end{macrocode}
1433 % \end{macro}
1434 %
1435 % The |\document| command (defined in \file{ltfiles.dtx}) has to be modified,
1436 % both for the main document (to allow later preamble commands and to
1437 % store the jobname of the main document), and similarly but not identically,
1438 % for the imported documents (output here is to the |\@partaux| file instead
1439 % of the |\@mainaux| file).
1440 %
1441 % \begin{macro}{\c@ltextblock}
1442 % |\c@ltextblock| is a macro holding some code that is common to both
1443 % |\c@ladocument| and |\c@lbdocument|.
1444 % \changes{v0.3}{2000/05/20}{Added \cs{c@ltextblock} command}
1445 % \begin{macrocode}
1446 \newcommand{\c@ltextblock}{%
1447 \@colht\textheight
1448 \@colroom\textheight \vsize\textheight
1449 \columnwidth\textwidth
1450 \@clubpenalty\clubpenalty
1451 \if@twocolumn
1452 \advance\columnwidth -\columnsep
1453 \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
1454 \fi
1455 \hsize\columnwidth \linewidth\hsize
1456 }
1457
1458 % \end{macrocode}
1459 % \end{macro}
1460 %
1461 % \begin{macro}{\c@ladocument}
1462 % \begin{macro}{\c@lbdocument}
1463 % \begin{macrocode}
1464 \newcommand{\c@ladocument}{%
1465 \endgroup
1466 \let\mainjobname\jobname %% added
1467 \def\c@lmainauxfile{\jobname.aux} %% added
1468 \ifx\@unusedoptionlist\@empty\else
1469 \@latex@warning@no@line{Unused global option(s):^^J%
1470 \@spaces[\@unusedoptionlist]}%
1471 \fi
1472 \c@ltextblock %% a replacement
1473 \begingroup\@floatplacement\@dblfloatplacement
1474 \makeatletter\let\@writefile\@gobbletwo
1475 \global \let \@multiplelabels \relax
1476 \@input{\c@lmainauxfile}% %% changed
1477 \endgroup
1478 \if@filesw
1479 \immediate\openout\@mainaux\c@lmainauxfile %% changed
1480 \immediate\write\@mainaux{\relax}%
1481 \fi
1482 \process@table
1483 \let\glb@currsize\@empty
1484 \normalsize
1485 \everypar{}%
1486 \ifx\normalsfcodes\@empty
1487 \ifnum\sfcode`\.=\@m
1488 \let\normalsfcodes\frenchspacing
1489 \else
1490 \let\normalsfcodes\nonfrenchspacing
1491 \fi
1492 \fi
1493 \@noskipsecfalse
1494 % \end{macrocode}
1495 % \begin{macro}{\@outputpage}
1496 % Imported documents may change the page number, which can then mess
1497 % up the numbering of later pages. The |colpage| counter is used
1498 % to synchronize the main document page numbering after any import.
1499 % To do this, it has to be incremented for each typeset page, so
1500 % this is added to the output routine (described in \file{ltoutput.dtx}).
1501 % This is done here in case any package in the main document has modified
1502 % |\@outputpage|, as the \Lpack{showframe} package does.
1503 % \changes{v0.4}{2000/05/27}{Moved the modification to \cs{@outputpage}
1504 % to within \cs{c@ladocument}}
1505 %
1506 % Similarly, the |\maketitle| command is made to be |\@clamaketitle| in case
1507 % some other package (e.g., \Lpack{titling}) has modified |\maketitle| after
1508 % the \Lpack{combine} class has done its thing.
1509 % \changes{v0.41}{2000/06/18}{Moved \cs{maketitle} letting to
1510 % \cs{c@lamaketitle} to inside \cs{c@ladocument}}
1511 % \begin{macrocode}
1512 \g@addto@macro{\@outputpage}{\stepcounter{colpage}} %% added
1513 \let\maketitle\c@lamaketitle %% added
1514 % \end{macrocode}
1515 % \end{macro}
1516 % \begin{macro}{\c@lthechap}
1517 % \begin{macro}{\c@lthesec}
1518 % Store the initial forms of |\thechapter| or |\thesection| for later
1519 % restoration after a possible |\appendix|.
1520 % \changes{v0.51}{2001/07/05}{Added \cs{c@lthechap} and \cs{c@lthesec}}
1521 % \begin{macrocode}
1522 \@ifundefined{c@chapter}% %% added
1523 {\@ifundefined{c@section}{}{\let\c@lthesec\thesection}}%
1524 {\let\c@lthechap\thechapter}
1525 % \end{macrocode}
1526 % \end{macro}
1527 % \end{macro}
1528 %
1529 % \begin{macrocode}
1530 \let \@refundefined \relax
1531 \let\AtBeginDocument\@firstofone
1532 \@begindocumenthook
1533 \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
1534 \global\@maxdepth\maxdepth
1535 %% \global\let\@begindocumenthook\@undefined
1536 \ifx\@listfiles\@undefined
1537 \global\let\@filelist\relax
1538 \global\let\@addtofilelist\@gobble
1539 \fi
1540 %% \gdef\do##1{\global\let ##1\@notprerr}%
1541 %% \@preamblecmds
1542 \global\let \@nodocument \relax
1543 \global\let\do\noexpand
1544 \ignorespaces}
1545
1546 % \end{macrocode}
1547 % For an imported document the \Lopt{layouts} option is implemented
1548 % in the |\document| command. The \Lpack{article},
1549 % \Lpack{report} and \Lpack{letter} classes all start of with the |plain|
1550 % page style, which is specified within the class file. When mixed classes
1551 % of imported documents are used the page style definitions can get
1552 % overwritten by the extra class(es). So, the revised |\document| command
1553 % resets the |plain| page style to the \Lpack{combine} class definition
1554 % and sets the initial page style to be |plain|.
1555 % \begin{macrocode}
1556 \newcommand{\c@lbdocument}{%
1557 %% \endgroup
1558 %% \ifx\@unusedoptionlist\@empty\else
1559 %% \@latex@warning@no@line{Unused global option(s):^^J%
1560 %% \@spaces[\@unusedoptionlist]}%
1561 %% \fi
1562 \ifc@llayouts %% layouts option
1563 \c@ltextblock
1564 \fi
1565 \begingroup\@floatplacement\@dblfloatplacement
1566 \makeatletter \let\@writefile\@gobbletwo
1567 %% \global \let \@multiplelabels \relax
1568 \@input{\c@lauxfile}%
1569 \endgroup
1570 \if@filesw
1571 \immediate\openout\@partaux\c@lauxfile
1572 \immediate\write\@partaux{\relax}%
1573 \fi
1574 \process@table
1575 \let\glb@currsize\@empty
1576 \normalsize
1577 \everypar{}%
1578 \@noskipsecfalse
1579 %% \let \@refundefined \relax
1580 \let\AtBeginDocument\@firstofone
1581 \@begindocumenthook
1582 \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
1583 \global\@maxdepth\maxdepth
1584 %% \global\let\@begindocumenthook\@undefined
1585 \ifx\@listfiles\@undefined
1586 \global\let\@filelist\relax
1587 \global\let\@addtofilelist\@gobble
1588 \fi
1589 %% \gdef\do##1{\global\let ##1\@notprerr}%
1590 %% \@preamblecmds
1591 \global\let \@nodocument \relax
1592 \global\let\do\noexpand
1593 \let\ps@plain\c@lbps@plain %% set pagestyle
1594 % \end{macrocode}
1595 % Setting |\pagestyle| here kills the use of any other style (e.g.,
1596 % a fancy style) in the imports\footnote{Problem discovered by Rumen
1597 % Bogdanovski (\texttt{[email protected]}) on 2001/04/03.}.
1598 % \changes{v0.41}{2001/04/04}{Eliminated page style setting for imports.}
1599 % \begin{macrocode}
1600 %% \pagestyle{plain}
1601 \ifc@lfolios %% folios option initialises page number
1602 \setcounter{page}{1}
1603 \fi
1604 \ifc@lhaschapter %% set chapter/section number
1605 \setcounter{c@lctr}{\value{chapter}}
1606 \setcounter{chapter}{0}
1607 \else
1608 \setcounter{c@lctr}{\value{section}}
1609 \setcounter{section}{0}
1610 \fi
1611 \c@lresetcounters %% added
1612 \makeatother %% added
1613 \ignorespaces}
1614
1615 % \end{macrocode}
1616 % \end{macro}
1617 % \end{macro}
1618 %
1619 % \begin{macro}{\c@lresetcounters}
1620 % This sets various counters to zero, and is called at the beginning of
1621 % an imported document.
1622 % \changes{v0.4}{2000/05/27}{Added \cs{c@lresetcounters} and
1623 % \cs{zeroextracounters} commands}
1624 % \changes{v0.51}{2001/07/05}{Reset chapter/section format after possible \cs{appendix}}
1625 % \begin{macrocode}
1626 \newcommand{\c@lresetcounters}{%
1627 \@ifundefined{c@figure}{}{\setcounter{figure}{0}}
1628 \@ifundefined{c@table}{}{\setcounter{table}{0}}
1629 \@ifundefined{c@equation}{}{\setcounter{equation}{0}}
1630 \@ifundefined{c@footnote}{}{\setcounter{footnote}{0}}
1631 \@ifundefined{c@chapter}%
1632 {\@ifundefined{c@section}{}{\renewcommand{\thesection}{\c@lthesec}}}%
1633 {\renewcommand{\thechapter}{\c@lthechap}}
1634 \zeroextracounters
1635 }
1636 % \end{macrocode}
1637 % \end{macro}
1638 %
1639 % \begin{macro}{\zeroextracounters}
1640 % This is a user-level macro that can be renewed to reset addtional
1641 % counters to zero at the beginning of an imported document.
1642 % \begin{macrocode}
1643 \newcommand{\zeroextracounters}{}
1644
1645 % \end{macrocode}
1646 % \end{macro}
1647 %
1648 %
1649 %
1650 % The |\enddocument| command (defined in \file{ltmiscen.dtx}) has
1651 % to be modified for both the main and imported documents. The modifications
1652 % are minor, mainly concerned with handling the proper files.
1653 %
1654 % \begin{macro}{\c@lenddoca}
1655 % |\c@lenddoca| holds some code that is common to both |\c@laenddocument|
1656 % and |\c@lbenddocument|.
1657 % \changes{v0.3}{2000/05/20}{Added \cs{c@lenddoca} command}
1658 % \begin{macrocode}
1659 \newcommand{\c@lenddoca}{%
1660 \@dofilelist
1661 \ifdim \font@submax >\fontsubfuzz\relax
1662 \@font@warning{Size substitutions with differences\MessageBreak
1663 up to \font@submax\space have occured.\@gobbletwo}%
1664 \fi
1665 \@defaultsubs
1666 %% \@refundefined
1667 \if@filesw
1668 \ifx \@multiplelabels \relax
1669 \if@tempswa
1670 \@latex@warning@no@line{Label(s) may have changed.
1671 Rerun to get cross-references right}%
1672 \fi
1673 \else
1674 \@multiplelabels
1675 \fi
1676 \fi
1677 }
1678
1679 % \end{macrocode}
1680 % \end{macro}
1681 %
1682 % \begin{macro}{\c@laenddocument}
1683 % \begin{macro}{\c@lbenddocument}
1684 % \begin{macrocode}
1685 \newcommand{\c@laenddocument}{%
1686 \@enddocumenthook
1687 \@checkend{document}%
1688 \clearpage
1689 \begingroup
1690 \if@filesw
1691 \immediate\closeout\@mainaux
1692 \immediate\closeout\@partaux
1693 \let\@setckpt\@gobbletwo
1694 \let\@newl@bel\@testdef
1695 \@tempswafalse
1696 \makeatletter \input\c@lmainauxfile %% change here
1697 \fi
1698 \c@lenddoca %% a replacement
1699 \@refundefined
1700 \endgroup
1701 \deadcycles\z@\@@end}
1702
1703 \newcommand{\c@lbenddocument}{%
1704 \@enddocumenthook
1705 \@checkend{document}%
1706 \clearpage
1707 \begingroup
1708 \if@filesw
1709 \immediate\closeout\@partaux %% change here
1710 \let\@setckpt\@gobbletwo
1711 \let\@newl@bel\@testdef
1712 \@tempswafalse
1713 \makeatletter \input\c@lauxfile %% change here
1714 \fi
1715 \c@lenddoca %% a replacement
1716 %% \@refundefined
1717 \endgroup
1718 \deadcycles\z@ %%\@@end %% \@@end will close *all* files
1719 \c@lclosetocs %% close local files
1720 % \end{macrocode}
1721 % Reset sectional and page numbering. Also reset stuff to take account
1722 % of the possibily that |\appendix| was called.
1723 % \changes{v0.51}{2001/05/09}{Added reset of chapter name after appendix}
1724 % \begin{macrocode}
1725 \ifc@lhaschapter %% reset chap/sec and page numbering
1726 \setcounter{chapter}{\value{c@lctr}}
1727 \gdef\thechapter{\c@lthechap}
1728 \gdef\@chapapp{\chaptername}
1729 \else
1730 \setcounter{section}{\value{c@lctr}}
1731 \gdef\thesection{\c@lthesec}
1732 \fi
1733 \setcounter{page}{\value{colpage}}
1734 \pagestyle{\c@lastyle}
1735 \erasetitling %% no \coltoc... or \published commands defined
1736 %% \let\@auxout\@mainaux
1737 \gdef\jobname{\mainjobname} %% swap back to main document file name
1738 \endinput %% ignore any text after \end{document}
1739 }
1740
1741 % \end{macrocode}
1742 % \end{macro}
1743 % \end{macro}
1744 %
1745 % \subsection{Titling commands}
1746 %
1747 % Changes to |\maketitle| and friends are defined here.
1748 %
1749 % \begin{macro}{\maintitlefont}
1750 % \begin{macro}{\postmaintitle}
1751 % \begin{macro}{\mainauthorfont}
1752 % \begin{macro}{\postmainauthor}
1753 % \begin{macro}{\maindatefont}
1754 % \begin{macro}{\postmaindate}
1755 % To provide some flexibilty in the titling style of the main document,
1756 % user level commands are provided that can be changed to reconfigure
1757 % the appearance resulting from |\maketitle|. These are defined initially
1758 % to approximately mimic the normal \LaTeX{} style.
1759 % \changes{v0.3}{2000/05/20}{Added \cs{...main...} commands.}
1760 % \begin{macrocode}
1761 \newcommand{\maintitlefont}{\begin{center}\LARGE}
1762 \newcommand{\postmaintitle}{\par\end{center}\vskip 0.5em}
1763 \newcommand{\mainauthorfont}{\begin{center}
1764 \large \lineskip .5em%
1765 \begin{tabular}[t]{c}}
1766 \newcommand{\postmainauthor}{\end{tabular}\par\end{center}}
1767 \newcommand{\maindatefont}{\begin{center}\large}
1768 \newcommand{\postmaindate}{\par\end{center}}
1769
1770 % \end{macrocode}
1771 % \end{macro}
1772 % \end{macro}
1773 % \end{macro}
1774 % \end{macro}
1775 % \end{macro}
1776 % \end{macro}
1777 %
1778 % \begin{macro}{\c@lamaketitle}
1779 % The |\maketitle| command (defined by each class) must not incapacitate
1780 % several commands that it normally does (e.g., |\thanks|, |\maketitle|,
1781 % |\title|, |\author|, |\date|, and |\and|). The following is a
1782 % modification of |\maketitle| as in the \Lpack{article}, \Lpack{report},
1783 % and \Lpack{book} classes.
1784 % \changes{v0.3}{2000/05/20}{Revised maketitle-related commands.}
1785 % \begin{macrocode}
1786 \if@titlepage
1787 \newcommand{\c@lamaketitle}{\begin{titlepage}%
1788 \let\footnotesize\small
1789 \let\footnoterule\relax
1790 \let \footnote \thanks
1791 \null\vfil
1792 \vskip 60\p@
1793 {\maintitlefont \@title \postmaintitle}
1794 {\mainauthorfont \@author \postmainauthor}
1795 {\maindatefont \@date \postmaindate}
1796 \par
1797 \@thanks
1798 \vfil\null
1799 \end{titlepage}%
1800 \setcounter{footnote}{0}%
1801 \c@lmtitlempty %% change here
1802 } % end titlepage defs
1803 \else
1804 \newcommand{\c@lamaketitle}{\par
1805 \begingroup
1806 \c@lmtitle %% change here
1807 \endgroup
1808 \setcounter{footnote}{0}%
1809 \c@lmtitlempty %% change here
1810 } % end non-titlepage
1811
1812 % \end{macrocode}
1813 % I use |\def\@maketitle| to account for the cases where the main class
1814 % does not have titling commands, and to ensure an existing |\@maketitle|
1815 % gets overridden.
1816 % \begin{macrocode}
1817
1818 \def\@maketitle{%
1819 \newpage
1820 \null
1821 \vskip 2em%
1822 {\maintitlefont \@title \postmaintitle}
1823 {\mainauthorfont \@author \postmainauthor}
1824 {\maindatefont \@date \postmaindate}
1825 \par
1826 \vskip 1.5em}
1827 \fi % end mod A of titling
1828
1829 % \end{macrocode}
1830 %
1831 % \begin{macro}{\c@lmtitle}
1832 % This macro contains much of the code that is common between
1833 % |\c@l@maketitle| and |\c@lbmaketitle|.
1834 % \begin{macrocode}
1835 \newcommand{\c@lmtitle}{%
1836 \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
1837 \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
1838 \long\def\@makefntext##1{\parindent 1em\noindent
1839 \hb@[email protected]{%
1840 \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
1841 \if@twocolumn
1842 \ifnum \col@number=\@ne
1843 \@maketitle
1844 \else
1845 \twocolumn[\@maketitle]%
1846 \fi
1847 \else
1848 \newpage
1849 \global\@topnum\z@
1850 \@maketitle
1851 \fi
1852 \thispagestyle{plain}\@thanks
1853 }
1854
1855 % \end{macrocode}
1856 % \end{macro}
1857 %
1858 % The modification for imported documents is simpler as there seems no
1859 % point in allowing for a \Lopt{titlepage} option. Also, don't start
1860 % a new page for the title and use a local typesetting style.
1861 % \begin{macrocode}
1862 \newcommand{\c@lbmaketitle}{\par
1863 \begingroup
1864 \let\newpage\relax
1865 \let\@maketitle\c@lb@maketitle
1866 \c@lmtitle
1867 \endgroup
1868 \setcounter{footnote}{0}%
1869 \c@lmtitlempty
1870 }
1871
1872 % \end{macrocode}
1873 % \end{macro}
1874 %
1875 % \begin{macro}{\c@lmtitlempty}
1876 % A helper macro to save some macro space.
1877 % It empties elements of |\maketitle|.
1878 % \begin{macrocode}
1879 \newcommand{\c@lmtitlempty}{%
1880 \global\let\@thanks\@empty
1881 \global\let\@author\@empty
1882 \global\let\@date\@empty
1883 \global\let\@title\@empty
1884 }
1885 % \end{macrocode}
1886 % \end{macro}
1887 %
1888 % \begin{macro}{\importtitlefont}
1889 % \begin{macro}{\postimporttitle}
1890 % \begin{macro}{\importauthorfont}
1891 % \begin{macro}{\postimportauthor}
1892 % \begin{macro}{\importdatefont}
1893 % \begin{macro}{\postimportdate}
1894 % The fonts and layouts for use within |\maketitle| in imported documents.
1895 % \changes{v0.3}{2000/05/20}{Added \cs{...import...} commands.}
1896 % \begin{macrocode}
1897 \newcommand{\importtitlefont}{\begin{center}\LARGE\bfseries}
1898 \newcommand{\postimporttitle}{\par\end{center}}
1899 \newcommand{\importauthorfont}{\begin{center}
1900 \large\itshape \lineskip .5em%
1901 \begin{tabular}[t]{c}}
1902 \newcommand{\postimportauthor}{\end{tabular}\par\end{center}}
1903 \newcommand{\importdatefont}{\begin{center}\large}
1904 \newcommand{\postimportdate}{\par\end{center}}
1905
1906 % \end{macrocode}
1907 % \end{macro}
1908 % \end{macro}
1909 % \end{macro}
1910 % \end{macro}
1911 % \end{macro}
1912 % \end{macro}
1913 %
1914 % \begin{macro}{\c@lb@maketitle}
1915 % This typesets the title in an imported document. It also includes the
1916 % code for implementing the \Lopt{nodate}, \Lopt{notitle} and \Lopt{noauthor}
1917 % options. The vertical spacing is reduced slightly from normal.
1918 % The title and author texts are set with |\importtitlefont| and
1919 % |\importauthorfont| respectiveley. The date is set with |\importdatefont|.
1920 % \begin{macrocode}
1921 \newcommand{\c@lb@maketitle}{%
1922 %% \newpage
1923 \begingroup
1924 \let\footnote\thanks
1925 \null
1926 \vskip 2em%
1927 \ifc@lnotitle\else
1928 {\importtitlefont \@title \postimporttitle}
1929 \fi
1930 \ifc@lnoauthor\else
1931 {\importauthorfont \@author \postimportauthor}
1932 \fi
1933 \ifc@lnodate\else
1934 {\importdatefont \@date \postimportdate}%
1935 \fi
1936 \par
1937 \endgroup
1938 }
1939
1940 % \end{macrocode}
1941 % \end{macro}
1942 %
1943 % \subsection{Cross referencing}
1944 %
1945 % This section deals with |\tableofcontents| and friends, together
1946 % with labeling, referencing and citations.
1947 %
1948 % \begin{macro}{\c@lbstarttoc}
1949 % The |\@starttoc| command (from \file{ltsect.dtx}) has to be modified
1950 % for imported documents so that a local ToC (LoF, LoT) file is used
1951 % instead of the one for the main document. I use a file identifier
1952 % of |c@l#1fnum| instead of the normal |tf@#1|.
1953 % \begin{macrocode}
1954 \newcommand{\c@lb@starttoc}[1]{%
1955 \begingroup
1956 \makeatletter
1957 \def\tocfname{\jobname.#1}
1958 \@input{\tocfname}%
1959 \if@filesw
1960 % \end{macrocode}
1961 % The following tests are to check if we can use a predefined output stream
1962 % or have to allocate a new one (e.g., if a new list of floats hase been
1963 % defined).
1964 % \begin{macrocode}
1965 \def\c@ltempa{#1} \def\c@ltempb{toc}
1966 \ifx \c@ltempa \c@ltempb
1967 \immediate\openout\c@ltocfnum \tocfname\relax
1968 \else
1969 \def\c@ltempb{lof}
1970 \ifx \c@tempa \c@ltempb
1971 \immediate\openout\c@lloffnum \tocfname\relax
1972 \else
1973 \def\c@ltempb{lot}
1974 \ifx \c@tempa \c@ltempb
1975 \immediate\openout\c@llotfnum \tocfname\relax
1976 \else
1977 \expandafter\newwrite\csname c@l#1fnum\endcsname
1978 \immediate\openout\csname c@l#1fnum\endcsname \tocfname\relax
1979 \fi
1980 \fi
1981 \fi
1982 \fi
1983 \@nobreakfalse
1984 \endgroup}
1985
1986 % \end{macrocode}
1987 % \end{macro}
1988 %
1989 % \begin{macro}{\c@lbwritefile}
1990 % To go along with local ToC files, |\@writefile| (in \file{ltmiscen.dtx})
1991 % has to be modified to match. We also check if a local file exists before
1992 % writing to it.
1993 % \begin{macrocode}
1994 \newcommand{\c@lb@writefile}[2]{%
1995 \def\tocfname{\jobname.#1}
1996 \IfFileExists{\tocfname}
1997 {\@temptokena{#2}%
1998 \immediate\write\csname c@l#1fnum\endcsname{\the\@temptokena}}
1999 {}
2000 }
2001
2002 % \end{macrocode}
2003 % \end{macro}
2004 %
2005 % \begin{macro}{\c@lclosetocs}
2006 % At the end of each imported document, any local ToC, etc., files
2007 % must be closed.
2008 % \begin{macrocode}
2009 \newcommand{\c@lclosetocs}{%
2010 \immediate\closeout\c@ltocfnum
2011 \immediate\closeout\c@lloffnum
2012 \immediate\closeout\c@llotfnum
2013 }
2014
2015 % \end{macrocode}
2016 % \end{macro}
2017 %
2018 %
2019 % \begin{macro}{\c@ltocgobble}
2020 % A macro containing some common code for |\...addtocontents| commands.
2021 % \begin{macrocode}
2022 \newcommand{\c@ltocgobble}{%
2023 \let\label\@gobble \let\index\@gobble \let\glossary\@gobble}
2024
2025 % \end{macrocode}
2026 % \end{macro}
2027 %
2028 % \begin{macro}{\c@laaddtocontents}
2029 % \begin{macro}{\c@laaddcontentsline}
2030 % It turns out to be useful to have versions of ToC addition commands
2031 % that go towards the main document.
2032 % \begin{macrocode}
2033 \newcommand{\c@laaddtocontents}[2]{%
2034 \protected@write\@mainaux
2035 {\c@ltocgobble}%
2036 {\string\@writefile{#1}{#2}}
2037 }
2038 \newcommand{\c@laaddcontentsline}[3]{%
2039 \c@laaddtocontents{#1}{\protect\contentsline{#2}{#3}{\thecolpage}}
2040 }
2041
2042 % \end{macrocode}
2043 % \end{macro}
2044 % \end{macro}
2045 %
2046 % \begin{macro}{\c@lbaddtocontents}
2047 % To implement the \Lopt{maintoc} option, we need a modification of
2048 % |\addtocontents| (in \file{ltsect.dtx}) so that it will write to
2049 % both the local and the main \file{.aux} files.
2050 % \begin{macrocode}
2051 \ifc@lmaintoc
2052 \newcommand{\c@lbaddtocontents}[2]{%
2053 \protected@write\@auxout
2054 {\c@ltocgobble}%
2055 {\string\@writefile{#1}{#2}}
2056 \ifx\@mainaux\@auxout\else %% prevent writing twice to mainaux
2057 \protected@write\@mainaux
2058 {\c@ltocgobble}%
2059 {\string\@writefile{#1}{\protect\begin{tocindent}{\toctocindent}}}
2060 \protected@write\@mainaux
2061 {\c@ltocgobble}%
2062 {\string\@writefile{#1}{#2}}
2063 \protected@write\@mainaux
2064 {\c@ltocgobble}%
2065 {\string\@writefile{#1}{\protect\end{tocindent}}}
2066 \fi
2067 }
2068 \fi
2069
2070 % \end{macrocode}
2071 % \end{macro}
2072 %
2073 % \begin{macro}{\c@lblabel}
2074 % \begin{macro}{\c@lb@setref}
2075 % To get the `correct' page number for labels in an imported
2076 % document, we have to use the global and not the local page number.
2077 % \begin{macrocode}
2078 \newcommand{\c@lblabel}[1]{\@bsphack
2079 \protected@write\@auxout{}%
2080 {\string\newlabel{#1}{{\@currentlabel}{\thecolpage}}}%
2081 \@esphack}
2082 \newcommand{\c@lb@setref}[3]{%
2083 \ifx#1\relax
2084 \protect\G@refundefinedtrue
2085 \nfss@text{\reset@font\bfseries ??}%
2086 \@latex@warning{Reference `#3' on page \thecolpage \space
2087 undefined}%
2088 \else
2089 \expandafter#2#1\null
2090 \fi}
2091
2092 % \end{macrocode}
2093 % \end{macro}
2094 % \end{macro}
2095 %
2096 % \begin{macro}{\c@lbnewlabel}
2097 % \begin{macro}{\c@lbref}
2098 % \begin{macro}{\c@lpagebref}
2099 % For local labels and cross-references in an imported document,
2100 % special versions of
2101 % |\newlabel|, |\ref| and |\pageref| (in \file{ltxref.dtx}) are needed.
2102 % I use |\jobname| to distinguish identical labels in different imported
2103 % files.
2104 % \begin{macrocode}
2105 \newcommand{\c@lbnewlabel}{\@newl@bel{R?\jobname?}}
2106 \newcommand{\c@lbref}[1]{\expandafter\@setref\csname R?\jobname?@#1\endcsname
2107 \@firstoftwo{#1}}
2108 \newcommand{\c@lbpageref}[1]{\expandafter\@setref\csname R?\jobname?@#1\endcsname
2109 \@secondoftwo{#1}}
2110
2111 % \end{macrocode}
2112 % \end{macro}
2113 % \end{macro}
2114 % \end{macro}
2115 %
2116 % \begin{macro}{\c@lwritemainbib}
2117 % \begin{macro}{\c@lwritelocalbib}
2118 % For citatations we may be writing to either the main bibliography
2119 % or to a local bibliography. For local bibliographies I use the
2120 % |\jobname| as a distinguishing characteristic.
2121 % \changes{v0.6}{2002/08/24}{Added \cs{c@lwritemainbib} and \cs{c@lwritelocalbib}}
2122 % \begin{macrocode}
2123 \newcommand{\c@lwritemainbib}{%
2124 \if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
2125 \@ifundefined{b@\@citeb}{\mbox{\reset@font\bfseries ?}%
2126 \G@refundefinedtrue
2127 \@latex@warning
2128 {Citation `\@citeb' on page \thecolpage \space undefined}}%
2129 {\hbox{\csname b@\@citeb\endcsname}}}
2130 \newcommand{\c@lwritelocalbib}{%
2131 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
2132 \@ifundefined{B?\jobname?@\@citeb}{\mbox{\reset@font\bfseries ?}%
2133 \G@refundefinedtrue
2134 \@latex@warning
2135 {Citation `\@citeb' on page \thecolpage \space undefined}}%
2136 {\hbox{\csname B?\jobname?@\@citeb\endcsname}}}
2137
2138 % \end{macrocode}
2139 % \end{macro}
2140 % \end{macro}
2141 %
2142 %
2143 % \begin{macro}{\c@lanocite}
2144 % Slight mod to the kernel |\nocite| macro.
2145 % \changes{v0.6}{2002/08/24}{Added \cs{c@lanocite}}
2146 % \begin{macrocode}
2147 \newcommand{\c@lanocite}[1]{\@bsphack
2148 \@for\@citeb:=#1\do{%
2149 \edef\@citeb{\expandafter\@firstofone\@citeb}%
2150 \if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
2151 \@ifundefined{b@\@citeb}{\G@refundefinedtrue
2152 \@latex@warning{Citation `\@citeb' undefined}}{}}%
2153 \@esphack}
2154 \let\nocite\c@lanocite
2155
2156 % \end{macrocode}
2157 % \end{macro}
2158 %
2159 % \begin{macro}{\c@lbnocite}
2160 % Need another version of |\nocite| for imports.
2161 % \changes{v0.6}{2002/08/24}{Added \cs{c@lbnocite}}
2162 % \begin{macrocode}
2163 \newcommand{\c@lbnocite}[1]{\@bsphack
2164 \@for\@citeb:=#1\do{%
2165 \edef\@citeb{\expandafter\@firstofone\@citeb}%
2166 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
2167 \@ifundefined{B?\jobname?@\@citeb}{\G@refundefinedtrue
2168 \@latex@warning{Citation `\@citeb' undefined}}{}}%
2169 \@esphack}
2170
2171 % \end{macrocode}
2172 % \end{macro}
2173 %
2174 % \begin{macro}{\c@lb@citex}
2175 % \begin{macro}{\c@lbbibcite}
2176 % For local citations in an imported document, special versions of
2177 % |\@citex| and |\bibcite| (in \file{ltbibl.dtx}) are needed. I use
2178 % the |\jobname| as a means of distinguishing between identical citation
2179 % labels in different imported files.
2180 % \changes{v0.6}{2002/08/24}{Added code for bib options to \cs{c@lbbibcite}}
2181 % \begin{macrocode}
2182 \def\c@lb@citex[#1]#2{%
2183 \ifc@lcombib
2184 \c@lanocite{#2}%
2185 \fi
2186 \let\@citea\@empty
2187 \@cite{\@for\@citeb:=#2\do
2188 {\@citea\def\@citea{,\penalty\@m\ }%
2189 \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
2190 \ifc@lcombib
2191 \c@lwritelocalbib
2192 \else
2193 \ifc@lonebib
2194 \c@lwritemainbib
2195 \else
2196 \c@lwritelocalbib
2197 \fi
2198 \fi}}{#1}}
2199
2200 \ifc@lonebib
2201 \newcommand{\c@lbbibcite}{\@newl@bel b}
2202 \ifc@lcombib
2203 \renewcommand{\c@lbbibcite}{\@newl@bel{B?\jobname?}}
2204 \fi
2205 \else
2206 \newcommand{\c@lbbibcite}{\@newl@bel{B?\jobname?}}
2207 \fi
2208
2209 % \end{macrocode}
2210 % \end{macro}
2211 % \end{macro}
2212 %
2213 %
2214 % \subsection{Page styles and numbering}
2215 %
2216 % \begin{macro}{\c@lapagestyle}
2217 % \begin{macro}{\c@lastyle}
2218 % \begin{macro}{\c@lbpagestyle}
2219 % I want to be able to restore the main document pagestyle after an
2220 % import. The current main pagestyle is kept in |\c@lastyle| which is
2221 % defined by |\c@lapagestyle| (original in \file{ltpage.dtx}).
2222 % \changes{v0.41}{2001/04/04}{Changed c@lstyle to \cs{c@lastyle} (two places)}
2223 % \begin{macrocode}
2224 \newcommand{\c@lapagestyle}[1]{%
2225 \gdef\c@lastyle{#1}
2226 \@ifundefined{ps@#1}{}{\@nameuse{ps@#1}}
2227 }
2228 % \end{macrocode}
2229 % |\c@lbpagestyle| is the same as the kernel |\pagestyle|, except for some
2230 % reason \LaTeX{} complains that the original command |\undefinedpagestyle|
2231 % is undefined!
2232 % \begin{macrocode}
2233 \newcommand{\c@lbpagestyle}[1]{%
2234 \@ifundefined{ps@#1}{}{\@nameuse{ps@#1}}
2235 }
2236
2237 % \end{macrocode}
2238 % \end{macro}
2239 % \end{macro}
2240 % \end{macro}
2241 %
2242 % \begin{macro}{\c@lbpagenumbering}
2243 % Need to do something about changing the page numbering in imported
2244 % documents, as it can have an unfortunate impact on later numbering.
2245 % The original command is in \file{ltpageno.dtx}. Disable changing
2246 % the style of the page number unless the \Lopt{folios} option is in effect.
2247 % \begin{macrocode}
2248 \ifc@lfolios
2249 \newcommand{\c@lbpagenumbering}[1]{%
2250 \global\c@page \@ne \gdef\thepage{\csname @#1\endcsname
2251 \c@page}}
2252 \else
2253 \newcommand{\c@lbpagenumbering}[1]{}
2254 \fi
2255
2256 % \end{macrocode}
2257 % \end{macro}
2258 %
2259 % \begin{macro}{\c@laps@plain}
2260 % \begin{macro}{\c@lbps@plain}
2261 % Alternative definitions for the |plain| pagestyle.
2262 % \begin{macrocode}
2263 \if@twoside
2264 \newcommand{\c@laps@plain}{%
2265 \let\@mkboth\@gobbletwo
2266 \let\@oddhead\@empty \let\@evenhead\@empty
2267 \def\@oddfoot{\reset@font\hfil\thepage}%
2268 \def\@evenfoot{\reset@font\thepage\hfil}%
2269 }
2270 \ifc@lfolios
2271 \newcommand{\c@lbps@plain}{%
2272 \let\@mkboth\@gobbletwo
2273 \let\@oddhead\@empty \let\@evenhead\@empty
2274 \def\@oddfoot{\reset@font(\thepage)\hfil\thecolpage}%
2275 \def\@evenfoot{\reset@font\thecolpage\hfil(\thepage)}%
2276 }
2277 \else
2278 \newcommand{\c@lbps@plain}{%
2279 \let\@mkboth\@gobbletwo
2280 \let\@oddhead\@empty \let\@evenhead\@empty
2281 \def\@oddfoot{\reset@font\hfil\thecolpage}%
2282 \def\@evenfoot{\reset@font\thecolpage\hfil}%
2283 }
2284 \fi
2285 \else
2286 \newcommand{\c@laps@plain}{%
2287 \let\@mkboth\@gobbletwo
2288 \let\@oddhead\@empty \let\@evenhead\@empty
2289 \def\@oddfoot{\reset@font\hfil\thepage}%
2290 \let\@evenfoot\@oddfoot
2291 }
2292 \ifc@lfolios
2293 \newcommand{\c@lbps@plain}{%
2294 \let\@mkboth\@gobbletwo
2295 \let\@oddhead\@empty \let\@evenhead\@empty
2296 \def\@oddfoot{\reset@font(\thepage)\hfil\thecolpage}%
2297 \let\@evenfoot\@oddfoot
2298 }
2299 \else
2300 \newcommand{\c@lbps@plain}{%
2301 \let\@mkboth\@gobbletwo
2302 \let\@oddhead\@empty \let\@evenhead\@empty
2303 \def\@oddfoot{\reset@font\hfil\thecolpage}%
2304 \let\@evenfoot\@oddfoot
2305 }
2306 \fi
2307 \fi
2308
2309 % \end{macrocode}
2310 % \end{macro}
2311 % \end{macro}
2312 %
2313 % \section{New class commands}
2314 %
2315 % That completes the preliminaries. We can now move on and define the
2316 % new commands and environment implemented by the \Lpack{combine} class.
2317 %
2318 % \begin{macro}{\ps@combine}
2319 % A new pagestyle. Like |plain| but the page numbers are put at
2320 % a bottom corner instead of being centered. It also changes the
2321 % the |plain| style to match.
2322 % \begin{macrocode}
2323 \if@twoside
2324 \newcommand{\ps@combine}{%
2325 \let\@mkboth\@gobbletwo
2326 \let\@oddhead\@empty \let\@evenhead\@empty
2327 \def\@oddfoot{\reset@font\hfil\thepage}%
2328 \def\@evenfoot{\reset@font\thepage\hfil}%
2329 \let\ps@plain\c@laps@plain
2330 }
2331 \else
2332 \newcommand{\ps@combine}{%
2333 \let\@mkboth\@gobbletwo
2334 \let\@oddhead\@empty \let\@evenhead\@empty
2335 \def\@oddfoot{\reset@font\hfil\thepage}%
2336 \let\@evenfoot\@oddfoot
2337 \let\ps@plain\c@laps@plain
2338 }
2339 \fi
2340
2341 % \end{macrocode}
2342 % \end{macro}
2343 %
2344 % \begin{macro}{\import}
2345 % |\import{|\meta{texfile}|}| attempts to find and input the file
2346 % \meta{texfile}\texttt{.tex}. It is very loosely based on |\include|.
2347 % It also adds the |\coltoctitle|, etc., to the ToC in a useful
2348 % order\footnote{This need pointed out by Stefan Becuwe
2349 % (\texttt{[email protected]}) by Email on 2001/07/09.}.
2350 % \changes{v0.51}{2001/07/09}{\cs{import} adds coltoctitle, etc., to the ToC}
2351 % \changes{v0.53}{2001/09/05}{Added empty \cs{numberline} to title in ToC}
2352 % \begin{macrocode}
2353 \newcommand{\import}[1]{%
2354 \ifc@ltoctitle
2355 \addtocontents{toc}{\protect\contentsline{coltoctitle}%
2356 {\protect\numberline{}\savec@ltoctitle}{\thecolpage}}
2357 \c@ltoctitlefalse
2358 \fi
2359 \ifc@ltocauthor
2360 \addcontentsline{toc}{coltocauthor}{\protect\numberline{}\savec@ltocauthor}
2361 \c@ltocauthorfalse
2362 \fi
2363 \ifc@lpub
2364 \addcontentsline{toc}{published}{\protect\numberline{}\savec@lpublished}
2365 \c@lpubfalse
2366 \fi
2367 \gdef\jobname{#1}
2368 % \end{macrocode}
2369 % \changes{v0.6}{2002/08/24}{Added empty definition for nocite{*}
2370 % handling to \cs{import}}
2371 % \begin{macrocode}
2372 \expandafter\let\csname B?\jobname?@*\endcsname\@empty
2373 \gdef\c@lauxfile{#1.aux}
2374 \@tempswatrue
2375 \let\@auxout\@partaux
2376 \@input@{#1.tex}%
2377 %% \@writeckpt{#1}%
2378 \let\@auxout\@mainaux
2379 }
2380
2381 % \end{macrocode}
2382 % \end{macro}
2383 %
2384 % \begin{macro}{\bodytitlemark}
2385 % \begin{macro}{\bodytitle}
2386 % |\bodytitle[|\meta{short}|]{|\meta{long}|}| is for putting a sectional
2387 % title into the main document for the following imported document. It is
2388 % like a |\section| (or |\chapter|) command and has its own numbering scheme.
2389 % \begin{macrocode}
2390 \newcommand*\bodytitlemark[1]{}
2391 \newcounter{bodytitle}
2392 \renewcommand{\thebodytitle}{\@arabic\c@bodytitle}
2393 \ifc@lhaschapter
2394 \newcommand{\bodytitle}{\@startsection{bodytitle}{0}{\z@}%
2395 {-3.5ex \@plus -1ex \@minus -.2ex}%
2396 {2.3ex \@plus.2ex}%
2397 {\normalfont\Huge\bfseries}}
2398 \else
2399 \newcommand{\bodytitle}{\@startsection{bodytitle}{1}{\z@}%
2400 {-3.5ex \@plus -1ex \@minus -.2ex}%
2401 {2.3ex \@plus.2ex}%
2402 {\normalfont\Large\bfseries}}
2403 \fi
2404
2405 % \end{macrocode}
2406 % \end{macro}
2407 % \end{macro}
2408 %
2409 % \begin{macro}{\c@ll@chapseci}
2410 % \begin{macro}{\c@ll@chapsecii}
2411 % These are two helper macros that contain common code used for
2412 % some of the ToC typesetting commands that will be defined. Essentially
2413 % they hold the first and second quarter of the code for ToC typesetting
2414 % of chapters and sections.
2415 % \begin{macrocode}
2416 \newcommand{\c@ll@chapseci}{%
2417 % \setlength\@tempdima{1.5em}%
2418 \setlength\@tempdima{0em}%
2419 \begingroup
2420 \parindent \z@ \rightskip \@pnumwidth
2421 \parfillskip -\@pnumwidth
2422 \leavevmode
2423 }
2424 \newcommand{\c@ll@chapsecii}[2]{%
2425 \advance\leftskip\@tempdima
2426 \hskip -\leftskip
2427 #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
2428 }
2429
2430 % \end{macrocode}
2431 % \end{macro}
2432 % \end{macro}
2433 %
2434 % \begin{macro}{\l@bodytitle}
2435 % |\l@bodytitle| typesets the ToC entry for |\bodytitle|.
2436 % \begin{macrocode}
2437 \ifc@lhaschapter
2438 \newcommand*\l@bodytitle[2]{% % as per chapter
2439 \ifnum \c@tocdepth >\m@ne
2440 \addpenalty{-\@highpenalty}%
2441 \addvspace{1.0em \@plus\p@}%
2442 \c@ll@chapseci
2443 \bfseries %% bold ToC entry
2444 \c@ll@chapsecii{#1}{#2}
2445 \penalty\@highpenalty
2446 \endgroup
2447 \fi}
2448 \else
2449 \newcommand*\l@bodytitle[2]{% % as per section
2450 \ifnum \c@tocdepth >\z@
2451 \addpenalty\@secpenalty
2452 \addvspace{1.0em \@plus\p@}%
2453 \c@ll@chapseci
2454 \bfseries %% bold ToC entry
2455 \c@ll@chapsecii{#1}{#2}
2456 \endgroup
2457 \fi}
2458 \fi
2459
2460 % \end{macrocode}
2461 % \end{macro}
2462 %
2463 % \begin{macro}{\toctitleindent}
2464 % \begin{macro}{\tocauthorindent}
2465 % \begin{macro}{\tocpubindent}
2466 % \begin{macro}{\toctocindent}
2467 % These lengths control the indentations of the imported title, author,
2468 % published, and sectional headings in the main ToC.
2469 % \begin{macrocode}
2470 \newlength{\toctitleindent}\setlength{\toctitleindent}{0pt}
2471 \newlength{\tocauthorindent}\setlength{\tocauthorindent}{1.5em}
2472 \newlength{\tocpubindent}\setlength{\tocpubindent}{1.5em}
2473 \newlength{\toctocindent}\setlength{\toctocindent}{1.5em}
2474
2475 % \end{macrocode}
2476 % \end{macro}
2477 % \end{macro}
2478 % \end{macro}
2479 % \end{macro}
2480 %
2481 % \begin{environment}{tocindent}
2482 % The |tocindent| environment is used to set the various main ToC indents.
2483 % \begin{macrocode}
2484 \newenvironment{tocindent}[1]{%
2485 \hangindent #1 \hangafter -100\relax}{}
2486
2487 % \end{macrocode}
2488 % \end{environment}
2489 %
2490 % \begin{macro}{\toctitlefont}
2491 % \begin{macro}{\tocauthorfont}
2492 % \begin{macro}{\tocpubfont}
2493 % These macros define the fonts to be used for typesetting the title,
2494 % author and publication entries in the main ToC.
2495 % \begin{macrocode}
2496 \newcommand{\toctitlefont}{\bfseries}
2497 \newcommand{\tocauthorfont}{\itshape}
2498 \newcommand{\tocpubfont}{\normalfont}
2499
2500 % \end{macrocode}
2501 % \end{macro}
2502 % \end{macro}
2503 % \end{macro}
2504 %
2505 % \begin{macro}{\coltoctitle}
2506 % \begin{macro}{\l@coltoctitle}
2507 % |\coltoctitle{|\meta{title}|}| adds \meta{title} to the ToC for the
2508 % following imported document. The ToC entry is typeset by |\l@coltoctitle|.
2509 % \changes{v0.51}{2001/07/09}{Save the value of \cs{coltoctitle}}
2510 % \begin{macrocode}
2511 \newcommand*{\coltoctitle}[1]{%
2512 \c@ltoctitletrue%
2513 \gdef\savec@ltoctitle{#1}
2514 }
2515
2516 % \end{macrocode}
2517 %
2518 % We want to arrange it so that if the title is near the bottom of a
2519 % page in the ToC, have the pagebreak before rather than after the title.
2520 % \changes{v0.42}{2001/04/04}{Changed pagebreak penalties in \cs{l@coltoctitle}}
2521 % \changes{v0.53}{2001/09/05}{Fixed extraneous space in \cs{l@coltoctitle}}
2522 % \begin{macrocode}
2523 \ifc@lhaschapter
2524 \newcommand*\l@coltoctitle[2]{% % as per chapter
2525 \ifnum \c@tocdepth >\m@ne
2526 \addpenalty{-\@highpenalty}% encourage page break
2527 \addvspace{1.0em \@plus\p@}%
2528 \c@ll@chapseci
2529 \setlength{\@tempdima}{\toctitleindent}% eliminate any spaces here
2530 \toctitlefont %% bold ToC entry
2531 \c@ll@chapsecii{#1}{#2}
2532 \penalty\@highpenalty % discourage page break
2533 \endgroup
2534 \fi}
2535 \else
2536 \newcommand*\l@coltoctitle[2]{% % as per section
2537 \ifnum \c@tocdepth >\z@
2538 \addpenalty\@secpenalty
2539 \addvspace{1.0em \@plus\p@}%
2540 \c@ll@chapseci
2541 \setlength{\@tempdima}{\toctitleindent}% eliminate any spaces here
2542 \toctitlefont %% bold ToC entry
2543 \c@ll@chapsecii{#1}{#2}
2544 \penalty\@highpenalty % discourage page break
2545 \endgroup
2546 \fi}
2547 \fi
2548
2549 % \end{macrocode}
2550 % \end{macro}
2551 % \end{macro}
2552 %
2553 % \begin{macro}{\coltocauthor}
2554 % \begin{macro}{\l@coltocauthor}
2555 % |\coltocauthor{|\meta{authors}|}| adds \meta{authors} to the ToC for the
2556 % following imported document. The ToC entry is typeset by |\l@coltocauthor|.
2557 % Note that a page number is not printed.
2558 % \changes{v0.51}{2001/07/09}{Save value of \cs{coltocauthor}}
2559 % \begin{macrocode}
2560 \newcommand*{\coltocauthor}[1]{%
2561 \c@ltocauthortrue%
2562 \gdef\savec@ltocauthor{#1}
2563 }
2564
2565 % \end{macrocode}
2566 % As it is unlikely that the author will be in the ToC without the title,
2567 % don't encourage a page break beforehand.
2568 % \changes{v0.42}{2001/04/04}{Changed pagebreak penalties in \cs{l@coltocauthor}}
2569 % \changes{v0.53}{2001/09/05}{Fixed extraneous space in \cs{l@coltocauthor}}
2570 %
2571 % \begin{macrocode}
2572 \ifc@lhaschapter
2573 \newcommand*\l@coltocauthor[2]{% % similar to chapter
2574 \ifnum \c@tocdepth >\m@ne
2575 \c@ll@chapseci
2576 \setlength{\@tempdima}{\tocauthorindent}% eliminate any spaces here
2577 \tocauthorfont %% italic ToC entry
2578 \c@ll@chapsecii{#1}{}
2579 \penalty\@highpenalty % discourage page break
2580 \endgroup
2581 \fi}
2582 \else
2583 \newcommand*\l@coltocauthor[2]{% % similar to section
2584 \ifnum \c@tocdepth >\z@
2585 \c@ll@chapseci
2586 \setlength{\@tempdima}{\tocauthorindent}% eliminate any spaces here
2587 \tocauthorfont %% italic ToC entry
2588 \c@ll@chapsecii{#1}{}
2589 \penalty\@highpenalty % discourage page break
2590 \endgroup
2591 \fi}
2592 \fi
2593
2594 % \end{macrocode}
2595 % \end{macro}
2596 % \end{macro}
2597 %
2598 % \begin{macro}{\published}
2599 % \begin{macro}{\pubfont}
2600 % \begin{macro}{\l@published}
2601 % |\published[|\meta{short}|]{|\meta{long}|}| adds \meta{long} to the
2602 % body of the document. It also adds \meta{long} to the ToC, unless the
2603 % optional argument is present, in which case \meta{short} is added
2604 % to the ToC.
2605 %
2606 % In the body of the document \meta{long} is typeset using |\pubfont|.
2607 % The ToC entry is typeset by |\l@published|.
2608 % Note that a page number is not printed.
2609 % \changes{v0.51}{2001/07/09}{Save value of \cs{published}}
2610 % \begin{macrocode}
2611 \newcommand{\published}[2][\@empty]{%
2612 \c@lpubtrue
2613 \ifc@lnopubintoc\else
2614 \ifx #1\@empty
2615 \gdef\savec@lpublished{#2}
2616 \else
2617 \gdef\savec@lpublished{#1}
2618 \fi
2619 \fi
2620 \ifc@lnopubindoc\else
2621 {\parindent \z@ \pubfont #2\par\nobreak}
2622 \fi
2623 }
2624 \newcommand{\pubfont}{\normalfont\centering}
2625
2626 % \end{macrocode}
2627 % As the published information is unlikely to be in the ToC without
2628 % prior title or author information, don't encourage a prior break,
2629 % but also don't try and prevent one afterwards either.
2630 % \changes{v0.42}{2001/04/04}{Changed pagebreak penalties in \cs{l@published}}
2631 % \changes{v0.53}{2001/09/05}{Fixed extraneous space in \cs{l@published}}
2632 %
2633 % \begin{macrocode}
2634 \ifc@lhaschapter
2635 \newcommand*\l@published[2]{% % similar to chapter
2636 \ifnum \c@tocdepth >\m@ne
2637 \c@ll@chapseci
2638 \setlength{\@tempdima}{\tocpubindent}% eliminate any spaces here
2639 \tocpubfont %% normal font ToC entry
2640 \c@ll@chapsecii{#1}{}
2641 \endgroup
2642 \fi}
2643 \else
2644 \newcommand*\l@published[2]{% % similar to section
2645 \ifnum \c@tocdepth >\z@
2646 \c@ll@chapseci
2647 \setlength{\@tempdima}{\tocpubindent}% eliminate any spaces here
2648 \tocpubfont %% normal font ToC entry
2649 \c@ll@chapsecii{#1}{}
2650 \endgroup
2651 \fi}
2652 \fi
2653
2654 % \end{macrocode}
2655 % \end{macro}
2656 % \end{macro}
2657 % \end{macro}
2658 %
2659 % \begin{macro}{\erasetitling}
2660 % This macro sets the |\coltoctitle|, |\coltocauthor| and |\published|
2661 % flags to FALSE.
2662 % \begin{macrocode}
2663 \newcommand{\erasetitling}{\c@ltoctitlefalse\c@ltocauthorfalse\c@lpubfalse}
2664
2665 % \end{macrocode}
2666 % \end{macro}
2667 %
2668 %
2669 % \begin{environment}{papers}
2670 % The |papers| environment has one optional argument,
2671 % default |\cleardoublepage| which gets executed at the start of the
2672 % environment. Then the appropriate changes to the kernel commands are
2673 % executed.
2674 % \begin{macrocode}
2675 \newenvironment{papers}[1][\cleardoublepage]{%
2676 #1
2677 \setuppapers
2678 }{%
2679 \takedownpapers
2680 }
2681
2682 % \end{macrocode}
2683 % \end{environment}
2684 %
2685 % \begin{macro}{\setuppapers}
2686 % This macro executes the kernel modifications within the |papers|
2687 % environment. Various options are also checked and implemented if required.
2688 % Sectional numbering is reset to zero. Imported files can't |\include|
2689 % other files, so |\include| is replaced by |\input|. If |\chapter| is
2690 % defined, then the chapter typesetting is redefined to look more like
2691 % a |\section| heading.
2692 % \changes{v0.41}{2000/06/18}{\cs{def}ed \cs{maketitle} instead of \cs{let}ing
2693 % inside \cs{setuppapers} to ignore any titling package redefinitions}
2694 % \changes{v0.52}{2001/08/25}{Added \cs{c@lbLoadClass} to \cs{setuppapers}}
2695 % \changes{v0.6}{2002/08/24}{Added onebib and combinedbib options code to \cs{setuppapers}}
2696 % \changes{v0.62}{2003/06/30}{Left \cs{bibliographystyle} unaltered}.
2697 % \begin{macrocode}
2698 \newcommand{\setuppapers}{%
2699 \let\documentclass\c@lbdocumentclass
2700 \ifc@lpackages\else \let\usepackage\c@lbusepackage \fi
2701 \let\document\c@lbdocument
2702 \let\enddocument\c@lbenddocument
2703 \let\LoadClass\c@lbLoadClass
2704 %% \let\maketitle\c@lbmaketitle
2705 \def\maketitle{\c@lbmaketitle}
2706 \let\@writefile\c@lb@writefile
2707 \let\@starttoc\c@lb@starttoc
2708 \ifc@lnomaketitle \let\maketitle\relax \fi
2709 \ifc@lnotoc \let\tableofcontents\relax \fi
2710 \ifc@lnolof \let\listoffigures\relax \fi
2711 \ifc@lnolot \let\listoftables\relax \fi
2712 \ifc@lmaintoc \let\addtocontents\c@lbaddtocontents \fi
2713 \let\label\c@lblabel
2714 \let\@setref\c@lb@setref
2715 \let\newlabel\c@lbnewlabel
2716 \let\ref\c@lbref
2717 \let\pageref\c@lbpageref
2718 %%% \renewcommand{\bibliographystyle}[1]{}
2719 \ifc@lcombib
2720 \else
2721 \ifc@lonebib
2722 \renewcommand{\bibliography}[1]{}
2723 \fi
2724 \fi
2725 \let\@citex\c@lb@citex
2726 \let\bibcite\c@lbbibcite
2727 \let\nocite\c@lbnocite
2728 \ifc@lhaschapter
2729 \renewcommand{\chapter}{\@startsection{chapter}{0}{\z@}%
2730 {-3.5ex \@plus -1ex \@minus -.2ex}%
2731 {2.3ex \@plus.2ex}%
2732 {\normalfont\Large\bfseries}}
2733 \fi
2734 \c@ltoctitlefalse
2735 \c@ltocauthorfalse
2736 \c@lpubfalse
2737 \let\pagenumbering\c@lbpagenumbering
2738 \setcounter{colpage}{\value{page}}
2739 \let\pagestyle\c@lbpagestyle
2740 \pagestyle{\c@lastyle}
2741 \let\include\input
2742 }
2743
2744 % \end{macrocode}
2745 % \end{macro}
2746 %
2747 % \begin{macro}{\takedownpapers}
2748 % This macro executes the actions, if any, at the end of the |papers|
2749 % environment.
2750 % \begin{macrocode}
2751 \newcommand{\takedownpapers}{%
2752 }
2753
2754 % \end{macrocode}
2755 % \end{macro}
2756 %
2757 % \begin{macro}{\emptyAtBeginDocument}
2758 % This macro empties tokens stored for use at |\begin{document}| time.
2759 % \changes{v0.51}{2003/07/17}{Added \cs{emptyAtBeginDocument}}
2760 % \begin{macrocode}
2761 \newcommand{\emptyAtBeginDocument}{\let\@begindocumenthook\@empty}
2762
2763 % \end{macrocode}
2764 % \end{macro}
2765 %
2766 % Finally, use the appropriate revised kernel commands for the main document.
2767 % \changes{v0.41}{2000/06/18}{Moved main document \cs{maketitle} letting to
2768 % its begin document}
2769 % \begin{macrocode}
2770 \let\document\c@ladocument
2771 \let\enddocument\c@laenddocument
2772 %%\let\maketitle\c@lamaketitle
2773 \let\pagestyle\c@lapagestyle
2774 \pagestyle{combine}
2775
2776 % \end{macrocode}
2777 %
2778 %
2779 %
2780 %
2781 % The end of this class.
2782 % \begin{macrocode}
2783 %</usc>
2784 % \end{macrocode}
2785 %
2786 % \section{The \Lpack{combinet} package code} \label{packcode}
2787 %
2788 %
2789 % \begin{macrocode}
2790 %<*pck>
2791 % \end{macrocode}
2792 % The usual preliminaries. The \Lpack{combine} class is expected.
2793 % \changes{v0.53}{2001/09/05}{combinet package now version 0.2}
2794 % \changes{v0.64}{2004/03/06}{combinet package now version 0.2a}
2795 % \begin{macrocode}
2796 \@ifclassloaded{combine}{}{%
2797 \PackageError{combinet}{The `combine' class is expected}{\@ehc}%
2798 }
2799
2800 % \end{macrocode}
2801 %
2802 % \begin{macro}{\ifc@lnomtitle}
2803 % \begin{macro}{\ifc@lnomauthor}
2804 % \begin{macro}{\ifc@lnothanks}
2805 % \begin{macro}{\ifc@lpubopt}
2806 % \begin{macro}{\ifc@lpubtop}
2807 % \begin{macro}{\ifc@lpubs}
2808 % Booleans for implementing the options.
2809 % \begin{macrocode}
2810 \newif\ifc@lnomtitle
2811 \c@lnomtitlefalse
2812 \newif\ifc@lnomauthor
2813 \c@lnomauthorfalse
2814 \newif\ifc@lnothanks
2815 \c@lnothanksfalse
2816 \newif\ifc@lpubopt
2817 \c@lpuboptfalse
2818 \newif\ifc@lpubtop
2819 \c@lpubtopfalse
2820 \newif\ifc@lpubs
2821 \c@lpubsfalse
2822
2823 % \end{macrocode}
2824 % \end{macro}
2825 % \end{macro}
2826 % \end{macro}
2827 % \end{macro}
2828 % \end{macro}
2829 % \end{macro}
2830 %
2831 % Declare and execute the options.
2832 % \begin{macrocode}
2833 \DeclareOption{nomtitle}{\c@lnomtitletrue}
2834 \DeclareOption{nomauthor}{\c@lnomauthortrue}
2835 \DeclareOption{nothanks}{\c@lnothankstrue}
2836 \DeclareOption{pub}{\c@lpubopttrue\c@lpubtopfalse\c@lpubstrue}
2837 \DeclareOption{pubtop}{\c@lpubtoptrue\c@lpuboptfalse\c@lpubstrue}
2838 \ProcessOptions\relax
2839
2840 % \end{macrocode}
2841 %
2842 % \begin{macro}{\published}
2843 % \begin{macro}{\c@lpubtoc}
2844 % \begin{macro}{\c@lpubbody}
2845 % In order to implement either of the \Lopt{pub} options, the |\published|
2846 % command must be modified to delay printing.
2847 % \begin{macrocode}
2848 \ifc@lpubs
2849 \renewcommand{\published}[2][\@empty]{%
2850 \c@lpubtrue
2851 \ifx #1\@empty
2852 \gdef\c@lpubtoc{#2}
2853 \else
2854 \gdef\c@lpubtoc{#1}
2855 \fi
2856 \gdef\c@lpubbody{#2}
2857 }
2858 \fi
2859
2860 % \end{macrocode}
2861 % \end{macro}
2862 % \end{macro}
2863 % \end{macro}
2864 %
2865 % \begin{macro}{\title}
2866 % \begin{macro}{\author}
2867 % To implement the \Lopt{nothanks} option, the |\title| and |\author|
2868 % kernel commands must be extended to save their values.
2869 %
2870 % Originally I used |\xdef| below which worked unless there was some
2871 % command other than |\thanks| in the title or author text.
2872 % David Kastrup\footnote{At \texttt{[email protected]}.}
2873 % and Donald Arseneau\footnote{At \texttt{[email protected]}.}
2874 % both pointed out the use of |\protected@xdef|.
2875 % Barbara Beeton\footnote{\texttt{[email protected]}} suggested adding the |\unskip|
2876 % to the redefinition of |\and| in order to remove any preceeding spaces when
2877 % it gets printed in the ToC.
2878 % \changes{v0.4}{2000/06/09}{Added \cs{unskip} to \cs{and} redefinition}
2879 % \changes{v0.41}{2000/06/18}{Appended to \cs{title} and \cs{author} definitions}
2880 % \begin{macrocode}
2881 \appendiargdef{\title}{%
2882 \begingroup
2883 \renewcommand{\thanks}[1]{}
2884 \protected@xdef\c@l@title{#1}
2885 \endgroup
2886 }
2887 \appendiargdef{\author}{%
2888 \begingroup
2889 \renewcommand{\thanks}[1]{}
2890 \renewcommand{\and}{\unskip, }
2891 \protected@xdef\c@l@author{#1}
2892 \endgroup
2893 }
2894
2895 % \end{macrocode}
2896 % \end{macro}
2897 % \end{macro}
2898 %
2899 % \begin{macro}{\c@lbmaketitle}
2900 % The |\c@lbmaketitle| command is (re)defined so that it adds the title
2901 % and author (if given) to the main ToC. If |\coltoctitle| and/or
2902 % |\coltocauthor| have been used then nothing is done with the title
2903 % and/or author respectively.
2904 % \changes{v0.53}{2001/09/05}{Added empty \cs{numberline} in \cs{c@lbmaketitle}}
2905 % \changes{v0.64}{2004/03/06}{Changed \cs{c@laaddtocontents} for titles to
2906 % \cs{c@laaddcontentsline} in \cs{c@lbmaketitle}}
2907 % \begin{macrocode}
2908 \def\c@lbmaketitle{\par
2909 \begingroup
2910 \let\newpage\relax
2911 \let\@maketitle\c@lb@maketitle
2912 \ifc@lpub
2913 \ifc@lpubtop
2914 \ifc@lnopubindoc\else
2915 {\parindent\z@ \pubfont \c@lpubbody\par\nobreak}
2916 \fi
2917 \fi
2918 \fi
2919 \c@lmtitle %% typeset the title block
2920 \endgroup
2921 \setcounter{footnote}{0}
2922 \begingroup
2923 \let\thanks\@empty
2924 \ifc@ltoctitle\else
2925 \ifc@lnomtitle\else
2926 \ifx\@title\@empty\else
2927 \ifc@lnothanks
2928 % \end{macrocode}
2929 % I originally used
2930 % \begin{verbatim}
2931 % \c@laaddtocontents{toc}%
2932 % {\protect\contentsline{coltoctitle}%
2933 % {\protect\numberline{}\c@l@title}{\thecolpage}}
2934 % \end{verbatim}
2935 % below, but James Szinger\footnote{Email, 2004/03/05, \texttt{[email protected]}}
2936 % asked me to change to \verb?\c@laaddcontentsline? instead
2937 % (which I should have done, looking back I've no idea why I didn't) to help
2938 % with using hyperref, which he said required redefining
2939 % \verb?\c@laaddcontentsline? to be compatible with hyperref's (hyperref never
2940 % seems to bother with trying to be compatible with other classes though).
2941 % \begin{macrocode}
2942 \c@laaddcontentsline{toc}%
2943 {coltoctitle}{\protect\numberline{}\c@l@title}%
2944 \else
2945 \c@laaddcontentsline{toc}%
2946 {coltoctitle}{\protect\numberline{}\@title}%
2947 \fi
2948 \fi
2949 \fi
2950 \fi
2951 \ifc@ltocauthor\else
2952 \ifc@lnomauthor\else
2953 \ifx\@author\@empty\else
2954 \ifc@lnothanks
2955 \c@laaddcontentsline{toc}%
2956 {coltocauthor}{\protect\numberline{}\c@l@author}
2957 \else
2958 \c@laaddcontentsline{toc}%
2959 {coltocauthor}{\protect\numberline{}\@author}
2960 \fi
2961 \fi
2962 \fi
2963 \fi
2964 \endgroup
2965 \ifc@lpub
2966 \ifc@lpubopt
2967 \ifc@lnopubindoc\else
2968 {\parindent\z@ \pubfont \c@lpubbody\par\nobreak}
2969 \fi
2970 \fi
2971 \ifc@lpubs
2972 \ifc@lnopubintoc\else
2973 \c@laaddcontentsline{toc}{published}{\protect\numberline{}\c@lpubtoc}
2974 \fi
2975 \fi
2976 \fi
2977 \c@lmtitlempty
2978 }
2979
2980 % \end{macrocode}
2981 % \end{macro}
2982 %
2983 %
2984 % The end of this package
2985 % \begin{macrocode}
2986 %</pck>
2987 % \end{macrocode}
2988 %
2989 %
2990 % \section{The \Lpack{combnat} package code} \label{natpackcode}
2991 %
2992 % This package calls the \Lpack{natbib} package~\cite{NATBIB}
2993 % and then makes some minor changes to some of its macro definitions.
2994 % \changes{v0.6}{2002/08/24}{Added onebib option processing to combnat package}
2995 %
2996 % \begin{macrocode}
2997 %<*natpack>
2998 % \end{macrocode}
2999 % The usual preliminaries. The \Lpack{natbib} package is required
3000 % and all options are passed to it to deal with.
3001 % \changes{v0.5}{2001/07/03}{Added the combnat package}
3002 % \changes{v0.6}{2002/08/24}{Added combine class check to the combnat package}
3003 % \changes{v0.6}{2002/08/24}{combnat package is now version 0.2}
3004 % \changes{v0.61}{2003/05/22}{combnat package is now version 0.21}
3005 % \changes{v0.61}{2003/05/22}{Somehow removed extraneous space from combnat package}
3006 % \changes{v0.7}{2010/03/22}{combnat bug fix thanks to Nicola Talbot}
3007 % \begin{macrocode}
3008 \@ifclassloaded{combine}{}{%
3009 \PackageError{combnat}{The `combine' class is expected}{\@ehc}}
3010 \RequirePackageWithOptions{natbib}
3011 % \end{macrocode}
3012 %
3013 % For multiple bibliographies (|\c@lonebibfalse|)
3014 % the change consists of replacing
3015 % \Lpack{natbib}'s
3016 % naming of citation labels in the \file{.aux} files by the form
3017 % used by the \Lpack{combine} class. That is, the |b@| in each
3018 % code fragment like |b@#...| or |b@\...| is replaced by
3019 % |B?\jobname?@...|.
3020 %
3021 % For a single main bibliography |\c@lonebibtrue|, implementation is much
3022 % easier, merely ensuring that the stuff gets written to the main
3023 % *.aux file.
3024 %
3025 %
3026 % \begin{macro}{\c@lNATwritemainbib}
3027 % \begin{macro}{\c@lNATwritemainbibdate}
3028 % We have to write different biblabels to different files. These write
3029 % to the main *.aux file.
3030 % \begin{macrocode}
3031 \newcommand{\c@lNATwritemainbib}{%
3032 \if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
3033 \@ifundefined{b@\@citeb\@extra@b@citeb}{%
3034 {\reset@font\bfseries?}
3035 \NAT@citeundefined\PackageWarning{natbib}%
3036 {Citation `\@citeb' on page \thepage \space undefined}}}
3037
3038 \newcommand{\c@lNATwritemainbibdate}{%
3039 \if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
3040 \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
3041 {\reset@font\bfseries ?}\NAT@citeundefined
3042 \PackageWarning{natbib}%
3043 {Citation `\@citeb' on page \thepage \space undefined}
3044 \def\NAT@date{}}}
3045
3046 % \end{macrocode}
3047 % \end{macro}
3048 % \end{macro}
3049 %
3050 % \begin{macro}{\c@lNATwritelocalbib}
3051 % \begin{macro}{\c@lNATwritelocalbibdate}
3052 % We have to write different biblabels to different files. These write
3053 % to the local *.aux files.
3054 % \begin{macrocode}
3055 \newcommand{\c@lNATwritelocalbib}{%
3056 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
3057 \@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{%
3058 {\reset@font\bfseries?}
3059 \NAT@citeundefined\PackageWarning{natbib}%
3060 {Citation `\@citeb' on page \thepage \space undefined}}}
3061
3062 \newcommand{\c@lNATwritelocalbibdate}{%
3063 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
3064 \@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{\@citea%
3065 {\reset@font\bfseries ?}\NAT@citeundefined
3066 \PackageWarning{natbib}%
3067 {Citation `\@citeb' on page \thepage \space undefined}
3068 \def\NAT@date{}}}
3069
3070 % \end{macrocode}
3071 % \end{macro}
3072 % \end{macro}
3073 %
3074 %
3075 % \begin{macro}{\c@lNAT@citexnum@swatrue}
3076 % Holds some of the internals of the original |\NAT@citexnum|.
3077 % \begin{macrocode}
3078 \newcommand{\c@lNAT@citexnum@swatrue}{%
3079 \ifnum\NAT@ctype>1\relax\@citea
3080 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3081 \ifnum\NAT@ctype=2\relax\NAT@test{\NAT@ctype}%
3082 \else\NAT@alias
3083 \fi\hyper@natlinkend\else
3084 \ifnum\NAT@sort>1\relax
3085 \begingroup\catcode`\_=8
3086 \ifcat _\ifnum\z@<0\NAT@num _\else A\fi
3087 \global\let\NAT@nm=\NAT@num \else \gdef\NAT@nm{-2}\fi
3088 \ifcat _\ifnum\z@<0\NAT@last@num _\else A\fi
3089 \global\@tempcnta=\NAT@last@num \global\advance\@tempcnta by\@ne
3090 \else \global\@tempcnta\m@ne\fi
3091 \endgroup
3092 \ifnum\NAT@nm=\@tempcnta
3093 \ifx\NAT@last@yr\relax
3094 \edef\NAT@last@yr{\@citea \mbox{\noexpand\citenumfont\NAT@num}}%
3095 \else
3096 \edef\NAT@last@yr{--\penalty\@m\mbox{\noexpand\citenumfont\NAT@num}}%
3097 \fi
3098 \else
3099 \NAT@last@yr \@citea \mbox{\citenumfont\NAT@num}%
3100 \let\NAT@last@yr\relax
3101 \fi
3102 \else
3103 \@citea \mbox{\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3104 {\citenumfont\NAT@num}\hyper@natlinkend}%
3105 \fi
3106 \fi
3107 \def\@citea{\NAT@sep\penalty\@m\NAT@space}%
3108 }
3109
3110 % \end{macrocode}
3111 % \end{macro}
3112 %
3113 % \begin{macro}{\NAT@citexnum}
3114 % We redefine the original |\NAT@citexnum| to write for the main file.
3115 % \begin{macrocode}
3116 \def\NAT@citexnum[#1][#2]#3{%
3117 \NAT@sort@cites{#3}%
3118 \let\@citea\@empty
3119 \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
3120 \@for\@citeb:=\NAT@cite@list\do
3121 {\edef\@citeb{\expandafter\@firstofone\@citeb}%
3122 \c@lNATwritemainbib %%% change here
3123 {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
3124 \NAT@parse{\@citeb}%
3125 \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
3126 \let\NAT@name=\NAT@all@names
3127 \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
3128 \fi
3129 \ifNAT@full\let\NAT@nm\NAT@all@names\else
3130 \let\NAT@nm\NAT@name
3131 \fi
3132 \ifNAT@swa
3133 \c@lNAT@citexnum@swatrue
3134 \else
3135 \ifcase\NAT@ctype\relax
3136 \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\penalty\@m\NAT@space\else
3137 \@citea \NAT@test{1}\ \NAT@@open
3138 \if*#1*\else#1\ \fi\fi \NAT@mbox{%
3139 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3140 {\citenumfont\NAT@num}\hyper@natlinkend}%
3141 \def\@citea{\NAT@@close\NAT@sep\penalty\@m\ }%
3142 \or\@citea
3143 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3144 \NAT@test{\NAT@ctype}\hyper@natlinkend
3145 \def\@citea{\NAT@sep\penalty\@m\ }%
3146 \or\@citea
3147 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3148 \NAT@test{\NAT@ctype}\hyper@natlinkend
3149 \def\@citea{\NAT@sep\penalty\@m\ }%
3150 \or\@citea
3151 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3152 \NAT@alias\hyper@natlinkend
3153 \def\@citea{\NAT@sep\penalty\@m\ }%
3154 \fi
3155 \fi
3156 }}%
3157 \ifnum\NAT@sort>1\relax\NAT@last@yr\fi
3158 \ifNAT@swa\else\ifnum\NAT@ctype=0\if*#2*\else
3159 \NAT@cmt#2\fi \NAT@@close\fi\fi}{#1}{#2}}
3160
3161 % \end{macrocode}
3162 % \end{macro}
3163 %
3164 % \begin{macro}{\c@lbNAT@citexnum}
3165 % A local version of |\NAT@citexnum|.
3166 % \begin{macrocode}
3167 \def\c@lbNAT@citexnum[#1][#2]#3{%
3168 \ifc@lcombib\c@laNATnocite{#3}\fi %%% change here
3169 \NAT@sort@cites{#3}%
3170 \let\@citea\@empty
3171 \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty
3172 \@for\@citeb:=\NAT@cite@list\do
3173 {\edef\@citeb{\expandafter\@firstofone\@citeb}%
3174 \c@lNATwritelocalbib %%% change here
3175 {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm
3176 \NAT@parse{\@citeb}%
3177 \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
3178 \let\NAT@name=\NAT@all@names
3179 \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
3180 \fi
3181 \ifNAT@full\let\NAT@nm\NAT@all@names\else
3182 \let\NAT@nm\NAT@name\fi
3183 \ifNAT@swa
3184 \c@lNAT@citexnum@swatrue
3185 \else
3186 \ifcase\NAT@ctype\relax
3187 \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\penalty\@m\NAT@space\else
3188 \@citea \NAT@test{1}\ \NAT@@open
3189 \if*#1*\else#1\ \fi\fi \NAT@mbox{%
3190 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3191 {\citenumfont\NAT@num}\hyper@natlinkend}%
3192 \def\@citea{\NAT@@close\NAT@sep\penalty\@m\ }%
3193 \or\@citea
3194 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3195 \NAT@test{\NAT@ctype}\hyper@natlinkend
3196 \def\@citea{\NAT@sep\penalty\@m\ }%
3197 \or\@citea
3198 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3199 \NAT@test{\NAT@ctype}\hyper@natlinkend
3200 \def\@citea{\NAT@sep\penalty\@m\ }%
3201 \or\@citea
3202 \hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3203 \NAT@alias\hyper@natlinkend
3204 \def\@citea{\NAT@sep\penalty\@m\ }%
3205 \fi\fi
3206 }}%
3207 \ifnum\NAT@sort>1\relax\NAT@last@yr\fi
3208 \ifNAT@swa\else\ifnum\NAT@ctype=0\if*#2*\else
3209 \NAT@cmt#2\fi \NAT@@close\fi\fi}{#1}{#2}}
3210
3211 % \end{macrocode}
3212 % \end{macro}
3213 %
3214 %
3215 % \begin{macro}{\c@lNAT@citex@swatrue}
3216 % Holds some of the internals of the original |\NAT@citex|.
3217 % \begin{macrocode}
3218 \newcommand{\c@lNAT@citex@swatrue}{%
3219 \ifcase\NAT@ctype
3220 \if\relax\NAT@date\relax
3221 \@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3222 \NAT@nmfmt{\NAT@nm}\NAT@date\hyper@natlinkend
3223 \else
3224 \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
3225 \ifx\NAT@last@yr\NAT@year
3226 \hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
3227 \hyper@natlinkend
3228 \else
3229 \unskip\
3230 \hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
3231 \hyper@natlinkend
3232 \fi
3233 \else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3234 \NAT@nmfmt{\NAT@nm}%
3235 \hyper@natlinkbreak{\NAT@aysep\ }{\@citeb\@extra@b@citeb}%
3236 \NAT@date\hyper@natlinkend
3237 \fi
3238 \fi
3239 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3240 \NAT@nmfmt{\NAT@nm}\hyper@natlinkend
3241 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3242 \NAT@date\hyper@natlinkend
3243 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3244 \NAT@alias\hyper@natlinkend
3245 \fi \def\@citea{\NAT@sep\ }%
3246 }
3247
3248 % \end{macrocode}
3249 % \end{macro}
3250 %
3251 % \begin{macro}{\c@laNAT@citex}
3252 % We redefine the original |\NAT@citex| macro for the main document.
3253 % \begin{macrocode}
3254 \def\NAT@citex%
3255 [#1][#2]#3{%
3256 \NAT@sort@cites{#3}%
3257 \let\@citea\@empty
3258 \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
3259 \@for\@citeb:=\NAT@cite@list\do
3260 {\edef\@citeb{\expandafter\@firstofone\@citeb}%
3261 \c@lNATwritemainbibdate %%%% change here
3262 {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
3263 \NAT@parse{\@citeb}%
3264 \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
3265 \let\NAT@name=\NAT@all@names
3266 \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
3267 \fi
3268 \ifNAT@full\let\NAT@nm\NAT@all@names\else
3269 \let\NAT@nm\NAT@name\fi
3270 \ifNAT@swa
3271 \c@lNAT@citex@swatrue
3272 \else
3273 \ifcase\NAT@ctype
3274 \if\relax\NAT@date\relax
3275 \@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3276 \NAT@nmfmt{\NAT@nm}\hyper@natlinkend
3277 \else
3278 \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
3279 \ifx\NAT@last@yr\NAT@year
3280 \hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
3281 \hyper@natlinkend
3282 \else\unskip\
3283 \hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
3284 \hyper@natlinkend
3285 \fi
3286 \else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3287 \NAT@nmfmt{\NAT@nm}%
3288 \hyper@natlinkbreak{\ \NAT@@open\if*#1*\else#1\ \fi}%
3289 {\@citeb\@extra@b@citeb}%
3290 \NAT@date\hyper@natlinkend\fi
3291 \fi
3292 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3293 \NAT@nmfmt{\NAT@nm}\hyper@natlinkend
3294 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3295 \NAT@date\hyper@natlinkend
3296 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3297 \NAT@alias\hyper@natlinkend
3298 \fi \if\relax\NAT@date\relax\def\@citea{\NAT@sep\ }%
3299 \else\def\@citea{\NAT@@close\NAT@sep\ }\fi
3300 \fi
3301 }}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
3302 \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}
3303
3304 % \end{macrocode}
3305 % \end{macro}
3306 %
3307 % \begin{macro}{\c@lbNAT@citex}
3308 % The local version of |\NAT@citex|.
3309 % \begin{macrocode}
3310 \def\c@lbNAT@citex[#1][#2]#3{%
3311 \ifc@lcombib \c@laNATnocite{#3} \fi %%%% change here
3312 \NAT@sort@cites{#3}%
3313 \let\@citea\@empty
3314 \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
3315 \@for\@citeb:=\NAT@cite@list\do
3316 {\edef\@citeb{\expandafter\@firstofone\@citeb}%
3317 \c@lNATwritelocalbibdate %%%% change here
3318 {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
3319 \NAT@parse{\@citeb}%
3320 \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
3321 \let\NAT@name=\NAT@all@names
3322 \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
3323 \fi
3324 \ifNAT@full\let\NAT@nm\NAT@all@names\else
3325 \let\NAT@nm\NAT@name\fi
3326 \ifNAT@swa
3327 \c@lNAT@citex@swatrue
3328 \else
3329 \ifcase\NAT@ctype
3330 \if\relax\NAT@date\relax
3331 \@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3332 \NAT@nmfmt{\NAT@nm}\hyper@natlinkend
3333 \else
3334 \ifx\NAT@last@nm\NAT@nm\NAT@yrsep
3335 \ifx\NAT@last@yr\NAT@year
3336 \hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@exlab
3337 \hyper@natlinkend
3338 \else\unskip\
3339 \hyper@natlinkstart{\@citeb\@extra@b@citeb}\NAT@date
3340 \hyper@natlinkend
3341 \fi
3342 \else\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3343 \NAT@nmfmt{\NAT@nm}%
3344 \hyper@natlinkbreak{\ \NAT@@open\if*#1*\else#1\ \fi}%
3345 {\@citeb\@extra@b@citeb}%
3346 \NAT@date\hyper@natlinkend\fi
3347 \fi
3348 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3349 \NAT@nmfmt{\NAT@nm}\hyper@natlinkend
3350 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3351 \NAT@date\hyper@natlinkend
3352 \or\@citea\hyper@natlinkstart{\@citeb\@extra@b@citeb}%
3353 \NAT@alias\hyper@natlinkend
3354 \fi \if\relax\NAT@date\relax\def\@citea{\NAT@sep\ }%
3355 \else\def\@citea{\NAT@@close\NAT@sep\ }\fi
3356 \fi
3357 }}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
3358 \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}
3359
3360 % \end{macrocode}
3361 % \end{macro}
3362 %
3363 % \begin{macro}{\c@laNATnocite}
3364 % \begin{macro}{\nocite}
3365 % A main document version of the natbib |\nocite|.
3366 % \begin{macrocode}
3367 \newcommand\c@laNATnocite[1]{\@bsphack
3368 \@for\@citeb:=#1\do{%
3369 \edef\@citeb{\expandafter\@firstofone\@citeb}%
3370 \if@filesw\immediate\write\@mainaux{\string\citation{\@citeb}}\fi
3371 \if*\@citeb\else
3372 \@ifundefined{b@\@citeb\@extra@b@citeb}{%
3373 \NAT@citeundefined \PackageWarning{natbib}%
3374 {Citation `\@citeb' undefined}}{}\fi}%
3375 \@esphack}
3376 \renewcommand{\nocite}[1]{\c@laNATnocite{#1}}
3377
3378 % \end{macrocode}
3379 % \end{macro}
3380 % \end{macro}
3381 %
3382 % \begin{macro}{\c@lbNATnocite}
3383 % The local version pf |\nocite|.
3384 % \begin{macrocode}
3385 \newcommand\c@lbNATnocite[1]{\@bsphack
3386 \@for\@citeb:=#1\do{%
3387 \edef\@citeb{\expandafter\@firstofone\@citeb}%
3388 \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
3389 \if*\@citeb\else
3390 \@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{%
3391 \NAT@citeundefined \PackageWarning{natbib}%
3392 {Citation `\@citeb' undefined}}{}\fi}%
3393 \@esphack}
3394
3395 % \end{macrocode}
3396 % \end{macro}
3397 %
3398 % \begin{macro}{\NAT@wrout}
3399 % Main version of the original |\NAT@wrout|.
3400 % \begin{macrocode}
3401 \renewcommand{\NAT@wrout}[5]{%
3402 \if@filesw
3403 {\let\protect\noexpand\let~\relax
3404 \immediate
3405 \write\@mainaux{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
3406 \ignorespaces}
3407
3408 % \end{macrocode}
3409 % \end{macro}
3410 %
3411 % \begin{macro}{\c@lbNAT@wrout}
3412 % Local version of the original |\NAT@wrout|.
3413 % \begin{macrocode}
3414 \newcommand{\c@lbNAT@wrout}[5]{%
3415 \if@filesw
3416 {\let\protect\noexpand\let~\relax
3417 \immediate
3418 \write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi
3419 \ignorespaces}
3420
3421 % \end{macrocode}
3422 % \end{macro}
3423 %
3424 %
3425 %
3426 % \begin{macro}{\c@laNAT@parse}
3427 % \begin{macro}{\c@lbNAT@parse}
3428 % Main and local versions of |\NAT@parse|.
3429 % \begin{macrocode}
3430 \newcommand\c@laNAT@parse[1]{{%
3431 \let\protect=\@unexpandable@protect\let~\relax
3432 \let\active@prefix=\@gobble
3433 \xdef\NAT@temp{\csname b@#1\@extra@b@citeb\endcsname}}%
3434 \expandafter\NAT@split\NAT@temp?????@@%
3435 \expandafter\NAT@parse@date\NAT@date??????@@%
3436 \ifciteindex\NAT@index\fi}
3437
3438 \newcommand\c@lbNAT@parse[1]{{%
3439 \let\protect=\@unexpandable@protect\let~\relax
3440 \let\active@prefix=\@gobble
3441 \xdef\NAT@temp{\csname B?\jobname?@#1\@extra@b@citeb\endcsname}}%
3442 \expandafter\NAT@split\NAT@temp?????@@%
3443 \expandafter\NAT@parse@date\NAT@date??????@@%
3444 \ifciteindex\NAT@index\fi}
3445
3446 % \end{macrocode}
3447 % \end{macro}
3448 % \end{macro}
3449 %
3450 % \begin{macro}{\c@laNAT@lbibitem}
3451 % \begin{macro}{\c@lbNAT@lbibitem}
3452 % Main and local version of |\@lbibitem|.
3453 % \begin{macrocode}
3454 \def\c@laNAT@lbibitem[#1]#2{%
3455 \if\relax\@extra@b@citeb\relax\else
3456 \@ifundefined{br@#2\@extra@b@citeb}{}{%
3457 \@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
3458 \@ifundefined{b@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
3459 \item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\@biblabel{\NAT@num}%
3460 \hyper@natanchorend]%
3461 \NAT@ifcmd#1(@)(@)\@nil{#2}}
3462
3463 \def\c@lbNAT@lbibitem[#1]#2{%
3464 \if\relax\@extra@b@citeb\relax\else
3465 \@ifundefined{br@#2\@extra@b@citeb}{}{%
3466 \@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}}\fi
3467 \@ifundefined{B?\jobname?@#2\@extra@b@citeb}{\def\NAT@num{}}{\NAT@parse{#2}}%
3468 \item[\hfil\hyper@natanchorstart{#2\@extra@b@citeb}\@biblabel{\NAT@num}%
3469 \hyper@natanchorend]%
3470 \NAT@ifcmd#1(@)(@)\@nil{#2}}
3471
3472 % \end{macrocode}
3473 % \end{macro}
3474 % \end{macro}
3475 %
3476 % \begin{macro}{\c@laNATbibcite}
3477 % \begin{macro}{\c@lbNATbibcite}
3478 % Main and local versions of |\NATbibcite|.
3479 % \begin{macrocode}
3480 \newcommand\c@laNATbibcite[2]{\@ifundefined{b@#1\@extra@binfo}\relax
3481 {\NAT@citemultiple
3482 \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
3483 \global\@namedef{b@#1\@extra@binfo}{#2}}
3484
3485 \newcommand\c@lbNATbibcite[2]{\@ifundefined{B?\jobname?@#1\@extra@binfo}\relax
3486 {\NAT@citemultiple
3487 \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
3488 \global\@namedef{B?\jobname?@#1\@extra@binfo}{#2}}
3489
3490 \ifc@lonebib
3491 \ifc@lcombib
3492 \else
3493 \renewcommand\c@lbNATbibcite[2]{\@ifundefined{b@#1\@extra@binfo}\relax
3494 {\NAT@citemultiple
3495 \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}}%
3496 \global\@namedef{B?\jobname?@#1\@extra@binfo}{#2}}
3497 \fi
3498 \fi
3499
3500 % \end{macrocode}
3501 % \end{macro}
3502 % \end{macro}
3503 %
3504 % \begin{macro}{\c@laNAT@testdef}
3505 % \begin{macro}{\c@lbNAT@testdef}
3506 % Main and local versions of |\NAT@testdef|.
3507 % \begin{macrocode}
3508 \newcommand\c@laNAT@testdef[2]{%
3509 \def\NAT@temp{#2}\expandafter \ifx \csname b@#1\@extra@binfo\endcsname
3510 \NAT@temp \else \ifNAT@swa \NAT@swafalse
3511 \PackageWarningNoLine{natbib}{Citation(s) may have
3512 changed.\MessageBreak
3513 Rerun to get citations correct}\fi\fi}
3514
3515 \newcommand\c@lbNAT@testdef[2]{%
3516 \def\NAT@temp{#2}\expandafter \ifx \csname B?\jobname?@#1\@extra@binfo\endcsname
3517 \NAT@temp \else \ifNAT@swa \NAT@swafalse
3518 \PackageWarningNoLine{natbib}{Citation(s) may have
3519 changed.\MessageBreak
3520 Rerun to get citations correct}\fi\fi}
3521
3522 % \end{macrocode}
3523 % \end{macro}
3524 % \end{macro}
3525 %
3526 % \begin{macro}{\c@laNAT@make@cite@list}
3527 % \begin{macro}{\c@lbNAT@make@cite@list}
3528 % Main and local versions of |\NAT@make@cite@list|.
3529 % \begin{macrocode}
3530 \ifnum\NAT@sort>0
3531 \begingroup \catcode`\_=8
3532 \gdef\c@laNAT@make@cite@list{%
3533 \edef\@citeb{\expandafter\@firstofone\@citeb}%
3534 \@ifundefined{b@\@citeb\@extra@b@citeb}{\def\NAT@num{A}}%
3535 {\NAT@parse{\@citeb}}%
3536 \ifcat _\ifnum\z@<0\NAT@num _\else A\fi
3537 \@tempcnta\NAT@num \relax
3538 \ifnum \@tempcnta>\@tempcntb
3539 \edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
3540 \edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
3541 \@tempcntb\@tempcnta
3542 \else
3543 \let\NAT@@cite@list=\NAT@cite@list \def\NAT@cite@list{}%
3544 \edef\NAT@num@list{\expandafter\NAT@num@celt \NAT@num@list \@gobble @}%
3545 {\let\@celt=\NAT@celt\NAT@num@list}%
3546 \fi
3547 \else
3548 \edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}%
3549 \fi}
3550 \endgroup
3551
3552 \begingroup \catcode`\_=8
3553 \gdef\c@lbNAT@make@cite@list{%
3554 \edef\@citeb{\expandafter\@firstofone\@citeb}%
3555 \@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}{\def\NAT@num{A}}%
3556 {\NAT@parse{\@citeb}}%
3557 \ifcat _\ifnum\z@<0\NAT@num _\else A\fi
3558 \@tempcnta\NAT@num \relax
3559 \ifnum \@tempcnta>\@tempcntb
3560 \edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%
3561 \edef\NAT@cite@list{\NAT@cite@list\@citeb,}%
3562 \@tempcntb\@tempcnta
3563 \else
3564 \let\NAT@@cite@list=\NAT@cite@list \def\NAT@cite@list{}%
3565 \edef\NAT@num@list{\expandafter\NAT@num@celt \NAT@num@list \@gobble @}%
3566 {\let\@celt=\NAT@celt\NAT@num@list}%
3567 \fi
3568 \else
3569 \edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}%
3570 \fi}
3571 \endgroup
3572 \fi
3573
3574 % \end{macrocode}
3575 % \end{macro}
3576 % \end{macro}
3577 %
3578 % Some things are done at the end of a document.
3579 %
3580 % \begin{macrocode}
3581 \AtEndDocument{%
3582 \ifNAT@stdbst\if@filesw\immediate\write
3583 \@mainaux{\string\global\string\NAT@numberstrue}\fi\fi
3584 }
3585
3586 \AtEndDocument{\NAT@swatrue\let\bibcite\NAT@testdef}
3587
3588 % \end{macrocode}
3589 %
3590 % \begin{macro}{\c@laNAT@set@cites}
3591 % Main version of |\NAT@set@cites|.
3592 % \begin{macrocode}
3593 \newcommand{\c@laNAT@set@cites}{\ifNAT@numbers
3594 \ifNAT@super \let\@cite\NAT@citesuper
3595 \def\NAT@mbox##1{\unskip\nobreak\hspace{1\p@}\textsuperscript{##1}}%
3596 \let\citeyearpar=\citeyear
3597 \let\NAT@space\relax\else
3598 \let\NAT@mbox=\mbox
3599 \let\@cite\NAT@citenum \def\NAT@space{ }\fi
3600 \let\@citex\NAT@citexnum
3601 \ifx\@biblabel\@empty\let\@biblabel\NAT@biblabelnum\fi
3602 \let\@bibsetup\NAT@bibsetnum
3603 \def\natexlab##1{}%
3604 \else
3605 \let\@cite\NAT@cite
3606 \let\@citex\NAT@citex
3607 \let\@biblabel\NAT@biblabel
3608 \let\@bibsetup\NAT@bibsetup
3609 \def\natexlab##1{##1}%
3610 \fi}
3611
3612 % \end{macrocode}
3613 % \end{macro}
3614 %
3615 % \begin{macro}{\c@lbNAT@set@cites}
3616 % Local version of |\NAT@set@cites|.
3617 % \begin{macrocode}
3618 \newcommand{\c@lbNAT@set@cites}{\ifNAT@numbers
3619 \ifNAT@super \let\@cite\NAT@citesuper
3620 \def\NAT@mbox##1{\unskip\nobreak\hspace{1\p@}\textsuperscript{##1}}%
3621 \let\citeyearpar=\citeyear
3622 \let\NAT@space\relax\else
3623 \let\NAT@mbox=\mbox
3624 \let\@cite\NAT@citenum \def\NAT@space{ }\fi
3625 \let\@citex\NAT@citexnum
3626 \ifx\@biblabel\@empty\let\@biblabel\NAT@biblabelnum\fi
3627 \let\@bibsetup\NAT@bibsetnum
3628 \def\natexlab##1{}%
3629 \else
3630 \let\@cite\NAT@cite
3631 \let\@citex\NAT@citex
3632 \let\@biblabel\NAT@biblabel
3633 \let\@bibsetup\NAT@bibsetup
3634 \def\natexlab##1{##1}%
3635 \fi}
3636
3637 % \end{macrocode}
3638 % \end{macro}
3639 %
3640 % For the main document, use |\c@la...| to replace the |\NAT...| definitions.
3641 % \begin{macrocode}
3642 \let\NAT@parse\c@laNAT@parse
3643 %%\let\nocite\c@laNATnocite
3644 %%\let\NAT@wrout\c@laNAT@wrout
3645 \let\@lbibitem\c@laNAT@lbibitem
3646 \let\bibcite\c@laNATbibcite
3647 \let\NAT@testdef\c@laNAT@testdef
3648 %%\let\NAT@make@cite@list\c@laNAT@make@cite@list
3649 %%\let\NAT@citexnum\c@laNAT@citexnum
3650 %%\let\NAT@citex\c@laNAT@citex
3651
3652 % \end{macrocode}
3653 %
3654 % And similarly for imported documents
3655 % \begin{macrocode}
3656 \let\c@loldsetuppapers\setuppapers
3657 \newcommand{\c@lNATsetuplocal}{%
3658 \let\NAT@parse\c@lbNAT@parse
3659 \let\nocite\c@lbNATnocite
3660 \let\NAT@wrout\c@lbNAT@wrout
3661 \let\@lbibitem\c@lbNAT@lbibitem
3662 \let\bibcite\c@lbNATbibcite
3663 \let\NAT@testdef\c@lbNAT@testdef
3664 \let\NAT@make@cite@list\c@lbNAT@make@cite@list
3665 \let\NAT@citexnum\c@lbNAT@citexnum
3666 \let\NAT@citex\c@lbNAT@citex
3667 \let\NAT@set@cites\c@lbNAT@set@cites
3668 \c@lbNAT@set@cites
3669 }
3670 \renewcommand{\setuppapers}{%
3671 \c@loldsetuppapers
3672 \ifc@lcombib
3673 \c@lNATsetuplocal
3674 \else
3675 \ifc@lonebib
3676 \else
3677 \c@lNATsetuplocal
3678 \fi
3679 \fi
3680 }
3681
3682 % \end{macrocode}
3683 %
3684 %
3685 % The end of this package
3686 % \begin{macrocode}
3687 %</natpack>
3688 % \end{macrocode}
3689 %
3690 %
3691 %
3692 % \section{The \Lpack{combcite} package code} \label{citepackcode}
3693 %
3694 % This package calls the \Lpack{cite} package~\cite{CITE}
3695 % and then makes some minor changes to some of its macro definitions.
3696 % \changes{v0.63}{2003/11/09}{Added the combcite package}
3697 %
3698 % \begin{macrocode}
3699 %<*citepack>
3700 % \end{macrocode}
3701 % The usual preliminaries. The \Lpack{cite} package is required
3702 % and all options are passed to it to deal with.
3703 % \begin{macrocode}
3704 \@ifclassloaded{combine}{}{%
3705 \PackageError{combcite}{The `combine' class is expected}{\@ehc}}
3706 % \end{macrocode}
3707 % By definition, we need the \Lpack{cite} package, but first have
3708 % to set up some option handling.
3709 % \begin{macro}{\ifc@lbsuperopt}
3710 % \cs{ifc@lbsuperopt} is a flag for if the \Lpack{cite} \Lopt{superscript}
3711 % option has been used.
3712 % \begin{macrocode}
3713 \newif\ifc@lbsuperopt
3714 \c@lbsuperoptfalse
3715 % \end{macrocode}
3716 % \end{macro}
3717 % Now do the options.
3718 % \begin{macrocode}
3719 \DeclareOption{super}{\ExecuteOptions{superscript}}
3720 \DeclareOption{superscript}{\c@lbsuperopttrue
3721 \PassOptionsToClass{superscript}{cite}}
3722 \ProcessOptions
3723 % \end{macrocode}
3724 %
3725 % We need the latest cite package (version 4.01 November 2003)
3726 % \begin{macrocode}
3727 \RequirePackageWithOptions{cite}[2003/11/04]
3728
3729 % \end{macrocode}
3730 % Need special versions of various macros for imported papers,
3731 % principally to handle writing to the .aux files.
3732 % Indicate these by prepending `c@lb' to the name.
3733 %
3734 % \begin{macro}{\c@lbciten}
3735 % \begin{macrocode}
3736 \DeclareRobustCommand\c@lbciten[1]{%
3737 \begingroup
3738 \let\@safe@activesfalse\@empty
3739 %% \c@lb@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
3740 \@nocite{#1}% ignores spaces, writes to .aux file, returns #1 in \@no@sparg
3741 \@tempcntb\m@ne % \@tempcntb tracks highest number
3742 \let\@h@ld\@empty % nothing held from list yet
3743 \let\@citea\@empty % no punctuation preceding first
3744 \let\@celt\delimiter % an unexpandable, but identifiable, token
3745 \def\@cite@list{}% % empty list to start
3746 \@for \@citeb:=\@no@sparg\do{\c@lb@make@cite@list}% make a sorted list of numbers
3747 % After sorted citelist is made, execute it to compress citation ranges.
3748 \@tempcnta\m@ne % no previous number
3749 \let\@celt\@compress@cite \@cite@list % output number list with compression
3750 \@h@ld % output anything held over
3751 \endgroup
3752 \@restore@auxhandle
3753 }
3754
3755 % \end{macrocode}
3756 % \end{macro}
3757 %
3758 % \begin{macro}{\c@lb@make@cite@list}
3759 %
3760 % \begin{macrocode}
3761 \def\c@lb@make@cite@list{%
3762 \expandafter\let \expandafter\@B@citeB
3763 \csname B?\jobname?@\@citeb\@extra@b@citeb \endcsname
3764 \ifx\@B@citeB\relax % undefined: output ? and warning
3765 \@citea {\bfseries ?}\let\@citea\citepunct \G@refundefinedtrue
3766 \@warning {Citation `\@citeb' on page \thepage\space undefined}%
3767 \oc@verbo \global\@namedef{B?\jobname?@\@citeb\@extra@b@citeb}{?}%
3768 \else % defined % remove previous line to repeat warnings
3769 \ifcat _\ifnum\z@<0\@B@citeB _\else A\fi % a positive number, put in list
3770 \@addto@cite@list
3771 \else % citation is not a number, output immediately
3772 \@citea \citeform{\@B@citeB}\let\@citea\citepunct
3773 \fi\fi}
3774
3775 % \end{macrocode}
3776 % \end{macro}
3777 %
3778 % \begin{macro}{\c@lbcite}
3779 % The revision to \cs{cite} depends on whether the \Lopt{superscript}
3780 % option has been used.
3781 % \begin{macrocode}
3782 \ifc@lbsuperopt
3783 \DeclareRobustCommand{\c@lbcite}{%
3784 \@ifnextchar[{\@tempswatrue\c@lb@citex}{\@tempswafalse\c@lb@citew}}
3785 \else
3786 \DeclareRobustCommand{\c@lbcite}{%
3787 \@ifnextchar[{\@tempswatrue\c@lb@citex}{\@tempswafalse\c@lb@citex[]}}
3788 \fi
3789
3790 % \end{macrocode}
3791 % \end{macro}
3792 %
3793 % \begin{macro}{\c@lb@citex}
3794 %
3795 % \begin{macrocode}
3796 \def\c@lb@citex[#1]#2{\@cite{\c@lbciten{#2}}{#1}}
3797
3798 % \end{macrocode}
3799 % \end{macro}
3800 %
3801 % \begin{macro}{\c@lb@citew}
3802 %
3803 % \begin{macrocode}
3804 \def\c@lb@citew#1{\begingroup \leavevmode
3805 \@if@fillglue \lastskip \relax \unskip
3806 \def\@tempa{\@tempcnta\spacefactor
3807 \/% this allows the last word to be hyphenated, and it looks better.
3808 \@citess{\c@lbciten{#1}}\spacefactor\@tempcnta
3809 \endgroup \@restore@auxhandle}%
3810 \oc@movep\relax}% check for following punctuation (depending on options)
3811
3812 % \end{macrocode}
3813 % \end{macro}
3814 %
3815 % \begin{macro}{\c@lbnocite}
3816 %
3817 % \begin{macrocode}
3818 \DeclareRobustCommand\c@lbnocite[1]{%
3819 \@bsphack \@nocite{#1}%
3820 \@for \@citeb:=\@no@sparg\do{\@ifundefined{B?\jobname?@\@citeb\@extra@b@citeb}%
3821 {\G@refundefinedtrue\@warning{Citation `\@citeb' undefined}%
3822 \oc@verbo \global\@namedef{B?\jobname?@\@citeb\@extra@b@citeb}{?}}{}}%
3823 \@esphack}
3824
3825 % \end{macrocode}
3826 % \end{macro}
3827 %
3828 % \begin{macro}{\@nocite}
3829 %
3830 % \begin{macrocode}
3831 \def\@nocite#1{\begingroup\let\protect\string% normalize active chars
3832 \xdef\@no@sparg{\expandafter\@ignsp#1 \: }\endgroup% and remove ALL spaces
3833 \if@filesw \immediate\write\@newciteauxhandle % = \@auxout, except with multibib
3834 {\string\citation {\@no@sparg}}\fi
3835 }
3836
3837 % \end{macrocode}
3838 % \end{macro}
3839 %
3840 % Finally, add the revision to \cs{setuppapers}.
3841 % \begin{macrocode}
3842 \g@addto@macro{\setuppapers}{\let\cite\c@lbcite}
3843 \g@addto@macro{\setuppapers}{\let\citenum\c@lbciten}
3844 \g@addto@macro{\setuppapers}{\let\citeonline\c@lbciten}
3845
3846 % \end{macrocode}
3847 %
3848 %
3849 % The end of this package
3850 % \begin{macrocode}
3851 %</citepack>
3852 % \end{macrocode}
3853 %
3854 %
3855 %
3856 % \appendix
3857 % \section{Original code}
3858 %
3859 % This section presents the original kernel code before modification.
3860 %
3861 % The |\documentclass| macro is specified in \file{ltclass.dtx}.
3862 % \par\begin{small}\begin{verbatim}
3863 % \def\documentclass{%
3864 % \let\documentclass\@twoclasseserror
3865 % \if@compatability\else\let\usepackage\RequirePackage\fi
3866 % \@fileswithoptions\@clsextension}
3867 % \@onlypreamble\documentclass
3868 % \end{verbatim}
3869 % \end{small}\par
3870 %
3871 % The |document| environment is specified between \file{ltfiles.dtx} and
3872 % \file{ltmiscen.dtx}. The |\document| command is given in \file{ltfiles.dtx}.
3873 % \par\begin{small}\begin{verbatim}
3874 % \def\document{\endgroup
3875 % \ifx\@unusedoptionlist\@empty\else
3876 % \@latex@warning@no@line{Unused global option(s):^^J%
3877 % \@spaces[\@unusedoptionlist]}%
3878 % \fi
3879 % \@colht\textheight
3880 % \@colroom\textheight \vsize\textheight
3881 % \columnwidth\textwidth
3882 % \@clubpenalty\clubpenalty
3883 % \if@twocolumn
3884 % \advance\columnwidth -\columnsep
3885 % \divide\columnwidth\tw@ \hsize\columnwidth \@firstcolumntrue
3886 % \fi
3887 % \hsize\columnwidth \linewidth\hsize
3888 % \begingroup\@floatplacement\@dblfloatplacement
3889 % \makeatletter\let\@writefile\@gobbletwo
3890 % \global \let \@multiplelabels \relax
3891 % \@input{\jobname.aux}%
3892 % \endgroup
3893 % \if@filesw
3894 % \immediate\openout\@mainaux\jobname.aux
3895 % \immediate\write\@mainaux{\relax}%
3896 % \fi
3897 % \process@table
3898 % \let\glb@currsize\@empty
3899 % \normalsize
3900 % \everypar{}%
3901 % \ifx\normalsfcodes\@empty
3902 % \ifnum\sfcode`\.=\@m
3903 % \let\normalsfcodes\frenchspacing
3904 % \else
3905 % \let\normalsfcodes\nonfrenchspacing
3906 % \fi
3907 % \fi
3908 % \@noskipsecfalse
3909 % \let \@refundefined \relax
3910 % \let\AtBeginDocument\@firstofone
3911 % \@begindocumenthook
3912 % \ifdim\topskip<1sp\global\topskip 1sp\relax\fi
3913 % \global\@maxdepth\maxdepth
3914 % \global\let\@begindocumenthook\@undefined
3915 % \ifx\@listfiles\@undefined
3916 % \global\let\@filelist\relax
3917 % \global\let\@addtofilelist\@gobble
3918 % \fi
3919 % \gdef\do##1{\global\let ##1\@notprerr}%
3920 % \@preamblecmds
3921 % \global\let \@nodocument \relax
3922 % \global\let\do\noexpand
3923 % \ignorespaces}
3924 % \@onlypreamble\document
3925 % \end{verbatim}
3926 % \end{small}\par
3927 % The |\enddocument| macro is specified in \file{ltmiscen.dtx}.
3928 % \par\begin{small}\begin{verbatim}
3929 % \def\enddocument{%
3930 % \@enddocumenthook
3931 % \@checkend{document}%
3932 % \clearpage
3933 % \begingroup
3934 % \if@filesw
3935 % \immediate\closeout\@mainaux
3936 % \let\@setckpt\@gobbletwo
3937 % \let\@newl@bel\@testdef
3938 % \@tempswafalse
3939 % \makeatletter \input\jobname.aux
3940 % \fi
3941 % \@dofilelist
3942 % \ifdim \font@submax >\fontsubfuzz\relax
3943 % \@font@warning{Size substitutions with differences\MessageBreak
3944 % up to \font@submax\space have occured.\@gobbletwo}%
3945 % \fi
3946 % \@defaultsubs
3947 % \@refundefined
3948 % \if@filesw
3949 % \ifx \@multiplelabels \relax
3950 % \if@tempswa
3951 % \@latex@warning@no@line{Label(s) may have changed.
3952 % Rerun to get cross-references right}%
3953 % \fi
3954 % \else
3955 % \@multiplelabels
3956 % \fi
3957 % \fi
3958 % \endgroup
3959 % \deadcycles\z@\@@end}
3960 % \end{verbatim}
3961 % \end{small}\par
3962 %
3963 % |\maketitle| is defined by each class. The following is from
3964 % \file{classes.dtx} for the \Lpack{book}, \Lpack{report} and \Lpack{article}
3965 % classes.
3966 % \par\begin{small}\begin{verbatim}
3967 % \if@titlepage
3968 % \newcommand{\maketitle}{\begin{titlepage}%
3969 % \let\footnotesize\small
3970 % \let\footnoterule\relax
3971 % \let \footnote \thanks
3972 % \null\vfil
3973 % \vskip 60\p@
3974 % \begin{center}%
3975 % {\LARGE \@title \par}%
3976 % \vskip 3em%
3977 % {\large
3978 % \lineskip .75em%
3979 % \begin{tabular}[t]{c}%
3980 % \@author
3981 % \end{tabular}\par}%
3982 % \vskip 1.5em%
3983 % {\large \@date \par}%
3984 % \end{center}\par
3985 % \@thanks
3986 % \vfil\null
3987 % \end{titlepage}%
3988 % \setcounter{footnote}{0}%
3989 % \global\let\thanks\relax
3990 % \global\let\maketitle\relax
3991 % \global\let\@thanks\@empty
3992 % \global\let\@author\@empty
3993 % \global\let\@date\@empty
3994 % \global\let\@title\@empty
3995 % \global\let\title\relax
3996 % \global\let\author\relax
3997 % \global\let\date\relax
3998 % \global\let\and\relax
3999 % } % end titlepage \maketitle
4000 % \else
4001 % \newcommand{\maketitle}{\par
4002 % \begingroup
4003 % \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
4004 % \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
4005 % \long\def\@makefntext##1{\parindent 1em\noindent
4006 % \hb@[email protected]{%
4007 % \hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
4008 % \if@twocolumn
4009 % \ifnum \col@number=\@ne
4010 % \@maketitle
4011 % \else
4012 % \twocolumn[\@maketitle]%
4013 % \fi
4014 % \else
4015 % \newpage
4016 % \global\@topnum\z@
4017 % \@maketitle
4018 % \fi
4019 % \thispagestyle{plain}\@thanks
4020 % \endgroup
4021 % \setcounter{footnote}{0}%
4022 % \global\let\thanks\relax
4023 % \global\let\maketitle\relax
4024 % \global\let\@maketitle\relax
4025 % \global\let\@thanks\@empty
4026 % \global\let\@author\@empty
4027 % \global\let\@date\@empty
4028 % \global\let\@title\@empty
4029 % \global\let\title\relax
4030 % \global\let\author\relax
4031 % \global\let\date\relax
4032 % \global\let\and\relax
4033 % } % end non-titlepage \maketitle
4034 %
4035 % \def\@maketitle{%
4036 % \newpage
4037 % \null
4038 % \vskip 2em%
4039 % \begin{center}%
4040 % \let \footnote \thanks
4041 % {\LARGE \@title \par}%
4042 % \vskip 1.5em%
4043 % {\large
4044 % \lineskip .5em%
4045 % \begin{tabular}[t]{c}%
4046 % \@author
4047 % \end{tabular}\par}%
4048 % \vskip 1em%
4049 % {\large \@date}%
4050 % \end{center}\par
4051 % \vskip 1.5em}
4052 % \fi
4053 % \end{verbatim}
4054 % \end{small}\par
4055 %
4056 % The definitions of |\title| and friends are in \file{ltsect.dtx}.
4057 % \par\begin{small}\begin{verbatim}
4058 % \def\title#1{\gdef\@title{#1}}
4059 % \def\@title{\@latex@error{No \noexpand\title given}\@ehc}
4060 % \def\author#1{\gdef\@author{#1}}
4061 % \def\@author{\@latex@warning@no@line{No \noexpand\author given}}
4062 % \def\date#1{\gdef\@date{#1}}
4063 % \gdef\@date{\today}
4064 % \def\thanks#1{\footnotemark
4065 % \protected@xdef\@thanks{\@thanks
4066 % \protect\footnotetext[\the\c@footnote]{#1}}}
4067 % \let\@thanks\@empty
4068 % \def\and{% % \begin{tabular}
4069 % \end{tabular}%
4070 % \hskip 1em \@plus.17fil%
4071 % \begin{tabular}[t]{c}}% % \end{tabular}
4072 % \end{verbatim}
4073 % \end{small}\par
4074 %
4075 % The definition of |\@starttoc| from \file{ltsect.dtx}.
4076 % \par\begin{small}\begin{verbatim}
4077 % \def\@starttoc#1{%
4078 % \begingroup
4079 % \makeatletter
4080 % \@input{\jobname.#1}%
4081 % \if@filesw
4082 % \expandafter\newwrite\csname tf@#1\endcsname
4083 % \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
4084 % \fi
4085 % \@nobreakfalse
4086 % \endgroup}
4087 % \end{verbatim}
4088 % \end{small}\par
4089 %
4090 % The definition of |\@writefile| from \file{ltmiscen.dtx}.
4091 % \par\begin{small}\begin{verbatim}
4092 % \long\def@writefile#1#2{%
4093 % \@ifundefined{tf@#1}\relax
4094 % {\@temptokena{#2}%
4095 % \immediate\write\csname tf@#1\endcsname{\the\@temptokena}%
4096 % }}
4097 % \end{verbatim}
4098 % \end{small}\par
4099 %
4100 % The definitions of |\addtocontents| and |addcontentsline|
4101 % from \file{ltsect.dtx}.
4102 % \par\begin{small}\begin{verbatim}
4103 % \long\def\addtocontents#1#2{%
4104 % \protected@write\@auxout
4105 % {\let\label\@gobble \let\index\@gobble \let\glossary\@gobble}%
4106 % {\string\@writefile{#1}{#2}}}
4107 % \def\addcontentsline#1#2#3{%
4108 % \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}}
4109 % \end{verbatim}
4110 % \end{small}\par
4111 %
4112 % The definitions of |\label|, |\@setref|, |\newlabel|, |\ref| and |\pageref|
4113 % from \file{ltxref.dtx}.
4114 % \par\begin{small}\begin{verbatim}
4115 % \def\label#1{\@bsphack
4116 % \protected@write\@auxout{}%
4117 % {\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
4118 % \@esphack}
4119 % \def\@setref#1#2#3{%
4120 % \ifx#1\relax
4121 % \protect\G@refundefinedtrue
4122 % \nfss@text{\reset@font\bfseries ??}%
4123 % \@latex@warning{Reference `#3' on page \thepage \space
4124 % undefined}%
4125 % \else
4126 % \expandafter#2#1\null
4127 % \fi}
4128 % \def\newlabel{\@newl@bel r}
4129 % \def\ref#1{\expandafter\@setref\csname r@#1\endcsname
4130 % \@firstoftwo{#1}}
4131 % \def\pageref#1{\expandafter\@setref\csname r@#1\endcsname
4132 % \@secondoftwo{#1}}
4133 % \end{verbatim}
4134 % \end{small}\par
4135 %
4136 % The definitions of |\bibcite| and |\@citex| from \file{ltbibl.dtx}.
4137 % \par\begin{small}\begin{verbatim}
4138 % \def\bibcite{\@newl@bel b}
4139 % \def\@citex[#1]#2{%
4140 % \let\@citea\@empty
4141 % \@cite{\@for\@citeb:=#2\do
4142 % {\@citea\def\@citea{,\penalty\@m\ }%
4143 % \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
4144 % \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi
4145 % \@ifundefined{b\@citeb}{\mbox{\reset@font\bfseries ?}%
4146 % \G@refundefinedtrue
4147 % \@latex@warning
4148 % {Citation `\@citeb' on page \thepage \space undefined}}%
4149 % {\hbox{\csname b\@citeb\endcsname}}}}{#1}}
4150 % \end{verbatim}
4151 % \end{small}\par
4152 %
4153 %
4154 %
4155 %
4156 % \Finale
4157 % \PrintIndex
4158 %
4159 \endinput
4160
4161 %% \CharacterTable
4162 %% {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
4163 %% 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
4164 %% Digits \0\1\2\3\4\5\6\7\8\9
4165 %% Exclamation \! Double quote \" Hash (number) \#
4166 %% Dollar \$ Percent \% Ampersand \&
4167 %% Acute accent \' Left paren \( Right paren \)
4168 %% Asterisk \* Plus \+ Comma \,
4169 %% Minus \- Point \. Solidus \/
4170 %% Colon \: Semicolon \; Less than \<
4171 %% Equals \= Greater than \> Question mark \?
4172 %% Commercial at \@ Left bracket \[ Backslash \\
4173 %% Right bracket \] Circumflex \^ Underscore \_
4174 %% Grave accent \` Left brace \{ Vertical bar \|
4175 %% Right brace \} Tilde \~}
4176
4177