Debian Codegraph @

texmf-dist/tex/latex/caption/caption_2007-04-16.sty

raw
1 %%
2 %% This is file `caption_2007-04-16.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% fallback/v3.0/caption.dtx (with options: `package')
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{caption}[2022/07/10 v3.0r Customising captions (AR)]
40 \RequirePackage{caption3}[=2007/01/31] % needs v1.0l or newer
41 \@ifpackageloaded{caption2}{%
42 \caption@Error{You can't use both the caption *and* caption2 package}%
43 \endinput
44 }{}
45 \DeclareCaptionOption{config}[caption]{%
46 \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file
47 #1.cfg used ***}}%
48 {\PackageWarning{caption}{Configuration
49 file #1.cfg not found}}}
50 \DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}
51 \DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}
52 \DeclareCaptionOption*{figurename}{\captionsetup[figure]{name=#1}}
53 \DeclareCaptionOption*{tablename}{\captionsetup[table]{name=#1}}
54 \DeclareCaptionOption*{normal}[]{\caption@setformat{normal}}
55 \DeclareCaptionOption*{isu}[]{\caption@setformat{hang}}
56 \DeclareCaptionOption*{hang}[]{\caption@setformat{hang}}
57 \DeclareCaptionOption*{center}[]{\caption@setjustification{centering}}
58 \DeclareCaptionOption*{anne}[]{\caption@setjustification{centerlast}}
59 \DeclareCaptionOption*{centerlast}[]{\caption@setjustification{centerlast}}
60 \DeclareCaptionOption*{scriptsize}[]{\def\captionfont{\scriptsize}}
61 \DeclareCaptionOption*{footnotesize}[]{\def\captionfont{\footnotesize}}
62 \DeclareCaptionOption*{small}[]{\def\captionfont{\small}}
63 \DeclareCaptionOption*{normalsize}[]{\def\captionfont{\normalsize}}
64 \DeclareCaptionOption*{large}[]{\def\captionfont{\large}}
65 \DeclareCaptionOption*{Large}[]{\def\captionfont{\Large}}
66 \DeclareCaptionOption*{up}[]{\l@addto@macro\captionlabelfont\upshape}
67 \DeclareCaptionOption*{it}[]{\l@addto@macro\captionlabelfont\itshape}
68 \DeclareCaptionOption*{sl}[]{\l@addto@macro\captionlabelfont\slshape}
69 \DeclareCaptionOption*{sc}[]{\l@addto@macro\captionlabelfont\scshape}
70 \DeclareCaptionOption*{md}[]{\l@addto@macro\captionlabelfont\mdseries}
71 \DeclareCaptionOption*{bf}[]{\l@addto@macro\captionlabelfont\bfseries}
72 \DeclareCaptionOption*{rm}[]{\l@addto@macro\captionlabelfont\rmfamily}
73 \DeclareCaptionOption*{sf}[]{\l@addto@macro\captionlabelfont\sffamily}
74 \DeclareCaptionOption*{tt}[]{\l@addto@macro\captionlabelfont\ttfamily}
75 \DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}}
76 \caption@setbool{ruled}{0}
77 \DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}}
78 \DeclareCaptionOption*{flushleft}[]{\caption@setjustification{raggedright}}
79 \DeclareCaptionOption*{flushright}[]{\caption@setjustification{raggedleft}}
80 \DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}}
81 \DeclareCaptionOption*{ignoreLTcapwidth}[]{}
82 \DeclareCaptionOption*{onelinecaption}[]{\caption@setbool{slc}{1}}
83 \DeclareCaptionOption*{noonelinecaption}[]{\caption@setbool{slc}{0}}
84 \DeclareCaptionOption*{tablecaptionabove}[]{\captionsetup[table]{position=t}}
85 \DeclareCaptionOption*{tablecaptionbelow}[]{\captionsetup[table]{position=b}}
86 \newcommand*\caption@declarepackage[1]{%
87 \caption@setbool{pkt@#1}{1}%
88 \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}}
89 \AtEndOfPackage{\let\caption@declarepackage\@undefined}
90 \newcommand\caption@ifpackage[3]{%
91 \edef\caption@tempa{%
92 \caption@ifbool{pkt@#1}%
93 {\@ifundefined{#2}{AtBeginDocument}{firstofone}}%
94 {gobble}}%
95 \caption@Info{#1=\caption@ifbool{pkt@#1}{1}{0} %
96 (\@ifundefined{#2}{not }{}loaded->\caption@tempa)}%
97 \caption@ifbool{pkt@#1}{%
98 \@ifundefined{#2}%
99 {\let\caption@tempa\AtBeginDocument}%
100 {\let\caption@tempa\@firstofone}%
101 }{%
102 \let\caption@tempa\@gobble
103 }%
104 \caption@tempa{\@ifundefined{#2}{}{#3}}%
105 \caption@undefbool{pkt@#1}}
106 \AtEndOfPackage{\let\caption@ifpackage\@undefined}
107 \caption@declarepackage{caption}
108 \caption@declarepackage{float}
109 \caption@declarepackage{floatrow}
110 \caption@declarepackage{hyperref}
111 \caption@declarepackage{hypcap}
112 \caption@declarepackage{listings}
113 \caption@declarepackage{longtable}
114 \caption@declarepackage{picins}
115 \caption@declarepackage{rotating}
116 \caption@declarepackage{sidecap}
117 \caption@declarepackage{supertabular}
118 \DeclareCaptionOption{verbose}[1]{%
119 \caption@setbool{verbose}{#1}%
120 \caption@ifverbose{%
121 \def\caption@Info{\PackageInfo{caption}}%
122 }{%
123 \let\caption@Info\@gobble
124 }}
125 \setkeys{caption}{verbose=0}
126 \caption@ProcessOptions{caption}
127 \caption@ifbool{pkt@caption}{}{\endinput}
128 \caption@undefbool{pkt@caption}
129 \def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}}
130 \newcommand*\caption@of[2]{\def\@captype{#2}#1}
131 \DeclareCaptionOption{name}{\caption@setfloatname\@captype{#1}}
132 \DeclareCaptionOption{type}{\def\@captype{#1}}
133 \providecommand\ContinuedFloat{%
134 \@ifnextchar[%]
135 \@ContinuedFloat
136 {\ifx\@captype\@undefined
137 \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd
138 \else
139 \@ContinuedFloat[\@captype]%
140 \fi}}
141 \def\@ContinuedFloat[#1]{%
142 \addtocounter{#1}\m@ne
143 \caption@ContinuedFloat{#1}%
144 \caption@@ContinuedFloat{#1}}
145 \let\caption@ContinuedFloat\@gobble
146 \let\caption@resetContinuedFloat\@gobble
147 \providecommand*\caption@@ContinuedFloat[1]{}
148 \newcommand*\caption@begin[1]{%
149 \caption@resetContinuedFloat{#1}%
150 \begingroup
151 \caption@setfloattype{#1}%
152 \ifx\caption@lfmt\caption@lfmt@default\else
153 \@namedef{fnum@#1}{%
154 \caption@lfmt{\caption@floatname{#1}}{\@nameuse{the#1}}}%
155 \fi
156 \caption@fixposition
157 \global\let\caption@fixedposition\caption@position}
158 \newcommand\caption@beginex[3]{%
159 \caption@begin{#1}%
160 \caption@iflof%
161 {\def\caption@tempa{#2}}%
162 {\let\caption@tempa\@empty}%
163 \ifx\caption@tempa\@empty
164 \long\def\addcontentsline##1##2##3{}% There is no \@gobblethree...
165 \fi
166 \caption@ifempty{#3}{\let\caption@ifempty\@secondoftwo}%
167 }
168 \newcommand*\caption@end{%
169 \endgroup
170 \let\caption@position\caption@fixedposition}
171 \let\caption@setfloattype\caption@settype
172 \newcommand*\caption@letfloattype[2]{%
173 \def\caption@setfloattype##1{%
174 \caption@settype{##1}#2\caption@settype{#1}}}
175 \newcommand*\caption@floatname[1]{\@nameuse{#1name}}
176 \newcommand*\caption@setfloatname[1]{\@namedef{#1name}}
177 \AtBeginDocument{%
178 \@ifundefined{cc@caption}{%
179 \@ifundefined{caption@old}{%
180 \let\caption@old\caption
181 \def\caption{\caption@caption\caption@old}%
182 \def\caption@caption#1{%
183 \@ifstar{\ContinuedFloat\global\caption@startrue#1[]}{#1}}%
184 \let\caption@@old\@caption
185 \long\def\@caption#1[#2]#3{%
186 \caption@beginex{#1}{#2}{#3}%
187 \caption@@old{#1}[{#2}]{#3}%
188 \caption@end}%
189 }{}}{%
190 \caption@Info{captcont package v2.0 detected}%
191 \def\caption@caption#1{#1}%
192 }%
193 }
194 \renewcommand\@makecaption[2]{%
195 \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
196 \caption@@make{#1}{#2}%
197 \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}}
198 \@ifundefined{scr@caption}{}{%
199 \caption@Info{KOMA-Script class detected}
200 \AtBeginDocument{\let\scr@caption\caption}
201 \def\onelinecaptionstrue{\caption@setbool{slc}{1}}
202 \def\onelinecaptionsfalse{\caption@setbool{slc}{0}}
203 \def\captionabove{%
204 \caption@setposition{t}\let\caption@setposition\@gobble
205 \scr@caption}
206 \def\captionbelow{%
207 \caption@setposition{b}\let\caption@setposition\@gobble
208 \scr@caption}
209 }
210 \AtBeginDocument{\@ifundefined{f@ffrench}{}{%
211 \caption@Info{french(le) package detected}%
212 \@ifundefined{GOfrench}%
213 {\let\caption@tempa\@firstofone}%
214 {\def\caption@tempa{\g@addto@macro\GOfrench}}%
215 \caption@tempa{%
216 \let\@cnORI\caption
217 \let\caption@tablescaption\@tablescaption
218 \def\@tablescaption{\caption@caption\caption@tablescaption}%
219 \let\@eatDP\@undefined
220 \let\caption@tempa\@empty
221 \ifx\f@ffrench\fnum@figure
222 \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}%
223 \fi
224 \ifx\f@tfrench\fnum@table
225 \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}%
226 \fi
227 \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}%
228 \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}%
229 \caption@tempa
230 }}}
231 \def\caption@setfloatposition{%
232 \caption@setposition{\@fs@iftopcapt t\else b\fi}}
233 \caption@ifpackage{float}{@float@setevery}{%
234 \caption@Info{float package v1.3 (or newer) detected}%
235 \let\caption@of@float\@gobble
236 \renewcommand*\caption@of[2]{%
237 \@ifundefined{fst@#2}{}{%
238 \let\caption@of@float\@firstofone
239 \@nameuse{fst@#2}\@float@setevery{#2}}%
240 \def\@captype{#2}#1}%
241 \let\caption@@float\float@caption
242 \long\def\float@caption#1[#2]#3{%
243 \caption@beginex{#1}{#2}{#3}%
244 \let\@fs@capt\caption@@make
245 \caption@@float{#1}[{#2}]{#3}%
246 \caption@of@float{%
247 \@ifundefined{hyper@@anchor}{}{%
248 \begingroup
249 \@tempdima\prevdepth
250 \nointerlineskip
251 \let\leavevmode\relax
252 \hyper@@anchor\@currentHref\relax
253 \prevdepth\@tempdima
254 \endgroup}%
255 \def\caption@@make##1##2{\unvbox\@floatcapt}%
256 \@makecaption{}{}}%
257 \caption@end}%
258 \let\caption@float@setevery\@float@setevery
259 \def\@float@setevery#1{%
260 \def\caption@floatname##1{\@nameuse{fname@#1}}%
261 \def\caption@setfloatname##1{\@namedef{fname@#1}}%
262 \expandafter\let\expandafter\caption@tempa\csname @float@c@#1\endcsname
263 \ifx\caption@tempa\float@caption
264 \else\ifx\caption@tempa\@caption
265 \else\ifx\caption@tempa\caption@@float
266 \caption@Info{\protect\@float@c@#1\space := \protect\float@caption}%
267 \expandafter\let\csname @float@c@#1\endcsname\float@caption
268 \else
269 \caption@Info{\protect\@float@c@#1\space := \protect\@caption}%
270 \expandafter\let\csname @float@c@#1\endcsname\@caption
271 \fi\fi\fi
272 \expandafter\ifx\csname @float@c@#1\endcsname\float@caption
273 \caption@setfloatposition
274 \expandafter\let\expandafter\caption@fst\csname fst@#1\endcsname
275 \edef\caption@fst{\noexpand\string\expandafter\noexpand\caption@fst}%
276 \edef\caption@fst{\noexpand\@gobblefour\caption@fst}%
277 \caption@setstyle*\caption@fst
278 \caption@settype\caption@fst
279 \fi
280 \caption@float@setevery{#1}}%
281 \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}%
282 \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}%
283 }
284 \captionsetup[boxed]{skip=2pt}
285 \caption@ifbool{ruled}{%
286 \captionsetup[ruled]{margin=0pt,singlelinecheck=0}%
287 }{%
288 \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}%
289 }
290 \caption@undefbool{ruled}
291 \caption@ifpackage{floatrow}{flrow@setlist}{%
292 \caption@Info{floatrow package v0.1f (or newer) detected}%
293 \renewcommand*\caption@of[2]{%
294 \def\@captype{#2}\flrow@setlist{{#2}}#1}%
295 \renewcommand*\caption@floatname[1]{%
296 \@nameuse{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
297 \renewcommand*\caption@setfloatname[1]{%
298 \@namedef{\@ifundefined{fname@#1}{#1name}{fname@#1}}}%
299 }
300 \caption@ifpackage{hyperref}{theHfigure}{%
301 \caption@Info{hyperref package v6.74m (or newer) detected}%
302 \def\caption@ContinuedFloat#1{%
303 \@ifundefined{theH#1}{}{%
304 \@ifundefined{CF@#1}{%
305 \expandafter\caption@newcounter\csname CF@#1\endcsname
306 \caption@resetContinuedFloat{#1}}{}%
307 \expandafter\caption@stepcounter\csname CF@#1\endcsname
308 \expandafter\l@addto@macro\csname theH#1\endcsname{%
309 .\csname CF@#1\endcsname}%
310 \let\caption@resetContinuedFloat\@gobble
311 }}%
312 \def\caption@resetContinuedFloat#1{%
313 \@ifundefined{CF@#1}{}{%
314 \expandafter\caption@setcounter\csname CF@#1\endcsname0}}%
315 }
316 \caption@ifpackage{hypcap}{hc@caption}{%
317 \caption@Info{hypcap package v1.0 (or newer) detected}%
318 \let\caption@capstart\capstart
319 \def\capstart{%
320 \let\hc@org@caption\caption
321 \begingroup
322 \let\H@refstepcounter\@gobble
323 \Hy@hypertexnamesfalse
324 \caption@capstart
325 \@ifundefined{hc@hyperref}{}{% hypcap v1.7
326 \global\advance\csname c@\@captype\endcsname\@ne}%
327 \global\let\hc@currentHref\@currentHref
328 \endgroup
329 \@ifundefined{hc@hyperref}%
330 {\let\next\@firstofone}{\let\next\hc@hyperref}% hypcap v1.7
331 \next{\def\caption{%
332 \let\caption\hc@org@caption
333 \H@refstepcounter\@captype
334 \@ifundefined{hc@hyperref}{}{% hypcap v1.7
335 \global\advance\csname c@\@captype\endcsname\m@ne}%
336 \caption@caption\hc@caption}}%
337 }%
338 \let\caption@hc@@caption\hc@@caption
339 \long\def\hc@@caption#1[#2]#3{%
340 \caption@beginex{#1}{#2}{#3}%
341 \let\caption@hyper@makecurrent\hyper@makecurrent
342 \def\hyper@makecurrent\@captype{%
343 \let\hyper@makecurrent\caption@hyper@makecurrent
344 \global\let\@currentHref\hc@currentHref}%
345 \caption@hc@@caption{#1}[{#2}]{#3}%
346 \caption@end}%
347 }
348 \caption@ifpackage{listings}{lst@MakeCaption}{%
349 \caption@Info{listings package v1.2 (or newer) detected}%
350 \let\caption@lst@MakeCaption\lst@MakeCaption
351 \def\lst@MakeCaption#1{%
352 \def\caption@autoposition{\caption@setposition{#1}}%
353 \caption@begin{lstlisting}%
354 \caption@lst@MakeCaption{#1}%
355 \caption@end}%
356 }
357 \caption@ifpackage{longtable}{LT@makecaption}{%
358 \caption@Info{longtable package v3.15 (or newer) detected}%
359 \def\LT@makecaption#1#2#3{%
360 \caption@LT@make{%
361 \caption@startrue#1\caption@starfalse
362 \caption@letfloattype{longtable}{%
363 \ifdim\LTcapwidth=4in \else
364 \setcaptionwidth\LTcapwidth
365 \fi}%
366 \let\caption@defaultpos\@firstoftwo
367 \def\caption@autoposition{%
368 \caption@setposition{\ifcase\LT@rows t\else b\fi}}%
369 \caption@begin{table}%
370 \vskip-\ht\strutbox
371 \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}%
372 \caption@@make{#2}{#3}\endgraf
373 \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
374 \caption@end}}%
375 \newcommand\caption@LT@make[1]{%
376 \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{#1}\hss}}}%
377 }
378 \caption@ifpackage{picins}{piccaption}{%
379 \caption@Info{picins package v3.0 (or newer) detected}%
380 \def\piccaption{\@dblarg\@piccaption}
381 }
382 \caption@ifpackage{rotating}{@rotcaption}{%
383 \caption@Info{rotating package v2.0 (or newer) detected}%
384 \def\rotcaption{\let\@makecaption\@makerotcaption\caption}%
385 \def\rotcaptionof{%
386 \@ifstar{\caption@of{\rotcaption*}}{\caption@of\rotcaption}}%
387 \long\def\@makerotcaption#1#2{%
388 \ifdim\captionwidth=\z@
389 \setcaptionwidth{.8\textheight}%
390 \caption@slc{#1}{#2}{.8\vsize}{%
391 \let\caption@makerot\caption@@make
392 \setcaptionmargin\z@
393 \let\captionbox\@secondoftwo}%
394 \caption@setbool{slc}{0}% been there, done that
395 \fi
396 \rotatebox{90}{\caption@makerot{#1}{#2}}%
397 \nobreak\hspace{12pt}}%
398 \newcommand\caption@makerot[2]{%
399 \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}%
400 }
401 \caption@ifpackage{sidecap}{endSC@FLOAT}{%
402 \caption@Info{sidecap package v1.4d (or newer) detected}%
403 \@ifundefined{caption@caption}%
404 {\let\caption@tempa\AtBeginDocument}%
405 {\let\caption@tempa\@firstofone}%
406 \caption@tempa{\let\SC@caption=\caption}%
407 \let\caption@SC@zfloat\SC@zfloat
408 \def\SC@zfloat#1#2#3[#4]{%
409 \caption@SC@zfloat{#1}{#2}{#3}[#4]%
410 \global\let\SC@CAPsetup\@empty
411 \def\captionsetup##1{\g@addto@macro\SC@CAPsetup{,##1}}%
412 \let\caption@SC\caption
413 \def\caption{\caption@caption\caption@SC}%
414 \ignorespaces}%
415 \let\caption@endSC@FLOAT\endSC@FLOAT
416 \def\endSC@FLOAT{%
417 \let\@captype\SC@captype
418 \caption@esetup\SC@CAPsetup
419 \caption@letfloattype{SC\@captype}{%
420 \@listdepth\z@
421 \setcaptionmargin\z@
422 \@ifundefined{SC@justify}{}{%
423 \ifx\SC@justify\@empty\else
424 \let\caption@hj\SC@justify
425 \let\SC@justify\@empty
426 \fi}}%
427 \long\def\caption@ifempty##1{%
428 \ifx\SC@CAPtext\@empty
429 \expandafter\@firstofone
430 \else
431 \expandafter\@gobble
432 \fi}%
433 \caption@endSC@FLOAT}%
434 }
435 \def\caption@setSTposition{%
436 \caption@setposition{\if@topcaption t\else b\fi}}
437 \caption@ifpackage{supertabular}{ST@caption}{%
438 \caption@Info{supertabular package detected}%
439 \let\caption@tablecaption\tablecaption
440 \def\tablecaption{\caption@caption\caption@tablecaption}%
441 \long\def\ST@caption#1[#2]#3{\par%
442 \caption@letfloattype{supertabular}{}%
443 \let\caption@fixposition\caption@setSTposition
444 \caption@beginex{#1}{#2}{#3}%
445 \addcontentsline{\csname ext@#1\endcsname}{#1}%
446 {\protect\numberline{%
447 \csname the#1\endcsname}{\ignorespaces #2}}%
448 \@parboxrestore
449 \normalsize
450 \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
451 \caption@end}%
452 }
453 \endinput
454 %%
455 %% End of file `caption_2007-04-16.sty'.