diff options
author | Norbert Preining <norbert@preining.info> | 2020-06-11 03:02:13 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-06-11 03:02:13 +0000 |
commit | e3a95d205140a9c1ec8bc34f9a6125d8074f5e58 (patch) | |
tree | 9c905c13b24fc43e1645387b937d7a8af3dd4f51 /macros/latex/contrib/caption/caption.dtx | |
parent | 6706ba0fbc0ef5a672ef0ccb05bd75174a30bb07 (diff) |
CTAN sync 202006110302
Diffstat (limited to 'macros/latex/contrib/caption/caption.dtx')
-rw-r--r-- | macros/latex/contrib/caption/caption.dtx | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/macros/latex/contrib/caption/caption.dtx b/macros/latex/contrib/caption/caption.dtx index 06c2832c70..e75d4bd431 100644 --- a/macros/latex/contrib/caption/caption.dtx +++ b/macros/latex/contrib/caption/caption.dtx @@ -28,7 +28,7 @@ % caption-deu.tex, caption-eng.tex, caption-rus.tex. % % \fi -% \CheckSum{2977} +% \CheckSum{3022} % % \iffalse %<*driver> @@ -218,7 +218,7 @@ % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[1994/12/01] -\ProvidesPackage{caption}[2020/05/10 v3.4j Customizing captions (AR)] +\ProvidesPackage{caption}[2020/05/30 v3.4k Customizing captions (AR)] % \end{macrocode} % % \section{Loading the kernel} @@ -2444,6 +2444,77 @@ % \end{macrocode} % \end{macro} % +% \subsection{The changepage package} +% \changes{v3.4k}{2020/05/30}{Patch of the \package{changepage} package added} +% +% \begin{macrocode} +\caption@IfPackageLoaded{changepage}[2008/07/23 memoir-v3.7k]{% +% \end{macrocode} +% +% Both environments, \env{adjustwidth} and \env{adjustwidth*}, are starting a \env{list} \cs{item}. +% But \cs{hsize} isn't set properly inside a \env{list} item, and therefore \cs{@makecaption} +% (offered by document classes) doesn't work properly when used inside \env{adjustwidth}. +% Therefore we try to detect the situation ``Are we inside a adjustwidth environment?'' +% inside \cs{@makecaption} and fix this. (Sigh!) +% +% We cannot simply set and test a flag here since our adjustment to \cs{hsize} should +% not be done within a \cs{parbox} within a adjustwidth environment for example, +% and therefore we store \cs{hsize} and \cs{linewidth}, and test \cs{hsize} and \cs{linewidth} +% against the stored values instead. If they are equal we are (hopefully) quite save +% to assume that we are now inside a plain \env{adjustwidth} environment and therefore need +% to fix \cs{hsize} before typesetting the caption. (Deep sigh!) +% +% \begin{macro}{\caption@adjustwidth@hsize} +% \begin{macro}{\caption@adjustwidth@linewidth} +% \begin{macrocode} + \newdimen\caption@adjustwidth@hsize + \newdimen\caption@adjustwidth@linewidth +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\caption@set@adjustwidth} +% \changes{v3.4k}{2020/05/30}{This macro and its usage added} +% Store the values of \cs{hsize} and \cs{linewidth}. +% \begin{macrocode} + \providecommand*\caption@set@adjustwidth{% + \caption@adjustwidth@hsize\hsize + \caption@adjustwidth@linewidth\linewidth}% +% \end{macrocode} +% \begin{macrocode} + \providecommand*\caption@patch@changepage[1]{% + \expandafter\let\csname caption@#1\expandafter\endcsname\csname #1\endcsname + \expandafter\renewcommand\csname #1\endcsname[2]{% + \@nameuse{caption@#1}{##1}{##2}% + \caption@set@adjustwidth}}% + \caption@patch@changepage{adjustwidth}% + \caption@patch@changepage{adjustwidth*}% + \let\caption@patch@changepage\relax +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\caption@test@adjustwidth} +% \changes{v3.4k}{2020/05/30}{This macro and its usage added} +% Test if the values of \cs{hsize} and \cs{linewidth} are identical to +% the ones stored in the \env{adjustwidth} environment. +% If yes, set \cs{hsize} to the correct value. +% \begin{macrocode} + \providecommand\caption@test@adjustwidth{% + \ifdim\hsize=\caption@adjustwidth@hsize + \ifdim\linewidth=\caption@adjustwidth@linewidth + \hsize=\linewidth + \fi + \fi}% +% \end{macrocode} +% \begin{macrocode} +\AtBeginCaption{\caption@test@adjustwidth} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} + }{}% +% \end{macrocode} +% % \subsection{The chkfloat package} % \changes{v3.3}{2018/09/06}{Support of the \package{chkfloat} package added} % |