summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/caption/caption.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/caption/caption.sty')
-rw-r--r--Master/texmf-dist/tex/latex/caption/caption.sty674
1 files changed, 382 insertions, 292 deletions
diff --git a/Master/texmf-dist/tex/latex/caption/caption.sty b/Master/texmf-dist/tex/latex/caption/caption.sty
index ea101edc13e..74909ecde1d 100644
--- a/Master/texmf-dist/tex/latex/caption/caption.sty
+++ b/Master/texmf-dist/tex/latex/caption/caption.sty
@@ -6,7 +6,7 @@
%%
%% caption.dtx (with options: `package')
%%
-%% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+%% Copyright (C) 1994-2022 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%%
%% https://gitlab.com/axelsommerfeldt/caption
%%
@@ -33,13 +33,21 @@
%% caption.sty, caption-light.sty, caption2.sty, caption3.sty,
%% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
%% caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
-%% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty,
-%% and the user manuals
-%% caption-deu.tex, caption-eng.tex, caption-rus.tex.
+%% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty.
%%
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption}[2020/10/26 v3.5g Customizing captions (AR)]
-\RequirePackage{caption3}[2020/10/06] % needs v2.2b or newer
+\providecommand\DeclareRelease[3]{}
+\providecommand\DeclareCurrentRelease[2]{}
+\DeclareRelease{v1}{1994-10-27}{caption_1995-04-05.sty}
+\DeclareRelease{v3.0}{2003-12-20}{caption_2007-04-16.sty}
+\DeclareRelease{v3.1}{2007-09-01}{caption_2010-01-09.sty}
+\DeclareRelease{v3.2}{2011-08-06}{caption_2011-11-10.sty}
+\DeclareRelease{v3.3}{2013-01-10}{caption_2019-09-01.sty}
+\DeclareRelease{v3.4}{2019-11-24}{caption_2020-07-29.sty}
+\DeclareRelease{v3.5}{2020-08-30}{caption_2020-10-26.sty}
+\DeclareCurrentRelease{v3.6}{2022-02-20}
+\ProvidesPackage{caption}[2022/02/20 v3.6 Customizing captions (AR)]
+\RequirePackage{caption3}[2022/01/07] % needs v2.3 or newer
\caption@ifbool{documentclass}{}{%
\caption@WarningNoLine{%
Unknown document class (or package),\MessageBreak
@@ -51,17 +59,40 @@
\endinput
}{}
\caption@AtBeginDocument{%
- \@ifpackageloaded{ftcap}{\caption@DisablePositionOption{ftcap}}{}%
- \@ifpackageloaded{nonfloat}{\caption@DisablePositionOption{nonfloat}}{}%
- \@ifpackageloaded{topcapt}{\caption@DisablePositionOption{topcapt}}{}}
-\newcommand*\caption@DisablePositionOption[1]{%
- \caption@InfoNoLine{%
- `#1' package detected; setting `position=b' for compatibility reasons}%
- \caption@setposition b%
- \DeclareCaptionOption{position}{%
- \caption@Error{Usage of the `position' option is incompatible\MessageBreak
- to the `#1' package}}}
-\@onlypreamble\caption@DisablePositionOption
+ \caption@setincompatible{\@ifpackageloaded{captcont}}{captcont package}%
+ \caption@setincompatible{\@ifpackageloaded{ftcap}}{ftcap package}%
+ \caption@setincompatible{\@ifpackageloaded{nonfloat}}{nonfloat package}%
+ \caption@setincompatible{\@ifpackageloaded{topcapt}}{topcapt package}}
+\newcommand*\caption@setincompatible[2]{%
+ #1{%
+ \caption@Error{%
+ The #2 is incompatible to the\MessageBreak
+ current version of the `caption' package,\MessageBreak
+ so try \string\usepackage{caption}[=v1] instead}%
+ }{}}
+\@onlypreamble\caption@setincompatible
+\DeclareCaptionPosition{auto}{#2}{%
+ \caption@ifsubcaption@above{#2}{%
+ \ifvmode
+ \caption@autoposition{#1}{#2}%
+ \else
+ #2%
+ \fi}}
+\def\caption@position@a{\caption@position@auto} % needed by floatrow package, \flrow@cappos
+\SetCaptionDefault{position}{auto}
+\newcommand*\caption@setautoposition[1]{%
+ \renewcommand*\caption@position@auto{%
+ \@nameuse{caption@position@#1}}}
+\newcommand*\caption@autoposition[2]{%
+ \edef\caption@tempa{\the\prevdepth}%
+ \caption@Debug{\string\prevdepth=\caption@tempa}%
+ \ifdim\prevdepth>-\p@
+ #2% position=bottom
+ \else
+ #1% position=top
+ \fi}
+\newcommand*\DeclareCaptionAutoPosition{%
+ \renewcommand*\caption@autoposition[2]}%
\DeclareCaptionOption*{config}[caption]{%
\InputIfFileExists{#1.cfg}%
{\typeout{*** Local configuration file #1.cfg used ***}}%
@@ -76,56 +107,22 @@
}}}
\DeclareCaptionOption{list-entry}{\caption@selectlistentry{#1}}
\captionsetup{list-entry=default}
-\newcommand\caption@declparboxrestore{%
- \caption@decl{parboxrestore}}
-\@onlypreamble\caption@declparboxrestore
-\newcommand*\caption@setparboxrestore{%
- \caption@set{parboxrestore}}
-\caption@declparboxrestore{full}{%
- \@parboxrestore}
-\caption@declparboxrestore{partial}{%
- \let\if@nobreak\iffalse
- \let\if@noskipsec\iffalse
- \let\par\@@par
- \parindent\z@ \parskip\z@skip
- \everypar{}%
- \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
- \parfillskip\@flushglue \lineskip\normallineskip
- \baselineskip\normalbaselineskip
- \sloppy
- \let\\\@normalcr}
-\caption@declparboxrestore{mini}{%
- \let\par\@@par
- \parindent\z@ \parskip\z@skip
- \sloppy}
-\SetCaptionDefault{parboxrestore}{full}
-\DeclareCaptionOption{parboxrestore}{\caption@setparboxrestore{#1}}
-\captionsetup{parboxrestore=default}
\DeclareCaptionOption{@minipage}{%
\caption@ifinlist{#1}{auto,default}%
{\let\caption@if@minipage\@gobbletwo}%
{\caption@set@bool\caption@if@minipage{#1}}}
\captionsetup{@minipage=default}
-\DeclareCaptionOption{compatibility}[v1]{%
- \caption@ifinlist{#1}{v1,1,true,yes,on}{%
- \let\caption@ifcompatibility\@firstoftwo
- }{\caption@ifinlist{#1}{v3,3,0,false,no,off}{%
- \let\caption@ifcompatibility\@secondoftwo
+\DeclareCaptionOption{compatibility}[1]{%
+ \caption@ifinlist{#1}{1,true,yes,on}{%
+ \caption@Error{%
+ Obsolete compatibility value `#1',\MessageBreak
+ please use either \string\usepackage{caption}[=v1]\MessageBreak
+ or \string\usepackage{caption-light} instead}%
+ }{\caption@ifinlist{#1}{0,false,no,off}{%
+ % nothing to do
}{%
\caption@Error{Undefined compatibility value `#1'}%
}}}
-\@onlypreamble@key{caption}{compatibility}
-\caption@setbool{compatibility}{0} % default: Try not to be compatible to v1.x
-\newcommand*\caption@setincompatible[2]{%
- #1{%
- \caption@WarningNoLine{%
- #2;\MessageBreak
- Setting compatibility to v1}%
- \caption@setbool{compatibility}{1}%
- }{}}
-\caption@AtBeginDocument{\caption@ifcompatibility{}{%
- \caption@setincompatible{\@ifpackageloaded{captcont}}{captcont package is loaded}%
-}}
\DeclareCaptionOptionNoValue*{normal}{%
\caption@setup{format=plain,justification=justified}}
\DeclareCaptionOptionNoValue*{isu}{%
@@ -186,6 +183,16 @@
\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
\caption@ProcessOptions*{caption}
\newcounter{caption@flags}
+\newcommand*\caption@clrflags{%
+ \setcounter{caption@flags}{0}}
+\newcommand*\caption@ifflags{%
+ \ifcase\c@caption@flags
+ \expandafter\@secondoftwo
+ \else
+ \expandafter\@firstoftwo
+ \fi}
+\newcommand*\caption@setflag[1]{%
+ \caption@ifflag{#1}{}{\addtocounter{caption@flags}{#1}}}
\newcommand*\caption@ifflag[1]{%
\@tempcnta\c@caption@flags
\divide\@tempcnta #1\relax
@@ -194,22 +201,24 @@
\else
\expandafter\@secondoftwo
\fi}
-\newcommand*\caption@clrflags{%
- \setcounter{caption@flags}\z@}
-\newcommand*\caption@clrflag[1]{%
- \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
-\newcommand*\caption@setflag[1]{%
- \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
-\newcommand*\caption@addtoflags{%
- \addtocounter{caption@flags}}
+\newcommand*\caption@setcontinued{\caption@setflag1}
+\newcommand*\caption@ifcontinued{\caption@ifflag1}
+\newcommand*\caption@setcaption{\caption@setflag2}
+\newcommand*\caption@ifcaption{\caption@ifflag2}
+\newcommand*\caption@setsubcaption{%
+ \caption@ifcaption{\caption@setflag8}{\caption@setflag4}}
+\newcommand*\caption@ifsubcaption@above{\caption@ifflag4}
+\newcommand*\caption@ifsubcaption@below{\caption@ifflag8}
\def\caption@caption{%
\caption@iftype
{\caption@checkgrouplevel\@empty\caption
\caption@star
{\caption@refstepcounter\@captype}%
{\caption@dblarg{\@caption\@captype}}}%
- {\caption@Error{\noexpand\caption outside float}%
- \caption@gobble}}
+ {\caption@OutsideFloat\caption
+ \caption@withoptargs\@gobbletwo}}
+\newcommand*\caption@OutsideFloat[1]{%
+ \caption@Error{\string#1 outside float}}
\newcommand*\caption@star[2]{%
\@ifstar{\caption@startrue#2[]}{#1#2}}
\long\def\caption@@caption#1[#2]#3{%
@@ -219,6 +228,7 @@
\@nameuse{nag@hascaptiontrue}%
\fi
\par
+ \caption@nobreak
\caption@beginex{#1}{#2}{#3}%
\caption@setfloatcapt{%
\caption@parboxrestore
@@ -231,6 +241,7 @@
\fi
\@makecaption{\csname fnum@#1\endcsname}%
{\ignorespaces\caption@makeanchor{#3}}\par
+ \caption@nobreak
\caption@if@minipage\@minipagetrue\@minipagefalse}%
\caption@end}
\providecommand\memcaptioninfo[4]{}
@@ -239,10 +250,22 @@
\caption@ifhypcap\caption@@start\relax
\M@gettitle{#2}}
\providecommand\M@gettitle[1]{}
+\newcommand*\caption@nobreak{}
+\newcommand*\caption@parboxrestore{%
+ \caption@before@parboxrestore
+ \caption@@parboxrestore
+ \caption@after@parboxrestore}
+\newcommand*\caption@before@parboxrestore{}
+\newcommand*\caption@@parboxrestore{\@parboxrestore}
+\newcommand*\caption@after@parboxrestore{}
\long\def\caption@makecaption#1#2{%
+ \caption@nobreak
\caption@make@above
+ \caption@nobreak
\caption@@make{#1}{#2}%
- \caption@make@below}
+ \caption@nobreak
+ \caption@make@below
+ \caption@nobreak}
\newcommand*\caption@make@above{%
\caption@iftop
\caption@belowskip
@@ -251,49 +274,28 @@
\caption@iftop
{\caption@aboveskip\caption@rule}%
\caption@belowskip}
-\newcommand*\caption@redefine{}
-\g@addto@macro\caption@redefine{%
- \caption@ifcompatibility{%
- \caption@InfoNoLine{
- \noexpand\caption will not be redefined since `compatibility' is set to v1}%
- \renewcommand*\caption@redefine{}%
- \renewcommand*\caption@continuedfloat[1]{%
- \caption@Error{Not available with option `compatibility=v1'}}%
- \caption@AtBeginDocument*{%
- \let\caption@start\relax
- \caption@ifdefined\caption@ORI@capstart{%
- \caption@Debug{%
- Restore hypcap definition of \string\capstart\@gobble}%
- \let\capstart\caption@ORI@capstart}{}%
- }%
- \renewcommand*\caption@star[2]{#1#2}%
- }{%
- \renewcommand*\caption@redefine{%
- \let\caption\caption@caption
- \let\@caption\caption@@caption}%
- }%
- \caption@redefine
- \caption@AtBeginDocument*{%
- \let\caption@ORI@capstart\@undefined}%
+\newcommand*\caption@redefine{%
+ \let\caption\caption@caption
+ \let\@caption\caption@@caption
\let\caption@ORI@xfloat\@xfloat
- \def\@xfloat#1[#2]{%
- \caption@ORI@xfloat{#1}[#2]%
- \caption@settype{#1}%
- \caption@xfloat@hook}%
- \newcommand*\caption@xfloat@hook{}%
+ \let\@xfloat\caption@xfloat
\let\caption@ORI@xdblfloat\@xdblfloat
- \def\@xdblfloat#1[#2]{%
- \caption@ORI@xdblfloat{#1}[#2]% expands to \@xfloat{#1}[#2] + extra stuff
- \caption@setoptions{#1*}%
- \caption@xdblfloat@hook}%
- \newcommand*\caption@xdblfloat@hook{}%
+ \let\@xdblfloat\caption@xdblfloat
}
-\caption@AtBeginDocument{\caption@redefine}
+\caption@AtBeginDocument{%
+ \caption@redefine
+ \let\caption@redefine\relax}
\let\@makecaption\caption@makecaption
-\newcommand\phantomcaption{%
- \caption@iftype
- {\caption@refstepcounter\@captype}%
- {\caption@Error{\noexpand\phantomcaption outside float}}}%
+\def\caption@xfloat#1[#2]{%
+ \caption@ORI@xfloat{#1}[#2]%
+ \caption@settype{#1}%
+ \caption@xfloat@hook}
+\newcommand*\caption@xfloat@hook{}
+\def\caption@xdblfloat#1[#2]{%
+ \caption@ORI@xdblfloat{#1}[#2]% expands to \@xfloat{#1}[#2] + extra stuff
+ \caption@setoptions{#1*}%
+ \caption@xdblfloat@hook}
+\newcommand*\caption@xdblfloat@hook{}
\caption@AtBeginDocument{%
\DeclareCaptionOption{type}{\setcaptiontype{#1}}%
\DeclareCaptionOption{type*}{\setcaptiontype*{#1}}%
@@ -301,25 +303,34 @@
\DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}%
}
\def\setcaptiontype{%
- \caption@parboxrestore@mini
+ \caption@parboxrestore@light
\caption@settype}
-\newcommand\setcaptionsubtype{%
- \caption@iftype
- \caption@setsubtype
- {\caption@Error{\noexpand\setcaptionsubtype outside float}}}%
-\newcommand\caption@setsubtype{%
- \caption@teststar\caption@@setsubtype\@firstoftwo\@secondoftwo}
-\newcommand*\caption@@setsubtype[1]{%
- \caption@@@settype{sub}{#1}{sub\@captype}}
\newcommand*\caption@settype{%
+ \caption@initposition
\caption@clrflags
- \caption@set@type}
-\newcommand*\caption@set@type{%
- \caption@teststar\caption@@settype\@firstoftwo\@secondoftwo}
+ \aftergroup\flushsubcaptionlistentries
+ \caption@@settype}
\newcommand*\caption@@settype{%
- \caption@@@settype{}}
+ \caption@teststar\caption@@settype@\@firstoftwo\@secondoftwo}
+\newcommand*\caption@@settype@[1]{%
+ \@ifnextchar[%]
+ {\caption@@settype@@{#1}}%
+ {\caption@@@settype{}{#1}}}
+\def\caption@@settype@@#1[#2]#3{%
+ \caption@@@settype{}{#1}{#3}%
+ \caption@setoptions{#2}}
+\newcommand*\setcaptionsubtype{%
+ \caption@setsubtype}
+\newcommand*\caption@setsubtype{% used by the floatrow package
+ \caption@teststar\caption@@setsubtype\@firstoftwo\@secondoftwo}
+\newcommand*\caption@@setsubtype[1]{%
+ \caption@iftype
+ {\caption@ifsubtype
+ {\caption@Debug{subtype=\@subcaptype}}%
+ {\caption@@@settype{sub}{#1}{sub\@captype}}}%
+ {\caption@OutsideFloat\setcaptionsubtype}}
\newcommand*\caption@@@settype[3]{%
- \caption@Debug{#1type=#3}%
+ \caption@Debug{#1type:=#3}%
\@nameuse{caption@check#1type}{#3}%
{\caption@checkgrouplevel{#1}{%
\captionsetup{#1type#2*\@empty=...}#2{ or
@@ -338,21 +349,26 @@
The #1type was already set to
`\csname @#1captype\endcsname'\MessageBreak}}%
\fi
- #2{}{%
- \let\@currentlabel\caption@undefinedlabel
- \ifx\caption@x@label\@undefined
- \let\caption@x@label\label
- \let\label\caption@xlabel
- \fi
- \caption@start}}}
+ #2{}{\caption@reset@currentlabel\caption@start}}}
+\newcommand*\caption@parboxrestore@light{%
+ \let\par\@@par
+ \parindent\z@ \parskip\z@skip
+ \sloppy}
+\newcommand*\caption@reset@currentlabel{%
+ \let\@currentlabel\caption@undefinedlabel
+ \ifx\caption@x@label\@undefined
+ \let\caption@x@label\label
+ \let\label\caption@xlabel
+ \fi}
\newcommand*\caption@iftype{\caption@ifdefined\@captype}
+\newcommand*\caption@ifsubtype{\caption@ifdefined\@subcaptype}
\newcommand*\caption@checktype[1]{%
- \caption@ifsubtype{#1}\@firstoftwo{\caption@ifin@list\sf@counterlist{#1}}%
+ \caption@ifdefined@subtype{#1}\@firstoftwo{\caption@ifin@list\sf@counterlist{#1}}%
{\caption@Error{Should not be used with subtype `#1'}%
\@gobble}%
\@firstofone}
\newcommand*\caption@checksubtype[1]{%
- \caption@ifsubtype{#1}%
+ \caption@ifdefined@subtype{#1}%
\@firstofone
{\caption@ifin@list\sf@counterlist{#1}%
{\caption@Warning{%
@@ -395,17 +411,68 @@
\caption@AtBeginDocument{%
\def\captionof{\caption@teststar\caption@of{\caption*}\caption}}
\providecommand*\caption@of[2]{\setcaptiontype*{#2}#1}
+\newcommand*\phantomcaption{%
+ \caption@iftype
+ {\caption@refstepcounter\@captype}%
+ {\caption@OutsideFloat\phantomcaption}}
\newcommand*\captionlistentry{%
- \caption@teststar\@captionlistentry\@firstoftwo\@secondoftwo}
-\newcommand*\@captionlistentry[1]{%
- \@testopt{\caption@listentry{#1}}\@captype}
-\def\caption@listentry#1[#2]#3{%
+ \caption@teststar\caption@listentry\@firstoftwo\@secondoftwo}
+\newcommand*\caption@listentry[1]{%
+ \@ifnextchar[%]
+ {\caption@listentry@{#1}}%
+ {\caption@@listentry{#1}}}
+\def\caption@listentry@#1[#2]{%
+ \caption@@@listentry{#1}{#2}{\caption@refstepcounter@}}
+\newcommand*\caption@@listentry[1]{%
+ \caption@iftype
+ {\caption@@@listentry{#1}{\@captype}{\caption@refstepcounter}}%
+ {\caption@OutsideFloat\captionlistentry
+ \@gobble}}
+\newcommand*\caption@@@listentry[4]{%
\@bsphack
- #1{\caption@gettitle{#3}}%
- {\caption@refstepcounter{#2}%
- \caption@makecurrent{#2}{#3}}%
- \caption@addcontentsline{#2}{#3}%
+ #1{\caption@gettitle{#4}}%
+ {#3{#2}\caption@makecurrent{#2}{#4}}%
+ \caption@addcontentsline{#2}{#4}%
\@esphack}
+\newcommand*\captiontext{%
+ \caption@iftype
+ {\caption@text\@captype}%
+ {\caption@OutsideFloat\captiontext
+ \caption@withoptargs\@gobbletwo}}
+\newcommand*\caption@text[1]{%
+ \caption@teststar{\caption@@text{#1}}\caption@@@make\caption@@make}
+\newcommand*\caption@@text[2]{%
+ \kernel@ifnextchar[%]
+ {\caption@@@text{#1}#2\@iden}%
+ {\caption@@@text{#1}#2\@gobble[0]}}
+\long\def\caption@@@text#1#2#3[#4]#5{%
+ \begingroup
+ #3{\csname c@#1\endcsname #4\relax}%
+ #2{\caption@fnum{#1}}{#5}%
+ \endgroup}
+\newenvironment{captiongroup}{\setcaptiontype}{}
+\newenvironment{captiongroup*}{\setcaptiontype*}{}
+\newcommand*\caption@minipage{%
+ \@testopt\caption@iminipage b}
+\def\caption@iminipage[#1]{%
+ \caption@withoptargs{\caption@iiminipage{#1}}}
+\newcommand*\caption@iiminipage[3]{%
+ \let\caption@endminipage@hook\@empty
+ \if#1B%
+ \minipage[b]#2{#3}%
+ \def\caption@endminipage@hook{\vspace{0pt}}%
+ \else\if#1T%
+ \minipage[t]#2{#3}%
+ \vspace{0pt}%
+ \else
+ \minipage[#1]#2{#3}%
+ \fi\fi
+ \@floatboxreset
+ \setcaptiontype}
+\newcommand*\caption@endminipage{%
+ \caption@endminipage@hook
+ \endminipage}
+\newenvironment{captionblock}{\caption@minipage}{\caption@endminipage}
\newcommand*\captionbox{%
\caption@withoptargs{\caption@ibox\@gobble}}
\newcommand\caption@ibox[3]{%
@@ -420,56 +487,64 @@
\long\def\caption@iiibox#1{%
\caption@iiiibox{#1}\vbox\vtop}
\long\def\caption@iiiibox#1#2#3#4#5[#6][#7]#8{%
- \begingroup
- #1*% set \caption@position
- \caption@iftop{%
- \endgroup
- \parbox[t]{#6}{%
- #1\relax
- \caption@setposition t%
- #2{\caption#4{#5}}%
- \captionbox@hrule
- \csname caption@justification@#7\endcsname
- #8}%
- }{%
- \endgroup
- \parbox[b]{#6}{%
- #1\relax
- \caption@setposition b%
- \csname caption@justification@#7\endcsname
- #8%
- \captionbox@hrule
- #3{\caption#4{#5}}}%
- }}
+ \caption@checkdecl{justification}{#7}{%
+ \begingroup
+ #1*% set \caption@position
+ \caption@iftop{%
+ \endgroup
+ \parbox[t]{#6}{%
+ #1\relax
+ \caption@setposition t%
+ #2{\caption#4{#5}}%
+ \captionbox@hrule
+ \csname caption@justification@#7\endcsname
+ #8}%
+ }{%
+ \endgroup
+ \parbox[b]{#6}{%
+ #1\relax
+ \caption@setposition b%
+ \csname caption@justification@#7\endcsname
+ #8%
+ \captionbox@hrule
+ #3{\caption#4{#5}}}%
+ }}}
\newcommand*\captionbox@innerpos@default{c}
\newcommand*\captionbox@hrule{\hrule\@height\z@\relax}
\providecommand*\caption@justification@c{\centering}
\providecommand*\caption@justification@l{\raggedright}
\providecommand*\caption@justification@r{\raggedleft}
\providecommand*\caption@justification@s{}
-\def\continuedfloat{%
- \caption@iftype
- {\caption@continuedfloat\@captype}%
- {\caption@Error{\noexpand\continuedfloat outside float}}}
-\newcommand*\caption@continuedfloat[1]{%
- \@ifstar
- {\caption@@refstepcounter\@captype
- \caption@@continuedfloat{#1}}%
- {\caption@continued@float{#1}}}
-\newcommand*\caption@continued@float[1]{%
- \edef\caption@tempa{#1}%
- \ifx\caption@tempa\caption@CFtype
- \caption@@continuedfloat{#1}%
+\newcounter{continuedfloat}
+\let\c@ContinuedFloat\c@continuedfloat % defined for compatibility reasons
+\def\thecontinuedfloat{\theContinuedFloat}
+\let\theContinuedFloat\@empty % defined for compatibility reasons
+\newcommand*\continuedfloat@captype{??}
+\newcommand*\caption@reset@continuedfloat[1]{%
+ \xdef\continuedfloat@captype{#1}%
+ \@stpelt{continuedfloat}}
+\newcommand*\caption@set@continuedfloat{%
+ \ifx\@captype\continuedfloat@captype
+ \stepcounter{continuedfloat}%
+ \expandafter\@firstoftwo
\else
- \caption@Error{Continued `#1' after `\caption@CFtype'}%
+ \caption@Error{Continued `\@captype' after `\continuedfloat@captype'}%
+ \expandafter\@secondoftwo
\fi}
+\def\continuedfloat{%
+ \caption@teststar\caption@continuedfloat\@firstoftwo\@secondoftwo}
+\newcommand*\caption@continuedfloat[1]{%
+ \caption@iftype
+ {#1{\caption@@refstepcounter\@captype}{}%
+ \caption@@continuedfloat\@captype}%
+ {\caption@OutsideFloat\continuedfloat}}
\newcommand*\caption@@continuedfloat{%
- \caption@setflag1% continued float
- \caption@@@continuedfloat}
-\newcommand*\caption@@@continuedfloat{%
- \stepcounter{continuedfloat}%
- \caption@@@@continuedfloat}
-\newcommand*\caption@@@@continuedfloat[1]{%
+ \caption@clrflags
+ \caption@set@continuedfloat
+ {\caption@setcontinued
+ \caption@@@continuedfloat}%
+ {\@gobble}}
+\newcommand*\caption@@@continuedfloat[1]{%
\caption@setoptions{ContinuedFloat}% for compatibility reasons
\caption@setoptions{continuedfloat}%
\caption@setoptions{continued#1}%
@@ -477,65 +552,78 @@
\@ifundefined{theH#1}{}{%
\expandafter\l@addto@macro\csname theH#1\endcsname{%
\@alph\c@continuedfloat}}%
- \let\caption@@@@continuedfloat\@gobble}
-\newcommand*\caption@CFtype{??}
-\newcounter{continuedfloat}
-\let\c@ContinuedFloat\c@continuedfloat % defined for compatibility reasons
-\def\thecontinuedfloat{\theContinuedFloat}
-\let\theContinuedFloat\@empty % defined for compatibility reasons
-\newcommand*\caption@reset@continuedfloat[1]{%
- \xdef\caption@CFtype{#1}%
- \@stpelt{continuedfloat}}
+ \let\caption@@@continuedfloat\@gobble}
\def\ContinuedFloat{\continuedfloat} % defined for compatibility reasons
\def\caption@ContinuedFloat{%
- \let\caption@reset@continuedfloat\@gobble
- \caption@@@continuedfloat}
-\newcommand*\caption@refstepcounter[1]{%
- \@ifundefined{c@#1}%
- {\caption@Error{No float type '#1' defined}}%
- {\caption@ref@stepcounter{#1}%
- \caption@fixposition % TODO: Make this independant on the "position" setting
- \caption@iftop\caption@setflag\caption@clrflag2% caption
- \caption@clrflag4% subcaption
- \@nameuse{donemaincaptiontrue}}}
-\newcommand*\caption@ref@stepcounter{%
- \caption@ifflag1{% continued float
- \let\caption@tempa\caption@@refcounter
- \caption@clrflag1% continued float
- }{%
- \let\caption@tempa\caption@@refstepcounter
- \caption@ifflag2{}{% caption
- \caption@ifflag4{% subcaption
- % Counter was already incremented by content, so we suppress \stepcounter{#1} here
- \let\caption@tempa\caption@@refcounter
- }{}%
- }%
- }%
- \caption@tempa}
+ \caption@set@continuedfloat\caption@@@continuedfloat\@gobble}
+\providecommand*\nextfloat{%
+ \caption@teststar\caption@nextfloat\@firstoftwo\@secondoftwo}
+\newcommand*\caption@nextfloat[1]{%
+ \caption@iftype
+ {\caption@@nextfloat\@captype
+ #1{}{\caption@reset@currentlabel\caption@start}}%
+ {\caption@OutsideFloat\nextfloat}}
+\newcommand*\caption@@nextfloat[1]{%
+ \flushsubcaptionlistentries
+ \caption@clrflags
+ \ifx\caption@@@continuedfloat\@gobble
+ % next continued float
+ \caption@set@continuedfloat\caption@setcontinued\relax
+ \fi}
+\newcommand*\caption@refstepcounter{%
+ \@nameuse{donemaincaptiontrue}% Support of the memoir document class
+ \caption@ifrefstepcounter\caption@@refstepcounter\caption@@refcounter}
+\newcommand*\caption@@refstepcounter[1]{%
+ \caption@prepare@stepcounter{#1}%
+ \caption@refstepcounter@{#1}}
\newcommand*\caption@@refcounter[1]{%
\let\caption@stepcounter@ORI\stepcounter
\def\stepcounter##1{%
\edef\caption@tempa{#1}%
\edef\caption@tempb{##1}%
- \ifx\caption@tempa\caption@tempb \else
+ \ifx\caption@tempa\caption@tempb
+ % Suppress incrementation of counter
+ \else
\caption@stepcounter@ORI{##1}%
\fi}%
- \caption@@@refstepcounter{#1}%
- \let\stepcounter\caption@stepcounter@ORI}
-\newcommand*\caption@@refstepcounter[1]{%
- \caption@prepare@stepcounter{#1}{ref}%
- \caption@@@refstepcounter{#1}}
+ \caption@refstepcounter@{#1}%
+ \let\stepcounter\caption@stepcounter@ORI}
+\newcommand*\caption@refstepcounter@{\refstepcounter}
+\newcommand*\caption@stepcounter{%
+ \caption@ifstepcounter\caption@@stepcounter\caption@@counter}
\newcommand*\caption@@stepcounter[1]{%
- \caption@prepare@stepcounter{#1}{}%
- \caption@@@stepcounter{#1}}
-\newcommand*\caption@prepare@stepcounter[2]{%
- \caption@addsubcontentslines{#2stepcounter}%
- \caption@reset@continuedfloat{#1}}
-\newcommand*\caption@@@refstepcounter{\refstepcounter}
-\newcommand*\caption@@@stepcounter{\stepcounter}
+ \caption@prepare@stepcounter{#1}%
+ \caption@stepcounter@{#1}}
+\newcommand*\caption@@counter[1]{} % nothing to do
+\newcommand*\caption@stepcounter@{\stepcounter}
+\newcommand*\caption@prepare@stepcounter{%
+ \caption@addsubcontentslines\relax
+ \caption@reset@continuedfloat}
+\newcommand*\caption@ifrefstepcounter{%
+ \caption@ifcounter
+ {\caption@ifcaption}%
+ {\caption@ifsubcaption@below{\caption@iftop\@secondoftwo\@firstoftwo}{\@secondoftwo}}%
+ {\caption@setcaption}}
+\newcommand*\caption@ifstepcounter{%
+ \caption@ifcounter
+ {\caption@ifcaption\caption@ifsubcaption@above\@secondoftwo}%
+ {\caption@iftop}%
+ {\caption@setsubcaption}}
+\newcommand*\caption@ifcounter[3]{%
+ \caption@ifflags
+ {#1%
+ {#2\caption@Warning\@gobble{Ambiguous sub-caption(s), use \string\nextfloat}%
+ \caption@clrflags
+ \let\caption@next\@firstoftwo}%
+ {\let\caption@next\@secondoftwo}}%
+ {\let\caption@next\@firstoftwo}%
+ #3%
+ \caption@next}
\@ifundefined{kernel@ifnextchar}{\let\kernel@ifnextchar\@ifnextchar}{}
\newcommand\caption@dblarg[1]{%
- \kernel@ifnextchar[{\caption@ydblarg{#1}}{\caption@xdblarg{#1}}}
+ \kernel@ifnextchar[%]
+ {\caption@ydblarg{#1}}%
+ {\caption@xdblarg{#1}}}
\newcommand\caption@xdblarg[2]{%
#1[{#2\relax}]{#2}}
\long\def\caption@ydblarg#1[#2]#3{%
@@ -551,11 +639,6 @@
\caption@ifempty{#3}{}}
\newcommand*\caption@end{%
\endgroup}
-\newcommand*\caption@setfnum[1]{%
- \@ifundefined{caption@fnum@#1}%
- {\expandafter\let\csname caption@fnum@#1\expandafter\endcsname\csname fnum@#1\endcsname
- \@namedef{fnum@#1}{\caption@fnum{#1}}}%
- {}}
\newcommand*\caption@normalsize{%
\caption@font@normal\@unused}
\let\caption@setfloatcapt\@firstofone
@@ -572,18 +655,11 @@
\newcommand*\caption@subtypehook{%
\ifx\caption\caption@subcaption \else
\caption@warmup
- \caption@ifflag2{}{% caption
- \let\caption@add@contentsline\caption@addsubcontentsline
- \let\caption@addsubcontentslines\@gobble
- \caption@ifflag4{}{% subcaption
- \caption@ifflag1{% continued float
- \caption@clrflag1%
- }{%
- \caption@@stepcounter\@captype
- }%
- \caption@setflag4% subcaption
- }%
- }%
+ \caption@stepcounter\@captype
+ \caption@ifcaption
+ {}%
+ {\let\caption@add@contentsline\caption@addsubcontentsline
+ \let\caption@addsubcontentslines\@gobble}%
\c@continuedfloat=0\relax
\let\caption@setfloatcapt\@firstofone
\let\caption@chkfloat\@gobbletwo
@@ -604,7 +680,8 @@
\let\@caption\caption@@caption
\let\phantomcaption\caption@subphantom
\let\captionlistentry\caption@sublistentry
- \let\caption@refstepcounter\caption@@@refstepcounter
+ \let\captiontext\caption@subtext
+ \let\caption@refstepcounter\caption@refstepcounter@
\if@subfloatrow
\caption@Debug{Keeping \string\@makecaption}%
\else
@@ -632,7 +709,9 @@
\newcommand*\caption@sublistentry{%
\caption@teststar\@subcaptionlistentry\@firstoftwo\@secondoftwo}
\newcommand*\@subcaptionlistentry[1]{%
- \@testopt{\caption@listentry{#1}}\@subcaptype}
+ \@testopt{\caption@listentry{#1}}{\@subcaptype}}
+\newcommand*\caption@subtext{%
+ \caption@text\@subcaptype}
\newcommand*\caption@clearsubcontentslines{%
\global\let\caption@subcontentslines\@empty}
\caption@clearsubcontentslines
@@ -651,24 +730,13 @@
\noexpand\caption@@@addcontentsline{#1}{#2}{#3}{#4}}}%
\@tempa}
\newcommand*\flushsubcaptionlistentries{%
- \caption@addsubcontentslines{user}}
+ \caption@addsubcontentslines\relax}
\renewcommand*\caption@addsubcontentslines[1]{%
- \caption@Debug{\string\flushsubcaptionlistentries (#1)}%
+ \caption@Debug{\string\flushsubcaptionlistentries}%
\begingroup
\caption@subcontentslines
\endgroup
\caption@clearsubcontentslines}
-\AtBeginDocument{%
- \caption@ifdefined\chapter{%
- \let\caption@chapter@ORI\chapter
- \def\chapter{%
- \caption@addsubcontentslines{chapter}\caption@chapter@ORI}}{}%
- \caption@ifdefined\appendix{%
- \let\caption@appendix@ORI\appendix
- \def\appendix{%
- \caption@addsubcontentslines{appendix}\caption@appendix@ORI}}{}%
- \caption@addsubcontentslines{AtEndDocument}%
-}
\caption@IfBabelArabi{%
\let\@makecaption\caption@makecaption
\def\fnum@figure{\figurename\nobreakspace\thefigure}%
@@ -719,7 +787,7 @@
}{\@secondoftwo}}
\@onlypreamble\caption@If@Package@Loaded
\newcommand*\caption@clearmargin{%
- \setcaptionmargin\z@
+ \caption@setmargin\z@
\let\caption@minmargin\@undefined}
\caption@setbool{needfreeze}{0}
\caption@AtBeginDocument*{%
@@ -731,22 +799,21 @@
\newcommand*\caption@freeze{%
\let\caption@frozen@continuedfloat\continuedfloat
\def\continuedfloat{%
- \caption@@freeze{\caption@@@@continuedfloat\@captype}%
+ \caption@@freeze{\caption@@@continuedfloat\@captype}%
\caption@frozen@continuedfloat}%
+ \let\caption@frozen@nextfloat\nextfloat
+ \def\nextfloat{\caption@freeze@error}%
\let\caption@frozen@setup\caption@setup
\def\caption@setup##1{%
\caption@@freeze{\caption@setup{##1}}%
\caption@frozen@setup{##1}}%
\let\caption@frozen@caption\caption
\def\caption{%
- \def\caption{%
- \caption@Error{%
- Only one \noexpand\caption can be placed in this environment}%
- \caption@gobble}%
+ \def\caption{\caption@freeze@error\caption@gobble}%
\@ifstar
- {\caption@SC@caption*}%
- {\let\@currentlabel\caption@SClabel
- \caption@withoptargs\caption@SC@caption}}%
+ {\caption@SC@caption*}%
+ {\let\@currentlabel\caption@SClabel
+ \caption@withoptargs\caption@SC@caption}}%
\long\def\caption@SC@caption##1##2{%
\caption@@freeze{\caption##1{##2}}%
\ignorespaces}%
@@ -769,11 +836,14 @@
\g@addto@macro\caption@frozen@content}%
\def\caption@warmup{%
\let\continuedfloat\caption@frozen@continuedfloat
+ \let\nextfloat\caption@frozen@nextfloat
\let\caption@setup\caption@frozen@setup
\let\caption\caption@frozen@caption
\let\label\caption@frozen@label}}%
+ \newcommand*\caption@freeze@error{%
+ \caption@Error{Only one \noexpand\caption can be placed in this environment}}
\newcommand*\caption@prepare@defrost{%
- \let\caption@settype\caption@set@type}
+ \let\caption@settype\caption@@settype}
\newcommand*\caption@defrost{%
\ifx\caption@frozen@caption\@undefined
\caption@frozen@content
@@ -789,7 +859,8 @@
\newdimen\caption@adjustwidth@linewidth
\providecommand*\caption@set@adjustwidth{%
\caption@adjustwidth@hsize\hsize
- \caption@adjustwidth@linewidth\linewidth}%
+ \caption@adjustwidth@linewidth\linewidth
+ \l@addto@macro\caption@before@parboxrestore\caption@test@adjustwidth}%
\providecommand*\caption@patch@changepage[1]{%
\expandafter\let\csname caption@#1\expandafter\endcsname\csname #1\endcsname
\expandafter\renewcommand\csname #1\endcsname[2]{%
@@ -804,7 +875,6 @@
\hsize=\linewidth
\fi
\fi}%
- \AtBeginCaption{\caption@test@adjustwidth}%
}{}%
\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
\caption@ifdefined\chkfloat@addcontentsline{%
@@ -835,13 +905,13 @@
\caption@float@setname{#1}%
\caption@freezeHref % will be defrosted in \float@makebox
\caption@ORI@float@setevery{#1}}%
- \caption@AtBeginDocument{\caption@ifcompatibility{}{%
+ \caption@AtBeginDocument{%
\caption@ifdefined\HyOrg@float@makebox
{\let\caption@ORI@float@makebox\HyOrg@float@makebox}%
{\let\caption@ORI@float@makebox\float@makebox}%
\renewcommand\float@makebox[1]{%
\caption@ORI@float@makebox{#1\relax \caption@defrostHref}}%
- }}%
+ }%
\newcommand*\caption@float@setname[1]{%
\expandafter\ifx\csname #1name\endcsname\relax
\expandafter\let\csname #1name\expandafter\endcsname\csname fname@#1\endcsname
@@ -883,7 +953,6 @@
\newcommand*\caption@floatflt[1]{%
\caption@settype{#1}%
\caption@clearmargin
- \caption@setparboxrestore{full}%
\caption@setoptions{floating#1}}%
}{}
\caption@IfPackageLoaded{fltpage}[1998/10/29 v.0.3]{%
@@ -952,8 +1021,8 @@
Hyperref support is turned off\MessageBreak
because hyperref has stopped early}%
}{%
- \g@addto@macro\caption@prepareslc{\measuring@true}%
- \renewcommand*\caption@@@refstepcounter{\H@refstepcounter}%
+ \AtCaptionSingleLineCheck{\measuring@true}%
+ \renewcommand*\caption@refstepcounter@{\H@refstepcounter}%
\renewcommand*\caption@makecurrent[2]{%
\caption@makecurrentHref{#1}%
\caption@Debug{hyperref current=\@currentHref}%
@@ -969,7 +1038,7 @@
\expandafter\hyper@@anchor\expandafter{\@currentHref}{\relax}%
}#1%
\fi}%
- \g@addto@macro\caption@prepareslc{\let\caption@makeanchor\@firstofone}%
+ \AtCaptionSingleLineCheck{\let\caption@makeanchor\@firstofone}%
\newif\if@capstart
\def\caption@start{\caption@ifhypcap\caption@start@\relax}%
\def\caption@start@{%
@@ -1034,7 +1103,6 @@
}}{}
\caption@IfPackageLoaded{hypcap}{% v1.0
\ifx\caption@start\relax \else % hyperref hasn't stopped early
- \let\caption@ORI@capstart\capstart % save for compatibility mode
\caption@ifundefined\capstarttrue % check for v1.10 of hypcap package
{\def\capstart{\caption@start@}}%
{\def\capstart{\ifcapstart\caption@start@\fi}}%
@@ -1047,7 +1115,7 @@
\caption@setbool{lst@Init}{0}%
\lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}%
\let\caption@ORI@lst@MakeCaption\lst@MakeCaption
- \def\lst@MakeCaption#1{% #1 is `t' or `b'
+ \renewcommand*\lst@MakeCaption[1]{% #1 is `t' or `b'
\begingroup
\caption@iflst@Init{}{%
\edef\caption@lst@leftskip{\noexpand\hskip-\the\@totalleftmargin\noexpand\relax}%
@@ -1060,6 +1128,12 @@
\caption@setup{rule=0}%
\caption@setoptions{lstlisting}%
\caption@setautoposition{#1}%
+ \ifx\lst@@caption\@empty \else
+ \let\caption@ORI@addcontentsline\addcontentsline
+ \renewcommand*\addcontentsline[3]{%
+ \let\addcontentsline\caption@ORI@addcontentsline
+ \caption@addcontentsline{lstlisting}{\lst@@caption}}%
+ \fi
\caption@begin{lstlisting}%
\caption@ORI@lst@MakeCaption{#1}%
\caption@end
@@ -1096,7 +1170,7 @@
%% \let\Hy@LT@currentHlabel\@currentHlabel
%% \let\@currentHlabel\Hy@LT@currentHlabel
\def\continuedfloat{\noalign{%
- \caption@Error{\noexpand\continuedfloat outside float}}}%
+ \caption@OutsideFloat\continuedfloat}}%
\let\bicaption\LT@bicaption
}%
\def\LT@capti@n{%
@@ -1109,7 +1183,7 @@
\caption@LT@setup
\caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
\caption@startrue#1\caption@starfalse
- \caption@prepare@stepcounter\LTcaptype{LT}%
+ \caption@prepare@stepcounter\LTcaptype
\caption@begin\LTcaptype
\caption@normalsize
\vskip-\ht\strutbox
@@ -1127,7 +1201,7 @@
\newcommand*\caption@LT@settype[1]{%
\caption@settype*{#1}%
\ifdim\LTcapwidth=4in \else
- \setcaptionwidth\LTcapwidth
+ \caption@setwidth\LTcapwidth
\fi
\caption@setoptions{longtable}%
\caption@setoptions{@longtable}}%
@@ -1160,15 +1234,16 @@
\let\@makecaption\caption@@make
\caption@setautoposition b%
\caption@settype{#1}%
- \caption@clearmargin
- \caption@setparboxrestore{full}}%
+ \caption@clearmargin}%
\newcommand\caption@wincaption[1]{%
\ifdim\picwd=\z@
\let\caption@makecurrent\@gobbletwo
\let\caption@@start\relax
\caption@prepareslc
\else
- \caption@setflag1%
+ % don't increment the figure or table counter again
+ \caption@clrflags
+ \caption@setcontinued
\fi
\edef\@tempa{\expandafter\noexpand\@car#1\@nil}%
\if\@tempa*%
@@ -1197,8 +1272,7 @@
\long\def\caption[##1]##2{%
\caption@freezeHref % will be defrosted in \ivparpic
\caption@settype\@piccaptype
- \caption@clearmargin
- \caption@setparboxrestore{full}%
+ \caption@clearmargin
\caption@setoptions{parpic}%
\caption@setautoposition b%
\expandafter\expandafter\expandafter\caption@ORI
@@ -1226,8 +1300,8 @@
\caption@teststar\caption@of{\rotcaption*}\rotcaption}%
\long\def\@makerotcaption#1#2{%
\rotatebox{90}{%
- \ifdim\captionwidth=\z@
- \setcaptionwidth{.8\vsize}%
+ \ifdim\caption@width=\z@
+ \caption@setwidth{.8\vsize}%
\l@addto@macro\caption@singleline{%
\caption@setup{parbox=none}}%
\fi
@@ -1361,7 +1435,7 @@
\@nameuse{fst@#1}%
\def\WF@floatstyhook{\let\@currbox\WF@box
\global\setbox\WF@box\float@makebox{\wd\WF@box}}}%
- \@ifnextchar[\WF@wr{\WF@wr[]}}
+ \@testopt\WF@wr{}}
\def\WF@rapt[#1]#2{% final two args: #1 = overhang, #2 = width,
\gdef\WF@ovh{#1}% hold overhang for later, when \width is known
\global\setbox\WF@box\vtop\bgroup \setlength\hsize{#2}%
@@ -1374,9 +1448,25 @@
\@ifundefined{fst@#1}{}{\@float@setevery{#1}}%
\caption@settype{#1}%
\caption@clearmargin
-%%% \caption@setoptions{wrap}%
+%%% \caption@setoptions{wrap}%
\caption@setoptions{wrap#1}}%
}{}
+\newcommand*\caption@checkcounter[1]{%
+ \caption@check{\the#1}{\@nameuse{the#1}}}
+\newcommand*\caption@check[3]{%
+ \edef\caption@tempa{#2}%
+ \edef\caption@tempb{#3}%
+ \ifx\caption@tempa\caption@tempb
+ \caption@Info{\string#1 = \caption@tempa}%
+ \else
+ \caption@Error{\string#1 = \caption@tempa\space <> \caption@tempb}%
+ \fi}
+\newcommand*\caption@checkref[2]{%
+ \@ifundefined{r@#1}{}%
+ {\expandafter\expandafter\expandafter
+ \caption@@checkref\csname r@#1\endcsname\@nil{#1}{#2}}}
+\def\caption@@checkref#1#2\@nil#3#4{%
+ \caption@check{\ref{#3}}{#1}{#4}}
\caption@endtitles@code
\let\caption@endtitles@code\@undefined
\let\AfterCaptionPackage\@firstofone