Debian Codegraph @

texmf-dist/tex/latex/caption/caption3_2007-04-11.sty

raw
1 %%
2 %% This is file `caption3_2007-04-11.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% fallback/v3.0/caption.dtx (with options: `kernel')
8 %%
9 %% Copyright (C) 1994-2022 Axel Sommerfeldt ([email protected])
10 %%
11 %% https://gitlab.com/axelsommerfeldt/caption
12 %%
13 %% --------------------------------------------------------------------------
14 %%
15 %% This work may be distributed and/or modified under the
16 %% conditions of the LaTeX Project Public License, either version 1.3
17 %% of this license or (at your option) any later version.
18 %% The latest version of this license is in
19 %% http://www.latex-project.org/lppl.txt
20 %% and version 1.3 or later is part of all distributions of LaTeX
21 %% version 2003/12/01 or later.
22 %%
23 %% This work has the LPPL maintenance status "maintained".
24 %%
25 %% This Current Maintainer of this work is Axel Sommerfeldt.
26 %%
27 %% This work consists of the files
28 %% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx,
29 %% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
30 %% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
31 %% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
32 %% the derived files
33 %% caption.sty, caption-light.sty, caption2.sty, caption3.sty,
34 %% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
35 %% caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
36 %% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty.
37 %%
38 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
39 \ProvidesPackage{caption3}[2007/04/11 v1.0q caption3 kernel (AR)]
40 \providecommand*\@nameundef[1]{%
41 \expandafter\let\csname #1\endcsname\@undefined}
42 \providecommand{\l@addto@macro}[2]{%
43 \begingroup
44 \toks@\expandafter{#1#2}%
45 \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}%
46 \@tempa}
47 \def\bothIfFirst#1#2{%
48 \protected@edef\caption@tempa{#1}%
49 \ifx\caption@tempa\@empty\else
50 #1#2%
51 \fi}
52 \def\bothIfSecond#1#2{%
53 \protected@edef\caption@tempa{#2}%
54 \ifx\caption@tempa\@empty\else
55 #1#2%
56 \fi}
57 \def\caption@ifinlist#1#2{%
58 \let\next\@secondoftwo
59 \edef\caption@tempa{#1}%
60 \@for\caption@tempb:={#2}\do{%
61 \ifx\caption@tempa\caption@tempb
62 \let\next\@firstoftwo
63 \fi}%
64 \next}
65 \def\caption@setbool#1#2{%
66 \caption@ifinlist{#2}{1,true,yes,on}{%
67 \expandafter\let\csname caption@if#1\endcsname\@firstoftwo
68 }{\caption@ifinlist{#2}{0,false,no,off}{%
69 \expandafter\let\csname caption@if#1\endcsname\@secondoftwo
70 }{%
71 \caption@Error{Undefined boolean value `#2'}%
72 }}}
73 \def\caption@ifbool#1{\@nameuse{caption@if#1}}
74 \def\caption@undefbool#1{\@nameundef{caption@if#1}}
75 \def\caption@newcounter#1{\gdef#1{0}}
76 \def\caption@setcounter#1#2{\xdef#1{#2}}
77 \def\caption@addtocounter#1#2{%
78 \begingroup
79 \@tempcnta#1%
80 \advance\@tempcnta#2%
81 \xdef#1{\the\@tempcnta}%
82 \endgroup}
83 \def\caption@stepcounter#1{\caption@addtocounter#1\@ne}
84 \newcommand\caption@Package{caption}
85 \newcommand*\caption@Error[1]{%
86 \PackageError\caption@Package{#1}\caption@eh}
87 \newcommand\caption@eh{%
88 If you do not understand this error, please take a closer look\MessageBreak
89 at the documentation of the `\caption@Package' package.\MessageBreak
90 \@ehc}
91 \RequirePackage{keyval}[1997/11/10]
92 \providecommand*\undefine@key[2]{%
93 \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}}
94 \newcommand\DeclareCaptionOption{%
95 \@ifstar{\caption@declareoption\AtEndOfPackage}%
96 {\caption@declareoption\@gobble}}
97 \newcommand*\caption@declareoption[2]{%
98 #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}}
99 \@onlypreamble\DeclareCaptionOption
100 \@onlypreamble\caption@declareoption
101 \newcommand\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup}
102 \newcommand\caption@typ@{caption@typ@} % This saves 74 words of TeX memory
103 \def\caption@setuptype[#1]#2{%
104 \@ifundefined{\caption@typ@#1}%
105 {\@namedef{\caption@typ@#1}{#2}}%
106 {\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}}
107 \newcommand\caption@setup{\caption@setkeys{caption}}
108 \newcommand*\caption@setkeys{%
109 \@dblarg\caption@@setkeys}
110 \long\def\caption@@setkeys[#1]#2#3{%
111 \ifnum\caption@keydepth=0\relax
112 \let\caption@KV@errx\KV@errx
113 \let\caption@KV@err\KV@err
114 \let\KV@errx\caption@Error
115 \let\KV@err\caption@Error
116 \fi
117 \caption@stepcounter\caption@keydepth
118 \def\caption@Package{#1}%
119 \caption@Debug{\protect\setkeys{#2}{#3}}%
120 \setkeys{#2}{#3}%
121 \def\caption@Package{caption}%
122 \caption@addtocounter\caption@keydepth\m@ne
123 \ifnum\caption@keydepth=0\relax
124 \let\KV@errx\caption@KV@errx
125 \let\KV@err\caption@KV@err
126 \fi}
127 \caption@newcounter\caption@keydepth
128 \newcommand*\caption@settype[1]{%
129 \@ifundefined{\caption@typ@#1}{}{%
130 \caption@esetup{\csname\caption@typ@#1\endcsname}}}
131 \newcommand*\caption@esetup[1]{%
132 \edef\caption@tempa{\noexpand\caption@setup{#1}}%
133 \caption@tempa}
134 \newcommand*\clearcaptionsetup[1]{\@nameundef{\caption@typ@#1}}
135 \newcommand*\showcaptionsetup[2][\@firstofone]{%
136 \GenericWarning{}{%
137 #1 Caption Info: KV list on `#2'\MessageBreak
138 #1 Caption Data: (%
139 \@ifundefined{\caption@typ@#2}{%
140 % empty -- print nothing
141 }{%
142 \@nameuse{\caption@typ@#2}%
143 }%
144 )}}
145 \newcommand*\caption@ProcessOptions[1]{%
146 \let\@tempc\relax
147 \let\caption@tempa\@empty
148 \@for\CurrentOption:=\@classoptionslist\do{%
149 \@ifundefined{KV@#1@\CurrentOption}{%
150 }{%
151 \@ifundefined{KV@#1@\CurrentOption @default}{%
152 \PackageInfo{#1}{Global option `\CurrentOption' ignored}%
153 }{%
154 \PackageInfo{#1}{Global option `\CurrentOption' processed}%
155 \edef\caption@tempa{\caption@tempa,\CurrentOption,}%
156 \@expandtwoargs\@removeelement\CurrentOption
157 \@unusedoptionlist\@unusedoptionlist
158 }%
159 }%
160 }%
161 \edef\caption@tempa{%
162 \noexpand\caption@setkeys{#1}{%
163 \caption@tempa\@ptionlist{\@currname.\@currext}%
164 }%
165 }%
166 \caption@tempa
167 \let\CurrentOption\@empty
168 \AtEndOfPackage{\let\@unprocessedoptions\relax}}
169 \@onlypreamble\caption@ProcessOptions
170 \newdimen\captionmargin
171 \newdimen\captionmargin@
172 \newdimen\captionwidth
173 \DeclareCaptionOption{margin}{\setcaptionmargin{#1}}
174 \DeclareCaptionOption{width}{\setcaptionwidth{#1}}
175 \DeclareCaptionOption{twoside}[1]{\caption@setbool{twoside}{#1}}
176 \newcommand*\setcaptionmargin[1]{%
177 \captionwidth\z@
178 \caption@@setmargin#1,#1,\@nil\@@}
179 \def\caption@@setmargin#1,#2,#3\@@{%
180 \setlength\captionmargin{#1}%
181 \setlength\captionmargin@{#2}%
182 \advance\captionmargin@ by -\captionmargin}
183 \newcommand\setcaptionwidth{%
184 \setlength\captionwidth}
185 \caption@newcounter\caption@count
186 \newcommand*\caption@newlabel{\@newl@bel{caption}}
187 \newcommand*\caption@thepage{\the\c@page}
188 \def\caption@ifoddpage{%
189 \caption@iftwoside{%
190 \caption@stepcounter\caption@count
191 \protected@write\@auxout{\let\caption@thepage\relax}%
192 {\string\caption@newlabel{\caption@count}{\caption@thepage}}%
193 \expandafter\ifx\csname caption@\caption@count\endcsname\relax
194 \G@refundefinedtrue % => 'There are undefined references.'
195 \PackageWarning{caption3}{Reference on page \thepage \space undefined}%
196 \else
197 \expandafter\let\expandafter\caption@thepage
198 \csname caption@\caption@count\endcsname
199 \fi
200 \ifodd\caption@thepage
201 \let\caption@ifoddpage\@firstoftwo
202 \else
203 \let\caption@ifoddpage\@secondoftwo
204 \fi
205 }{\let\caption@ifoddpage\@firstoftwo}%
206 \caption@ifoddpage}
207 \newdimen\captionindent
208 \newdimen\captionparindent
209 \newdimen\captionhangindent
210 \DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete!
211 \DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}}
212 \DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}}
213 \DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}}
214 \DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}}
215 \@ifundefined{scr@caption}{}{%
216 \let\caption@KV@parindent\KV@caption@parindent
217 \DeclareCaptionOption{parindent}[]{%
218 \def\caption@tempa{#1}%
219 \ifx\caption@tempa\@empty
220 \PackageInfo{caption3}{Option `parindent' ignored}%
221 \else
222 \caption@KV@parindent{#1}%
223 \fi}%
224 \let\caption@KV@parskip\KV@caption@parskip
225 \DeclareCaptionOption{parskip}[]{%
226 \def\caption@tempa{#1}%
227 \ifx\caption@tempa\@empty
228 \PackageInfo{caption3}{Option `parskip' ignored}%
229 \else
230 \caption@KV@parskip{#1}%
231 \fi}%
232 }
233 \newcommand*\DeclareCaptionStyle[1]{%
234 \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}}
235 \def\caption@declarestyle#1[#2]#3{%
236 \global\@namedef{caption@sls@#1}{#2}%
237 \global\@namedef{caption@sty@#1}{#3}}
238 \@onlypreamble\DeclareCaptionStyle
239 \@onlypreamble\caption@declarestyle
240 \DeclareCaptionOption{style}{\caption@setstyle{#1}}
241 \newcommand\caption@setstyle{%
242 \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}}
243 \newcommand*\caption@@setstyle[2]{%
244 \@ifundefined{caption@sty@#2}%
245 {#1{\caption@Error{Undefined caption style `#2'}}}%
246 {\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname
247 \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}}
248 \newcommand\caption@setdefault{\captionsetup{%
249 format=default,labelformat=default,labelsep=default,textformat=default,%
250 justification=default,font=default,labelfont=default,textfont=default,%
251 margin=0pt,indent=0pt,parindent=0pt,hangindent=0pt,%
252 singlelinecheck=1,strut=1}}
253 \DeclareCaptionStyle{default}[indent=0pt,justification=centering]{}
254 \newcommand\DeclareCaptionFormat{%
255 \@ifstar{\caption@declareformat\@gobble}%
256 {\caption@declareformat\@firstofone}}
257 \newcommand\caption@declareformat[3]{%
258 \global\expandafter\let\csname caption@ifh@#2\endcsname#1%
259 \global\long\@namedef{caption@fmt@#2}##1##2##3{#3}}
260 \@onlypreamble\DeclareCaptionFormat
261 \@onlypreamble\caption@declareformat
262 \DeclareCaptionOption{format}{\caption@setformat{#1}}
263 \newcommand*\caption@setformat[1]{%
264 \@ifundefined{caption@fmt@#1}%
265 {\caption@Error{Undefined caption format `#1'}}%
266 {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname
267 \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}}
268 \DeclareCaptionFormat{plain}{#1#2#3\par}
269 \DeclareCaptionFormat{hang}{%
270 \@hangfrom{#1#2}%
271 \advance\captionparindent\hangindent
272 \advance\captionhangindent\hangindent
273 \caption@@par
274 #3\par}
275 \def\caption@fmt@default{\caption@fmt@plain}
276 \def\caption@ifh@default{\caption@ifh@plain}
277 \newcommand*\DeclareCaptionLabelFormat[2]{%
278 \global\@namedef{caption@lfmt@#1}##1##2{#2}}
279 \@onlypreamble\DeclareCaptionLabelFormat
280 \DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}}
281 \newcommand*\caption@setlabelformat[1]{%
282 \@ifundefined{caption@lfmt@#1}%
283 {\caption@Error{Undefined caption label format `#1'}}%
284 {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}}
285 \DeclareCaptionLabelFormat{empty}{}
286 \DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2}
287 \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)}
288 \def\caption@lfmt@default{\caption@lfmt@simple}
289 \newcommand\DeclareCaptionLabelSeparator{%
290 \@ifstar{\caption@declarelabelseparator\@gobble}%
291 {\caption@declarelabelseparator\@firstofone}}
292 \newcommand\caption@declarelabelseparator[3]{%
293 \global\expandafter\let\csname caption@iflf@#2\endcsname#1%
294 \global\long\@namedef{caption@lsep@#2}{#3}}
295 \@onlypreamble\DeclareCaptionLabelSeparator
296 \@onlypreamble\caption@declarelabelseparator
297 \DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}}
298 \DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}}
299 \newcommand*\caption@setlabelseparator[1]{%
300 \@ifundefined{caption@lsep@#1}%
301 {\caption@Error{Undefined caption label separator `#1'}}%
302 {\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname
303 \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}}
304 \DeclareCaptionLabelSeparator{none}{}
305 \DeclareCaptionLabelSeparator{colon}{: }
306 \DeclareCaptionLabelSeparator{period}{. }
307 \DeclareCaptionLabelSeparator{space}{ }
308 \DeclareCaptionLabelSeparator*{quad}{\quad}
309 \DeclareCaptionLabelSeparator*{newline}{\\}
310 \DeclareCaptionLabelSeparator*{endash}{\space\textendash\space}
311 \def\caption@lsep@default{\caption@lsep@colon}
312 \def\caption@iflf@default{\caption@iflf@colon}
313 \newcommand*\DeclareCaptionTextFormat[2]{%
314 \global\long\@namedef{caption@tfmt@#1}##1{#2}}
315 \@onlypreamble\DeclareCaptionTextFormat
316 \DeclareCaptionOption{textformat}{\caption@settextformat{#1}}
317 \newcommand*\caption@settextformat[1]{%
318 \@ifundefined{caption@tfmt@#1}%
319 {\caption@Error{Undefined caption text format `#1'}}%
320 {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}}
321 \DeclareCaptionTextFormat{simple}{#1}
322 \DeclareCaptionTextFormat{period}{#1.}
323 \def\caption@tfmt@default{\caption@tfmt@simple}
324 \newcommand*\DeclareCaptionJustification[2]{%
325 \global\@namedef{caption@hj@#1}{#2}}
326 \@onlypreamble\DeclareCaptionJustification
327 \DeclareCaptionOption{justification}{\caption@setjustification{#1}}
328 \newcommand*\caption@setjustification[1]{%
329 \@ifundefined{caption@hj@#1}%
330 {\caption@Error{Undefined caption justification `#1'}}%
331 {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}}
332 \DeclareCaptionJustification{justified}{}
333 \DeclareCaptionJustification{centering}{\centering}
334 \DeclareCaptionJustification{centerfirst}{\centerfirst}
335 \DeclareCaptionJustification{centerlast}{\centerlast}
336 \DeclareCaptionJustification{raggedleft}{\raggedleft}
337 \DeclareCaptionJustification{raggedright}{\raggedright}
338 \def\caption@hj@default{\caption@hj@justified}
339 \providecommand\centerfirst{%
340 \let\\\@centercr
341 \edef\caption@normaladjust{%
342 \leftskip\the\leftskip
343 \rightskip\the\rightskip
344 \parfillskip\the\parfillskip\relax}%
345 \leftskip\z@\@plus -1fil%
346 \rightskip\z@\@plus 1fil%
347 \parfillskip\z@skip
348 \noindent\hskip\z@\@plus 2fil%
349 \@setpar{\@@par\@restorepar\caption@normaladjust}}
350 \providecommand\centerlast{%
351 \let\\\@centercr
352 \leftskip\z@\@plus 1fil%
353 \rightskip\z@\@plus -1fil%
354 \parfillskip\z@\@plus 2fil\relax}
355 \DeclareCaptionJustification{Centering}{%
356 \caption@ragged\Centering\centering}
357 \DeclareCaptionJustification{RaggedLeft}{%
358 \caption@ragged\RaggedLeft\raggedleft}
359 \DeclareCaptionJustification{RaggedRight}{%
360 \caption@ragged\RaggedRight\raggedright}
361 \newcommand*\caption@ragged{%
362 \caption@Debug{We need ragged2e}%
363 \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}%
364 \global\let\caption@ragged\caption@@ragged
365 \caption@@ragged}
366 \newcommand*\caption@@ragged[2]{%
367 \@ifundefined{caption\string#1}{%
368 \PackageWarning{caption3}{%
369 `ragged2e' package not loaded, therefore\MessageBreak
370 substituting \string#2 for \string#1\MessageBreak}%
371 \global\@namedef{caption\string#1}}{}%
372 #2}
373 \AtBeginDocument{%
374 \@ifundefined{caption@ragged2e}{%
375 \let\caption@@ragged\@secondoftwo % suppress warning above
376 }{%
377 \caption@Debug{We load ragged2e}%
378 \IfFileExists{ragged2e.sty}{%
379 \RequirePackage{ragged2e}\let\caption@@ragged\@firstoftwo}{}%
380 }}
381 \newcommand\DeclareCaptionFont[2]{%
382 \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}}
383 \@onlypreamble\DeclareCaptionFont
384 \DeclareCaptionOption{font}{\caption@setfont{font}{#1}}
385 \DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}}
386 \DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}}
387 \newcommand*\caption@setfont[2]{%
388 \let\caption@tempa\@empty
389 \begingroup
390 \caption@setkeys[caption]{caption@fnt}{#2}%
391 \endgroup
392 \expandafter\let\csname caption#1\endcsname\caption@tempa}
393 \DeclareCaptionFont{default}{}
394 \DeclareCaptionFont{scriptsize}{\scriptsize}
395 \DeclareCaptionFont{footnotesize}{\footnotesize}
396 \DeclareCaptionFont{small}{\small}
397 \DeclareCaptionFont{normalsize}{\normalsize}
398 \DeclareCaptionFont{large}{\large}
399 \DeclareCaptionFont{Large}{\Large}
400 \DeclareCaptionFont{up}{\upshape}
401 \DeclareCaptionFont{it}{\itshape}
402 \DeclareCaptionFont{sl}{\slshape}
403 \DeclareCaptionFont{sc}{\scshape}
404 \DeclareCaptionFont{md}{\mdseries}
405 \DeclareCaptionFont{bf}{\bfseries}
406 \DeclareCaptionFont{rm}{\rmfamily}
407 \DeclareCaptionFont{sf}{\sffamily}
408 \DeclareCaptionFont{tt}{\ttfamily}
409 \DeclareCaptionFont{singlespacing}{\setstretch{\setspace@singlespace}}% normally 1
410 \DeclareCaptionFont{onehalfspacing}{\onehalfspacing}
411 \DeclareCaptionFont{doublespacing}{\doublespacing}
412 \providecommand\captionsize{}
413 \DeclareCaptionOption{size}{\caption@setfont{size}{#1}}
414 \@ifundefined{abovecaptionskip}{%
415 \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{}
416 \@ifundefined{belowcaptionskip}{%
417 \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{}
418 \DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}}
419 \DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}}
420 \DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}
421 \DeclareCaptionOption{position}{\caption@setposition{#1}}
422 \newcommand*\caption@setposition[1]{%
423 \caption@ifinlist{#1}{d,default}{%
424 \def\caption@position{\caption@defaultpos}%
425 }{\caption@ifinlist{#1}{t,top,above}{%
426 \let\caption@position\@firstoftwo
427 }{\caption@ifinlist{#1}{b,bottom,below}{%
428 \let\caption@position\@secondoftwo
429 }{\caption@ifinlist{#1}{a,auto}{%
430 \let\caption@position\@undefined
431 }{%
432 \caption@Error{Undefined caption position `#1'}%
433 }}}}}
434 \let\caption@defaultpos\@secondoftwo
435 \newcommand\caption@iftop{%
436 \ifx\caption@position\@undefined
437 \expandafter\@secondoftwo
438 \else
439 \expandafter\caption@position
440 \fi}
441 \newcommand\caption@fixposition{%
442 \ifx\caption@position\@undefined
443 \caption@autoposition
444 \fi}
445 \newcommand\caption@autoposition{%
446 \ifvmode
447 \edef\caption@tempa{\the\prevdepth}%
448 \caption@Debug{\protect\prevdepth=\caption@tempa}%
449 \ifdim\prevdepth>-\p@
450 \let\caption@position\@secondoftwo
451 \else
452 \let\caption@position\@firstoftwo
453 \fi
454 \else
455 \caption@Debug{no \protect\prevdepth}%
456 \let\caption@position\@secondoftwo
457 \fi}
458 \newcommand\caption@beginhook{}
459 \newcommand\caption@endhook{}
460 \newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook}
461 \newcommand\AtEndCaption{\l@addto@macro\caption@endhook}
462 \DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}
463 \DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}}
464 \DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}
465 \DeclareCaptionOption{debug}[1]{%
466 \caption@setbool{debug}{#1}%
467 \caption@ifdebug{%
468 \def\caption@Debug{\PackageInfo{caption3}}%
469 }{%
470 \let\caption@Debug\@gobble
471 }}
472 \setkeys{caption}{debug=0}
473 \captionsetup{style=default,position=default,listof=1,%
474 twoside=\if@twoside 1\else 0\fi}
475 \newif\ifcaption@star
476 \newcommand\caption@make[2]{%
477 \caption@@make{\caption@lfmt{#1}{#2}}}
478 \newcommand\caption@@make[2]{%
479 \begingroup
480 \caption@beginhook
481 \caption@calcmargin
482 \caption@ifslc{\ifx\caption@sls\@empty\else
483 \caption@slc{#1}{#2}\captionwidth\relax
484 \fi}{}%
485 \@tempdima\captionmargin
486 \ifdim\captionmargin@=\z@\else
487 \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}%
488 \fi
489 \caption@ifh{\advance\@tempdima\captionindent}%
490 \hskip\@tempdima
491 \@tempdima\captionwidth
492 \caption@ifh{\advance\@tempdima by -\captionindent}%
493 \captionbox\@tempdima{%
494 \caption@ifh{%
495 \ifdim\captionindent=\z@
496 \leavevmode
497 \else
498 \hskip-\captionindent
499 \fi}%
500 \caption@@@make{#1}{#2}}%
501 \@tempdima\captionmargin
502 \ifdim\captionmargin@=\z@\else
503 \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}%
504 \fi
505 \hskip\@tempdima
506 \caption@endhook
507 \endgroup
508 \global\caption@starfalse}
509 \newcommand\caption@calcmargin{%
510 \@tempdima\hsize
511 \ifnum\@listdepth>0\relax
512 \advance\@tempdima by -\leftmargin
513 \advance\@tempdima by -\rightmargin
514 \fi
515 \ifdim\captionwidth=\z@
516 \captionwidth\@tempdima
517 \advance\captionwidth by -2\captionmargin
518 \advance\captionwidth by -\captionmargin@
519 \else
520 \captionmargin\@tempdima
521 \advance\captionmargin by -\captionwidth
522 \divide\captionmargin by 2
523 \captionmargin@\z@
524 \fi
525 \caption@Debug{%
526 \protect\hsize=\the\hsize,
527 \protect\margin=\the\captionmargin,
528 \protect\marginx=\the\captionmargin@,
529 \protect\width=\the\captionwidth}%
530 }
531 \newcommand\caption@slc[4]{%
532 \caption@startslc
533 \sbox\@tempboxa{\caption@@@make{#1}{#2}}%
534 \ifdim\wd\@tempboxa >#3%
535 \caption@endslc
536 \else
537 \caption@endslc
538 \caption@esetup\caption@sls
539 #4%
540 \fi}
541 \newcommand\caption@startslc{%
542 \begingroup
543 \let\label\@gobble
544 \let\@footnotetext\@gobble\let\@endnotetext\@gobble
545 \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}%
546 \let\caption@hj\relax}
547 \newcommand\caption@endslc{%
548 \endgroup}
549 \newcommand\captionbox{\parbox[b]}
550 \newcommand\caption@@@make[2]{%
551 \sbox\@tempboxa{#1}%
552 \ifdim\wd\@tempboxa=\z@
553 \let\caption@lsep\relax
554 \fi
555 \caption@ifempty{#2}{%
556 \let\caption@lsep\relax
557 }%
558 \@setpar{\@@par\caption@@par}\caption@@par
559 \caption@hj\captionsize\captionfont\caption@fmt
560 {\ifcaption@star\else{\captionlabelfont#1}\fi}%
561 {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}%
562 {{\captiontextfont
563 \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}%
564 \nobreak\hskip\z@skip
565 \caption@tfmt{#2}%
566 \caption@ifstrut{\@finalstrut\strutbox}{}%
567 \par}}}
568 \newcommand\caption@ifempty[1]{%
569 \def\caption@tempa{#1}%
570 \def\caption@tempb{\ignorespaces}%
571 \ifx\caption@tempa\caption@tempb
572 \let\caption@tempa\@empty
573 \fi
574 \ifx\caption@tempa\@empty
575 \expandafter\@firstofone
576 \else
577 \expandafter\@gobble
578 \fi}
579 \newcommand*\caption@@par{%
580 \parindent\captionparindent\hangindent\captionhangindent}%
581 \endinput
582 %%
583 %% End of file `caption3_2007-04-11.sty'.