summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-01-01 21:50:58 +0000
committerKarl Berry <karl@freefriends.org>2020-01-01 21:50:58 +0000
commitee1a9ddb8566d89bdd152fc8d6b84e2467918146 (patch)
tree7061e8d4ed2285b66da957e9a0241299e5e677fb /Master/texmf-dist/source/latex/caption
parentd4369812d53a63316beb43eb68f3c925d26b2f7b (diff)
caption (1jan20)
git-svn-id: svn://tug.org/texlive/trunk@53291 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/caption')
-rw-r--r--Master/texmf-dist/source/latex/caption/bicaption.dtx6
-rw-r--r--Master/texmf-dist/source/latex/caption/caption-deu.tex7
-rw-r--r--Master/texmf-dist/source/latex/caption/caption-eng.tex7
-rw-r--r--Master/texmf-dist/source/latex/caption/caption-rus.tex7
-rw-r--r--Master/texmf-dist/source/latex/caption/caption.dtx86
-rw-r--r--Master/texmf-dist/source/latex/caption/caption.ins2
-rw-r--r--Master/texmf-dist/source/latex/caption/caption3.dtx30
-rw-r--r--Master/texmf-dist/source/latex/caption/subcaption.dtx6
8 files changed, 83 insertions, 68 deletions
diff --git a/Master/texmf-dist/source/latex/caption/bicaption.dtx b/Master/texmf-dist/source/latex/caption/bicaption.dtx
index 49c9d1f5089..bf6243a2f61 100644
--- a/Master/texmf-dist/source/latex/caption/bicaption.dtx
+++ b/Master/texmf-dist/source/latex/caption/bicaption.dtx
@@ -110,12 +110,6 @@
% \newcommand\NEWfeature{\NEW{New feature}}
% \newcommand\NEWdescription{\NEW{New description}}
%
-% \makeatletter
-% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
-% \makeatother
-% \newcommand*\See[1]{\nopagebreak{\small (See #1)}}
-%
% \GetFileInfo{bicaption.drv}
% \let\docdate\filedate
% \let\docversion\fileversion
diff --git a/Master/texmf-dist/source/latex/caption/caption-deu.tex b/Master/texmf-dist/source/latex/caption/caption-deu.tex
index 420b8238786..6a58b3ca9a8 100644
--- a/Master/texmf-dist/source/latex/caption/caption-deu.tex
+++ b/Master/texmf-dist/source/latex/caption/caption-deu.tex
@@ -1,9 +1,6 @@
%
% This is file `caption-deu.tex'.
%
-% $Id$
-% $HeadURL$
-%
% Copyright (C) 1994-2012 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
@@ -172,8 +169,8 @@
{\endlist}
\makeatletter
-\newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-\newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+\def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+\def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
\newcommand*\SEE[3][]{\nopagebreak{#1(#2 #3)}}
\newcommand*\SeeUserDefined[1][]{\See{\Ref{declare}#1}}
\makeatother
diff --git a/Master/texmf-dist/source/latex/caption/caption-eng.tex b/Master/texmf-dist/source/latex/caption/caption-eng.tex
index 8aa5e473316..ef9fd389231 100644
--- a/Master/texmf-dist/source/latex/caption/caption-eng.tex
+++ b/Master/texmf-dist/source/latex/caption/caption-eng.tex
@@ -1,9 +1,6 @@
%
% This is file `caption-eng.tex'.
%
-% $Id$
-% $HeadURL$
-%
% Copyright (C) 1994-2012 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
@@ -165,8 +162,8 @@
{\endlist}
\makeatletter
-\newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-\newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+\def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+\def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
\newcommand*\SEE[3][]{\nopagebreak{#1(#2 #3)}}
\newcommand*\SeeUserDefined[1][]{\See{\Ref{declare}#1}}
\makeatother
diff --git a/Master/texmf-dist/source/latex/caption/caption-rus.tex b/Master/texmf-dist/source/latex/caption/caption-rus.tex
index c3b536cc2f0..2082c375f04 100644
--- a/Master/texmf-dist/source/latex/caption/caption-rus.tex
+++ b/Master/texmf-dist/source/latex/caption/caption-rus.tex
@@ -2,9 +2,6 @@
% This is file `caption-rus.tex'.
% Russian translation of `caption-eng.tex'
%
-% $Id$
-% $HeadURL$
-%
% Copyright (C) 1994-2007 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
@@ -196,8 +193,8 @@
{\endlist}
\makeatletter
-\newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-\newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+\def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+\def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
\newcommand*\SEE[3][]{\nopagebreak{#1(#2 #3)}}
\newcommand*\SeeUserDefined[1][]{\See{\Ref{declare}#1}}
\makeatother
diff --git a/Master/texmf-dist/source/latex/caption/caption.dtx b/Master/texmf-dist/source/latex/caption/caption.dtx
index 3b0a3968311..1bf48731430 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'.
%
-% Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+% Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
%
@@ -25,7 +25,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{2974}
+% \CheckSum{3006}
%
% \iffalse
%<*driver>
@@ -215,13 +215,13 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption}[2019/10/18 v3.4a Customizing captions (AR)]
+\ProvidesPackage{caption}[2020/01/01 v3.4c Customizing captions (AR)]
% \end{macrocode}
%
% \section{Loading the kernel}
%
% \begin{macrocode}
-\RequirePackage{caption3}[2019/09/09] % needs v1.8e or newer
+\RequirePackage{caption3}[2019/12/31] % needs v1.8f or newer
% \end{macrocode}
%
% \section{Check against unknown document classes}
@@ -1311,15 +1311,6 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\caption@typehook}
-% 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{}
-% \end{macrocode}
-% \end{macro}
-%
% \begin{macro}{\caption@iftype}
% \changes{v3.1}{2007/04/11}{This macro and its usage added}
% Since we often need to check if |\@captype| is defined (means: we
@@ -2600,6 +2591,7 @@
% \begin{macro}{\@float@setevery}
% \changes{v3.1k}{2009/10/09}{Bugfix 08-12-05: \cs{color@begin/endgroup} added
% to redefinition of \cs{caption@setfloatcapt}}
+% \changes{v3.4b}{2019/12/16}{Usage of \cs{caption@float@setname} added}
% |\@float@setevery|\marg{float type} is provided by the \package{float}
% package; it's called every time a floating environment defined with
% |\newfloat| or |\restylefloat| begins.
@@ -2648,6 +2640,7 @@
%
% \begin{macrocode}
}{}%
+ \caption@float@setname{#1}%
\caption@freezeHref % will be defrosted in \float@makebox
\caption@ORI@float@setevery{#1}}%
% \end{macrocode}
@@ -2674,8 +2667,9 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\caption@typehook}
+% \begin{macro}{\caption@float@setname}
% \changes{v3.1}{2007/07/08}{float package hook added}
+% \changes{v3.4b}{2019/12/16}{Renamed from \cs{caption@typehook} to \cs{caption@float@setname}}
% \LaTeX\ and almost every other packages use
% |\|\meta{type}|name|
% to provide a macro for the type resp.~environment name -- for example
@@ -2693,7 +2687,7 @@
% \Note{If the float was not defined with \cs{newfloat} but with
% \cs{restylefloat} instead, \cs{fname@}\meta{type} is not defined.}
% \begin{macrocode}
- \g@addto@macro\caption@typehook{%
+ \newcommand*\caption@float@setname[1]{%
\expandafter\ifx\csname #1name\endcsname\relax
\expandafter\let\csname #1name\expandafter\endcsname
\csname fname@#1\endcsname
@@ -3326,26 +3320,64 @@
% \changes{v3.1g}{2008/01/20}{Bugfix: Skips are handled correctly now}
% \changes{v3.1k}{2008/03/29}{Bugfix 08-10-16-dctt: \texttt{rule=0} added}
% \changes{v3.2}{2010/10/26}{Bugfix 10-07-20a: Set \cs{hsize} to \cs{linewidth}, if necessary}
+% \changes{v3.4c}{2020/01/01}{Ugly workaround for usage in lists added}
% To support the \package{listings} package we need to redefine
% |\lst@MakeCaption| so the original stuff is nested with
-% |\caption@begin| and |\caption@end| etc.
-% \Note{This macro is always called twice (with `t' resp. `b' as
-% parameter), therefore we need an extra group here.}
+% |\caption@begin| and |\caption@end| etc.\par
+% Unfortunately |\lst@MakeCaption| is sometimes used with |\linewidth| intact but sometimes with |\linewidth| adapted.
+% So we either could write a bunch of very ugly code which is using internals of the \package{listings} package, or
+% we could simply ignore this fact since |\hsize| will be left untouched by the \package{listings} package.
+% (This is reason why the caption is mis-aligned when using one of the options |linewidth=|, |xleftmargin=|, |yleftmargin=|, or |resetmargins=|,
+% even the \package{caption} package isn't used. This needs to be fixed within the \package{listings} package, for example by using
+% |\lst@MakeCaption| inside a parbox of correct width.)
+%
+% The \package{listings} package calls |\lst@MakeCaption| sometimes with original |\linewidth|, sometimes with adapted |\linewidth|.
+% So we need to detect if |\linewidth| is already adapted or not.
+% We realize this by setting a flag inside the "Init" hook of the \package{listings} package (where the adaption takes place).
+% \begin{macrocode}
+%% \caption@setbool{lst@Init}{0}%
+%% \lst@AddToHook{Init}{\caption@setbool{lst@Init}{1}}%
+% \end{macrocode}
% \begin{macrocode}
\let\caption@ORI@lst@MakeCaption\lst@MakeCaption
\def\lst@MakeCaption#1{% #1 is `t' or `b'
+% \end{macrocode}
+% This macro is always called twice by the \package{listings} package (with `t' resp. `b' as parameter),
+% therefore we need an extra group here.
+% \begin{macrocode}
\begingroup
% \end{macrocode}
-% Workaround for bug in \package{listings} package:
-% If |\hsize| seems not to be set correctly, we set it to |\linewidth|.
-% \changes{v3.3}{2018/04/30}{Bugfix from Ulrike Fischer applied, see also \url{https://github.com/axelsommerfeldt/caption/issues/1}}
% \begin{macrocode}
- \@tempdima\linewidth
- \advance\@tempdima\lst@xleftmargin
- \advance\@tempdima\lst@xrightmargin
- \ifdim\hsize>\@tempdima
- \hsize\@tempdima
- \fi
+%% \caption@Debug{%
+%% linewidth=\lst@linewidth,
+%% xleftmargin=\lst@xleftmargin,\MessageBreak
+%% xrightmargin=\lst@xrightmargin,
+%% resetmargins=\lst@ifresetmargins true\else false\fi}%
+% \end{macrocode}
+% If |\linewidth| isn't adapted by the \package{listings} package yet, do the adaption here.
+% \begin{macrocode}
+%% \caption@iflst@Init{}{%\lsthk@PreInit\lsthk@Init => has unwanted side-effects (like an extra horizontal line)
+%% \linewidth\lst@linewidth\relax
+%% \lst@ifresetmargins
+%% \advance\linewidth\@totalleftmargin
+%% \advance\linewidth\rightmargin
+%% \@totalleftmargin\z@
+%% \fi
+%% \advance\linewidth-\lst@xleftmargin
+%% \advance\linewidth-\lst@xrightmargin
+%% \advance\@totalleftmargin\lst@xleftmargin\relax}%
+% \end{macrocode}
+% Inside lists the \package{listings} package ignores the left margin (|\@totalleftmargin|) for captions.
+% We emulate this behaviour by adding a negativ skip which will be typeset ahead of |\caption@box|.\par
+% This does not result in correct justification of the caption, but captions inside listings inside
+% lists are not justified correctly anyway. (Again, this needs to be fixed by the \package{listings} package.)\par
+% Note: We cannot use |\@totalleftmargin| here since it was usually resetted by the \package{listings} package.
+% So we have to calculate the total left margin on our own which makes this code even more dirty.
+% \begin{macrocode}
+ \l@addto@macro\caption@beginhook{%
+ \@tempdima\leftmargin
+ \multiply\@tempdima\@listdepth
+ \hskip-\@tempdima\relax}%
% \end{macrocode}
% First of all, we set |position=#1| and if it was set to `top',
% we swap the skips so the default behavior of the \package{listings} package
diff --git a/Master/texmf-dist/source/latex/caption/caption.ins b/Master/texmf-dist/source/latex/caption/caption.ins
index 45381b84026..d6ea31962f1 100644
--- a/Master/texmf-dist/source/latex/caption/caption.ins
+++ b/Master/texmf-dist/source/latex/caption/caption.ins
@@ -6,7 +6,7 @@
\preamble
-Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
https://gitlab.com/axelsommerfeldt/caption
diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx
index 59e24f0fc1a..9837f72142e 100644
--- a/Master/texmf-dist/source/latex/caption/caption3.dtx
+++ b/Master/texmf-dist/source/latex/caption/caption3.dtx
@@ -25,7 +25,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{3418}
+% \CheckSum{3405}
%
% \iffalse
%<*driver>
@@ -188,7 +188,7 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption3}[2019/09/09 v1.8e caption3 kernel (AR)]
+\ProvidesPackage{caption3}[2019/12/31 v1.8f caption3 kernel (AR)]
% \end{macrocode}
%
% \section{Workaround for bug in package \package{arabtex}}
@@ -1523,7 +1523,8 @@
\DeclareCaptionBox{colorbox}{\colorbox{\caption@boxcolor}{%
\setlength\caption@tempdima{#1}%
\addtolength\caption@tempdima{-2\fboxsep}%
- \linewidth=\caption@tempdima\hsize=\caption@tempdima
+ \linewidth\caption@tempdima
+ \hsize\caption@tempdima
#2}}
\DeclareCaptionOption{boxcolor}{\def\caption@boxcolor{#1}}
\DeclareCaptionOption{boxsep}{\setlength\fboxsep{#1}}
@@ -3151,6 +3152,7 @@
% \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}
% \changes{v1.7}{2016/01/31}{Adapted to the \package{bicaption} package}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
% |\caption@@make|\marg{caption label}\marg{caption text}
% \begin{macrocode}
\newcommand\caption@@make[2]{%
@@ -3167,7 +3169,7 @@
%
% Typeset the outer box |\caption@box|
% \begin{macrocode}
- \caption@box\linewidth{%
+ \caption@box\hsize{%
% \end{macrocode}
%
% Special single-line treatment (option |singlelinecheck=|)
@@ -3237,12 +3239,11 @@
% \end{macro}
%
% \begin{macro}{\caption@calcmargin}
-% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by
-% \cs{ifdim}\cs{captionwidth=}\cs{z@}}
+% \changes{v1.0f}{2005/10/24}{Internal: \cs{ifcaption@width} replaced by \cs{ifdim}\cs{captionwidth=}\cs{z@}}
% \changes{v1.0g}{2006/01/12}{Improvement: Takes care of list environment now}
-% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore),
-% use \cs{linewidth} instead of \cs{hsize}}
+% \changes{v1.1}{2006/05/13}{Check of \cs{@listdepth} removed (not necessary anymore), use \cs{linewidth} instead of \cs{hsize}}
% \changes{v1.5}{2012/12/26}{max-margin stuff moved from \cs{caption@@make} to here}
+% \changes{v1.8f}{2019/12/18}{Usage of \cs{linewidth} replaced by \cs{hsize}}
% |\caption@calcmargin|\par
% Calculate |\captionmargin| \& |\captionwidth|, so both contain valid
% values.
@@ -3265,11 +3266,11 @@
% \end{macrocode}
% \begin{macrocode}
\ifdim\captionwidth=\z@
- \captionwidth\linewidth
+ \captionwidth\hsize
\advance\captionwidth by -2\captionmargin
\advance\captionwidth by -\captionmargin@
\else
- \captionmargin\linewidth
+ \captionmargin\hsize
\advance\captionmargin by -\captionwidth
\divide\captionmargin by 2
\captionmargin@\z@
@@ -3278,12 +3279,9 @@
% \begin{macrocode}
\caption@Debug{%
\string\hsize=\the\hsize,
- \string\linewidth=\the\linewidth,\MessageBreak
- \string\leftmargin=\the\leftmargin,
- \string\rightmargin=\the\rightmargin,\MessageBreak
- \string\margin=\the\captionmargin,
- \string\margin@=\the\captionmargin@,
- \string\width=\the\captionwidth}%
+ \string\captionwidth=\the\captionwidth,\MessageBreak
+ \string\captionmargin=\the\captionmargin,
+ \string\captionmargin@=\the\captionmargin@}%
% \end{macrocode}
% \begin{macrocode}
}
diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx
index 70b669ee201..2571963bfea 100644
--- a/Master/texmf-dist/source/latex/caption/subcaption.dtx
+++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx
@@ -102,10 +102,10 @@
% \newcommand\NEWdescription{\NEW{New description}}
%
% \makeatletter
-% \newcommand*\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
-% \newcommand*\@Ref[2]{#1{#2}: \textit{\nameref{#2}}}
+% \def\Ref{\@ifstar{\@Ref\ref}{\@Ref\autoref}}
+% \def\@Ref#1#2{#1{#2}: \textit{\nameref{#2}}}
% \makeatother
-% \newcommand*\See[1]{\nopagebreak{\small (See #1)}}
+% \def\See#1{\nopagebreak{\small (See #1)}}
%
% \GetFileInfo{subcaption.drv}
% \let\docdate\filedate