From 275ad8a0bdbe28776c421f0387b3e7de14abb488 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 9 Dec 2016 22:52:39 +0000 Subject: keyfloat (9dec16) git-svn-id: svn://tug.org/texlive/trunk@42662 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty | 111 +++++++++++++++++----- 1 file changed, 86 insertions(+), 25 deletions(-) (limited to 'Master/texmf-dist/tex/latex/keyfloat') diff --git a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty index 96f141782da..6a720f7672d 100644 --- a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty +++ b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty @@ -19,7 +19,8 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{keyfloat} - [2016/12/02 v0.11 Key/value interface for floats and the subcaption package.] + [2016/12/09 v0.12 Key/value interface for floats and the subcaption package.] + @@ -35,6 +36,8 @@ \RequirePackage{subcaption} \RequirePackage{calc} \RequirePackage{rotating} +\RequirePackage{placeins} +\RequirePackage{wrapfig} @@ -84,18 +87,14 @@ \newcommand*{\KFLT@as}{} \newcommand*{\KFLT@textalign}{} \newcommand{\KFLT@t}{} -\@ifpackageloaded{tocdata} -{} -{ -\newcommand{\tdtextjustify}{} -\newcommand{\tdtextcenter}{} -\newcommand{\tdtextleft}{} -\newcommand{\tdtextright}{} -\newcommand{\tdnamejustify}{} -\newcommand{\tdnamecenter}{} -\newcommand{\tdnameleft}{} -\newcommand{\tdnameright}{} -} +\providecommand{\tdtextjustify}{} +\providecommand{\tdtextcenter}{} +\providecommand{\tdtextleft}{} +\providecommand{\tdtextright}{} +\providecommand{\tdnamejustify}{} +\providecommand{\tdnamecenter}{} +\providecommand{\tdnameleft}{} +\providecommand{\tdnameright}{} \define@key{KFLT@keys}{t}{ \renewcommand{\KFLT@t}{#1} \renewcommand{\KFLT@textalign}{} @@ -142,6 +141,12 @@ \define@key{KFLT@keys}{stretch}{\renewcommand{\KFLT@stretch}{#1}} \newcommand*{\KFLT@stretch}{1} +\define@key{KFLT@keys}{mo}{\setlength{\KFLT@mo}{#1}} +\newlength{\KFLT@mo} + +\define@key{KFLT@keys}{wp}{\renewcommand{\KFLT@wp}{#1}} +\newcommand{\KFLT@wp}{O} + \newcounter{KFLT@keyfloatdepth} \setcounter{KFLT@keyfloatdepth}{0} @@ -310,8 +315,6 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \end{minipage}% \unskip% \end{turn}% -\par% -\addvspace{2ex}% } \newcommand*{\KFLT@captioniftype}[2]{% @@ -431,6 +434,8 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \setboolean{KFLT@f}{false}% \setboolean{KFLT@ft}{false}% \renewcommand{\KFLT@stretch}{1}% +\setlength{\KFLT@mo}{-1.2ex}% +\renewcommand{\KFLT@wp}{O}% } @@ -537,7 +542,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \endturn% \end{lrbox}% \KFLT@frame{\usebox{\KFLT@envbox}}% -\par\addvspace{\medskipamount}% +\par\addvspace{2ex}% }% endkeyboxinner \NewDocumentCommand{\KFLT@boxkeys}{+m m m} @@ -549,16 +554,30 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% } \NewDocumentEnvironment{KFLT@boxouter}{m m} -{% keyboxouter +{% boxouter \ifthenelse{\boolean{KFLT@inkeysubfloats}}% {\csname sub\KFLT@type\endcsname{\KFLT@rowboxwidth}}% subfloat {% not subfloat: \ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% {% keyfloats \minipage{\KFLT@rowboxwidth}% -\captionsetup{type=\KFLT@type}% +\captionsetup*{type=\KFLT@type}% }% keyfloats {% not keyfloats +\ifthenelse{\equal{#2}{W}}% +{% [W] +\KFLT@findwidths% +\csname wrap\KFLT@type\endcsname{\KFLT@wp}% +{\KFLT@imagewidth+2\KFLTlooseframewidth}% +\renewcommand{\KFLT@lw}{1}% +}% [W] +{% not [W] +\ifthenelse{\equal{#2}{M}}% +{% [M] +\csname margin\KFLT@type\endcsname[\KFLT@mo]% +\captionsetup{type=\KFLT@type}% +}% [M] +{% not [M} \ifthenelse{\equal{#2}{H}}% {% [H] \noindent\minipage{\linewidth}% @@ -568,6 +587,8 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \IfBooleanTF{#1}% {\csname \KFLT@type*\endcsname[#2]}{\csname \KFLT@type\endcsname[#2]}% }% not [H] +}% not [M] +}% not [W] }% not keyfloats }% not subfloat \ifthenelse{\boolean{KFLT@cont}}{\ContinuedFloat}{}% @@ -577,27 +598,39 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \unskip% \minipage{\linewidth}% \centering% -}% keyboxouter +}% boxouter {% endboxouter \endminipage% \end{center}% -\unskip\addvspace{\medskipamount}% +\unskip\addvspace{2ex}% \KFLT@addartisttext{}% \KFLT@captioniftype{figure}{}% \ifthenelse{\boolean{KFLT@inkeysubfloats}}% {\csname endsub\KFLT@type\endcsname}% subfloat {% not subfloat -\ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% keyfloat? +\ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% keyfloats? {\endminipage}% keyfloats {% not keyfloats +\ifthenelse{\equal{#2}{W}}% +{% [W] +\csname endwrap\KFLT@type\endcsname% +}% [W] +{% not[W] +\ifthenelse{\equal{#2}{M}}% +{% [M] +\csname endmargin\KFLT@type\endcsname% +}% [M] +{% not [M] \ifthenelse{\equal{#2}{H}}% {% \endminipage% [H] }% {% not [H] -\IfBooleanTF{#1}% starred table? +\IfBooleanTF{#1}% starred float? {\csname end\KFLT@type*\endcsname}{\csname end\KFLT@type\endcsname}% }% not [H] +}% not [M] +}% not [W] }% not keyfloats }% not subfloat }% endkeyboxouter @@ -624,9 +657,11 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \KFLT@trackrows% \KFLT@boxkeys{#3}{figure}{lof}% \renewcommand{\KFLT@i}{#4}% +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@onefigureimage% \endKFLT@boxouter% +\endgroup% } @@ -634,11 +669,13 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% {% \KFLT@trackrows% \KFLT@boxkeys{#3}{figure}{lof}% +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% #4% \endKFLT@boxinner% \endKFLT@boxouter% +\endgroup% } @@ -648,11 +685,13 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \KFLT@boxkeys{#3}{figure}{lof}% \renewcommand{\KFLT@c}{}% \setboolean{KFLT@cstar}{true}% +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% #4% \endKFLT@boxinner% \endKFLT@boxouter% +\endgroup% } @@ -660,12 +699,14 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% {% \KFLT@trackrows% \KFLT@boxkeys{#3}{table}{lot}% +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% \centering% #4% \endKFLT@boxinner% \endKFLT@boxouter% +\endgroup% } @@ -719,7 +760,7 @@ environment inside another, or inside a keyfloats.}% {\bigbreak% \noindent\begin{minipage}{\linewidth}}% \ifthenelse{\boolean{KFLT@inkeysubfloats}}% -{}{\captionsetup{type=figure}}% +{}{\captionsetup*{type=figure}}% }% [H] or nested {% figure \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format @@ -796,7 +837,7 @@ environment inside another, or inside a keyfloats.}% \IfBooleanTF{#1}% {\begin{\KFLT@type*}[#2]}{\begin{\KFLT@type}[#2]}% }% -\captionsetup{type=\KFLT@subgrptype}% +\captionsetup*{type=\KFLT@subgrptype}% \ifthenelse{\boolean{KFLT@subgrpcont}}{\ContinuedFloat}{}% \centering% \KFLT@captioniftype{table}{subgrp}% @@ -839,7 +880,27 @@ environment inside another, or inside a keyfloats.}% {% \KFLT@endsubfloats{#1}{#2}% } - +\newsavebox{\KFLT@marginfloatbox} + +\NewDocumentEnvironment{KFLT@marginfloat}{O{-1.2ex} m} +{% start +\FloatBarrier% keep floats in order +\begin{lrbox}{\KFLT@marginfloatbox}% +\begin{minipage}{\marginparwidth}% +\captionsetup{type=#2}% +\hbox{}\vspace*{#1}% +\noindent% +}% start +{\end{minipage}% +\end{lrbox}% +\marginpar{\usebox{\KFLT@marginfloatbox}}% +} +\ProvideDocumentEnvironment{marginfigure}{O{-1.2ex}} + {\begin{KFLT@marginfloat}[#1]{figure}} + {\end{KFLT@marginfloat}} +\ProvideDocumentEnvironment{margintable}{O{-1.2ex}} + {\begin{KFLT@marginfloat}[#1]{table}} + {\end{KFLT@marginfloat}} \endinput -- cgit v1.2.3