diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/caption/caption3.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/caption/caption3.sty | 1099 |
1 files changed, 834 insertions, 265 deletions
diff --git a/Master/texmf-dist/tex/latex/caption/caption3.sty b/Master/texmf-dist/tex/latex/caption/caption3.sty index 8dba296a100..5488a81fb14 100644 --- a/Master/texmf-dist/tex/latex/caption/caption3.sty +++ b/Master/texmf-dist/tex/latex/caption/caption3.sty @@ -22,172 +22,329 @@ %% %% This Current Maintainer of this work is Axel Sommerfeldt. %% -%% This work consists of the files caption.ins, caption.dtx, -%% caption2.dtx, and anleitung.tex and the derived files -%% caption.sty, caption2.sty, caption3.sty, and manual.tex. +%% This work consists of the files caption.ins, caption.dtx, caption2.dtx, +%% and ltcaption.dtx, the derived files caption.sty, caption2.sty, +%% caption3.sty, and ltcaption.sty, and the user manuals caption-deu.tex, +%% caption-eng.tex, and caption-rus.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2007/04/11 v3.0q caption3 kernel (AR)] +\ProvidesPackage{caption3}[2007/09/01 v3.1 caption3 kernel (AR)] \providecommand*\@nameundef[1]{% \expandafter\let\csname #1\endcsname\@undefined} -\providecommand{\l@addto@macro}[2]{% +\providecommand\l@addto@macro[2]{% \begingroup \toks@\expandafter{#1#2}% \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}% \@tempa} \def\bothIfFirst#1#2{% \protected@edef\caption@tempa{#1}% - \ifx\caption@tempa\@empty\else + \ifx\caption@tempa\@empty \else #1#2% \fi} \def\bothIfSecond#1#2{% \protected@edef\caption@tempa{#2}% - \ifx\caption@tempa\@empty\else + \ifx\caption@tempa\@empty \else #1#2% \fi} -\def\caption@ifinlist#1#2{% - \let\next\@secondoftwo - \edef\caption@tempa{#1}% - \@for\caption@tempb:={#2}\do{% - \ifx\caption@tempa\caption@tempb - \let\next\@firstoftwo +\newcommand*\caption@ifinlist{% + \@expandtwoargs\caption@@ifinlist} +\newcommand*\caption@@ifinlist[2]{% + \begingroup + \def\@tempa##1,#1,##2\@nil{% + \endgroup + \ifx\relax##2\relax + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo \fi}% - \next} -\def\caption@setbool#1#2{% + \@tempa,#2,#1,\@nil}% +\newcommand*\caption@ifin@list[2]{% + \caption@ifempty@list#1% + {\@secondoftwo}% + {\@expandtwoargs\caption@@ifinlist{#2}{#1}}} +\newcommand*\caption@g@addto@list[2]{% + \caption@ifempty@list#1{\gdef#1{#2}}{\g@addto@macro#1{,#2}}} +\newcommand*\caption@l@addto@list[2]{% + \caption@ifempty@list#1{\def#1{#2}}{\l@addto@macro#1{,#2}}} +\newcommand*\caption@g@removefrom@list[2]{% + \caption@l@removefrom@list#1{#2}% + \global\let#1#1} +\newcommand*\caption@l@removefrom@list[2]{% + \caption@ifempty@list#1{}{\@expandtwoargs\@removeelement{#2}#1#1}} +\newcommand*\caption@for@list[2]{% + \caption@ifempty@list#1{}{% + \def\caption@tempb##1{#2}% + \@for\caption@tempa:=#1\do{% + \expandafter\caption@tempb\expandafter{\caption@tempa}}}} +\newcommand*\caption@ifempty@list[1]{% + \ifx#1\@undefined + \expandafter\@firstoftwo + \else\ifx#1\relax + \expandafter\expandafter\expandafter\@firstoftwo + \else\ifx#1\@empty + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\@firstoftwo + \else + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\@secondoftwo + \fi\fi\fi} +\newcommand*\caption@setbool[1]{% + \expandafter\caption@set@bool\csname caption@if#1\endcsname} +\newcommand*\caption@set@bool[2]{% \caption@ifinlist{#2}{1,true,yes,on}{% - \expandafter\let\csname caption@if#1\endcsname\@firstoftwo + \let#1\@firstoftwo }{\caption@ifinlist{#2}{0,false,no,off}{% - \expandafter\let\csname caption@if#1\endcsname\@secondoftwo + \let#1\@secondoftwo }{% \caption@Error{Undefined boolean value `#2'}% }}} -\def\caption@ifbool#1{\@nameuse{caption@if#1}} -\def\caption@undefbool#1{\@nameundef{caption@if#1}} -\def\caption@newcounter#1{\gdef#1{0}} -\def\caption@setcounter#1#2{\xdef#1{#2}} -\def\caption@addtocounter#1#2{% +\newcommand*\caption@ifbool[1]{\@nameuse{caption@if#1}} +\newcommand*\caption@undefbool[1]{\@nameundef{caption@if#1}} +\newcommand*\caption@teststar[3]{\@ifstar{#1{#2}}{#1{#3}}} +\newcommand*\caption@withoptargs[1]{% + \@ifstar + {\def\caption@tempa{*}\caption@@withoptargs#1}% + {\def\caption@tempa{}\caption@@withoptargs#1}} +\def\caption@@withoptargs#1{% + \@ifnextchar[%] + {\caption@@@withoptargs#1}% + {\caption@@@@withoptargs#1}} +\def\caption@@@withoptargs#1[#2]{% + \l@addto@macro\caption@tempa{[{#2}]}% + \caption@@withoptargs#1} +\def\caption@@@@withoptargs#1{% + \expandafter#1\expandafter{\caption@tempa}} +\newcommand\caption@DoCheckCommand[2]{% \begingroup - \@tempcnta#1% - \advance\@tempcnta#2% - \xdef#1{\the\@tempcnta}% - \endgroup} -\def\caption@stepcounter#1{\caption@addtocounter#1\@ne} -\newcommand\caption@Package{caption} + \let\@tempa#1% + #2% + \ifx\@tempa#1% + \endgroup + \let\caption@CheckCommand\@gobbletwo + \else + \endgroup + \fi} +\@onlypreamble\caption@DoCheckCommand +\let\caption@CheckCommand\caption@DoCheckCommand +\@onlypreamble\caption@CheckCommand +\newcommand*\caption@IfCheckCommand{% + \ifx\caption@CheckCommand\@gobbletwo + \let\next\@firstoftwo + \else + \let\next\@secondoftwo + \fi + \let\caption@CheckCommand\caption@DoCheckCommand + \next} +\@onlypreamble\caption@IfCheckCommand +\let\caption@begindocumenthook\@empty +\let\caption@@begindocumenthook\@empty +\def\caption@AtBeginDocument{% + \caption@teststar\g@addto@macro + \caption@@begindocumenthook\caption@begindocumenthook} +\@onlypreamble\caption@AtBeginDocument +\AtBeginDocument{% + \PackageInfo{caption}{Begin \noexpand\AtBeginDocument code\@gobble}% + \def\caption@AtBeginDocument{% + \@ifstar{\g@addto@macro\caption@@begindocumenthook}\@firstofone}% + \caption@begindocumenthook + \let\caption@begindocumenthook\@undefined + \def\caption@AtBeginDocument{% + \@ifstar\@firstofone\@firstofone}% + \caption@@begindocumenthook + \let\caption@@begindocumenthook\@undefined + \PackageInfo{caption}{End \noexpand\AtBeginDocument code\@gobble}} \newcommand*\caption@Error[1]{% \PackageError\caption@Package{#1}\caption@eh} -\newcommand\caption@eh{% +\newcommand*\caption@Package{caption} +\newcommand*\caption@eh{% If you do not understand this error, please take a closer look\MessageBreak at the documentation of the `\caption@Package' package.\MessageBreak \@ehc} \RequirePackage{keyval}[1997/11/10] \providecommand*\undefine@key[2]{% \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}} -\newcommand\DeclareCaptionOption{% - \@ifstar{\caption@declareoption\AtEndOfPackage}% - {\caption@declareoption\@gobble}} +\providecommand*\@onlypreamble@key[2]{% + \expandafter\@onlypreamble\csname KV@#1@#2\endcsname} +\@onlypreamble\@onlypreamble@key +\newcommand*\DeclareCaptionOption{% + \caption@teststar\caption@declareoption\AtEndOfPackage\@gobble} +\@onlypreamble\DeclareCaptionOption \newcommand*\caption@declareoption[2]{% #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}} -\@onlypreamble\DeclareCaptionOption \@onlypreamble\caption@declareoption -\newcommand\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup} -\newcommand\caption@typ@{caption@typ@} % This saves 74 words of TeX memory -\def\caption@setuptype[#1]#2{% - \@ifundefined{\caption@typ@#1}% - {\@namedef{\caption@typ@#1}{#2}}% - {\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}} -\newcommand\caption@setup{\caption@setkeys{caption}} -\newcommand*\caption@setkeys{% - \@dblarg\caption@@setkeys} +\newcommand*\captionsetup{% + \caption@teststar\@captionsetup\@gobble\@firstofone} +\newcommand*\@captionsetup[1]{% + \@ifnextchar[{\caption@setup@options#1}\caption@setup} +\newcommand*\caption@setup{\caption@setkeys{caption}} +\def\caption@setup@options#1[#2]{% + % #1 is \@gobble in star form, and \@firstofone otherwise + #1{\caption@addtooptlist{#2}}% + \expandafter\caption@l@addto@list\csname caption@opt@#2\endcsname} +\newcommand*\clearcaptionsetup{% + \caption@teststar\@clearcaptionsetup\@gobble\@firstofone} +\newcommand*\@clearcaptionsetup[1]{% + \let\caption@tempa#1% + \@testopt\@@clearcaptionsetup{}} +\def\@@clearcaptionsetup[#1]#2{% + \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname + {\caption@tempa{\PackageWarning{caption}{Option list `#2' undefined}}}% + {\ifx,#1,% + \caption@clearsetup{#2}% + \else + \caption@@removefromsetup{#1}{#2}% + \fi}} +\newcommand*\caption@clearsetup[1]{% + \caption@removefromoptlist{#1}% + \@nameundef{caption@opt@#1}} +\newcommand*\caption@removefromsetup{% + \let\caption@tempa\@gobble + \caption@@removefromsetup} +\newcommand*\caption@@removefromsetup[2]{% + \expandafter\let\expandafter\@tempa\csname caption@opt@#2\endcsname + \expandafter\let\csname caption@opt@#2\endcsname\@undefined + \def\@tempb##1=##2\@nil{##1}% + \edef\@tempc{#1}% + \@for\@tempa:=\@tempa\do{% + \edef\@tempd{\expandafter\@tempb\@tempa=\@nil}% + \ifx\@tempd\@tempc + \let\caption@tempa\@gobble + \else + \expandafter\expandafter\expandafter\caption@l@addto@list + \expandafter\csname caption@opt@#2\expandafter\endcsname + \expandafter{\@tempa}% + \fi}% + \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname + {\caption@removefromoptlist{#2}}{}% + \caption@tempa{% + \PackageWarning{caption}{% + Option `#1' was not in list `#2'\MessageBreak}}} +\newcommand*\showcaptionsetup[2][\@firstofone]{% + \GenericWarning{}{% + #1 Caption Info: KV list on `#2'\MessageBreak + #1 Caption Data: \@ifundefined{caption@opt@#2}{% + -none-% + }{% + {\expandafter\expandafter\expandafter\strip@prefix + \expandafter\meaning\csname caption@opt@#2\endcsname}% + }}} +\DeclareCaptionOption{options}{\caption@setoptions{#1}} +\newcommand*\caption@setoptions[1]{% + \caption@Debug{options=#1}% + \expandafter\let\expandafter\@tempa\csname caption@opt@#1\endcsname + \ifx\@tempa\relax \else + \let\caption@iftypewarning\@firstoftwo % = true + \expandafter\caption@setup\expandafter{\@tempa}% + \caption@clearsetup{#1}% + \fi} +\newcommand*\caption@addtooptlist[1]{% + \@ifundefined{caption@opt@#1@lineno}{% + \caption@dooptlist\caption@g@addto@list{#1}% + \expandafter\xdef\csname caption@opt@#1@lineno\endcsname{\the\inputlineno}% + }{}} +\newcommand*\caption@removefromoptlist[1]{% + \caption@dooptlist\caption@g@removefrom@list{#1}% + \global\expandafter\let\csname caption@opt@#1@lineno\endcsname\@undefined} +\newcommand*\caption@dooptlist[2]{% + \begingroup + \edef\@tempa{#2}\@onelevel@sanitize\@tempa + \expandafter#1\expandafter\caption@optlist\expandafter{\@tempa}% + \endgroup} +\AtEndDocument{% + \caption@for@list\caption@optlist{% + \PackageWarningNoLine{caption}{% + Unused \string\captionsetup[#1] + on input line \csname caption@opt@#1@lineno\endcsname}}} +\newcommand*\caption@setkeys{\@dblarg\caption@@setkeys} \long\def\caption@@setkeys[#1]#2#3{% - \ifnum\caption@keydepth=0\relax - \let\caption@KV@errx\KV@errx - \let\caption@KV@err\KV@err + \ifx\caption@keydepth\@empty + \let\caption@ORI@KV@errx\KV@errx + \let\caption@ORI@KV@err\KV@err \let\KV@errx\caption@Error \let\KV@err\caption@Error \fi - \caption@stepcounter\caption@keydepth + \l@addto@macro\caption@keydepth.% \def\caption@Package{#1}% \caption@Debug{\protect\setkeys{#2}{#3}}% \setkeys{#2}{#3}% \def\caption@Package{caption}% - \caption@addtocounter\caption@keydepth\m@ne - \ifnum\caption@keydepth=0\relax - \let\KV@errx\caption@KV@errx - \let\KV@err\caption@KV@err + \edef\caption@keydepth{\expandafter\@cdr\caption@keydepth\@nil}% + \ifx\caption@keydepth\@empty + \let\KV@errx\caption@ORI@KV@errx + \let\KV@err\caption@ORI@KV@err \fi} -\caption@newcounter\caption@keydepth -\newcommand*\caption@settype[1]{% - \@ifundefined{\caption@typ@#1}{}{% - \caption@esetup{\csname\caption@typ@#1\endcsname}}} -\newcommand*\caption@esetup[1]{% - \edef\caption@tempa{\noexpand\caption@setup{#1}}% - \caption@tempa} -\newcommand*\clearcaptionsetup[1]{\@nameundef{\caption@typ@#1}} -\newcommand*\showcaptionsetup[2][\@firstofone]{% - \GenericWarning{}{% - #1 Caption Info: KV list on `#2'\MessageBreak - #1 Caption Data: (% - \@ifundefined{\caption@typ@#2}{% - % empty -- print nothing - }{% - \@nameuse{\caption@typ@#2}% - }% - )}} -\newcommand*\caption@ProcessOptions[1]{% +\let\caption@keydepth\@empty +\newcommand*\caption@ExecuteOptions[2]{% + \@expandtwoargs\caption@setkeys{#1}{#2}}% +\@onlypreamble\caption@ExecuteOptions +\newcommand*\caption@ProcessOptions{% + \caption@teststar\caption@@ProcessOptions\@gobble\@firstofone} +\@onlypreamble\caption@ProcessOptions +\newcommand*\caption@@ProcessOptions[2]{% \let\@tempc\relax \let\caption@tempa\@empty - \@for\CurrentOption:=\@classoptionslist\do{% - \@ifundefined{KV@#1@\CurrentOption}{% - }{% - \@ifundefined{KV@#1@\CurrentOption @default}{% - \PackageInfo{#1}{Global option `\CurrentOption' ignored}% - }{% - \PackageInfo{#1}{Global option `\CurrentOption' processed}% - \edef\caption@tempa{\caption@tempa,\CurrentOption,}% - \@expandtwoargs\@removeelement\CurrentOption - \@unusedoptionlist\@unusedoptionlist + #1{% \@firstofone -or- \@gobble + \@for\CurrentOption:=\@classoptionslist\do{% + \@ifundefined{KV@#2@\CurrentOption}{}{% + \@ifundefined{KV@#2@\CurrentOption @default}{% + \PackageInfo{#2}{Global option `\CurrentOption' ignored}% + }{% + \PackageInfo{#2}{Global option `\CurrentOption' processed}% + \edef\caption@tempa{\caption@tempa,\CurrentOption,}% + \@expandtwoargs\@removeelement\CurrentOption + \@unusedoptionlist\@unusedoptionlist + }% }% }% + \let\CurrentOption\@empty }% - \edef\caption@tempa{% - \noexpand\caption@setkeys{#1}{% - \caption@tempa\@ptionlist{\@currname.\@currext}% - }% - }% - \caption@tempa - \let\CurrentOption\@empty + \caption@ExecuteOptions{#2}{\caption@tempa\@ptionlist{\@currname.\@currext}}% \AtEndOfPackage{\let\@unprocessedoptions\relax}} -\@onlypreamble\caption@ProcessOptions +\@onlypreamble\caption@@ProcessOptions \newdimen\captionmargin \newdimen\captionmargin@ \newdimen\captionwidth \DeclareCaptionOption{margin}{\setcaptionmargin{#1}} +\DeclareCaptionOption{margin*}{\setcaptionmargin*{#1}} \DeclareCaptionOption{width}{\setcaptionwidth{#1}} -\DeclareCaptionOption{twoside}[1]{\caption@setbool{twoside}{#1}} -\newcommand*\setcaptionmargin[1]{% - \captionwidth\z@ - \caption@@setmargin#1,#1,\@nil\@@} -\def\caption@@setmargin#1,#2,#3\@@{% - \setlength\captionmargin{#1}% +\DeclareCaptionOption{twoside}[1]{\caption@set@bool\caption@iftwoside{#1}} +\DeclareCaptionOption{minmargin}{\caption@setoptcmd\caption@minmargin{#1}} +\DeclareCaptionOption{maxmargin}{\caption@setoptcmd\caption@maxmargin{#1}} +\newcommand*\setcaptionmargin{% + \caption@teststar\caption@setmargin\@gobble\@firstofone} +\newcommand*\caption@setmargin[2]{% + #1{\captionwidth\z@}% + \caption@@setmargin#2,#2,\@nil} +\def\caption@@setmargin#1,#2,#3\@nil{% \setlength\captionmargin@{#2}% - \advance\captionmargin@ by -\captionmargin} -\newcommand\setcaptionwidth{% + \setlength\captionmargin{#1}% + \addtolength\captionmargin@{-\captionmargin}} +\newcommand*\setcaptionwidth{% + \captionmargin\z@ + \captionmargin@\z@ \setlength\captionwidth} -\caption@newcounter\caption@count -\newcommand*\caption@newlabel{\@newl@bel{caption}} +\newcommand*\caption@count{0} +\newcommand*\caption@newlabel{\@newl@bel{caption@r}} \newcommand*\caption@thepage{\the\c@page} -\def\caption@ifoddpage{% +\newcommand*\caption@label[1]{% + \protected@write\@auxout{\let\caption@thepage\relax}% + {\string\caption@newlabel{#1}{\caption@thepage}}} +\newcommand*\caption@pageref[1]{% + \expandafter\ifx\csname caption@r@#1\endcsname\relax + \G@refundefinedtrue % => 'There are undefined references.' + \PackageWarning{caption}{Reference on page \thepage \space undefined}% + \else + \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname + \fi} +\newcommand*\caption@ifoddpage{% \caption@iftwoside{% - \caption@stepcounter\caption@count - \protected@write\@auxout{\let\caption@thepage\relax}% - {\string\caption@newlabel{\caption@count}{\caption@thepage}}% - \expandafter\ifx\csname caption@\caption@count\endcsname\relax - \G@refundefinedtrue % => 'There are undefined references.' - \PackageWarning{caption3}{Reference on page \thepage \space undefined}% - \else - \expandafter\let\expandafter\caption@thepage - \csname caption@\caption@count\endcsname - \fi + \begingroup + \@tempcnta\caption@count + \advance\@tempcnta\@ne + \xdef\caption@count{\the\@tempcnta}% + \endgroup + \caption@label\caption@count + \caption@pageref\caption@count \ifodd\caption@thepage \let\caption@ifoddpage\@firstoftwo \else @@ -195,101 +352,122 @@ \fi }{\let\caption@ifoddpage\@firstoftwo}% \caption@ifoddpage} -\newdimen\captionindent -\newdimen\captionparindent -\newdimen\captionhangindent -\DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete! -\DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}} -\DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}} -\DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}} -\DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}} +\newcommand*\caption@setoptcmd[2]{% + \caption@ifinlist{#2}{0,false,no,off}{\let#1\@undefined}{\def#1{#2}}} +\newdimen\caption@indent +\newdimen\caption@parindent +\newdimen\caption@hangindent +\DeclareCaptionOption{indent}[\leftmargini]{% + \setlength\caption@indent{#1}}% obsolete! +\DeclareCaptionOption{indention}[\leftmargini]{% + \setlength\caption@indent{#1}} +\DeclareCaptionOption{parindent}{% + \setlength\caption@parindent{#1}} +\DeclareCaptionOption{hangindent}{% + \setlength\caption@hangindent{#1}} +\DeclareCaptionOption{parskip}{% + \l@addto@macro\caption@@par{\setlength\parskip{#1}}} \@ifundefined{scr@caption}{}{% \let\caption@KV@parindent\KV@caption@parindent \DeclareCaptionOption{parindent}[]{% - \def\caption@tempa{#1}% - \ifx\caption@tempa\@empty - \PackageInfo{caption3}{Option `parindent' ignored}% + \ifx,#1,% + \caption@Debug{Option `parindent' ignored}% \else \caption@KV@parindent{#1}% \fi}% \let\caption@KV@parskip\KV@caption@parskip \DeclareCaptionOption{parskip}[]{% - \def\caption@tempa{#1}% - \ifx\caption@tempa\@empty - \PackageInfo{caption3}{Option `parskip' ignored}% + \ifx,#1,% + \caption@Debug{Option `parskip' ignored}% \else \caption@KV@parskip{#1}% \fi}% } \newcommand*\DeclareCaptionStyle[1]{% - \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}} + \@testopt{\caption@declarestyle{#1}}{}} +\@onlypreamble\DeclareCaptionStyle \def\caption@declarestyle#1[#2]#3{% \global\@namedef{caption@sls@#1}{#2}% \global\@namedef{caption@sty@#1}{#3}} -\@onlypreamble\DeclareCaptionStyle \@onlypreamble\caption@declarestyle \DeclareCaptionOption{style}{\caption@setstyle{#1}} -\newcommand\caption@setstyle{% - \@ifstar{\caption@@setstyle\@gobble}{\caption@@setstyle\@firstofone}} +\DeclareCaptionOption{singlelinecheck}{\caption@set@bool\caption@ifslc{#1}} +\newcommand*\caption@setstyle{% + \caption@teststar\caption@@setstyle\@gobble\@firstofone} \newcommand*\caption@@setstyle[2]{% \@ifundefined{caption@sty@#2}% - {#1{\caption@Error{Undefined caption style `#2'}}}% - {\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname - \caption@setdefault\caption@esetup{\csname caption@sty@#2\endcsname}}} -\newcommand\caption@setdefault{\captionsetup{% - format=default,labelformat=default,labelsep=default,textformat=default,% - justification=default,font=default,labelfont=default,textfont=default,% - margin=0pt,indent=0pt,parindent=0pt,hangindent=0pt,% - singlelinecheck=1,strut=1}} -\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{} + {#1{\caption@Error{Undefined style `#2'}}}% + {\expandafter\let\expandafter\caption@sty\csname caption@sty@#2\endcsname + \ifx\caption@setstyle@flag\@undefined + \let\caption@setstyle@flag\caption@setstyle + \let\caption@iftypewarning\@firstoftwo % = true + \caption@resetstyle + \expandafter\caption@setup\expandafter{\caption@sty}% + \let\caption@setstyle@flag\@undefined + \else + \expandafter\caption@setup\expandafter{\caption@sty}% + \fi + \expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname + \expandafter\caption@l@addto@list\expandafter\caption@opt@SingleLine + \expandafter{\caption@sls}}} +\newcommand*\caption@resetstyle{% + \caption@setup{% + format=plain,labelformat=default,labelsep=colon,textformat=simple,% + justification=justified,font=,labelfont=,textfont=,% + margin=0pt,minmargin=0,maxmargin=0,% + indent=0pt,parindent=0pt,hangindent=0pt,% + singlelinecheck=1,strut=1}% + \caption@clearsetup{SingleLine}} +\DeclareCaptionStyle{base}[indent=0pt,justification=centering]{} +\DeclareCaptionStyle{default}[indent=0pt,justification=centering,format=plain]{% + format=default,labelsep=default,textformat=default,% + justification=default,font=default,labelfont=default,textfont=default} \newcommand\DeclareCaptionFormat{% - \@ifstar{\caption@declareformat\@gobble}% - {\caption@declareformat\@firstofone}} + \caption@teststar\caption@declareformat\@gobble\@firstofone} +\@onlypreamble\DeclareCaptionFormat \newcommand\caption@declareformat[3]{% \global\expandafter\let\csname caption@ifh@#2\endcsname#1% \global\long\@namedef{caption@fmt@#2}##1##2##3{#3}} -\@onlypreamble\DeclareCaptionFormat \@onlypreamble\caption@declareformat \DeclareCaptionOption{format}{\caption@setformat{#1}} \newcommand*\caption@setformat[1]{% \@ifundefined{caption@fmt@#1}% - {\caption@Error{Undefined caption format `#1'}}% + {\caption@Error{Undefined format `#1'}}% {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} \DeclareCaptionFormat{plain}{#1#2#3\par} \DeclareCaptionFormat{hang}{% \@hangfrom{#1#2}% - \advance\captionparindent\hangindent - \advance\captionhangindent\hangindent + \advance\caption@parindent\hangindent + \advance\caption@hangindent\hangindent \caption@@par #3\par} \def\caption@fmt@default{\caption@fmt@plain} \def\caption@ifh@default{\caption@ifh@plain} \newcommand*\DeclareCaptionLabelFormat[2]{% - \global\@namedef{caption@lfmt@#1}##1##2{#2}} + \global\@namedef{caption@lfmt@#1}##1##2##3{#2}} \@onlypreamble\DeclareCaptionLabelFormat \DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}} \newcommand*\caption@setlabelformat[1]{% \@ifundefined{caption@lfmt@#1}% - {\caption@Error{Undefined caption label format `#1'}}% + {\caption@Error{Undefined label format `#1'}}% {\expandafter\let\expandafter\caption@lfmt\csname caption@lfmt@#1\endcsname}} \DeclareCaptionLabelFormat{empty}{} \DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} \def\caption@lfmt@default{\caption@lfmt@simple} \newcommand\DeclareCaptionLabelSeparator{% - \@ifstar{\caption@declarelabelseparator\@gobble}% - {\caption@declarelabelseparator\@firstofone}} + \caption@teststar\caption@declarelabelseparator\@gobble\@firstofone} +\@onlypreamble\DeclareCaptionLabelSeparator \newcommand\caption@declarelabelseparator[3]{% \global\expandafter\let\csname caption@iflf@#2\endcsname#1% \global\long\@namedef{caption@lsep@#2}{#3}} -\@onlypreamble\DeclareCaptionLabelSeparator \@onlypreamble\caption@declarelabelseparator \DeclareCaptionOption{labelsep}{\caption@setlabelseparator{#1}} \DeclareCaptionOption{labelseparator}{\caption@setlabelseparator{#1}} \newcommand*\caption@setlabelseparator[1]{% \@ifundefined{caption@lsep@#1}% - {\caption@Error{Undefined caption label separator `#1'}}% + {\caption@Error{Undefined label separator `#1'}}% {\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}} \DeclareCaptionLabelSeparator{none}{} @@ -305,28 +483,92 @@ \global\long\@namedef{caption@tfmt@#1}##1{#2}} \@onlypreamble\DeclareCaptionTextFormat \DeclareCaptionOption{textformat}{\caption@settextformat{#1}} +\DeclareCaptionOption{strut}{\caption@set@bool\caption@ifstrut{#1}} \newcommand*\caption@settextformat[1]{% \@ifundefined{caption@tfmt@#1}% - {\caption@Error{Undefined caption text format `#1'}}% + {\caption@Error{Undefined text format `#1'}}% {\expandafter\let\expandafter\caption@tfmt\csname caption@tfmt@#1\endcsname}} \DeclareCaptionTextFormat{simple}{#1} \DeclareCaptionTextFormat{period}{#1.} \def\caption@tfmt@default{\caption@tfmt@simple} +\newcommand*\DeclareCaptionFont[2]{% + \define@key{caption@fnt}{#1}[]{\l@addto@macro\caption@fnt{#2}}} +\@onlypreamble\DeclareCaptionFont +\newcommand*\DeclareDefaultCaptionFont[2]{% + \global\@namedef{caption#1@default}{#2}} +\@onlypreamble\DeclareDefaultCaptionFont +\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} +\DeclareDefaultCaptionFont{font}{} +\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} +\DeclareDefaultCaptionFont{labelfont}{} +\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} +\DeclareDefaultCaptionFont{textfont}{} +\newcommand*\caption@setfont[2]{% + \begingroup + \let\caption@fnt\@empty + \define@key{caption@fnt}{default}[]{% + \l@addto@macro\caption@fnt{\csname caption#1@default\endcsname}}% + \caption@setkeys[caption]{caption@fnt}{#2}% + \global\let\caption@tempa\caption@fnt + \endgroup + \expandafter\let\csname caption#1\endcsname\caption@tempa} +\newcommand*\caption@font{% + \caption@teststar\caption@@font\@firstofone + {\caption@setkeys[caption]{caption@fnt}}} +\newcommand*\caption@@font[2]{% + \begingroup + \def\caption@fnt{\endgroup}% + #1{#2}% + \caption@fnt} +\DeclareCaptionFont{normalcolor}{\normalcolor} +\DeclareCaptionFont{color}{\color{#1}} +\DeclareCaptionFont{normalfont}{\normalfont} +\DeclareCaptionFont{up}{\upshape} +\DeclareCaptionFont{it}{\itshape} +\DeclareCaptionFont{sl}{\slshape} +\DeclareCaptionFont{sc}{\scshape} +\DeclareCaptionFont{md}{\mdseries} +\DeclareCaptionFont{bf}{\bfseries} +\DeclareCaptionFont{rm}{\rmfamily} +\DeclareCaptionFont{sf}{\sffamily} +\DeclareCaptionFont{tt}{\ttfamily} +\DeclareCaptionFont{scriptsize}{\scriptsize} +\DeclareCaptionFont{footnotesize}{\footnotesize} +\DeclareCaptionFont{small}{\small} +\DeclareCaptionFont{normalsize}{\normalsize} +\DeclareCaptionFont{large}{\large} +\DeclareCaptionFont{Large}{\Large} +\DeclareCaptionFont{singlespacing}{\setstretch\setspace@singlespace}% normally 1 +\DeclareCaptionFont{onehalfspacing}{\onehalfspacing} +\DeclareCaptionFont{doublespacing}{\doublespacing} +\DeclareCaptionFont{stretch}{\setstretch{#1}} +\caption@AtBeginDocument{\providecommand*\setstretch[1]{}} +\DeclareCaptionFont{normal}{% + \caption@font*{% + \KV@caption@fnt@normalcolor\@unused + \KV@caption@fnt@normalfont\@unused + \KV@caption@fnt@normalsize\@unused + \KV@caption@fnt@singlespacing\@unused}} +\providecommand\captionsize{} +\DeclareCaptionOption{size}{\caption@setfont{size}{#1}} +\DeclareDefaultCaptionFont{size}{} \newcommand*\DeclareCaptionJustification[2]{% - \global\@namedef{caption@hj@#1}{#2}} + \global\@namedef{caption@hj@#1}{#2}% for compatibility to v3.0 + \DeclareCaptionFont{#1}{#2}} \@onlypreamble\DeclareCaptionJustification +\newcommand*\DeclareDefaultCaptionJustification[1]{% + \global\@namedef{caption@hj@default}{#1}% for compatibility to v3.0 + \DeclareDefaultCaptionFont{@hj}{#1}} +\@onlypreamble\DeclareDefaultCaptionJustification \DeclareCaptionOption{justification}{\caption@setjustification{#1}} -\newcommand*\caption@setjustification[1]{% - \@ifundefined{caption@hj@#1}% - {\caption@Error{Undefined caption justification `#1'}}% - {\expandafter\let\expandafter\caption@hj\csname caption@hj@#1\endcsname}} +\DeclareDefaultCaptionJustification{} +\newcommand*\caption@setjustification{\caption@setfont{@hj}} \DeclareCaptionJustification{justified}{} \DeclareCaptionJustification{centering}{\centering} \DeclareCaptionJustification{centerfirst}{\centerfirst} \DeclareCaptionJustification{centerlast}{\centerlast} \DeclareCaptionJustification{raggedleft}{\raggedleft} \DeclareCaptionJustification{raggedright}{\raggedright} -\def\caption@hj@default{\caption@hj@justified} \providecommand\centerfirst{% \let\\\@centercr \edef\caption@normaladjust{% @@ -353,55 +595,30 @@ \caption@Debug{We need ragged2e}% \protected@write\@auxout{}{\string\caption@newlabel{ragged2e}{}}% \global\let\caption@ragged\caption@@ragged - \caption@@ragged} -\newcommand*\caption@@ragged[2]{% - \@ifundefined{caption\string#1}{% - \PackageWarning{caption3}{% - `ragged2e' package not loaded, therefore\MessageBreak - substituting \string#2 for \string#1\MessageBreak}% - \global\@namedef{caption\string#1}}{}% - #2} -\AtBeginDocument{% - \@ifundefined{caption@ragged2e}{% - \let\caption@@ragged\@secondoftwo % suppress warning above + \caption@ragged} +\caption@AtBeginDocument{% + \@ifundefined{caption@r@ragged2e}{% + \newcommand*\caption@@ragged{% + \PackageWarning{caption}{% + `ragged2e' support has been changed.\MessageBreak + Rerun to get captions right}% + \global\let\caption@ragged\@secondoftwo % suppress further warnings + \caption@ragged}% }{% \caption@Debug{We load ragged2e}% \IfFileExists{ragged2e.sty}{% - \RequirePackage{ragged2e}\let\caption@@ragged\@firstoftwo}{}% + \RequirePackage{ragged2e}% + \let\caption@@ragged\@firstoftwo + }{% + \newcommand*\caption@@ragged[2]{% + \@ifundefined{caption\string#1}{% + \PackageWarning{caption}{% + `ragged2e' package not loaded, therefore\MessageBreak + substituting \string#2 for \string#1\MessageBreak}% + \global\@namedef{caption\string#1}}{}% + #2}% + }% }} -\newcommand\DeclareCaptionFont[2]{% - \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}} -\@onlypreamble\DeclareCaptionFont -\DeclareCaptionOption{font}{\caption@setfont{font}{#1}} -\DeclareCaptionOption{labelfont}{\caption@setfont{labelfont}{#1}} -\DeclareCaptionOption{textfont}{\caption@setfont{textfont}{#1}} -\newcommand*\caption@setfont[2]{% - \let\caption@tempa\@empty - \begingroup - \caption@setkeys[caption]{caption@fnt}{#2}% - \endgroup - \expandafter\let\csname caption#1\endcsname\caption@tempa} -\DeclareCaptionFont{default}{} -\DeclareCaptionFont{scriptsize}{\scriptsize} -\DeclareCaptionFont{footnotesize}{\footnotesize} -\DeclareCaptionFont{small}{\small} -\DeclareCaptionFont{normalsize}{\normalsize} -\DeclareCaptionFont{large}{\large} -\DeclareCaptionFont{Large}{\Large} -\DeclareCaptionFont{up}{\upshape} -\DeclareCaptionFont{it}{\itshape} -\DeclareCaptionFont{sl}{\slshape} -\DeclareCaptionFont{sc}{\scshape} -\DeclareCaptionFont{md}{\mdseries} -\DeclareCaptionFont{bf}{\bfseries} -\DeclareCaptionFont{rm}{\rmfamily} -\DeclareCaptionFont{sf}{\sffamily} -\DeclareCaptionFont{tt}{\ttfamily} -\DeclareCaptionFont{singlespacing}{\setstretch{\setspace@singlespace}}% normally 1 -\DeclareCaptionFont{onehalfspacing}{\onehalfspacing} -\DeclareCaptionFont{doublespacing}{\doublespacing} -\providecommand\captionsize{} -\DeclareCaptionOption{size}{\caption@setfont{size}{#1}} \@ifundefined{abovecaptionskip}{% \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} \@ifundefined{belowcaptionskip}{% @@ -412,7 +629,7 @@ \DeclareCaptionOption{position}{\caption@setposition{#1}} \newcommand*\caption@setposition[1]{% \caption@ifinlist{#1}{d,default}{% - \def\caption@position{\caption@defaultpos}% + \let\caption@position\caption@defaultpos }{\caption@ifinlist{#1}{t,top,above}{% \let\caption@position\@firstoftwo }{\caption@ifinlist{#1}{b,bottom,below}{% @@ -420,20 +637,19 @@ }{\caption@ifinlist{#1}{a,auto}{% \let\caption@position\@undefined }{% - \caption@Error{Undefined caption position `#1'}% + \caption@Error{Undefined position `#1'}% }}}}} -\let\caption@defaultpos\@secondoftwo -\newcommand\caption@iftop{% +\let\caption@defaultpos\@undefined +\newcommand*\caption@iftop{% \ifx\caption@position\@undefined - \expandafter\@secondoftwo - \else - \expandafter\caption@position - \fi} -\newcommand\caption@fixposition{% + \let\caption@position\@secondoftwo + \fi + \caption@position} +\newcommand*\caption@fixposition{% \ifx\caption@position\@undefined \caption@autoposition \fi} -\newcommand\caption@autoposition{% +\newcommand*\caption@autoposition{% \ifvmode \edef\caption@tempa{\the\prevdepth}% \caption@Debug{\protect\prevdepth=\caption@tempa}% @@ -446,98 +662,373 @@ \caption@Debug{no \protect\prevdepth}% \let\caption@position\@secondoftwo \fi} -\newcommand\caption@beginhook{} -\newcommand\caption@endhook{} -\newcommand\AtBeginCaption{\l@addto@macro\caption@beginhook} -\newcommand\AtEndCaption{\l@addto@macro\caption@endhook} -\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}} -\DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}} -\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}} +\newcommand*\caption@setautoposition[1]{% + \def\caption@autoposition{\caption@setposition{#1}}} +\newcommand*\caption@beginhook{} +\newcommand*\caption@endhook{} +\newcommand*\AtBeginCaption{\l@addto@macro\caption@beginhook} +\newcommand*\AtEndCaption{\l@addto@macro\caption@endhook} +\DeclareCaptionOption{listof}{\caption@set@bool\caption@iflof{#1}} +\newcommand*\DeclareCaptionListOfFormat[2]{% + \global\@namedef{caption@lstfmt@#1}##1##2{#2}} +\@onlypreamble\DeclareCaptionListOfFormat +\DeclareCaptionOption{listofformat}{\caption@setlistofformat{#1}} +\newcommand*\caption@setlistofformat[1]{% + \@ifundefined{caption@lstfmt@#1}% + {\caption@Error{Undefined list-of format `#1'}}% + {\expandafter\let\expandafter\caption@lstfmt + \csname caption@lstfmt@#1\endcsname}} +\DeclareCaptionListOfFormat{empty}{} +\DeclareCaptionListOfFormat{simple}{#1#2} +\DeclareCaptionListOfFormat{parens}{#1(#2)} +\DeclareCaptionListOfFormat{subsimple}{#2} +\DeclareCaptionListOfFormat{subparens}{(#2)} +\def\caption@lstfmt@default{\caption@lstfmt@subsimple} \DeclareCaptionOption{debug}[1]{% - \caption@setbool{debug}{#1}% + \caption@set@bool\caption@ifdebug{#1}% + \let\caption@iftypewarning\caption@ifdebug \caption@ifdebug{% - \def\caption@Debug{\PackageInfo{caption3}}% + \def\caption@Debug{\PackageInfo{caption}}% }{% \let\caption@Debug\@gobble }} +\DeclareOption{debug}{\setkeys{caption}{debug}} \setkeys{caption}{debug=0} -\captionsetup{style=default,position=default,listof=1,% +\caption@CheckCommand\@makecaption{\let\@makecaption\@undefined} +\caption@CheckCommand\@makecaption{% + % article|report|book [2005/09/16 v1.4f Standard LaTeX document class] + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1: #2}% + \ifdim \wd\@tempboxa >\hsize + #1: #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}} +\@ifundefined{@captionheadfont}{}{% + \caption@CheckCommand\@makecaption{% + % amsart|amsproc|amsbook [2004/08/06 v2.20] + \long\def\@makecaption#1#2{% + \setbox\@tempboxa\vbox{\color@setgroup + \advance\hsize-2\captionindent\noindent + \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp + {\@cdr#2\@nil}{.\@captionfont\upshape\enspace#2}% + \unskip\kern-2\captionindent\par + \global\setbox\@ne\lastbox\color@endgroup}% + \ifhbox\@ne % the normal case + \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% + \fi + \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line + \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% + \else % tempboxa contained more than one line + \setbox\@ne\vbox{\unvbox\@tempboxa\parskip\z@skip + \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% + \fi + \ifnum\@tempcnta<64 % if the float IS a figure... + \addvspace\abovecaptionskip + \hbox to\hsize{\kern\captionindent\box\@ne\hss}% + \else % if the float IS NOT a figure... + \hbox to\hsize{\kern\captionindent\box\@ne\hss}% + \nobreak + \vskip\belowcaptionskip + \fi + \relax + }} + \caption@CheckCommand\@makecaption{% + % smfart|smfbook [1999/11/15 v1.2f Classe LaTeX pour les articles publies par la SMF] + \long\def\@makecaption#1#2{% + \ifdim\captionindent>.1\hsize \captionindent.1\hsize \fi + \setbox\@tempboxa\vbox{\color@setgroup + \advance\hsize-2\captionindent\noindent + \@captionfont\@captionheadfont#1\@xp\@ifnotempty\@xp + {\@cdr#2\@nil}{\@addpunct{.}\@captionfont\upshape\enspace#2}% + \unskip\kern-2\captionindent\par + \global\setbox\@ne\lastbox\color@endgroup}% + \ifhbox\@ne % the normal case + \setbox\@ne\hbox{\unhbox\@ne\unskip\unskip\unpenalty\unkern}% + \fi + \ifdim\wd\@tempboxa=\z@ % this means caption will fit on one line + \setbox\@ne\hbox to\columnwidth{\hss\kern-2\captionindent\box\@ne\hss}% + \@tempdima\wd\@ne\advance\@tempdima-\captionindent + \wd\@ne\@tempdima + \else % tempboxa contained more than one line + \setbox\@ne\vbox{\rightskip=0pt plus\captionindent\relax + \unvbox\@tempboxa\parskip\z@skip + \noindent\unhbox\@ne\advance\hsize-2\captionindent\par}% + \fi + \ifnum\@tempcnta<64 % if the float IS a figure... + \addvspace\abovecaptionskip + \noindent\kern\captionindent\box\@ne + \else % if the float IS NOT a figure... + \noindent\kern\captionindent\box\@ne + \nobreak + \vskip\belowcaptionskip + \fi + \relax + }} + \let\captionmargin\captionindent + \begingroup\edef\@tempa{\endgroup + \noexpand\caption@g@addto@list\noexpand\caption@sty@default + {margin=\the\captionmargin + \@ifundefined{smf@makecaption}{}{,maxmargin=.1\linewidth}}} + \@tempa + \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin} + \DeclareCaptionLabelSeparator{default}{.\enspace} + \DeclareDefaultCaptionFont{font}{\@captionfont} + \DeclareDefaultCaptionFont{labelfont}{\@captionheadfont} + \DeclareDefaultCaptionFont{textfont}{\@captionfont\upshape} + \captionsetup*[figure]{position=b} + \captionsetup*[table]{position=t} +} +\@ifclassloaded{beamer}{% + \caption@CheckCommand\beamer@makecaption{% + % beamerbaselocalstructure.sty,v 1.53 2007/01/28 20:48:21 tantau + \long\def\beamer@makecaption#1#2{% + \def\insertcaptionname{\csname#1name\endcsname}% + \def\insertcaptionnumber{\csname the#1\endcsname}% + \def\insertcaption{#2}% + \nobreak\vskip\abovecaptionskip\nobreak + \sbox\@tempboxa{\usebeamertemplate**{caption}}% + \ifdim \wd\@tempboxa >\hsize + \usebeamertemplate**{caption}\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \nobreak\vskip\belowcaptionskip\nobreak}} + \DeclareCaptionLabelFormat{default}{#1} + \DeclareDefaultCaptionJustification{\raggedright} + \DeclareDefaultCaptionFont{font}{% + \usebeamerfont*{caption}% + \usebeamercolor[fg]{caption}} + \DeclareDefaultCaptionFont{labelfont}{% + \usebeamercolor[fg]{caption name}% + \usebeamerfont*{caption name}} + \defbeamertemplate{caption}{caption3}{% + \caption@make\insertcaptionname\insertcaptionnumber\insertcaption} + \DeclareOption{beamer}{% + % \usebeamertemplate**{caption} will set font + \DeclareDefaultCaptionFont{font}{}% + \setbeamertemplate{caption}[caption3]} +}{} +\@ifundefined{scr@caption}{}{% + \caption@CheckCommand\@makecaption{% + % scrartcl|scrreprt|scrbook [2007/03/07 v2.97a KOMA-Script document class] + \long\def\@makecaption#1#2{% + \if@captionabove + \vskip\belowcaptionskip + \else + \vskip\abovecaptionskip + \fi + \@@makecaption\@firstofone{#1}{#2}% + \if@captionabove + \vskip\abovecaptionskip + \else + \vskip\belowcaptionskip + \fi}} + \DeclareCaptionFormat{default}{% + \ifdofullc@p + \caption@fmt@hang{#1}{#2}{#3}% + \else + #1#2% + \ifdim\cap@indent<\z@ + \par + \noindent\hspace*{-\cap@indent}% + \else\if@capbreak + \par + \fi\fi + #3\par + \fi} + \DeclareCaptionLabelSeparator{default}{\captionformat} + \DeclareDefaultCaptionFont{font}{\scr@fnt@caption} + \DeclareDefaultCaptionFont{labelfont}{\scr@fnt@captionlabel} +} +\@ifundefined{CaptionFonts}{}{% + \caption@CheckCommand\@makecaption{% + % artikel|rapport|boek [2004/06/07 v2.1a NTG LaTeX document class] + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{{\CaptionLabelFont#1:} \CaptionTextFont#2}% + \ifdim \wd\@tempboxa >\hsize + {\CaptionLabelFont#1:} \CaptionTextFont#2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}} + \DeclareDefaultCaptionFont{labelfont}{\CaptionLabelFont} + \DeclareDefaultCaptionFont{textfont}{\CaptionTextFont} +} +\@ifundefined{FB@makecaption}{}{% + \caption@CheckCommand\@makecaption{% + % frenchb.ldf [2005/02/06 v1.6g French support from the babel system] + \long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1\CaptionSeparator #2}% + \ifdim \wd\@tempboxa >\hsize + #1\CaptionSeparator #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}} + \ifx\@makecaption\STD@makecaption + \DeclareCaptionLabelSeparator{default}{\CaptionSeparator} + \def\caption@frenchb{% supress frenchb warning + \let\STD@makecaption\@makecaption + \let\FB@makecaption\@makecaption} + \else + \ifx\@makecaption\@undefined\else + \PackageInfo{caption}{% + The definition of \protect\@makecaption\space + has been changed,\MessageBreak + frenchb will NOT customize it}% + \fi + \fi +} +\@ifundefined{frenchTeXmods}{}{% + \caption@CheckCommand\@makecaption{% + % french(le).sty [2006/10/03 The french(le) package /V5,9991/] + % french(le).sty [2007/06/28 The french(le) package /V5,9994/] + \def\@makecaption#1#2{% + \ifFTY% + \def\@secondofmany##1##2\void{##2}% + \def\@tempa{\@secondofmany#2\void}% + \ifx\@tempa\empty% + \let\captionseparator\empty% + \fi% + \@mcORI{#1}{\relax\captionfont{#2}}% + \else + \@mcORI{#1}{#2}% + \fi}} + \caption@CheckCommand\@makecaption{% + % french(le).sty [2007/02/11 The french(le) package /V5,9993/] + \def\@makecaption#1#2{% + \ifFTY% + \def\@secondofmany##1##2\void{##2}% + \protected@edef\@tempa{\@secondofmany#2\void}% + \ifx\@tempa\empty% + \let\captionseparator\empty% + \fi% + \@mcORI{#1}{\relax\captionfont{#2}}% + \else + \@mcORI{#1}{#2}% + \fi}} + \DeclareDefaultCaptionFont{textfont}{\itshape}% + \DeclareCaptionLabelSeparator{default}{\captionseparator\space}% +} +\captionsetup{style=default,position=default,listof=1,listofformat=default,% twoside=\if@twoside 1\else 0\fi} +\ProcessOptions* +\caption@IfCheckCommand{% + \caption@setbool{documentclass}{1}% +}{% + \caption@setbool{documentclass}{0}% + \PackageInfo{caption}{% + Unknown document class (or package),\MessageBreak + standard defaults will be used}% + \caption@Debug{\string\@makecaption\space=\space\meaning\@makecaption\@gobble}% +} +\newcommand*\caption@addcontentsline[2]{% + \caption@iflof% + {\def\@tempa{#2}}% + {\let\@tempa\@empty}% + \ifx\@tempa\@empty \else + {\let\\\space + \addcontentsline{\csname ext@#1\endcsname}{#1}% + {\protect\numberline + {\caption@lstfmt{\@nameuse{p@#1}}{\@nameuse{the#1}}}% + {\ignorespaces #2}}}% + \fi} \newif\ifcaption@star +\newcommand*\caption@fnum[1]{% + \caption@lfmt{\@nameuse{#1name}}{\@nameuse{the#1}}{\theContinuedFloat}} \newcommand\caption@make[2]{% - \caption@@make{\caption@lfmt{#1}{#2}}} + \caption@@make{\caption@lfmt{#1}{#2}{\theContinuedFloat}}} \newcommand\caption@@make[2]{% \begingroup \caption@beginhook + \ifx\caption@maxmargin\@undefined \else + \ifdim\captionmargin>\caption@maxmargin\relax + \captionmargin\caption@maxmargin\relax + \fi + \fi + \ifx\caption@minmargin\@undefined \else + \ifdim\captionmargin<\caption@minmargin\relax + \captionmargin\caption@minmargin\relax + \fi + \fi + \caption@ifslc{\caption@ifempty@list\caption@opt@SingleLine{}{% + \caption@slc{#1}{#2}\captionwidth\relax}}{}% \caption@calcmargin - \caption@ifslc{\ifx\caption@sls\@empty\else - \caption@slc{#1}{#2}\captionwidth\relax - \fi}{}% \@tempdima\captionmargin - \ifdim\captionmargin@=\z@\else + \ifdim\captionmargin@=\z@ \else \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}% \fi - \caption@ifh{\advance\@tempdima\captionindent}% - \hskip\@tempdima + \caption@ifh{\advance\@tempdima\caption@indent}% + \hspace\@tempdima \@tempdima\captionwidth - \caption@ifh{\advance\@tempdima by -\captionindent}% + \caption@ifh{\advance\@tempdima-\caption@indent}% \captionbox\@tempdima{% \caption@ifh{% - \ifdim\captionindent=\z@ + \ifdim\caption@indent=\z@ \leavevmode \else - \hskip-\captionindent + \hskip-\caption@indent \fi}% \caption@@@make{#1}{#2}}% \@tempdima\captionmargin - \ifdim\captionmargin@=\z@\else + \ifdim\captionmargin@=\z@ \else \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}% \fi - \hskip\@tempdima + \hspace\@tempdima \caption@endhook \endgroup \global\caption@starfalse} -\newcommand\caption@calcmargin{% - \@tempdima\hsize - \ifnum\@listdepth>0\relax - \advance\@tempdima by -\leftmargin - \advance\@tempdima by -\rightmargin - \fi +\newcommand*\caption@calcmargin{% \ifdim\captionwidth=\z@ - \captionwidth\@tempdima + \captionwidth\linewidth \advance\captionwidth by -2\captionmargin \advance\captionwidth by -\captionmargin@ \else - \captionmargin\@tempdima + \captionmargin\linewidth \advance\captionmargin by -\captionwidth \divide\captionmargin by 2 \captionmargin@\z@ \fi \caption@Debug{% - \protect\hsize=\the\hsize, - \protect\margin=\the\captionmargin, - \protect\marginx=\the\captionmargin@, - \protect\width=\the\captionwidth}% + \string\hsize=\the\hsize, + \string\linewidth=\the\linewidth,\MessageBreak + \string\leftmargin=\the\leftmargin, + \string\rightmargin=\the\rightmargin,\MessageBreak + \string\margin=\the\captionmargin, + \string\margin@=\the\captionmargin@, + \string\width=\the\captionwidth}% } \newcommand\caption@slc[4]{% - \caption@startslc + \caption@Debug{Begin SLC}% + \begingroup + \expandafter\caption@setup\expandafter{\caption@opt@SingleLine}% + \let\caption@hj\@empty + \caption@calcmargin % calculate #3 if necessary + \caption@prepareslc \sbox\@tempboxa{\caption@@@make{#1}{#2}}% - \ifdim\wd\@tempboxa >#3% - \caption@endslc + \ifdim\wd\@tempboxa>#3% + \endgroup \else - \caption@endslc - \caption@esetup\caption@sls + \endgroup + \expandafter\caption@setup\expandafter{\caption@opt@SingleLine}% #4% - \fi} -\newcommand\caption@startslc{% - \begingroup - \let\label\@gobble + \fi + \caption@Debug{End SLC}} +\newcommand*\caption@prepareslc{% \let\@footnotetext\@gobble\let\@endnotetext\@gobble + \def\label{\caption@withoptargs\@gobbletwo}% \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}% - \let\caption@hj\relax} -\newcommand\caption@endslc{% - \endgroup} -\newcommand\captionbox{\parbox[b]} + \let\refstepcounter\stepcounter\let\H@refstepcounter\stepcounter} +\newcommand*\captionbox{\parbox[b]} \newcommand\caption@@@make[2]{% \sbox\@tempboxa{#1}% \ifdim\wd\@tempboxa=\z@ @@ -552,9 +1043,9 @@ {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}% {{\captiontextfont \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}% - \nobreak\hskip\z@skip + \nobreak\hskip\z@skip % enable hyphenation \caption@tfmt{#2}% - \caption@ifstrut{\@finalstrut\strutbox}{}% + \caption@ifstrut{\ifhmode\@finalstrut\strutbox\fi}{}% \par}}} \newcommand\caption@ifempty[1]{% \def\caption@tempa{#1}% @@ -563,19 +1054,97 @@ \let\caption@tempa\@empty \fi \ifx\caption@tempa\@empty - \expandafter\@firstofone + \let\caption@ifempty\@secondoftwo \else - \expandafter\@gobble - \fi} + \let\caption@ifempty\@gobbletwo + \fi + \caption@ifempty\@unused} \newcommand*\caption@@par{% - \parindent\captionparindent\hangindent\captionhangindent}% -\AtBeginDocument{% + \parindent\caption@parindent\hangindent\caption@hangindent}% +\providecommand*\DeclareFloatingEnvironment[1]{% + \@ifundefined{c@chapter}% + {\newcounter{#1}% + \@namedef{the#1}{\arabic{#1}}% + \@namedef{theH#1}{\arabic{#1}}}% + {\newcounter{#1}[chapter]% + \@namedef{the#1}{\ifnum\c@chapter>\z@ \thechapter.\fi \arabic{#1}}% + \@namedef{theH#1}{\theHchapter.\arabic{#1}}}% + \@namedef{fps@#1}{tbp}% + \@ifundefined{c@float@type}{% + \newcounter{float@type}% + \setcounter{float@type}{\@ifundefined{c@figure}14}}{}% + \expandafter\xdef\csname ftype@#1\endcsname{\the\value{float@type}}% + \addtocounter{float@type}{\value{float@type}}% + \@namedef{ext@#1}{lo#1}% + \@namedef{fnum@#1}{\@nameuse{#1name}\nobreakspace\@nameuse{the#1}}% + \newenvironment{#1}{\@float{#1}}{\end@float}% + \newenvironment{#1*}{\@dblfloat{#1}}{\end@dblfloat}% + \expandafter\newcommand\csname listof#1s\endcsname{\begingroup + \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname + \expandafter\let\expandafter\ext@figure\csname ext@#1\endcsname + \let\caption@ORI@starttoc\@starttoc + \renewcommand*\@starttoc[1]{% + \expandafter\caption@ORI@starttoc\expandafter{\ext@figure}}% + \listoffigures + \endgroup}% + \@ifundefined{l@figure}% + {\@namedef{l@#1}{\@dottedtocline{1}{1.5em}{2.3em}}}% + {\expandafter\let\csname l@#1\endcsname\l@figure}% + \expandafter\newcommand\csname #1name\endcsname{}% + \edef\@tempa{% + \def\noexpand\@tempa{\expandafter\noexpand\@car#1\@nil}}% + \uppercase\expandafter{\@tempa}% + \edef\@tempb{% + \noexpand\g@addto@macro\noexpand\@tempa{\expandafter\@cdr#1\@nil}}% + \@tempb + \expandafter\let\csname #1name\endcsname\@tempa + \expandafter\newcommand\csname list#1name\endcsname{}% + \expandafter\xdef\csname list#1name\endcsname{List of \@tempa s}% + \@cons\caption@floatlist{{#1}}} +\@onlypreamble\DeclareFloatingEnvironment +\newcommand*\caption@floatlist{} +\caption@AtBeginDocument{% \def\@tempa{\@ifstar\sf@@subref\sf@subref}% \ifx\subref\@tempa - \PackageInfo{caption3}{subref 1.2 or 1.3 detected}% + \PackageInfo{caption3}{subfig package 1.2 or 1.3 is loaded\@gobble}% + \let\caption@setfloattype\@gobble + \let\sf@ifpositiontop\caption@iftop + \def\@dottedxxxline#1#2#3#4#5#6#7{% + \begingroup + \caption@setfloattype{#1}% + \caption@setoptions{subfloat}% + \caption@setoptions{sub#1}% + \ifnum #3>\@nameuse{c@#2depth}\else + \@dottedtocline{\z@}{#4}{#5}{#6}{#7}% + \fi + \endgroup}% + \let\sf@subfloat\sf@NEW@subfloat \DeclareRobustCommand*\subref{\@ifstar\sf@@subref\sf@subref}% + \caption@removefromoptlist{subfloat}% + \caption@removefromoptlist{subfigure}% + \caption@removefromoptlist{subtable}% \fi -} + \let\sf@NEW@subfloat\@undefined} +\def\sf@NEW@subfloat{% + \begingroup + \caption@setfloattype\@captype + \sf@ifpositiontop{% + \maincaptiontoptrue + }{% + \maincaptiontopfalse + }% + \caption@setoptions{subfloat}% + \caption@setoptions{sub\@captype}% + \let\sf@oldlabel=\label + \let\label=\subfloat@label + \ifmaincaptiontop\else + \advance\@nameuse{c@\@captype}\@ne + \fi + \refstepcounter{sub\@captype}% + \setcounter{sub\@captype @save}{\value{sub\@captype}}% + \@ifnextchar [% %] match left bracket + {\sf@@subfloat}% + {\sf@@subfloat[\@empty]}}% \endinput %% %% End of file `caption3.sty'. |