texlive[52160] Master/texmf-dist: keyfloat (23sep19)

commits+karl at tug.org commits+karl at tug.org
Mon Sep 23 22:57:22 CEST 2019


Revision: 52160
          http://tug.org/svn/texlive?view=revision&revision=52160
Author:   karl
Date:     2019-09-23 22:57:22 +0200 (Mon, 23 Sep 2019)
Log Message:
-----------
keyfloat (23sep19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/keyfloat/README.txt
    trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf
    trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx
    trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty

Modified: trunk/Master/texmf-dist/doc/latex/keyfloat/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/README.txt	2019-09-23 20:57:10 UTC (rev 52159)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/README.txt	2019-09-23 20:57:22 UTC (rev 52160)
@@ -1,7 +1,7 @@
 The LaTeX keyfloat package
 Provides a key/value interface for generating floats.
 
-v2.00 — 2019/03/21
+v2.01
 Copyright 2016-2019 Brian Dunn — www.BDTechConcepts.com
 
 LaTeX Project Public License, version 1.3

Modified: trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx	2019-09-23 20:57:10 UTC (rev 52159)
+++ trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx	2019-09-23 20:57:22 UTC (rev 52160)
@@ -17,7 +17,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{keyfloat}
-%<package>    [2019/03/21 v2.00 Key/value interface for floats and subfloats.]
+%<package>    [2019/09/23 v2.01 Key/value interface for floats and subfloats.]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -102,6 +102,8 @@
 
 \usepackage{enumitem}
 
+\usepackage{needspace}
+
 \usepackage{array}
 \usepackage{booktabs}
 \usepackage{threeparttable}
@@ -177,7 +179,7 @@
 
 
 
-\usepackage{lipsum}
+\usepackage{blindtext}
 
 
 
@@ -315,7 +317,7 @@
 %<*package>
 % \fi
 %
-% \CheckSum{1174}
+% \CheckSum{1251}
 %
 % \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
@@ -349,6 +351,7 @@
 % \changes{v2.00}{2019/03/21}{\ 2019/03/21}
 % \changes{v2.00}{2019/03/17}{Added custom float types.}
 % \changes{v2.00}{2019/03/17}{Added float authors.}
+% \changes{v2.01}{2019/09/23}{2019/09/23}
 
 
 
@@ -653,6 +656,7 @@
 % \end{sourceverb}
 %
 %
+% \needspace{7\baselineskip}
 % \subsection{Macros and environments}
 %
 % \DescribeMacro{\keyfig} * \oarg{loc} \marg{\keyvalsarg} \marg{image filename} \\
@@ -697,26 +701,32 @@
 %
 %
 % \DescribeEnv{keyfloats} * \oarg{loc} \marg{num columns} \\
-% A group of figures or tables typeset in rows.  May be nested.
+% A group of figures or tables typeset in rows.  May be nested, [H], [W], or [M].
 % See \cref{ex:keyfloats}.
 %
 % \DescribeEnv{keysubfigs} * \oarg{loc} \marg{numcols} \marg{keys} \\
 % A group of subfigures typeset in rows.
-% May not be nested.
+% May \emph{not} be nested.  May be [H], [W], or [M].
 % See \cref{ex:keysubfigs}.
 %
+% \needspace{2\baselineskip}
 % \DescribeEnv{keysubtabs} * \oarg{loc} \marg{numcols} \marg{keys} \\
 % A group of subtables typeset in rows.
-% May not be nested.
+% May \emph{not} be nested.  May be [H], [W], or [M].
 % See \cref{ex:keysubtabs}.
 %
+% \needspace{2\baselineskip}
 % \DescribeEnv{keysubfloats} * \oarg{loc} \marg{float type} \marg{numcols} \marg{keys} \\
 % A group of subfloats typeset in rows.
-% May not be nested.
+% May \emph{not} be nested.  May be [H], [W], or [M].
 %
 % \DescribeEnv{keywrap} \marg{width of keyfloat} \marg{keyfloat} \\
-% Displays a keyfloat next to an environment of text.  Usable inside a list item,
-% where [W] will not work.  \meta{keyfloat} may be any of \cs{keyfig}, \env{keyfigure},
+% Displays a keyfloat next to an environment of text.
+% Two minipages are used side-by-side, which allows its use inside a list item
+% where [W] will not work, but extra empty vertical space
+% \watchout[empty space]
+% will appear if the keyfloat and the text are of unequal vertical size.
+% \meta{keyfloat} may be any of \cs{keyfig}, \env{keyfigure},
 % \env{keyfloats}, \env{keysubfigs}, etc., each with its proper arguments.
 % See \cref{ex:keywrapkeyfig}.
 %
@@ -804,7 +814,7 @@
 % \end{tabular}
 % \begin{tablenotes}
 % \item[a:] All the keys in Part I may be used with the
-%	\env{keysubfigs} and \env{keysubtabs} environments.
+%	\env{keysubfigs}, \env{keysubtabs}, and \env{keysubfloats} environments.
 % \item[b:] Artist \Slash author keys:
 %   |al| is an artist's last name, |aul| is an author's last name, etc.
 %   Artists names are printed centered, authors are flush right.
@@ -854,7 +864,7 @@
 % \end{tabular}
 % \begin{tablenotes}
 % \item[a:] None of the keys in Part II are used in the
-%	\env{keysubfigs} and \env{keysubtabs} environments.
+%	\env{keysubfigs}, \env{keysubtabs}, and \env{keysubfloats} environments.
 % \end{tablenotes}
 % \end{threeparttable}
 % \end{keytable}
@@ -922,7 +932,7 @@
 % options for the |wp| key
 % for floats placed |[W]|.
 %
-% \begin{keytable}{c={Wrapped float placement options},l=tab:wrapplacement}
+% \begin{keytable}{c={Key \optn{wp}: Wrapped float placement options},l=tab:wrapplacement}
 % \index{float>wrapped placement}\index{wrapped float placement}
 % \centering
 % \begin{tabular}{ccl}
@@ -1256,8 +1266,8 @@
 % It is the user's responsibility to adjust |w|, |h|, or |lw| as necessary.
 % \index{troubleshooting>image too large}
 %
-% Keyfloats may be positioned [H]: \\
-% \hspace*{2em}|\begin{keyfloats}[H}{2}| \dots
+% Keyfloats may be located [H], [M], or located [W] set with half the line width:\\
+% \hspace*{2em}|\begin{keyfloats}[H]{2}| \dots
 %
 % Keyfloats may be starred to span both columns in a two-column format: \\
 % \hspace*{2em}|\begin{keyfloats}*{2}| \dots
@@ -1288,11 +1298,11 @@
 % 
 % \Crefrange{fig:firstsubfig}{fig:fifthsubfig} are in
 % the \cref{fig:subfigs} \env{keysubfigs} environment.
-% The \cs{keysubtabs} environment is similar.
+% The \env{keysubtabs} environment is similar.
 % Mixed types have the type of their container, as shown with \cref{fig:fourthsubfig}.
 %
 % Subfloats are associated floats (a, b, \dots) collected together into one common float
-% (the enclosing \cs{keysubfigs} or \cs{keysubtabs} environment).
+% (the enclosing \env{keysubfigs} or \env{keysubtabs} environment).
 % The enclosing float can have its own caption (call ``Sub-Figures'' in the example),
 % which appears in the \acro{LOF}/\acro{LOT}, and also a label.
 % Each subfloat can have its own caption and label as well, but the
@@ -1305,17 +1315,17 @@
 % This avoids miss-labeling as each subfloat must clearly be identified
 % as a child of its containing float.
 %
-% \cs{keysubfigs} and \cs{keysubtabs} may not be used inside\watchout[nested subfloats]
+% \env{keysubfigs} and \env{keysubtabs} may not be used inside\watchout[nested subfloats]
 % \index{troubleshooting>nested subfloats}\index{subfloat>nested}
 % the \env{keyfloats} environment,
 % and cannot be nested inside each other.  (No subfloat |12aa|, |12ab|, |12ba|, etc.)
 %
-% The \env{keyfloats} environment may be used inside \cs{keysubfigs} or
+% The \env{keyfloats} environment may be used inside \env{keysubfigs} or
 % \margintag{nested keyfloats}\index{keyfloats>nested}
-% \cs{keysubtabs} to gather subfloats together, such as the
+% \env{keysubtabs} to gather subfloats together, such as the
 % three right-most figures in \cref{fig:subfigs}.
 %
-% Subfloats may be located |H|: \\
+% Subfloats may be located [H], [M], or located [W] set with half the line width: \\
 % \hspace*{2em}|\begin{keysubfigs}[H]{3}{|key/vals \dots|}|
 % 
 % Subfloats may be starred to span both columns in a two-column format: \\
@@ -1446,10 +1456,10 @@
 % 	l=fig:keyfigw,ft,lw=.4,wp=I,
 % 	t={.4\cs{linewidth} wide, placed \texttt{I}.}
 % }{image2}
-% \lipsum[1]
+% \blindtext
 % \keytab[W]{c={A \cs{keytab}\texttt{[W]}},l=tab:keytabw,w=.75in,
 % }{\testtable}
-% \lipsum[2]
+% \blindtext
 % \end{dtxexample}
 %
 % \begin{dtxexample}[\Cref{fig:keyfigboxw} and the \cs{keyparbox}.]
@@ -1458,9 +1468,9 @@
 % 	l=fig:keyfigboxw,f,lw=.25,wp=I,
 % 	t=Text text text text text text text text text
 % }{The contents.}
-% \lipsum[1]
+% \blindtext
 % \keyparbox[W]{w=1in}{A \cs{keyparbox}[W] and some more text.}
-% \lipsum[2]
+% \blindtext
 % \end{dtxexample}
 %
 %
@@ -1470,7 +1480,7 @@
 % 	l=fig:keyfigurew,f,w=1.5in}
 % This is a keyfigure.
 % \end{keyfigure}
-% \lipsum[1]
+% \blindtext
 %
 % \begin{keytable}[W]{c={A \env{keytable}\texttt{[W]}},
 % 	l=tab:keytablew,w=2in,wp=L,tc=Placed \texttt{L} and 2in wide.}
@@ -1477,7 +1487,7 @@
 % \centering
 % \testwidetable
 % \end{keytable}
-% \lipsum[2]
+% \blindtext
 % \end{dtxexample}
 %
 %
@@ -1765,8 +1775,8 @@
 %
 %
 % \section{Code}
+% ^^A *source
 %
-%
 % \subsection{Older packages}
 %
 % Ensure that \pkg{tocdata}, if loaded, is new enough:
@@ -1907,18 +1917,32 @@
 % These macros are commonly used by others.
 
 % \begin{environment}{tablehere} Place a table exactly [H].
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
 \ProvideDocumentEnvironment{tablehere}{}
-  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{table}}
-  {\endminipage\bigbreak}
+{%
+    \vskip\intextsep\noindent%
+    \minipage{\linewidth}%
+    \def\@captype{table}%
+    \normalcolor\reset at font\normalsize%
+}%
+{\endminipage\vskip\intextsep}%
 %    \end{macrocode}
 % \end{environment}
 
 % \begin{environment}{figurehere} Place a figure exactly [H].
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
 \ProvideDocumentEnvironment{figurehere}{}
-  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{figure}}
-  {\endminipage\bigbreak}
+{%
+    \vskip\intextsep\noindent%
+    \minipage{\linewidth}%
+    \def\@captype{figure}%
+    \normalcolor\reset at font\normalsize%
+}%
+{\endminipage\vskip\intextsep}%
 %    \end{macrocode}
 % \end{environment}
 
@@ -2347,7 +2371,7 @@
 \setcounter{KFLT at keyfloatdepth}{0}
 %    \end{macrocode}
 
-% \DescribeBoolean{KFLT at inkeysubfloats} Inside a keysubfigs environment?
+% \DescribeBoolean{KFLT at inkeysubfloats} Inside a \env{keysubfigs} environment?
 %    \begin{macrocode}
 \newboolean{KFLT at inkeysubfloats}
 \setboolean{KFLT at inkeysubfloats}{false}
@@ -2876,7 +2900,7 @@
 % use either \cs{caption} or \cs{captionartist}.
 %
 % The fourth argument is |{}| if a regular float, or
-% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+% |subgrp| if \env{keysubfigs} or \env{keysubtabs}.
 %
 % See Table \ref{tab:captions} for the possible combinations of
 % the caption-related keys: |c|, |cstar|, and |sc|.
@@ -2961,7 +2985,7 @@
 % Caption-creation logic.
 %
 % The argument is |{}| if a regular float, or
-% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+% |subgrp| if \env{keysubfigs} or \env{keysubtabs}.
 %
 % See Table \ref{tab:captions} for the possible combinations of
 % the caption-related keys: |c|, |cstar|, and |sc|.
@@ -3141,7 +3165,7 @@
 % Adds optional additional text.
 %
 % The argument is |{}| if a regular float, or
-% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+% |subgrp| if \env{keysubfigs} or \env{keysubtabs}.
 %
 % \changes{v0.11}{2016/12/02}{Improved paragraph handling.}
 %
@@ -3205,7 +3229,7 @@
 % Adds optional additional text.
 %
 % The argument is |{}| if a regular float, or
-% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+% |subgrp| if \env{keysubfigs} or \env{keysubtabs}.
 %
 % One of two versions is used, depending on whether the \pkg{tocdata}
 % package is available.
@@ -3367,6 +3391,17 @@
 % \end{macro}
 
 
+% \DescribeBoolean{KFLT at captionistop} Saves the value of \cs{caption at position},
+% which may become unreliable if using Komascript and
+% \begin{sourceverb}
+% \captionsetup[table]{position=above}
+% \end{sourceverb}
+%
+%    \begin{macrocode}
+\newbool{KFLT at captionistop}
+%    \end{macrocode}
+
+
 % \begin{macro}{\KFLT at LWR@hook at boxouter} Used by \pkg{lwarp}.
 %    \begin{macrocode}
 \newcommand*{\KFLT at LWR@hook at boxouter}{}%
@@ -3373,13 +3408,6 @@
 %    \end{macrocode}
 % \end{macro}
 
-% \begin{environment}{KFLT at LWR@hook at boxouter@minipage} Used by \pkg{lwarp}.
-%    \begin{macrocode}
-\newenvironment*{KFLT at LWR@hook at boxouter@minipage}[2][]
-    {\minipage[#1]{#2}}
-    {\endminipage}
-%    \end{macrocode}
-% \end{environment}
 
 % \begin{environment}{KFLT at boxouter} \marg{star?} \marg{loc}
 %
@@ -3410,7 +3438,7 @@
         \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}%
         {% keyfloats
             \ifbool{KFLT at keywrap}%
-                {\KFLT at LWR@hook at boxouter@minipage[t]{\KFLT at rowboxwidth}}%
+                {\minipage[t]{\KFLT at rowboxwidth}}%
                 {\minipage[\KFLT at va]{\KFLT at rowboxwidth}}%
             \captionsetup*{type=\KFLT at type}%
         }% keyfloats
@@ -3430,7 +3458,7 @@
             {%
                 \par\addvspace{\baselineskip}%
                 \noindent%
-                \KFLT at LWR@hook at boxouter@minipage[t]{\linewidth}%
+                \minipage[t]{\linewidth}%
                 \captionsetup{type=\KFLT at type}%
             }%
             {% not a keywrap
@@ -3441,7 +3469,7 @@
 %    \begin{macrocode}
                 \ifstrequal{#2}{W}%
 %    \end{macrocode}
-% Place [W], so create a wrapfloat from the \pkg{wrapfig} package:
+% Place [W], so create a wrapfloat using the \pkg{wrapfig} package:
 %    \begin{macrocode}
                 {% [W]
 %    \end{macrocode}
@@ -3451,7 +3479,9 @@
 %    \begin{macrocode}
                     \KFLT at findwidths%
                     \wrapfloat{\KFLT at type}{\KFLT at wp}%
-                    {\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                        {\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                    \minipage{\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                    \normalcolor\reset at font\normalsize%
 %    \end{macrocode}
 % Change the interior image to the discovered fixed width.
 %    \begin{macrocode}
@@ -3470,9 +3500,8 @@
 %    \begin{macrocode}
                     {% [M]
                         \KFLT at marginfloat[\KFLT at mo]{\KFLT at type}%
-                        \captionsetup{type=\KFLT at type}%
                     }% [M]
-                    {% not [M}
+                    {% not [M]
 %    \end{macrocode}
 %
 % See if the float should be positioned [H]ere:
@@ -3480,10 +3509,13 @@
                         \ifstrequal{#2}{H}%
 %    \end{macrocode}
 % Place [H], so create an inline minipage:
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
                         {% [H]
-                            \par\addvspace{\baselineskip}%
+                            \vskip\intextsep%
                             \noindent\minipage[\KFLT at va]{\linewidth}%
+                            \normalcolor\reset at font\normalsize%
                             \captionsetup{type=\KFLT at type}%
                         }% [H]
 %    \end{macrocode}
@@ -3510,8 +3542,10 @@
     \KFLT at findwidths%
 %    \end{macrocode}
 % Place the caption above the contents depending on \pkg{caption} \optn{position} option:
+% \changes{v2.01}{2019/09/11}{Fix: Positions with \brand{Komascript}.}
 %    \begin{macrocode}
-    \caption at iftop{\KFLT at caption{}}{}%
+    \caption at iftop{\booltrue{KFLT at captionistop}}{\boolfalse{KFLT at captionistop}}%
+    \ifbool{KFLT at captionistop}{\KFLT at caption{}}{}%
 %    \end{macrocode}
 % Typeset the contents:
 %    \begin{macrocode}
@@ -3531,8 +3565,9 @@
     \KFLT at addartisttext{}%
 %    \end{macrocode}
 % Place the caption below the contents depending on \pkg{caption} \optn{position} option:
+% \changes{v2.01}{2019/09/11}{Fix: Positions with \brand{Komascript}.}
 %    \begin{macrocode}
-    \caption at iftop{}{\KFLT at caption{}}%
+    \ifbool{KFLT at captionistop}{}{\KFLT at caption{}}%
 %    \end{macrocode}
 % If are inside \env{keysubtabs}, end the subtable:
 %    \begin{macrocode}
@@ -3543,6 +3578,8 @@
     {% not subfloat
         \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}% keyfloats?
         {%
+%    \end{macrocode}
+%    \begin{macrocode}
             \endminipage%
         }% keyfloats
         {% not keyfloats
@@ -3555,7 +3592,7 @@
 % See if in a \env{keywrap}:
 %    \begin{macrocode}
             \ifbool{KFLT at keywrap}{%
-                \endKFLT at LWR@hook at boxouter@minipage%
+                \endminipage%
                 \par\addvspace{\baselineskip}%
             }%
             {% not keywrap
@@ -3568,6 +3605,7 @@
 % Place [W], so close the wrap float:
 %    \begin{macrocode}
                 {% [W]
+                    \endminipage%
                     \endwrapfloat%
                 }% [W]
                 {% not[W]
@@ -3577,17 +3615,21 @@
 %    \begin{macrocode}
                     \ifstrequal{#2}{M}%
 %    \end{macrocode}
-% Place [M], so close the marginfloat:
+% [M], so close the marginfloat:
 % \changes{v2.00}{2019/03/18}{Added custom float types.}
 %    \begin{macrocode}
                     {% [M]
                         \endKFLT at marginfloat%
                     }% [M]
+%    \end{macrocode}
+% [H] or float:
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
+%    \begin{macrocode}
                     {% not [M]
                         \ifstrequal{#2}{H}%
                         {%
                             \endminipage% [H]
-                            \par\addvspace{\baselineskip}%
+                            \vskip\intextsep%
                         }%
                         {% not [H]
                             \IfBooleanTF{#1}% starred float?
@@ -3989,7 +4031,7 @@
 % inside the \env{keyfloats} environment.
 %
 % Note that |lw| linewidth keys may need to be adjusted inside
-% a \env{keyfloats}, \cs{keysubfigs}, or \cs{keysubtabs}, since
+% a \env{keyfloats}, \env{keysubfigs}, or \env{keysubtabs}, since
 % \cs{linewidth} changes depending on the number of columns.
 % Likewise, manually-selected |w| width and |h| tags may need to be
 % adjusted to prevent overflow.
@@ -4023,6 +4065,7 @@
     {% [H] or nested
 %    \end{macrocode}
 % If nested, use different spacing as was computed in the outer nesting level:
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
         \ifboolexpr{%
             test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
@@ -4032,10 +4075,15 @@
             \KFLT at LWR@hook at keyfloatsminipage{\KFLT at rowboxwidth}%
         }%
         {%
-            \bigbreak%
+            \vskip\intextsep%
             \KFLT at LWR@hook at keyfloatsminipage{\linewidth}%
         }%
 %    \end{macrocode}
+% Reset font and color:
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
+%    \begin{macrocode}
+        \normalcolor\reset at font\normalsize%
+%    \end{macrocode}
 % If inside subfloats, generate subfigures by default:
 %    \begin{macrocode}
         \ifbool{KFLT at inkeysubfloats}%
@@ -4043,14 +4091,39 @@
             {\captionsetup*{type=figure}}%
     }% [H] or nested
 %    \end{macrocode}
-% Isn't [H] or nested, so create a figure:
+% Isn't [H] or nested
 %    \begin{macrocode}
-    {% figure
-        \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format
-            {\begin{figure*}[#2]}%
-            {\begin{figure}[#2]}%
-    }% figure
+    {% See if [W]:
+        \ifstrequal{#2}{W}
+        {% [W]:
 %    \end{macrocode}
+% [W]:
+% \changes{v2.01}{2019/09/16}{Added \env{keyfloats} [W].}
+%    \begin{macrocode}
+            \wrapfloat{figure}{O}{.5\linewidth}%
+            \minipage{\linewidth}%
+            \normalcolor\reset at font\normalsize%
+        }%
+        {% not [H]:
+            \ifstrequal{#2}{M}%
+            {% [M]:
+%    \end{macrocode}
+% [M]:
+% \changes{v2.01}{2019/09/16}{Added \env{keyfloats} [M].}
+%    \begin{macrocode}
+                \KFLT at marginfloat{figure}%
+            }%
+%    \end{macrocode}
+% A normal figure:
+%    \begin{macrocode}
+            {% figure
+                \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format
+                    {\begin{figure*}[#2]}%
+                    {\begin{figure}[#2]}%
+            }% figure
+        }% not [H]
+    }%
+%    \end{macrocode}
 % Compute the width of each entry:
 %    \begin{macrocode}
     \ifboolexpr{%
@@ -4093,22 +4166,47 @@
         \endKFLT at LWR@hook at keyfloatsminipage%
 %         \end{minipage}%
 %    \end{macrocode}
-% Spacing if nested:
+% Spacing if nested or not:
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
         \ifboolexpr{
             test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
             bool {KFLT at keywrap}
         }%
-        {}{%
-            \bigbreak%
+        {}{% not nested
+            \vskip\intextsep%
         }%
     }% was [H], etc.
 %    \end{macrocode}
-% Was not [H], so close a figure:
+% Not [H]:
 %    \begin{macrocode}
     {% not [H], etc.
-        \IfBooleanTF{#1}% starred figure?
-            {\end{figure*}}{\end{figure}}%
+        \ifstrequal{#2}{W}%
+        {% [W]:
+%    \end{macrocode}
+% [W]:
+% \changes{v2.01}{2019/09/16}{Added \env{keyfloats} [W].}
+%    \begin{macrocode}
+            \endminipage%
+            \endwrapfloat%
+        }%
+        {%
+            \ifstrequal{#2}{M}%
+            {% [M]:
+%    \end{macrocode}
+% [M]:
+% \changes{v2.01}{2019/09/16}{Added \env{keyfloats} [M].}
+%    \begin{macrocode}
+                \endKFLT at marginfloat%
+            }%
+            {% figure
+%    \end{macrocode}
+% A figure:
+%    \begin{macrocode}
+                \IfBooleanTF{#1}% starred figure?
+                    {\end{figure*}}{\end{figure}}%
+            }%
+        }%
     }% not [H], etc.
 %    \end{macrocode}
 % Unnest the environment:
@@ -4160,6 +4258,18 @@
 % \end{macro}
 
 
+% \DescribeBoolean{KFLT at subcaptionistop} Saves the value of \cs{caption at position},
+% which may become unreliable if using Komascript and
+% \begin{sourceverb}
+% \captionsetup[table]{position=above}
+% \end{sourceverb}
+%
+%    \begin{macrocode}
+\newbool{KFLT at subcaptionistop}
+%    \end{macrocode}
+
+
+
 % \begin{macro}{\KFLT at subfloats} \marg{starred?} \marg{loc} \marg{cols} \marg{\keyvalsarg}
 %
 % \changes{v0.13}{2017/01/16}{Fix: Subfloat type selection.}
@@ -4188,6 +4298,8 @@
         {\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
 %    \end{macrocode}
 % If [H], or in a \env{keywrap}, create an inline minipage:
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
     \ifboolexpr{%
         test {\ifstrequal{#2}{H}} or
@@ -4194,15 +4306,43 @@
         bool {KFLT at keywrap}
     }%
     {%
-        \bigbreak\noindent\begin{minipage}{\linewidth}%
+        \vskip\intextsep\noindent\begin{minipage}{\linewidth}%
+        \normalcolor\reset at font\normalsize%
     }%
 %    \end{macrocode}
-% Isn't [H], so create a float, possibly starred:
+% Not [H]:
 %    \begin{macrocode}
     {%
-        \IfBooleanTF{#1}%
-            {\begin{\KFLT at subgrptype*}[#2]}%
-            {\begin{\KFLT at subgrptype}[#2]}%
+        \ifstrequal{#2}{W}%
+        {% [W]
+%    \end{macrocode}
+% [W]:
+% \changes{v2.01}{2019/09/16}{Added \env{keysubfloats} [W].}
+%    \begin{macrocode}
+            \wrapfloat{\KFLT at subgrptype}{O}{.5\linewidth}%
+            \setlength{\KFLT at rowboxwidth}{.5\KFLT at rowboxwidth}%
+            \minipage{\linewidth}%
+            \normalcolor\reset at font\normalsize%
+        }%
+        {% not [H]:
+            \ifstrequal{#2}{M}%
+            {% [M]:
+%    \end{macrocode}
+% [M]:
+% \changes{v2.01}{2019/09/16}{Added \env{keysubfloats} [M].}
+%    \begin{macrocode}
+                \KFLT at marginfloat{\KFLT at subgrptype}%
+                \setlength{\KFLT at rowboxwidth}{.9\marginparwidth/\real{#3}}%
+            }% [M]
+            {% subfloat
+%    \end{macrocode}
+% A subfloat:
+%    \begin{macrocode}
+                \IfBooleanTF{#1}%
+                    {\begin{\KFLT at subgrptype*}[#2]}%
+                    {\begin{\KFLT at subgrptype}[#2]}%
+            }%
+        }% not [H]
     }%
 %    \end{macrocode}
 % Set the caption type:
@@ -4220,8 +4360,10 @@
     \center\unskip%
 %    \end{macrocode}
 % Place the caption above the contents depending on \pkg{caption} \optn{position} option:
+% \changes{v2.01}{2019/09/11}{Fix: Positions with \brand{Komascript}.}
 %    \begin{macrocode}
-    \caption at iftop{\KFLT at caption{subgrp}}{}%
+    \caption at iftop{\booltrue{KFLT at subcaptionistop}}{\boolfalse{KFLT at subcaptionistop}}%
+    \ifbool{KFLT at subcaptionistop}{\KFLT at caption{subgrp}}{}%
 %    \end{macrocode}
 % Not yet started a row of subfloats.
 % The use of \cs{defcounter} makes these changes local.
@@ -4260,20 +4402,41 @@
     \KFLT at addartisttext{subgrp}%
 %    \end{macrocode}
 % Place the caption below the contents depending on \pkg{caption} \optn{position} option:
+% \changes{v2.01}{2019/09/11}{Fix: Positions with \brand{Komascript}.}
 %    \begin{macrocode}
-    \caption at iftop{}{\KFLT at caption{subgrp}}%
+    \ifbool{KFLT at subcaptionistop}{}{\KFLT at caption{subgrp}}%
 %    \end{macrocode}
 % End the float or minipage:
+% \changes{v2.01}{2019/09/14}{Improved vertical space.}
 %    \begin{macrocode}
     \ifboolexpr{%
         test {\ifstrequal{#2}{H}} or
         bool{KFLT at keywrap}
     }%
-        {\end{minipage}\bigbreak}% was [H]
+        {\end{minipage}\vskip\intextsep}% was [H]
         {% not [H]:
-            \IfBooleanTF{#1}% starred?
-                {\end{\KFLT at subgrptype*}}%
-                {\end{\KFLT at subgrptype}}%
+            \ifstrequal{#2}{W}%
+            {% [W]
+%    \end{macrocode}
+% \changes{v2.01}{2019/09/16}{Added \env{keysubfloats} [W].}
+%    \begin{macrocode}
+                \endminipage%
+                \endwrapfloat%
+            }%
+            {% not [W]:
+                \ifstrequal{#2}{M}%
+                {% [M]:
+%    \end{macrocode}
+% \changes{v2.01}{2019/09/16}{Added \env{keysubfloats} [M].}
+%    \begin{macrocode}
+                    \endKFLT at marginfloat%
+                }% [M]
+                {% subfloat
+                    \IfBooleanTF{#1}% starred?
+                        {\end{\KFLT at subgrptype*}}%
+                        {\end{\KFLT at subgrptype}}%
+                }%
+            }% not [W]
         }% not [H]
 %    \end{macrocode}
 % Unnest the environment:
@@ -4380,6 +4543,7 @@
 % \subsection{Margin floats}
 %
 % \begin{environment}{KFLT at marginfloat} \oarg{offset} \marg{type}
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
 %    \begin{macrocode}
 \newsavebox{\KFLT at marginfloatbox}
 
@@ -4392,6 +4556,7 @@
     \captionsetup{type=#2}%
     \hbox{}\vspace*{#1}%
     \noindent%
+    \normalcolor\reset at font\normalsize%
 }% start
 {% end
     \end{minipage}%
@@ -4454,10 +4619,12 @@
 %
 % \begin{environment}{keywrap} \marg{width} \marg{keyfloat}
 % \changes{v0.15}{2017/05/11}{Added.}
+% \changes{v2.01}{2019/09/11}{Fix: Font and color.}
+% \changes{v2.01}{2019/09/16}{Fix: \cs{noindent}.}
 %    \begin{macrocode}
-\DeclareDocumentEnvironment{keywrap}{m +m}
+\DeclareDocumentEnvironment{keywrap}{m +m}%
 {%
-    \par%
+    \par\noindent%
     \setlength{\KFLT at keywrapwidth}{\linewidth}%
     \addtolength{\KFLT at keywrapwidth}{-#1}%
     \addtolength{\KFLT at keywrapwidth}{-2em}%
@@ -4473,6 +4640,7 @@
     \hfill%
     \begin{minipage}[t]{#1}%
     \booltrue{KFLT at keywrap}%
+    \normalcolor\reset at font\normalsize%
     #2%
     \par%
     \unskip\vspace{\smallskipamount}%

Modified: trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty	2019-09-23 20:57:10 UTC (rev 52159)
+++ trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty	2019-09-23 20:57:22 UTC (rev 52160)
@@ -18,7 +18,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{keyfloat}
-    [2019/03/21 v2.00 Key/value interface for floats and subfloats.]
+    [2019/09/23 v2.01 Key/value interface for floats and subfloats.]
 
 
 
@@ -78,12 +78,22 @@
 
 
 \ProvideDocumentEnvironment{tablehere}{}
-  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{table}}
-  {\endminipage\bigbreak}
+{%
+    \vskip\intextsep\noindent%
+    \minipage{\linewidth}%
+    \def\@captype{table}%
+    \normalcolor\reset at font\normalsize%
+}%
+{\endminipage\vskip\intextsep}%
 
 \ProvideDocumentEnvironment{figurehere}{}
-  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{figure}}
-  {\endminipage\bigbreak}
+{%
+    \vskip\intextsep\noindent%
+    \minipage{\linewidth}%
+    \def\@captype{figure}%
+    \normalcolor\reset at font\normalsize%
+}%
+{\endminipage\vskip\intextsep}%
 
 
 
@@ -641,12 +651,10 @@
     \setkeys{KFLT at keys}{#1}%
 }
 
+\newbool{KFLT at captionistop}
+
 \newcommand*{\KFLT at LWR@hook at boxouter}{}%
 
-\newenvironment*{KFLT at LWR@hook at boxouter@minipage}[2][]
-    {\minipage[#1]{#2}}
-    {\endminipage}
-
 \NewDocumentEnvironment{KFLT at boxouter}{m m}
 {% boxouter
     \ifbool{KFLT at inkeysubfloats}%
@@ -655,7 +663,7 @@
         \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}%
         {% keyfloats
             \ifbool{KFLT at keywrap}%
-                {\KFLT at LWR@hook at boxouter@minipage[t]{\KFLT at rowboxwidth}}%
+                {\minipage[t]{\KFLT at rowboxwidth}}%
                 {\minipage[\KFLT at va]{\KFLT at rowboxwidth}}%
             \captionsetup*{type=\KFLT at type}%
         }% keyfloats
@@ -665,7 +673,7 @@
             {%
                 \par\addvspace{\baselineskip}%
                 \noindent%
-                \KFLT at LWR@hook at boxouter@minipage[t]{\linewidth}%
+                \minipage[t]{\linewidth}%
                 \captionsetup{type=\KFLT at type}%
             }%
             {% not a keywrap
@@ -673,7 +681,9 @@
                 {% [W]
                     \KFLT at findwidths%
                     \wrapfloat{\KFLT at type}{\KFLT at wp}%
-                    {\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                        {\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                    \minipage{\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                    \normalcolor\reset at font\normalsize%
                     \renewcommand{\KFLT at lw}{}%
                     \renewcommand{\KFLT at w}{\KFLT at imagewidth}%
                 }% [W]
@@ -681,13 +691,13 @@
                     \ifstrequal{#2}{M}%
                     {% [M]
                         \KFLT at marginfloat[\KFLT at mo]{\KFLT at type}%
-                        \captionsetup{type=\KFLT at type}%
                     }% [M]
-                    {% not [M}
+                    {% not [M]
                         \ifstrequal{#2}{H}%
                         {% [H]
-                            \par\addvspace{\baselineskip}%
+                            \vskip\intextsep%
                             \noindent\minipage[\KFLT at va]{\linewidth}%
+                            \normalcolor\reset at font\normalsize%
                             \captionsetup{type=\KFLT at type}%
                         }% [H]
                         {% not [H]
@@ -702,7 +712,8 @@
     }% not subfloat
     \ifbool{KFLT at cont}{\ContinuedFloat}{}%
     \KFLT at findwidths%
-    \caption at iftop{\KFLT at caption{}}{}%
+    \caption at iftop{\booltrue{KFLT at captionistop}}{\boolfalse{KFLT at captionistop}}%
+    \ifbool{KFLT at captionistop}{\KFLT at caption{}}{}%
     \center\unskip%
 }% boxouter
 {% endboxouter
@@ -709,7 +720,7 @@
     \endcenter\unskip%
     \addvspace{\smallskipamount}%
     \KFLT at addartisttext{}%
-    \caption at iftop{}{\KFLT at caption{}}%
+    \ifbool{KFLT at captionistop}{}{\KFLT at caption{}}%
     \ifbool{KFLT at inkeysubfloats}%
     {%
         \csuse{endsub\KFLT at type}%
@@ -721,12 +732,13 @@
         }% keyfloats
         {% not keyfloats
             \ifbool{KFLT at keywrap}{%
-                \endKFLT at LWR@hook at boxouter@minipage%
+                \endminipage%
                 \par\addvspace{\baselineskip}%
             }%
             {% not keywrap
                 \ifstrequal{#2}{W}%
                 {% [W]
+                    \endminipage%
                     \endwrapfloat%
                 }% [W]
                 {% not[W]
@@ -738,7 +750,7 @@
                         \ifstrequal{#2}{H}%
                         {%
                             \endminipage% [H]
-                            \par\addvspace{\baselineskip}%
+                            \vskip\intextsep%
                         }%
                         {% not [H]
                             \IfBooleanTF{#1}% starred float?
@@ -966,18 +978,33 @@
             \KFLT at LWR@hook at keyfloatsminipage{\KFLT at rowboxwidth}%
         }%
         {%
-            \bigbreak%
+            \vskip\intextsep%
             \KFLT at LWR@hook at keyfloatsminipage{\linewidth}%
         }%
+        \normalcolor\reset at font\normalsize%
         \ifbool{KFLT at inkeysubfloats}%
             {}%
             {\captionsetup*{type=figure}}%
     }% [H] or nested
-    {% figure
-        \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format
-            {\begin{figure*}[#2]}%
-            {\begin{figure}[#2]}%
-    }% figure
+    {% See if [W]:
+        \ifstrequal{#2}{W}
+        {% [W]:
+            \wrapfloat{figure}{O}{.5\linewidth}%
+            \minipage{\linewidth}%
+            \normalcolor\reset at font\normalsize%
+        }%
+        {% not [H]:
+            \ifstrequal{#2}{M}%
+            {% [M]:
+                \KFLT at marginfloat{figure}%
+            }%
+            {% figure
+                \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format
+                    {\begin{figure*}[#2]}%
+                    {\begin{figure}[#2]}%
+            }% figure
+        }% not [H]
+    }%
     \ifboolexpr{%
         test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
         bool {KFLT at inkeysubfloats}
@@ -1001,13 +1028,26 @@
             test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
             bool {KFLT at keywrap}
         }%
-        {}{%
-            \bigbreak%
+        {}{% not nested
+            \vskip\intextsep%
         }%
     }% was [H], etc.
     {% not [H], etc.
-        \IfBooleanTF{#1}% starred figure?
-            {\end{figure*}}{\end{figure}}%
+        \ifstrequal{#2}{W}%
+        {% [W]:
+            \endminipage%
+            \endwrapfloat%
+        }%
+        {%
+            \ifstrequal{#2}{M}%
+            {% [M]:
+                \endKFLT at marginfloat%
+            }%
+            {% figure
+                \IfBooleanTF{#1}% starred figure?
+                    {\end{figure*}}{\end{figure}}%
+            }%
+        }%
     }% not [H], etc.
     \addtocounter{KFLT at keyfloatdepth}{-1}%
     \KFLT at envignorespaces%
@@ -1038,6 +1078,8 @@
     \renewcommand{\KFLT at subgrptextalign}{}%
 }
 
+\newbool{KFLT at subcaptionistop}
+
 \NewDocumentCommand{\KFLT at subfloats}{m m m +m}
 {%
     \KFLT at envignorespaces%
@@ -1051,12 +1093,29 @@
         bool {KFLT at keywrap}
     }%
     {%
-        \bigbreak\noindent\begin{minipage}{\linewidth}%
+        \vskip\intextsep\noindent\begin{minipage}{\linewidth}%
+        \normalcolor\reset at font\normalsize%
     }%
     {%
-        \IfBooleanTF{#1}%
-            {\begin{\KFLT at subgrptype*}[#2]}%
-            {\begin{\KFLT at subgrptype}[#2]}%
+        \ifstrequal{#2}{W}%
+        {% [W]
+            \wrapfloat{\KFLT at subgrptype}{O}{.5\linewidth}%
+            \setlength{\KFLT at rowboxwidth}{.5\KFLT at rowboxwidth}%
+            \minipage{\linewidth}%
+            \normalcolor\reset at font\normalsize%
+        }%
+        {% not [H]:
+            \ifstrequal{#2}{M}%
+            {% [M]:
+                \KFLT at marginfloat{\KFLT at subgrptype}%
+                \setlength{\KFLT at rowboxwidth}{.9\marginparwidth/\real{#3}}%
+            }% [M]
+            {% subfloat
+                \IfBooleanTF{#1}%
+                    {\begin{\KFLT at subgrptype*}[#2]}%
+                    {\begin{\KFLT at subgrptype}[#2]}%
+            }%
+        }% not [H]
     }%
     \captionsetup*{type=\KFLT at subgrptype}%
     \ifbool{KFLT at subgrpcont}%
@@ -1063,7 +1122,8 @@
         {\ContinuedFloat}%
         {}%
     \center\unskip%
-    \caption at iftop{\KFLT at caption{subgrp}}{}%
+    \caption at iftop{\booltrue{KFLT at subcaptionistop}}{\boolfalse{KFLT at subcaptionistop}}%
+    \ifbool{KFLT at subcaptionistop}{\KFLT at caption{subgrp}}{}%
     \defcounter{KFLT at numcols}{#3}%
     \defcounter{KFLT at thiscol}{0}%
     \begingroup%
@@ -1075,16 +1135,29 @@
     \endcenter%
     \par\addvspace{\bigskipamount}%
     \KFLT at addartisttext{subgrp}%
-    \caption at iftop{}{\KFLT at caption{subgrp}}%
+    \ifbool{KFLT at subcaptionistop}{}{\KFLT at caption{subgrp}}%
     \ifboolexpr{%
         test {\ifstrequal{#2}{H}} or
         bool{KFLT at keywrap}
     }%
-        {\end{minipage}\bigbreak}% was [H]
+        {\end{minipage}\vskip\intextsep}% was [H]
         {% not [H]:
-            \IfBooleanTF{#1}% starred?
-                {\end{\KFLT at subgrptype*}}%
-                {\end{\KFLT at subgrptype}}%
+            \ifstrequal{#2}{W}%
+            {% [W]
+                \endminipage%
+                \endwrapfloat%
+            }%
+            {% not [W]:
+                \ifstrequal{#2}{M}%
+                {% [M]:
+                    \endKFLT at marginfloat%
+                }% [M]
+                {% subfloat
+                    \IfBooleanTF{#1}% starred?
+                        {\end{\KFLT at subgrptype*}}%
+                        {\end{\KFLT at subgrptype}}%
+                }%
+            }% not [W]
         }% not [H]
     \setboolean{KFLT at inkeysubfloats}{false}%
     \KFLT at envignorespaces%
@@ -1135,6 +1208,7 @@
     \captionsetup{type=#2}%
     \hbox{}\vspace*{#1}%
     \noindent%
+    \normalcolor\reset at font\normalsize%
 }% start
 {% end
     \end{minipage}%
@@ -1153,9 +1227,9 @@
 \newlength{\KFLT at keywrapwidth}
 \newlength{\KFLT at keywrapparskip}
 \newlength{\KFLT at keywrapparindent}
-\DeclareDocumentEnvironment{keywrap}{m +m}
+\DeclareDocumentEnvironment{keywrap}{m +m}%
 {%
-    \par%
+    \par\noindent%
     \setlength{\KFLT at keywrapwidth}{\linewidth}%
     \addtolength{\KFLT at keywrapwidth}{-#1}%
     \addtolength{\KFLT at keywrapwidth}{-2em}%
@@ -1171,6 +1245,7 @@
     \hfill%
     \begin{minipage}[t]{#1}%
     \booltrue{KFLT at keywrap}%
+    \normalcolor\reset at font\normalsize%
     #2%
     \par%
     \unskip\vspace{\smallskipamount}%



More information about the tex-live-commits mailing list