This repository has been archived by the owner on Apr 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
subfigure.sty
419 lines (419 loc) · 14.8 KB
/
subfigure.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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
%%
%% This is file `subfigure.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% subfigure.dtx (with options: `package')
%%
%% Copyright (C) 1986-2002 Steven Douglas Cochran.
%%
%% This file is NOT the source for subfigure, because almost all comments
%% have been stripped from it. It is NOT the preferred form of subfigure
%% for making modifications to it.
%%
%% Therefore you can NOT redistribute and/or modify THIS file. You can
%% however redistribute the complete source (subfigure.dtx and
%% subfigure.ins) and/or modify it under the terms of the LaTeX Project
%% Public License, either version 1.2 of this license or (at your option)
%% any later version. The latest version of this license is in:
%% http://www.latex-project.org/lppl.txt
%% and version 1.2 or later is part of all distributions of LaTeX version
%% 1999/09/03 or later.
%%
%% The subfigure package is distributed in the hope that it will be
%% useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LaTeX
%% Project Public License for more details.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% @LaTeX-style-file{
%% author = "Steven Douglas Cochran",
%% version = "2.1.5",
%% date = "2005/04/29",
%% time = "14:24:08",
%% filename = "subfigure.sty",
%% address = "Digital Mapping Laboratory, School of Computer Science
%% Carnegie-Mellon University, 5000 Forbes Avenue
%% Pittsburgh, PA 15213-3890, USA",
%% telephone = "+1 412.268.5654",
%% fax = "+1 412.268.5576",
%% email = "cochran@ieee.org",
%% codetable = "ISO/ASCII",
%% keywords = "LaTeX, float, figure, table, captcont",
%% supported = "yes",
%% abstract = "LaTeX package for providing support for the
%% inclusion of small, `sub', figures and tables. It
%% simplifies the positioning, captioning and
%% labeling of them within a single figure or table
%% environment. In addition, this package allows
%% such subcaptions to be written to the List of
%% Figures or List of tables if desired."
%% }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesPackage{subfigure}[2002/03/15 v2.1.5 subfigure package]
\def\sf@floatfix#1#2{%
\ifx#1#2%
\ifx#1\@undefined\else
\PackageWarningNoLine{subfigure}{%
Your document class has a bad definition^^J
of \string#1, most likely^^J
\string\let\string#1=\string#2^^J
which has now been changed to^^J
\string\def\string#1{\string#2}^^J
because otherwise subsequent changes to \string#2^^J
(like done by several packages changing float behaviour)^^J
can't take effect on \string#1.^^J
Please complain to your document class author}%
\def#1{#2}%
\fi
\fi}
\begingroup
\def\next#1#2{%
\endgroup
\sf@floatfix\endfigure\end@float
\sf@floatfix\endtable\end@float
\sf@floatfix#1\end@dblfloat
\sf@floatfix#2\end@dblfloat}
\expandafter\next\csname endfigure*\expandafter\endcsname
\csname endtable*\endcsname
\newif\ifhyperrefloaded
\AtBeginDocument{%
\@ifpackageloaded{hyperref}{%
\hyperrefloadedtrue
\providecommand\theHsubfigure{\thefigure.\arabic{subfigure}}%
\providecommand\theHsubtable{\thetable.\arabic{subtable}}%
\providecommand{\toclevel@subfigure}{1}%
\providecommand{\toclevel@subtable}{1}}{}}
\newif\ifsubcaphang
\newif\ifsubcapcenter
\newif\ifsubcapcenterlast
\newif\ifsubcapnooneline
\newif\ifsubcapraggedright
\newskip\subfigtopskip \subfigtopskip = 5\p@
\newskip\subfigcapskip \subfigcapskip = 0\p@
\newdimen\subfigcaptopadj \subfigcaptopadj = 3\p@
\newskip\subfigbottomskip \subfigbottomskip = 5\p@
\newdimen\subfigcapmargin \subfigcapmargin = \z@
\newskip\subfiglabelskip \subfiglabelskip = 0.33em plus 0.07em minus 0.03em
\newcommand*{\subcapsize}{}
\newcommand*{\subcaplabelfont}{%
\subcaplabelfont@f\subcaplabelfont@c\subcaplabelfont@s}
\newcommand*{\subcaplabelfont@f}{\fontfamily{\familydefault}\selectfont}
\newcommand*{\subcaplabelfont@c}{\fontseries{\seriesdefault}\selectfont}
\newcommand*{\subcaplabelfont@s}{\fontshape{\shapedefault}\selectfont}
\newcommand*{\subcapfont}{%
\subcapfont@f\subcapfont@c\subcapfont@s}
\newcommand*{\subcapfont@f}{\fontfamily{\familydefault}\selectfont}
\newcommand*{\subcapfont@c}{\fontseries{\seriesdefault}\selectfont}
\newcommand*{\subcapfont@s}{\fontshape{\shapedefault}\selectfont}
\newif\ifsf@tight \sf@tighttrue
\newcounter{subfigure}[figure]
\@ifundefined{figuretopcaptrue}{\newif\iffiguretopcap}{}
\newif\ifsubfiguretopcap
\let\p@subfigure=\thefigure
\providecommand*{\thesubfigure}{(\alph{subfigure})}
\renewcommand*{\thesubfigure}{(\alph{subfigure})}
\newcommand*{\@thesubfigure}{\thesubfigure\hskip\subfiglabelskip}
\newcommand*{\@@thesubfigure}{\thesubfigure}
\let\ext@subfigure=\ext@figure
\newcommand*{\l@subfigure}{%
\@dottedxxxline{\ext@subfigure}{2}{3.8em}{2.5em}}
\newcounter{lofdepth}
\setcounter{lofdepth}{1}
\newcounter{subtable}[table]
\@ifundefined{tabletopcaptrue}{\newif\iftabletopcap}{}
\newif\ifsubtabletopcap
\let\p@subtable=\thetable
\providecommand*{\thesubtable}{(\alph{subtable})}
\renewcommand*{\thesubtable}{(\alph{subtable})}
\newcommand*{\@thesubtable}{\thesubtable\hskip\subfiglabelskip}
\newcommand*{\@@thesubtable}{\thesubtable}
\let\ext@subtable=\ext@table
\newcommand*{\l@subtable}{%
\@dottedxxxline{\ext@subtable}{2}{3.8em}{2.5em}}
\newcounter{lotdepth}
\setcounter{lotdepth}{1}
\DeclareOption{normal}{%
\subcaphangfalse
\subcapcenterfalse
\subcapcenterlastfalse
\subcapnoonelinefalse
\subcapraggedrightfalse}
\DeclareOption{hang}{\subcaphangtrue}
\DeclareOption{center}{\subcapcentertrue}
\DeclareOption{centerlast}{\subcapcenterlasttrue}
\DeclareOption{nooneline}{\subcapnoonelinetrue}
\DeclareOption{raggedright}{\subcapraggedrighttrue}
\DeclareOption{isu}{\ExecuteOption{hang}}
\DeclareOption{anne}{\ExecuteOption{centerlast}}
\DeclareOption{scriptsize}{\renewcommand*{\subcapsize}{\scriptsize}}
\DeclareOption{footnotesize}{\renewcommand*{\subcapsize}{\footnotesize}}
\DeclareOption{small}{\renewcommand*{\subcapsize}{\small}}
\DeclareOption{normalsize}{\renewcommand*{\subcapsize}{\normalsize}}
\DeclareOption{large}{\renewcommand*{\subcapsize}{\large}}
\DeclareOption{Large}{\renewcommand*{\subcapsize}{\Large}}
\DeclareOption{rm}{\renewcommand*{\subcaplabelfont@f}{\rmfamily}}
\DeclareOption{sf}{\renewcommand*{\subcaplabelfont@f}{\sffamily}}
\DeclareOption{tt}{\renewcommand*{\subcaplabelfont@f}{\ttfamily}}
\DeclareOption{md}{\renewcommand*{\subcaplabelfont@c}{\mdseries}}
\DeclareOption{bf}{\renewcommand*{\subcaplabelfont@c}{\bfseries}}
\DeclareOption{up}{\renewcommand*{\subcaplabelfont@s}{\upshape}}
\DeclareOption{it}{\renewcommand*{\subcaplabelfont@s}{\itshape}}
\DeclareOption{sl}{\renewcommand*{\subcaplabelfont@s}{\slshape}}
\DeclareOption{sc}{\renewcommand*{\subcaplabelfont@s}{\scshape}}
\DeclareOption{RM}{\renewcommand*{\subcapfont@f}{\rmfamily}}
\DeclareOption{SF}{\renewcommand*{\subcapfont@f}{\sffamily}}
\DeclareOption{TT}{\renewcommand*{\subcapfont@f}{\ttfamily}}
\DeclareOption{MD}{\renewcommand*{\subcapfont@c}{\mdseries}}
\DeclareOption{BF}{\renewcommand*{\subcapfont@c}{\bfseries}}
\DeclareOption{IT}{\renewcommand*{\subcapfont@s}{\itshape}}
\DeclareOption{SL}{\renewcommand*{\subcapfont@s}{\slshape}}
\DeclareOption{SC}{\renewcommand*{\subcapfont@s}{\scshape}}
\DeclareOption{UP}{\renewcommand*{\subcapfont@s}{\upshape}}
\DeclareOption{figbotcap}{\figuretopcapfalse}
\DeclareOption{figtopcap}{\figuretopcaptrue}
\DeclareOption{tabbotcap}{\tabletopcapfalse}
\DeclareOption{tabtopcap}{\tabletopcaptrue}
\DeclareOption{FIGBOTCAP}{\ExecuteOptions{figbotcap}\subfiguretopcapfalse}
\DeclareOption{FIGTOPCAP}{\ExecuteOptions{figtopcap}\subfiguretopcaptrue}
\DeclareOption{TABBOTCAP}{\ExecuteOptions{tabbotcap}\subtabletopcapfalse}
\DeclareOption{TABTOPCAP}{\ExecuteOptions{tabtopcap}\subtabletopcaptrue}
\DeclareOption{loose}{%
\subfigtopskip = 10\p@
\subfigcapskip = 10\p@
\subfigcaptopadj = 0\p@
\subfigbottomskip = 10\p@
\subfigcapmargin = 10\p@
\subfiglabelskip = 0.33em
\renewcommand*{\@thesubfigure}{\thesubfigure\space}
\renewcommand*{\@thesubtable}{\thesubtable\space}
\sf@tightfalse}
\DeclareOption{tight}{%
\subfigtopskip = 5\p@
\subfigcapskip = 0\p@
\subfigcaptopadj = 3\p@
\subfigbottomskip = 5\p@
\subfigcapmargin = \z@
\subfiglabelskip = 0.33em plus 0.07em minus 0.03em
\renewcommand*{\@thesubfigure}{\thesubfigure\hskip\subfiglabelskip}
\renewcommand*{\@thesubtable}{\thesubtable\hskip\subfiglabelskip}
\sf@tighttrue}
\ExecuteOptions{normal,footnotesize,FIGBOTCAP,TABBOTCAP,loose}
\InputIfFileExists{subfigure.cfg}{%
\typeout{****************************************^^J%
* Local config file subfigure.cfg used *^^J%
****************************************}}{}
\ProcessOptions
\newcommand*{\subfigure}{%
\bgroup
\let\subfig@oldlabel=\label
\let\label=\subfloat@label
\@nameuse{if\@captype topcap}\else
\advance\@nameuse{c@\@captype}\@ne
\fi
\refstepcounter{sub\@captype}%
\@ifnextchar [%
{\@subfigure}%
{\@subfigure[\@empty]}}
\let\subtable=\subfigure
\def\@subfigure[#1]{%
\@ifnextchar [%
{\@subfloat{sub\@captype}[{#1}]}%
{\@subfloat{sub\@captype}[\@empty{#1}][{#1}]}}
\newskip\subfig@top
\newskip\subfig@bottom
\long\def\@subfloat#1[#2][#3]#4{%
\@tempcnta=1
\ifsf@tight
\if@minipage
\@tempcnta=\z@
\else\ifdim \lastskip=\z@ \else
\@tempcnta=2
\fi\fi
\fi
\@nameuse{if\@captype topcap}%
\subfig@top=\subfigbottomskip
\subfig@bottom=\subfigtopskip
\else
\subfig@top=\subfigtopskip
\subfig@bottom=\subfigbottomskip
\fi
\leavevmode
\setbox\@tempboxa \hbox{#4}%
\@tempdima=\wd\@tempboxa
\vtop\bgroup
\vbox\bgroup
\ifcase\@tempcnta
\@minipagefalse
\or
\vspace{\subfig@top}%
\or
\ifdim \lastskip=\z@ \else
\@tempskipb\subfig@top\relax\@xaddvskip
\fi
\fi
\@nameuse{if#1topcap}%
\ifx \@empty#3\relax \else
\@subcaption{#1}{#2}{#3}%
\vskip\subfigcapskip
\vskip\subfigcaptopadj
\fi\egroup
\box\@tempboxa
\else
\box\@tempboxa\egroup
\ifx \@empty#3\relax \else
\vskip\subfigcapskip
\@subcaption{#1}{#2}{#3}%
\fi
\fi
\vspace{\subfig@bottom}%
\egroup
\@nameuse{if\@captype topcap}\else
\global\advance\@nameuse{c@\@captype}\m@ne
\fi
\egroup}
\newcommand*{\@subfigcaptionlist}{}
\newcommand{\@subcaption}[3]{%
\ifx \relax#2\relax \else
\bgroup
\let\label=\@gobble
\let\protect=\string
\def\@subcaplabel{\@nameuse{@@the#1}}%
\xdef\@subfigcaptionlist{%
\@subfigcaptionlist,%
{\protect\numberline{\@subcaplabel}\noexpand{\ignorespaces #2}}}%
\egroup
\fi
\@nameuse{@make#1caption}{\@nameuse{@the#1}}{#3}}
\newcommand*{\listsubcaptions}{%
\@ifstar
{\gdef\@subfigcaptionlist{}}%
{\@listsubcaptions{\@captype}}}
\newcommand*{\@listsubcaptions}[1]{%
\@ifundefined{@captype}{}{%
\@ifundefined{ext@sub#1}{}{%
\@for \sf@temp:=\@subfigcaptionlist \do {%
\ifx \@empty\sf@temp\relax \else
\addcontentsline
{\@nameuse{ext@sub#1}}%
{sub#1}%
{\sf@temp}%
\fi}}}%
\gdef\@subfigcaptionlist{}}
\newcommand{\@makesubfigurecaption}[2]{%
\setbox\@tempboxa\hbox{%
\subcapsize
{\subcaplabelfont #1}%
{\subcapfont\ignorespaces #2}}%
\@tempdimb=-\subfigcapmargin
\multiply\@tempdimb\tw@
\advance\@tempdimb\@tempdima
\hbox to\@tempdima{%
\hss
\ifdim \wd\@tempboxa >\@tempdimb
\subfig@caption{#1}{#2}%
\else\ifsubcapnooneline
\subfig@caption{#1}{#2}%
\else
\box\@tempboxa
\fi\fi
\hss}}
\let\@makesubtablecaption=\@makesubfigurecaption
\newcommand{\subfig@caption}[2]{%
\ifsubcaphang
\sbox{\@tempboxa}{\subcapsize\subcaplabelfont #1}%
\addtolength{\@tempdimb}{-\wd\@tempboxa}%
\usebox{\@tempboxa}%
\subfig@captionpar{\@tempdimb}{%
{\subcapfont\ignorespaces #2}}%
\else
\subfig@captionpar{\@tempdimb}{%
{\subcaplabelfont #1}%
{\subcapfont\ignorespaces #2}}%
\fi}
\newcommand{\subfig@captionpar}[2]{%
\parbox[t]{#1}{%
\subcapsize
\ifsubcapraggedright
\setlength{\leftskip}{\z@}%
\setlength{\@rightskip}{\@flushglue}%
\setlength{\rightskip}{\@rightskip}%
\setlength{\parindent}{\z@}%
\else\ifsubcapcenter
\setlength{\leftskip}{\@flushglue}%
\setlength{\rightskip}{\@flushglue}%
\setlength{\parfillskip}{\z@skip}%
\else\ifsubcapcenterlast
\addtolength{\leftskip}{\z@ plus 1fil}%
\addtolength{\rightskip}{\z@ plus -1fil}%
\setlength{\parfillskip}{\z@ plus 2fil}%
\fi\fi\fi
#2}}
\newcommand*{\@dottedxxxline}[6]{%
\ifnum #2>\@nameuse{c@#1depth}\else
\@dottedtocline{0}{#3}{#4}{#5}{#6}
\fi}
\let\subfig@end@float=\end@float
\renewcommand*{\end@float}{%
\@listsubcaptions{\@captype}%
\subfig@end@float}
\let\subfig@end@dblfloat=\end@dblfloat
\renewcommand*{\end@dblfloat}{%
\@listsubcaptions{\@captype}%
\subfig@end@dblfloat}
\let\subfig@oldcaption=\@caption
\long\def\@caption#1[#2]#3{%
\@ifundefined{if#1topcap}%
{\subfig@oldcaption{#1}[{#2}]{#3}}%
{\@nameuse{if#1topcap}%
\@listsubcaptions{#1}%
\subfig@oldcaption{#1}[{#2}]{#3}%
\else
\subfig@oldcaption{#1}[{#2}]{#3}%
\@listsubcaptions{#1}%
\fi}}
\let\subfig@oldlabel=\relax
\newcommand*{\subfloat@label}{%
\@ifnextchar(
{\sf@sub@label}
{\sf@sub@label(Sub\@captype\space
\@ifundefined{thechapter}{}{%
\@nameuse{thechapter}\space}%
\@nameuse{p@sub\@captype}%
\@nameuse{thesub\@captype}.)}}
\let\sub@label\subfloat@label
\def\sf@sub@label(#1)#2{%
\ifhyperrefloaded
\protected@edef\@currentlabelname{%
\expandafter\strip@period #1\relax.\relax\@@@}%
\fi
\sf@@sub@label{#2}}
\newcommand*{\sf@@sub@label}[1]{%
\@bsphack
\subfig@oldlabel{#1}%
\ifhyperrefloaded
\protected@write\@auxout{}{%
\string\newlabel{sub@#1}%
{{\@nameuse{@@thesub\@captype}}%
{\thepage}%
{\expandafter\strip@period\@currentlabelname\relax.\relax\@@@}%
{\@currentHref}%
{}}}%
\else
\protected@write\@auxout{}{%
\string\newlabel{sub@#1}%
{{\@nameuse{@@thesub\@captype}}%
{\thepage}}}%
\fi
\@esphack}
\newcommand\subref[1]{%
\ref{sub@#1}}
\newcommand\Subref[1]{%
{\subcaplabelfont
\ref{sub@#1}}}
\endinput
%%
%% End of file `subfigure.sty'.