summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/keyfloat
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-12 23:07:32 +0000
committerKarl Berry <karl@freefriends.org>2019-01-12 23:07:32 +0000
commit22f798b763d55c24eab8107dc76d4f200ca3ccf3 (patch)
tree49a1ce05fe7908dd1408c287d6e1b524c5a26456 /Master/texmf-dist/tex/latex/keyfloat
parent4d0cb3164bdec74c01f560fe6fa184314ac063d7 (diff)
keyfloat (12jan19)
git-svn-id: svn://tug.org/texlive/trunk@49683 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/keyfloat')
-rw-r--r--Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty1256
1 files changed, 639 insertions, 617 deletions
diff --git a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
index b3a4d566d6c..4bc84196c9c 100644
--- a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
+++ b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
@@ -18,16 +18,13 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{keyfloat}
- [2017/05/12 v0.15 Key/value interface for floats and the subcaption package.]
+ [2019/01/11 v1.00 Key/value interface for floats and subfloats.]
\RequirePackage{etoolbox}[2011/01/03]%
-
\RequirePackage{xparse}
-
-\RequirePackage{xifthen}
\RequirePackage{xkeyval}
\RequirePackage{graphicx}
\RequirePackage{caption}[2010/10/31]% v3.2 to support \phantomcaption
@@ -39,10 +36,14 @@
\@ifpackageloaded{floatrow}
{
\PackageError{keyfloat}
-{The keyfloat conflicts with the floatrow package.
-Remove floatrow to use keyfloat.}
-{Keyfloat uses the caption and subcaption packages to
-provide similar functionality to floatrow.}
+{%
+ The keyfloat package conflicts with the floatrow package.
+ Remove floatrow to use keyfloat.%
+}
+{%
+ Keyfloat uses the caption and subcaption packages to
+ provide similar functionality to floatrow.%
+}
}
{}
@@ -72,13 +73,15 @@ provide similar functionality to floatrow.}
\define@key{KFLT@keys}{cont}[true]{\setboolean{KFLT@cont}{#1}}
\newcommand{\KFLT@c}{}
\newboolean{KFLT@cstar}
-\define@key{KFLT@keys}{c}%
-{\renewcommand{\KFLT@c}{#1}\setboolean{KFLT@cstar}{false}}
-\define@key{KFLT@keys}{cstar}%
-{\renewcommand{\KFLT@c}{#1}\setboolean{KFLT@cstar}{true}}
+\define@key{KFLT@keys}{c}{%
+ \renewcommand{\KFLT@c}{#1}\setboolean{KFLT@cstar}{false}%
+}
+\define@key{KFLT@keys}{cstar}{%
+ \renewcommand{\KFLT@c}{#1}\setboolean{KFLT@cstar}{true}%
+}
\define@key{KFLT@keys}{sc}{%
-\renewcommand{\KFLT@sc}{#1}%
-\setboolean{KFLT@scgiven}{true}%
+ \renewcommand{\KFLT@sc}{#1}%
+ \setboolean{KFLT@scgiven}{true}%
}
\newcommand{\KFLT@sc}{}
\newboolean{KFLT@scgiven}
@@ -104,35 +107,35 @@ provide similar functionality to floatrow.}
\providecommand{\tdnamecenter}{}
\providecommand{\tdnameleft}{}
\providecommand{\tdnameright}{}
-\define@key{KFLT@keys}{t}{
-\renewcommand{\KFLT@t}{#1}
-\renewcommand{\KFLT@textalign}{}
-\tdtextjustify
-}
-\define@key{KFLT@keys}{tc}{
-\renewcommand{\KFLT@t}{#1}
-\renewcommand{\KFLT@textalign}{\centering}
-\tdtextcenter
-}
-\define@key{KFLT@keys}{tr}{
-\renewcommand{\KFLT@t}{#1}
-\renewcommand{\KFLT@textalign}{\raggedleft}
-\tdtextright
-}
-\define@key{KFLT@keys}{tl}{
-\renewcommand{\KFLT@t}{#1}
-\renewcommand{\KFLT@textalign}{\raggedright}
-\tdtextleft
+\define@key{KFLT@keys}{t}{%
+ \renewcommand{\KFLT@t}{#1}%
+ \renewcommand{\KFLT@textalign}{}%
+ \tdtextjustify%
+}
+\define@key{KFLT@keys}{tc}{%
+ \renewcommand{\KFLT@t}{#1}%
+ \renewcommand{\KFLT@textalign}{\centering}%
+ \tdtextcenter%
+}
+\define@key{KFLT@keys}{tr}{%
+ \renewcommand{\KFLT@t}{#1}%
+ \renewcommand{\KFLT@textalign}{\raggedleft}%
+ \tdtextright%
+}
+\define@key{KFLT@keys}{tl}{%
+ \renewcommand{\KFLT@t}{#1}%
+ \renewcommand{\KFLT@textalign}{\raggedright}%
+ \tdtextleft%
}
\newcommand*{\KFLT@i}{}
\define@key{KFLT@keys}{lw}{%
-\renewcommand{\KFLT@lw}{#1}%
-\setlength{\KFLT@w}{0pt}%
+ \renewcommand{\KFLT@lw}{#1}%
+ \setlength{\KFLT@w}{0pt}%
}
\newcommand*{\KFLT@lw}{}
\define@key{KFLT@keys}{w}{%
-\setlength{\KFLT@w}{#1}%
-\renewcommand{\KFLT@lw}{}%
+ \setlength{\KFLT@w}{#1}%
+ \renewcommand{\KFLT@lw}{}%
}
\newlength{\KFLT@w}
\define@key{KFLT@keys}{h}{\setlength{\KFLT@h}{#1}}
@@ -169,19 +172,21 @@ provide similar functionality to floatrow.}
\newboolean{KFLT@subgrpcont}{}
\define@key{KFLT@subgrpkeys}{cont}[true]{%
-\setboolean{KFLT@subgrpcont}{#1}%
+ \setboolean{KFLT@subgrpcont}{#1}%
}
\newcommand{\KFLT@subgrpc}{}
\newboolean{KFLT@subgrpcstar}
-\define@key{KFLT@subgrpkeys}{c}
-{\renewcommand{\KFLT@subgrpc}{#1}\setboolean{KFLT@subgrpcstar}{false}}
-\define@key{KFLT@subgrpkeys}{cstar}
-{\renewcommand{\KFLT@subgrpc}{#1}\setboolean{KFLT@subgrpcstar}{true}}
+\define@key{KFLT@subgrpkeys}{c}{%
+ \renewcommand{\KFLT@subgrpc}{#1}\setboolean{KFLT@subgrpcstar}{false}%
+}
+\define@key{KFLT@subgrpkeys}{cstar}{%
+ \renewcommand{\KFLT@subgrpc}{#1}\setboolean{KFLT@subgrpcstar}{true}%
+}
\define@key{KFLT@subgrpkeys}{sc}{%
-\renewcommand{\KFLT@subgrpsc}{#1}%
-\setboolean{KFLT@subgrpscgiven}{true}%
+ \renewcommand{\KFLT@subgrpsc}{#1}%
+ \setboolean{KFLT@subgrpscgiven}{true}%
}
\newcommand{\KFLT@subgrpsc}{}
@@ -193,37 +198,37 @@ provide similar functionality to floatrow.}
\newcommand*{\KFLT@subgrplisttype}{}
\newcommand*{\KFLT@setsubgrpfigure}{%
-\renewcommand{\KFLT@subgrptype}{figure}%
-\renewcommand{\KFLT@subgrplisttype}{lof}%
+ \renewcommand{\KFLT@subgrptype}{figure}%
+ \renewcommand{\KFLT@subgrplisttype}{lof}%
}
\newcommand*{\KFLT@setsubgrptable}{%
-\renewcommand{\KFLT@subgrptype}{table}%
-\renewcommand{\KFLT@subgrplisttype}{lot}%
+ \renewcommand{\KFLT@subgrptype}{table}%
+ \renewcommand{\KFLT@subgrplisttype}{lot}%
}
\define@key{KFLT@subgrpkeys}{l}{\renewcommand{\KFLT@subgrpl}{#1}}
\newcommand*{\KFLT@subgrpl}{}
\newcommand*{\KFLT@subgrptextalign}{}
\newcommand{\KFLT@subgrpt}{}
-\define@key{KFLT@subgrpkeys}{t}{
-\renewcommand{\KFLT@subgrpt}{#1}
-\renewcommand{\KFLT@subgrptextalign}{}
-\tdtextjustify
-}
-\define@key{KFLT@subgrpkeys}{tc}{
-\renewcommand{\KFLT@subgrpt}{#1}
-\renewcommand{\KFLT@subgrptextalign}{\centering}
-\tdtextcenter
-}
-\define@key{KFLT@subgrpkeys}{tl}{
-\renewcommand{\KFLT@subgrpt}{#1}
-\renewcommand{\KFLT@subgrptextalign}{\raggedright}
-\tdtextleft
-}
-\define@key{KFLT@subgrpkeys}{tr}{
-\renewcommand{\KFLT@subgrpt}{#1}
-\renewcommand{\KFLT@subgrptextalign}{\raggedleft}
-\tdtextright
+\define@key{KFLT@subgrpkeys}{t}{%
+ \renewcommand{\KFLT@subgrpt}{#1}%
+ \renewcommand{\KFLT@subgrptextalign}{}%
+ \tdtextjustify%
+}
+\define@key{KFLT@subgrpkeys}{tc}{%
+ \renewcommand{\KFLT@subgrpt}{#1}%
+ \renewcommand{\KFLT@subgrptextalign}{\centering}%
+ \tdtextcenter%
+}
+\define@key{KFLT@subgrpkeys}{tl}{%
+ \renewcommand{\KFLT@subgrpt}{#1}%
+ \renewcommand{\KFLT@subgrptextalign}{\raggedright}%
+ \tdtextleft%
+}
+\define@key{KFLT@subgrpkeys}{tr}{%
+ \renewcommand{\KFLT@subgrpt}{#1}%
+ \renewcommand{\KFLT@subgrptextalign}{\raggedleft}%
+ \tdtextright%
}
\define@key{KFLT@subgrpkeys}{ap}{\renewcommand{\KFLT@subgrpap}{#1}}
\newcommand*{\KFLT@subgrpap}{}
@@ -233,312 +238,308 @@ provide similar functionality to floatrow.}
\newcommand*{\KFLT@subgrpal}{}
\define@key{KFLT@subgrpkeys}{as}{\renewcommand{\KFLT@subgrpas}{#1}}
\newcommand*{\KFLT@subgrpas}{}
-%%
\newlength{\KFLT@imagewidth}
\newlength{\KFLT@boxwidth}
\newcommand*{\KFLT@findwidths}{%
-\ifthenelse{\boolean{KFLT@ft}}% tight frame?
-{\setlength{\KFLT@boxwidth}{\linewidth - 2\KFLTtightframewidth}}%
-{% not tight frame
-\ifthenelse{\boolean{KFLT@f}}% loose frame?
-{\setlength{\KFLT@boxwidth}{\linewidth - 2\KFLTlooseframewidth}}%
-{\setlength{\KFLT@boxwidth}{\linewidth}}% no frame
-}% not tight frame
-\ifthenelse{\dimtest{\KFLT@w}{>}{0pt}}%
-{\setlength{\KFLT@imagewidth}{\KFLT@w}}%
-{% width not given
-\ifcsempty{\KFLT@lw}%
-{\setlength{\KFLT@imagewidth}{\KFLT@boxwidth}}%
-{\setlength{\KFLT@imagewidth}{\KFLT@lw\KFLT@boxwidth}}%
-}% width not given
+ \ifbool{KFLT@ft}% tight frame?
+ {\setlength{\KFLT@boxwidth}{\linewidth - 2\KFLTtightframewidth}}%
+ {% not tight frame
+ \ifbool{KFLT@f}% loose frame?
+ {\setlength{\KFLT@boxwidth}{\linewidth - 2\KFLTlooseframewidth}}%
+ {\setlength{\KFLT@boxwidth}{\linewidth}}% no frame
+ }% not tight frame
+ \ifdimgreater{\KFLT@w}{0pt}%
+ {\setlength{\KFLT@imagewidth}{\KFLT@w}}%
+ {% width not given
+ \ifcsempty{\KFLT@lw}%
+ {\setlength{\KFLT@imagewidth}{\KFLT@boxwidth}}%
+ {\setlength{\KFLT@imagewidth}{\KFLT@lw\KFLT@boxwidth}}%
+ }% width not given
}
\newcommand{\KFLTtightframe}[1]{%
-\setlength{\fboxsep}{0pt}%
-\setlength{\fboxrule}{.4pt}%
-\fbox{#1}%
+ \setlength{\fboxsep}{0pt}%
+ \setlength{\fboxrule}{.4pt}%
+ \fbox{#1}%
}
\newlength{\KFLTtightframewidth}
\setlength{\KFLTtightframewidth}{.4pt}
\newcommand{\KFLTlooseframe}[1]{%
-\setlength{\fboxsep}{3pt}%
-\setlength{\fboxrule}{.4pt}%
-\fbox{#1}%
+ \setlength{\fboxsep}{3pt}%
+ \setlength{\fboxrule}{.4pt}%
+ \fbox{#1}%
}
\newlength{\KFLTlooseframewidth}
\setlength{\KFLTlooseframewidth}{3.4pt}
\newcommand{\KFLT@frame}[1]
{%
-\ifthenelse{\boolean{KFLT@ft}}%
-{\KFLTtightframe{#1}}%
-{% not tightframe
-\ifthenelse{\boolean{KFLT@f}}%
-{\KFLTlooseframe{#1}}%
-{#1}% no frame
-}% not looseframe
+ \ifbool{KFLT@ft}%
+ {\KFLTtightframe{#1}}%
+ {% not tightframe
+ \ifbool{KFLT@f}%
+ {\KFLTlooseframe{#1}}%
+ {#1}% no frame
+ }% not looseframe
}
\newcommand{\KFLT@findenvboxwidth}{%
-\settowidth{\KFLTimageboxwidth}{\usebox{\KFLT@envbox}}%
-\ifthenelse{\boolean{KFLT@ft}}%
-{\addtolength{\KFLTimageboxwidth}{2\KFLTtightframewidth}}%
-{% not tightframe
-\ifthenelse{\boolean{KFLT@f}}%
-{\addtolength{\KFLTimageboxwidth}{2\KFLTlooseframewidth}}%
-{}% no frame
-}% not looseframe
+ \settowidth{\KFLTimageboxwidth}{\usebox{\KFLT@envbox}}%
+ \ifbool{KFLT@ft}%
+ {\addtolength{\KFLTimageboxwidth}{2\KFLTtightframewidth}}%
+ {% not tightframe
+ \ifbool{KFLT@f}%
+ {\addtolength{\KFLTimageboxwidth}{2\KFLTlooseframewidth}}%
+ {}% no frame
+ }% not looseframe
}
\NewDocumentCommand{\KFLT@onefigureimage}{}
{%
-\begin{lrbox}{\KFLT@envbox}%
-\ifthenelse{\NOT\equal{\KFLT@lw}{}}%
-{\includegraphics%
-[scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}}%
-{% not linewidth
-\ifthenelse{\dimtest{\KFLT@w}{>}{0pt}}%
-{% width is given
-\ifthenelse{\dimtest{\KFLT@h}{>}{0pt}}%
-{% w and h
-\includegraphics%
-[scale=\KFLT@s,%
-width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
-}% w and h
-{% only w
-\includegraphics%
-[scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}%
-}% only w
-}% width is given
-{% width is not given
-\ifthenelse{\dimtest{\KFLT@h}{>}{0pt}}%
-{\includegraphics%
-[scale=\KFLT@s,height=\KFLT@h]{\KFLT@i}}%
-{\includegraphics%
-[scale=\KFLT@s]{\KFLT@i}}%
-}% width is not given
-}% not linewidth
-\end{lrbox}%
-\unskip%
-\KFLT@findenvboxwidth%
-\begin{turn}{\KFLT@r}%
-\KFLT@frame{\usebox{\KFLT@envbox}}%
-\unskip%
-\end{turn}%
+ \begin{lrbox}{\KFLT@envbox}%
+ \ifdefempty{\KFLT@lw}%
+ {% not linewidth
+ \ifdimgreater{\KFLT@w}{0pt}%
+ {% width is given
+ \ifdimgreater{\KFLT@h}{0pt}%
+ {% w and h
+ \includegraphics%
+ [scale=\KFLT@s,%
+ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
+ }% w and h
+ {% only w
+ \includegraphics%
+ [scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}%
+ }% only w
+ }% width is given
+ {% width is not given
+ \ifdimgreater{\KFLT@h}{0pt}%
+ {\includegraphics[scale=\KFLT@s,height=\KFLT@h]{\KFLT@i}}%
+ {\includegraphics[scale=\KFLT@s]{\KFLT@i}}%
+ }% width is not given
+ }% not linewidth
+ {% linewidth given
+ \includegraphics[scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}%
+ }%
+ \end{lrbox}%
+ \unskip%
+ \KFLT@findenvboxwidth%
+ \begin{turn}{\KFLT@r}%
+ \KFLT@frame{\usebox{\KFLT@envbox}}%
+ \unskip%
+ \end{turn}%
}
\newcommand*{\KFLT@captioniftype}[2]{%
-\ifthenelse{\equal{\csname KFLT@#2type\endcsname}{#1}}%
-{\KFLT@caption{#2}}%
-{}%
+ \ifcsstring{KFLT@#2type}{#1}%
+ {\KFLT@caption{#2}}%
+ {}%
}
\NewDocumentCommand{\KFLT@dosimplecaption}{m m m}
{%
-\unskip%
-\IfBooleanTF{#1}% star?
-{% star
-\IfValueTF{#2}{\caption*[#2]{#3}}{\caption*{#3}}%
-}% star
-{% no star
-\IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}%
-}% no star
+ \unskip%
+ \IfBooleanTF{#1}% star?
+ {\IfValueTF{#2}{\caption*[#2]{#3}}{\caption*{#3}}}%
+ {\IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}}%
}
\@ifpackageloaded{tocdata}
{% tocdata loaded
\NewDocumentCommand{\KFLT@docaption}{s o m m}
{%
-\ifthenelse{\equal{\csname KFLT@#4type\endcsname}{figure}}%
-{% figure
-\ifcsempty{KFLT@#4al}%
-{% figure w/o artist
-\KFLT@dosimplecaption{#1}{#2}{#3}%
-}% figure w/o artist
-{% figure with an artist
-\IfBooleanTF{#1}{% star
-\captionartist*[#2]{#3}%
-[\csname KFLT@#4t\endcsname]%
-[\csname KFLT@#4ap\endcsname]%
-{\csname KFLT@#4af\endcsname}%
-{\csname KFLT@#4al\endcsname}%
-[\csname KFLT@#4as\endcsname]%
-}% star
-{% no star
-\captionartist[#2]{#3}%
-[\csname KFLT@#4t\endcsname]%
-[\csname KFLT@#4ap\endcsname]%
-{\csname KFLT@#4af\endcsname}%
-{\csname KFLT@#4al\endcsname}%
-[\csname KFLT@#4as\endcsname]%
-}% no star
-}% figure with an artist
-}% figure
-{% not a figure, ignore artist information:
-\KFLT@dosimplecaption{#1}{#2}{#3}%
-}% not a figure
+ \ifcsstring{KFLT@#4type}{figure}%
+ {% figure
+ \ifcsempty{KFLT@#4al}%
+ {% figure w/o artist
+ \KFLT@dosimplecaption{#1}{#2}{#3}%
+ }% figure w/o artist
+ {% figure with an artist
+ \IfBooleanTF{#1}{% star
+ \captionartist*[#2]{#3}%
+ [\csname KFLT@#4t\endcsname]%
+ [\csname KFLT@#4ap\endcsname]%
+ {\csname KFLT@#4af\endcsname}%
+ {\csname KFLT@#4al\endcsname}%
+ [\csname KFLT@#4as\endcsname]%
+ }% star
+ {% no star
+ \captionartist[#2]{#3}%
+ [\csname KFLT@#4t\endcsname]%
+ [\csname KFLT@#4ap\endcsname]%
+ {\csname KFLT@#4af\endcsname}%
+ {\csname KFLT@#4al\endcsname}%
+ [\csname KFLT@#4as\endcsname]%
+ }% no star
+ }% figure with an artist
+ }% figure
+ {% not a figure, ignore artist information:
+ \KFLT@dosimplecaption{#1}{#2}{#3}%
+ }% not a figure
}% KFLT@tocdata
}% tocdata loaded
{% no tocdata
\NewDocumentCommand{\KFLT@docaption}{s o m m}
{%
-\KFLT@dosimplecaption{#1}{#2}{#3}%
-\ifcsempty{KFLT@#4al}%
-{}% no artist
-{% yes artist
-\ifcsempty{KFLT@#4af}%
-{\index{\csname KFLT@#4al\endcsname}}%
-{\index{\csname KFLT@#4al\endcsname, \csname KFLT@#4af\endcsname}}%
-}% yes artist
+ \KFLT@dosimplecaption{#1}{#2}{#3}%
+ \ifcsempty{KFLT@#4al}%
+ {}% no artist
+ {% yes artist
+ \ifcsempty{KFLT@#4af}%
+ {\index{\csname KFLT@#4al\endcsname}}%
+ {\index{\csname KFLT@#4al\endcsname, \csname KFLT@#4af\endcsname}}%
+ }% yes artist
}% KFLT@docaption
}% no tocdata
\newcommand{\KFLT@caption}[1]{%
-\ifthenelse{\boolean{KFLT@#1cstar}}% starred caption?
-{%starred caption
-\ifcsempty{KFLT@#1c}% cstar={}?
-{}%
-{% non-empty starred caption
-\ifcsempty{KFLT@#1sc}%
-{}%
-{% non-empty cstar and sc:
-\addcontentsline{\KFLT@listtype}%
-{\csname KFLT@#1type\endcsname}{\KFLT@sc}%
-}% non-empty cstar and sc
-\KFLT@docaption*{\csname KFLT@#1c\endcsname}{#1}%
-}%
-}% starred caption
-{% unstarred caption
-\ifcsempty{KFLT@#1sc}%
-{% no short cap
-\KFLT@docaption{\csname KFLT@#1c\endcsname}{#1}%
-}% no short cap
-{% short cap
-\KFLT@docaption[\csname KFLT@#1sc\endcsname]%
-{\csname KFLT@#1c\endcsname}{#1}%
-}% short cap
-\ifcsempty{KFLT@#1l}%
-{}%
-{\label{\csname KFLT@#1l\endcsname}}%
-}% unstarred caption
+ \ifbool{KFLT@#1cstar}% starred caption?
+ {%starred caption
+ \ifcsempty{KFLT@#1c}% cstar={}?
+ {}%
+ {% non-empty starred caption
+ \ifcsempty{KFLT@#1sc}%
+ {}%
+ {% non-empty cstar and sc:
+ \addcontentsline{\KFLT@listtype}%
+ {\csname KFLT@#1type\endcsname}{\KFLT@sc}%
+ }% non-empty cstar and sc
+ \KFLT@docaption*{\csname KFLT@#1c\endcsname}{#1}%
+ }%
+ }% starred caption
+ {% unstarred caption
+ \ifcsempty{KFLT@#1sc}%
+ {% no short cap
+ \KFLT@docaption{\csname KFLT@#1c\endcsname}{#1}%
+ }% no short cap
+ {% short cap
+ \KFLT@docaption[\csname KFLT@#1sc\endcsname]%
+ {\csname KFLT@#1c\endcsname}{#1}%
+ }% short cap
+ \ifcsempty{KFLT@#1l}%
+ {}%
+ {\label{\csname KFLT@#1l\endcsname}}%
+ }% unstarred caption
}
\newcommand*{\KFLT@defaults}{%
-\setboolean{KFLT@cont}{false}%
-\renewcommand{\KFLT@c}{}%
-\setboolean{KFLT@cstar}{false}%
-\renewcommand{\KFLT@sc}{}%
-\setboolean{KFLT@scgiven}{false}%
-\renewcommand{\KFLT@type}{figure}%
-\renewcommand{\KFLT@listtype}{lof}%
-\renewcommand{\KFLT@l}{}%
-\renewcommand{\KFLT@ap}{}%
-\renewcommand{\KFLT@af}{}%
-\renewcommand{\KFLT@al}{}%
-\renewcommand{\KFLT@as}{}%
-\renewcommand{\KFLT@t}{}%
-\renewcommand{\KFLT@textalign}{}%
-\tdtextjustify%
-\renewcommand{\KFLT@i}{}%
-\renewcommand{\KFLT@lw}{}%
-\setlength{\KFLT@w}{0pt}%
-\setlength{\KFLT@h}{0pt}%
-\renewcommand{\KFLT@s}{1}%
-\renewcommand{\KFLT@r}{0}%
-\setboolean{KFLT@f}{false}%
-\setboolean{KFLT@ft}{false}%
-\renewcommand{\KFLT@stretch}{1}%
-\setlength{\KFLT@mo}{-1.2ex}%
-\renewcommand{\KFLT@wp}{O}%
-\renewcommand{\KFLT@va}{c}%
+ \setboolean{KFLT@cont}{false}%
+ \renewcommand{\KFLT@c}{}%
+ \setboolean{KFLT@cstar}{false}%
+ \renewcommand{\KFLT@sc}{}%
+ \setboolean{KFLT@scgiven}{false}%
+ \renewcommand{\KFLT@type}{figure}%
+ \renewcommand{\KFLT@listtype}{lof}%
+ \renewcommand{\KFLT@l}{}%
+ \renewcommand{\KFLT@ap}{}%
+ \renewcommand{\KFLT@af}{}%
+ \renewcommand{\KFLT@al}{}%
+ \renewcommand{\KFLT@as}{}%
+ \renewcommand{\KFLT@t}{}%
+ \renewcommand{\KFLT@textalign}{}%
+ \tdtextjustify%
+ \renewcommand{\KFLT@i}{}%
+ \renewcommand{\KFLT@lw}{}%
+ \setlength{\KFLT@w}{0pt}%
+ \setlength{\KFLT@h}{0pt}%
+ \renewcommand{\KFLT@s}{1}%
+ \renewcommand{\KFLT@r}{0}%
+ \setboolean{KFLT@f}{false}%
+ \setboolean{KFLT@ft}{false}%
+ \renewcommand{\KFLT@stretch}{1}%
+ \setlength{\KFLT@mo}{-1.2ex}%
+ \renewcommand{\KFLT@wp}{O}%
+ \renewcommand{\KFLT@va}{c}%
}
\newcommand*{\KFLT@maybestartfloatrow}{%
-\KFLT@maybeendfloatrow%
-\defcounter{KFLT@thiscol}{\value{KFLT@thiscol}+1}%
+ \KFLT@maybeendfloatrow%
+ \defcounter{KFLT@thiscol}{\value{KFLT@thiscol}+1}%
}
\newcommand*{\KFLT@maybeendfloatrow}{%
-\ifthenelse{\cnttest{\value{KFLT@thiscol}}{>=}{\value{KFLT@numcols}}}%
-{%
+ \ifnumless{\value{KFLT@thiscol}}{\value{KFLT@numcols}}%
+ {}% thiscol < numcols
+ {% >=
-\addvspace{.75\floatsep}%
+ \addvspace{.75\floatsep}
-\defcounter{KFLT@thiscol}{0}%
-}{}%
+ \defcounter{KFLT@thiscol}{0}%
+ }%
}%
\newcommand{\KFLT@trackrows}
{%
-\ifthenelse{%
-\cnttest{\value{KFLT@keyfloatdepth}}>{0}%
-\OR\boolean{KFLT@inkeysubfloats}%
-}%
-{% nested
-\KFLT@maybestartfloatrow%
-\ifthenelse{\cnttest{\value{KFLT@thiscol}}{>}{1}}%
-{\hfill}{}%
-}% nested
-{}% not nested
+ \ifboolexpr{%
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or
+ bool{KFLT@inkeysubfloats}%
+ }%
+ {% nested
+ \KFLT@maybestartfloatrow%
+ \ifnumgreater{\value{KFLT@thiscol}}{1}%
+ {\hfill}%
+ {}%
+ }% nested
+ {}% not nested
}
\newcommand{\KFLT@addtext}[1]
{%
-\ifcsempty{KFLT@#1t}%
-{}% no text
-{% text to add
-{% local
-\unskip%
-\addvspace{2ex}%
-\begin{minipage}{\linewidth}%
-\csname KFLT@#1textalign\endcsname%
-\footnotesize%
-\setlength{\parskip}{1.5ex}%
-\setlength{\parindent}{0em}%
-\csname KFLT@#1t\endcsname%
-\end{minipage}%
-\par\addvspace{2ex}%
-}% local
-}% text to add
+ \ifcsempty{KFLT@#1t}%
+ {}% no text
+ {% text to add
+ {% local
+ \unskip%
+ \addvspace{2ex}%
+ \begin{minipage}{\linewidth}%
+ \csname KFLT@#1textalign\endcsname%
+ \footnotesize%
+ \setlength{\parskip}{1.5ex}%
+ \setlength{\parindent}{0em}%
+ \csname KFLT@#1t\endcsname%
+ \end{minipage}%
+ \par\addvspace{2ex}%
+ }% local
+ }% text to add
}
\newcommand{\KFLT@optionalname}[1]
{%
-\ifthenelse{\equal{#1}{}}%
-{}%
-{#1~}%
+ \ifblank{#1}%
+ {}%
+ {#1~}%
}
\@ifpackageloaded{tocdata}
{% tocdata loaded
\newcommand{\KFLT@addartisttext}[1]
{%
-\ifthenelse{\equal{\csname KFLT@#1type\endcsname}{figure}}%
-{% figure
-\ifcsempty{KFLT@#1al}%
-{\KFLT@addtext{#1}}%
-{}% fig w/ artist: text will be added by \captionartist in \KFLT@caption
-}% figure
-{\KFLT@addtext{#1}}%
+ \ifcsstring{KFLT@#1type}{figure}%
+ {% figure
+ \ifcsempty{KFLT@#1al}%
+ {\KFLT@addtext{#1}}%
+ {}% fig w/ artist: text will be added by \captionartist in \KFLT@caption
+ }% figure
+ {\KFLT@addtext{#1}}%
}% KFLT@addartisttext
}% tocdata loaded
{% tocdata not loaded
\newcommand{\KFLT@addartisttext}[1]
{%
-\ifcsempty{KFLT@#1al}%
-{}% last name not given
-{% last name given
-\addvspace{2ex}%
-\begin{minipage}{\linewidth}%
-\centering\footnotesize\textsc{%
-\KFLT@optionalname{\csname KFLT@#1ap\endcsname}%
-\KFLT@optionalname{\csname KFLT@#1af\endcsname}%
-\csname KFLT@#1al\endcsname\csname KFLT@#1as\endcsname%
-}%
-\end{minipage}%
-\par\addvspace{2ex}%
-}% last name given
-\KFLT@addtext{#1}%
+ \ifcsempty{KFLT@#1al}%
+ {}% last name not given
+ {% last name given
+ \addvspace{2ex}%
+ \begin{minipage}{\linewidth}%
+ \centering\footnotesize\textsc{%
+ \KFLT@optionalname{\csname KFLT@#1ap\endcsname}%
+ \KFLT@optionalname{\csname KFLT@#1af\endcsname}%
+ \csname KFLT@#1al\endcsname\csname KFLT@#1as\endcsname%
+ }%
+ \end{minipage}%
+ \par\addvspace{2ex}%
+ }% last name given
+ \KFLT@addtext{#1}%
}% KFLT@addartisttext
}% tocdata not loaded
@@ -548,398 +549,418 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}%
\NewDocumentEnvironment{KFLT@boxinner}{}
{% keyboxinner
-\begin{lrbox}{\KFLT@envbox}%
-\turn{\KFLT@r}%
-\minipage{\KFLT@imagewidth}%
-\setlength{\parskip}{2ex}%
-\renewcommand{\arraystretch}{\KFLT@stretch}%
+ \begin{lrbox}{\KFLT@envbox}%
+ \turn{\KFLT@r}%
+ \minipage{\KFLT@imagewidth}%
+ \setlength{\parskip}{2ex}%
+ \renewcommand{\arraystretch}{\KFLT@stretch}%
}% keyboxinner
{% endkeyboxinner
-\endminipage%
-\endturn%
-\end{lrbox}%
-\KFLT@frame{\usebox{\KFLT@envbox}}%
-\par\addvspace{2ex}%
+ \endminipage%
+ \endturn%
+ \end{lrbox}%
+ \KFLT@frame{\usebox{\KFLT@envbox}}%
+ \par\addvspace{2ex}%
}% endkeyboxinner
\NewDocumentCommand{\KFLT@boxkeys}{+m m m}
{%
-\KFLT@defaults%
-\renewcommand{\KFLT@type}{#2}%
-\renewcommand{\KFLT@listtype}{#3}%
-\setkeys{KFLT@keys}{#1}%
+ \KFLT@defaults%
+ \renewcommand{\KFLT@type}{#2}%
+ \renewcommand{\KFLT@listtype}{#3}%
+ \setkeys{KFLT@keys}{#1}%
}
\NewDocumentEnvironment{KFLT@boxouter}{m m}
{% boxouter
-\ifthenelse{\boolean{KFLT@inkeysubfloats}}%
-{\csname sub\KFLT@type\endcsname{\KFLT@rowboxwidth}}% subfloat
-{% not subfloat:
-\ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}%
-{% keyfloats
-\ifbool{KFLT@keywrap}
-{\minipage[t]{\KFLT@rowboxwidth}}%
-{\minipage[\KFLT@va]{\KFLT@rowboxwidth}}%
-\captionsetup*{type=\KFLT@type}%
-}% keyfloats
-{% not keyfloats
-\ifbool{KFLT@keywrap}%
-{%
-\par\addvspace{\baselineskip}%
-\noindent\minipage[t]{\linewidth}%
-\captionsetup{type=\KFLT@type}%
-}%
-{% not a keywrap
-\ifthenelse{\equal{#2}{W}}%
-{% [W]
-\KFLT@findwidths%
-\csname wrap\KFLT@type\endcsname{\KFLT@wp}%
-{\KFLT@imagewidth+2\KFLTlooseframewidth}%
-\renewcommand{\KFLT@lw}{}%
-\renewcommand{\KFLT@w}{\KFLT@imagewidth}%
-}% [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]
-\par\addvspace{\baselineskip}%
-\noindent\minipage[\KFLT@va]{\linewidth}%
-\captionsetup{type=\KFLT@type}%
-}% [H]
-{% not [H]
-\IfBooleanTF{#1}%
-{\csname \KFLT@type*\endcsname[#2]}{\csname \KFLT@type\endcsname[#2]}%
-}% not [H]
-}% not [M]
-}% not [W]
-}% not keywrap
-}% not keyfloats
-}% not subfloat
-\ifthenelse{\boolean{KFLT@cont}}{\ContinuedFloat}{}%
-\KFLT@findwidths%
-\KFLT@captioniftype{table}{}%
-\center\unskip%
+ \ifbool{KFLT@inkeysubfloats}%
+ {\csname sub\KFLT@type\endcsname{\KFLT@rowboxwidth}}% subfloat
+ {% not subfloat:
+ \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}%
+ {% keyfloats
+ \ifbool{KFLT@keywrap}%
+ {\minipage[t]{\KFLT@rowboxwidth}}%
+ {\minipage[\KFLT@va]{\KFLT@rowboxwidth}}%
+ \captionsetup*{type=\KFLT@type}%
+ }% keyfloats
+ {% not keyfloats
+ \ifbool{KFLT@keywrap}%
+ {%
+ \par\addvspace{\baselineskip}%
+ \noindent\minipage[t]{\linewidth}%
+ \captionsetup{type=\KFLT@type}%
+ }%
+ {% not a keywrap
+ \ifstrequal{#2}{W}%
+ {% [W]
+ \KFLT@findwidths%
+ \csname wrap\KFLT@type\endcsname{\KFLT@wp}%
+ {\KFLT@imagewidth+2\KFLTlooseframewidth}%
+ \renewcommand{\KFLT@lw}{}%
+ \renewcommand{\KFLT@w}{\KFLT@imagewidth}%
+ }% [W]
+ {% not [W]
+ \ifstrequal{#2}{M}%
+ {% [M]
+ \csname margin\KFLT@type\endcsname[\KFLT@mo]%
+ \captionsetup{type=\KFLT@type}%
+ }% [M]
+ {% not [M}
+ \ifstrequal{#2}{H}%
+ {% [H]
+ \par\addvspace{\baselineskip}%
+ \noindent\minipage[\KFLT@va]{\linewidth}%
+ \captionsetup{type=\KFLT@type}%
+ }% [H]
+ {% not [H]
+ \IfBooleanTF{#1}%
+ {\csname \KFLT@type*\endcsname[#2]}%
+ {\csname \KFLT@type\endcsname[#2]}%
+ }% not [H]
+ }% not [M]
+ }% not [W]
+ }% not keywrap
+ }% not keyfloats
+ }% not subfloat
+ \ifbool{KFLT@cont}{\ContinuedFloat}{}%
+ \KFLT@findwidths%
+ \KFLT@captioniftype{table}{}%
+ \center\unskip%
}% boxouter
{% endboxouter
-\endcenter\unskip%
-\KFLT@addartisttext{}%
-\KFLT@captioniftype{figure}{}%
-\ifthenelse{\boolean{KFLT@inkeysubfloats}}%
-{
-\csname endsub\KFLT@type\endcsname
-}% subfloat
-{% not subfloat
-\ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% keyfloats?
-{\endminipage}% keyfloats
-{% not keyfloats
-\ifbool{KFLT@keywrap}{%
-\endminipage%
-\par\addvspace{\baselineskip}%
-}
-{% not keywrap
-\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]
-\par\addvspace{\baselineskip}%
-}%
-{% not [H]
-\IfBooleanTF{#1}% starred float?
-{\csname end\KFLT@type*\endcsname}{\csname end\KFLT@type\endcsname}%
-}% not [H]
-}% not [M]
-}% not [W]
-}% not keywrap
-}% not keyfloats
-}% not subfloat
+ \endcenter\unskip%
+ \KFLT@addartisttext{}%
+ \KFLT@captioniftype{figure}{}%
+ \ifbool{KFLT@inkeysubfloats}%
+ {%
+ \csname endsub\KFLT@type\endcsname%
+ }% subfloat
+ {% not subfloat
+ \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% keyfloats?
+ {\endminipage}% keyfloats
+ {% not keyfloats
+ \ifbool{KFLT@keywrap}{%
+ \endminipage%
+ \par\addvspace{\baselineskip}%
+ }%
+ {% not keywrap
+ \ifstrequal{#2}{W}%
+ {% [W]
+ \csname endwrap\KFLT@type\endcsname%
+ }% [W]
+ {% not[W]
+ \ifstrequal{#2}{M}%
+ {% [M]
+ \csname endmargin\KFLT@type\endcsname%
+ }% [M]
+ {% not [M]
+ \ifstrequal{#2}{H}%
+ {%
+ \endminipage% [H]
+ \par\addvspace{\baselineskip}%
+ }%
+ {% not [H]
+ \IfBooleanTF{#1}% starred float?
+ {\csname end\KFLT@type*\endcsname}%
+ {\csname end\KFLT@type\endcsname}%
+ }% not [H]
+ }% not [M]
+ }% not [W]
+ }% not keywrap
+ }% not keyfloats
+ }% not subfloat
}% endkeyboxouter
\NewDocumentEnvironment{keyfigure}{s O{tbp} +m}
{%
-\KFLT@boxkeys{#3}{figure}{lof}%
-\KFLT@boxouter{#1}{#2}%
-\KFLT@boxinner%
+ \KFLT@boxkeys{#3}{figure}{lof}%
+ \KFLT@boxouter{#1}{#2}%
+ \KFLT@boxinner%
}%
{%
-\endKFLT@boxinner%
-\endKFLT@boxouter%
+ \endKFLT@boxinner%
+ \endKFLT@boxouter%
}
\BeforeBeginEnvironment{keyfigure}{%
-\KFLT@trackrows%
+ \KFLT@trackrows%
}
\NewDocumentCommand{\keyfig}{s O{tbp} +m m}
{%
-\KFLT@trackrows%
-\KFLT@boxkeys{#3}{figure}{lof}%
-\renewcommand{\KFLT@i}{#4}%
-\begingroup%
-\KFLT@boxouter{#1}{#2}%
-\KFLT@onefigureimage%
-\endKFLT@boxouter%
-\endgroup%
+ \KFLT@trackrows%
+ \KFLT@boxkeys{#3}{figure}{lof}%
+ \renewcommand{\KFLT@i}{#4}%
+ \begingroup%
+ \KFLT@boxouter{#1}{#2}%
+ \KFLT@onefigureimage%
+ \endKFLT@boxouter%
+ \endgroup%
}
\NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m}
{%
-\KFLT@trackrows%
-\KFLT@boxkeys{#3}{figure}{lof}%
-\begingroup%
-\KFLT@boxouter{#1}{#2}%
-\KFLT@boxinner%
-#4%
-\endKFLT@boxinner%
-\endKFLT@boxouter%
-\endgroup%
+ \KFLT@trackrows%
+ \KFLT@boxkeys{#3}{figure}{lof}%
+ \begingroup%
+ \KFLT@boxouter{#1}{#2}%
+ \KFLT@boxinner%
+ #4%
+ \endKFLT@boxinner%
+ \endKFLT@boxouter%
+ \endgroup%
}
\NewDocumentCommand{\keyparbox}{s O{tbp} +m +m}
{%
-\KFLT@trackrows%
-\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%
+ \KFLT@trackrows%
+ \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%
}
\NewDocumentCommand{\keytab}{s O{tbp} +m +m}
{%
-\KFLT@trackrows%
-\KFLT@boxkeys{#3}{table}{lot}%
-\begingroup%
-\KFLT@boxouter{#1}{#2}%
-\KFLT@boxinner%
-\centering%
-#4%
-\endKFLT@boxinner%
-\endKFLT@boxouter%
-\endgroup%
+ \KFLT@trackrows%
+ \KFLT@boxkeys{#3}{table}{lot}%
+ \begingroup%
+ \KFLT@boxouter{#1}{#2}%
+ \KFLT@boxinner%
+ \centering%
+ #4%
+ \endKFLT@boxinner%
+ \endKFLT@boxouter%
+ \endgroup%
}
\NewDocumentEnvironment{keytable}{s O{tbp} +m}
{%
-\KFLT@boxkeys{#3}{table}{lot}%
-\KFLT@boxouter{#1}{#2}%
-\KFLT@boxinner%
-\centering%
+ \KFLT@boxkeys{#3}{table}{lot}%
+ \KFLT@boxouter{#1}{#2}%
+ \KFLT@boxinner%
+ \centering%
}%
{%
-\endKFLT@boxinner%
-\endKFLT@boxouter%
+ \endKFLT@boxinner%
+ \endKFLT@boxouter%
}
\BeforeBeginEnvironment{keytable}{%
-\KFLT@trackrows%
+ \KFLT@trackrows%
}
\newcommand*{\KFLT@nonest}{%
-\ifthenelse{%
-\cnttest{\value{KFLT@keyfloatdepth}}>{0}%
-\OR\boolean{KFLT@inkeysubfloats}%
-}%
-{%
-\PackageError{keyfloat}{Cannot nest keysubfigs or keysubtabs.%
-(Not in outer par mode.)}%
-{The subcaption package do not support nested environments, so%
-the keyfloat package cannot place a keysubfigs or keysubtabs%
-environment inside another, or inside a keyfloats.}%
-}%
-{}%
+ \ifboolexpr{%
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or
+ bool {KFLT@inkeysubfloats}%
+ }%
+ {%
+ \PackageError{keyfloat}%
+ {%
+ Cannot nest keysubfigs or keysubtabs.%
+ (Not in outer par mode.)%
+ }%
+ {%
+ The subcaption package do not support nested environments, so%
+ the keyfloat package cannot place a keysubfigs or keysubtabs%
+ environment inside another, or inside a keyfloats.%
+ }%
+ }%
+ {}%
}
\NewDocumentEnvironment{keyfloats}{s O{tbp} m}
{%
-\addtocounter{KFLT@keyfloatdepth}{1}%
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\cnttest{\value{KFLT@keyfloatdepth}}>{1}%
-\OR\boolean{KFLT@inkeysubfloats}%
-\OR\boolean{KFLT@keywrap}%
-}%
-{% [H] or nested
-\ifthenelse{%
-\cnttest{\value{KFLT@keyfloatdepth}}>{1}%
-\OR\boolean{KFLT@inkeysubfloats}%
-}%
-{\noindent%
-\begin{minipage}{\KFLT@rowboxwidth}%
-}%
-{\bigbreak%
-\noindent\begin{minipage}{\linewidth}}%
-\ifthenelse{\boolean{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
-\ifthenelse{%
-\cnttest{\value{KFLT@keyfloatdepth}}>{1}%
-\OR\boolean{KFLT@inkeysubfloats}%
-}%
-{\setlength{\KFLT@rowboxwidth}{.9\KFLT@rowboxwidth/\real{#3}}}%
-{\setlength{\KFLT@rowboxwidth}{.9\linewidth/\real{#3}}}%
-\centering%
-\defcounter{KFLT@numcols}{#3}%
-\defcounter{KFLT@thiscol}{0}%
+ \addtocounter{KFLT@keyfloatdepth}{1}%
+ \ifboolexpr{%
+ test {\ifstrequal{#2}{H}} or
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{1}} or
+ bool {KFLT@inkeysubfloats} or
+ bool {KFLT@keywrap}
+ }%
+ {% [H] or nested
+ \ifboolexpr{%
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{1}} or
+ bool {KFLT@inkeysubfloats}
+ }%
+ {%
+ \noindent%
+ \begin{minipage}{\KFLT@rowboxwidth}%
+ }%
+ {%
+ \bigbreak%
+ \noindent\begin{minipage}{\linewidth}%
+ }%
+ \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
+ \ifboolexpr{%
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{1}} or
+ bool {KFLT@inkeysubfloats}
+ }%
+ {\setlength{\KFLT@rowboxwidth}{.9\KFLT@rowboxwidth/\real{#3}}}%
+ {\setlength{\KFLT@rowboxwidth}{.9\linewidth/\real{#3}}}%
+ \centering%
+ \defcounter{KFLT@numcols}{#3}%
+ \defcounter{KFLT@thiscol}{0}%
}% starting keyfloats environment
{% ending keyfloats environment
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\cnttest{\value{KFLT@keyfloatdepth}}>{1}%
-\OR\boolean{KFLT@inkeysubfloats}%
-\OR\boolean{KFLT@keywrap}%
-}%
-{\end{minipage}%
-\ifthenelse{%
-\cnttest{\value{KFLT@keyfloatdepth}}>{0}%
-\OR\boolean{KFLT@keywrap}%
-}%
-{}{\bigbreak}%
-}% was [H]
-{% not [H]
-\IfBooleanTF{#1}% starred figure?
-{\end{figure*}}{\end{figure}}%
-}% not [H]
-\addtocounter{KFLT@keyfloatdepth}{-1}%
+ \ifboolexpr{%
+ test {\ifstrequal{#2}{H}} or
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{1}} or
+ bool {KFLT@inkeysubfloats} or
+ bool {KFLT@keywrap}
+ }%
+ {% was [H], etc.
+ \end{minipage}%
+ \ifboolexpr{%
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or
+ bool {KFLT@keywrap}
+ }%
+ {}{\bigbreak}%
+ }% was [H], etc.
+ {% not [H], etc.
+ \IfBooleanTF{#1}% starred figure?
+ {\end{figure*}}{\end{figure}}%
+ }% not [H], etc.
+ \addtocounter{KFLT@keyfloatdepth}{-1}%
}
\BeforeBeginEnvironment{keyfloats}{%
-\ifthenelse{%
-\cnttest{\value{KFLT@keyfloatdepth}}>{0}%
-\OR\boolean{KFLT@inkeysubfloats}%
-}%
-{\KFLT@maybestartfloatrow}{}%
-\ifthenelse{\cnttest{\value{KFLT@thiscol}}{>}{1}}%
-{\hfill}{}%
+ \ifboolexpr{%
+ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or
+ bool {KFLT@inkeysubfloats}
+ }%
+ {\KFLT@maybestartfloatrow}%
+ {}%
+ \ifnumgreater{\value{KFLT@thiscol}}{1}%
+ {\hfill}%
+ {}%
}
\newcommand*{\KFLT@subgrpdefaults}{%
-\setboolean{KFLT@subgrpcont}{false}%
-\renewcommand{\KFLT@subgrpc}{}%
-\setboolean{KFLT@subgrpcstar}{false}%
-\renewcommand{\KFLT@subgrpsc}{}%
-\setboolean{KFLT@subgrpscgiven}{false}%
-\KFLT@setsubgrpfigure%
-\renewcommand{\KFLT@subgrpl}{}%
-\renewcommand{\KFLT@subgrpap}{}%
-\renewcommand{\KFLT@subgrpaf}{}%
-\renewcommand{\KFLT@subgrpal}{}%
-\renewcommand{\KFLT@subgrpas}{}%
-\renewcommand{\KFLT@subgrpt}{}%
-\renewcommand{\KFLT@subgrptextalign}{}
-\tdtextjustify
+ \setboolean{KFLT@subgrpcont}{false}%
+ \renewcommand{\KFLT@subgrpc}{}%
+ \setboolean{KFLT@subgrpcstar}{false}%
+ \renewcommand{\KFLT@subgrpsc}{}%
+ \setboolean{KFLT@subgrpscgiven}{false}%
+ \KFLT@setsubgrpfigure%
+ \renewcommand{\KFLT@subgrpl}{}%
+ \renewcommand{\KFLT@subgrpap}{}%
+ \renewcommand{\KFLT@subgrpaf}{}%
+ \renewcommand{\KFLT@subgrpal}{}%
+ \renewcommand{\KFLT@subgrpas}{}%
+ \renewcommand{\KFLT@subgrpt}{}%
+ \renewcommand{\KFLT@subgrptextalign}{}%
+ \tdtextjustify%
}
\NewDocumentCommand{\KFLT@subfloats}{m m m +m}
{%
-\setkeys{KFLT@subgrpkeys}{#4}%
-\setboolean{KFLT@inkeysubfloats}{true}%
-\IfBooleanTF{#1}%
-{\setlength{\KFLT@rowboxwidth}{.9\textwidth/\real{#3}}}%
-{\setlength{\KFLT@rowboxwidth}{.9\linewidth/\real{#3}}}%
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\boolean{KFLT@keywrap}%
-}%
-{%
-\bigbreak\noindent\begin{minipage}{\linewidth}%
-}%
-{%
-\IfBooleanTF{#1}%
-{\begin{\KFLT@subgrptype*}[#2]}{\begin{\KFLT@subgrptype}[#2]}%
-}%
-\captionsetup*{type=\KFLT@subgrptype}%
-\ifthenelse{\boolean{KFLT@subgrpcont}}{\ContinuedFloat}{}%
-\center\unskip%
-\KFLT@captioniftype{table}{subgrp}%
-\defcounter{KFLT@numcols}{#3}%
-\defcounter{KFLT@thiscol}{0}%
-\begingroup%
+ \setkeys{KFLT@subgrpkeys}{#4}%
+ \setboolean{KFLT@inkeysubfloats}{true}%
+ \IfBooleanTF{#1}%
+ {\setlength{\KFLT@rowboxwidth}{.9\textwidth/\real{#3}}}%
+ {\setlength{\KFLT@rowboxwidth}{.9\linewidth/\real{#3}}}%
+ \ifboolexpr{%
+ test {\ifstrequal{#2}{H}} or
+ bool {KFLT@keywrap}
+ }%
+ {%
+ \bigbreak\noindent\begin{minipage}{\linewidth}%
+ }%
+ {%
+ \IfBooleanTF{#1}%
+ {\begin{\KFLT@subgrptype*}[#2]}%
+ {\begin{\KFLT@subgrptype}[#2]}%
+ }%
+ \captionsetup*{type=\KFLT@subgrptype}%
+ \ifbool{KFLT@subgrpcont}%
+ {\ContinuedFloat}%
+ {}%
+ \center\unskip%
+ \KFLT@captioniftype{table}{subgrp}%
+ \defcounter{KFLT@numcols}{#3}%
+ \defcounter{KFLT@thiscol}{0}%
+ \begingroup%
}
\newcommand*{\KFLT@endsubfloats}[2]{%
-\endgroup%
-\unskip\endcenter%
-\par\addvspace{\bigskipamount}%
-\KFLT@addartisttext{subgrp}%
-\KFLT@captioniftype{figure}{subgrp}%
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\boolean{KFLT@keywrap}%
-}%
-{\end{minipage}\bigbreak}% was [H]
-{% not [H]:
-\IfBooleanTF{#1}% starred?
-{\end{\KFLT@subgrptype*}}{\end{\KFLT@subgrptype}}%
-}% not [H]
-\setboolean{KFLT@inkeysubfloats}{false}%
+ \endgroup%
+ \unskip\endcenter%
+ \par\addvspace{\bigskipamount}%
+ \KFLT@addartisttext{subgrp}%
+ \KFLT@captioniftype{figure}{subgrp}%
+ \ifboolexpr{%
+ test {\ifstrequal{#2}{H}} or
+ bool{KFLT@keywrap}
+ }%
+ {\end{minipage}\bigbreak}% was [H]
+ {% not [H]:
+ \IfBooleanTF{#1}% starred?
+ {\end{\KFLT@subgrptype*}}%
+ {\end{\KFLT@subgrptype}}%
+ }% not [H]
+ \setboolean{KFLT@inkeysubfloats}{false}%
}
\NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m}
{%
-\KFLT@nonest%
-\KFLT@subgrpdefaults%
-\KFLT@subfloats{#1}{#2}{#3}{#4}%
+ \KFLT@nonest%
+ \KFLT@subgrpdefaults%
+ \KFLT@subfloats{#1}{#2}{#3}{#4}%
}% the start of the environment
{%
-\KFLT@endsubfloats{#1}{#2}%
+ \KFLT@endsubfloats{#1}{#2}%
}
\NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m}
{%
-\KFLT@nonest%
-\KFLT@subgrpdefaults%
-\KFLT@setsubgrptable%
-\KFLT@subfloats{#1}{#2}{#3}{#4}%
+ \KFLT@nonest%
+ \KFLT@subgrpdefaults%
+ \KFLT@setsubgrptable%
+ \KFLT@subfloats{#1}{#2}{#3}{#4}%
}% the start of the environment
{%
-\KFLT@endsubfloats{#1}{#2}%
+ \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%
+ \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}}%
-}
+{% end
+ \end{minipage}%
+ \end{lrbox}%
+ \marginpar{\usebox{\KFLT@marginfloatbox}}%
+}% end
\ProvideDocumentEnvironment{marginfigure}{O{-1.2ex}}
{\begin{KFLT@marginfloat}[#1]{figure}}
{\end{KFLT@marginfloat}}
@@ -953,31 +974,32 @@ environment inside another, or inside a keyfloats.}%
\newlength{\KFLT@keywrapparindent}
\DeclareDocumentEnvironment{keywrap}{m +m}
{%
-\par%
-\setlength{\KFLT@keywrapwidth}{\linewidth}%
-\addtolength{\KFLT@keywrapwidth}{-#1}%
-\addtolength{\KFLT@keywrapwidth}{-2em}%
-\minipage[t]{\KFLT@keywrapwidth}%
-\setlength{\parskip}{\KFLT@keywrapparskip}%
-\setlength{\parindent}{\KFLT@keywrapparindent}%
-\booltrue{KFLT@keywrap}%
-}
-{%
-\par
-\endminipage%
-\hfill%
-\begin{minipage}[t]{#1}%
-\booltrue{KFLT@keywrap}%
-#2%
-\par
-\unskip\vspace{\smallskipamount}
-\end{minipage}%
-\par
-}
-
-\BeforeBeginEnvironment{keywrap}{
-\setlength{\KFLT@keywrapparskip}{\parskip}
-\setlength{\KFLT@keywrapparindent}{\parindent}
+ \par%
+ \setlength{\KFLT@keywrapwidth}{\linewidth}%
+ \addtolength{\KFLT@keywrapwidth}{-#1}%
+ \addtolength{\KFLT@keywrapwidth}{-2em}%
+ \minipage[t]{\KFLT@keywrapwidth}%
+ %
+ \setlength{\parskip}{\KFLT@keywrapparskip}%
+ \setlength{\parindent}{\KFLT@keywrapparindent}%
+ \booltrue{KFLT@keywrap}%
+}
+{%
+ \par%
+ \endminipage%
+ \hfill%
+ \begin{minipage}[t]{#1}%
+ \booltrue{KFLT@keywrap}%
+ #2%
+ \par%
+ \unskip\vspace{\smallskipamount}%
+ \end{minipage}%
+ \par%
+}
+
+\BeforeBeginEnvironment{keywrap}{%
+ \setlength{\KFLT@keywrapparskip}{\parskip}%
+ \setlength{\KFLT@keywrapparindent}{\parindent}%
}
\endinput
%%