diff options
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/caption/bicaption.dtx | 10 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption.dtx | 248 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption3.dtx | 90 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/ltcaption.dtx | 9 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/caption/subcaption.dtx | 413 |
5 files changed, 537 insertions, 233 deletions
diff --git a/Master/texmf-dist/source/latex/caption/bicaption.dtx b/Master/texmf-dist/source/latex/caption/bicaption.dtx index 48bb77a4d7b..3f0e989df9f 100644 --- a/Master/texmf-dist/source/latex/caption/bicaption.dtx +++ b/Master/texmf-dist/source/latex/caption/bicaption.dtx @@ -25,7 +25,7 @@ % caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{188} +% \CheckSum{190} % % \iffalse %<*driver> @@ -567,8 +567,8 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{bicaption}[2011/07/13 v0.9a Bilingual Captions (AR)] -\RequirePackage{caption}[2011/01/01] % needs v3.2 or newer +\ProvidesPackage{bicaption}[2011/08/12 v0.9b Bilingual Captions (AR)] +\RequirePackage{caption}[2011/08/12] % needs v3.2a or newer % \end{macrocode} % \bigskip % @@ -653,7 +653,7 @@ % Set the language via \cs{selectlanguage}. % \begin{macrocode} \newcommand*\bicaption@selectlanguage{% - \@ifundefined{bicaption@language}{}{% + \caption@ifundefined\bicaption@language{}{% \expandafter\selectlanguage\expandafter{\bicaption@language}}} % \end{macrocode} % |\caption@applyfont| (of the \package{caption} package kernel) will be extended here @@ -701,7 +701,7 @@ % \begin{macrocode} \let\caption@@make@ORI\caption@@make \renewcommand\caption@@make[2]{% - \@ifundefined{bicaption@text}% + \caption@ifundefined\bicaption@text {\caption@@make@ORI{#1}{#2}}% {\bicaption@@make{#1}{#2}{\bicaption@text}% \global\let\bicaption@label\@undefined diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx index 7e93fe05176..b45b87679d7 100644 --- a/Master/texmf-dist/source/latex/caption/caption.dtx +++ b/Master/texmf-dist/source/latex/caption/caption.dtx @@ -25,7 +25,7 @@ % caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{3589} +% \CheckSum{3655} % % \iffalse %<*driver> @@ -220,7 +220,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2011/08/06 v3.2 Customizing captions (AR)] +\ProvidesPackage{caption}[2011/08/18 v3.2b Customizing captions (AR)] %\@ifundefined{PackageRedefines}{}{\PackageRedefines{caption}{caption}} % \end{macrocode} % @@ -328,7 +328,7 @@ \newcommand*\caption@SetName[2]{% \caption@setname{#1}{#2}% \begingroup - \@ifundefined{languagename}{}{% + \caption@ifundefined\languagename{}{% \@ifundefined{captions\languagename}{}{% \expandafter\g@addto@macro\csname captions\languagename\endcsname {\caption@setname{#1}{#2}}}}% @@ -345,15 +345,15 @@ % \changes{v3.1f}{2007/12/21}{Options \opt{figurewithin} and \opt{tablewithin} added} % \changes{v3.1i}{2008/04/13}{Option \opt{within} added} % \changes{v3.1l}{2010/01/09}{The \opt{within} options are now available within the document, too} -% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined floats -% declared with \cs{DeclareCaptionType}, too} +% \changes{v3.1l}{2010/01/09}{The global \opt{within} option will now affect user-defined +% floats declared with \cs{DeclareCaptionType}, too} % % \begin{macro}{\caption@DeclareWithinOption} % \changes{v3.1l}{2010/01/09}{This macro and its usage added} % \begin{macrocode} \newcommand*\caption@DeclareWithinOption[1]{% \DeclareCaptionOption{#1within}{\caption@Within{#1}{##1}}% - \DeclareCaptionOption{#1without}{\caption@Within{#1}{none}}} + \DeclareCaptionOptionNoValue{#1without}{\caption@Within{#1}{none}}} % \end{macrocode} % \end{macro} % \begin{macrocode} @@ -362,11 +362,11 @@ % \end{macrocode} % \begin{macrocode} \DeclareCaptionOption{within}{% - \@ifundefined{c@figure}{}{\caption@Within{figure}{#1}}% - \@ifundefined{c@table}{}{\caption@Within{table}{#1}}% + \caption@ifundefined\c@figure{}{\caption@Within{figure}{#1}}% + \caption@ifundefined\c@table{}{\caption@Within{table}{#1}}% \caption@For{typelist}{\caption@Within{##1}{#1}}% \def\caption@within@default{#1}} -\DeclareCaptionOption{without}{\KV@caption@within{none}} +\DeclareCaptionOptionNoValue{without}{\KV@caption@within{none}} % \end{macrocode} % \begin{macro}{\caption@within} % \changes{v3.1}{2007/12/21}{This macro added} @@ -635,7 +635,7 @@ % \end{macro} % % \begin{macrocode} - \@ifundefined{cap@indent}{}{\caption@setcapindent} + \caption@ifundefined\cap@indent{}{\caption@setcapindent} % \end{macrocode} % % \begin{macro}{\setcapwidth} @@ -652,7 +652,7 @@ % \begin{macrocode} \newcommand*\caption@setcapwidth[1]{% \ifx\\#1\\\else - \@ifundefined{cap@margin}{}{% + \caption@ifundefined\cap@margin{}{% \def\@tempa{captionbeside}% \ifx\@tempa\@currenvir\else\caption@Warning{% Ignoring optional argument [#1] of \string\setcapwidth\MessageBreak}% @@ -718,7 +718,7 @@ % % \changes{v3.1}{2007/03/17}{We do not process global options anymore} % \begin{macrocode} -\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}% +\caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}} \caption@ProcessOptions*{caption} % \end{macrocode} % @@ -742,7 +742,8 @@ \caption@star {\caption@refstepcounter\@captype}% {\caption@dblarg{\@caption\@captype}}}% - {\caption@Error{\noexpand\caption outside float}}}% + {\caption@Error{\noexpand\caption outside float}% + \caption@withoptargs\@gobbletwo}} % \end{macrocode} % \end{macro} % @@ -753,7 +754,7 @@ % \package{sidecap} package, too.} % \begin{macrocode} \newcommand*\caption@star[2]{% - \@ifstar{\global\caption@startrue#2[]}{#1#2}}% + \@ifstar{\global\caption@startrue#2[]}{#1#2}} % \end{macrocode} % \end{macro} % @@ -794,7 +795,7 @@ \@makecaption{\csname fnum@#1\endcsname}% {\ignorespaces\caption@makeanchor{#3}}\par \caption@if@minipage\@minipagetrue\@minipagefalse}% - \caption@end}% + \caption@end} % \end{macrocode} % \end{macro} % @@ -1221,7 +1222,7 @@ % % The option |compatibility=| will override the compatibility mode. % \begin{macrocode} - \@ifundefined{caption@ifcompatibility}% + \caption@ifundefined\caption@ifcompatibility {\let\caption@ifcompatibility\caption@ifincompatible \let\caption@tempa\caption@WarningNoLine}% {\let\caption@tempa\@gobble}% suppress warning @@ -1252,11 +1253,11 @@ % \begin{macrocode} \caption@AtBeginDocument*{% \let\caption@start\relax - \@ifundefined{caption@ORI@capstart}{}{% + \caption@ifundefined\caption@ORI@capstart{}{% \caption@Debug{% Restore hypcap definition of \string\capstart\@gobble}% \let\capstart\caption@ORI@capstart}% - \@ifundefined{caption@ORI@float@makebox}{}{% + \caption@ifundefined\caption@ORI@float@makebox{}{% \caption@Debug{% Restore hyperref redefinition of \string\float@makebox\@gobble}% \let\float@makebox\caption@ORI@float@makebox}% @@ -1351,8 +1352,8 @@ \DeclareCaptionOption{type*}{\setcaptiontype*{#1}}% % \end{macrocode} % \begin{macrocode} - \DeclareCaptionOption{subtype}[sub\@captype]{\caption@setsubtype{#1}}% - \DeclareCaptionOption{subtype*}[sub\@captype]{\caption@setsubtype*{#1}}% + \DeclareCaptionOptionNoValue{subtype}{\setcaptionsubtype\relax}% + \DeclareCaptionOptionNoValue{subtype*}{\setcaptionsubtype*}% % \end{macrocode} % \begin{macrocode} } @@ -1373,6 +1374,23 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\setcaptionsubtype} +% \changes{v3.2a}{2011/08/15}{This macro added} +% Same, but sets the sub-type. +% \begin{macrocode} +\newcommand\setcaptionsubtype{% + \caption@iftype + \caption@setsubtype + {\caption@Error{\noexpand\setcaptionsubtype outside float}}}% +% \end{macrocode} +% \begin{macrocode} +\newcommand\caption@setsubtype{% + \@ifstar + {\caption@@settype{sub}*{sub\@captype}}% + {\caption@@settype{sub}{sub\@captype}}}% +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\caption@settype} % \changes{v3.1}{2007/05/09}{This macro added} % \changes{v3.1b}{2007/09/22}{Usage of \cs{caption@xlabel} added} @@ -1396,12 +1414,6 @@ \caption@@settype{}} % \end{macrocode} % \begin{macrocode} -\newcommand*\caption@setsubtype{% - \caption@iftype - {\caption@@settype{sub}}% - {\caption@Error{Option `subtype=' outside float}}}% -% \end{macrocode} -% \begin{macrocode} \newcommand*\caption@@settype[1]{% \caption@teststar{\caption@@@settype{#1}}\@firstoftwo\@secondoftwo} % \end{macrocode} @@ -1440,8 +1452,8 @@ #2{}{% \let\@currentlabel\caption@undefinedlabel % \let\@currentHlabel\@undefined - \ifx\caption@ORI@label\@undefined - \let\caption@ORI@label\label + \ifx\caption@x@label\@undefined + \let\caption@x@label\label \let\label\caption@xlabel \fi \caption@start}} @@ -1462,16 +1474,8 @@ % are inside a floating environment) this helper macro was introduced. % \begin{macrocode} \newcommand*\caption@iftype{% - \@ifundefined{@captype}{\let\@captype\@undefined\@secondoftwo}\@firstoftwo} + \caption@ifundefined\@captype\@secondoftwo\@firstoftwo} % \end{macrocode} -% \iffalse -% \newcommand*\caption@iftype{% -% \begingroup -% \@ifundefined{@captype}% -% {\aftergroup\@secondoftwo}% -% {\aftergroup\@firstoftwo}% -% \endgroup} -% \fi % \end{macro} % % \begin{macro}{\caption@checkgrouplevel} @@ -1489,7 +1493,7 @@ \caption@Debug{TeX engine: e-TeX} \newcommand*\caption@checkgrouplevel[2]{% \@ifundefined{#1caption@grouplevel}{% - \@ifundefined{caption@grouplevel}{\let\caption@grouplevel\z@}{}% + \caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}% \ifnum\currentgrouplevel>\caption@grouplevel\relax \expandafter\edef\csname #1caption@grouplevel\endcsname{% \the\currentgrouplevel}% @@ -1534,7 +1538,7 @@ \newcommand*\caption@xlabel[1]{% \caption@@xlabel \def\caption@labelname{#1}% - \caption@ORI@label{#1}} + \caption@x@label{#1}} % \end{macrocode} % \begin{macrocode} \newcommand*\caption@@xlabel{% @@ -1596,10 +1600,11 @@ % % \begin{macro}{\captionbox} % \changes{v3.2}{2010/12/17}{This macro added} +% \changes{v3.2a}{2011/08/16}{\cs{captionsetup} replaces with \cs{captionbox@settype} and \cs{caption@setposition}} % A |\parbox| with contents and caption, separated by an invisible |\hrule|. % \begin{macrocode} \newcommand*\captionbox{% - \let\captionbox@type\@empty + \let\captionbox@settype\@gobble \caption@withoptargs\caption@box} % \end{macrocode} % \begin{macrocode} @@ -1614,11 +1619,12 @@ \long\def\caption@iibox#1#2#3[#4]#5{% \setbox\@tempboxa\hbox{#5}% \begingroup - \expandafter\captionsetup\expandafter{\captionbox@type*}% set \caption@position + \captionbox@settype*% set \caption@position \caption@iftop{% \endgroup \parbox[t]{#3}{% - \expandafter\captionsetup\expandafter{\captionbox@type,position=t}% + \captionbox@settype\relax + \caption@setposition t% \vbox{\caption#1{#2}}% \captionbox@hrule \csname caption@hj@#4\endcsname @@ -1626,7 +1632,8 @@ }{% \endgroup \parbox[b]{#3}{% - \expandafter\captionsetup\expandafter{\captionbox@type,position=b}% + \captionbox@settype\relax + \caption@setposition b% \csname caption@hj@#4\endcsname \unhbox\@tempboxa \captionbox@hrule @@ -1643,9 +1650,6 @@ \providecommand*\caption@hj@r{\raggedleft} \providecommand*\caption@hj@s{} % \end{macrocode} -% \begin{macrocode} -\DeclareCaptionOption{*}[]{} -% \end{macrocode} % \end{macro} % % \subsection{\cs{ContinuedFloat}} @@ -1797,7 +1801,7 @@ % A |\relax| was added compared to |\@dblarg| so |\caption{}| will be % expanded to |\caption[\relax]{}| (and not to |\caption[]{}|). % \begin{macrocode} -\@ifundefined{kernel@ifnextchar}% +\caption@ifundefined\kernel@ifnextchar {\newcommand\caption@dblarg[1]{\@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% {\newcommand\caption@dblarg[1]{\kernel@ifnextchar[{#1}{\caption@xdblarg{#1}}}}% \newcommand\caption@xdblarg[2]{#1[{#2\relax}]{#2}}% @@ -2015,7 +2019,7 @@ % This one is needed for support of the \package{nameref} package. % \begin{macrocode} \newcommand\caption@gettitle[1]{% - \@ifundefined{NR@gettitle}% + \caption@ifundefined\NR@gettitle {\def\@currentlabelname{#1}}% {\NR@gettitle{#1}}} % \end{macrocode} @@ -2044,7 +2048,7 @@ % Initialize the sub-captions defined with \cs{newsubfloat}\cite{subfig}\ldots % \begin{macrocode} \caption@AtBeginDocument*{% - \@ifundefined{sf@counterlist}{}{% + \caption@ifundefined\sf@counterlist{}{% \@for\sf@temp:=\sf@counterlist\do{% \expandafter\caption@DeclareSubType\sf@temp\@nil}}} % \end{macrocode} @@ -2053,10 +2057,13 @@ % \changes{v3.1g}{2008/03/20}{Redefinition of \cs{caption@setlist} added} % \changes{v3.1k}{2009/10/09}{Bugfix 09-08-12b: \cs{@makecaption} will now be restored here, too} % \changes{v3.2}{2011/06/26}{Uses \cs{caption@@addcontentsline} instead of \cs{addcontentsline} now} +% \changes{v3.2a}{2011/08/17}{Redefinition of \cs{phantomcaption} added} +% \changes{v3.2a}{2011/08/17}{Usage of \cs{caption@warmup} added} % Hook, will be used inside \cs{caption@setsubtype}. % \begin{macrocode} \newcommand*\caption@subtypehook{% \ifx\caption\caption@subcaption \else + \caption@warmup % \end{macrocode} % \begin{macrocode} \caption@ifrefstepcounter{}{% @@ -2087,6 +2094,7 @@ % \end{macrocode} % \begin{macrocode} \let\caption\caption@subcaption + \let\phantomcaption\caption@subphantom \let\@makecaption\caption@makecaption \fi}% % \end{macrocode} @@ -2096,12 +2104,20 @@ % Makes a sub-caption. % \begin{macrocode} \newcommand*\caption@subcaption{% - \caption@iftype - {\caption@checkgrouplevel{sub}\subcaption - \caption@star - {\caption@refstepcounter\@subcaptype}% - {\caption@dblarg{\@caption\@subcaptype}}}% - {\caption@Error{\noexpand\subcaption outside float}}} + \caption@checkgrouplevel{sub}\subcaption + \caption@star + {\caption@refstepcounter\@subcaptype}% + {\caption@dblarg{\@caption\@subcaptype}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@subphantom} +% \changes{v3.2a}{2011/08/17}{This macro added} +% Same as |\phantomcaption|, but for sub-captions. +% \begin{macrocode} +\newcommand*\caption@subphantom{% + \caption@checkgrouplevel{sub}\phantomsubcaption + \caption@refstepcounter\@subcaptype} % \end{macrocode} % \end{macro} % @@ -2173,7 +2189,7 @@ % % \begin{macrocode} \caption@AtBeginDocument*{% - \@ifundefined{sf@ifpositiontop}{\let\sf@ifpositiontop\@gobbletwo}{}% + \caption@ifundefined\sf@ifpositiontop{\let\sf@ifpositiontop\@gobbletwo}{}% \caption@clearsubcontentslines \g@addto@macro\caption@typehook{\caption@checksubcontentslines}% \AtEndDocument{\caption@checksubcontentslines}}% @@ -2185,7 +2201,7 @@ % \changes{v3.1}{2007/07/29}{\AmS\ \& \SmF\ classes support added} % % \begin{macrocode} -\@ifundefined{smf@makecaption}{}{\let\smf@makecaption\@makecaption} +\caption@ifundefined\smf@makecaption{}{\let\smf@makecaption\@makecaption} % \end{macrocode} % % \subsubsection{The beamer class} @@ -2229,7 +2245,7 @@ % so we need to update |\scr@caption| here, too. % % \begin{macrocode} -\@ifundefined{scr@caption}{}{% +\caption@ifundefined\scr@caption{}{% \caption@AtBeginDocument{\let\scr@caption\caption}} % \end{macrocode} % @@ -2248,7 +2264,7 @@ % \changes{v3.0h}{2005/10/03}{Adaptation to \package{frenchle/pro} added} % % \begin{macrocode} -\caption@AtBeginDocument{\@ifundefined{frenchTeXmods}{}{% +\caption@AtBeginDocument{\caption@ifundefined\frenchTeXmods{}{% \caption@InfoNoLine{frenchle/pro package is loaded}% % \end{macrocode} % @@ -2262,7 +2278,7 @@ % captions have already been done, so we can do our patches immediately. % Otherwise we must add our stuff to |\GOfrench|. % \begin{macrocode} - \@ifundefined{GOfrench}% + \caption@ifundefined\GOfrench {\let\caption@tempa\@firstofone}% {\def\caption@tempa{\g@addto@macro\GOfrench}}% \caption@tempa{% @@ -2415,14 +2431,13 @@ % \changes{v3.1f}{2007/11/16}{Uses `space hack' instead of \cs{ignorespaces} now} % \changes{v3.1g}{2008/01/29}{Starred variants of \cs{ContinuedFloat} and \cs{captionsetup} added} % \changes{v3.2}{2010/10/26}{Bugfix 10-09-01a: Uses \cs{ignorespaces} instead of `space hack' again} -% |\caption@freeze*|\par +% \changes{v3.2a}{2011/08/17}{Starred variant of \cs{caption@freeze} removed} +% \changes{v3.2b}{2011/08/18}{Redefines \cs{caption@setup} instead of \cs{captionsetup} now} +% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised} +% |\caption@freeze|\par % Used by the \package{fltpage} \& \package{sidecap} package support. % \begin{macrocode} \newcommand*\caption@freeze{% - \caption@teststar\caption@@freeze\@gobble\@firstofone}% -% \end{macrocode} -% \begin{macrocode} - \newcommand*\caption@@freeze[1]{% \global\let\caption@SCcontinued\relax \global\let\caption@SCsetup\@undefined \global\let\caption@SClentry\@undefined @@ -2430,52 +2445,72 @@ \global\let\caption@SClabel\@undefined % \end{macrocode} % \begin{macrocode} - \let\caption@ORI@ContinuedFloat\ContinuedFloat + \let\caption@frozen@ContinuedFloat\ContinuedFloat \def\ContinuedFloat{% \caption@withoptargs\caption@SC@ContinuedFloat}% \def\caption@SC@ContinuedFloat##1{% - \let\caption@ORI@setcounter\setcounter - \let\caption@ORI@addtocounter\addtocounter + \let\caption@frozen@setcounter\setcounter + \let\caption@frozen@addtocounter\addtocounter \def\setcounter####1####2{\csname c@####1\endcsname####2\relax}% \def\addtocounter####1####2{\advance\csname c@####1\endcsname ####2\relax}% - \caption@ORI@ContinuedFloat##1% - \global\let\caption@SCcontinued\caption@ORI@ContinuedFloat - \let\setcounter\caption@ORI@setcounter - \let\addtocounter\caption@ORI@addtocounter}% - \let\caption@ORI@setup\captionsetup - \def\captionsetup{% - \caption@withoptargs\caption@SC@setup}% - \def\caption@SC@setup##1##2{% - \caption@g@addto@list\caption@SCsetup{##2}% - \caption@ORI@setup##1{##2}}% - \let\caption@ORI\caption + \caption@frozen@ContinuedFloat##1% + \global\let\caption@SCcontinued\caption@frozen@ContinuedFloat + \let\setcounter\caption@frozen@setcounter + \let\addtocounter\caption@frozen@addtocounter}% + \let\caption@frozen@setup\caption@setup + \def\caption@setup##1{% + \caption@g@addto@list\caption@SCsetup{##1}% + \caption@frozen@setup{##1}}% + \let\caption@frozen\caption \def\caption{% \def\caption{\caption@Error{% Only one \noexpand\caption can be placed in this environment}}% \let\captionsetup\caption@setup \let\caption@@refstepcounter\caption@l@stepcounter - \caption@ORI}% + \caption@frozen}% + \let\caption@frozen@\@caption \long\def\@caption##1[##2]##3{% % \@bsphack \gdef\caption@SClentry{##2}% \gdef\caption@SCtext{##3}% + \let\@currentlabel\caption@SCcurrentlabel % \@esphack}% \ignorespaces}% - #1{% is \@gobble in star form, and \@firstofone otherwise - \def\label##1{\@bsphack\gdef\caption@SClabel{##1}\@esphack}}% + \let\caption@frozen@label\label + \def\label##1{% + \ifx\@currentlabel\caption@SCcurrentlabel + \@bsphack\gdef\caption@SClabel{##1}\@esphack + \else + \caption@frozen@label{##1}% + \fi}% + \def\caption@SCcurrentlabel{???}% % \end{macrocode} % \begin{macrocode} }% % \end{macrocode} % \end{macro} % +% \begin{macro}{\caption@warmup} +% \changes{v3.2a}{2011/08/17}{This macro added} +% |\caption@warmup| +% \begin{macrocode} + \newcommand*\caption@warmup{% + \ifx\caption@frozen\@undefined\else + \let\caption@setup\caption@frozen@setup + \let\caption\caption@frozen + \let\@caption\caption@frozen@ + \let\label\caption@frozen@label + \fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\caption@defrost} % \changes{v3.1}{2007/07/22}{This macro added} % \changes{v3.1g}{2008/01/30}{\cs{caption@defrost@setup} added} % |\caption@defrost| % \begin{macrocode} \newcommand*\caption@defrost{% - \ifx\caption@ORI@ContinuedFloat\@undefined + \ifx\caption@frozen\@undefined \caption@defrost@setup \ifx\caption@SCtext\@undefined \else \expandafter\expandafter\expandafter\caption @@ -2502,7 +2537,7 @@ % \end{macro} % % \begin{macrocode} - }{}% + }{\let\caption@warmup\relax}% \caption@undefbool{needfreeze}} % \end{macrocode} % @@ -2896,10 +2931,10 @@ \def\@captype{#1}% \let\FP@LabelText\@empty \begin{lrbox}{\FP@floatCorpusBOX}% + \caption@freeze \caption@ifFPrefcap - {\caption@freeze\relax}% - {\def\label##1{\@bsphack\gdef\FP@LabelText{##1}\@esphack}% - \caption@freeze*}% + {}% + {\def\label##1{\@bsphack\gdef\FP@LabelText{##1}\@esphack}}% \ignorespaces}% % \end{macrocode} % \end{macro} @@ -3013,11 +3048,11 @@ % \begin{macrocode} \caption@IfPackageLoaded{hyperref}[2003/11/30 v6.74m]{% % Test if hyperref has stopped early - \@ifundefined{ifhyp@stoppedearly}{% + \caption@ifundefined\ifhyp@stoppedearly{% \newif\ifhyp@stoppedearly - \@ifundefined{H@refstepcounter}\hyp@stoppedearlytrue{% - \@ifundefined{hyper@makecurrent}\hyp@stoppedearlytrue{% - \@ifundefined{measuring@true}\hyp@stoppedearlytrue{}}}}{}% + \caption@ifundefined\H@refstepcounter\hyp@stoppedearlytrue{% + \caption@ifundefined\hyper@makecurrent\hyp@stoppedearlytrue{% + \caption@ifundefined\measuring@true\hyp@stoppedearlytrue{}}}}{}% \ifhyp@stoppedearly % hyperref has stopped early \caption@InfoNoLine{% Hyperref support is turned off\MessageBreak @@ -3214,7 +3249,7 @@ % but there isn't any. % \begin{macrocode} \def\caption@@start{% - \@ifundefined{hc@currentHref}{% + \caption@ifundefined\hc@currentHref{% \caption@Warning{% The option `hypcap=true' will be ignored for this\MessageBreak particular \string\caption}}{}}% @@ -3272,7 +3307,7 @@ % Do our own redefinition of |\float@makebox|, if it was redefined by % the \package{hyperref} package. % \begin{macrocode} - \@ifundefined{HyOrg@float@makebox}{}{% + \caption@ifundefined\HyOrg@float@makebox{}{% \caption@Debug{% Redefining \noexpand\float@makebox (again)\@gobble}% \let\caption@ORI@float@makebox\float@makebox % save for compatibility mode @@ -3309,7 +3344,7 @@ % environment, at least unless a new |\capstart| will be placed. % \begin{macrocode} \let\caption@ORI@capstart\capstart % save for compatibility mode - \@ifundefined{capstarttrue}% check for v1.10 of hypcap package + \caption@ifundefined\capstarttrue % check for v1.10 of hypcap package {\def\capstart{\caption@start@}}% {\def\capstart{\ifcapstart\caption@start@\fi}}% \let\caption@start\relax @@ -3735,7 +3770,7 @@ % Initial set |\@piccaptype| and undefine |\@captype| which was set to % |figure| by the \package{picins} package. % \begin{macrocode} - \@ifundefined{@piccaptype}{% + \caption@ifundefined\@piccaptype{% \caption@iftype{% \let\@piccaptype\@captype }{% @@ -3955,18 +3990,18 @@ % \changes{v3.0b}{2004/05/16}{Local definition of \cs{captionsetup} added} % \changes{v3.0c}{2004/07/16}{Bugfix 04-07-15: Check for \cs{caption@star} removed} % \changes{v3.1c}{2007/10/06}{\cs{caption} will be saved \& restored now} +% \changes{v3.2a}{2011/08/17}{Bugfix: Uses \cs{caption@freeze} instead of \cs{caption@freeze*} now} % This macro will be called at the start of the environment, here is a good % opportunity to do some adaptations to |\caption| and |\captionsetup|. % \begin{macrocode} \let\caption@ORI@SC@zfloat\SC@zfloat \def\SC@zfloat#1#2#3[#4]{% % \end{macrocode} -% First we use the original definition, but save \& restore \cs{caption} -% so \cs{caption@freeze} will work correctly. +% First we use the original definition, but restore \cs{caption} and \cs{label} +% so \cs{caption@freeze} and \cs{caption@warmup} will work correctly. % \begin{macrocode} - \let\caption@ORI\caption \caption@ORI@SC@zfloat{#1}{#2}{#3}[#4]% - \let\caption\caption@ORI + \SC@RestoreCommands % \end{macrocode} % Since the sidecap package uses our |\caption| code outside the % environment the regular |\captionsetup| will not work. @@ -3975,7 +4010,16 @@ % Furthermore we need to make |\caption*| work. % \begin{macrocode} \caption@settype*{#2}% - \caption@freeze*}% + \caption@freeze +% \end{macrocode} +% The sidecap package uses |\ifx\label\SC@label| to test if it is just inside a +% |SC|\-|figure| or not. So we redefine |\SC@label| here so this test will still work. +% \begin{macrocode} + \let\SC@label\label}% +% \end{macrocode} +% \begin{macrocode} + \providecommand*\SC@RestoreCommands{% + \let\caption=\SC@orig@caption \let\label=\SC@orig@label}% % \end{macrocode} % \end{macro} % @@ -4017,7 +4061,7 @@ % \begin{macrocode} \def\caption@setSC@justify{% \caption@clearmargin - \@ifundefined{SC@justify}{}{% + \caption@ifundefined\SC@justify{}{% \ifx\SC@justify\@empty \else \let\caption@hj\SC@justify \let\SC@justify\@empty @@ -4398,7 +4442,7 @@ % |\float@restyle| (if defined), too, so new or restyled floats will be % handled correctly, too. % \begin{macrocode} - \@ifundefined{float@restyle}{}{% + \caption@ifundefined\float@restyle{}{% \toks@=\expandafter{\float@restyle{#1}% (env may or may not be defined) \caption@restylewrapfloat{#1}}% \edef\@tempa{\def\noexpand\float@restyle##1{\the\toks@}}% diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx index cc40823cbc1..cf6d48a3072 100644 --- a/Master/texmf-dist/source/latex/caption/caption3.dtx +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -25,7 +25,7 @@ % caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{4056} +% \CheckSum{4127} % % \iffalse %<*driver> @@ -200,7 +200,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption3}[2011/08/06 v1.3 caption3 kernel (AR)] +\ProvidesPackage{caption3}[2011/08/18 v1.3b caption3 kernel (AR)] % \end{macrocode} % % \subsection{Generic helpers} @@ -252,6 +252,23 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\caption@ifundefined} +% \changes{v1.3a}{2011/08/12}{This macro added} +% \changes{v1.3b}{2011/08/18}{Made expandable} +% Similar to \cs{@ifundefined} offered by the \LaTeX kernel, but does +% not define the undefined macro as \cs{relax}. +% \begin{macrocode} +\newcommand*\caption@ifundefined[1]{% + \ifx#1\@undefined + \expandafter\@firstoftwo + \else\ifx#1\relax + \expandafter\expandafter\expandafter\@firstoftwo + \else + \expandafter\expandafter\expandafter\@secondoftwo + \fi\fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\caption@ifinlist} % \changes{v1.1}{2007/07/29}{Rewritten} % This helper macro checks if the first argument is in the comma separated @@ -1337,7 +1354,7 @@ % of the \package{subfig} package (Sigh!)} % \begin{macrocode} \providecommand*\caption@ifkomaclass{% - \@ifundefined{scr@caption}\@gobble\@firstofone} + \caption@ifundefined\scr@caption\@gobble\@firstofone} \@onlypreamble\caption@ifkomaclass % \end{macrocode} % \begin{macrocode} @@ -1862,7 +1879,7 @@ % \changes{v1.2d}{2009/10/09}{Bugfix 09-05-18: \package{setspace} package support revised} % \begin{macrocode} \DeclareCaptionFont{singlespacing}{% - \@ifundefined{setspace@singlespace}{}{% + \caption@ifundefined\setspace@singlespace{}{% \setstretch\setspace@singlespace}}% normally 1 \DeclareCaptionFont{onehalfspacing}{\onehalfspacing} \DeclareCaptionFont{doublespacing}{\doublespacing} @@ -2047,9 +2064,9 @@ % Usually these skips are defined within the document class, but some % document classes don't do so. % \begin{macrocode} -\@ifundefined{abovecaptionskip}{% +\caption@ifundefined\abovecaptionskip{% \newlength\abovecaptionskip\setlength\abovecaptionskip{10\p@}}{} -\@ifundefined{belowcaptionskip}{% +\caption@ifundefined\belowcaptionskip{% \newlength\belowcaptionskip\setlength\belowcaptionskip{0\p@}}{} % \end{macrocode} % \end{macro} @@ -2341,7 +2358,7 @@ % \begin{macro}{\caption@ifamsclass} % \begin{macrocode} \providecommand*\caption@ifamsclass{% - \@ifundefined{@captionheadfont}\@gobble\@firstofone} + \caption@ifundefined\@captionheadfont\@gobble\@firstofone} \@onlypreamble\caption@ifamsclass % \end{macrocode} % \end{macro} @@ -2418,7 +2435,7 @@ \begingroup\edef\@tempa{\endgroup \noexpand\caption@g@addto@list\noexpand\caption@sty@default {margin=\the\captionmargin - \@ifundefined{smf@makecaption}{}{,maxmargin=.1\linewidth}}} + \caption@ifundefined\smf@makecaption{}{,maxmargin=.1\linewidth}}} \@tempa \caption@g@addto@list\caption@sls@default{margin*=.5\captionmargin} \DeclareCaptionLabelSeparator{default}{.\enspace} @@ -2525,7 +2542,7 @@ % \begin{macro}{\caption@ifkomaclass} % \begin{macrocode} \providecommand*\caption@ifkomaclass{% - \@ifundefined{scr@caption}\@gobble\@firstofone} + \caption@ifundefined\scr@caption\@gobble\@firstofone} \@onlypreamble\caption@ifkomaclass % \end{macrocode} % \end{macro} @@ -2581,7 +2598,7 @@ % \begin{macro}{\caption@ifntgclass} % \begin{macrocode} \providecommand*\caption@ifntgclass{% - \@ifundefined{CaptionFonts}\@gobble\@firstofone} + \caption@ifundefined\CaptionFonts\@gobble\@firstofone} \@onlypreamble\caption@ifntgclass % \end{macrocode} % \end{macro} @@ -2618,7 +2635,7 @@ % \begin{macro}{\caption@ifthesisclass} % \begin{macrocode} \providecommand*\caption@ifthesisclass{% - \@ifundefined{cph@font}{\@gobble}{\@ifundefined{cpb@font}\@gobble\@firstofone}} + \caption@ifundefined\cph@font{\@gobble}{\caption@ifundefined\cpb@font\@gobble\@firstofone}} % \end{macrocode} % \end{macro} % @@ -2651,7 +2668,7 @@ % \changes{v1.1}{2006/05/14}{\package{frenchb} package support added} % % \begin{macrocode} -\@ifundefined{FB@makecaption}{}{% +\caption@ifundefined\FB@makecaption{}{% % \end{macrocode} % \begin{macrocode} \caption@CheckCommand\@makecaption{% @@ -2691,7 +2708,7 @@ % \changes{v1.1}{2006/05/14}{\package{frenchle/pro} package support added} % % \begin{macrocode} -\@ifundefined{frenchTeXmods}{}{% +\caption@ifundefined\frenchTeXmods{}{% % \end{macrocode} % \begin{macrocode} \caption@CheckCommand\@makecaption{% @@ -2707,7 +2724,7 @@ \@mcORI{#1}{\relax\captionfont{#2}}% \else \@mcORI{#1}{#2}% - \fi}} + \fi}}% % \end{macrocode} % \begin{macrocode} \caption@CheckCommand\@makecaption{% @@ -2722,7 +2739,7 @@ \@mcORI{#1}{\relax\captionfont{#2}}% \else \@mcORI{#1}{#2}% - \fi}} + \fi}}% % \end{macrocode} % \begin{macrocode} \DeclareCaptionDefaultFont{textfont}{\itshape}% @@ -2734,12 +2751,29 @@ % % \subsubsection{The hungarian and magyar Babel option} % \changes{v1.3}{2009/03/29}{\package{magyar} package support added} +% \changes{v1.3a}{2011/08/12}{\package{magyar} package support revised} % % \begin{macrocode} \DeclareCaptionListFormat{subperiod}{#2.} % \end{macrocode} % % \begin{macrocode} +\caption@ifundefined\hunnewlabel{}{% + \caption@CheckCommand\@makecaption{% + % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system] + \def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1. #2}% + \ifdim \wd\@tempboxa >\hsize + {#1. #2\csname par\endcsname} + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip}}} +% \end{macrocode} +% +% \begin{macrocode} \def\caption@tempa#1{\@ifundefined{extras#1}{}{% \expandafter\addto\csname extras#1\endcsname{% % change default labelsep and listformat @@ -2749,6 +2783,8 @@ % change default labelsep and listformat \caption@setdefaultlabelsep{colon}% \caption@setdefaultlistformat{subsimple}}% +% \end{macrocode} +% \begin{macrocode} }} % \end{macrocode} % \begin{macrocode} @@ -3245,9 +3281,9 @@ \KV@caption@DCT@within\caption@within@default \caption@DeclareWithinOption{#2}% \KV@caption@DCT@placement{tbp}% - \@ifundefined{c@float@type}% + \caption@ifundefined\c@float@type {\newcounter{float@type}% - \setcounter{float@type}{\@ifundefined{c@figure}14}}% + \setcounter{float@type}{\caption@ifundefined\c@figure14}}% {}% \caption@Debug{float type `#2'=\the\value{float@type}}% \expandafter\xdef\csname ftype@#2\endcsname{\the\value{float@type}}% @@ -3258,7 +3294,7 @@ \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% \expandafter\newcommand\csname listof#2s\endcsname{\caption@listof{#2}}% \expandafter\newcommand\csname listof#2es\endcsname{\caption@listof{#2}}% - \@ifundefined{l@figure}% + \caption@ifundefined\l@figure {\@namedef{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}}% {\expandafter\let\csname l@#2\endcsname\l@figure}% % \end{macrocode} @@ -3277,14 +3313,14 @@ \caption@setkeys[caption]{caption@DCT}{#1}% % \end{macrocode} % \begin{macrocode} - \@ifundefined{float@exts}{\newtoks\float@exts}{}% + \caption@ifundefined\float@exts{\newtoks\float@exts}{}% \let\float@do=\relax \edef\@tempa{\noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#2}}}}% \@tempa - \@ifundefined{float@addtolists}{% + \caption@ifundefined\float@addtolists{% \newcommand\float@addtolists[1]{% \def\float@do####1{\addtocontents{####1}{##1}}\the\float@exts}% - \@ifundefined{@chapter}{}{\caption@PatchChapter}}{}% + \caption@ifundefined\@chapter{}{\caption@PatchChapter}}{}% % \end{macrocode} % \begin{macrocode} \@ifnextchar[\@@DeclareCaptionType\relax} @@ -3302,7 +3338,7 @@ \@onlypreamble\@@@DeclareCaptionType % \end{macrocode} % \begin{macrocode} -\let\DeclareFloatingEnvironment\DeclareCaptionType % old command name +\let\DeclareFloatingEnvironment\DeclareCaptionType % alternative command name \@onlypreamble\DeclareFloatingEnvironment % \end{macrocode} % \end{macro} @@ -3311,7 +3347,7 @@ % \changes{v1.2b}{2008/04/13}{This macro added} % The default `within' value. % \begin{macrocode} -\newcommand*\caption@within@default{\@ifundefined{c@chapter}{none}{chapter}} +\newcommand*\caption@within@default{\caption@ifundefined\c@chapter{none}{chapter}} \@onlypreamble\caption@within@default % \end{macrocode} % \end{macro} @@ -3357,7 +3393,7 @@ \define@key{caption@DCT}{placement}{\@namedef{fps@\caption@type}{#1}} \@onlypreamble@key{caption@DCT}{placement} \define@key{caption@DCT}{within}{% - \@ifundefined{c@chapter}{}{\@removefromreset\caption@type{chapter}}% + \caption@ifundefined\c@chapter{}{\@removefromreset\caption@type{chapter}}% \@removefromreset\caption@type{section}% \begingroup \caption@setkeys[caption]{caption@within}{#1}% @@ -3375,7 +3411,7 @@ \@addtoreset\caption@type{section}% \caption@within{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}} %\@onlypreamble@key{caption@within}{section} -\@ifundefined{c@chapter}{}{% +\caption@ifundefined\c@chapter{}{% \define@key{caption@within}{chapter}[]{% \@addtoreset\caption@type{chapter}% \caption@within{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}} @@ -3547,7 +3583,7 @@ % \end{macrocode} % \begin{macrocode} % scrreprt/scrbook.cls - \@ifundefined{KOMAClassName}{}{% + \caption@ifundefined\KOMAClassName{}{% \caption@Debug{document class `\KOMAClassName' detected}% \let\caption@patch@chapter\@gobblethree}% % \end{macrocode} @@ -3843,7 +3879,7 @@ % \end{macrocode} % \begin{macrocode} \newcommand*\caption@declaresublistentry{% - \@ifundefined{l@chapter}% + \caption@ifundefined\l@chapter {\caption@@declaresublistentry\l@subsubsection}% {\caption@@declaresublistentry\l@subsection}} \@onlypreamble\caption@declaresublistentry diff --git a/Master/texmf-dist/source/latex/caption/ltcaption.dtx b/Master/texmf-dist/source/latex/caption/ltcaption.dtx index 4973327f210..6dae5f9edf0 100644 --- a/Master/texmf-dist/source/latex/caption/ltcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/ltcaption.dtx @@ -25,7 +25,7 @@ % caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{341} +% \CheckSum{343} % % \iffalse %<*driver> @@ -435,7 +435,7 @@ % % \setlength{\parskip}{0pt plus 1pt} % \changes{v1.0}{2007/04/15}{First release} -% \changes{v1.1}{2007/07/06}{Support of |\LTcaptype| added} +% \changes{v1.1}{2007/07/06}{Support of \cs{LTcaptype} added} % % \iffalse % --------------------------------------------------------------------------- % @@ -454,6 +454,11 @@ \ProvidesPackage{ltcaption}[2011/01/01 v1.2a longtable captions (AR)] % \end{macrocode} % +% \begin{macrocode} +\@ifpackageloaded{longtable}{}{% + \PackageError{ltcaption}{longtable package not loaded, aborting}{RTFM}} +% \end{macrocode} +% % \subsection{User interface} % % \begin{macro}{\LTcaptype} diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx index 413d66da4ec..27226210f65 100644 --- a/Master/texmf-dist/source/latex/caption/subcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx @@ -2,7 +2,7 @@ % % This is file `subcaption.dtx'. % -% Copyright (C) 2007-2010 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% Copyright (C) 2007-2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) % % -------------------------------------------------------------------------- % @@ -25,12 +25,12 @@ % caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{78} +% \CheckSum{139} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{subcaption.drv}[2010/09/04 v1.0 Adds a sub-caption feature to the caption package] +\ProvidesFile{subcaption.drv}[2011/08/17 v1.1 Adds a sub-caption feature to the caption package] \hbadness=9999 \newcount\hbadness \hfuzz=74pt % Make TeX shut up. %\errorcontextlines=3 % @@ -47,19 +47,20 @@ \addtolength\marginparwidth{15pt} \ifdim\paperheight=297mm % a4paper \renewcommand\LineBreak{\\} - \renewcommand\PageBreak{\clearpage} + \renewcommand\PageBreak{\clearpage} \fi \fi % \usepackage[bottom]{footmisc} -\usepackage{array,graphicx,pict2e,slashbox} +\usepackage{array,graphicx,overpic,pict2e,slashbox} \IfFileExists{test/tlc2/cat.eps}{\graphicspath{{test/tlc2/}}}{}% % +\PassOptionsToPackage{breaklinks=true}{hyperref} \usepackage{hypdoc} \ifpdf\usepackage{hypdestopt}\fi \hypersetup{pdfkeywords={LaTeX, package, subcaption},pdfstartpage={},pdfstartview={}} % -\usepackage{subcaption}[2010/09/01] +\usepackage{subcaption}[2011/08/01] % needs v1.1 or newer \DeclareCaptionSubType*[arabic]{table} \captionsetup[subtable]{labelformat=simple,labelsep=colon} % @@ -139,21 +140,18 @@ % |\caption@sub|\-|type|\-|hook| (offered by the \package{caption} package). % \end{background*} % -% \setcounter{tocdepth}{2} -% \tableofcontents -% -% \iffalse -% \vfill +% \bigskip % \INFO* % \emph{Please note:} % This package is incompatible with the \package{subfigure} and \package{subfig} % packages. -% \fi % % \clearpage -% \section{The user interface} +% \setcounter{tocdepth}{2} +% \tableofcontents % -% \subsection{Loading the package} +% \clearpage +% \section{Loading the package} % % Load this package using % \begin{quote} @@ -221,7 +219,7 @@ % \end{quote} % % \PageBreak -% \subsection{The \cs{subcaption} command} +% \section{The \cs{subcaption} command} % % \DescribeMacro\subcaption % The easiest and most flexible method to apply a sub-caption is by using the @@ -251,7 +249,7 @@ % gives the result: % \par\bigskip % \noindent\begin{minipage}{\linewidth} -% \captionsetup{type=figure} +% \setcaptiontype{figure} % \begin{minipage}[b]{.5\linewidth} % \centering\large A % \subcaption{A subfigure}\label{fig:1a} @@ -266,21 +264,20 @@ % \bigskip % % \begin{background} -% Prepared with either |\Declare|\-|Caption|\-|Sub|\-|Type| (offered by the -% \package{caption} package) or |\new|\-|sub|\-|float| (offered by the -% \package{subfig} package), the caption package option |subtype| becames -% available. -% Analogous to the |type| option of the \package{caption} package, -% the |subtype| option sets the sub-type of the box or environment +% Prepared with |\Declare|\-|Caption|\-|Sub|\-|Type| (offered by the +% \package{caption} package), the caption package command |\set|\-|caption|\-|sub|\-|type| +% becames available. +% Analogous to the |\set|\-|caption|\-|type| command of the \package{caption} package, +% the |\set|\-|caption|\-|sub|\-|type| command sets the sub-type of the box or environment % (so |\caption| will typeset a sub-caption instead of an ordinary one), % places a proper hyperlink anchor (non-starred variant only), % executes options associated with the sub-type etc.\par % The |\subcaption| command is just a simple combination of -% |\caption|\-|setup{sub|\-|type*}| and |\caption|. +% |\set|\-|caption|\-|sub|\-|type*| and |\caption|. % \end{background} % % \PageBreak -% \subsection{The subfigure \& subtable environments} +% \section{The subfigure \& subtable environments} % % \DescribeEnv{subfigure} % \DescribeEnv{subtable} @@ -327,14 +324,14 @@ % % \begin{background} % The |subfigure| \& |subtable| environments are just simple minipage -% environments with |\caption|\-|setup|\x|{subtype}| as first contents line. +% environments with |\set|\-|caption|\-|sub|\-|type| as first contents line. % These environments are defined with the help of % |\caption@For{subtypelist}|, which executes code for every sub-type % declared with |\DeclareCaptionSubType|. % \end{background} % % \PageBreak -% \subsection{The \cs{subcaptionbox} command} +% \section{The \cs{subcaptionbox} command} % % \DescribeMacro\subcaptionbox % A more powerful (but less flexible) way of setting sub-figures is @@ -382,7 +379,7 @@ % \end{quote} % gives the result:\par % \noindent\begin{minipage}{\linewidth} -% \captionsetup{type=figure} +% \setcaptiontype{figure} % \centering % \subcaptionbox{A cat\label{cat}} % {\includegraphics[width=30pt]{cat}} @@ -406,7 +403,7 @@ % | |\ldots % \end{quote} % \noindent\begin{minipage}{\linewidth} -% \captionsetup{type=figure} +% \setcaptiontype{figure} % \centering % \subcaptionbox{A cat\label{cat2}} % [2.5cm]{\includegraphics[width=30pt]{cat}} @@ -430,7 +427,7 @@ % | |\ldots % \end{quote} % \noindent\begin{minipage}{\linewidth} -% \captionsetup{type=figure} +% \setcaptiontype{figure} % \centering % \subcaptionbox{A cat\label{cat3}} % [.4\linewidth]{\includegraphics[width=39.34724pt]{cat}}%^^A @@ -443,7 +440,7 @@ % % \iffalse % \noindent\begin{minipage}{\linewidth} -% \captionsetup{type=figure} +% \setcaptiontype{figure} % \centering % \hbox{\subcaptionbox{An elephant\label{elephant4}} % {\includegraphics[width=.4\textwidth]{elephant}}%^^A @@ -458,46 +455,19 @@ % % \begin{background} % The |\sub|\-|caption|\-|box| is a |\par|\-|box| with -% |\caption|\-|setup{sub|\-|type}| as first contents line. +% |\set|\-|caption|\-|sub|\-|type| as first contents line. % \iffalse See implementation for details.\fi % \end{background} % % \PageBreak -% \subsection{The \cs{subref} command} -% -% While |\ref|\marg{key} (and |\ref*|\marg{key}, if the \package{hyperref} -% package is used) usually gives a combined result representing the main -% caption counter and the sub-caption one, it is sometimes useful to have -% a reference to the sub-caption only. For this purpose you can use -% \begin{quote} -% |\subref|\marg{key}\\ -% |\subref*|\marg{key}~\footnote{%^^A -% Like \cs{ref*}, \cs{subref*} is only available if the \package{hyperref} -% package\cite{hyperref} is used.}%^^A -% \qquad. -% \end{quote} -% So for example |\ref{cat}| gives the result `\ref{cat}' but |\subref{cat}| -% gives `\subref{cat}'. -% -% \begin{small} -% \emph{Note:} If the sub-caption was defined with the starred variant -% |\Declare|\-|Caption|\-|Sub|\-|Type*|, both |\ref| and |\sub|\-|ref| gives -% the same result. -% \end{small} -% -% \begin{background} -% The |\sub|\-|ref| command demonstrates the usage of |\caption@sub|\-|type|\-|hook| -% which will be called during |\caption|\-|setup{sub|\-|type}|. -% \end{background} -% -% \pagebreak[3] -% \subsection{The \cs{DeclareCaptionSubType} command} +% \section{The \cs{DeclareCaptionSubType} command} % % \DescribeMacro\DeclareCaptionSubType % For using the sub-caption feature of the \package{caption} package some -% commands and counters must be prepared. This is done with~\footnote{%^^A +% commands and counters must be prepared. This is done with +% \iffalse\footnote{%^^A % \cs{newsubfloat} offered by the \package{subfig} package\cite{subfig} -% could be used for this purpose as well.} +% could be used for this purpose as well.}\fi % \begin{quote} % |\DeclareCaptionSubType|\oarg{numbering scheme}\marg{type}\\ % |\DeclareCaptionSubType*|\oarg{numbering scheme}\marg{type} @@ -521,11 +491,11 @@ % would give you sub-caption numbers like `|1b|'. % \end{small} % -% The default numbering scheme is |alph|, but you can use any \LaTeX\ command -% name here which converts a counter to a text value, e.g. |arabic|, |roman|, +% The default numbering scheme is |alph|, but you can use any \LaTeX\ (or self-defined) +% command name here which converts a counter to a text value, e.g. |arabic|, |roman|, % |Roman|, |alph|, |Alph|, |fnsymbol|, \ldots % -% But |\DeclareCaptionSubType| is not for defining new sub-caption types only, +% But |\DeclareCaptionSubType| is not only for defining new sub-caption types, % you can use this command for re-definitions as well, e.g. % \begingroup % \leftmargini=12pt @@ -534,11 +504,11 @@ % |\captionsetup[subtable]{labelformat=simple,labelsep=colon}| % \end{quote} % \endgroup -% \pagebreak[3] +% \pagebreak[2] % will give you sub-captions in |table|s like these ones: % \par\bigskip % \noindent\begin{minipage}{\linewidth} -% \captionsetup{type=table} +% \setcaptiontype{table} % \centering % \caption{Two tables} % \subcaptionbox{Table one}[3cm][c]{\begin{tabular}{cc}A & B\\ C & D\\ \end{tabular}} @@ -550,15 +520,201 @@ % package kernel. % \end{background} % +% \PageBreak +% \section{References} +% +% The macro |\the|\-\meta{counter} is not only responsible for the look of the \meta{counter}, +% but for the look of the references typeset with |\ref|, too. References will be prefixed by +% \LaTeX{} with the internal macro |\p@|\-\meta{counter}. +% +% |\Declare|\-|Caption|\-|Sub|\-|Type| will define both of them for sub-captions +% (e.g. |sub|\-|figure| and |sub|\-|table|), and as you have seen in the last section +% |\Declare|\-|Caption|\-|Sub|\-|Type| will give you some options to control the +% internal (re-)definition of |\the|\-\meta{counter} and |\p@|\-\meta{counter}. +% +% \DescribeMacro\thesubfigure +% \DescribeMacro\p@subfigure +% For example |\thesubfigure| and |\p@subfigure| are (as default) internally defined as +% \begin{quote} +% |\newcommand\thesubfigure{\alph{subfigure}}|\\ +% |\newcommand\p@subfigure{\thefigure}| +% \end{quote} +% so the label of sub-captions will look like `|a|' (decorated by the selected label format), +% while references will look like `|1a|' since they are prefixed by |\p@sub|\-|figure| $=$ +% |\the|\-|figure|. +% +% After |\Declare|\-|Caption|\-|Sub|\-|Type*[arabic]{figure}|, |\the|\-|sub|\-|figure| and +% |\p@sub|\-|figure| will look like +% \begin{quote} +% |\renewcommand\thesubfigure{\thefigure.\arabic{subfigure}}|\\ +% |\renewcommand\p@subfigure{}| +% \end{quote} +% +% But if you want detailed control on how the references will look like, +% the options of |\Declare|\-|Caption|\-|Sub|\-|Type| are potentially not sufficient. +% In this case one need to redefine these two macros on his/her own. +% Some examples: +% +% If you want parentheses around the sub-figure part of the reference, +% so they will look like `|1(a)|', you may get them this way: +% \begin{quote} +% |\usepackage[labelformat=simple]{subcaption}|\\ +% |\renewcommand\thesubfigure{(\alph{subfigure})}| +% \end{quote} +% {\small (\emph{Note:} Since |parens| is the default label format you will get double +% parentheses in sub-captions when not specifiying a different label format, e.g. |simple|.)} +% +% But if you want only a closing parenthesis, so references will look like `|1a)|', +% but the sub-captions itself should still look like `|(a)|', +% this would be a possible solution: +% \begin{quote} +% |\usepackage{subcaption}|\\ +% |\renewcommand\thesubfigure{\alph{subfigure})}|\\ +% |\DeclareCaptionLabelFormat{opening}{(#2}|\\ +% |\captionsetup[subfigure]{labelformat=opening}| +% \end{quote} +% +% {\small(Please note that you need to surround redefinitions of |\p@|\-\meta{counter} +% with |\makeatletter| and |\makeatother|. See +% \url{http://tex.stackexchange.com/questions/8351/} +% for details.)} +% +% \pagebreak[3] +% \subsection{The \cs{subref} command} +% +% While |\ref|\marg{key} (and |\ref*|\marg{key}, if the \package{hyperref} +% package is used) usually gives a combined result representing the main +% caption counter and the sub-caption one, it is sometimes useful to have +% a reference to the sub-caption only. For this purpose you can use +% \begin{quote} +% |\subref|\marg{key}\\ +% |\subref*|\marg{key}~\footnote{%^^A +% Like \cs{ref*}, \cs{subref*} is only available if the \package{hyperref} +% package\cite{hyperref} is used.}%^^A +% \qquad. +% \end{quote} +% So for example |\ref{cat}| gives the result `\ref{cat}' but |\subref{cat}| +% gives `\subref{cat}'. +% +% \begin{small} +% \emph{Note:} If the sub-caption was (re-)defined with the starred variant +% |\Declare|\-|Caption|\-|Sub|\-|Type*|, both |\ref| and |\sub|\-|ref| usually gives +% the same result. +% \end{small} +% +% \begin{background} +% The |\sub|\-|ref| command demonstrates the usage of |\caption@sub|\-|type|\-|hook| +% which will be called during |\caption|\-|setup{sub|\-|type}|. +% \end{background} +% +% \pagebreak[3] +% \subsection{The \opt{subrefformat=} option} +% +% \DescribeMacro{subrefformat=} +% By applying |\Declare|\-|Caption|\-|Sub|\-|Type|, or by redefining |\the|\-\meta{counter} +% and |\p@|\-\meta{counter}, you will change the look of references typeset with |\ref| +% \emph{and} |\sub|\-|ref|. +% But maybe you only want to change the output of |\sub|\-|ref| without +% affecting the references typeset with |\ref|? +% This is possible, too, by using the option \opt{subrefformat}: +% \begin{quote} +% |\captionsetup{subrefformat=|\meta{label format}|}| +% \end{quote} +% This one will choose a label format (either a pre-defined one, or a one defined with +% |\Declare|\-|Caption|\-|Label|\-|Format|) as decorative element to sub-references. +% The default one is |simple| which has no decorative elements but simply typeset +% the reference as it is. +% +% For example +% \begin{quote} +% |\captionsetup{subrefformat=parens}| +% \end{quote} +% will result in references (typeset with |\ref|) like `|1a|' but sub-references +% (typeset with |\subref|) like `|(a)|'. +% +% \subsection{Referencing sub-figures without sub-captions} +% +% If you don't want to give a sub-figure a caption, because the picture itself +% already contains the caption, or for some other reason, you can use the command +% \begin{quote} +% |\phantomsubcaption| +% \end{quote} +% itstead of |\sub|\-|caption|, or -- when inside a |sub|\-|figure| or |sub|\-|table| environment -- +% |\phantom|\-|caption| instead of |\caption|. +% |\phantom|\-|sub|\-|caption| and |\phantom|\-|caption| do not have any arguments, and +% they do not generate any output, but give you an anchor for a |\label| command +% which can be placed afterwards. +% Furthermore it increases the sub-figure resp. sub-table counter. +% +% Please note that -- just like |\sub|\-|caption| -- the |\phantom|\-|sub|\-|caption| +% command \emph{must} be applied inside its own group, box, or environment. +% +% \pagebreak[3] +% An example: +% \begin{quote} +% |\begin{figure}|\\ +% | \centering|\\ +% | {\includegraphics{cat_with_a}|\\ +% | \phantomsubcaption\label{cat}}|\\ +% | {\includegraphics{elephant_with_b}|\\ +% | \phantomsubcaption\label{elephant}}|\\ +% | \caption{Two animals: \subref{cat} a huge cat,|\\ +% | and \subref{elephant} an elephant}|\\ +% |\end{figure}| +% \end{quote} +% +% \noindent\begin{minipage}{\linewidth} +% \setcaptiontype{figure} +% \centering +% \begin{overpic}[width=60pt]{cat} +% \put(40,34){(a)} +% \end{overpic} +% {\phantomsubcaption\label{cat6.3}} +% \begin{overpic}[width=.4\textwidth]{elephant} +% \put(60,50){(b)} +% \end{overpic} +% {\phantomsubcaption\label{elephant6.3}} +% \captionsetup{subrefformat=parens} +% \caption{Two animals: \subref{cat6.3} a huge cat, and \subref{elephant6.3} an elephant} +% \end{minipage} +% +% \pagebreak[3] +% \subsection{Where to place the \cs{label} command?} +% \label{label} +% +% When using |\sub|\-|caption| or |\phantom|\-|sub|\-|caption|, +% or |\caption| or |\phantom|\-|caption| inside a |sub|\-|figure| or |sub|\-|table| environment, +% the |\label| can be either placed inside the caption text or right after the |\sub|\-|caption| or +% |\caption| command, e.g: +% \begin{quote} +% |\subcaption{Some text here\label{label1}}|\\ +% \ldots\\ +% |\subcaption{Some other text}\label{label2}}|\\ +% \ldots\\ +% |\subcaption{Something different}|\\ +% |\label{label3}| +% \end{quote} +% +% When using the |\sub|\-|caption|\-|box| command, the |\label| should be placed inside +% the caption text, e.g.: +% \begin{quote} +% |\subcaptionbox{A description here\label{label4}}|\\ +% | {Some content here}|\\ +% \ldots\\ +% |\subcaptionbox[List-of-Figures entry]|\\ +% | {A description here\label{label5}}|\\ +% | {Some content here}| +% \end{quote} +% % \pagebreak[3] % \subsection{Where do hyperlinks jump?} % \label{hypcap} % % For the |subfigure| \& |subtable| environments and |\subcaptionbox| boxes -% (and own constructs which use |\captionsetup{subtype}|) the +% (and own constructs which use |\set|\-|caption|\-|sub|\-|type|) the % hyperlink anchors will be placed in respect to the |hypcap=| setting. -% While usage of this option is straight-forward ordinary captions, -% the usage for sub-captions depends on the setting for the main captions. +% While usage of this option is straight-forward for ordinary captions, +% the usage for sub-captions depends on the setting regarding the main captions. % This table gives you an overview where the hyperlinks will jump:\par % % \bigskip @@ -600,7 +756,7 @@ % \fi % % \pagebreak[3] -% \subsection{Beyond this package} +% \section{Beyond this package} % \label{floatrow} % % For a more advanced usage of the sub-caption feature of the @@ -612,7 +768,7 @@ % --------------------------------------------------------------------------- % % \fi % -% \pagebreak[2] +% \pagebreak[3] % \section{Thanks} % % I would like to thank @@ -644,11 +800,13 @@ % \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/oberdiek/}% % {\emph{The hypcap package -- Adjusting anchors of captions}}, % 2007/04/09 +% \iffalse % \bibitem{subfig} % Steven D. Cochran:\\ % \href{http://tug.ctan.org/tex-archive/macros/latex/contrib/subfig/}% % {\emph{The subfig package}}, % 2005/07/05 +% \fi % \end{thebibliography} % } % @@ -725,33 +883,33 @@ % \subsection{Identification} % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{subcaption}[2011/01/22 v1.0c Adding subcaptions (AR)] +\ProvidesPackage{subcaption}[2011/08/18 v1.1a Adding subcaptions (AR)] % \end{macrocode} % % \subsection{Initial code} % +% Since we base on the \package{caption} package we load it here. +% \begin{macrocode} +\RequirePackage{caption}[2011/08/18] % needs v3.2b or newer +% \end{macrocode} +% % Since we are incompatible to them an error message will be issued when % the \package{subfigure} or \package{subfig} package is loaded. % \begin{macrocode} -\@ifundefined{subfigure}{}{% +\caption@ifundefined\subfigure{}{% \PackageError{subcaption}{% This package can't be used in cooperation\MessageBreak - with the subfigure package}% + with the subfigure package}{RTFM}% \endinput} % \end{macrocode} % \begin{macrocode} -\@ifundefined{subfloat}{}{% +\caption@ifundefined\subfloat{}{% \PackageError{subcaption}{% This package can't be used in cooperation\MessageBreak - with the subfig package}% + with the subfig package}{RTFM}% \endinput} % \end{macrocode} % -% Since we base on the \package{caption} package we load it here. -% \begin{macrocode} -\RequirePackage{caption}[2010/12/01] % needs v3.2 or newer -% \end{macrocode} -% % \iffalse % \subsection{Declaration of options} % We do not have own options. @@ -770,11 +928,11 @@ % % \subsection{Main code} % -% We call |\DeclareCaptionSubType| for |figure|, |table|, -% and every caption type declared with |\DeclareCaptionType| here. +% We call |\Declare|\-|Caption|\-|Sub|\-|Type| for |figure|, |table|, +% and every caption type declared with |\Declare|\-|Caption|\-|Type| here. % \begin{macrocode} -\@ifundefined{c@figure}{}{\DeclareCaptionSubType{figure}} -\@ifundefined{c@table}{}{\DeclareCaptionSubType{table}} +\caption@ifundefined\c@figure{}{\DeclareCaptionSubType{figure}} +\caption@ifundefined\c@table{}{\DeclareCaptionSubType{table}} \caption@For{typelist}{\DeclareCaptionSubType{#1}} % \end{macrocode} % @@ -782,17 +940,40 @@ % \subsubsection{The \cs{subcaption} command} % % \begin{macro}{\subcaption} -% Without a prefacing |\captionsetup{subtype}|, \cs{subcaption} is some kind -% of |\captionof{sub\@captype}|. +% Without a prefacing |\set|\-|caption|\-|sub|\-|type|, |\sub|\-|caption| is some kind +% of |\caption|\-|of{sub|\-|\@cap|\-|type}|. % \Note{Like \cs{captionof}, this command is designed to be used inside an % own group!} % \begin{macrocode} -\newcommand*\subcaption{\captionsetup{subtype*}\caption} +\newcommand*\subcaption{% + \caption@iftype + {\setcaptionsubtype*\caption}% + {\caption@Error{\noexpand\subcaption outside float}% + \caption@withoptargs\@gobbletwo}}% % \end{macrocode} -% But with a prefacing |\captionsetup{subtype}|, \cs{subcaption} is simply +% But with a prefacing |\set|\-|caption|\-|sub|\-|type|, |\sub|\-|caption| is simply % |\caption|. % \begin{macrocode} -\g@addto@macro\caption@subtypehook{\let\subcaption\caption} +\g@addto@macro\caption@subtypehook{% + \let\subcaption\caption} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsubsection{The \cs{phantomsubcaption} command} +% +% \begin{macro}{\phantomsubcaption} +% \changes{v1.1}{2011/08/17}{This macro added} +% Same as |\phantom|\-|caption|, but for subfigures. +% \begin{macrocode} +\newcommand*\phantomsubcaption{% + \caption@iftype + {\setcaptionsubtype*\phantomcaption}% + {\caption@Error{\noexpand\phantomsubcaption outside float}}}% +% \end{macrocode} +% \begin{macrocode} +\g@addto@macro\caption@subtypehook{% + \let\phantomsubcaption\phantomcaption} % \end{macrocode} % \end{macro} % @@ -802,7 +983,7 @@ % \begin{macro}{subfigure} % \begin{macro}{subtable} % This is just an ordinary \env{minipage} environment with -% |\captionsetup{subtype}| as first contents line. +% |\setcaptionsubtype| as first contents line. % It will be defined using the helper macro |\caption@For{sub|\-|type|\-|list}| % offered by the \package{caption} kernel, so for every caption type % declared with |\Declare|\-|Caption|\-|Type| a corresponding `sub' environment @@ -816,7 +997,7 @@ % \begin{macrocode} \newcommand*\subcaption@minipage[2]{% \minipage#1{#2}% - \captionsetup{subtype}} + \setcaptionsubtype\relax} % \end{macrocode} % \end{macro} % \end{macro} @@ -828,10 +1009,11 @@ % \changes{v1.0a}{2008/05/06}{Adapted to the \opt{rule} option of the \package{caption} package} % \changes{v1.0b}{2008/08/31}{Definition and usage of \cs{subcaption@hrule} added} % \changes{v1.0c}{2010/12/17}{Uses \cs{caption@box} now} +% \changes{v1.1}{2011/08/16}{Adapted to actual version of \cs{caption@box}} % A |\parbox| with contents and sub-caption, separated by an invisible |\hrule|. % \begin{macrocode} \newcommand*\subcaptionbox{% - \def\captionbox@type{subtype}% + \let\captionbox@settype\setcaptionsubtype \caption@withoptargs\caption@box} % \end{macrocode} % \end{macro} @@ -863,10 +1045,47 @@ % \end{macro} % % \begin{macro}{\subref} -% This simply calls |\ref| with the second label. (see |\subcaption@label|) +% \changes{v1.1}{2011/08/14}{Caption option \opt{subrefformat=} added} +% \changes{v1.1a}{2011/08/18}{Uses \cs{caption@setoptions} now} +% This one calls |\ref| with the second label. (see |\subcaption@label|) +% \begin{macrocode} +\DeclareRobustCommand*\subref{\@ifstar{\subcaption@ref*}\@subref} +\newcommand*\@subref{% + \caption@withoptargs\@@subref} +\newcommand*\@@subref[2]{% + \caption@ifundefined\hyperref + {\subcaption@ref#1{#2}}% + {\hyperref[#2]{\subcaption@ref*#1{#2}}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\subcaption@ref{% + \caption@withoptargs\subcaption@@ref} +\newcommand*\subcaption@@ref[2]{% + \begingroup + \caption@setoptions*{sub}% + \subcaption@reffmt\p@subref{\ref#1{sub@#2}}% + \endgroup} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\p@subref{} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\DeclareCaptionOption{subrefformat}{\subcaption@setrefformat{#1}} +% \end{macrocode} +% +% \begin{macro}{\subcaption@setrefformat} +% |\subcaption@setrefformat|\marg{name}\par +% Selecting a subref format simply means saving the code (in |\subcaption@reffmt|). +% \begin{macrocode} +\newcommand*\subcaption@setrefformat[1]{% + \@ifundefined{caption@lfmt@#1}% + {\caption@Error{Undefined label format `#1'}}% + {\expandafter\let\expandafter\subcaption@reffmt\csname caption@lfmt@#1\endcsname}} +% \end{macrocode} % \begin{macrocode} -\DeclareRobustCommand*\subref{\caption@withoptargs\subcaption@ref} -\newcommand*\subcaption@ref[2]{\ref#1{sub@#2}} +\subcaption@setrefformat{simple} % \end{macrocode} % \end{macro} % |