diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/caption/caption.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/caption/caption.sty | 186 |
1 files changed, 104 insertions, 82 deletions
diff --git a/Master/texmf-dist/tex/latex/caption/caption.sty b/Master/texmf-dist/tex/latex/caption/caption.sty index 75bb68422f0..0ea37e2194e 100644 --- a/Master/texmf-dist/tex/latex/caption/caption.sty +++ b/Master/texmf-dist/tex/latex/caption/caption.sty @@ -29,7 +29,7 @@ %% caption-eng.tex, and caption-rus.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2011/08/06 v3.2 Customizing captions (AR)] +\ProvidesPackage{caption}[2011/08/18 v3.2b Customizing captions (AR)] \RequirePackage{caption3}[2011/08/01] % needs v1.3 or newer \caption@ifbool{documentclass}{}{% \caption@WarningNoLine{% @@ -69,7 +69,7 @@ \newcommand*\caption@SetName[2]{% \caption@setname{#1}{#2}% \begingroup - \@ifundefined{languagename}{}{% + \caption@ifundefined\languagename{}{% \@ifundefined{captions\languagename}{}{% \expandafter\g@addto@macro\csname captions\languagename\endcsname {\caption@setname{#1}{#2}}}}% @@ -78,15 +78,15 @@ \caption@AtBeginDocument{\let\caption@SetName\caption@setname} \newcommand*\caption@DeclareWithinOption[1]{% \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}% - \DeclareCaptionOption{#1without}{\caption@Within{#1}{none}}} + \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}} \caption@DeclareWithinOption{figure} \caption@DeclareWithinOption{table} \DeclareCaptionOption{within}{% - \@ifundefined{c@figure}{}{\caption@Within{figure}{#1}}% - \@ifundefined{c@table}{}{\caption@Within{table}{#1}}% + \caption@ifundefined\c@figure{}{\caption@Within{figure}{#1}}% + \caption@ifundefined\c@table{}{\caption@Within{table}{#1}}% \caption@For{typelist}{\caption@Within{##1}{#1}}% \def\caption@within@default{#1}} -\DeclareCaptionOption{without}{\KV@caption@within{none}} +\DeclareCaptionOptionNoValue{without}{\KV@caption@within{none}} \newcommand*\caption@Within[1]{\def\caption@type{#1}\KV@caption@DCT@within} \DeclareCaptionOption*{config}[caption]{% \InputIfFileExists{#1.cfg}% @@ -199,14 +199,14 @@ \caption@KOMA@@setcapindent{#1}\caption@setcapindent} \newcommand*\caption@setcapindent{% \captionsetup{indent=\ifdim\cap@indent<\z@\z@\else\cap@indent\fi}} - \@ifundefined{cap@indent}{}{\caption@setcapindent} + \caption@ifundefined\cap@indent{}{\caption@setcapindent} \expandafter\let\expandafter\caption@KOMA@setcapwidth \csname\string\setcapwidth\endcsname \@namedef{\string\setcapwidth}[#1]#2{% \caption@KOMA@setcapwidth[#1]{#2}\caption@setcapwidth{#1}} \newcommand*\caption@setcapwidth[1]{% \ifx\\#1\\\else - \@ifundefined{cap@margin}{}{% + \caption@ifundefined\cap@margin{}{% \def\@tempa{captionbeside}% \ifx\@tempa\@currenvir\else\caption@Warning{% Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}% @@ -244,7 +244,7 @@ \caption@setcapmargin \fi } -\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}% +\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}} \caption@ProcessOptions*{caption} \def\caption@caption{% \caption@iftype @@ -252,9 +252,10 @@ \caption@star {\caption@refstepcounter\@captype}% {\caption@dblarg{\@caption\@captype}}}% - {\caption@Error{\noexpand\caption outside float}}}% + {\caption@Error{\noexpand\caption outside float}% + \caption@withoptargs\@gobbletwo}} \newcommand*\caption@star[2]{% - \@ifstar{\global\caption@startrue#2[]}{#1#2}}% + \@ifstar{\global\caption@startrue#2[]}{#1#2}} \long\def\caption@@caption#1[#2]#3{% \ifcaption@star \else \caption@prepareanchor{#1}{#2}% @@ -273,7 +274,7 @@ \@makecaption{\csname fnum@#1\endcsname}% {\ignorespaces\caption@makeanchor{#3}}\par \caption@if@minipage\@minipagetrue\@minipagefalse}% - \caption@end}% + \caption@end} \newcommand*\caption@prepareanchor[2]{% \caption@makecurrent{#1}{#2}% \caption@ifhypcap\caption@@start{}} @@ -591,7 +592,7 @@ Incompatible package detected (regarding \string\@caption).\MessageBreak \string\@caption\space=\space\meaning\@caption}% \caption@setbool{incompatible}{1}}% - \@ifundefined{caption@ifcompatibility}% + \caption@ifundefined\caption@ifcompatibility {\let\caption@ifcompatibility\caption@ifincompatible \let\caption@tempa\caption@WarningNoLine}% {\let\caption@tempa\@gobble}% suppress warning @@ -605,11 +606,11 @@ \caption@Error{Not available in compatibility mode}}% \caption@AtBeginDocument*{% \let\caption@start\relax - \@ifundefined{caption@ORI@capstart}{}{% + \caption@ifundefined\caption@ORI@capstart{}{% \caption@Debug{% Restore hypcap definition of \string\capstart\@gobble}% \let\capstart\caption@ORI@capstart}% - \@ifundefined{caption@ORI@float@makebox}{}{% + \caption@ifundefined\caption@ORI@float@makebox{}{% \caption@Debug{% Restore hyperref redefinition of \string\float@makebox\@gobble}% \let\float@makebox\caption@ORI@float@makebox}% @@ -640,18 +641,22 @@ \caption@AtBeginDocument{% \DeclareCaptionOption{type}{\setcaptiontype{#1}}% \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}% - \DeclareCaptionOption{subtype}[sub\@captype]{\caption@setsubtype{#1}}% - \DeclareCaptionOption{subtype*}[sub\@captype]{\caption@setsubtype*{#1}}% + \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}% + \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}% } \newcommand\setcaptiontype{% \caption@boxrestore@mini \caption@settype} +\newcommand\setcaptionsubtype{% + \caption@iftype + \caption@setsubtype + {\caption@Error{\noexpand\setcaptionsubtype outside float}}}% +\newcommand\caption@setsubtype{% + \@ifstar + {\caption@@settype{sub}*{sub\@captype}}% + {\caption@@settype{sub}{sub\@captype}}}% \newcommand*\caption@settype{% \caption@@settype{}} -\newcommand*\caption@setsubtype{% - \caption@iftype - {\caption@@settype{sub}}% - {\caption@Error{Option `subtype=' outside float}}}% \newcommand*\caption@@settype[1]{% \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo} \newcommand*\caption@@@settype[3]{% @@ -676,14 +681,14 @@ \let\caption@ifrefstepcounter\@secondoftwo #2{}{% \let\@currentlabel\caption@undefinedlabel - \ifx\caption@ORI@label\@undefined - \let\caption@ORI@label\label + \ifx\caption@x@label\@undefined + \let\caption@x@label\label \let\label\caption@xlabel \fi \caption@start}} \newcommand*\caption@typehook{} \newcommand*\caption@iftype{% - \@ifundefined{@captype}{\let\@captype\@undefined\@secondoftwo}\@firstoftwo} + \caption@ifundefined\@captype\@secondoftwo\@firstoftwo} \begingroup\expandafter\expandafter\expandafter\endgroup \expandafter\ifx\csname currentgrouplevel\endcsname\relax \caption@Debug{TeX engine: TeX} @@ -692,7 +697,7 @@ \caption@Debug{TeX engine: e-TeX} \newcommand*\caption@checkgrouplevel[2]{% \@ifundefined{#1caption@grouplevel}{% - \@ifundefined{caption@grouplevel}{\let\caption@grouplevel\z@}{}% + \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}% \ifnum\currentgrouplevel>\caption@grouplevel\relax \expandafter\edef\csname #1caption@grouplevel\endcsname{% \the\currentgrouplevel}% @@ -710,7 +715,7 @@ \newcommand*\caption@xlabel[1]{% \caption@@xlabel \def\caption@labelname{#1}% - \caption@ORI@label{#1}} + \caption@x@label{#1}} \newcommand*\caption@@xlabel{% \global\let\caption@@xlabel\@empty \@bsphack @@ -733,7 +738,7 @@ \caption@addcontentsline{#2}{#3}% \@esphack} \newcommand*\captionbox{% - \let\captionbox@type\@empty + \let\captionbox@settype\@gobble \caption@withoptargs\caption@box} \newcommand\caption@box[2]{% \@testopt{\caption@ibox{#1}{#2}}{\wd\@tempboxa}} @@ -742,11 +747,12 @@ \long\def\caption@iibox#1#2#3[#4]#5{% \setbox\@tempboxa\hbox{#5}% \begingroup - \expandafter\captionsetup\expandafter{\captionbox@type*}% set \caption@position + \captionbox@settype*% set \caption@position \caption@iftop{% \endgroup \parbox[t]{#3}{% - \expandafter\captionsetup\expandafter{\captionbox@type,position=t}% + \captionbox@settype\relax + \caption@setposition t% \vbox{\caption#1{#2}}% \captionbox@hrule \csname caption@hj@#4\endcsname @@ -754,7 +760,8 @@ }{% \endgroup \parbox[b]{#3}{% - \expandafter\captionsetup\expandafter{\captionbox@type,position=b}% + \captionbox@settype\relax + \caption@setposition b% \csname caption@hj@#4\endcsname \unhbox\@tempboxa \captionbox@hrule @@ -766,7 +773,6 @@ \providecommand*\caption@hj@l{\raggedright} \providecommand*\caption@hj@r{\raggedleft} \providecommand*\caption@hj@s{} -\DeclareCaptionOption{*}[]{} \def\ContinuedFloat{% \@ifnextchar[\@Continued@Float\@ContinuedFloat} \def\@Continued@Float[#1]{\addtocounter{#1}\m@ne} @@ -817,7 +823,7 @@ \let\caption@ifrefstepcounter\@firstoftwo}} \newcommand*\caption@@refstepcounter{\refstepcounter} \let\caption@ifrefstepcounter\@secondoftwo -\@ifundefined{kernel@ifnextchar}% +\caption@ifundefined\kernel@ifnextchar {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% \newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}% @@ -877,7 +883,7 @@ \let\caption@freezeHref\relax \let\caption@defrostHref\relax \newcommand\caption@gettitle[1]{% - \@ifundefined{NR@gettitle}% + \caption@ifundefined\NR@gettitle {\def\@currentlabelname{#1}}% {\NR@gettitle{#1}}} \def\caption@DeclareSubType sub#1\@nil{% @@ -887,11 +893,12 @@ \@onlypreamble\caption@DeclareSubType \caption@For*{subtypelist}{\caption@DeclareSubType sub#1\@nil} \caption@AtBeginDocument*{% - \@ifundefined{sf@counterlist}{}{% + \caption@ifundefined\sf@counterlist{}{% \@for\sf@temp:=\sf@counterlist\do{% \expandafter\caption@DeclareSubType\sf@temp\@nil}}} \newcommand*\caption@subtypehook{% \ifx\caption\caption@subcaption \else + \caption@warmup \caption@ifrefstepcounter{}{% % no \caption or \subcaption in this (floating) environment yet \caption@Debug{Increment \@captype\ counter =\the\value\@captype}% @@ -912,15 +919,17 @@ \caption@setoptions{sub}% \caption@setoptions{subfloat}% for subfig-package compatibility \let\caption\caption@subcaption + \let\phantomcaption\caption@subphantom \let\@makecaption\caption@makecaption \fi}% \newcommand*\caption@subcaption{% - \caption@iftype - {\caption@checkgrouplevel{sub}\subcaption - \caption@star - {\caption@refstepcounter\@subcaptype}% - {\caption@dblarg{\@caption\@subcaptype}}}% - {\caption@Error{\noexpand\subcaption outside float}}} + \caption@checkgrouplevel{sub}\subcaption + \caption@star + {\caption@refstepcounter\@subcaptype}% + {\caption@dblarg{\@caption\@subcaptype}}} +\newcommand*\caption@subphantom{% + \caption@checkgrouplevel{sub}\phantomsubcaption + \caption@refstepcounter\@subcaptype} \let\caption@kernel@addcontentsline\caption@addcontentsline \renewcommand*\caption@addcontentsline[2]{% \sf@ifpositiontop{\@listsubcaptions{#1}}{}% @@ -953,11 +962,11 @@ \newcommand*\caption@clearsubcontentslines{% \global\let\caption@subcontentslines\@empty} \caption@AtBeginDocument*{% - \@ifundefined{sf@ifpositiontop}{\let\sf@ifpositiontop\@gobbletwo}{}% + \caption@ifundefined\sf@ifpositiontop{\let\sf@ifpositiontop\@gobbletwo}{}% \caption@clearsubcontentslines \g@addto@macro\caption@typehook{\caption@checksubcontentslines}% \AtEndDocument{\caption@checksubcontentslines}}% -\@ifundefined{smf@makecaption}{}{\let\smf@makecaption\@makecaption} +\caption@ifundefined\smf@makecaption{}{\let\smf@makecaption\@makecaption} \@ifclassloaded{beamer}{% \caption@InfoNoLine{beamer document class}% \expandafter\let\expandafter\caption@ORI@figure @@ -971,16 +980,16 @@ \caption@ORI@table[#1]% \caption@settype{table}} }{} -\@ifundefined{scr@caption}{}{% +\caption@ifundefined\scr@caption{}{% \caption@AtBeginDocument{\let\scr@caption\caption}} \@nameuse{caption@frenchb}\@nameundef{caption@frenchb} -\caption@AtBeginDocument{\@ifundefined{frenchTeXmods}{}{% +\caption@AtBeginDocument{\caption@ifundefined\frenchTeXmods{}{% \caption@InfoNoLine{frenchle/pro package is loaded}% \let\captionfont@ORI\captionfont \let\captionlabelfont@ORI\captionlabelfont \let\@makecaption@ORI\@makecaption - \@ifundefined{GOfrench}% + \caption@ifundefined\GOfrench {\let\caption@tempa\@firstofone}% {\def\caption@tempa{\g@addto@macro\GOfrench}}% \caption@tempa{% @@ -1051,47 +1060,58 @@ \caption@AtBeginDocument*{% \caption@ifneedfreeze{% \newcommand*\caption@freeze{% - \caption@teststar\caption@@freeze\@gobble\@firstofone}% - \newcommand*\caption@@freeze[1]{% \global\let\caption@SCcontinued\relax \global\let\caption@SCsetup\@undefined \global\let\caption@SClentry\@undefined \global\let\caption@SCtext\@undefined \global\let\caption@SClabel\@undefined - \let\caption@ORI@ContinuedFloat\ContinuedFloat + \let\caption@frozen@ContinuedFloat\ContinuedFloat \def\ContinuedFloat{% \caption@withoptargs\caption@SC@ContinuedFloat}% \def\caption@SC@ContinuedFloat##1{% - \let\caption@ORI@setcounter\setcounter - \let\caption@ORI@addtocounter\addtocounter + \let\caption@frozen@setcounter\setcounter + \let\caption@frozen@addtocounter\addtocounter \def\setcounter####1####2{\csname c@####1\endcsname####2\relax}% \def\addtocounter####1####2{\advance\csname c@####1\endcsname ####2\relax}% - \caption@ORI@ContinuedFloat##1% - \global\let\caption@SCcontinued\caption@ORI@ContinuedFloat - \let\setcounter\caption@ORI@setcounter - \let\addtocounter\caption@ORI@addtocounter}% - \let\caption@ORI@setup\captionsetup - \def\captionsetup{% - \caption@withoptargs\caption@SC@setup}% - \def\caption@SC@setup##1##2{% - \caption@g@addto@list\caption@SCsetup{##2}% - \caption@ORI@setup##1{##2}}% - \let\caption@ORI\caption + \caption@frozen@ContinuedFloat##1% + \global\let\caption@SCcontinued\caption@frozen@ContinuedFloat + \let\setcounter\caption@frozen@setcounter + \let\addtocounter\caption@frozen@addtocounter}% + \let\caption@frozen@setup\caption@setup + \def\caption@setup##1{% + \caption@g@addto@list\caption@SCsetup{##1}% + \caption@frozen@setup{##1}}% + \let\caption@frozen\caption \def\caption{% \def\caption{\caption@Error{% Only one \noexpand\caption can be placed in this environment}}% \let\captionsetup\caption@setup \let\caption@@refstepcounter\caption@l@stepcounter - \caption@ORI}% + \caption@frozen}% + \let\caption@frozen@\@caption \long\def\@caption##1[##2]##3{% \gdef\caption@SClentry{##2}% \gdef\caption@SCtext{##3}% + \let\@currentlabel\caption@SCcurrentlabel \ignorespaces}% - #1{% is \@gobble in star form, and \@firstofone otherwise - \def\label##1{\@bsphack\gdef\caption@SClabel{##1}\@esphack}}% + \let\caption@frozen@label\label + \def\label##1{% + \ifx\@currentlabel\caption@SCcurrentlabel + \@bsphack\gdef\caption@SClabel{##1}\@esphack + \else + \caption@frozen@label{##1}% + \fi}% + \def\caption@SCcurrentlabel{???}% }% + \newcommand*\caption@warmup{% + \ifx\caption@frozen\@undefined\else + \let\caption@setup\caption@frozen@setup + \let\caption\caption@frozen + \let\@caption\caption@frozen@ + \let\label\caption@frozen@label + \fi} \newcommand*\caption@defrost{% - \ifx\caption@ORI@ContinuedFloat\@undefined + \ifx\caption@frozen\@undefined \caption@defrost@setup \ifx\caption@SCtext\@undefined \else \expandafter\expandafter\expandafter\caption @@ -1112,7 +1132,7 @@ \ifx\caption@SCsetup\@undefined \else \expandafter\captionsetup\expandafter{\caption@SCsetup}% \fi}% - }{}% + }{\let\caption@warmup\relax}% \caption@undefbool{needfreeze}} \caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{% \@ifpackageloaded{floatrow}{% @@ -1200,10 +1220,10 @@ \def\@captype{#1}% \let\FP@LabelText\@empty \begin{lrbox}{\FP@floatCorpusBOX}% + \caption@freeze \caption@ifFPrefcap - {\caption@freeze\relax}% - {\def\label##1{\@bsphack\gdef\FP@LabelText{##1}\@esphack}% - \caption@freeze*}% + {}% + {\def\label##1{\@bsphack\gdef\FP@LabelText{##1}\@esphack}}% \ignorespaces}% \renewcommand*\FP@floatEnd{% \end{lrbox}% @@ -1255,11 +1275,11 @@ } \caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{% % Test if hyperref has stopped early - \@ifundefined{ifhyp@stoppedearly}{% + \caption@ifundefined\ifhyp@stoppedearly{% \newif\ifhyp@stoppedearly - \@ifundefined{H@refstepcounter}\hyp@stoppedearlytrue{% - \@ifundefined{hyper@makecurrent}\hyp@stoppedearlytrue{% - \@ifundefined{measuring@true}\hyp@stoppedearlytrue{}}}}{}% + \caption@ifundefined\H@refstepcounter\hyp@stoppedearlytrue{% + \caption@ifundefined\hyper@makecurrent\hyp@stoppedearlytrue{% + \caption@ifundefined\measuring@true\hyp@stoppedearlytrue{}}}}{}% \ifhyp@stoppedearly % hyperref has stopped early \caption@InfoNoLine{% Hyperref support is turned off\MessageBreak @@ -1325,7 +1345,7 @@ \let\caption@raisedlink\Hy@raisedlink \fi \def\caption@@start{% - \@ifundefined{hc@currentHref}{% + \caption@ifundefined\hc@currentHref{% \caption@Warning{% The option `hypcap=true' will be ignored for this\MessageBreak particular \string\caption}}{}}% @@ -1345,7 +1365,7 @@ \caption@startanchor\caption@currentHref \global\let\caption@currentHref\@undefined \fi}% - \@ifundefined{HyOrg@float@makebox}{}{% + \caption@ifundefined\HyOrg@float@makebox{}{% \caption@Debug{% Redefining \noexpand\float@makebox (again)\@gobble}% \let\caption@ORI@float@makebox\float@makebox % save for compatibility mode @@ -1356,7 +1376,7 @@ \caption@IfPackageLoaded{hypcap}{% v1.0 \ifx\caption@start\relax \else % hyperref hasn't stopped early \let\caption@ORI@capstart\capstart % save for compatibility mode - \@ifundefined{capstarttrue}% check for v1.10 of hypcap package + \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package {\def\capstart{\caption@start@}}% {\def\capstart{\ifcapstart\caption@start@\fi}}% \let\caption@start\relax @@ -1470,7 +1490,7 @@ }{} \newcommand*\piccaptiontype[1]{\def\@piccaptype{#1}} \caption@IfPackageLoaded{picins}{% - \@ifundefined{@piccaptype}{% + \caption@ifundefined\@piccaptype{% \caption@iftype{% \let\@piccaptype\@captype }{% @@ -1534,11 +1554,13 @@ \caption@AtBeginDocument{\let\SC@caption=\caption}% \let\caption@ORI@SC@zfloat\SC@zfloat \def\SC@zfloat#1#2#3[#4]{% - \let\caption@ORI\caption \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]% - \let\caption\caption@ORI + \SC@RestoreCommands \caption@settype*{#2}% - \caption@freeze*}% + \caption@freeze + \let\SC@label\label}% + \providecommand*\SC@RestoreCommands{% + \let\caption=\SC@orig@caption \let\label=\SC@orig@label}% \let\caption@ORI@endSC@FLOAT\endSC@FLOAT \def\endSC@FLOAT{% \let\caption@ORI@settype\caption@settype @@ -1550,7 +1572,7 @@ \caption@start}% \def\caption@setSC@justify{% \caption@clearmargin - \@ifundefined{SC@justify}{}{% + \caption@ifundefined\SC@justify{}{% \ifx\SC@justify\@empty \else \let\caption@hj\SC@justify \let\SC@justify\@empty @@ -1704,7 +1726,7 @@ \newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}% \caption@restylewrapfloat{#1}}% \ifx\WF@floatstyhook\@undefined \else % wrapfig v3.6 - \@ifundefined{float@restyle}{}{% + \caption@ifundefined\float@restyle{}{% \toks@=\expandafter{\float@restyle{#1}% (env may or may not be defined) \caption@restylewrapfloat{#1}}% \edef\@tempa{\def\noexpand\float@restyle##1{\the\toks@}}% |