From 67eb531ee03008beb82d697623f5a991d446d0c0 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 23 Sep 2019 20:57:22 +0000 Subject: keyfloat (23sep19) git-svn-id: svn://tug.org/texlive/trunk@52160 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty | 157 ++++++++++++++++------ 1 file changed, 116 insertions(+), 41 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty index 0a8b5d6ceef..6c18d0c7f2b 100644 --- a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty +++ b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty @@ -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@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@font\normalsize% +}% +{\endminipage\vskip\intextsep}% @@ -641,11 +651,9 @@ \setkeys{KFLT@keys}{#1}% } -\newcommand*{\KFLT@LWR@hook@boxouter}{}% +\newbool{KFLT@captionistop} -\newenvironment*{KFLT@LWR@hook@boxouter@minipage}[2][] - {\minipage[#1]{#2}} - {\endminipage} +\newcommand*{\KFLT@LWR@hook@boxouter}{}% \NewDocumentEnvironment{KFLT@boxouter}{m m} {% boxouter @@ -655,7 +663,7 @@ \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 @@ -665,7 +673,7 @@ {% \par\addvspace{\baselineskip}% \noindent% - \KFLT@LWR@hook@boxouter@minipage[t]{\linewidth}% + \minipage[t]{\linewidth}% \captionsetup{type=\KFLT@type}% }% {% not a keywrap @@ -673,7 +681,9 @@ {% [W] \KFLT@findwidths% \wrapfloat{\KFLT@type}{\KFLT@wp}% - {\KFLT@imagewidth+2\KFLTlooseframewidth}% + {\KFLT@imagewidth+2\KFLTlooseframewidth}% + \minipage{\KFLT@imagewidth+2\KFLTlooseframewidth}% + \normalcolor\reset@font\normalsize% \renewcommand{\KFLT@lw}{}% \renewcommand{\KFLT@w}{\KFLT@imagewidth}% }% [W] @@ -681,13 +691,13 @@ \ifstrequal{#2}{M}% {% [M] \KFLT@marginfloat[\KFLT@mo]{\KFLT@type}% - \captionsetup{type=\KFLT@type}% }% [M] - {% not [M} + {% not [M] \ifstrequal{#2}{H}% {% [H] - \par\addvspace{\baselineskip}% + \vskip\intextsep% \noindent\minipage[\KFLT@va]{\linewidth}% + \normalcolor\reset@font\normalsize% \captionsetup{type=\KFLT@type}% }% [H] {% not [H] @@ -702,14 +712,15 @@ }% not subfloat \ifbool{KFLT@cont}{\ContinuedFloat}{}% \KFLT@findwidths% - \caption@iftop{\KFLT@caption{}}{}% + \caption@iftop{\booltrue{KFLT@captionistop}}{\boolfalse{KFLT@captionistop}}% + \ifbool{KFLT@captionistop}{\KFLT@caption{}}{}% \center\unskip% }% boxouter {% endboxouter \endcenter\unskip% \addvspace{\smallskipamount}% \KFLT@addartisttext{}% - \caption@iftop{}{\KFLT@caption{}}% + \ifbool{KFLT@captionistop}{}{\KFLT@caption{}}% \ifbool{KFLT@inkeysubfloats}% {% \csuse{endsub\KFLT@type}% @@ -721,12 +732,13 @@ }% keyfloats {% not keyfloats \ifbool{KFLT@keywrap}{% - \endKFLT@LWR@hook@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@LWR@hook@keyfloatsminipage{\KFLT@rowboxwidth}% }% {% - \bigbreak% + \vskip\intextsep% \KFLT@LWR@hook@keyfloatsminipage{\linewidth}% }% + \normalcolor\reset@font\normalsize% \ifbool{KFLT@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@font\normalsize% + }% + {% not [H]: + \ifstrequal{#2}{M}% + {% [M]: + \KFLT@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@keyfloatdepth}}{1}} or bool {KFLT@inkeysubfloats} @@ -1001,13 +1028,26 @@ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or bool {KFLT@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@marginfloat% + }% + {% figure + \IfBooleanTF{#1}% starred figure? + {\end{figure*}}{\end{figure}}% + }% + }% }% not [H], etc. \addtocounter{KFLT@keyfloatdepth}{-1}% \KFLT@envignorespaces% @@ -1038,6 +1078,8 @@ \renewcommand{\KFLT@subgrptextalign}{}% } +\newbool{KFLT@subcaptionistop} + \NewDocumentCommand{\KFLT@subfloats}{m m m +m} {% \KFLT@envignorespaces% @@ -1051,19 +1093,37 @@ bool {KFLT@keywrap} }% {% - \bigbreak\noindent\begin{minipage}{\linewidth}% + \vskip\intextsep\noindent\begin{minipage}{\linewidth}% + \normalcolor\reset@font\normalsize% }% {% - \IfBooleanTF{#1}% - {\begin{\KFLT@subgrptype*}[#2]}% - {\begin{\KFLT@subgrptype}[#2]}% + \ifstrequal{#2}{W}% + {% [W] + \wrapfloat{\KFLT@subgrptype}{O}{.5\linewidth}% + \setlength{\KFLT@rowboxwidth}{.5\KFLT@rowboxwidth}% + \minipage{\linewidth}% + \normalcolor\reset@font\normalsize% + }% + {% not [H]: + \ifstrequal{#2}{M}% + {% [M]: + \KFLT@marginfloat{\KFLT@subgrptype}% + \setlength{\KFLT@rowboxwidth}{.9\marginparwidth/\real{#3}}% + }% [M] + {% subfloat + \IfBooleanTF{#1}% + {\begin{\KFLT@subgrptype*}[#2]}% + {\begin{\KFLT@subgrptype}[#2]}% + }% + }% not [H] }% \captionsetup*{type=\KFLT@subgrptype}% \ifbool{KFLT@subgrpcont}% {\ContinuedFloat}% {}% \center\unskip% - \caption@iftop{\KFLT@caption{subgrp}}{}% + \caption@iftop{\booltrue{KFLT@subcaptionistop}}{\boolfalse{KFLT@subcaptionistop}}% + \ifbool{KFLT@subcaptionistop}{\KFLT@caption{subgrp}}{}% \defcounter{KFLT@numcols}{#3}% \defcounter{KFLT@thiscol}{0}% \begingroup% @@ -1075,16 +1135,29 @@ \endcenter% \par\addvspace{\bigskipamount}% \KFLT@addartisttext{subgrp}% - \caption@iftop{}{\KFLT@caption{subgrp}}% + \ifbool{KFLT@subcaptionistop}{}{\KFLT@caption{subgrp}}% \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] + \endminipage% + \endwrapfloat% + }% + {% not [W]: + \ifstrequal{#2}{M}% + {% [M]: + \endKFLT@marginfloat% + }% [M] + {% subfloat + \IfBooleanTF{#1}% starred? + {\end{\KFLT@subgrptype*}}% + {\end{\KFLT@subgrptype}}% + }% + }% not [W] }% not [H] \setboolean{KFLT@inkeysubfloats}{false}% \KFLT@envignorespaces% @@ -1135,6 +1208,7 @@ \captionsetup{type=#2}% \hbox{}\vspace*{#1}% \noindent% + \normalcolor\reset@font\normalsize% }% start {% end \end{minipage}% @@ -1153,9 +1227,9 @@ \newlength{\KFLT@keywrapwidth} \newlength{\KFLT@keywrapparskip} \newlength{\KFLT@keywrapparindent} -\DeclareDocumentEnvironment{keywrap}{m +m} +\DeclareDocumentEnvironment{keywrap}{m +m}% {% - \par% + \par\noindent% \setlength{\KFLT@keywrapwidth}{\linewidth}% \addtolength{\KFLT@keywrapwidth}{-#1}% \addtolength{\KFLT@keywrapwidth}{-2em}% @@ -1171,6 +1245,7 @@ \hfill% \begin{minipage}[t]{#1}% \booltrue{KFLT@keywrap}% + \normalcolor\reset@font\normalsize% #2% \par% \unskip\vspace{\smallskipamount}% -- cgit v1.2.3