summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/caption.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/caption.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/caption.dtx220
1 files changed, 131 insertions, 89 deletions
diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx
index 64991dcd6fa..36d35e39f2e 100644
--- a/Master/texmf-dist/source/latex/caption/caption.dtx
+++ b/Master/texmf-dist/source/latex/caption/caption.dtx
@@ -2,7 +2,7 @@
%
% This is file `caption.dtx'.
%
-% $Id: caption.dtx 73 2013-04-14 19:40:46Z sommerfeldt $
+% $Id: caption.dtx 89 2013-05-02 07:05:20Z sommerfeldt $
% $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/trunk/source/caption.dtx $
%
% Copyright (C) 1994-2013 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
@@ -28,7 +28,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{3491}
+% \CheckSum{3507}
%
% \iffalse
%<*driver>
@@ -99,7 +99,7 @@
% This package has version number \fileversion, last revised \filedate.}}%^^A
% {the caption package}}
% \author{Axel Sommerfeldt\\
-% \url{http://sourceforge.net/projects/latex-caption/}}
+% \url{http://sourceforge.net/p/latex-caption/}}
% \date{\docdate}
% \maketitle
%
@@ -223,14 +223,14 @@
\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: caption.dtx 73 2013-04-14 19:40:46Z sommerfeldt $
+\caption@tempa $Id: caption.dtx 89 2013-05-02 07:05:20Z sommerfeldt $
\ProvidesPackage{caption}[\caption@tempa v3.3-\caption@tempb Customizing captions (AR)]
% \end{macrocode}
%
% \subsection{Loading the kernel}
%
% \begin{macrocode}
-\RequirePackage{caption3}[2012/12/26] % needs v1.5 or newer
+\RequirePackage{caption3}[2013/05/01] % needs v1.6 or newer
% \end{macrocode}
%
% \subsection{Check against incompatible document classes}
@@ -1512,7 +1512,19 @@
% \end{macrocode}
% \end{macro}
%
-% \subsection{\cs{captionof} and \cs{captionlistentry}}
+% \begin{macro}{\phantomcaption}
+% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
+% |\phantomcaption|\par
+% Use this one for figures with subcaptions but without main caption.
+% \begin{macrocode}
+\newcommand\phantomcaption{%
+ \caption@iftype
+ {\caption@refstepcounter\@captype}%
+ {\caption@Error{\noexpand\phantomcaption outside float}}}%
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{\cs{captionof}}
%
% \changes{v3.0d}{2004/08/03}{Option \opt{type=} added}
% \changes{v3.1}{2007/06/25}{Option \opt{type*=} added}
@@ -1643,7 +1655,8 @@
% \end{macro}
%
% \begin{macro}{\caption@typehook}
-% Hook, will be extended later on, e.g.~by our \package{float} package
+% Hook which will be used inside |\caption@set|\-|type|.
+% It will be extended later on, e.g.~by our \package{float} package
% support.
% \begin{macrocode}
\newcommand*\caption@typehook{}
@@ -1663,16 +1676,12 @@
% \begin{macro}{\caption@checkgrouplevel}
% \changes{v3.1}{2007/07/15}{This macro and its usage added}
% \changes{v3.1f}{2007/11/28}{Error changed to warning (compatibility)}
+% \changes{v3.3}{2013/04/21}{Uses \cs{caption@ifeTeX} now}
% Checks if |\captionsetup{type=|\ldots|}| or |\caption| is done
% inside a group or not -- in the latter case a warning message will
% be issued. (needs \eTeX)
% \begin{macrocode}
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname currentgrouplevel\endcsname\relax
- \caption@Debug{TeX engine: TeX}
- \let\caption@checkgrouplevel\@gobbletwo
-\else
- \caption@Debug{TeX engine: e-TeX}
+\caption@ifeTeX{%
\newcommand*\caption@checkgrouplevel[2]{%
\@ifundefined{#1caption@grouplevel}{%
\caption@ifundefined\caption@grouplevel{\let\caption@grouplevel\z@}{}%
@@ -1682,8 +1691,10 @@
\else
\caption@Warning{\string#2\MessageBreak outside box or environment}%
\fi
- }{}}
-\fi
+ }{}}%
+}{%
+ \let\caption@checkgrouplevel\@gobbletwo
+}
% \end{macrocode}
% \end{macro}
%
@@ -1758,6 +1769,8 @@
% \end{macrocode}
% \end{macro}
%
+% \subsection{\cs{captionlistentry}}
+%
% \begin{macro}{\captionlistentry}
% \changes{v3.1}{2007/07/28}{This macro added}
% \changes{v3.1f}{2007/11/16}{Bugfix 07-11-09: `space hack' added}
@@ -1854,6 +1867,7 @@
% \changes{v3.1g}{2008/01/29}{Starred variant added}
% \changes{v3.2f}{2011/12/17}{Undocumented optional argument removed}
% \changes{v3.3}{2011/12/28}{Uses \cs{ifcaption@ContinuedFloat} now}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@restorecounters} added}
% |\ContinuedFloat|\\
% |\ContinuedFloat*|\par
% This mainly sets the appropriate flag, increments the
@@ -1889,6 +1903,7 @@
\newcommand*\caption@Continued@Float[1]{%
\edef\caption@tempa{#1}%
\ifx\caption@tempa\caption@CFtype
+ \caption@restorecounters
\caption@@ContinuedFloat{#1}%
\else
\caption@Error{Continued `#1' after `\caption@CFtype'}%
@@ -1936,15 +1951,15 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\phantomcaption}
-% \changes{v3.2}{2010/10/31}{Bugfix 10-09-01b: This macro added}
-% |\phantomcaption|\par
-% Use this one for figures with subcaptions but without main caption.
+% \begin{macro}{\donemaincaptionfalse}
+% Since the \class{memoir} document class resets the sub-caption
+% counter at |\@float|, right after |\done|\-|main|\-|caption|\-|false|,
+% we save all sub-caption counters at |\done|\-|main|\-|caption|\-|false|
+% so we can restore them using |\caption@restore|\-|counters|
+% inside |\Continued|\-|Float|.
% \begin{macrocode}
-\newcommand\phantomcaption{%
- \caption@iftype
- {\caption@refstepcounter\@captype}%
- {\caption@Error{\noexpand\phantomcaption outside float}}}%
+\caption@ifundefined\donemaincaptionfalse{}{%
+ \g@addto@macro\donemaincaptionfalse\caption@savesubcounters}
% \end{macrocode}
% \end{macro}
%
@@ -2283,6 +2298,7 @@
% \changes{v3.2c}{2011/09/30}{Bugfix 11-09-26: Usage of \cs{if@subfloatrow} added}
% \changes{v3.3}{2011/12/28}{Bugfix 11-12-16: \cs{caption@l@stepcounter} replaced by \cs{stepcounter}}
% \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added}
+% \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added}
% Hook, will be used inside \cs{caption@setsubtype}.\par
% (Note: If we are inside an |sub|\-|float|\-|row| environment we have to keep
% the |\@make|\-|caption| code of the \package{floatrow} package intact.)
@@ -2312,15 +2328,30 @@
\let\caption@setfloatcapt\@firstofone
% \end{macrocode}
% \begin{macrocode}
- \caption@setbox{parbox}%
+ \caption@setbox{none}%
\caption@clearmargin
\caption@iflist{}{\let\caption@setlist\@gobble}%
\caption@setoptions{sub}%
\caption@setoptions{subfloat}% for subfig-package compatibility
% \end{macrocode}
% \begin{macrocode}
+% redefine \setcaptiontype
+ \def\caption@settype{\caption@withoptargs\caption@sub@settype}%
+ \def\caption@sub@settype##1##2{%
+ \def\caption@tempa{##2}%
+ \ifx\caption@tempa\@captype
+%%% \caption@setsubtype##1\relax
+ \else
+ \caption@Error{##2 inside \@subcaptype}%
+ \fi}%
+% \end{macrocode}
+% \begin{macrocode}
+% redefine \caption
\let\caption\caption@subcaption
\let\phantomcaption\caption@subphantom
+% \end{macrocode}
+% \begin{macrocode}
+% restore \@makecaption
\if@subfloatrow
\caption@Debug{Keeping \string\@makecaption}%
\else
@@ -2669,6 +2700,18 @@
\caption@ifneedfreeze{%
% \end{macrocode}
%
+% \begin{macro}{\caption@freezetype}
+% \changes{v3.3}{2013/05/01}{This macro added}
+% |\caption@freezetype|\marg{type}\par
+% Used by the \package{fltpage} \& \package{sidecap} package support.
+% \begin{macrocode}
+ \newcommand*\caption@freezetype[1]{%
+ \caption@settype*{#1}%
+ \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround!
+ \caption@freeze}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\caption@freeze}
% \changes{v3.1}{2007/07/22}{This macro added}
% \changes{v3.1c}{2007/10/06}{\cs{caption} \& \cs{@caption} revised for enhanced compatibility}
@@ -2681,67 +2724,63 @@
% \changes{v3.2b}{2011/08/18}{Redefinition of \cs{label} revised}
% \changes{v3.2c}{2011/08/21}{Revised}
% \changes{v3.3}{2013/01/06}{Adapted to new switch \cs{caption@caption} etc.}
-% |\caption@freeze|\par
-% Used by the \package{fltpage} \& \package{sidecap} package support.
-% \begin{macrocode}
- \newcommand*\caption@freeze[1]{%
- \caption@settype*{#1}%
- \captionsetup*[sub]{hypcap=true}% Note: This is just a (q&d) workaround!
-% \end{macrocode}
+% |\caption@freeze|\par
+% Used by the \package{bicaption} package.
% \begin{macrocode}
- \let\caption@frozen@ContinuedFloat\ContinuedFloat
- \def\ContinuedFloat{%
- \caption@@freeze{\caption@@@ContinuedFloat\@captype}%
- \caption@frozen@ContinuedFloat}%
+ \newcommand*\caption@freeze{%
+ \let\caption@frozen@ContinuedFloat\ContinuedFloat
+ \def\ContinuedFloat{%
+ \caption@@freeze{\caption@@@ContinuedFloat\@captype}%
+ \caption@frozen@ContinuedFloat}%
% \end{macrocode}
% \begin{macrocode}
- \let\caption@frozen@setup\caption@setup
- \def\caption@setup##1{%
- \caption@@freeze{\caption@setup{##1}}%
- \caption@frozen@setup{##1}}%
+ \let\caption@frozen@setup\caption@setup
+ \def\caption@setup##1{%
+ \caption@@freeze{\caption@setup{##1}}%
+ \caption@frozen@setup{##1}}%
% \end{macrocode}
% \begin{macrocode}
- \let\caption@frozen@caption\caption
- \def\caption{%
+ \let\caption@frozen@caption\caption
\def\caption{%
- \caption@Error{%
- Only one \noexpand\caption can be placed in this environment}%
- \caption@gobble}%
- \@ifstar
- {\caption@SC@caption*}%
- {\let\@currentlabel\caption@SClabel
- \caption@withoptargs\caption@SC@caption}}%
- \long\def\caption@SC@caption##1##2{%
- \caption@@freeze{\caption##1{##2}}%
- \ignorespaces}%
-% \end{macrocode}
-% \begin{macrocode}
- \let\caption@frozen@label\label
- \def\label{%
- \caption@withoptargs\caption@SC@label}%
- \def\caption@SC@label##1##2{%
- \ifx\@currentlabel\caption@SClabel
- \@bsphack
- \caption@freeze@label{##1}{##2}%
- \@esphack
- \else
- \caption@frozen@label##1{##2}%
- \fi}%
- \def\caption@SClabel{\caption@undefinedlabel}%
- \def\caption@freeze@label##1##2{%
- \caption@@freeze{\label##1{##2}}}%
+ \def\caption{%
+ \caption@Error{%
+ Only one \noexpand\caption can be placed in this environment}%
+ \caption@gobble}%
+ \@ifstar
+ {\caption@SC@caption*}%
+ {\let\@currentlabel\caption@SClabel
+ \caption@withoptargs\caption@SC@caption}}%
+ \long\def\caption@SC@caption##1##2{%
+ \caption@@freeze{\caption##1{##2}}%
+ \ignorespaces}%
+% \end{macrocode}
+% \begin{macrocode}
+ \let\caption@frozen@label\label
+ \def\label{%
+ \caption@withoptargs\caption@SC@label}%
+ \def\caption@SC@label##1##2{%
+ \ifx\@currentlabel\caption@SClabel
+ \@bsphack
+ \caption@freeze@label{##1}{##2}%
+ \@esphack
+ \else
+ \caption@frozen@label##1{##2}%
+ \fi}%
+ \def\caption@SClabel{\caption@undefinedlabel}%
+ \def\caption@freeze@label##1##2{%
+ \caption@@freeze{\label##1{##2}}}%
% \end{macrocode}
% \begin{macrocode}
- \global\let\caption@frozen@content\@empty
- \long\def\caption@@freeze{%
- \g@addto@macro\caption@frozen@content}%
+ \global\let\caption@frozen@content\@empty
+ \long\def\caption@@freeze{%
+ \g@addto@macro\caption@frozen@content}%
% \end{macrocode}
% \begin{macrocode}
- \def\caption@warmup{%
- \let\ContinuedFloat\caption@frozen@ContinuedFloat
- \let\caption@setup\caption@frozen@setup
- \let\caption\caption@frozen@caption
- \let\label\caption@frozen@label}}%
+ \def\caption@warmup{%
+ \let\ContinuedFloat\caption@frozen@ContinuedFloat
+ \let\caption@setup\caption@frozen@setup
+ \let\caption\caption@frozen@caption
+ \let\label\caption@frozen@label}}%
% \end{macrocode}
% \end{macro}
%
@@ -2761,13 +2800,13 @@
% \changes{v3.2c}{2011/08/21}{\cs{caption@defrost@setup} removed}
% |\caption@defrost|
% \begin{macrocode}
- \newcommand*\caption@defrost{%
- \ifx\caption@frozen@caption\@undefined
- \caption@frozen@content
- \else
- \caption@Error{Internal Error:\MessageBreak
- \noexpand\caption@defrost in same group as \string\caption@freeze}%
- \fi}%
+ \newcommand*\caption@defrost{%
+ \ifx\caption@frozen@caption\@undefined
+ \caption@frozen@content
+ \else
+ \caption@Error{Internal Error:\MessageBreak
+ \noexpand\caption@defrost in same group as \string\caption@freeze}%
+ \fi}%
% \end{macrocode}
% \end{macro}
%
@@ -3107,6 +3146,7 @@
% \changes{v3.1k}{2009/10/09}{Bugfix 09-09-11: Missing \cs{ignorespaces} added}
% \changes{v3.2c}{2011/08/28}{Adapted to current version of \cs{caption@freeze}}
% \changes{v3.2f}{2012/02/19}{Bugfix 12-02-16: \texttt{minipage} environment added}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
% Original code:
% \begin{verbatim}
% \newcommand{\FP@floatBegin}[1]{%
@@ -3130,7 +3170,7 @@
\def\FP@captype{#1}%
\begin{lrbox}{\FP@floatCorpusBOX}%
\minipage\hsize % changes from LR mode to vertical mode
- \caption@freeze{#1}%
+ \caption@freezetype{#1}%
\ignorespaces}%
% \end{macrocode}
% \end{macro}
@@ -4108,7 +4148,8 @@
\rotatebox{90}{%
\ifdim\captionwidth=\z@
\setcaptionwidth{.8\vsize}%
- \l@addto@macro\caption@singleline{\caption@setbox{none}}%
+ \l@addto@macro\caption@singleline{%
+ \caption@setup{parbox=none}}%
\fi
\let\caption@calcmargin\relax
\caption@@make{#1}{#2}}%
@@ -4132,6 +4173,7 @@
% \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}
+% \changes{v3.3}{2013/05/01}{Usage of \cs{caption@freeze} replaced by \cs{caption@freezetype}}
% 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}
@@ -4150,7 +4192,7 @@
% which will be executed later on.
% Furthermore we need to make |\caption*| work.
% \begin{macrocode}
- \caption@freeze{#2}%
+ \caption@freezetype{#2}%
% \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.
@@ -4411,8 +4453,8 @@
\let\caption@ORI@threeparttable\threeparttable
\renewcommand*\threeparttable{%
\caption@settype{table}%
- \caption@setposition a% ?
- \caption@clearmargin
+ \caption@setposition a% ?
+ \caption@clearmargin
\caption@setoptions{threeparttable}%
\caption@ORI@threeparttable}%
% \end{macrocode}
@@ -4423,8 +4465,8 @@
\let\caption@ORI@measuredfigure\measuredfigure
\renewcommand*\measuredfigure{%
\caption@settype{figure}%
- \caption@setposition a% ?
- \caption@clearmargin
+ \caption@setposition a% ?
+ \caption@clearmargin
\caption@setoptions{measuredfigure}%
\caption@ORI@measuredfigure}%
% \end{macrocode}