diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/keyfloat')
-rw-r--r-- | Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx | 332 |
1 files changed, 250 insertions, 82 deletions
diff --git a/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx b/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx index 980abeba9c4..08acaf860a7 100644 --- a/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx +++ b/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx @@ -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 @@ position=top, -\usepackage{lipsum} +\usepackage{blindtext} @@ -315,7 +317,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% %<*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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{sourceverb} % % +% \needspace{7\baselineskip} % \subsection{Macros and environments} % % \DescribeMacro{\keyfig} * \oarg{loc} \marg{\keyvalsarg} \marg{image filename} \\ @@ -697,26 +701,32 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % % \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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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,14 +1480,14 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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.} % \centering % \testwidetable % \end{keytable} -% \lipsum[2] +% \blindtext % \end{dtxexample} % % @@ -1765,7 +1775,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % % \section{Code} -% +% ^^A *source % % \subsection{Older packages} % @@ -1907,18 +1917,32 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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@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@font\normalsize% +}% +{\endminipage\vskip\intextsep}% % \end{macrocode} % \end{environment} @@ -2347,7 +2371,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \setcounter{KFLT@keyfloatdepth}{0} % \end{macrocode} -% \DescribeBoolean{KFLT@inkeysubfloats} Inside a keysubfigs environment? +% \DescribeBoolean{KFLT@inkeysubfloats} Inside a \env{keysubfigs} environment? % \begin{macrocode} \newboolean{KFLT@inkeysubfloats} \setboolean{KFLT@inkeysubfloats}{false} @@ -2876,7 +2900,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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,19 +3391,23 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macro} +% \DescribeBoolean{KFLT@captionistop} Saves the value of \cs{caption@position}, +% which may become unreliable if using Komascript and +% \begin{sourceverb} +% \captionsetup[table]{position=above} +% \end{sourceverb} +% +% \begin{macrocode} +\newbool{KFLT@captionistop} +% \end{macrocode} + + % \begin{macro}{\KFLT@LWR@hook@boxouter} Used by \pkg{lwarp}. % \begin{macrocode} \newcommand*{\KFLT@LWR@hook@boxouter}{}% % \end{macrocode} % \end{macro} -% \begin{environment}{KFLT@LWR@hook@boxouter@minipage} Used by \pkg{lwarp}. -% \begin{macrocode} -\newenvironment*{KFLT@LWR@hook@boxouter@minipage}[2][] - {\minipage[#1]{#2}} - {\endminipage} -% \end{macrocode} -% \end{environment} % \begin{environment}{KFLT@boxouter} \marg{star?} \marg{loc} % @@ -3410,7 +3438,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% {% keyfloats \ifbool{KFLT@keywrap}% - {\KFLT@LWR@hook@boxouter@minipage[t]{\KFLT@rowboxwidth}}% + {\minipage[t]{\KFLT@rowboxwidth}}% {\minipage[\KFLT@va]{\KFLT@rowboxwidth}}% \captionsetup*{type=\KFLT@type}% }% keyfloats @@ -3430,7 +3458,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {% \par\addvspace{\baselineskip}% \noindent% - \KFLT@LWR@hook@boxouter@minipage[t]{\linewidth}% + \minipage[t]{\linewidth}% \captionsetup{type=\KFLT@type}% }% {% not a keywrap @@ -3441,7 +3469,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \KFLT@findwidths% \wrapfloat{\KFLT@type}{\KFLT@wp}% - {\KFLT@imagewidth+2\KFLTlooseframewidth}% + {\KFLT@imagewidth+2\KFLTlooseframewidth}% + \minipage{\KFLT@imagewidth+2\KFLTlooseframewidth}% + \normalcolor\reset@font\normalsize% % \end{macrocode} % Change the interior image to the discovered fixed width. % \begin{macrocode} @@ -3470,9 +3500,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} {% [M] \KFLT@marginfloat[\KFLT@mo]{\KFLT@type}% - \captionsetup{type=\KFLT@type}% }% [M] - {% not [M} + {% not [M] % \end{macrocode} % % See if the float should be positioned [H]ere: @@ -3480,10 +3509,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \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@va]{\linewidth}% + \normalcolor\reset@font\normalsize% \captionsetup{type=\KFLT@type}% }% [H] % \end{macrocode} @@ -3510,8 +3542,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \KFLT@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@iftop{\KFLT@caption{}}{}% + \caption@iftop{\booltrue{KFLT@captionistop}}{\boolfalse{KFLT@captionistop}}% + \ifbool{KFLT@captionistop}{\KFLT@caption{}}{}% % \end{macrocode} % Typeset the contents: % \begin{macrocode} @@ -3531,8 +3565,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \KFLT@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@iftop{}{\KFLT@caption{}}% + \ifbool{KFLT@captionistop}{}{\KFLT@caption{}}% % \end{macrocode} % If are inside \env{keysubtabs}, end the subtable: % \begin{macrocode} @@ -3543,6 +3578,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {% not subfloat \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% keyfloats? {% +% \end{macrocode} +% \begin{macrocode} \endminipage% }% keyfloats {% not keyfloats @@ -3555,7 +3592,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % See if in a \env{keywrap}: % \begin{macrocode} \ifbool{KFLT@keywrap}{% - \endKFLT@LWR@hook@boxouter@minipage% + \endminipage% \par\addvspace{\baselineskip}% }% {% not keywrap @@ -3568,6 +3605,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Place [W], so close the wrap float: % \begin{macrocode} {% [W] + \endminipage% \endwrapfloat% }% [W] {% not[W] @@ -3577,17 +3615,21 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \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@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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {% [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@keyfloatdepth}}{1}} or @@ -4032,10 +4075,15 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \KFLT@LWR@hook@keyfloatsminipage{\KFLT@rowboxwidth}% }% {% - \bigbreak% + \vskip\intextsep% \KFLT@LWR@hook@keyfloatsminipage{\linewidth}% }% % \end{macrocode} +% Reset font and color: +% \changes{v2.01}{2019/09/11}{Fix: Font and color.} +% \begin{macrocode} + \normalcolor\reset@font\normalsize% +% \end{macrocode} % If inside subfloats, generate subfigures by default: % \begin{macrocode} \ifbool{KFLT@inkeysubfloats}% @@ -4043,13 +4091,38 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {\captionsetup*{type=figure}}% }% [H] or nested % \end{macrocode} -% Isn't [H] or nested, so create a figure: +% Isn't [H] or nested +% \begin{macrocode} + {% See if [W]: + \ifstrequal{#2}{W} + {% [W]: +% \end{macrocode} +% [W]: +% \changes{v2.01}{2019/09/16}{Added \env{keyfloats} [W].} % \begin{macrocode} - {% figure - \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format - {\begin{figure*}[#2]}% - {\begin{figure}[#2]}% - }% figure + \wrapfloat{figure}{O}{.5\linewidth}% + \minipage{\linewidth}% + \normalcolor\reset@font\normalsize% + }% + {% not [H]: + \ifstrequal{#2}{M}% + {% [M]: +% \end{macrocode} +% [M]: +% \changes{v2.01}{2019/09/16}{Added \env{keyfloats} [M].} +% \begin{macrocode} + \KFLT@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} @@ -4093,22 +4166,47 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \endKFLT@LWR@hook@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@keyfloatdepth}}{0}} or bool {KFLT@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@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 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macro} +% \DescribeBoolean{KFLT@subcaptionistop} Saves the value of \cs{caption@position}, +% which may become unreliable if using Komascript and +% \begin{sourceverb} +% \captionsetup[table]{position=above} +% \end{sourceverb} +% +% \begin{macrocode} +\newbool{KFLT@subcaptionistop} +% \end{macrocode} + + + % \begin{macro}{\KFLT@subfloats} \marg{starred?} \marg{loc} \marg{cols} \marg{\keyvalsarg} % % \changes{v0.13}{2017/01/16}{Fix: Subfloat type selection.} @@ -4188,21 +4298,51 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {\setlength{\KFLT@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 bool {KFLT@keywrap} }% {% - \bigbreak\noindent\begin{minipage}{\linewidth}% + \vskip\intextsep\noindent\begin{minipage}{\linewidth}% + \normalcolor\reset@font\normalsize% }% % \end{macrocode} -% Isn't [H], so create a float, possibly starred: +% Not [H]: % \begin{macrocode} {% - \IfBooleanTF{#1}% - {\begin{\KFLT@subgrptype*}[#2]}% - {\begin{\KFLT@subgrptype}[#2]}% + \ifstrequal{#2}{W}% + {% [W] +% \end{macrocode} +% [W]: +% \changes{v2.01}{2019/09/16}{Added \env{keysubfloats} [W].} +% \begin{macrocode} + \wrapfloat{\KFLT@subgrptype}{O}{.5\linewidth}% + \setlength{\KFLT@rowboxwidth}{.5\KFLT@rowboxwidth}% + \minipage{\linewidth}% + \normalcolor\reset@font\normalsize% + }% + {% not [H]: + \ifstrequal{#2}{M}% + {% [M]: +% \end{macrocode} +% [M]: +% \changes{v2.01}{2019/09/16}{Added \env{keysubfloats} [M].} +% \begin{macrocode} + \KFLT@marginfloat{\KFLT@subgrptype}% + \setlength{\KFLT@rowboxwidth}{.9\marginparwidth/\real{#3}}% + }% [M] + {% subfloat +% \end{macrocode} +% A subfloat: +% \begin{macrocode} + \IfBooleanTF{#1}% + {\begin{\KFLT@subgrptype*}[#2]}% + {\begin{\KFLT@subgrptype}[#2]}% + }% + }% not [H] }% % \end{macrocode} % Set the caption type: @@ -4220,8 +4360,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \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@iftop{\KFLT@caption{subgrp}}{}% + \caption@iftop{\booltrue{KFLT@subcaptionistop}}{\boolfalse{KFLT@subcaptionistop}}% + \ifbool{KFLT@subcaptionistop}{\KFLT@caption{subgrp}}{}% % \end{macrocode} % Not yet started a row of subfloats. % The use of \cs{defcounter} makes these changes local. @@ -4260,20 +4402,41 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \KFLT@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@iftop{}{\KFLT@caption{subgrp}}% + \ifbool{KFLT@subcaptionistop}{}{\KFLT@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@keywrap} }% - {\end{minipage}\bigbreak}% was [H] + {\end{minipage}\vskip\intextsep}% was [H] {% not [H]: - \IfBooleanTF{#1}% starred? - {\end{\KFLT@subgrptype*}}% - {\end{\KFLT@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@marginfloat% + }% [M] + {% subfloat + \IfBooleanTF{#1}% starred? + {\end{\KFLT@subgrptype*}}% + {\end{\KFLT@subgrptype}}% + }% + }% not [W] }% not [H] % \end{macrocode} % Unnest the environment: @@ -4380,6 +4543,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \subsection{Margin floats} % % \begin{environment}{KFLT@marginfloat} \oarg{offset} \marg{type} +% \changes{v2.01}{2019/09/11}{Fix: Font and color.} % \begin{macrocode} \newsavebox{\KFLT@marginfloatbox} @@ -4392,6 +4556,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \captionsetup{type=#2}% \hbox{}\vspace*{#1}% \noindent% + \normalcolor\reset@font\normalsize% }% start {% end \end{minipage}% @@ -4454,10 +4619,12 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \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@keywrapwidth}{\linewidth}% \addtolength{\KFLT@keywrapwidth}{-#1}% \addtolength{\KFLT@keywrapwidth}{-2em}% @@ -4473,6 +4640,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \hfill% \begin{minipage}[t]{#1}% \booltrue{KFLT@keywrap}% + \normalcolor\reset@font\normalsize% #2% \par% \unskip\vspace{\smallskipamount}% |