From 26c7201725a630fb71ec1c952974cd207170d70f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 11 Apr 2007 23:10:18 +0000 Subject: caption 3.0p (10apr07) git-svn-id: svn://tug.org/texlive/trunk@4152 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/caption/caption.sty | 27 ++++-- Master/texmf-dist/tex/latex/caption/caption2.sty | 106 +++++++++++------------ Master/texmf-dist/tex/latex/caption/caption3.sty | 104 +++++++++++++++------- 3 files changed, 143 insertions(+), 94 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 cf8c40c921a..9fac17f8caf 100644 --- a/Master/texmf-dist/tex/latex/caption/caption.sty +++ b/Master/texmf-dist/tex/latex/caption/caption.sty @@ -27,8 +27,13 @@ %% caption.sty, caption2.sty, caption3.sty, and manual.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2007/03/09 v3.0o Customising captions (AR)] +\ProvidesPackage{caption}[2007/04/09 v3.0p Customising captions (AR)] \RequirePackage{caption3}[2007/01/31] % needs v3.0l or newer +\def\caption@package{caption}% +\@ifpackageloaded{caption2}{% + \caption@error{You can't use both the caption *and* caption2 package}% + \endinput +}{} \DeclareCaptionOption{config}[caption]{% \InputIfFileExists{#1.cfg}{\typeout{*** Local configuration file #1.cfg used ***}}% @@ -104,7 +109,7 @@ \caption@declarepackage{supertabular} \DeclareCaptionOption{verbose}[1]{% \caption@setbool{verbose}{#1}% - \caption@ifbool{verbose}{% + \caption@ifverbose{% \def\caption@Info{\PackageInfo{caption}}% }{% \let\caption@Info\@gobble @@ -294,15 +299,16 @@ \def\caption@ContinuedFloat#1{% \@ifundefined{theH#1}{}{% \@ifundefined{CF@#1}{% - \expandafter\newcount\csname CF@#1\endcsname + \expandafter\caption@newcounter\csname CF@#1\endcsname \caption@resetContinuedFloat{#1}}{}% - \global\advance\csname CF@#1\endcsname\@ne\relax + \expandafter\caption@stepcounter\csname CF@#1\endcsname \expandafter\l@addto@macro\csname theH#1\endcsname{% - .\expandafter\@arabic\csname CF@#1\endcsname}% + .\csname CF@#1\endcsname}% \let\caption@resetContinuedFloat\@gobble }}% \def\caption@resetContinuedFloat#1{% - \@ifundefined{CF@#1}{}{\global\csname CF@#1\endcsname\z@\relax}}% + \@ifundefined{CF@#1}{}{% + \expandafter\caption@setcounter\csname CF@#1\endcsname0}}% } \caption@ifpackage{hypcap}{hc@caption}{% \caption@Info{hypcap package v1.0 (or newer) detected}% @@ -313,12 +319,19 @@ \let\H@refstepcounter\@gobble \Hy@hypertexnamesfalse \caption@capstart + \@ifundefined{hc@hyperref}{}{% hypcap v1.7 + \global\advance\csname c@\@captype\endcsname\@ne}% \global\let\hc@currentHref\@currentHref \endgroup - \def\caption{% + \@ifundefined{hc@hyperref}% + {\let\next\@firstofone}{\let\next\hc@hyperref}% hypcap v1.7 + \next{\def\caption{% \let\caption\hc@org@caption \H@refstepcounter\@captype + \@ifundefined{hc@hyperref}{}{% hypcap v1.7 + \global\advance\csname c@\@captype\endcsname\m@ne}% \caption@caption\hc@caption}}% + }% \let\caption@hc@@caption\hc@@caption \long\def\hc@@caption#1[#2]#3{% \caption@beginex{#1}{#2}{#3}% diff --git a/Master/texmf-dist/tex/latex/caption/caption2.sty b/Master/texmf-dist/tex/latex/caption/caption2.sty index 02197eb69e7..0fd4bd37639 100644 --- a/Master/texmf-dist/tex/latex/caption/caption2.sty +++ b/Master/texmf-dist/tex/latex/caption/caption2.sty @@ -27,39 +27,43 @@ %% caption.sty, caption2.sty, caption3.sty, and manual.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption2}[2005/10/03 v2.1d Customising captions (AS)] +\ProvidesPackage{caption2}[2007/04/06 v2.2 Customising captions (AS)] \PackageWarning{caption2}{% - THIS PACKAGE IS OBSOLETE, PLEASE USE caption INSTEAD} -\newcommand*\captionfont{} -\newcommand*\captionlabelfont{} + *** THIS PACKAGE IS OBSOLETE, PLEASE USE caption ***} +\RequirePackage{caption3}[2007/03/04] % needs v3.0m or newer +\def\caption@package{caption2} +\@ifpackageloaded{caption}{% + \caption@error{You can't use both the caption *and* caption2 package}% + \endinput +}{} \newcommand*\captionlabeldelim{} \newcommand*\captionlabelsep{} -\newcommand*\captionsize{} -\newdimen\captionmargin -\newdimen\captionwidth -\newif\ifcaptionwidth -\newdimen\captionindent -\newif\ifcaptionlabel\captionlabeltrue -\newif\ifonelinecaptions +\newcommand*\ifcaptionwidth{\ifdim\captionwidth>\z@} +\newif\ifcaption@temp +\def\ifcaptionlabel{% + \ifcaption@star + \caption@tempfalse + \else + \caption@temptrue + \fi + \ifcaption@temp} +\def\captionlabeltrue{\caption@starfalse} +\def\captionlabelfalse{\caption@startrue} +\def\ifonelinecaptions{% + \caption@ifslc{\caption@temptrue}{\caption@tempfalse}% + \ifcaption@temp} +\def\onelinecaptionstrue{\caption@setbool{slc}{1}} +\def\onelinecaptionsfalse{\caption@setbool{slc}{0}} \newif\ifignoreLTcapwidth -\newcommand*\setcaptionmargin{% - \captionwidthfalse - \setlength\captionmargin} -\newcommand*\setcaptionwidth{% - \captionwidthtrue - \setlength\captionwidth} \newcommand*\normalcaptionparams{% \let\captionsize\@empty \renewcommand*\captionfont{\captionsize}% \let\captionlabelfont\@empty \renewcommand*\captionlabeldelim{:}% \renewcommand*\captionlabelsep{\space}% - \setcaptionmargin\z@\setlength\captionindent\z@ + \setcaptionmargin\z@ + \setlength\captionindent\z@ \onelinecaptionstrue} -\newcommand*\caption@eh{% - If you do not understand this error, please take a closer look\MessageBreak - at the documentation of the `caption2' package.\MessageBreak - \@ehc} \newcommand*\defcaptionstyle[1]{% \@namedef{caption@@#1}} \newcommand*\newcaptionstyle[1]{% @@ -118,17 +122,12 @@ \onelinecaption {\caption@label\captiontext}% {\parbox[b]\captionlinewidth{\strut\@nameuse{caption@@@#1}\par}\par}} -\newcommand*\caption@make{\caption@makecaption} \newcommand*\caption@@@normal{% \caption@label\captiontext} \newcommand*\caption@@@center{% \centering\caption@label\captiontext}% -\newcommand*\caption@centerlast{% - \advance\leftskip by 0pt plus 1fil% - \advance\rightskip by 0pt plus -1fil% - \parfillskip0pt plus 2fil\relax} \newcommand*\caption@@@centerlast{% - \caption@centerlast\caption@label\captiontext} + \centerlast\caption@label\captiontext} \newcommand*\caption@@@flushleft{% \raggedright\caption@label\captiontext}% \newcommand*\caption@@@flushright{% @@ -141,7 +140,7 @@ \newcommand*\caption@@@hang@center{% \let\caption@hangplus\centering\caption@@@hang} \newcommand*\caption@@@hang@centerlast{% - \let\caption@hangplus\caption@centerlast\caption@@@hang} + \let\caption@hangplus\centerlast\caption@@@hang} \newcommand*\caption@@@hang@flushleft{% \let\caption@hangplus\raggedright\caption@@@hang} \newcommand*\caption@@@indent{% @@ -176,20 +175,19 @@ \DeclareOption{tt}{\g@addto@macro\captionlabelfont\ttfamily} \DeclareOption{oneline}{\onelinecaptionstrue} \DeclareOption{nooneline}{\onelinecaptionsfalse} -\newcommand*\caption@package[1]{\@namedef{caption@pkt@#1}} -\DeclareOption{float}{\caption@twozerofalse\caption@package{float}{1}} -\DeclareOption{longtable}{\caption@twozerofalse\caption@package{longtable}{1}} -\DeclareOption{subfigure}{\caption@twozerofalse\caption@package{subfigure}{1}} +\newcommand*\caption@setpackage[1]{\@namedef{caption@pkt@#1}} +\DeclareOption{float}{\caption@twozerofalse\caption@setpackage{float}{1}} +\DeclareOption{longtable}{\caption@twozerofalse\caption@setpackage{longtable}{1}} +\DeclareOption{subfigure}{\caption@twozerofalse\caption@setpackage{subfigure}{1}} \DeclareOption{none}{\caption@twozerofalse - \caption@package{float}{0}\caption@package{longtable}{0}% - \caption@package{subfigure}{0}} + \caption@setpackage{float}{0}\caption@setpackage{longtable}{0}% + \caption@setpackage{subfigure}{0}} \DeclareOption{all}{\ExecuteOptions{float,longtable,subfigure}} \newif\ifcaption@ruled \DeclareOption{ruled}{\caption@ruledtrue} \DeclareOption{boxed}{} \DeclareOption{ignoreLTcapwidth}{\ignoreLTcapwidthtrue} -\DeclareOption{debug}{\caption@debugtrue} -\newif\ifcaption@debug +\DeclareOption{debug}{\captionsetup{debug}} \newif\ifcaption@twozero \normalcaptionparams \ExecuteOptions{none,normal} @@ -238,7 +236,8 @@ }{% \@ifundefined{caption@@#1}% {\PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}}% - {\@nameuse{caption@@#1}}% + {\let\caption@make\caption@makecaption + \@nameuse{caption@@#1}}% }} \renewcommand\@makecaption[2]{% \vskip\abovecaptionskip @@ -248,7 +247,7 @@ \def\captiontext{#2}% \usecaptionstyle\caption@style \vskip\belowcaptionskip} -\renewcommand*\caption@package[3]{% +\newcommand*\caption@ifpackage[3]{% \if1\@nameuse{caption@pkt@#1}% \@ifundefined{#2}% {\let\next\AtBeginDocument}% @@ -261,14 +260,13 @@ #3\let\next\@gobble \fi\fi \expandafter\let\csname caption@pkt@#1\endcsname\undefined - \ifcaption@debug + \caption@ifdebug{% \ifx\next\@gobble\PackageInfo{caption2}{#1 => gobble}% \else\ifx\next\@firstofone\PackageInfo{caption2}{#1 => firstofone}% \else\ifx\next\AtBeginDocument\PackageInfo{caption2}{#1 => AtBeginDocument}% - \fi\fi\fi - \fi + \fi\fi\fi}{}% \next} -\caption@package{float}{floatc@plain}{}{% +\caption@ifpackage{float}{floatc@plain}{}{% \ifx\floatc@plain\relax \PackageWarning{caption2}{% Option `float' was set but there is no float package loaded} @@ -306,7 +304,7 @@ \vskip\belowcaptionskip \bgroup}% \fi} -\caption@package{longtable}{LT@makecaption}{}{% +\caption@ifpackage{longtable}{LT@makecaption}{}{% \ifx\LT@makecaption\relax \PackageWarning{caption2}{% Option `longtable' was set but there is no longtable package loaded} @@ -369,7 +367,7 @@ \def\captiontext{\ignorespaces #2}% \usecaptionstyle\caption@substyle}% \caption@subfig@hss}} -\caption@package{subfigure}{@makesubfigurecaption}{% +\caption@ifpackage{subfigure}{@makesubfigurecaption}{% \let\setsubcapstyle\undefined \let\caption@makesubcaption\undefined}{% \ifx\@makesubfigurecaption\relax @@ -381,30 +379,30 @@ \ifx\subcapfont\undefined \PackageInfo{caption2}{subfigure package v2.0 detected} \let\subcapfont\@empty - \newcommand*\subfigcapwidth{\z@} - \newcommand*\setsubcapmargin{% + \newcommand\subfigcapwidth{\z@} + \newcommand\setsubcapmargin{% \subfigcapwidthfalse \renewcommand*\subfigcapmargin} - \newcommand*\setsubcapwidth{% + \newcommand\setsubcapwidth{% \subfigcapwidthtrue \renewcommand*\subfigcapwidth} - \newcommand*\subcaplabelsep{\space} + \newcommand\subcaplabelsep{\space} \let\caption@subfig@hss\hfil \else \PackageInfo{caption2}{subfigure package v2.1 (or newer) detected} \newdimen\subfigcapwidth - \newcommand*\setsubcapmargin{% + \newcommand\setsubcapmargin{% \subfigcapwidthfalse \setlength\subfigcapmargin} - \newcommand*\setsubcapwidth{% + \newcommand\setsubcapwidth{% \subfigcapwidthtrue \setlength\subfigcapwidth} - \newcommand*\subcaplabelsep{\hskip\subfiglabelskip} + \newcommand\subcaplabelsep{\hskip\subfiglabelskip} \let\caption@subfig@hss\hss \fi \newif\ifsubfigcapwidth \newdimen\subcapindent - \newcommand*\subcaplabeldelim{} + \newcommand\subcaplabeldelim{} \newcommand*\subcapstyle[1]{% \expandafter\ifx\csname caption@@#1\endcsname\relax \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}% @@ -417,7 +415,7 @@ \let\@makesubfigurecaption\caption@makesubcaption \let\@makesubtablecaption\caption@makesubcaption \fi} -\let\caption@package\undefined +\let\caption@ifpackage\undefined \endinput %% %% End of file `caption2.sty'. diff --git a/Master/texmf-dist/tex/latex/caption/caption3.sty b/Master/texmf-dist/tex/latex/caption/caption3.sty index 3a760aa1bb6..34a8e52fb0d 100644 --- a/Master/texmf-dist/tex/latex/caption/caption3.sty +++ b/Master/texmf-dist/tex/latex/caption/caption3.sty @@ -27,7 +27,7 @@ %% caption.sty, caption2.sty, caption3.sty, and manual.tex. %% \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2007/03/30 v3.0o caption3 kernel (AR)] +\ProvidesPackage{caption3}[2007/04/09 v3.0p caption3 kernel (AR)] \providecommand*\@nameundef[1]{% \expandafter\let\csname #1\endcsname\@undefined} \providecommand{\l@addto@macro}[2]{% @@ -45,18 +45,6 @@ \ifx\caption@tempa\@empty\else #1#2% \fi} -\providecommand*\AtBeginEnvironment[1]{% - \@ifundefined{#1}% - {\@latex@error{Environment #1 undefined}\@ehc - \@gobble}% - {\@ifundefined{caption@env@#1}% - {\expandafter\let\csname caption@env@#1\expandafter\endcsname - \csname #1\endcsname - \expandafter\let\csname caption@hook@#1\endcsname\@empty - \@namedef{#1}{\@nameuse{caption@hook@#1}\@nameuse{caption@env@#1}}}% - {}% - \expandafter\g@addto@macro\csname caption@hook@#1\endcsname}} -\@onlypreamble\AtBeginEnvironment \def\caption@ifinlist#1#2{% \let\next\@secondoftwo \edef\caption@tempa{#1}% @@ -75,6 +63,15 @@ }}} \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{% + \begingroup + \@tempcnta#1% + \advance\@tempcnta#2% + \xdef#1{\the\@tempcnta}% + \endgroup} +\def\caption@stepcounter#1{\caption@addtocounter#1\@ne} \newcommand\caption@package{caption} \newcommand*\caption@error[1]{% \PackageError\caption@package{#1}\caption@eh} @@ -99,26 +96,26 @@ {\@namedef{\caption@typ@#1}{#2}}% {\expandafter\l@addto@macro\csname\caption@typ@#1\endcsname{,#2}}} \newcommand\caption@setup{\caption@setkeys{caption}} -\newcount\caption@keydepth \caption@keydepth=0 \newcommand*\caption@setkeys{% \@dblarg\caption@@setkeys} \long\def\caption@@setkeys[#1]#2#3{% - \ifnum\caption@keydepth =0\relax + \ifnum\caption@keydepth=0\relax \let\caption@KV@errx\KV@errx \let\caption@KV@err\KV@err \let\KV@errx\caption@error \let\KV@err\caption@error \fi - \advance\caption@keydepth\@ne + \caption@stepcounter\caption@keydepth \def\caption@package{#1}% \caption@Debug{\protect\setkeys{#2}{#3}}% \setkeys{#2}{#3}% \def\caption@package{caption}% - \advance\caption@keydepth\m@ne - \ifnum\caption@keydepth =0\relax + \caption@addtocounter\caption@keydepth\m@ne + \ifnum\caption@keydepth=0\relax \let\KV@errx\caption@KV@errx \let\KV@err\caption@KV@err \fi} +\caption@newcounter\caption@keydepth \newcommand*\caption@settype[1]{% \@ifundefined{\caption@typ@#1}{}{% \caption@esetup{\csname\caption@typ@#1\endcsname}}} @@ -162,19 +159,42 @@ \AtEndOfPackage{\let\@unprocessedoptions\relax}} \@onlypreamble\caption@ProcessOptions \newdimen\captionmargin -\newdimen\captionmarginx +\newdimen\captionmargin@ \newdimen\captionwidth \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}% - \setlength\captionmarginx{#2}% - \advance\captionmarginx by -\captionmargin} + \setlength\captionmargin@{#2}% + \advance\captionmargin@ by -\captionmargin} \newcommand\setcaptionwidth{% \setlength\captionwidth} +\caption@newcounter\caption@count +\newcommand*\caption@newlabel{\@newl@bel{caption}} +\newcommand*\caption@thepage{\the\c@page} +\def\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 + \ifodd\caption@thepage + \let\caption@ifoddpage\@firstoftwo + \else + \let\caption@ifoddpage\@secondoftwo + \fi + }{\let\caption@ifoddpage\@firstoftwo}% + \caption@ifoddpage} \newdimen\captionindent \newdimen\captionparindent \newdimen\captionhangindent @@ -329,15 +349,24 @@ \caption@ragged\RaggedLeft\raggedleft} \DeclareCaptionJustification{RaggedRight}{% \caption@ragged\RaggedRight\raggedright} -\newcommand*\caption@ragged[2]{% +\newcommand*\caption@ragged{% + \caption@Info{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{caption}{% - Cannot locate the `ragged2e' package, therefore\MessageBreak + \PackageWarning{caption3}{% + `ragged2e' package not loaded, therefore\MessageBreak substituting \string#2 for \string#1\MessageBreak}% \global\@namedef{caption\string#1}}{}% #2} -\AtBeginDocument{\IfFileExists{ragged2e.sty}{% - \RequirePackage{ragged2e}\let\caption@ragged\@firstoftwo}{}} +\AtBeginDocument{% + \@ifundefined{caption@ragged2e}{}{% + \caption@Info{We load ragged2e}% + \IfFileExists{ragged2e.sty}{% + \RequirePackage{ragged2e}\let\caption@@ragged\@firstoftwo}{}% + }} \newcommand\DeclareCaptionFont[2]{% \define@key{caption@fnt}{#1}[]{\g@addto@macro\caption@tempa{#2}}} \@onlypreamble\DeclareCaptionFont @@ -366,6 +395,9 @@ \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}{% @@ -421,13 +453,14 @@ \DeclareCaptionOption{strut}{\caption@setbool{strut}{#1}} \DeclareCaptionOption{debug}[1]{% \caption@setbool{debug}{#1}% - \caption@ifbool{debug}{% + \caption@ifdebug{% \def\caption@Debug{\PackageInfo{caption3}}% }{% \let\caption@Debug\@gobble }} \setkeys{caption}{debug=0} -\captionsetup{style=default,position=default,listof=1} +\captionsetup{style=default,position=default,listof=1,% + twoside=\if@twoside 1\else 0\fi} \newif\ifcaption@star \newcommand\caption@make[2]{% \caption@@make{\caption@lfmt{#1}{#2}}} @@ -439,7 +472,10 @@ \caption@slc{#1}{#2}\captionwidth\relax \fi}{}% \@tempdima\captionmargin - \caption@ifh{\advance\@tempdima by \captionindent}% + \ifdim\captionmargin@=\z@\else + \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}% + \fi + \caption@ifh{\advance\@tempdima\captionindent}% \hskip\@tempdima \@tempdima\captionwidth \caption@ifh{\advance\@tempdima by -\captionindent}% @@ -452,7 +488,9 @@ \fi}% \caption@@@make{#1}{#2}}% \@tempdima\captionmargin - \advance\@tempdima by \captionmarginx + \ifdim\captionmargin@=\z@\else + \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}% + \fi \hskip\@tempdima \caption@endhook \endgroup @@ -466,17 +504,17 @@ \ifdim\captionwidth=\z@ \captionwidth\@tempdima \advance\captionwidth by -2\captionmargin - \advance\captionwidth by -\captionmarginx + \advance\captionwidth by -\captionmargin@ \else \captionmargin\@tempdima \advance\captionmargin by -\captionwidth \divide\captionmargin by 2 - \captionmarginx\z@ + \captionmargin@\z@ \fi \caption@Debug{% \protect\hsize=\the\hsize, \protect\margin=\the\captionmargin, - \protect\marginx=\the\captionmarginx, + \protect\marginx=\the\captionmargin@, \protect\width=\the\captionwidth}% } \newcommand\caption@slc[4]{% -- cgit v1.2.3