From f7fc4ad3995d7f6ebbed20c20bf06e3a9176ea04 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 9 Jun 2021 03:03:06 +0000
Subject: CTAN sync 202106090303

---
 macros/latex/contrib/keyfloat/keyfloat.dtx | 107 ++++++++++++++++++++++-------
 1 file changed, 84 insertions(+), 23 deletions(-)

(limited to 'macros/latex/contrib/keyfloat/keyfloat.dtx')

diff --git a/macros/latex/contrib/keyfloat/keyfloat.dtx b/macros/latex/contrib/keyfloat/keyfloat.dtx
index 317856b7da..7be362c421 100644
--- a/macros/latex/contrib/keyfloat/keyfloat.dtx
+++ b/macros/latex/contrib/keyfloat/keyfloat.dtx
@@ -17,7 +17,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{keyfloat}
-%<package>    [2021/05/28 v2.03 Key/value interface for floats and subfloats.]
+%<package>    [2021/06/08 v2.04 Key/value interface for floats and subfloats.]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -317,7 +317,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 %<*package>
 % \fi
 %
-% \CheckSum{1298}
+% \CheckSum{1326}
 %
 % \CharacterTable
 % {Upper-case     \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -355,6 +355,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % \changes{v2.02}{2021/05/28}{2021/05/27}
 % \changes{v2.03}{2021/05/28}{Fixed \cs{hbadness} w/ \cs{relax}.}
 % \changes{v2.03}{2021/05/28}{2021/05/28}
+% \changes{v2.04}{2021/06/08}{2021/06/08}
 
 
 
@@ -811,7 +812,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % cont & \largebullet &  Continued float?  & cont \\
 % l & \largebullet &  The label.  Enclose in braces if a comma is included.
 %	Ignored in unnumbered floats. & l=fig:A name  \\
-% ap, aup & \largebullet & Artist/author's prefix, such as ``Mr.''\tnote{b} & ap=Mr. \\
+% ap, aup & \largebullet & Artist/author's prefix, such as ``Mr.''\,\tnote{b} & ap=Mr. \\
 % af, auf & \largebullet & Artist/author's first name.\tnote{b} & af=First \\
 % al, aul & \largebullet & Artist/author's last name.\tnote{b} & al=Last \\
 % as, aus & \largebullet & Artist/author's suffix, such as |~III|.\tnote{b} & |al=~III| \\
@@ -849,44 +850,46 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % \index{keys>and values}
 % \begin{threeparttable}
 % \small
-% \begin{tabular}{>{\ttfamily}c>{\raggedright}p{2.5in}>{\centering\arraybackslash}>{\ttfamily\arraybackslash}p{1in}}
+% \begin{tabular}{>{\ttfamily}cc>{\raggedright}p{2.5in}>{\centering\arraybackslash}>{\ttfamily\arraybackslash}p{1in}}
 % \toprule
-% \textrm{Key}\tnote{a} & Description & \textrm{Example} \\
+% \textrm{Key} & Sub\tnote{c} & Description & \textrm{Example} \\
 % \midrule
-% lw &  Set the width to a fraction of \cs{linewidth}.  Cancels |w|.
+% lw & --- & Set the width to a fraction of \cs{linewidth}.  Cancels |w|.
 % 	If a non-image float, sets the width of the text box.
 %   For wrapped objects, may be used with \optn{wlw} for a smaller item
 %       with a larger caption.
 %           & lw=.5 \\  
-% w &  Set the actual width.  Cancels |lw|.
+% w &  --- & Set the actual width.  Cancels |lw|.
 % 	If a non-image float, sets the width of the text box.
 %   For wrapped objects, may be used with \optn{ww} for a smaller item
 %       with a larger caption.
 %           & w=2in \\
-% h &  Set the actual height, images only.  & w=2in \\
-% s &  Set the image scale, images only.  & s=3 \\
-% a &  Set the rotation angle; counter-clockwise degrees. & r=90 \\
-% f &  Selects a loose frame with the current \cs{fboxsep}.
+% h & --- & Set the actual height, images only.  & w=2in \\
+% s & --- & Set the image scale, images only.  & s=3 \\
+% a & --- & Set the rotation angle; counter-clockwise degrees. & r=90 \\
+% f & --- & Selects a loose frame with the current \cs{fboxsep}.
 %	Only rotated with \cs{keyfig}.  & f \\
-% ft &  Selects a tight frame with no \cs{fboxsep}.  Useful for photographs,
+% ft & --- & Selects a tight frame with no \cs{fboxsep}.  Useful for photographs,
 % 	or diagrams which already have some margin built in. & ft \\
-% stretch & Sets \cs{arraystretch} inside the float. & stretch=1.5 \\
-% mo & Sets the vertical offset for a margin float. & mo=-1.2ex \\
-% wp & Sets the wrap placement for a wrapped float. The default
+% stretch & --- & Sets \cs{arraystretch} inside the float. & stretch=1.5 \\
+% mo & --- & Sets the vertical offset for a margin float. & mo=-1.2ex \\
+% wn & --- & Sets the number of lines for a wrapped float. & wn=2 \\
+% wp & --- & Sets the wrap placement for a wrapped float. The default
 %	is |O|, which places the wrapped float at the outside edge of the text.
 %	See \cref{tab:wrapplacement}.
 %	& wp=I \\
-% wlw & Sets the total width of the wrapped item to a fraction of \cs{linewidth}.
+% wo & --- & Sets the wrap overhang for a wrapped float. & wo=8em \\
+% wlw & --- & Sets the total width of the wrapped item to a fraction of \cs{linewidth}.
 %       May be more than the \optn{w} or \optn{lw} width. & wlw=.6 \\
-% ww & Sets the total width of the wrapped item.
+% ww & --- & Sets the total width of the wrapped item.
 %       May be more than the \optn{w} or \optn{lw} width. & ww=2in \\
-% va & Sets the vertical alignment of the outermost minipage container for the keyfloat.
+% va & --- & Sets the vertical alignment of the outermost minipage container for the keyfloat.
 %	Defaults to 'c'.
 %	& va=t \\
 % \bottomrule
 % \end{tabular}
 % \begin{tablenotes}
-% \item[a:] None of the keys in Part II are used in the
+% \item[c:] None of the keys in Part II are used in the
 %	\env{keysubfigs}, \env{keysubtabs}, and \env{keysubfloats} environments.
 % \end{tablenotes}
 % \end{threeparttable}
@@ -1476,7 +1479,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % \begin{dtxexample}[\Cref{fig:keyfigw,tab:keytabw}]
 %	{Using \cs{keyfig}\optn{[W]} and \cs{keytab}\optn{[W]}\label{ex:keyfigw}}
 % \keyfig[W]{c={A \cs{keyfig}\optn{[W]}},
-% 	l=fig:keyfigw,ft,lw=.4,wp=I,
+% 	l=fig:keyfigw,ft,lw=.4,wp=I, wo=8em, wn=12,
 % 	t={.4\cs{linewidth} wide, placed \optn{I}.}
 % }{image2}
 % \blindtext
@@ -1489,7 +1492,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % \begin{dtxexample}[\Cref{fig:keyfigboxw} and the \cs{keyparbox}.]
 %	{Using \cs{keyfigbox}\optn{[W]} and \cs{keyparbox}\optn{[W]}\label{ex:keyfigboxw}}
 % \keyfigbox[W]{c={A \cs{keyfigbox}\optn{[W]}},
-% 	l=fig:keyfigboxw,f,lw=.25,wp=I,
+% 	l=fig:keyfigboxw,f,lw=.25,wp=I, wn=7,
 % 	t=Text text text text text text text text text
 % }{The contents.}
 % \blindtext
@@ -1502,7 +1505,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % \begin{dtxexample}[\Cref{fig:keyfigurew,tab:keytablew}]
 %	{Using \cs{keyfigure}\optn{[W]} and \cs{keytable}\optn{[W]}\label{ex:keyfiguretablew}}
 % \begin{keyfigure}[W]{c={A \cs{keyfigure}\optn{[W]}},
-% 	l=fig:keyfigurew,f,w=1.5in}
+% 	l=fig:keyfigurew,f,w=1.5in, wo=4em,wn=5}
 % This is a keyfigure.
 % \end{keyfigure}
 % \blindtext
@@ -1936,6 +1939,32 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 %
 
 
+% \subsection{Patching \pkg{wrapfig}}
+%
+% A minor patch to allow \pkg{wrapfig} to expand its argument for the
+% number of narrow lines.
+% This allows it to be programmed by \pkg{keyfloat}.
+%
+% \cs{WF@wr} will not be defined if using \pkg{lwarp} with \HTML\ output.
+% \changes{v2.04}{2021/06/08}{Patch \pkg{wrapfig}.}
+%    \begin{macrocode}
+\RequirePackage{xpatch}
+
+\ifdef{\WF@wr}
+{
+    \xpatchcmd{\WF@wr}
+        {\gdef}
+        {\xdef}
+        {}
+        {
+            \PackageError{keyfloat}
+            {Unable to patch wrapfig \protect\WF@wr}
+            {Please inform the keyfloat author.}
+        }
+}
+{}
+%    \end{macrocode}
+
 
 
 % \DescribePackage{gettitlestring} Used by \pkg{hyperref} and \pkg{nameref}.
@@ -2372,6 +2401,20 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % \end{macro}
 
 
+% \DescribeKey[main]{wn} Set wrap number of narrow lines for a wrapped float.
+%
+% \changes{v2.04}{2021/06/08}{Added \optn{wn} key.}
+%    \begin{macrocode}
+\define@key{KFLT@keys}{wn}{\renewcommand{\KFLT@wn}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT@wn} Storage for the wrap placement.
+%    \begin{macrocode}
+\newcommand{\KFLT@wn}{}
+%    \end{macrocode}
+% \end{macro}
+
+
 % \DescribeKey[main]{wp} Set wrap placement for a wrapped float.
 %
 % See \cref{tab:wrapplacement} on \cpageref{tab:wrapplacement}.
@@ -2387,6 +2430,21 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 %    \end{macrocode}
 % \end{macro}
 
+
+% \DescribeKey[main]{wo} Set wrap overhang for a wrapped float.
+%
+% \changes{v2.04}{2021/06/08}{Added \optn{wo} key.}
+%    \begin{macrocode}
+\define@key{KFLT@keys}{wo}{\renewcommand{\KFLT@wo}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT@wo} Storage for the wrap placement.
+%    \begin{macrocode}
+\newcommand{\KFLT@wo}{\wrapoverhang}
+%    \end{macrocode}
+% \end{macro}
+
+
 % \DescribeKey[main]{wlw} Wrapped figure, fraction of \cs{linewidth}
 % \changes{v2.02}{2021/05/27}{Added \optn{ww} and \optn{wlw}.}
 %    \begin{macrocode}
@@ -3190,7 +3248,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
     \setboolean{KFLT@ft}{false}%
     \renewcommand{\KFLT@stretch}{1}%
     \setlength{\KFLT@mo}{-1.2ex}%
+    \renewcommand{\KFLT@wn}{}%
     \renewcommand{\KFLT@wp}{O}%
+    \renewcommand{\KFLT@wo}{\wrapoverhang}%
     \renewcommand{\KFLT@wlw}{}%
     \setlength{\KFLT@ww}{0pt}%
     \renewcommand{\KFLT@va}{c}%
@@ -3600,9 +3660,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}%
 % and make the wrapped figure environment as wide as the
 % desired image size plus frame:
 % \changes{v2.02}{2021/05/27}{Added \optn{ww} and \optn{wlw}.}
+% \changes{v2.04}{2021/06/08}{Added \optn{wn} and \optn{wo}.}
 %    \begin{macrocode}
                     \KFLT@findwidths%
-                    \wrapfloat{\KFLT@type}{\KFLT@wp}%
+                    \wrapfloat{\KFLT@type}[\KFLT@wn]{\KFLT@wp}[\KFLT@wo]%
                         {\KFLT@wrapwidth+2\KFLTlooseframewidth}%
                     \minipage{\KFLT@wrapwidth+2\KFLTlooseframewidth}%
 %    \end{macrocode}
-- 
cgit v1.2.3

