diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/caption3.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/caption/caption3.dtx | 193 |
1 files changed, 130 insertions, 63 deletions
diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx index 75d79b1a2ca..d1b72258426 100644 --- a/Master/texmf-dist/source/latex/caption/caption3.dtx +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -2,7 +2,7 @@ % % This is file `caption3.dtx'. % -% $Id: caption3.dtx 71 2013-04-14 15:14:26Z sommerfeldt $ +% $Id: caption3.dtx 88 2013-05-02 05:15:09Z sommerfeldt $ % $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/trunk/source/caption3.dtx $ % % Copyright (C) 1994-2013 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) @@ -28,12 +28,12 @@ % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{3477} +% \CheckSum{3543} % % \iffalse %<*driver> \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesFile{caption3.drv}[2011/10/09 v1.5 Implementation of the caption kernel] +\ProvidesFile{caption3.drv}[2013/05/01 v1.6 Implementation of the caption kernel] \hbadness=9999 \newcount\hbadness \hfuzz=100pt % Make TeX shut up. %\errorcontextlines=3 % @@ -102,7 +102,7 @@ % This package has version number \fileversion, last revised \filedate.}}%^^A % {the caption kernel}} % \author{Axel Sommerfeldt\\ -% \url{http://sourceforge.net/projects/latex-caption/}} +% \url{http://sourceforge.net/p/latex-caption/}} % \date{\docdate} % \maketitle % @@ -203,8 +203,8 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] \def\caption@tempa$Id: #1 #2 #3-#4-#5 #6${% \def\caption@tempa{#3/#4/#5 }\def\caption@tempb{#2 }} -\caption@tempa $Id: caption3.dtx 71 2013-04-14 15:14:26Z sommerfeldt $ -\ProvidesPackage{caption3}[\caption@tempa v1.5-\caption@tempb caption3 kernel (AR)] +\caption@tempa $Id: caption3.dtx 88 2013-05-02 05:15:09Z sommerfeldt $ +\ProvidesPackage{caption3}[\caption@tempa v1.6-\caption@tempb caption3 kernel (AR)] % \end{macrocode} % % \subsection{Generic helpers} @@ -221,16 +221,27 @@ % \end{macro} % % \begin{macro}{\l@addto@macro} +% \changes{v3.3}{2013/04/26}{Revised} % The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which % globally adds tokens to existing macros, like in |\AtBeginDocument|. -% This is the same but it works local, not global -% (using \cs{edef} instead of \cs{xdef}). +% This is the same but it works local, not global. % \begin{macrocode} -\providecommand\l@addto@macro[2]{% - \begingroup - \toks@\expandafter{#1#2}% - \edef\@tempa{\endgroup\def\noexpand#1{\the\toks@}}% - \@tempa} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname currentgrouplevel\endcsname\relax + \PackageInfo{caption3}{TeX engine: TeX} + \let\caption@ifeTeX\@secondoftwo + \providecommand\l@addto@macro[2]{% + \begingroup + \toks@\expandafter{#1#2}% + \xdef\caption@addto@temp{\the\toks@}% + \endgroup + \let#1\caption@addto@temp} +\else + \PackageInfo{caption3}{TeX engine: e-TeX} + \let\caption@ifeTeX\@firstoftwo + \providecommand\l@addto@macro[2]{% + \edef#1{\unexpanded\expandafter{#1#2}}} +\fi % \end{macrocode} % \end{macro} % @@ -1498,12 +1509,13 @@ % \changes{v1.2}{2007/11/17}{Usage of \opt{size=} added} % \changes{v1.2b}{2008/05/06}{Usage of \opt{rule} added} % \changes{v1.5}{2012/03/15}{\opt{box=parbox} added} +% \changes{v1.6}{2013/05/01}{\opt{box=none} added, \opt{box=parbox} changed to \opt{parbox=parbox}} % This resets (nearly) all caption options to the base ones. % \emph{Note that this does not touch the skips and the positioning!} % \begin{macrocode} \newcommand*\caption@resetstyle{% \caption@setup{% - box=parbox,boxcolor=white,% + box=none,boxcolor=white,parbox=parbox,% format=plain,labelformat=default,labelsep=colon,textformat=simple,% justification=justified,font=,size=,labelfont=,textfont=,% margin=0pt,minmargin=0,maxmargin=0,% @@ -1548,23 +1560,37 @@ % \end{macrocode} % \end{macro} % +% \changes{v1.5}{2012/03/15}{Option \opt{box=} added} +% \changes{v1.6}{2013/05/01}{Option \opt{parbox=} added} % \begin{macrocode} \DeclareCaptionOption{box}{\caption@setbox{#1}} +\DeclareCaptionOption{parbox}{\caption@set@box\caption@parbox{#1}} % \end{macrocode} % % \begin{macro}{\caption@setbox} % |\caption@setbox|\marg{name}\par % Selecting a caption box simply means saving the code (in |\caption@box|). % \begin{macrocode} -\newcommand*\caption@setbox[1]{% - \@ifundefined{caption@box@#1}% - {\caption@Error{Undefined box `#1'}}% - {\expandafter\let\expandafter\caption@box\csname caption@box@#1\endcsname}} +\newcommand*\caption@setbox{% + \caption@set@box\caption@box} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@set@box[2]{% + \@ifundefined{caption@box@#2}% + {\caption@Error{Undefined box `#2'}}% + {\expandafter\let\expandafter#1\csname caption@box@#2\endcsname}} % \end{macrocode} % \end{macro} % -% There are four pre-defined label formats, called `empty', `simple', -% `parens', and `brace'. +% There are four pre-defined boxes, called `empty', `none', +% `parbox', and `colorbox'. +% \changes{v1.0i}{2006/05/13}{We define \cs{captionbox} instead of +% \cs{caption@start/endbox}} +% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{captionbox} changed from +% \cs{parbox-t} to \cs{parbox-b}} +% \changes{v1.2}{2007/11/11}{\cs{captionbox} renamed to \cs{caption@parbox}} +% \changes{v1.5}{2012/03/15}{\cs{caption@parbox} adapted to \cs{DeclareCaptionBox}} +% \changes{v1.6}{2013/05/02}{Option \opt{boxsep=} added} % \begin{macrocode} \DeclareCaptionBox{empty}{} \DeclareCaptionBox{none}{#2} @@ -1572,15 +1598,17 @@ %\DeclareCaptionBox{colorbox}{% % \colorbox{\caption@boxcolor}{\caption@box@parbox{\dimexpr #1-2\fboxsep}{#2}}} \DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{% -% \setlength\caption@tempdima{#1}% + \setlength\caption@tempdima{#1}% \addtolength\caption@tempdima{-2\fboxsep}% - \caption@box@parbox\caption@tempdima{#2}}} + \linewidth=\caption@tempdima\hsize=\caption@tempdima + #2}} \DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}} +\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}} % \end{macrocode} % -% `default' usually maps to `parbox'. +% `default' usually maps to `none`. % \begin{macrocode} -\def\caption@box@default{\caption@box@parbox} +\def\caption@box@default{\caption@box@none} % \end{macrocode} % % \subsection{Formats} @@ -2643,6 +2671,7 @@ % \subsubsection{The beamer class (Part one)} % \changes{v1.1}{2007/03/10}{beamer class support added} % \changes{v1.3}{2011/08/06}{beamer class support revised} +% \changes{v3.3}{2013/04/27}{The beamer template \texttt{caption label separator} will be used now} % % \begin{macro}{\caption@ifbeamerclass} % \begin{macrocode} @@ -2673,6 +2702,8 @@ \nobreak\vskip\belowcaptionskip\nobreak}} % \end{macrocode} % \begin{macro}{\caption@ifbeamertemplate} +% |\caption@ifbeamertemplate|\marg{caption template name}\marg{yes-code}\marg{no-code}\\ +% tests if the given beamer caption template was selected by the user (or not). % \begin{macrocode} \newcommand*\caption@ifbeamertemplate[1]{% \begingroup @@ -2691,7 +2722,8 @@ \caption@declarelabelseparator {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone} {default} - {\caption@ifbeamertemplate{caption name own line}{\\}{: }} + {\caption@ifbeamertemplate{caption name own line}{\\}% + {\usebeamertemplate{caption label separator}}} \DeclareCaptionDefaultFont{font}{% \usebeamerfont*{caption}% \usebeamercolor[fg]{caption}} @@ -3128,6 +3160,7 @@ % \changes{v1.1e}{2007/10/28}{\cs{caption@stepcounter} added} % \changes{v1.5}{2012/03/15}{Uses \cs{caption@tempdima} instead of \cs{@tempdima}} % \changes{v1.5}{2012/12/26}{max-margin stuff moved to \cs{caption@calcmargin}} +% \changes{v1.6}{2013/05/01}{Usage of \cs{caption@box} added} % |\caption@@make|\marg{caption label}\marg{caption text} % \begin{macrocode} \newcommand\caption@@make[2]{% @@ -3136,20 +3169,25 @@ \caption@beginhook % \end{macrocode} % +% Typeset the outer box |\caption@box| +% \begin{macrocode} + \caption@box\linewidth{% +% \end{macrocode} +% % Special single-line treatment (option |singlelinecheck=|) % \begin{macrocode} - \caption@ifslc{\caption@slc{#1}{#2}\caption@singleline\relax}{}% + \caption@ifslc{\caption@slc{#1}{#2}\caption@singleline\relax}{}% % \end{macrocode} % % Typeset the left margin (option |margin=|) % \begin{macrocode} - \caption@calcmargin - \@tempdima\captionmargin - \ifdim\captionmargin@=\z@ \else - \caption@ifoddpage{}{\advance\@tempdima\captionmargin@}% - \fi - \caption@ifh{\advance\@tempdima\caption@indent}% - \hspace\@tempdima + \caption@calcmargin + \caption@tempdima\captionmargin + \ifdim\captionmargin@=\z@ \else + \caption@ifoddpage{}{\advance\caption@tempdima\captionmargin@}% + \fi + \caption@ifh{\advance\caption@tempdima\caption@indent}% + \hspace\caption@tempdima % \end{macrocode} % % We actually use a |\vbox| of width |\captionwidth - \caption@indent| @@ -3157,35 +3195,40 @@ % \Note{\cs{captionindent} is \emph{not} supported if the caption format % was defined with \cs{DeclareCaptionFormat*}.} % \begin{macrocode} - \caption@tempdima\captionwidth - \caption@ifh{\advance\caption@tempdima-\caption@indent}% - \caption@parbox\caption@tempdima{% + \caption@tempdima\captionwidth + \caption@ifh{\advance\caption@tempdima-\caption@indent}% + \caption@parbox\caption@tempdima{% % \end{macrocode} % % Typeset the indention (option |indention=|)\\ % {\small Bugfix 04-05-05: % |\hskip-\caption@indent| replaced by |\ifdim\caption@indent=\z@|\ldots} % \begin{macrocode} - \caption@ifh{% - \ifdim\caption@indent=\z@ - \leavevmode - \else - \hskip-\caption@indent - \fi}% + \caption@ifh{% + \ifdim\caption@indent=\z@ + \leavevmode + \else + \hskip-\caption@indent + \fi}% % \end{macrocode} % % Typeset the caption itself and close the |\caption@parbox| % \begin{macrocode} - \caption@@@make{#1}{#2}}% + \caption@@@make{#1}{#2}}% % \end{macrocode} % % Typeset the right margin (option |margin=|) % \begin{macrocode} - \@tempdima\captionmargin - \ifdim\captionmargin@=\z@ \else - \caption@ifoddpage{\advance\@tempdima\captionmargin@}{}% - \fi - \hspace\@tempdima + \caption@tempdima\captionmargin + \ifdim\captionmargin@=\z@ \else + \caption@ifoddpage{\advance\caption@tempdima\captionmargin@}{}% + \fi + \hspace\caption@tempdima +% \end{macrocode} +% +% Close the outer box |\caption@box| +% \begin{macrocode} + }% % \end{macrocode} % % \begin{macrocode} @@ -3352,21 +3395,6 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\caption@parbox} -% \changes{v1.0i}{2006/05/13}{We define \cs{caption@parbox} instead of -% \cs{caption@start/endbox}} -% \changes{v1.0l}{2006/03/09}{Bugfix 07-03-09: \cs{caption@parbox} changed from -% \cs{parbox-t} to \cs{parbox-b}} -% \changes{v1.2}{2007/11/11}{Renamed from \cs{captionbox} to \cs{caption@parbox}} -% \changes{v1.5}{2012/03/15}{Adapted to \cs{DeclareCaptionBox}} -% |\caption@parbox|\marg{width}\marg{contents}\par -% This macro defines the box which surrounds the caption paragraph. -% (For compatibility reasons we still use |\caption@par|\-|box| instead of |\caption@box|.) -% \begin{macrocode} -\newcommand*\caption@parbox{\caption@box} -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\caption@applyfont} % \changes{v1.3}{2010/09/04}{This macro added} % |\caption@applyfont|\par @@ -3675,6 +3703,45 @@ % \end{macrocode} % \end{macro} % +% Unfortunately the \class{memoir} document class resets the +% \texttt{subfigure} resp.~\texttt{subtable} counter at the begin +% of floating environments, i.e.~at |\@float|. +% As a side-effect |\Continued|\-|Float| does not work correctly. +% For that reason we need to introduce macros to save and restore +% all sub-caption counters here. +% +% \begin{macro}{\caption@restorecounters} +% \changes{v1.5}{2013/05/01}{This macro added} +% |\caption@restore|\-|counters| restores all counters saved with +% |\caption@save|\-|counter|. +% \begin{macrocode} +\newcommand*\caption@restorecounters{% + \caption@restore@counters + \global\let\caption@restore@counters\@empty} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@restore@counters{} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\caption@savesubcounters} +% \changes{v1.5}{2013/05/01}{This macro added} +% |\caption@save|\-|sub|\-|counters| saves all sub-caption counters, +% so they can be restored with |\caption@restore|\-|counters| later on. +% \begin{macrocode} +\newcommand*\caption@savesubcounters{% + \def\@elt##1{\caption@savecounter{sub##1}}% + \caption@subtypelist + \let\@elt\relax}% +% \end{macrocode} +% \begin{macrocode} +\newcommand*\caption@savecounter[1]{% + \edef\caption@tempa{% + \noexpand\l@addto@macro\noexpand\caption@restore@counters + {\noexpand\setcounter{#1}{\number\value{#1}}}}% + \caption@tempa} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\caption@For} % \changes{v1.1a}{2007/09/07}{This macro added} % \changes{v1.2}{2007/11/16}{Renamed from \cs{ForFloatingEnvironments} to \cs{caption@For}} |