From 5183558ea817194c76ec71a3c8310ae6f06f5a69 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 31 May 2006 16:48:45 +0000 Subject: caption 3.0j git-svn-id: svn://tug.org/texlive/trunk@1627 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/caption/caption.sty | 275 ++++++++++++++--------- Master/texmf-dist/tex/latex/caption/caption2.sty | 18 +- Master/texmf-dist/tex/latex/caption/caption3.sty | 236 ++++++++++--------- 3 files changed, 303 insertions(+), 226 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 506c95edab5..1e5324db58b 100644 --- a/Master/texmf-dist/tex/latex/caption/caption.sty +++ b/Master/texmf-dist/tex/latex/caption/caption.sty @@ -6,7 +6,7 @@ %% %% caption.dtx (with options: `package') %% -%% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfeldt.net) +%% Copyright (C) 1994-2006 Axel Sommerfeldt (caption@sommerfee.de) %% %% -------------------------------------------------------------------------- %% @@ -23,21 +23,19 @@ %% This Current Maintainer of this work is Axel Sommerfeldt. %% %% This work consists of the files caption.ins, caption.dtx, -%% caption2.dtx, caption.xml, and anleitung.tex and the derived files +%% caption2.dtx, and anleitung.tex and the derived files %% caption.sty, caption2.sty, caption3.sty, and manual.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2005/06/28 v3.0g Customising captions (AS)] -\RequirePackage{caption3} -\DeclareCaptionOption{type}{\def\@captype{#1}}% new v3.0d -\newcommand*\caption@floatname[1]{\@nameuse{#1name}} -\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}}% new v3.0a -\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}}% new v3.0a +\ProvidesPackage{caption}[2006/03/21 v3.0j Customising captions (AR)] +\RequirePackage{caption3}[2006/01/12] % needs v3.0i or newer \DeclareCaptionOption{config}[caption]{% \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file #1.cfg used ***}}% {\PackageWarning{caption}{Configuration file #1.cfg not found}}} +\DeclareCaptionOption*{figureposition}{\captionsetup[figure]{position=#1}} +\DeclareCaptionOption*{tableposition}{\captionsetup[table]{position=#1}} \DeclareCaptionOption*{normal}[]{\caption@setformat{normal}} \DeclareCaptionOption*{isu}[]{\caption@setformat{hang}} \DeclareCaptionOption*{hang}[]{\caption@setformat{hang}} @@ -62,57 +60,68 @@ \DeclareCaptionOption*{nooneline}[]{\caption@setbool{slc}{0}} \caption@setbool{ruled}{0} \DeclareCaptionOption*{ruled}[]{\caption@setbool{ruled}{1}} -\newcommand*\DeclareCaptionPackage[1]{% +\DeclareCaptionOption*{flushleft}[]{\caption@setjustification{raggedright}} +\DeclareCaptionOption*{flushright}[]{\caption@setjustification{raggedleft}} +\DeclareCaptionOption*{oneline}[]{\caption@setbool{slc}{1}} +\DeclareCaptionOption*{ignoreLTcapwidth}[]{} +\@ifundefined{scr@caption}{}{% + \DeclareCaptionOption*{onelinecaption}[]{\onelinecaptionstrue} + \DeclareCaptionOption*{noonelinecaption}[]{\onelinecaptionsfalse} + \DeclareCaptionOption*{tablecaptionabove}[]{\captionsetup[table]{position=t}} + \DeclareCaptionOption*{tablecaptionbelow}[]{\captionsetup[table]{position=b}} + \def\onelinecaptionstrue{\caption@setbool{slc}{1}} + \def\onelinecaptionsfalse{\caption@setbool{slc}{0}} + \def\captionabove{% + \caption@setposition{t}\let\caption@setposition\@gobble + \scr@caption} + \def\captionbelow{% + \caption@setposition{b}\let\caption@setposition\@gobble +\scr@caption} +} +\newcommand*\caption@declarepackage[1]{% \caption@setbool{pkt@#1}{1}% \DeclareCaptionOption*{#1}{\caption@setbool{pkt@#1}{##1}}} -\AtEndOfPackage{\let\DeclareCaptionPackage\@undefined} +\AtEndOfPackage{\let\caption@declarepackage\@undefined} \newcommand\caption@ifpackage[3]{% \caption@ifbool{pkt@#1}{% \@ifundefined{#2}% - {\let\next\AtBeginDocument}% - {\let\next\@firstofone}% + {\let\caption@tempa\AtBeginDocument}% + {\let\caption@tempa\@firstofone}% }{% - \let\next\@gobble + \let\caption@tempa\@gobble }% - \ifodd\caption@debug\relax - \edef\caption@tempa{% - \caption@ifbool{pkt@#1}{% - \@ifundefined{#2}{AtBeginDocument}{firstofone}% - }{gobble}}% - \PackageInfo{caption}{#1 = \caption@ifbool{pkt@#1}{1}{0} % - (\@ifundefined{#2}{not }{}loaded -> \caption@tempa)}% - \fi - \@nameundef{caption@ifpkt@#1}% bugfixed v3.0a - \next{% - \expandafter\ifx\csname #2\endcsname\relax - \else - #3 - \fi}} + \caption@tempa{\@ifundefined{#2}{}{#3}}% + \caption@undefbool{pkt@#1}} \AtEndOfPackage{\let\caption@ifpackage\@undefined} -\DeclareCaptionPackage{caption} -\DeclareCaptionPackage{float} -\DeclareCaptionPackage{floatrow} -\DeclareCaptionPackage{hyperref} -\DeclareCaptionPackage{hypcap} -\DeclareCaptionPackage{listings} -\DeclareCaptionPackage{longtable} -\DeclareCaptionPackage{rotating} -\DeclareCaptionPackage{sidecap} -\DeclareCaptionPackage{supertabular} -\def\ProcessOptionsWithKV#1{% bugfixed v3.0a +\caption@declarepackage{caption} +\caption@declarepackage{float} +\caption@declarepackage{floatrow} +\caption@declarepackage{hyperref} +\caption@declarepackage{hypcap} +\caption@declarepackage{listings} +\caption@declarepackage{longtable} +\caption@declarepackage{picins} +\caption@declarepackage{rotating} +\caption@declarepackage{sidecap} +\caption@declarepackage{supertabular} +\def\ProcessOptionsWithKV#1{% \let\@tempc\relax \let\caption@tempa\@empty \@for\CurrentOption:=\@classoptionslist\do{% - \@ifundefined{KV@#1@\CurrentOption}% - {}% - {% - \edef\caption@tempa{\caption@tempa,\CurrentOption,}% - \@expandtwoargs\@removeelement\CurrentOption - \@unusedoptionlist\@unusedoptionlist + \@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 + }% }% }% \edef\caption@tempa{% - \noexpand\setkeys{#1}{% + \noexpand\caption@setkeys{#1}{% \caption@tempa\@ptionlist{\@currname.\@currext}% }% }% @@ -120,20 +129,26 @@ \let\CurrentOption\@empty \AtEndOfPackage{\let\@unprocessedoptions\relax}} \ProcessOptionsWithKV{caption} -\let\ProcessOptionsWithKV\@undefined \caption@ifbool{pkt@caption}{}{\endinput} -\@nameundef{caption@ifpkt@caption} +\caption@undefbool{pkt@caption} \def\captionof{\@ifstar{\caption@of{\caption*}}{\caption@of\caption}} \newcommand*\caption@of[2]{\def\@captype{#2}#1} +\DeclareCaptionOption{type}{\def\@captype{#1}} \providecommand\ContinuedFloat{% - \ifx\@captype\@undefined - \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd - \else - \addtocounter\@captype\m@ne - \caption@ContinuedFloat\@captype - \fi}% + \@ifnextchar[%] + \@ContinuedFloat + {\ifx\@captype\@undefined + \@latex@error{\noexpand\ContinuedFloat outside float}\@ehd + \else + \@ContinuedFloat[\@captype]% + \fi}} +\def\@ContinuedFloat[#1]{% + \addtocounter{#1}\m@ne + \caption@ContinuedFloat{#1}% + \caption@@ContinuedFloat{#1}} \let\caption@ContinuedFloat\@gobble \let\caption@resetContinuedFloat\@gobble +\providecommand*\caption@@ContinuedFloat[1]{} \newcommand*\caption@begin[1]{% \caption@resetContinuedFloat{#1}% \begingroup @@ -143,52 +158,68 @@ \caption@lfmt{\caption@floatname{#1}}{\@nameuse{the#1}}}% \fi \caption@fixposition - \global\let\caption@fixedposition\caption@position - \caption@@begin{#1}} -\newcommand*\caption@beginex[1]{% + \global\let\caption@fixedposition\caption@position} +\newcommand\caption@beginex[2]{% \caption@begin{#1}% - \caption@preparelof} + \caption@iflof% + {\def\caption@tempa{#2}}% + {\let\caption@tempa\@empty}% + \ifx\caption@tempa\@empty + \long\def\addcontentsline##1##2##3{}% + \fi} \newcommand*\caption@end{% - \caption@@end \endgroup \let\caption@position\caption@fixedposition} -\let\caption@setfloattype\caption@settype% new v3.0a +\let\caption@setfloattype\caption@settype \newcommand*\caption@letfloattype[2]{% \def\caption@setfloattype##1{% \caption@settype{##1}#2\caption@settype{#1}}} -\newcommand*\caption@preparelof[1]{% changed v3.0b - \caption@iflof% - {\def\caption@tempa{#1}}% - {\let\caption@tempa\@empty}% - \ifx\caption@tempa\@empty - \def\addcontentsline##1##2##3{}% - \fi} -\let\caption@@begin\@gobble % new v3.0a -\let\caption@@end\@empty % new v3.0a +\newcommand*\caption@floatname[1]{\@nameuse{#1name}} \AtBeginDocument{% - \let\caption@old\caption - \let\caption@@old\@caption \@ifundefined{cc@caption}{% + \let\caption@old\caption \def\caption{\caption@caption\caption@old}% \def\caption@caption#1{% - \@ifstar{\ContinuedFloat\global\caption@startrue #1[]}{#1}}% + \@ifstar{\ContinuedFloat\global\caption@startrue#1[]}{#1}}% + \let\caption@@old\@caption \long\def\@caption#1[#2]#3{% \caption@beginex{#1}{#2}% \caption@@old{#1}[{#2}]{#3}% \caption@end}% }{% \PackageInfo{caption}{captcont package v2.0 detected}% - \def\caption@caption#1{#1}% added v3.0c + \def\caption@caption#1{#1}% }% } \renewcommand\@makecaption[2]{% \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}% - \ifnum\caption@debug>1 % - \llap{$\caption@iftop\downarrow\uparrow$ }% - \fi \caption@@make{#1}{#2}% \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}} -\AtBeginDocument{\let\scr@caption\caption} +\AtBeginDocument{\@ifundefined{scr@caption}{}{% + \PackageInfo{caption}{KOMA-Script class detected}% + \let\scr@caption\caption +}} +\AtBeginDocument{\@ifundefined{f@ffrench}{}{% + \PackageInfo{caption}{french(le) package detected}% + \@ifundefined{GOfrench}% + {\let\caption@tempa\@firstofone}% + {\def\caption@tempa{\g@addto@macro\GOfrench}}% + \caption@tempa{% + \let\@cnORI\caption + \let\caption@tablescaption\@tablescaption + \def\@tablescaption{\caption@caption\caption@tablescaption}% + \let\@eatDP\@undefined + \let\caption@tempa\@empty + \ifx\f@ffrench\fnum@figure + \l@addto@macro\caption@tempa{\let\fnum@figure\f@ffrench}% + \fi + \ifx\f@tfrench\fnum@table + \l@addto@macro\caption@tempa{\let\fnum@table\f@tfrench}% + \fi + \def\f@ffrench{\ifx\listoffigures\relax\else\figurename~\thefigure\fi}% + \def\f@tfrench{\ifx\listoftables\relax\else\tablename~\thetable\fi}% + \caption@tempa +}}} \def\caption@setfloatposition{% \caption@setposition{\@fs@iftopcapt t\else b\fi}} \caption@ifpackage{float}{@float@setevery}{% @@ -205,6 +236,14 @@ \let\@fs@capt\caption@@make \caption@@float{#1}[{#2}]{#3}% \caption@of@float{% + \@ifundefined{hyper@@anchor}{}{% + \begingroup + \@tempdima\prevdepth + \nointerlineskip + \let\leavevmode\relax + \hyper@@anchor\@currentHref\relax + \prevdepth\@tempdima + \endgroup}% \def\caption@@make##1##2{\unvbox\@floatcapt}% \@makecaption{}{}}% \caption@end}% @@ -221,22 +260,23 @@ \expandafter\let\csname @float@c@#1\endcsname\@caption \fi\fi\fi \expandafter\ifx\csname @float@c@#1\endcsname\float@caption - \caption@setfloatposition% changed v3.0b+f + \caption@setfloatposition \expandafter\let\expandafter\caption@fst\csname fst@#1\endcsname \edef\caption@fst{\noexpand\string\expandafter\noexpand\caption@fst}% \edef\caption@fst{\noexpand\@gobblefour\caption@fst}% \caption@setstyle*\caption@fst - \caption@settype\caption@fst% new v3.0f + \caption@settype\caption@fst \fi}% \g@addto@macro\fs@plaintop{\def\@fs@mid{\vspace\abovecaptionskip\relax}}% \g@addto@macro\fs@boxed{\def\@fs@mid{\kern\abovecaptionskip\relax}}% } -\captionsetup[boxed]{skip=2pt}% +\captionsetup[boxed]{skip=2pt} \caption@ifbool{ruled}{% - \captionsetup[ruled]{margin=0pt,singlelinecheck=0}% new v3.0f -}{% v3.0f: "strut=0" added - \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}} -\let\caption@ifruled\@undefined + \captionsetup[ruled]{margin=0pt,singlelinecheck=0}% +}{% + \DeclareCaptionStyle{ruled}{labelfont=bf,labelsep=space,strut=0}% +} +\caption@undefbool{ruled} \caption@ifpackage{floatrow}{flrow@setlist}{% \PackageInfo{caption}{floatrow package v0.1f (or newer) detected}% \renewcommand*\caption@of[2]{% @@ -252,7 +292,8 @@ \expandafter\newcount\csname CF@#1\endcsname \caption@resetContinuedFloat{#1}}{}% \global\advance\csname CF@#1\endcsname\@ne\relax - \expandafter\l@addto@macro\csname theH#1\endcsname{.\expandafter\@arabic\csname CF@#1\endcsname}% + \expandafter\l@addto@macro\csname theH#1\endcsname{% + .\expandafter\@arabic\csname CF@#1\endcsname}% \let\caption@resetContinuedFloat\@gobble }}% \def\caption@resetContinuedFloat#1{% @@ -287,7 +328,6 @@ \PackageInfo{caption}{listings package v1.2 (or newer) detected}% \let\caption@lst@MakeCaption\lst@MakeCaption \def\lst@MakeCaption#1{% - \let\caption@setfloattype\caption@settype \def\caption@autoposition{\caption@setposition{#1}}% \caption@begin{lstlisting}% \caption@lst@MakeCaption{#1}% @@ -296,43 +336,53 @@ \caption@ifpackage{longtable}{LT@makecaption}{% \PackageInfo{caption}{longtable package v3.15 (or newer) detected}% \def\LT@makecaption#1#2#3{% - \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{% - \caption@letfloattype{longtable}{% bugfixed v3.0e + \caption@LT@make{% + \caption@startrue#1\caption@starfalse + \caption@letfloattype{longtable}{% \ifdim\LTcapwidth=4in \else - \caption@setwidth\LTcapwidth + \setcaptionwidth\LTcapwidth \fi}% - \let\caption@defaultpos\@firstoftwo% default = top - \def\caption@autoposition{% does not work within \end(last)foot! + \let\caption@defaultpos\@firstoftwo + \def\caption@autoposition{% \caption@setposition{\ifcase\LT@rows t\else b\fi}}% \caption@begin{table}% - \vskip-\ht\@arstrutbox + \vskip-\ht\strutbox \caption@iftop{\vskip\belowcaptionskip}{\vskip\abovecaptionskip}% - \caption@startrue#1\caption@starfalse \caption@@make{#2}{#3}\endgraf \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}% - \caption@end}% - \hss}}}% + \caption@end}}% + \newcommand\caption@LT@make[1]{% + \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\hsize{#1}\hss}}}% +} +\caption@ifpackage{picins}{piccaption}{% + \PackageInfo{caption}{picins package v3.0 (or newer) detected}% + \def\piccaption{\@dblarg\@piccaption} } \caption@ifpackage{rotating}{@rotcaption}{% \PackageInfo{caption}{rotating package v2.0 (or newer) detected}% - \let\caption@rot\rotcaption - \def\rotcaption{\caption@caption\caption@rot}% - \let\caption@@rot\@rotcaption - \long\def\@rotcaption#1[#2]#3{% - \caption@beginex{#1}{#2}% - \caption@@rot{#1}[{#2}]{#3}% - \caption@end}% + \def\rotcaption{\let\@makecaption\@makerotcaption\caption}% + \def\rotcaptionof{\@ifstar{\caption@of{\rotcaption*}}{\caption@of\rotcaption}}% \long\def\@makerotcaption#1#2{% - \rotatebox{90}{% - \begin{minipage}{.8\textheight}% - \caption@@make{#1}{#2}% - \end{minipage}% - }\par - \hspace{12pt}}% + \ifdim\captionwidth=\z@ + \setcaptionwidth{.8\textheight}% + \caption@slc{#1}{#2}{.8\vsize}{% + \let\caption@makerot\caption@@make + \setcaptionmargin\z@ + \let\caption@startbox\@gobble + \let\caption@endbox\relax}% + \caption@setbool{slc}{0}% been there, done that + \fi + \rotatebox{90}{\caption@makerot{#1}{#2}}% + \nobreak\hspace{12pt}}% + \newcommand\caption@makerot[2]{% + \begin{minipage}\captionwidth\caption@@make{#1}{#2}\end{minipage}}% } \caption@ifpackage{sidecap}{endSC@FLOAT}{% \PackageInfo{caption}{sidecap package v1.4d (or newer) detected}% - \let\SC@caption=\caption + \@ifundefined{caption@caption}% + {\let\caption@tempa\AtBeginDocument}% + {\let\caption@tempa\@firstofone}% + \caption@tempa{\let\SC@caption=\caption}% \let\caption@SC@zfloat\SC@zfloat \def\SC@zfloat#1#2#3[#4]{% \caption@SC@zfloat{#1}{#2}{#3}[#4]% @@ -345,14 +395,15 @@ \def\endSC@FLOAT{% \let\@captype\SC@captype \caption@esetup\SC@CAPsetup - \caption@letfloattype{SC\@captype}{% bugfixed v3.0e - \caption@setmargin\z@ + \caption@letfloattype{SC\@captype}{% + \@listdepth\z@ + \setcaptionmargin\z@ \@ifundefined{SC@justify}{}{% \ifx\SC@justify\@empty\else \let\caption@hj\SC@justify \let\SC@justify\@empty \fi}}% - \long\def\caption@ifempty##1{% bugfix v3.0e + \long\def\caption@ifempty##1{% \ifx\SC@CAPtext\@empty \expandafter\@firstofone \else @@ -367,7 +418,7 @@ \let\caption@tablecaption\tablecaption \def\tablecaption{\caption@caption\caption@tablecaption}% \let\caption@ST\ST@caption - \long\def\ST@caption#1[#2]#3{\par% bugfixed v3.0a + \long\def\ST@caption#1[#2]#3{\par% \caption@letfloattype{supertabular}{}% \let\caption@fixposition\caption@setSTposition \caption@beginex{#1}{#2}% diff --git a/Master/texmf-dist/tex/latex/caption/caption2.sty b/Master/texmf-dist/tex/latex/caption/caption2.sty index fa7ffb21b57..60f829b6c79 100644 --- a/Master/texmf-dist/tex/latex/caption/caption2.sty +++ b/Master/texmf-dist/tex/latex/caption/caption2.sty @@ -6,7 +6,7 @@ %% %% caption2.dtx (with options: `package') %% -%% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfeldt.net) +%% Copyright (C) 1994-2006 Axel Sommerfeldt (caption@sommerfee.de) %% %% -------------------------------------------------------------------------- %% @@ -23,11 +23,13 @@ %% This Current Maintainer of this work is Axel Sommerfeldt. %% %% This work consists of the files caption.ins, caption.dtx, -%% caption2.dtx, caption.xml, and anleitung.tex and the derived files +%% caption2.dtx, and anleitung.tex and the derived files %% caption.sty, caption2.sty, caption3.sty, and manual.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption2}[2004/05/10 v2.1c Customising captions (AS)] +\ProvidesPackage{caption2}[2005/10/03 v2.1d Customising captions (AS)] +\PackageWarning{caption2}{% + THIS PACKAGE IS OBSOLETE, PLEASE USE caption INSTEAD} \newcommand*\captionfont{} \newcommand*\captionlabelfont{} \newcommand*\captionlabeldelim{} @@ -86,7 +88,7 @@ before you can select\MessageBreak it with \protect\captionstyle. \space\caption@eh}% \else - #2\usecaptionstyle{\caption@style}% + #2\usecaptionstyle\caption@style \fi}} \newcommand*\captionstyle[1]{% \expandafter\ifx\csname caption@@#1\endcsname\relax @@ -223,7 +225,7 @@ \sbox\@tempboxa{#1}% \ifdim\wd\@tempboxa >\captionlinewidth \else - \def\next{{\centering\usebox{\@tempboxa}\par}\@gobble}% + \def\next{{\centering\usebox\@tempboxa\par}\@gobble}% \fi \fi\next} \newcommand*\usecaptionstyle[1]{% @@ -244,7 +246,7 @@ \realcaptionwidth\hsize \def\captionlabel{#1}% \def\captiontext{#2}% - \usecaptionstyle{\caption@style}% + \usecaptionstyle\caption@style \vskip\belowcaptionskip} \renewcommand*\caption@package[3]{% \if1\@nameuse{caption@pkt@#1}% @@ -359,13 +361,13 @@ \captionindent\subcapindent \ifsubcapnooneline\onelinecaptionsfalse\else\onelinecaptionstrue\fi \hbox to\@tempdima{% - \caption@subfig@hss\parbox[t]{\@tempdima}{% + \caption@subfig@hss\parbox[t]\@tempdima{% \captionlinewidth\@tempdima \realcaptionwidth\@tempdima \captionlabeltrue \def\captionlabel{#1}% \def\captiontext{\ignorespaces #2}% - \usecaptionstyle{\caption@substyle}}% + \usecaptionstyle\caption@substyle}% \caption@subfig@hss}} \caption@package{subfigure}{@makesubfigurecaption}{% \let\setsubcapstyle\undefined diff --git a/Master/texmf-dist/tex/latex/caption/caption3.sty b/Master/texmf-dist/tex/latex/caption/caption3.sty index 75bed31ea4b..5d23cc47d8e 100644 --- a/Master/texmf-dist/tex/latex/caption/caption3.sty +++ b/Master/texmf-dist/tex/latex/caption/caption3.sty @@ -6,7 +6,7 @@ %% %% caption.dtx (with options: `kernel') %% -%% Copyright (C) 1994-2005 Axel Sommerfeldt (caption@sommerfeldt.net) +%% Copyright (C) 1994-2006 Axel Sommerfeldt (caption@sommerfee.de) %% %% -------------------------------------------------------------------------- %% @@ -23,11 +23,11 @@ %% This Current Maintainer of this work is Axel Sommerfeldt. %% %% This work consists of the files caption.ins, caption.dtx, -%% caption2.dtx, caption.xml, and anleitung.tex and the derived files +%% caption2.dtx, and anleitung.tex and the derived files %% caption.sty, caption2.sty, caption3.sty, and manual.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2005/06/11 v3.0f caption3 kernel (AS)] +\ProvidesPackage{caption3}[2006/03/16 v3.0j caption3 kernel (AR)] \providecommand*\@nameundef[1]{% \expandafter\let\csname #1\endcsname\@undefined} \providecommand\l@addto@macro[2]{% @@ -62,6 +62,7 @@ \PackageError{caption}{Undefined boolean value `#2'}{\caption@eh}% }}} \def\caption@ifbool#1{\@nameuse{caption@if#1}} +\def\caption@undefbool#1{\@nameundef{caption@if#1}} \RequirePackage{keyval}[1997/11/10] \providecommand*\undefine@key[2]{% \@nameundef{KV@#1@#2}\@nameundef{KV@#1@#2@default}} @@ -72,27 +73,41 @@ #1{\undefine@key{caption}{#2}}\define@key{caption}{#2}} \@onlypreamble\DeclareCaptionOption \@onlypreamble\caption@declareoption -\def\captionsetup{\@ifnextchar[\caption@setuptype\caption@setup} +\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}}} -\def\caption@setup{\setkeys{caption}} -\def\caption@settype#1{% - \@ifundefined{caption@typ@#1}{}{% - \caption@esetup{\csname caption@typ@#1\endcsname}}} -\def\caption@esetup#1{% + \@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[2]{% + \let\caption@KV@errx\KV@errx + \let\caption@KV@err\KV@err + \def\KV@errx##1{\PackageError\caption@package{##1}\@ehc}% + \let\KV@err\KV@errx + \setkeys{#1}{#2}% + \let\KV@errx\caption@KV@errx + \let\KV@err\caption@KV@err} +\newcommand\caption@package{caption} +\newcommand\caption@settype{% + \@ifnextchar[\caption@@settype{\caption@@settype[caption]}} +\def\caption@@settype[#1]#2{% + \@ifundefined{\caption@typ@#2}{}{% + \def\caption@package{#1}% + \caption@esetup{\csname\caption@typ@#2\endcsname}% + \def\caption@package{caption}}} +\newcommand*\caption@esetup[1]{% \edef\caption@tempa{\noexpand\caption@setup{#1}}% \caption@tempa} -\newcommand*\clearcaptionsetup[1]{\@nameundef{caption@typ@#1}} +\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. + \@ifundefined{\caption@typ@#2}{% + % empty -- print nothing }{% - \@nameuse{caption@typ@#2}% + \@nameuse{\caption@typ@#2}% }% )}} \newcommand\caption@eh{% @@ -100,23 +115,27 @@ at the documentation of the `caption' package.\MessageBreak \@ehc} \newdimen\captionmargin +\newdimen\captionmarginx \newdimen\captionwidth -\newif\ifcaption@width -\DeclareCaptionOption{margin}{\caption@setmargin{#1}} -\DeclareCaptionOption{width}{\caption@setwidth{#1}} -\newcommand\caption@setmargin{% - \caption@widthfalse - \setlength\captionmargin} -\newcommand\caption@setwidth{% - \caption@widthtrue +\DeclareCaptionOption{margin}{\setcaptionmargin{#1}} +\DeclareCaptionOption{width}{\setcaptionwidth{#1}} +\newcommand*\setcaptionmargin[1]{% + \captionwidth\z@ + \caption@@setmargin#1,#1,\@nil\@@} +\def\caption@@setmargin#1,#2,#3\@@{% + \setlength\captionmargin{#1}% + \setlength\captionmarginx{#2}% + \advance\captionmarginx by -\captionmargin} +\newcommand\setcaptionwidth{% \setlength\captionwidth} \newdimen\captionindent \newdimen\captionparindent \newdimen\captionhangindent \DeclareCaptionOption{indent}[\leftmargini]{\setlength\captionindent{#1}}% obsolete! \DeclareCaptionOption{indention}[\leftmargini]{\setlength\captionindent{#1}} -\DeclareCaptionOption{parindent}[\parindent]{\setlength\captionparindent{#1}}% changed v3.0b -\DeclareCaptionOption{hangindent}[0pt]{\setlength\captionhangindent{#1}}% changed v3.0b +\DeclareCaptionOption{hangindent}{\setlength\captionhangindent{#1}} +\DeclareCaptionOption{parindent}{\setlength\captionparindent{#1}} +\DeclareCaptionOption{parskip}{\l@addto@macro\caption@@par{\setlength\parskip{#1}}} \newcommand*\DeclareCaptionStyle[1]{% \@ifnextchar[{\caption@declarestyle{#1}}{\caption@declarestyle{#1}[]}} \def\caption@declarestyle#1[#2]#3{% @@ -130,18 +149,20 @@ \newcommand*\caption@@setstyle[2]{% \@ifundefined{caption@sty@#2}% {#1{\PackageError{caption}{Undefined caption style `#2'}{\caption@eh}}}% -{\expandafter\let\expandafter\caption@sls\csname caption@sls@#2\endcsname + {\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,justification=default,% - font=default,labelfont=default,textfont=default,% - margin=0pt,indention=0pt,parindent=0pt,hangindent=0pt,singlelinecheck}} + format=default,labelformat=default,labelsep=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]{} -\def\DeclareCaptionFormat{% - \@ifstar{\caption@declareformat\@gobble}{\caption@declareformat\@firstofone}} +\newcommand\DeclareCaptionFormat{% + \@ifstar{\caption@declareformat\@gobble}% + {\caption@declareformat\@firstofone}} \newcommand\caption@declareformat[3]{% \global\expandafter\let\csname caption@ifh@#2\endcsname#1% - \global\long\expandafter\def\csname caption@fmt@#2\endcsname##1##2##3{#3}} + \global\long\@namedef{caption@fmt@#2}##1##2##3{#3}} \@onlypreamble\DeclareCaptionFormat \@onlypreamble\caption@declareformat \DeclareCaptionOption{format}{\caption@setformat{#1}} @@ -150,17 +171,17 @@ {\PackageError{caption}{Undefined caption format `#1'}{\caption@eh}}% {\expandafter\let\expandafter\caption@ifh\csname caption@ifh@#1\endcsname \expandafter\let\expandafter\caption@fmt\csname caption@fmt@#1\endcsname}} -\DeclareCaptionFormat{@normal}{#1#2#3\par} +\DeclareCaptionFormat{plain}{#1#2#3\par} \DeclareCaptionFormat{hang}{% \@hangfrom{#1#2}% \advance\captionparindent\hangindent \advance\captionhangindent\hangindent \caption@@par #3\par} -\def\caption@fmt@default{\caption@fmt@@normal} -\def\caption@ifh@default{\caption@ifh@@normal}% bugfix v3.0e (05-04-28) +\def\caption@fmt@default{\caption@fmt@plain} +\def\caption@ifh@default{\caption@ifh@plain} \newcommand*\DeclareCaptionLabelFormat[2]{% - \global\expandafter\def\csname caption@lfmt@#1\endcsname##1##2{#2}} + \global\@namedef{caption@lfmt@#1}##1##2{#2}} \@onlypreamble\DeclareCaptionLabelFormat \DeclareCaptionOption{labelformat}{\caption@setlabelformat{#1}} \newcommand*\caption@setlabelformat[1]{% @@ -171,22 +192,30 @@ \DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} \def\caption@lfmt@default{\caption@lfmt@simple} -\newcommand\DeclareCaptionLabelSeparator[2]{% - \global\long\@namedef{caption@lsep@#1}{#2}} +\newcommand\DeclareCaptionLabelSeparator{% + \@ifstar{\caption@declarelabelseparator\@gobble}% + {\caption@declarelabelseparator\@firstofone}} +\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}% {\PackageError{caption}{Undefined caption label separator `#1'}{\caption@eh}}% - {\expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}} + {\expandafter\let\expandafter\caption@iflf\csname caption@iflf@#1\endcsname + \expandafter\let\expandafter\caption@lsep\csname caption@lsep@#1\endcsname}} \DeclareCaptionLabelSeparator{none}{} \DeclareCaptionLabelSeparator{colon}{: } \DeclareCaptionLabelSeparator{period}{. } \DeclareCaptionLabelSeparator{space}{ } -\DeclareCaptionLabelSeparator{quad}{\quad} -\DeclareCaptionLabelSeparator{newline}{\\}% 05-03-23 (v3.0f) +\DeclareCaptionLabelSeparator*{quad}{\quad} +\DeclareCaptionLabelSeparator*{newline}{\\} +\DeclareCaptionLabelSeparator*{endash}{\space\textendash\space} \def\caption@lsep@default{\caption@lsep@colon} +\def\caption@iflf@default{\caption@iflf@colon} \newcommand*\DeclareCaptionJustification[2]{% \global\@namedef{caption@hj@#1}{#2}} \@onlypreamble\DeclareCaptionJustification @@ -240,7 +269,7 @@ \newcommand*\caption@setfont[2]{% \let\caption@tempa\@empty \begingroup - \setkeys{caption@fnt}{#2}% + \caption@setkeys{caption@fnt}{#2}% \endgroup \expandafter\let\csname caption#1\endcsname\caption@tempa} \DeclareCaptionFont{default}{} @@ -260,14 +289,14 @@ \DeclareCaptionFont{sf}{\sffamily} \DeclareCaptionFont{tt}{\ttfamily} \providecommand\captionsize{} -\DeclareCaptionOption{size}{\caption@setfont{size}{#1}}% changed v3.0a +\DeclareCaptionOption{size}{\caption@setfont{size}{#1}} \@ifundefined{abovecaptionskip}{% \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} \@ifundefined{belowcaptionskip}{% \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{} \DeclareCaptionOption{aboveskip}{\setlength\abovecaptionskip{#1}} \DeclareCaptionOption{belowskip}{\setlength\belowcaptionskip{#1}} -\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}}% new 3.0d +\DeclareCaptionOption{skip}{\setlength\abovecaptionskip{#1}} \DeclareCaptionOption{position}{\caption@setposition{#1}} \newcommand*\caption@setposition[1]{% \caption@ifinlist{#1}{d,default}{% @@ -282,7 +311,7 @@ \PackageError{caption}{Undefined caption position `#1'}{\caption@eh}% }}}}} \let\caption@defaultpos\@secondoftwo -\newcommand\caption@iftop{% bugfixed v3.0a, improved v3.0d +\newcommand\caption@iftop{% \ifx\caption@position\@undefined \expandafter\@secondoftwo \else @@ -292,89 +321,81 @@ \ifx\caption@position\@undefined \caption@autoposition \fi} -\newcommand\caption@autoposition{% bugfixed v3.0a +\newcommand\caption@autoposition{% \ifvmode - \ifodd\caption@debug\relax - \edef\caption@tempa{\the\prevdepth}% - \PackageInfo{caption}{\protect\prevdepth=\caption@tempa}% - \fi \ifdim\prevdepth>-\p@ \let\caption@position\@secondoftwo \else \let\caption@position\@firstoftwo \fi \else - \ifodd\caption@debug\relax - \PackageInfo{caption}{no \protect\prevdepth}% - \fi \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{parskip}[5pt]{\AtBeginCaption{\setlength\parskip{#1}}} -\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}}% new v3.0b -\DeclareCaptionOption{singlelinecheck}[1]{\caption@setbool{slc}{#1}} -\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}}% new v3.0d -\DeclareCaptionOption{debug}{\def\caption@debug{#1}} -\captionsetup{style=default,position=default,listof=1,strut=1,debug=0} +\DeclareCaptionOption{listof}{\caption@setbool{lof}{#1}} +\DeclareCaptionOption{singlelinecheck}{\caption@setbool{slc}{#1}} +\DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}} +\captionsetup{style=default,position=default,listof=1} \newif\ifcaption@star \newcommand\caption@make[2]{% \caption@@make{\caption@lfmt{#1}{#2}}} \newcommand\caption@@make[2]{% + \begingroup \caption@beginhook \caption@calcmargin - \caption@ifslc{% - \ifx\caption@sls\@empty\else - \caption@startslc - \setbox\@tempboxa\hbox{\caption@@@make{#1}{#2}}% - \ifdim\wd\@tempboxa >\captionwidth - \caption@endslc - \else - \caption@endslc - \caption@esetup\caption@sls - \caption@calcmargin - \fi - \fi}{}% + \caption@ifslc{\ifx\caption@sls\@empty\else + \caption@slc{#1}{#2}\captionwidth\relax + \fi}{}% \@tempdima\captionmargin \caption@ifh{\advance\@tempdima by \captionindent}% - \ifdim\@tempdima=\z@\else - \hskip\@tempdima - \fi + \hskip\@tempdima \@tempdima\captionwidth \caption@ifh{\advance\@tempdima by -\captionindent}% \caption@startbox\@tempdima \caption@ifh{% - \ifdim\captionindent=\z@ - \leavevmode - \else - \hskip-\captionindent - \fi}% + \hskip-\captionindent}% \caption@@@make{#1}{#2}% \caption@endbox - \ifdim\captionmargin=\z@\else - \hskip\captionmargin - \fi + \@tempdima\captionmargin + \advance\@tempdima by \captionmarginx + \hskip\@tempdima \caption@endhook + \endgroup \global\caption@starfalse} \newcommand\caption@calcmargin{% - \ifcaption@width - \captionmargin\hsize + \@tempdima\hsize + \ifnum\@listdepth>0\relax + \advance\@tempdima by -\leftmargin + \advance\@tempdima by -\rightmargin + \fi + \ifdim\captionwidth=\z@ + \captionwidth\@tempdima + \advance\captionwidth by -2\captionmargin + \advance\captionwidth by -\captionmarginx + \else + \captionmargin\@tempdima \advance\captionmargin by -\captionwidth \divide\captionmargin by 2 - \else - \captionwidth\hsize - \advance\captionwidth by -2\captionmargin + \captionmarginx\z@ \fi - \ifodd\caption@debug\relax - \PackageInfo{caption}{\protect\hsize=\the\hsize, - \protect\margin=\the\captionmargin, - \protect\width=\the\captionwidth}% +} +\newcommand\caption@slc[4]{% + \caption@startslc + \sbox\@tempboxa{\caption@@@make{#1}{#2}}% + \ifdim\wd\@tempboxa >#3% + \caption@endslc + \else + \caption@endslc + \caption@esetup\caption@sls + #4% \fi} \newcommand\caption@startslc{% \begingroup - \let\label\@gobble\let\@footnotetext\@gobble + \let\label\@gobble + \let\@footnotetext\@gobble\let\@endnotetext\@gobble \def\stepcounter##1{\advance\csname c@##1\endcsname\@ne\relax}% \let\caption@hj\relax} \newcommand\caption@endslc{% @@ -382,22 +403,23 @@ \newcommand*\caption@startbox[1]{\vbox\bgroup\hsize#1}% \newcommand*\caption@endbox{\egroup} \newcommand\caption@@@make[2]{% - \caption@ifempty{#2}{% changed v3.0e + \sbox\@tempboxa{#1}% + \ifdim\wd\@tempboxa=\z@ + \let\caption@lsep\relax + \fi + \caption@ifempty{#2}{% \let\caption@lsep\relax - \let\caption@ifstrut\@secondoftwo % added v3.0e }% - \def\caption@@par{% - \parindent\captionparindent\hangindent\captionhangindent}% \@setpar{\@@par\caption@@par}\caption@@par - \caption@hj\captionsize\captionfont - \caption@fmt{\ifcaption@star\else{\captionlabelfont#1}\fi}% - {\ifcaption@star\else{\captionlabelfont\caption@lsep}\fi}% - {{\captiontextfont - \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}% - \nobreak\hskip\z@skip - #2% - \caption@ifstrut{\@finalstrut\strutbox}{}% - \par}}} + \caption@hj\captionsize\captionfont\caption@fmt + {\ifcaption@star\else{\captionlabelfont#1}\fi}% + {\ifcaption@star\else{\caption@iflf\captionlabelfont\caption@lsep}\fi}% + {{\captiontextfont + \caption@ifstrut{\vrule\@height\ht\strutbox\@width\z@}{}% + \nobreak\hskip\z@skip + #2% + \caption@ifstrut{\@finalstrut\strutbox}{}% + \par}}} \newcommand\caption@ifempty[1]{% \def\caption@tempa{#1}% \def\caption@tempb{\ignorespaces}% @@ -409,6 +431,8 @@ \else \expandafter\@gobble \fi} +\newcommand*\caption@@par{% + \parindent\captionparindent\hangindent\captionhangindent}% \endinput %% %% End of file `caption3.sty'. -- cgit v1.2.3