From 2034f98ccd2647b427b70c8ecd1fb430e9e1592e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 19 Oct 2007 17:53:31 +0000 Subject: caption 3.1c git-svn-id: svn://tug.org/texlive/trunk@5235 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/caption/caption.sty | 195 ++++++++++++----------- Master/texmf-dist/tex/latex/caption/caption3.sty | 71 ++++++--- 2 files changed, 148 insertions(+), 118 deletions(-) (limited to 'Master/texmf-dist/tex/latex/caption') diff --git a/Master/texmf-dist/tex/latex/caption/caption.sty b/Master/texmf-dist/tex/latex/caption/caption.sty index 0c3426c8bcc..06e20a785ed 100644 --- a/Master/texmf-dist/tex/latex/caption/caption.sty +++ b/Master/texmf-dist/tex/latex/caption/caption.sty @@ -28,10 +28,10 @@ %% caption-eng.tex, and caption-rus.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2007/09/22 v3.1b Customising captions (AR)] +\ProvidesPackage{caption}[2007/10/17 v3.1c Customising captions (AR)] \newcommand*\caption@Info[1]{\PackageInfo{caption}{#1\@gobble}} \@onlypreamble\caption@Info -\RequirePackage{caption3}[2007/09/16] % needs v3.1a or newer +\RequirePackage{caption3}[2007/10/17] % needs v3.1c or newer \@ifpackageloaded{caption2}{% \caption@Error{% You can't use both, the (obsolete) caption2 *and*\MessageBreak @@ -68,7 +68,7 @@ } \@ifundefined{@captionheadfont}{}{% \caption@Info{AMS or SMF document class}% - \setlength\belowcaptionskip{0pt}% set to 3pc by AMS class + \setlength\belowcaptionskip{0pt}% set to 12pt by AMS class } \@ifundefined{scr@caption}{}{% \caption@Info{KOMA-Script document class}% @@ -114,7 +114,7 @@ \ifx\\#1\\\else \@ifundefined{cap@margin}{}{% \def\@tempa{captionbeside}% - \ifx\@tempa\@currenvir\else\PackageWarning{caption}{% + \ifx\@tempa\@currenvir\else\caption@Warning{% Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}% \fi}% \fi @@ -153,7 +153,7 @@ \DeclareCaptionOption*{config}[caption]{% \InputIfFileExists{#1.cfg}% {\typeout{*** Local configuration file #1.cfg used ***}}% - {\PackageWarning{caption}{Configuration file #1.cfg not found}}} + {\caption@Warning{Configuration file #1.cfg not found}}} \DeclareCaptionOption{figureposition}{% \captionsetup*[figure]{position=#1}} \@onlypreamble@key{caption}{figureposition} @@ -184,51 +184,51 @@ \@onlypreamble\caption@SetFloatName \DeclareCaptionOption{compatibility}[1]{\caption@setbool{compatibility}{#1}} \@onlypreamble@key{caption}{compatibility} -\DeclareCaptionOption*{normal}[]{% +\DeclareCaptionOptionNoValue*{normal}{% \caption@setformat{normal}% \caption@setjustification{justified}} -\DeclareCaptionOption*{isu}[]{% +\DeclareCaptionOptionNoValue*{isu}{% \caption@setformat{hang}% \caption@setjustification{justified}} -\DeclareCaptionOption*{hang}[]{% +\DeclareCaptionOptionNoValue*{hang}{% \caption@setformat{hang}% \caption@setjustification{justified}} -\DeclareCaptionOption*{center}[]{% +\DeclareCaptionOptionNoValue*{center}{% \caption@setformat{normal}% \caption@setjustification{centering}} -\DeclareCaptionOption*{anne}[]{% +\DeclareCaptionOptionNoValue*{anne}{% \caption@setformat{normal}% \caption@setjustification{centerlast}} -\DeclareCaptionOption*{centerlast}[]{% +\DeclareCaptionOptionNoValue*{centerlast}{% \caption@setformat{normal}% \caption@setjustification{centerlast}} -\DeclareCaptionOption*{scriptsize}[]{\def\captionfont{\scriptsize}} -\DeclareCaptionOption*{footnotesize}[]{\def\captionfont{\footnotesize}} -\DeclareCaptionOption*{small}[]{\def\captionfont{\small}} -\DeclareCaptionOption*{normalsize}[]{\def\captionfont{\normalsize}} -\DeclareCaptionOption*{large}[]{\def\captionfont{\large}} -\DeclareCaptionOption*{Large}[]{\def\captionfont{\Large}} -\DeclareCaptionOption*{up}[]{\l@addto@macro\captionlabelfont\upshape} -\DeclareCaptionOption*{it}[]{\l@addto@macro\captionlabelfont\itshape} -\DeclareCaptionOption*{sl}[]{\l@addto@macro\captionlabelfont\slshape} -\DeclareCaptionOption*{sc}[]{\l@addto@macro\captionlabelfont\scshape} -\DeclareCaptionOption*{md}[]{\l@addto@macro\captionlabelfont\mdseries} -\DeclareCaptionOption*{bf}[]{\l@addto@macro\captionlabelfont\bfseries} -\DeclareCaptionOption*{rm}[]{\l@addto@macro\captionlabelfont\rmfamily} -\DeclareCaptionOption*{sf}[]{\l@addto@macro\captionlabelfont\sffamily} -\DeclareCaptionOption*{tt}[]{\l@addto@macro\captionlabelfont\ttfamily} -\DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}} +\DeclareCaptionOptionNoValue*{scriptsize}{\def\captionfont{\scriptsize}} +\DeclareCaptionOptionNoValue*{footnotesize}{\def\captionfont{\footnotesize}} +\DeclareCaptionOptionNoValue*{small}{\def\captionfont{\small}} +\DeclareCaptionOptionNoValue*{normalsize}{\def\captionfont{\normalsize}} +\DeclareCaptionOptionNoValue*{large}{\def\captionfont{\large}} +\DeclareCaptionOptionNoValue*{Large}{\def\captionfont{\Large}} +\DeclareCaptionOptionNoValue*{up}{\l@addto@macro\captionlabelfont\upshape} +\DeclareCaptionOptionNoValue*{it}{\l@addto@macro\captionlabelfont\itshape} +\DeclareCaptionOptionNoValue*{sl}{\l@addto@macro\captionlabelfont\slshape} +\DeclareCaptionOptionNoValue*{sc}{\l@addto@macro\captionlabelfont\scshape} +\DeclareCaptionOptionNoValue*{md}{\l@addto@macro\captionlabelfont\mdseries} +\DeclareCaptionOptionNoValue*{bf}{\l@addto@macro\captionlabelfont\bfseries} +\DeclareCaptionOptionNoValue*{rm}{\l@addto@macro\captionlabelfont\rmfamily} +\DeclareCaptionOptionNoValue*{sf}{\l@addto@macro\captionlabelfont\sffamily} +\DeclareCaptionOptionNoValue*{tt}{\l@addto@macro\captionlabelfont\ttfamily} +\DeclareCaptionOptionNoValue*{nooneline}{\caption@setbool{slc}{0}} \caption@setbool{ruled}{0} -\DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}} -\DeclareCaptionOption*{flushleft}[]{% +\DeclareCaptionOptionNoValue*{ruled}{\caption@setbool{ruled}{1}} +\DeclareCaptionOptionNoValue*{flushleft}{% \caption@setformat{normal}% \caption@setjustification{raggedright}} -\DeclareCaptionOption*{flushright}[]{% +\DeclareCaptionOptionNoValue*{flushright}{% \caption@setformat{normal}% \caption@setjustification{raggedleft}} -\DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}} -\DeclareCaptionOption*{ignoreLTcapwidth}[]{% - \PackageWarning{caption}{Obsolete option `ignoreLTcapwidth' ignored}} +\DeclareCaptionOptionNoValue*{oneline}{\caption@setbool{slc}{1}} +\DeclareCaptionOptionNoValue*{ignoreLTcapwidth}{% + \caption@Warning{Obsolete option `ignoreLTcapwidth' ignored}} \DeclareCaptionOption*{caption}{% \caption@setbool{temp}{#1}% \caption@ifbool{temp}{}{% @@ -262,9 +262,8 @@ \@ifundefined{@#1captype}{}{% \edef\@tempa{#3}% \expandafter\ifx\csname @#1captype\endcsname\@tempa \else - \caption@iftypewarning{% - \PackageWarning{caption}{% - Caption type was already set to `#3'\MessageBreak}}{}% + \caption@iftypewarning{\caption@Warning{% + Caption type was already set to `#3'\MessageBreak}}{}% \fi}% \expandafter\edef\csname @#1captype\endcsname{#3}% \let\caption@iftypewarning\caption@ifdebug @@ -301,14 +300,12 @@ \newcommand*\caption@undefinedlabel{??} \newcommand*\caption@xlabel[2]{% \ifx\@currentlabel\caption@undefinedlabel - \PackageWarning{caption}{\noexpand\label before \noexpand\caption ignored}% + \caption@Warning{\noexpand\label before \noexpand\caption ignored}% \else \caption@ORI@label#1{#2}% \fi} \def\captionof{\caption@teststar\caption@of{\caption*}\caption} -\newcommand*\caption@of[2]{% - \let\caption@setfloatcapt\@firstofone - \caption@settype*{#2}#1} +\newcommand*\caption@of[2]{\caption@settype*{#2}#1} \newcommand*\captionlistentry{% \@testopt\caption@listentry\@captype} \def\caption@listentry[#1]#2{% @@ -316,10 +313,11 @@ \caption@makecurrent{#1}{#2}% \caption@addcontentsline{#1}{#2}} \def\ContinuedFloat{% - \caption@iftype - {\addtocounter\@captype\m@ne - \caption@ContinuedFloat\@captype}% - {\caption@Error{\noexpand\ContinuedFloat outside float}}} + \@ifnextchar[\@ContinuedFloat{% + \caption@iftype + {\addtocounter\@captype\m@ne + \caption@ContinuedFloat\@captype}% + {\caption@Error{\noexpand\ContinuedFloat outside float}}}} \def\caption@ContinuedFloat#1{% \edef\@tempa{#1}% \ifx\@tempa\caption@CFtype \else @@ -330,6 +328,7 @@ \caption@setoptions{ContinuedFloat}% \caption@setoptions{continued#1}% \let\caption@resetContinuedFloat\@gobble} +\def\@ContinuedFloat[#1]{\addtocounter{#1}\m@ne} \newcounter{ContinuedFloat} \newcommand*\caption@CFtype{??} \newcommand*\caption@@ContinuedFloat[1]{} @@ -383,7 +382,6 @@ \caption@font*{\KV@caption@fnt@normal\@unused}} \let\caption@setfloatcapt\@firstofone \newcommand*\caption@makecurrent[2]{} -\let\caption@makestart\@gobble \let\caption@@anchor\@firstofone \let\caption@start\relax \let\caption@@start\relax @@ -594,7 +592,7 @@ {\let\@tempa\@gobble}% suppress warning \caption@ifcompatibility{% \@tempa{% - \PackageWarningNoLine{caption}{% + \caption@WarningNoLine{% \noexpand\caption will not be redefined since it's already\MessageBreak redefined by a document class or package which is\MessageBreak unknown to the caption package.\MessageBreak @@ -619,11 +617,11 @@ \newcommand*\caption@star[2]{#1#2}% }{% \caption@ifincompatible{% - \PackageWarning{caption}{% + \caption@WarningNoLine{% Forced redefinition of \noexpand\caption since the\MessageBreak unsupported(!) package option `compatibility=false'\MessageBreak was given. Please fasten your seat belts, as we may\MessageBreak - experience turbulence!\@gobbletwo}% + experience turbulence}% }{}% \def\caption{% \caption@iftype @@ -754,17 +752,15 @@ \def\captionsetup##1{% \caption@g@addto@list\caption@SCsetup{##1}% \caption@setup{##1}}% + \let\caption@ORI\caption \def\caption{% - \let\captionsetup\@gobble - \caption@star - {\let\caption@ORI@refstepcounter\caption@@refstepcounter - \def\caption@@refstepcounter########1{% - \advance\csname c@########1\endcsname\@ne\relax}% - \caption@refstepcounter\@captype - \let\caption@@refstepcounter\caption@ORI@refstepcounter}% - {\caption@dblarg\@caption@SC}}% - \def\@caption@SC[##1]##2{% - \gdef\caption@SClentry{##1}\gdef\caption@SCtext{##2}% + \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}% + \long\def\@caption##1[##2]##3{% + \gdef\caption@SClentry{##2}\gdef\caption@SCtext{##3}% \ignorespaces}% #1{% is \@gobble in star form, and \@firstofone otherwise \def\label##1{\gdef\caption@SClabel{##1}\ignorespaces}}% @@ -861,6 +857,7 @@ \caption@ORI@floatingtable}% \newcommand*\caption@floatflt[1]{% \caption@settype{#1}% + \caption@clearmargin \caption@setoptions{floating#1}% \let\caption@boxrestore\@parboxrestore}% }{} @@ -875,9 +872,10 @@ \def\@captype{#1}% \let\FP@LabelText\@empty \begin{lrbox}{\FP@floatCorpusBOX}% - \caption@ifFPrefcap\caption@freeze{% - \def\label##1{\gdef\FP@LabelText{##1}\ignorespaces}% - \caption@freeze*}}% + \caption@ifFPrefcap + {\caption@freeze\relax}% + {\def\label##1{\gdef\FP@LabelText{##1}\ignorespaces}% + \caption@freeze*}}% \renewcommand*\FP@floatEnd{% \end{lrbox}% \stepcounter{FP@\@captype C}% @@ -928,7 +926,7 @@ } \caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{% \@ifundefined{hyper@makecurrent}{% hyperref has stopped early - \PackageWarningNoLine{caption}{% + \caption@WarningNoLine{% Hyperref support is turned off\MessageBreak because hyperref has stopped early}% }{% @@ -936,17 +934,11 @@ \renewcommand*\caption@@refstepcounter{\H@refstepcounter}% \renewcommand*\caption@makecurrent[2]{% \caption@makecurrentHref{#1}% - \caption@Debug{hyper current=\@currentHref}% + \caption@Debug{hyperref current=\@currentHref}% \def\@currentlabelname{#2}}% \newcommand*\caption@makecurrentHref{\hyper@makecurrent}% - \renewcommand*\caption@makestart[1]{% - \begingroup - \Hy@hypertexnamesfalse - \hyper@makecurrent{#1.xxx}% - \endgroup - \caption@Debug{hyper start=\@currentHref}}% \renewcommand\caption@@anchor[1]{% - \caption@Debug{hyper anchor: \@currentHref}% + \caption@Debug{hyperref anchor: \@currentHref}% % If we cannot have nesting, the anchor is empty. \ifHy@nesting \hyper@@anchor{\@currentHref}{#1}% @@ -954,23 +946,6 @@ \Hy@raisedlink{\hyper@@anchor{\@currentHref}{\relax}}#1% \fi}% \g@addto@macro\caption@prepareslc{\let\caption@@anchor\@firstofone}% - \newcommand*\caption@startanchor[1]{% - \caption@Debug{hyper anchor: #1}% - \ifvmode\begingroup - \@tempdima\prevdepth - \nointerlineskip - \vspace*{-\caption@hypcapspace}% - \caption@anchor{#1}% - \vspace*{\caption@hypcapspace}% - \prevdepth\@tempdima - \endgroup\else - \PackageWarning{caption}{Internal Warning: Vertical TeX mode expected}% - \caption@anchor{#1}% - \fi}% - \newcommand*\caption@anchor[1]{% - \ifmeasuring@ \else - \Hy@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}% - \fi}% \renewcommand*\caption@@ContinuedFloat[1]{% \@ifundefined{theH#1}{}{% \expandafter\l@addto@macro\csname theH#1\endcsname{% @@ -985,17 +960,43 @@ \global\@capstartfalse \global\let\@currentHref\hc@currentHref}% \let\caption@@anchor\@firstofone -%%% \let\caption@startanchor\@gobble }{}}% + \newcommand*\caption@makestart[1]{% + \begingroup + \Hy@hypertexnamesfalse + \hyper@makecurrent{#1.caption}% + \endgroup + \caption@Debug{hypcap start=\@currentHref}}% + \newcommand*\caption@startanchor[1]{% + \caption@Debug{hypcap anchor: #1}% + \ifvmode\begingroup + \@tempdima\prevdepth + \nointerlineskip + \vspace*{-\caption@hypcapspace}% + \caption@anchor{#1}% + \vspace*{\caption@hypcapspace}% + \prevdepth\@tempdima + \endgroup\else + \caption@Warning{Internal Warning: Vertical TeX mode expected}% + \caption@anchor{#1}% + \fi}% + \newcommand*\caption@anchor[1]{% + \ifmeasuring@ \else + \caption@raisedlink{\hyper@anchorstart{#1}\hyper@anchorend}% + \fi}% + \ifx\HyperRaiseLinkLength\@tempdima + \def\caption@raisedlink#1{\ifvmode#1\else\Hy@raisedlink{#1}\fi}% + \else + \let\caption@raisedlink\Hy@raisedlink + \fi \def\caption@@start{% \@ifundefined{hc@currentHref}{% - \PackageWarning{caption}{% + \caption@Warning{% The option `hypcap=true' will be ignored for this\MessageBreak particular \string\caption}}{}}% \def\caption@freezeHref{% \let\caption@ORI@start\caption@start \def\caption@start{\let\caption@start\caption@ORI@start}% - \let\caption@ORI@@start\caption@@start \global\let\caption@currentHref\@undefined \def\caption@@start{\global\let\caption@currentHref\@currentHref}% \let\caption@ORI@setfloatcapt\caption@setfloatcapt @@ -1023,6 +1024,7 @@ \let\capstart\caption@start \let\caption@start\relax \let\caption@@start\relax + \caption@@setbool\caption@ifhypcap1% \renewcommand*\caption@hypcapspace{\hypcapspace}% \@ifundefined{Hy@float@makebox}{}{% \caption@Debug{% @@ -1093,11 +1095,12 @@ \caption@window{table}% \caption@setoptions{tabwindow}% \begin{window}[#1,#2,{#3},\caption@wincaption{#4}] }% - \newcommand*\caption@window{% + \newcommand*\caption@window[1]{% \let\caption@boxrestore\@parboxrestore \let\@makecaption\caption@@make \caption@setautoposition b% - \caption@settype}% + \caption@settype{#1}% + \caption@clearmargin}% \newcommand\caption@wincaption[1]{% \ifdim\picwd=\z@ \let\caption@makecurrent\@gobbletwo @@ -1184,7 +1187,9 @@ \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 \caption@settype*{#2}% \caption@freeze*}% \let\caption@ORI@endSC@FLOAT\endSC@FLOAT @@ -1193,7 +1198,7 @@ \def\caption@settype##1{% will be done in \@xfloat \caption@ORI@settype*{##1}% do not change \@currentlabel \caption@setSC@justify - \caption@setoptions{SCfloat}% +%%% \caption@setoptions{SCfloat}% \caption@setoptions{SC\@captype}% \caption@start}% \def\caption@setSC@justify{% @@ -1311,8 +1316,8 @@ \else \float@dostyle{#1}% \fi}{}% - \caption@clearmargin - \caption@setoptions{wrapfloat}% + \caption@clearmargin +%%% \caption@setoptions{wrapfloat}% \caption@setoptions{wrap#1}% \@nameuse{caption@ORI@wrap#1}}% \caption@restylewrapfloat{figure}% diff --git a/Master/texmf-dist/tex/latex/caption/caption3.sty b/Master/texmf-dist/tex/latex/caption/caption3.sty index 4bc31c25115..7d89e2f142e 100644 --- a/Master/texmf-dist/tex/latex/caption/caption3.sty +++ b/Master/texmf-dist/tex/latex/caption/caption3.sty @@ -28,7 +28,7 @@ %% caption-eng.tex, and caption-rus.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2007/09/22 v3.1b caption3 kernel (AR)] +\ProvidesPackage{caption3}[2007/10/17 v3.1c caption3 kernel (AR)] \providecommand*\@nameundef[1]{% \expandafter\let\csname #1\endcsname\@undefined} \providecommand\l@addto@macro[2]{% @@ -153,12 +153,16 @@ \caption@@begindocumenthook \let\caption@@begindocumenthook\@undefined \PackageInfo{caption}{End \noexpand\AtBeginDocument code\@gobble}} +\newcommand*\caption@Warning[1]{\caption@WarningNoLine{#1\on@line}} +\newcommand*\caption@WarningNoLine[1]{\PackageWarning{caption}{#1.^^J\caption@wh\@gobbletwo}} \newcommand*\caption@Error[1]{\PackageError{caption}{#1}\caption@eh} \let\caption@KV@err\caption@Error +\newcommand*\caption@wh{% + See the caption package documentation for explanation.} \newcommand*\caption@eh{% If you do not understand this error, please take a closer look\MessageBreak - at the documentation of the `caption' package.\MessageBreak - \@ehc} + at the documentation of the `caption' package, especially the\MessageBreak + section about errors.\MessageBreak\@ehc} \RequirePackage{keyval}[1997/11/10] \providecommand*\undefine@key[2]{% \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}} @@ -171,6 +175,20 @@ \newcommand*\caption@declareoption[2]{% #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}} \@onlypreamble\caption@declareoption +\newcommand*\DeclareCaptionOptionNoValue{% + \caption@teststar\caption@declareoption@novalue\AtEndOfPackage\@gobble} +\@onlypreamble\DeclareCaptionOptionNoValue +\newcommand\caption@declareoption@novalue[3]{% + \caption@declareoption{#1}{#2}[\KV@err]{% + \caption@option@novalue{#2}{##1}{#3}}} +\@onlypreamble\caption@declareoption@novalue +\newcommand*\caption@option@novalue[2]{% + \ifx\KV@err#2% + \expandafter\@firstofone + \else + \KV@err{No value allowed for #1}% + \expandafter\@gobble + \fi} \newcommand*\captionsetup{% \caption@teststar\@captionsetup\@gobble\@firstofone} \newcommand*\@captionsetup[1]{% @@ -187,7 +205,7 @@ \@testopt\@@clearcaptionsetup{}} \def\@@clearcaptionsetup[#1]#2{% \expandafter\caption@ifempty@list\csname caption@opt@#2\endcsname - {\caption@tempa{\PackageWarning{caption}{Option list `#2' undefined}}}% + {\caption@tempa{\caption@Warning{Option list `#2' undefined}}}% {\ifx,#1,% \caption@clearsetup{#2}% \else @@ -215,9 +233,8 @@ \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}}} + \caption@tempa{\caption@Warning{% + Option `#1' was not in list `#2'\MessageBreak}}} \newcommand*\showcaptionsetup[2][\@firstofone]{% \GenericWarning{}{% #1 Caption Info: KV list on `#2'\MessageBreak @@ -327,7 +344,7 @@ \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}% + \caption@Warning{Reference on page \thepage \space undefined}% \else \expandafter\let\expandafter\caption@thepage\csname caption@r@#1\endcsname \fi} @@ -414,24 +431,29 @@ singlelinecheck=1,strut=1}% \caption@clearsetup{SingleLine}} \DeclareCaptionStyle{base}[indent=0pt,justification=centering]{} -\DeclareCaptionStyle{default}[indent=0pt,justification=centering,format=plain]{% +\DeclareCaptionStyle{default}[indent=0pt,justification=centering]{% format=default,labelsep=default,textformat=default,% justification=default,font=default,labelfont=default,textfont=default} -\newcommand\DeclareCaptionFormat{% +\newcommand*\DeclareCaptionFormat{% \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}} +\newcommand*\caption@declareformat[2]{% + \@dblarg{\caption@@declareformat#1{#2}}} \@onlypreamble\caption@declareformat +\long\def\caption@@declareformat#1#2[#3]#4{% + \global\expandafter\let\csname caption@ifh@#2\endcsname#1% + \global\long\@namedef{caption@slfmt@#2}##1##2##3{#3}% + \global\long\@namedef{caption@fmt@#2}##1##2##3{#4}} +\@onlypreamble\caption@@declareformat \DeclareCaptionOption{format}{\caption@setformat{#1}} \newcommand*\caption@setformat[1]{% \@ifundefined{caption@fmt@#1}% {\caption@Error{Undefined format `#1'}}% {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname + \expandafter\let\expandafter\caption@slfmt\csname caption@slfmt@#1\endcsname \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} \DeclareCaptionFormat{plain}{#1#2#3\par} -\DeclareCaptionFormat{hang}{% +\DeclareCaptionFormat{hang}[#1#2#3\par]{% \caption@ifin@list\caption@lsepcrlist\caption@lsepname {\caption@Error{% The option `labelsep=\caption@lsepname' does not work\MessageBreak @@ -604,7 +626,7 @@ \caption@AtBeginDocument{% \@ifundefined{caption@r@ragged2e}{% \newcommand*\caption@@ragged{% - \PackageWarning{caption}{% + \caption@Warning{% `ragged2e' support has been changed.\MessageBreak Rerun to get captions right}% \global\let\caption@ragged\@secondoftwo % suppress further warnings @@ -617,7 +639,7 @@ }{% \newcommand*\caption@@ragged[2]{% \@ifundefined{caption\string#1}{% - \PackageWarning{caption}{% + \caption@Warning{% `ragged2e' package not loaded, therefore\MessageBreak substituting \string#2 for \string#1\MessageBreak}% \global\@namedef{caption\string#1}}{}% @@ -771,7 +793,7 @@ \fi \relax }} - \let\captionmargin\captionindent + \let\captionmargin\captionindent % set to 3pc by AMS class \begingroup\edef\@tempa{\endgroup \noexpand\caption@g@addto@list\noexpand\caption@sty@default {margin=\the\captionmargin @@ -831,7 +853,7 @@ \else \vskip\belowcaptionskip \fi}} - \DeclareCaptionFormat{default}{% + \DeclareCaptionFormat{default}[#1#2#3\par]{% \ifdofullc@p \caption@ifin@list\caption@lsepcrlist\caption@lsepname {\caption@Error{% @@ -967,8 +989,7 @@ \captionmargin\caption@minmargin\relax \fi \fi - \caption@ifslc{\caption@ifempty@list\caption@opt@SingleLine{}{% - \caption@slc{#1}{#2}\captionwidth\relax}}{}% + \caption@ifslc{\caption@slc{#1}{#2}\captionwidth\relax}{}% \caption@calcmargin \@tempdima\captionmargin \ifdim\captionmargin@=\z@ \else @@ -1017,7 +1038,7 @@ \newcommand\caption@slc[4]{% \caption@Debug{Begin SLC}% \begingroup - \expandafter\caption@setup\expandafter{\caption@opt@SingleLine}% + \caption@SingleLine \let\caption@hj\@empty \caption@calcmargin % calculate #3 if necessary \caption@prepareslc @@ -1026,15 +1047,19 @@ \endgroup \else \endgroup - \expandafter\caption@setup\expandafter{\caption@opt@SingleLine}% + \caption@SingleLine #4% \fi \caption@Debug{End SLC}} +\newcommand*\caption@SingleLine{% + \expandafter\caption@setup\expandafter{\caption@opt@SingleLine}% + \let\caption@fmt\caption@slfmt} \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\stepcounter\caption@l@stepcounter \let\refstepcounter\stepcounter\let\H@refstepcounter\stepcounter} +\newcommand*\caption@l@stepcounter[1]{\advance\csname c@#1\endcsname\@ne\relax} \newcommand*\captionbox{\parbox[b]} \newcommand\caption@@@make[2]{% \sbox\@tempboxa{#1}% -- cgit v1.2.3