summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/caption
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-01-02 03:02:24 +0000
committerNorbert Preining <norbert@preining.info>2020-01-02 03:02:24 +0000
commitaf7bc18edca6890fb1addbeb6a34672275532e3b (patch)
treeb6274aa5bf5b395e381e80a870d068764b427537 /macros/latex/contrib/caption
parent8cd36d1d38fe9da8a02a138e1984636379710e18 (diff)
CTAN sync 202001020302
Diffstat (limited to 'macros/latex/contrib/caption')
-rw-r--r--macros/latex/contrib/caption/README4
-rw-r--r--macros/latex/contrib/caption/bicaption.dtx6
-rw-r--r--macros/latex/contrib/caption/caption-deu.tex7
-rw-r--r--macros/latex/contrib/caption/caption-eng.tex7
-rw-r--r--macros/latex/contrib/caption/caption-rus.tex7
-rw-r--r--macros/latex/contrib/caption/caption.dtx86
-rw-r--r--macros/latex/contrib/caption/caption.ins2
-rw-r--r--macros/latex/contrib/caption/caption3.dtx30
-rw-r--r--macros/latex/contrib/caption/subcaption.dtx6
9 files changed, 85 insertions, 70 deletions
diff --git a/macros/latex/contrib/caption/README b/macros/latex/contrib/caption/README
index 74919d6378..092748d6ac 100644
--- a/macros/latex/contrib/caption/README
+++ b/macros/latex/contrib/caption/README
@@ -1,8 +1,8 @@
==========================================================================
The `caption' package bundle
-Release 2019-11-24
-Copyright (C) 1994-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+Release 2020-01-01
+Copyright (C) 1994-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
License: LPPL = LaTeX Project Public Licence
Maintenance Status: maintained (by Axel Sommerfeldt)
diff --git a/macros/latex/contrib/caption/bicaption.dtx b/macros/latex/contrib/caption/bicaption.dtx
index 49c9d1f508..bf6243a2f6 100644
--- a/macros/latex/contrib/caption/bicaption.dtx
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/caption-deu.tex b/macros/latex/contrib/caption/caption-deu.tex
index 420b823878..6a58b3ca9a 100644
--- a/macros/latex/contrib/caption/caption-deu.tex
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/caption-eng.tex b/macros/latex/contrib/caption/caption-eng.tex
index 8aa5e47331..ef9fd38923 100644
--- a/macros/latex/contrib/caption/caption-eng.tex
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/caption-rus.tex b/macros/latex/contrib/caption/caption-rus.tex
index c3b536cc2f..2082c375f0 100644
--- a/macros/latex/contrib/caption/caption-rus.tex
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/caption.dtx b/macros/latex/contrib/caption/caption.dtx
index 3b0a396831..1bf4873143 100644
--- a/macros/latex/contrib/caption/caption.dtx
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/caption.ins b/macros/latex/contrib/caption/caption.ins
index 45381b8402..d6ea31962f 100644
--- a/macros/latex/contrib/caption/caption.ins
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/caption3.dtx b/macros/latex/contrib/caption/caption3.dtx
index 59e24f0fc1..9837f72142 100644
--- a/macros/latex/contrib/caption/caption3.dtx
+++ b/macros/latex/contrib/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/macros/latex/contrib/caption/subcaption.dtx b/macros/latex/contrib/caption/subcaption.dtx
index 70b669ee20..2571963bfe 100644
--- a/macros/latex/contrib/caption/subcaption.dtx
+++ b/macros/latex/contrib/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