-
Notifications
You must be signed in to change notification settings - Fork 25
/
tocbibind.sty
320 lines (296 loc) · 8.72 KB
/
tocbibind.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
%%
%% This is file `tocbibind.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tocbibind.dtx (with options: `usc')
%%
%% -----------------------------------------------------------------
%% Author: Peter Wilson, Herries Press
%% Maintainer: Will Robertson (will dot robertson at latex-project dot org)
%% Copyright 1998--2004 Peter R. Wilson
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3c of this license or (at your option) any
%% later version: <http://www.latex-project.org/lppl.txt>
%%
%% This work has the LPPL maintenance status "maintained".
%% The Current Maintainer of this work is Will Robertson.
%%
%% This work consists of the files listed in the README file.
%% -----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tocbibind}[2010/10/13 v1.5k extra ToC listings]
\providecommand{\PRWPackageNote}[2]{%
\GenericWarning{%
(#1)\@spaces\@spaces\@spaces\@spaces
}{%
Package #1 Note: #2%
}%
}
\providecommand{\PRWPackageNoteNoLine}[2]{%
\PRWPackageNote{#1}{#2\@gobble}%
}
\newcommand{\@bibquit}{}
\newif\if@bibchapter
\@ifundefined{chapter}{%
\@bibchapterfalse
\@ifundefined{section}{%
\PackageWarning{tocbibind}%
{I don't recognize any sectional divisions.\MessageBreak
I hope you have used the `other' option\MessageBreak
otherwise I'll ignore the package}
\renewcommand{\@bibquit}{\endinput}
}{\PackageInfo{tocbibind}{The document has section divisions}}
}{\@bibchaptertrue
\PackageInfo{tocbibind}{The document has chapter divisions}}
\newif\if@inltxdoc
\@ifclassloaded{ltxdoc}{\@inltxdoctrue}{\@inltxdocfalse}
\newif\if@dotocbib\@dotocbibtrue
\newif\if@dotocind\@dotocindtrue
\newif\if@dotoctoc\@dotoctoctrue
\newif\if@dotoclot\@dotoclottrue
\newif\if@dotoclof\@dotocloftrue
\newif\if@donumbib\@donumbibfalse
\newif\if@donumindex\@donumindexfalse
\newif\if@dot@cb@bsection\@dot@cb@bsectionfalse
\DeclareOption{section}{\@bibchapterfalse}
\DeclareOption{notbib}{\@dotocbibfalse}
\DeclareOption{notindex}{\@dotocindfalse}
\DeclareOption{nottoc}{\@dotoctocfalse}
\DeclareOption{notlot}{\@dotoclotfalse}
\DeclareOption{notlof}{\@dotocloffalse}
\DeclareOption{numbib}{\@donumbibtrue}
\DeclareOption{numindex}{\@donumindextrue}
\DeclareOption{chapter}{%
\if@bibchapter\else
\PackageWarning{tocbibind}%
{Chapters are undefined, using section instead}
\fi}
\DeclareOption{other}{\renewcommand{\@bibquit}{}
\@bibchapterfalse}
\DeclareOption{none}{%
\@dotocbibfalse
\@dotocindfalse
\@dotoctocfalse
\@dotoclotfalse
\@dotocloffalse
\@donumbibfalse
\@donumindexfalse
}
\ProcessOptions\relax
\@bibquit
\if@bibchapter
\PRWPackageNoteNoLine{tocbibind}{Using chapter style headings, unless overridden}
\else
\PRWPackageNoteNoLine{tocbibind}{Using section or other style headings}
\fi
\if@inltxdoc \@dotocindfalse \fi
\newcommand{\@tocextra}{section}
\newcommand{\tocotherhead}[1]{\renewcommand{\@tocextra}{#1}}
\newcommand{\tocetcmark}[1]{%
\@mkboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}}
\newcommand{\prw@mkboth}[1]{\tocetcmark{#1}}
\newcommand{\toc@section}[2]{%
\@nameuse{#1}*{#2\prw@mkboth{#2}}
\addcontentsline{toc}{#1}{#2}}
\newcommand{\toc@headstar}[2]{%
\@nameuse{#1}*{{#2}}}
\newcommand{\toc@chapter}[1]{%
\chapter*{#1}\prw@mkboth{#1}
\addcontentsline{toc}{chapter}{#1}}
\ifx\bibname\undefined
\ifx\refname\undefined
\newcommand{\tocbibname}{References}
\else
\newcommand{\tocbibname}{\refname}
\fi
\else
\newcommand{\tocbibname}{\bibname}
\fi
\providecommand{\indexname}{Index}
\newcommand{\setindexname}[1]{\renewcommand{\indexname}{#1}}
\providecommand{\contentsname}{Contents}
\newcommand{\settocname}[1]{\renewcommand{\contentsname}{#1}}
\providecommand{\listtablename}{List of Tables}
\newcommand{\setlotname}[1]{\renewcommand{\listtablename}{#1}}
\providecommand{\listfigurename}{List of Figures}
\newcommand{\setlofname}[1]{\renewcommand{\listfigurename}{#1}}
\newcommand{\settocbibname}[1]{\renewcommand{\tocbibname}{#1}}
\newcommand{\t@cb@bchapsec}{%
\if@bibchapter
\if@donumbib
\chapter{\tocbibname}%
\else
\toc@chapter{\tocbibname}%
\fi
\else
\if@donumbib
\@nameuse{\@tocextra}{\tocbibname}%
\else
\toc@section{\@tocextra}{\tocbibname}%
\fi
\fi}
\newcommand{\t@cb@bsection}{%
\if@donumbib
\@nameuse{\@tocextra}{\tocbibname}%
\else
\toc@section{\@tocextra}{\tocbibname}%
\fi}
\if@dotocbib
\@ifpackageloaded{natbib}{}{% natbib not loaded
\newcommand{\bibsection}{\t@cb@bchapsec}
\renewenvironment{thebibliography}[1]{%
\bibsection
\begin{thebibitemlist}{#1}}{\end{thebibitemlist}}}
\newenvironment{thebibitemlist}[1]{
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\@ifpackagewith{chapterbib}{sectionbib}%
{\renewcommand{\sectionbib}[2]{}}%
{}
\fi
\AtBeginDocument{%
\@ifpackagewith{natbib}{sectionbib}{\@dot@cb@bsectiontrue}{}
\@ifpackagewith{chapterbib}{sectionbib}%
{\@dot@cb@bsectiontrue
\@ifundefined{sectionbib}{}{\def\sectionbib#1#2{}}}%
{}
\if@dotocbib
\if@dot@cb@bsection
\renewcommand{\bibsection}{\t@cb@bsection}%
\else
\renewcommand{\bibsection}{\t@cb@bchapsec}%
\fi
\fi
}
\if@inltxdoc\else
\renewenvironment{theindex}%
{\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\if@bibchapter
\if@donumindex
\refstepcounter{chapter}
\twocolumn[\vspace*{2\topskip}%
\@makechapterhead{\indexname}]%
\addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}\indexname}
\chaptermark{\indexname}
\else
\if@dotocind
\twocolumn[\vspace*{2\topskip}%
\@makeschapterhead{\indexname}]%
\prw@mkboth{\indexname}
\addcontentsline{toc}{chapter}{\indexname}
\else
\twocolumn[\vspace*{2\topskip}%
\@makeschapterhead{\indexname}]%
\prw@mkboth{\indexname}
\fi
\fi
\else
\if@donumindex
\twocolumn[\vspace*{-1.5\topskip}%
\@nameuse{\@tocextra}{\indexname}]%
\csname \@tocextra mark\endcsname{\indexname}
\else
\if@dotocind
\twocolumn[\vspace*{-1.5\topskip}%
\toc@headstar{\@tocextra}{\indexname}]%
\prw@mkboth{\indexname}
\addcontentsline{toc}{\@tocextra}{\indexname}
\else
\twocolumn[\vspace*{-1.5\topskip}%
\toc@headstar{\@tocextra}{\indexname}]%
\prw@mkboth{\indexname}
\fi
\fi
\fi
\thispagestyle{plain}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\let\item\@idxitem}
{\if@restonecol\onecolumn\else\clearpage\fi}
\fi
\newcommand{\toc@start}{%
\if@bibchapter
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\fi}
\newcommand{\toc@finish}{%
\if@bibchapter
\if@restonecol\twocolumn\fi
\fi}
\newcommand{\tocfile}[2]{%
\toc@start
\if@bibchapter
\toc@chapter{#1}
\else
\toc@section{\@tocextra}{#1}
\fi
\@starttoc{#2}
\toc@finish}
\if@dotoctoc
\renewcommand{\tableofcontents}{%
\tocfile{\contentsname}{toc}
}
\fi
\if@dotoclot
\renewcommand{\listoftables}{%
\tocfile{\listtablename}{lot}
}
\fi
\if@dotoclof
\renewcommand{\listoffigures}{%
\tocfile{\listfigurename}{lof}
}
\fi
\newcommand{\simplechapter}[1][\@empty]{%
\let\@tbiold@makechapterhead\@makechapterhead
\renewcommand{\@makechapterhead}[1]{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge\bfseries #1\space\thechapter\simplechapterdelim\space
##1\par\nobreak
\vskip 40\p@
}}
}
\newcommand{\restorechapter}{%
\@ifundefined{@tbiold@makechapterhead}{}%
{\let\@makechapterhead\@tbiold@makechapterhead}
}
\newcommand{\simplechapterdelim}{}
\newcommand{\tocchapter}{%
\providecommand{\@makechapterhead}{}
\simplechapter
\renewcommand{\toc@chapter}[1]{\chapter{##1}}
}
\newcommand{\tocsection}{%
\renewcommand{\toc@section}[2]{\@nameuse{##1}{##2}}
}
\endinput
%%
%% End of file `tocbibind.sty'.