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.dtx296
1 files changed, 194 insertions, 102 deletions
diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx
index 88f3f2549e9..ed00fb9143e 100644
--- a/Master/texmf-dist/source/latex/caption/caption.dtx
+++ b/Master/texmf-dist/source/latex/caption/caption.dtx
@@ -25,7 +25,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{3579}
+% \CheckSum{3693}
%
% \iffalse
%<*driver>
@@ -218,13 +218,13 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption}[2018/05/01 v3.3-147 Customizing captions (AR)]
+\ProvidesPackage{caption}[2018/09/12 v3.3-152 Customizing captions (AR)]
% \end{macrocode}
%
% \subsection{Loading the kernel}
%
% \begin{macrocode}
-\RequirePackage{caption3}[2018/05/01] % needs v1.8 or newer
+\RequirePackage{caption3}[2018/09/12] % needs v1.8c or newer
% \end{macrocode}
%
% \subsection{Check against incompatible document classes}
@@ -818,59 +818,65 @@
%
% \subsection{\cs{caption}, \cs{@caption}, and \cs{@makecaption}}
%
-% \begin{macro}{\ifcaption@caption}
-% \changes{v3.3}{2011/12/28}{This switch added}
-% \begin{macro}{\ifcaption@subcaption}
-% \changes{v3.3}{2011/12/28}{This switch added}
-% \begin{macro}{\ifcaption@ContinuedFloat}
+% \begin{macro}{\caption@ifflag}
% \changes{v3.3}{2011/12/28}{This switch added}
+% \changes{v3.3}{2018/08/08}{Rewritten (and renamed) so a counter is used instead of a switch}
% Since we support continued floats and sub-figures it's not an easy task
% to manage the figure (and table) counter. (Especially since previous versions
% of the caption package has proven that correcting a counter locally is not a good idea.)
%
% These three switches hold the
-% current status: |\if|\-|caption@caption| is set if the caption was already
+% current status: |\caption@if|\-|flag{2}| is set if the caption was already
% typeset (so the counter doesn't need to be incremented for sub-figures),
-% |\if|\-|caption@sub|\-|caption| is set if there is already content which have
+% |\caption@if|\-|flag{4}| is set if there is already content which have
% incremented the counter (so the counter doesn't need to be incremented
% for the main caption, further sub-figures, and other stuff), and
-% |\if|\-|caption@Continued|\-|Float| is set if |\Continued|\-|Float| was given.
+% |\caption@if|\-|flag{1}| is set if |\Continued|\-|Float| was given.
+%
+% In the past three boolean switches were used to store the flags, but since some
+% packages (like the \package{floatrow} and \package{tabu} package) try hard to keep
+% counter changes locally under certain circumstances, it seems a good idea to make
+% these flags a counter value, too.
% \begin{macrocode}
-\newif\ifcaption@caption
-\newif\ifcaption@subcaption
-\newif\ifcaption@ContinuedFloat
+\newcounter{caption@flags}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\caption@ifflag[1]{%
+ \@tempcnta\c@caption@flags
+ \divide\@tempcnta #1\relax
+ \ifodd\@tempcnta
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
% \end{macrocode}
-% \end{macro}
-% \end{macro}
% \end{macro}
%
+% \begin{macro}{\caption@clrflags}
+% \changes{v3.3}{2018/08/08}{This macro added}
% \begin{macro}{\caption@clrflag}
% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
% \begin{macro}{\caption@setflag}
% \changes{v3.3}{2013/04/14}{This macro added}
+% \changes{v3.3}{2018/08/08}{Rewritten so a counter is used instead of a switch}
% Furthermore we introduce the macros \cs{caption@clrflag} and \cs{caption@setflag}
% for clearing resp.~setting these flags.
% \begin{macrocode}
-\newcommand*\caption@clrflag[1]{%
- \caption@chgflag{#1}{false}}
-\newcommand*\caption@setflag[1]{%
- \caption@chgflag{#1}{true}}
-\newcommand*\caption@chgflag[2]{%
- \global\csname caption@#1#2\endcsname}
+\newcommand*\caption@clrflags{%
+ \setcounter{caption@flags}\z@}
% \end{macrocode}
-% The \package{floatrow} package uses \cs{FR@loc@} to keep changes
-% (flags, counters, \ldots) local. Since it is not aware of our flags above
-% we need to extend that macro (if defined).
% \begin{macrocode}
-\caption@AtBeginDocument{%
- \caption@ifundefined\FR@loc@{}{%
- \caption@InfoNoLine{floatrow package is loaded}%
- \g@addto@macro\FR@loc@{%
- \renewcommand*\caption@chgflag[2]{%
- \csname caption@#1#2\endcsname}}}}
+\newcommand*\caption@clrflag[1]{%
+ \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
+\newcommand*\caption@setflag[1]{%
+ \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
+\newcommand*\caption@addtoflags{%
+ \addtocounter{caption@flags}}
% \end{macrocode}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\caption@caption}
% \changes{v3.0f}{2005/05/22}{Bugfix: \cs{ContinuedFloat} added}
@@ -1165,6 +1171,50 @@
%
% \begin{macrocode}
\caption@CheckCommand\@caption{%
+ % arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addtocontents{\csname ext@#1\endcsname}{\xstring\select@language{\main@Arabi@language}}%
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}{\ignorespaces \if@rl{\textRL{#2}}\else\textLR{#2}\fi}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces \if@rl{\textRL{#3}}\else\textLR{#3}\fi}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % rlbabel.def [2005/03/30 v2.3h Right-to-Left support from the babel system Hebrew language support from the babel system]
+ \long\def\@caption#1[#2]#3{%
+ \par
+ \addcontentsline{\csname ext@#1\endcsname}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}%
+ {\ignorespaces #2}}%
+ \def\@fignm{figure}
+ \ifx#1\@fignm\addcontentsline{fol}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}%
+ {\ignorespaces #2}}\fi%
+ \def\@tblnm{table}
+ \ifx#1\@tblnm\addcontentsline{tol}{#1}%
+ {\protect\numberline{\csname the#1\endcsname}%
+ {\ignorespaces #2}}\fi%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}}%
+% \end{macrocode}
+%
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
% magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
\long\def\@caption#1[#2]#3{%
\csname par\endcsname
@@ -1402,6 +1452,21 @@
% \end{macrocode}
%
% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % chkfloat.sty [2012/08/19 v0.1 chkfloat: check for moved floats]
+ \def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}%
+ \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}%
+ }}%
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@CheckCommand\@caption{%
+ % chkfloat.sty [20??/??/?? v0.? chkfloat: check for moved floats]
+ \def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}%
+ \chkfloat@addcontentsline{#1}{#2}%
+ }}%
+% \end{macrocode}
+%
+% \begin{macrocode}
\caption@IfCheckCommand{}{%
\caption@InfoNoLine{%
Incompatible package detected (regarding \string\@caption).\MessageBreak
@@ -1608,9 +1673,7 @@
% (if |hypcap=|\-|true| and the \package{hypcap} package is not loaded).
% \begin{macrocode}
\newcommand*\caption@settype{%
- \caption@clrflag{caption}%
- \caption@clrflag{subcaption}%
- \caption@clrflag{ContinuedFloat}%
+ \caption@clrflags
\caption@set@type}
% \end{macrocode}
% \begin{macrocode}
@@ -1925,7 +1988,7 @@
% \end{macrocode}
% \begin{macrocode}
\newcommand*\caption@@ContinuedFloat{%
- \caption@setflag{ContinuedFloat}%
+ \caption@setflag1% ContinuedFloat
\caption@@@ContinuedFloat}
\newcommand*\caption@@@ContinuedFloat{%
\stepcounter{ContinuedFloat}%
@@ -2011,12 +2074,12 @@
% therefore ending this part, so we set the flag to |false| in this case.)
% \begin{macrocode}
\caption@fixposition
- \caption@iftop\caption@setflag\caption@clrflag{caption}%
+ \caption@iftop\caption@setflag\caption@clrflag2% caption
% \end{macrocode}
% This part does not contain content (like sub-figures) yet,
% so we set |\if|\-|caption@sub|\-|caption| to |false|.
% \begin{macrocode}
- \caption@clrflag{subcaption}%
+ \caption@clrflag4% subcaption
% \end{macrocode}
% Support of the \textsf{memoir} document class.
% \begin{macrocode}
@@ -2024,18 +2087,18 @@
% \end{macrocode}
% \begin{macrocode}
\newcommand*\caption@ref@stepcounter{%
- \ifcaption@ContinuedFloat
+ \caption@ifflag1{% ContinuedFloat
\let\caption@tempa\caption@@refcounter
- \caption@clrflag{ContinuedFloat}%
- \else
+ \caption@clrflag1% ContinuedFloat
+ }{%
\let\caption@tempa\caption@@refstepcounter
- \ifcaption@caption \else
- \ifcaption@subcaption
+ \caption@ifflag2{}{% caption
+ \caption@ifflag4{% subcaption
% Counter was already incremented by content, so we suppress \stepcounter{#1} here
\let\caption@tempa\caption@@refcounter
- \fi
- \fi
- \fi
+ }{}%
+ }%
+ }%
\caption@tempa}
% \end{macrocode}
% \begin{macrocode}
@@ -2328,6 +2391,7 @@
% \changes{v3.3}{2012/03/15}{Usage of \cs{caption@setbox} added}
% \changes{v3.3}{2013/05/01}{Redefinition of \cs{caption@settype} added}
% \changes{v3.3}{2013/06/17}{Missing redefinition of \cs{captionlistentry} added}
+% \changes{v3.3}{2018/09/06}{Adapted to the \package{chkfloat} package}
% 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.)
@@ -2337,24 +2401,25 @@
\caption@warmup
% \end{macrocode}
% \begin{macrocode}
- \ifcaption@caption \else
+ \caption@ifflag2{}{% caption
% no \caption in this part of the (floating) environment yet
\let\caption@add@contentsline\caption@addsubcontentsline
\let\caption@addsubcontentslines\@gobble
- \ifcaption@subcaption \else
+ \caption@ifflag4{}{% subcaption
% no \subcaption in this part of the (floating) environment yet
- \ifcaption@ContinuedFloat
- \caption@clrflag{ContinuedFloat}%
- \else
+ \caption@ifflag1{% ContinuedFloat
+ \caption@clrflag1%
+ }{%
\caption@@stepcounter\@captype
- \fi
- \caption@setflag{subcaption}%
- \fi
- \fi
+ }%
+ \caption@setflag4% subcaption
+ }%
+ }%
% \end{macrocode}
% \begin{macrocode}
\c@ContinuedFloat=0\relax
\let\caption@setfloatcapt\@firstofone
+ \let\caption@chkfloat\@gobbletwo
% \end{macrocode}
% \begin{macrocode}
\caption@setbox{none}%
@@ -2668,19 +2733,21 @@
%
% \subsubsection{The hungarian and magyar Babel option}
% \changes{v3.2}{2009/03/29}{\package{magyar} package support added}
+% \changes{v3.3}{2018/08/26}{\package{magyar} package support revised}
%
% \begin{macrocode}
\def\caption@tempa#1{%
- \@ifundefined{extras#1}\caption@AtBeginDocument\@firstofone{%
- \@ifundefined{extras#1}{}{%
- \caption@InfoNoLine{#1 babel option is loaded}%
- \expandafter\addto\csname extras#1\endcsname{%
- % reverse changes made by magyar.ldf
- \let\@makecaption\caption@makecaption
- \babel@save\@makecaption
- \caption@redefine
- \babel@save\@caption}%
- }}}
+ \@ifpackagewith{babel}{#1}{%
+ \caption@InfoNoLine{#1 babel option is loaded}%
+ \expandafter\addto\csname extras#1\endcsname{%
+ % reverse changes made by magyar.ldf
+ \let\@makecaption\caption@makecaption
+ \babel@save\@makecaption
+ \caption@redefine
+ \babel@save\@caption}%
+ }{}}
+% \end{macrocode}
+% \begin{macrocode}
\caption@tempa{hungarian}%
\caption@tempa{magyar}%
% \end{macrocode}
@@ -2868,6 +2935,30 @@
% \end{macrocode}
% \end{macro}
%
+% \subsubsection{The chkfloat package}
+% \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added}
+%
+% \begin{macrocode}
+\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
+% \end{macrocode}
+%
+% \begin{macro}{\caption@chkfloat}
+% \changes{v3.3}{2018/09/06}{This macro added}
+% \begin{macrocode}
+ \caption@ifundefined\chkfloat@addcontentsline{%
+ \renewcommand\caption@chkfloat[2]{%
+ \caption@ifundefined\chkfloat@page{}{%
+ \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}}}%
+ }{%
+ \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}%
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+ }{}%
+% \end{macrocode}
+%
% \subsubsection{The float package}
% \changes{v3.0f}{2005/05/31}{\package{float} package support rewritten and improved}
% \iffalse
@@ -3726,7 +3817,7 @@
\caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
% \end{macrocode}
% \begin{macrocode}
- \RequirePackage{ltcaption}[2007/09/01]%
+ \RequirePackage{ltcaption}[2018/08/26]%
\let\LT@@makecaption\@undefined
% \end{macrocode}
%
@@ -3767,10 +3858,8 @@
% \begin{macrocode}
\def\captionlistentry{%
\noalign\bgroup
- \@ifstar{\egroup\LT@captionlistentry}% gobble *
- {\egroup\LT@captionlistentry}}%
- \def\LT@captionlistentry##1{%
- \caption@listentry\@firstoftwo[\LTcaptype]{##1}}%
+ \@ifstar{\egroup\LT@listentry}% gobble *
+ {\egroup\LT@listentry}}%
% \end{macrocode}
% |\ContinuedFloat| for longtable:\\
% {\small(Commented out, since it's not deeply tested and quite useless anyway)}
@@ -3833,26 +3922,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\LT@c@ption}
-% \changes{v3.1g}{2008/01/22}{Made it \cs{long}}
-% The original implementation:
-% \begin{verbatim}
-% \def\LT@c@ption#1[#2]#3{%
-% \LT@makecaption#1\fnum@table{#3}%
-% \def\@tempa{#2}%
-% \ifx\@tempa\@empty\else
-% {\let\\\space
-% \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}%
-% \fi}
-% \end{verbatim}%^^A
-% Our implementation uses |\LTcaptype| instead of |{table}|:
-% \begin{macrocode}
- \long\def\LT@c@ption#1[#2]#3{%
- \LT@makecaption#1{\csname fnum@\LTcaptype\endcsname}{#3}%
- \LT@captionlistentry{#2}}%
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\LT@makecaption}
% \changes{v3.0d}{2004/08/10}{%
% Bugfix 04-08-04: \cs{abovecaptionskip} \& \cs{belowcaptionskip} will be used now}
@@ -3881,19 +3950,7 @@
% \begin{macrocode}
\renewcommand\LT@makecaption[3]{%
\caption@LT@make{%
-% \end{macrocode}
-%
-% If |\LTcapwidth| is not set to its default value |4in| we assume
-% that it shall overwrite our own setting.
-% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
-% \begin{macrocode}
- \caption@settype*\LTcaptype
- \ifdim\LTcapwidth=4in \else
- \setcaptionwidth\LTcapwidth
- \fi
- \caption@setoptions{longtable}%
-% \caption@setContinuedFloat
- \caption@setoptions{@longtable}%
+ \caption@LT@settype\LTcaptype
% \end{macrocode}
%
% |\caption@LT@setup| is re-defined inside the \package{bicaption} package
@@ -3954,6 +4011,41 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\LT@listentry}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \begin{macrocode}
+ \renewcommand*\LT@listentry[2]{%
+ \begingroup
+ \caption@LT@settype{#1}%
+ \caption@listentry\@firstoftwo[#1]{#2}%
+ \endgroup}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\caption@LT@settype}
+% \changes{v3.3}{2018/08/26}{This macro added}
+% \begin{macrocode}
+ \newcommand*\caption@LT@settype[1]{%
+ \caption@settype*\LTcaptype
+% \end{macrocode}
+% If |\LTcapwidth| is not set to its default value |4in| we assume
+% that it shall overwrite our own setting.
+% (But |\captionsetup[longtable]{width=|\ldots|}| will overwrite |\LTcapwidth|.)
+% \begin{macrocode}
+ \ifdim\LTcapwidth=4in \else
+ \setcaptionwidth\LTcapwidth
+ \fi
+% \end{macrocode}
+% \begin{macrocode}
+ \caption@setoptions{longtable}%
+% \caption@setContinuedFloat
+% \end{macrocode}
+% Finally set options applied by |\captionsetup| inside the longtable.
+% \begin{macrocode}
+ \caption@setoptions{@longtable}}
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macrocode}
}{}
% \end{macrocode}