texlive[49683] Master/texmf-dist: keyfloat (12jan19)

commits+karl at tug.org commits+karl at tug.org
Sun Jan 13 00:07:33 CET 2019


Revision: 49683
          http://tug.org/svn/texlive?view=revision&revision=49683
Author:   karl
Date:     2019-01-13 00:07:32 +0100 (Sun, 13 Jan 2019)
Log Message:
-----------
keyfloat (12jan19)

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-01-12 23:07:09 UTC (rev 49682)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/README.txt	2019-01-12 23:07:32 UTC (rev 49683)
@@ -1,8 +1,8 @@
 The LaTeX keyfloat package
 Provides a key/value interface for generating floats.
 
-v0.15 — 2017/05/12
-Copyright 2016-2017 Brian Dunn — www.BDTechConcepts.com
+v1.00 — 2019/01/11
+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-01-12 23:07:09 UTC (rev 49682)
+++ trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx	2019-01-12 23:07:32 UTC (rev 49683)
@@ -17,7 +17,7 @@
 % \iffalse
 %<package>\NeedsTeXFormat{LaTeX2e}
 %<package>\ProvidesPackage{keyfloat}
-%<package>    [2017/05/12 v0.15 Key/value interface for floats and the subcaption package.]
+%<package>    [2019/01/11 v1.00 Key/value interface for floats and subfloats.]
 %
 %<*driver>
 \documentclass{ltxdoc}
@@ -26,7 +26,11 @@
 \newcommand{\quicksummary}{Provides a key/value interface for generating floats.}
 
 
-\usepackage{lmodern}
+% \usepackage{lmodern}
+\usepackage{erewhon}
+\usepackage{roboto}
+% \usepackage{sourcesanspro}
+\usepackage{inconsolata}
 % \usepackage{libertine}
 \usepackage[T1]{fontenc}
 \usepackage[utf8]{inputenc}
@@ -67,6 +71,19 @@
 \newunicodechar{‡}{\ddag}
 \newunicodechar{⚠}{\textwarning}
 
+\usepackage{metalogo}
+\makeatletter
+\@ifpackageloaded{erewhon}{
+\setlogokern{Te}{-.08em}
+\setlogokern{eX}{-0.04em}
+\setlogokern{La}{-.25em}
+\setlogokern{aT}{-.08em}
+\setlogokern{Xe}{-.04em}
+\setlogokern{eL}{-.06em}
+\setlogodrop{0.27ex}
+}{}
+\makeatother
+
 \usepackage{microtype}
 
 \usepackage{etoolbox}
@@ -185,15 +202,7 @@
 
 \usepackage[normalem]{ulem}
 
-% \usepackage{verbatim}
-% \usepackage{fancyvrb}
 
-% \usepackage{comment}
-% \excludecomment{testing}
-
-% \usepackage{morefloats}
-% \usepackage{marginfix}
-
 \usepackage{tocloft}
 \setlength{\cftsubsecnumwidth}{3em}
 \setlength{\cftsubsubsecindent}{2.8em}
@@ -218,40 +227,10 @@
 \pagestyle{pageheadfoot}
 
 
-\usepackage{dtxdescribe}
+\usepackage{dtxdescribe}[2019/01/11]
 
 
-\newcommand*{\lmacro}[1]{\textbackslash#1}
-\newcommand*{\cmds}[1]{\texttt{#1}}
-\newcommand*{\env}[1]{\texttt{#1}}
-\newcommand*{\pkg}[1]{\textsf{#1}}
-\newcommand*{\acro}[1]{\textsc{\lowercase{#1}}}
 
-
-
-% \newcommand*{\tikz}{Ti\textit{k}z}
-\newcommand*{\htmlfive}{\acro{HTML}\oldstylenums{5}}
-\newcommand*{\cssthree}{\acro{CSS}\oldstylenums{3}}
-
-\newcommand*{\goesto}{$\Rightarrow$}
-
-\newenvironment{docsidebar}[1][]
-{\par\addvspace{1.5ex}%
-\hfill\minipage{.9\linewidth}\raggedright#1\smallskip\hrule\medskip}
-{\smallskip\hrule\endminipage\hspace*{\fill}\par\addvspace{1.5ex}}
-
-
-
-
-
-% \setlength{\marginparsep}{1em}
-\setlength{\marginparpush}{2.5ex}
-\setlength{\parindent}{0em}
-\setlength{\parskip}{2ex}
-\setlength{\IndexMin}{40ex}
-
-
-
 \newcommand{\testtable}{%
 \begin{tabular}{cc}%
 \hline\rule{0pt}{2.7ex}%
@@ -271,7 +250,7 @@
 }
 
 
-\newcommand{\mainsubarg}{\texttt{\{\}} or \texttt{subgrp}}
+\newcommand{\mainsubarg}{empty or ``\texttt{subgrp}''}
 \newcommand{\keyvalsarg}{keys/values}
 
 \setlength{\floatsep}{5ex plus 1ex minus 1ex}
@@ -294,7 +273,25 @@
 Keywords={LaTeX, floats, key/val, subcaption, rows}%
 }}
 
+\pdfstringdefDisableCommands{
+\def\quad{ }
+\def\\{ }
+\def\pkg#1{#1}
+\def\cs#1{\textbackslash#1}
+\def\env#1{#1}
+\def\,{ }
+\def\prog#1{#1}
+\def\LuaLaTeX{LuaLaTeX}
+\def\XeLaTeX{XeLaTeX}
+\def\TeX{TeX}
+\def\LaTeX{LaTeX}
+\def\Dash{ --- }
+\def\dash{ -- }
+\def\element#1{#1}
+\def\attribute#1{#1}
+}
 
+
 \usepackage{cleveref}
 
 
@@ -316,7 +313,7 @@
 %<*package>
 % \fi
 %
-% \CheckSum{1102}
+% \CheckSum{0}
 %
 % \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
@@ -343,6 +340,10 @@
 % \changes{v0.13}{2017/01/12}{Docs: Other Settings.}
 % \changes{v0.14}{2017/02/09}{\ 2017/02/09}
 % \changes{v0.15}{2017/05/12}{\ 2017/05/12}
+% \changes{v1.00}{2019/01/11}{\ 2019/01/11}
+% \changes{v1.00}{2019/01/08}{Source formatting improvements.}
+% \changes{v1.00}{2019/01/08}{PDF bookmark improvements.}
+% \changes{v1.00}{2019/01/08}{Removed spurious spaces.}
 
 
 
@@ -368,7 +369,7 @@
 %
 % \bigskip
 %
-% {\small\copyright{} 2016} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
+% {\small\textcopyright{} 2016--2019} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
 %
 % \vspace{.5in}
 %
@@ -381,7 +382,7 @@
 % ^^A % \title{The \pkg{keyfloat} package\thanks{This document
 % ^^A %   corresponds to \pkg{keyfloat}~\fileversion,
 % ^^A %   dated \filedate.}}
-% ^^A % \author{{\small\copyright{} 2016} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}}
+% ^^A % \author{{\small\textcopyright{} 2016} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}}
 % ^^A % \published{}
 % ^^A % \subtitle{\textup{Subtitle}}
 % ^^A %
@@ -405,16 +406,14 @@
 % When used with the \pkg{tocdata} package, the name also appears in the
 % List of Figures.
 %
-% Floats may be placed into a multi-row environment, and are
-% typeset to fit within the given number of columns,
-% continuing to the next rows as necessary.
+% Floats may be moved into or rearranged inside a multi-row environment or subfloats,
+% and are typeset to fit within the given number of columns,
+% continuing to additional rows as necessary.
 % Nested sub-rows may be used to generate layouts such as
 % two small figures placed vertically next to
 % one larger figure.
 %
-% Subfloats are supported by two environments.
 %
-%
 % \bigskip
 %
 % \noindent
@@ -459,14 +458,14 @@
 % \section{Introduction}
 %
 % The \pkg{keyfloat} package simplifies the creation
-% of \LaTeX\ floats, while still allowing a number of useful features.
+% of \LaTeX\ floats, while still allowing a large number of useful features.
 %
 %
-% \subsection{A Problem with Floats}
+% \subsection{A problem with floats}
 %
 % When including a figure with a graphics image into a document,
 % the user typically enters something such as:
-% \begin{verbatim}
+% \begin{sourceverb}
 % \begin{figure}
 % \centering
 % \includegraphics[width=3in]{filename}
@@ -473,19 +472,19 @@
 % \caption{A Figure}
 % \label{fig:somelabel}
 % \end{figure}
-% \end{verbatim}
+% \end{sourceverb}
 % \unskip
 %
 % When doing that often enough, it makes sense to factor the common code:
-% \begin{verbatim}
+% \begin{sourceverb}
 % \onefigure[3in]{filename}{A Figure}{fig:somelabel}
-% \end{verbatim}
+% \end{sourceverb}
 % \unskip
 % 
 % Expanding the capability of \cs{onefigure} via \pkg{xparse} can lead to the general case of:
-% \begin{verbatim}
+% \begin{sourceverb}
 % \onefigure*[loc](width){filename}(add'l text)[shortcap]{caption}*[label]
-% \end{verbatim}
+% \end{sourceverb}
 % \unskip
 % Attempting to add additional features such as frames and continued floats
 % hits the limit of nine parameters for a \TeX\ macro,
@@ -497,20 +496,21 @@
 % syntax, and allows a shared syntax with subfloats and groups of floats as well.
 % Thus, the \pkg{keyfloat} package.
 %
-% \subsection{The \pkg{keyfloat} Package}
+% \subsection{The \pkg{keyfloat} package}
 % 
 % Using \pkg{keyfloat}, the previous example becomes:
-% \begin{verbatim}
-% \keyfig{w=3in,c=A Figure,l=fig:somelabel}{filename}
-% \end{verbatim}
+% \begin{sourceverb}
+% \keyfig{w=3in,c=A figure,l=fig:somelabel}{filename}
+% \end{sourceverb}
 % \unskip
 % 
 % The \cs{onefigure} general case becomes:
-% \begin{verbatim}
+% \begin{sourceverb}
 % \keyfig*[loc]{w=width,t={add'l text},sc=shortcap,cstar=caption,
 %     l=label}{filename}
-% \end{verbatim}
+% \end{sourceverb}
 %
+%
 % \subsection{Features}
 %
 % The macros and environments provided by \pkg{keyfloat} include:
@@ -580,27 +580,27 @@
 %
 % \clearpage
 %
-% \section{Using the \pkg{keyfloat} Package}
+% \section{Using the \pkg{keyfloat} package}
 %
 % \subsection{Loading \pkg{keyfloat}}
 %
 % \pkg{keyfloat} is loaded with the usual command:
-% \begin{verbatim}
-% 	\usepackage{keyfloat}
-% \end{verbatim}
+% \begin{sourcedisplay}
+% 	\cs{usepackage}\{keyfloat\}
+% \end{sourcedisplay}
 %
 % If you wish to have artist's names appear in the table of contents,
 % as provided by the \pkg{tocdata} package,
 % load either \pkg{tocloft} or \pkg{titletoc},
 % followed by \pkg{tocdata}, then \pkg{keyfloat}:
-% \begin{verbatim}
-% 	\usepackage{titletoc}% or titletoc
-% 	\usepackage{tocdata}
-% 	\usepackage{keyfloat}
-% \end{verbatim}
+% \begin{sourcedisplay}
+% 	\cs{usepackage}\{titletoc\}\% or titletoc \\
+% 	\cs{usepackage}\{tocdata\} \\
+% 	\cs{usepackage}\{keyfloat\}
+% \end{sourcedisplay}
 % 
 % 
-% \subsection{Macros and Environments}
+% \subsection{Macros and environments}
 %
 % \DescribeMacro{\keyfig} * \oarg{loc} \marg{\keyvalsarg} \marg{image filename} \\
 % A macro to generate a figure with an image from a file.
@@ -629,11 +629,11 @@
 % Useful for larger tables.
 % See \cref{ex:keytable}.
 %
-% \medskip\hrule
-% The above macros and environments may be used by themselves,
+% \begin{docsidebar}
+% \textbf{The above macros and environments may be used by themselves,
 % or inside the following \env{keyfloats}, \env{keysubfigs}, or
-% \env{keysubtabs} environments.
-% \medskip\hrule
+% \env{keysubtabs} environments.}
+% \end{docsidebar}
 %
 %
 % \DescribeEnv{keyfloats} * \oarg{loc} \marg{num columns} \\
@@ -668,7 +668,7 @@
 % or provides its own version otherwise.
 % See \cref{ex:margintable}.
 %
-% \bigskip\hrule
+% \medskip\hrule\medskip
 %
 % \DescribeArgument{*}
 % The star option create floats which span both columns in a two-column
@@ -702,11 +702,11 @@
 %
 %
 %
-% \subsection{Keys and Values}
+% \subsection{Keys and values}
 %
 % \newcommand{\largebullet}{{\Large\textbullet}}
 %
-% \begin{keytable}[bp]{c={Keys and Values — Part I},l={tab:keyvals},stretch=1.5}
+% \begin{keytable}[bp]{c={Keys and values — part I},l={tab:keyvals},stretch=1.5}
 % \index{keys>and values}
 % \begin{threeparttable}
 % \small
@@ -715,10 +715,10 @@
 % \textrm{Key} & Sub\tnote{a} & Description & \textrm{Example} \\
 % \midrule
 % c & \largebullet &  An unstarred caption.
-%	If empty, creates a figure with a number but no caption. & c={A Caption} \\
+%	If empty, creates a figure with a number but no caption. & c={A caption} \\
 % cstar & \largebullet &  A starred caption.  Creates a float without a number.
 % 	If empty, creates a figure with no number or caption. & cstar={No Num} \\
-% sc & \largebullet &  The short caption for the \acro{LOF}/\acro{LOT}, even if cstar. & sc={Short Cap} \\
+% sc & \largebullet &  The short caption for the \acro{LOF}/\acro{LOT}, even if cstar. & sc={Short cap} \\
 % cont & \largebullet &  Continued float?  & cont \\
 % l & \largebullet &  The label.  Enclose in braces if a comma is included.
 %	Ignored in unnumbered floats. & l=fig:A name  \\
@@ -753,7 +753,7 @@
 
 
 % \begin{keytable}{
-%	c={Keys and Values — Part II},cont,stretch=1.5}
+%	c={Keys and values — part II},cont,stretch=1.5}
 % \index{keys>and values}
 % \begin{threeparttable}
 % \small
@@ -818,7 +818,7 @@
 % entries in the \acro{LOF}/\acro{LOT}.
 % 
 %
-% \begin{keytable}{c={Caption-Related Key Combinations},l=tab:captions,stretch=1.5}
+% \begin{keytable}{c={Caption-related key combinations},l=tab:captions,stretch=1.5}
 % \index{caption>options}
 % \begin{threeparttable}
 % \small
@@ -826,7 +826,7 @@
 % \toprule
 % \multicolumn{3}{c}{\bfseries Keys in Use} & \multicolumn{2}{c}{\bfseries Type of} \\
 % \cmidrule(r){1-3}\cmidrule(l){4-5}
-% |c| & |cstar| & |sc| & \textbf{Caption}\tnote{a} & \textbf{LOF/LOT}\tnote{b} \\
+% |c| & |cstar| & |sc| & \textbf{Caption}\tnote{a} & \textbf{\LOF\Slash\LOT}\tnote{b} \\
 % \cmidrule(r){1-3} \cmidrule(l){4-5}
 % \largebullet & — & — & Numbered & Caption \\
 % \largebullet & — & \largebullet & Numbered & Short Caption \\
@@ -840,7 +840,7 @@
 % \begin{tablenotes}
 % \item[a:] Caption: Shows whether the float will
 % be numbered, unnumbered, or have no caption.
-% \item[b:] LOF/LOT: Shows whether the regular or short caption
+% \item[b:] \LOF\Slash\LOT: Shows whether the regular or short caption
 % will appear in the List of Figures or List of Tables, or if there will be no listing.
 % \end{tablenotes}
 % \end{threeparttable}
@@ -852,7 +852,7 @@
 % options for the |wp| key
 % for floats placed |[W]|.
 %
-% \begin{keytable}{c=Wrapped-Float Placement Options,l=tab:wrapplacement}
+% \begin{keytable}{c={Wrapped float placement options},l=tab:wrapplacement}
 % \index{float>wrapped placement}\index{wrapped float placement}
 % \begin{tabular}{ccl}
 % \toprule
@@ -874,7 +874,7 @@
 %
 % \clearpage
 %
-% \subsection{Other Settings}
+% \subsection{Other settings}
 %
 % \DescribeMacro{\KFLTtightframe} \marg{contents} Frames the contents without separation.
 %
@@ -901,7 +901,7 @@
 % \subsection{Examples}
 %
 %
-% \subsubsection{Single Floats}
+% \subsubsection{Single floats}
 %
 %
 % \begin{dtxexample}[\Cref{fig:simple}]{Figure with an image from a file}
@@ -1060,12 +1060,12 @@
 %
 % \clearpage
 %
-% \begin{dtxexample}[\Cref{fig:here}]{Located [H]ere}
-% \keytab[H]{c={A table [H]},l=fig:here}{\testtable}
-% \keyfig[H]{f,w=1in,c={A keyfig [H]}}{image}
+% \begin{dtxexample}[\Cref{tab:here}, \Cref{fig:here}]{Located [H]ere}
+% \keytab[H]{c={A table [H]},l=tab:here}{\testtable}
+% \keyfig[H]{f,w=1in,c={A keyfig [H]},l=fig:here}{image}
 % \end{dtxexample}
 %
-% \Cref{fig:here} is to be placed ``[H]ere'', and therefore may appear
+% \Cref{tab:here} and \Cref{fig:here} are to be placed ``[H]ere'', and therefore may appear
 % \watchout[Out of sequence]
 % out-of-sequence with surrounding figures.
 % \index{troubleshooting>float out of sequence}
@@ -1138,7 +1138,7 @@
 %
 % \clearpage
 %
-% \subsubsection{Groups of Floats}
+% \subsubsection{Groups of floats}
 %
 % \begin{dtxexample}[\Cref{fig:firstinrow} to \Cref{tab:seventhinrow}]{Groups of figures — \env{keyfloats} environment\label{ex:keyfloats}}
 % \begin{keyfloats}{2}
@@ -1259,7 +1259,7 @@
 %
 % \clearpage
 %
-% \subsubsection{Continued Floats}
+% \subsubsection{Continued floats}
 %
 % The |cont| key may be used to generate a ``continued'' float.
 % The continued float receives the same number as the previous float,
@@ -1278,7 +1278,7 @@
 %
 %
 % \clearpage
-% \subsubsection{Continued Subfloats}
+% \subsubsection{Continued subfloats}
 % 
 % The \env{keysubfigs} and \env{keysubtabs} environments may also
 % be given the |cont| key.
@@ -1298,7 +1298,7 @@
 %
 %
 % \clearpage
-% \subsubsection{Margin Floats}
+% \subsubsection{Margin floats}
 % \changes{v0.12}{2016/12/02}{Docs: Margin float examples.}
 %
 % When a keyfloat is located [M], it will be placed in the margin.
@@ -1355,14 +1355,14 @@
 % To set the minimum-allowed distance between \cs{marginpar}s and margin floats:
 % \margintag{distance between floats}
 % \index{distance between floats}\index{float>distance between}
-% \begin{verbatim}
+% \begin{sourceverb}
 % \setlength{\marginparpush}{3ex}
-% \end{verbatim}
+% \end{sourceverb}
 %
 %
 %
 % \clearpage
-% \subsubsection{Wrapped Floats}
+% \subsubsection{Wrapped floats}
 % \changes{v0.12}{2016/12/03}{Docs: Wrapped float examples.}
 %
 % \begin{dtxexample}[\Cref{fig:keyfigw,tab:keytabw}]
@@ -1437,7 +1437,7 @@
 %
 %
 % \clearpage
-% \subsubsection{Custom Frames}
+% \subsubsection{Custom frames}
 %
 % 
 % \begin{dtxexample}[\Cref{fig:customframe,fig:customlooseframe}]
@@ -1532,7 +1532,7 @@
 %
 %
 % \clearpage
-% \subsubsection{Artist's Name}
+% \subsubsection{Artist's name}
 %
 % \begin{dtxexample}[\Cref{fig:artist}]{Artist's name — image}
 % \keyfig{ft,ap=Mr.,af=First,al=Last,as={~III},
@@ -1585,7 +1585,7 @@
 %
 % \subsection{Customization}
 %
-% \subsubsection{Custom Frames}
+% \subsubsection{Custom frames}
 % \label{sec:customframes}
 %
 % \index{frame>custom}
@@ -1599,7 +1599,7 @@
 %
 % Each macro takes one argument and frames it.
 %
-% Each macro has an associated \LaTeX\ length: \\
+% Each macro has a associated \LaTeX\ lengths: \\
 % \hspace*{2em}\cs{KFLTtightframewidth} and \cs{KFLTlooseframewidth}
 %
 % These lengths must be redefined to the expected
@@ -1606,22 +1606,22 @@
 % total frame width, equal to the frame thickness plus
 % separation.
 %
-% The defaults definitions are:
-% \begin{Verbatim}[gobble=2]
+% The default definitions are:
+% \begin{sourceverb}
 % \newcommand{\KFLTtightframe}[1]{%
-% \setlength{\fboxsep}{0pt}%
-% \setlength{\fboxrule}{.4pt}%
-% \fbox{#1}%
+%   \setlength{\fboxsep}{0pt}%
+%   \setlength{\fboxrule}{.4pt}%
+%   \fbox{#1}%
 % }
 % \setlength{\KFLTtightframewidth}{.4pt}
 % 
 % \newcommand{\KFLTlooseframe}[1]{%
-% \setlength{\fboxsep}{3pt}%
-% \setlength{\fboxrule}{.4pt}%
-% \fbox{#1}%
+%   \setlength{\fboxsep}{3pt}%
+%   \setlength{\fboxrule}{.4pt}%
+%   \fbox{#1}%
 % }
 % \setlength{\KFLTlooseframewidth}{3.4pt}
-% \end{Verbatim}
+% \end{sourceverb}
 %
 % See \cref{ex:customframe} for an example
 % created with the \pkg{mdframed} package,
@@ -1630,7 +1630,7 @@
 %
 %
 %
-% \subsubsection{Distance between Floats and Rows}
+% \subsubsection{Distance between floats and rows}
 % \index{distance between floats}
 % \index{subfloat>distance between}
 % \index{float>distance between}
@@ -1637,21 +1637,21 @@
 % \index{troubleshooting>rows too close or far}
 % To spread out the distance between floats and/or rows of floats
 % \margintag{rows too close/far}
-% on a busy page, the following adjustments may be made.
-% The values used in this documentation are:
-% \begin{verbatim}
+% on a busy page, the following settings may be changed.
+% The settings used in this documentation are:
+% \begin{sourceverb}
 % \setlength{\floatsep}{5ex plus 1ex minus 1ex}
 % \setlength{\dblfloatsep}{5ex plus 1ex minus 1ex}
-% \end{verbatim}
+% \end{sourceverb}
 %
 %
-% \subsubsection{Formatting the Captions}
+% \subsubsection{Formatting the captions}
 %
 % \index{troubleshooting>caption format}
 % To modify the typesetting of the captions, see the \pkg{caption} package.
 % \index{caption>formatting}
 % The settings used in this documentation are:
-% \begin{verbatim}
+% \begin{sourceverb}
 % % default applied to margin floats:
 % \captionsetup{labelfont={small,bf},textfont={small,bf}}
 % 
@@ -1678,7 +1678,7 @@
 % 	margin=0pt, parskip=0pt, skip=1ex,
 % 	labelfont={small},textfont={small}
 % }
-% \end{verbatim}
+% \end{sourceverb}
 
 
 
@@ -1695,16 +1695,17 @@
 %
 %
 %
-% \subsection{Required Packages}
+% \subsection{Required packages}
+% \changes{v1.00}{2019/01/08}{Removed \pkg{xifthen} dependency.}
 %
 % \DescribePackage{etoolbox} v2.6 or later
 %	for \cs{BeforeBeginEnvironment}, \cs{AfterEndEnvironment}
 %    \begin{macrocode}
 \RequirePackage{etoolbox}[2011/01/03]%
-
+%    \end{macrocode}
+% \DescribePackage{xparse} Argument processing:
+%    \begin{macrocode}
 \RequirePackage{xparse}
-
-\RequirePackage{xifthen}
 %    \end{macrocode}
 % \DescribePackage{keyval} Key processing:
 %    \begin{macrocode}
@@ -1748,17 +1749,20 @@
 \@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.%
+}
+}
 {}
 %    \end{macrocode}
 
 
 
-%
 % \DescribePackage{gettitlestring} Used by \pkg{hyperref} and \pkg{nameref}.
 %
 % \changes{v0.13}{2017/01/14}{Fix: Expands names in references.}
@@ -1775,7 +1779,7 @@
 % environment.
 %
 
-% \subsection{In-line Figures and Tables}
+% \subsection{In-line figures and tables}
 
 % These macros are commonly used by others.
 
@@ -1797,7 +1801,7 @@
 
 
 
-% \subsection{Row Counting and Control}
+% \subsection{Row counting and control}
 
 % Used to count position and wrap at end of each row.
 
@@ -1823,7 +1827,7 @@
 
 
 
-% \subsection{Float Key Handling}
+% \subsection{Float key handling}
 
 % \DescribeBoolean{KFLT at cont} Continued float?
 %    \begin{macrocode}
@@ -1850,15 +1854,17 @@
 % \DescribeKey[main]{c} Caption
 %
 %    \begin{macrocode}
-\define at key{KFLT at keys}{c}%
-	{\renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{false}}
+\define at key{KFLT at keys}{c}{%
+    \renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{false}%
+}
 %    \end{macrocode}
 %
 % \DescribeKey[main]{cstar} Caption starred?
 %
 %    \begin{macrocode}
-\define at key{KFLT at keys}{cstar}%
-	{\renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{true}}
+\define at key{KFLT at keys}{cstar}{%
+    \renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{true}%
+}
 %    \end{macrocode}
 %
 % \DescribeKey[main]{sc} Short caption
@@ -1865,8 +1871,8 @@
 %
 %    \begin{macrocode}
 \define at key{KFLT at keys}{sc}{%
-\renewcommand{\KFLT at sc}{#1}%
-\setboolean{KFLT at scgiven}{true}%
+    \renewcommand{\KFLT at sc}{#1}%
+    \setboolean{KFLT at scgiven}{true}%
 }
 %    \end{macrocode}
 %
@@ -1989,37 +1995,37 @@
 %
 % \DescribeKey[main]{t} Additional text, justified alignment.
 %    \begin{macrocode}
-\define at key{KFLT at keys}{t}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{}
-\tdtextjustify
+\define at key{KFLT at keys}{t}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{}%
+    \tdtextjustify%
 }
 %    \end{macrocode}
 %
 % \DescribeKey[main]{tc} Additional text, centered alignment.
 %    \begin{macrocode}
-\define at key{KFLT at keys}{tc}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{\centering}
-\tdtextcenter
+\define at key{KFLT at keys}{tc}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{\centering}%
+    \tdtextcenter%
 }
 %    \end{macrocode}
 %
 % \DescribeKey[main]{tr} Additional text, aligned to the right.
 %    \begin{macrocode}
-\define at key{KFLT at keys}{tr}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{\raggedleft}
-\tdtextright
+\define at key{KFLT at keys}{tr}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{\raggedleft}%
+    \tdtextright%
 }
 %    \end{macrocode}
 %
 % \DescribeKey[main]{tl} Additional text, aligned to the left.
 %    \begin{macrocode}
-\define at key{KFLT at keys}{tl}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{\raggedright}
-\tdtextleft
+\define at key{KFLT at keys}{tl}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{\raggedright}%
+    \tdtextleft%
 }
 %    \end{macrocode}
 %
@@ -2035,8 +2041,8 @@
 % \DescribeKey[main]{lw} Fraction of \cs{linewidth}
 %    \begin{macrocode}
 \define at key{KFLT at keys}{lw}{%
-\renewcommand{\KFLT at lw}{#1}%
-\setlength{\KFLT at w}{0pt}%
+    \renewcommand{\KFLT at lw}{#1}%
+    \setlength{\KFLT at w}{0pt}%
 }
 %    \end{macrocode}
 %
@@ -2049,8 +2055,8 @@
 % \DescribeKey[main]{w} Fixed width
 %    \begin{macrocode}
 \define at key{KFLT at keys}{w}{%
-\setlength{\KFLT at w}{#1}%
-\renewcommand{\KFLT at lw}{}%
+    \setlength{\KFLT at w}{#1}%
+    \renewcommand{\KFLT at lw}{}%
 }
 %    \end{macrocode}
 %
@@ -2174,7 +2180,7 @@
 
 
 
-% \subsection{Nesting Control}
+% \subsection{Nesting control}
 
 % \DescribeCounter{KFLT at keyfloatdepth} Depth inside a keyfigs environment
 %    \begin{macrocode}
@@ -2190,7 +2196,7 @@
 
 
 
-% \subsection{Subfloat Key Handling}
+% \subsection{Subfloat key handling}
 %
 % These keys are for the container holding a collection of subfigures.
 
@@ -2202,7 +2208,7 @@
 % \DescribeKey[subfloat container]{cont} Continued float
 %    \begin{macrocode}
 \define at key{KFLT at subgrpkeys}{cont}[true]{%
-\setboolean{KFLT at subgrpcont}{#1}%
+    \setboolean{KFLT at subgrpcont}{#1}%
 }
 %    \end{macrocode}
 
@@ -2219,21 +2225,23 @@
 %
 % \DescribeKey[subfloat container]{c} Caption
 %    \begin{macrocode}
-\define at key{KFLT at subgrpkeys}{c}
-	{\renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{false}}
+\define at key{KFLT at subgrpkeys}{c}{%
+    \renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{false}%
+}
 %    \end{macrocode}
 %
 % \DescribeKey[subfloat container]{cstar} Starred caption?
 %    \begin{macrocode}
-\define at key{KFLT at subgrpkeys}{cstar}
-	{\renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{true}}
+\define at key{KFLT at subgrpkeys}{cstar}{%
+    \renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{true}%
+}
 %    \end{macrocode}
 %
 % \DescribeKey[subfloat container]{sc} Short caption
 %    \begin{macrocode}
 \define at key{KFLT at subgrpkeys}{sc}{%
-\renewcommand{\KFLT at subgrpsc}{#1}%
-\setboolean{KFLT at subgrpscgiven}{true}%
+    \renewcommand{\KFLT at subgrpsc}{#1}%
+    \setboolean{KFLT at subgrpscgiven}{true}%
 }
 %    \end{macrocode}
 
@@ -2265,8 +2273,8 @@
 % \begin{macro}{\KFLT at setsubgrpfigure} Set to figure type
 %    \begin{macrocode}
 \newcommand*{\KFLT at setsubgrpfigure}{%
-\renewcommand{\KFLT at subgrptype}{figure}%
-\renewcommand{\KFLT at subgrplisttype}{lof}%
+    \renewcommand{\KFLT at subgrptype}{figure}%
+    \renewcommand{\KFLT at subgrplisttype}{lof}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2274,8 +2282,8 @@
 % \begin{macro}{\KFLT at setsubgrptable} Set to table type
 %    \begin{macrocode}
 \newcommand*{\KFLT at setsubgrptable}{%
-\renewcommand{\KFLT at subgrptype}{table}%
-\renewcommand{\KFLT at subgrplisttype}{lot}%
+    \renewcommand{\KFLT at subgrptype}{table}%
+    \renewcommand{\KFLT at subgrplisttype}{lot}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2308,37 +2316,37 @@
 %
 % \DescribeKey[subfloat container]{t} Additional text — full justification
 %    \begin{macrocode}
-\define at key{KFLT at subgrpkeys}{t}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{}
-\tdtextjustify
+\define at key{KFLT at subgrpkeys}{t}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{}%
+    \tdtextjustify%
 }
 %    \end{macrocode}
 %
 % \DescribeKey[subfloat container]{t} Additional text — center justification
 %    \begin{macrocode}
-\define at key{KFLT at subgrpkeys}{tc}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{\centering}
-\tdtextcenter
+\define at key{KFLT at subgrpkeys}{tc}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{\centering}%
+    \tdtextcenter%
 }
 %    \end{macrocode}
 %
 % \DescribeKey[subfloat container]{t} Additional text — aligned left
 %    \begin{macrocode}
-\define at key{KFLT at subgrpkeys}{tl}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{\raggedright}
-\tdtextleft
+\define at key{KFLT at subgrpkeys}{tl}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{\raggedright}%
+    \tdtextleft%
 }
 %    \end{macrocode}
 %
 % \DescribeKey[subfloat container]{t} Additional text — aligned right
 %    \begin{macrocode}
-\define at key{KFLT at subgrpkeys}{tr}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{\raggedleft}
-\tdtextright
+\define at key{KFLT at subgrpkeys}{tr}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{\raggedleft}%
+    \tdtextright%
 }
 %    \end{macrocode}
 %
@@ -2389,19 +2397,11 @@
 \newcommand*{\KFLT at subgrpas}{}
 %    \end{macrocode}
 % \end{macro}
-%%
-%
-%
-%
-%
-%
-%
-%
-%
 
 
-% \subsection{Computing Image Width}
 
+% \subsection{Computing image width}
+
 % \DescribeLength{\KFLT at imagewidth} Computed width of the image
 %    \begin{macrocode}
 \newlength{\KFLT at imagewidth}
@@ -2413,9 +2413,6 @@
 %    \end{macrocode}
 %
 %
-%
-%
-%
 % \begin{macro}{\KFLT at findwidths} Figure out how wide to make an image and its container
 %    \begin{macrocode}
 \newcommand*{\KFLT at findwidths}{%
@@ -2422,35 +2419,35 @@
 %    \end{macrocode}
 % Default to a box of full \cs{linewidth} minus the potential frame:
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT at ft}}% tight frame?
-{\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTtightframewidth}}%
-{% not tight frame
-\ifthenelse{\boolean{KFLT at f}}% loose frame?
-{\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTlooseframewidth}}%
-{\setlength{\KFLT at boxwidth}{\linewidth}}% no frame
-}% not tight frame
+    \ifbool{KFLT at ft}% tight frame?
+        {\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTtightframewidth}}%
+        {% not tight frame
+            \ifbool{KFLT at f}% loose frame?
+                {\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTlooseframewidth}}%
+                {\setlength{\KFLT at boxwidth}{\linewidth}}% no frame
+        }% not tight frame
 %    \end{macrocode}
 % Several width options exist.  First see if width was given:
 %    \begin{macrocode}
-\ifthenelse{\dimtest{\KFLT at w}{>}{0pt}}%
+    \ifdimgreater{\KFLT at w}{0pt}%
 %    \end{macrocode}
 %  Width was given:
 %    \begin{macrocode}
-{\setlength{\KFLT at imagewidth}{\KFLT at w}}%
-{% width not given
+        {\setlength{\KFLT at imagewidth}{\KFLT at w}}%
+        {% width not given
 %    \end{macrocode}
 % Use full \cs{linewidth} or only a fraction:
 %    \begin{macrocode}
-\ifcsempty{\KFLT at lw}%
-{\setlength{\KFLT at imagewidth}{\KFLT at boxwidth}}%
-{\setlength{\KFLT at imagewidth}{\KFLT at lw\KFLT at boxwidth}}%
-}% width not given
+            \ifcsempty{\KFLT at lw}%
+            {\setlength{\KFLT at imagewidth}{\KFLT at boxwidth}}%
+            {\setlength{\KFLT at imagewidth}{\KFLT at lw\KFLT at boxwidth}}%
+        }% width not given
 }
 %    \end{macrocode}
 % \end{macro}
 %
 %
-% \subsection{Framing and Rotation}
+% \subsection{Framing and rotation}
 %
 %
 % A user-redefinable macro and length to tightly frame the contents.
@@ -2462,9 +2459,9 @@
 % \begin{macro}{\KFLT at tightframe} \marg{contents}
 %    \begin{macrocode}
 \newcommand{\KFLTtightframe}[1]{%
-\setlength{\fboxsep}{0pt}%
-\setlength{\fboxrule}{.4pt}%
-\fbox{#1}%
+    \setlength{\fboxsep}{0pt}%
+    \setlength{\fboxrule}{.4pt}%
+    \fbox{#1}%
 }
 
 %    \end{macrocode}
@@ -2487,9 +2484,9 @@
 %
 %    \begin{macrocode}
 \newcommand{\KFLTlooseframe}[1]{%
-\setlength{\fboxsep}{3pt}%
-\setlength{\fboxrule}{.4pt}%
-\fbox{#1}%
+    \setlength{\fboxsep}{3pt}%
+    \setlength{\fboxrule}{.4pt}%
+    \fbox{#1}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2507,13 +2504,13 @@
 %    \begin{macrocode}
 \newcommand{\KFLT at frame}[1]
 {%
-\ifthenelse{\boolean{KFLT at ft}}%
-{\KFLTtightframe{#1}}%
-{% not tightframe
-\ifthenelse{\boolean{KFLT at f}}%
-{\KFLTlooseframe{#1}}%
-{#1}% no frame
-}% not looseframe
+    \ifbool{KFLT at ft}%
+        {\KFLTtightframe{#1}}%
+        {% not tightframe
+            \ifbool{KFLT at f}%
+                {\KFLTlooseframe{#1}}%
+                {#1}% no frame
+        }% not looseframe
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2523,14 +2520,14 @@
 % Figures the width of the contents of \cs{KFLT at envbox} plus the frame:
 %    \begin{macrocode}
 \newcommand{\KFLT at findenvboxwidth}{%
-\settowidth{\KFLTimageboxwidth}{\usebox{\KFLT at envbox}}%
-\ifthenelse{\boolean{KFLT at ft}}%
-{\addtolength{\KFLTimageboxwidth}{2\KFLTtightframewidth}}%
-{% not tightframe
-\ifthenelse{\boolean{KFLT at f}}%
-{\addtolength{\KFLTimageboxwidth}{2\KFLTlooseframewidth}}%
-{}% no frame
-}% not looseframe
+    \settowidth{\KFLTimageboxwidth}{\usebox{\KFLT at envbox}}%
+    \ifbool{KFLT at ft}%
+        {\addtolength{\KFLTimageboxwidth}{2\KFLTtightframewidth}}%
+        {% not tightframe
+            \ifbool{KFLT at f}%
+                {\addtolength{\KFLTimageboxwidth}{2\KFLTlooseframewidth}}%
+                {}% no frame
+        }% not looseframe
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2538,7 +2535,7 @@
 %
 %
 %
-% \subsection{A Graphics Image from a File}
+% \subsection{A graphics image from a file}
 %
 % \begin{macro}{\KFLT at onefigureimage} Create a stand-alone figure with an image.
 %    \begin{macrocode}
@@ -2549,66 +2546,59 @@
 % and each is treated separately.
 % Scaling and width/height are done first, then framing, then rotation.
 %    \begin{macrocode}
-\begin{lrbox}{\KFLT at envbox}%
+    \begin{lrbox}{\KFLT at envbox}%
 %    \end{macrocode}
 % Handle the |lw| key.  If |lw| is used, width and height are ignored.
 %    \begin{macrocode}
-\ifthenelse{\NOT\equal{\KFLT at lw}{}}%
-{\includegraphics%
-[scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}}%
-{% not linewidth
+    \ifdefempty{\KFLT at lw}%
+    {% not linewidth
 %    \end{macrocode}
 % Handle the |w| key, which may be used along with the |h| key:
 %    \begin{macrocode}
-\ifthenelse{\dimtest{\KFLT at w}{>}{0pt}}%
-{% width is given
-\ifthenelse{\dimtest{\KFLT at h}{>}{0pt}}%
+        \ifdimgreater{\KFLT at w}{0pt}%
+        {% width is given
+            \ifdimgreater{\KFLT at h}{0pt}%
 %    \end{macrocode}
 % Width and height are both given:
 %    \begin{macrocode}
-{% w and h
-\includegraphics%
-[scale=\KFLT at s,%
-width=\KFLT at imagewidth,height=\KFLT at h]{\KFLT at i}%
-}% w and h
+            {% w and h
+                \includegraphics%
+                [scale=\KFLT at s,%
+                width=\KFLT at imagewidth,height=\KFLT at h]{\KFLT at i}%
+            }% w and h
 %    \end{macrocode}
 % Only width:
 %    \begin{macrocode}
-{% only w
-\includegraphics%
-[scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}%
-}% only w
-}% width is given
+            {% only w
+                \includegraphics%
+                [scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}%
+            }% only w
+        }% width is given
 %    \end{macrocode}
 % Width was not given, so maybe handle |h| alone:
 %    \begin{macrocode}
-{% width is not given
-\ifthenelse{\dimtest{\KFLT at h}{>}{0pt}}%
+        {% width is not given
+            \ifdimgreater{\KFLT at h}{0pt}%
 %    \end{macrocode}
 % |h| was given:
 %    \begin{macrocode}
-{\includegraphics%
-[scale=\KFLT at s,height=\KFLT at h]{\KFLT at i}}%
+                {\includegraphics[scale=\KFLT at s,height=\KFLT at h]{\KFLT at i}}%
 %    \end{macrocode}
 % If none were given, use the image's natural size:
 %    \begin{macrocode}
-{\includegraphics%
-[scale=\KFLT at s]{\KFLT at i}}%
-}% width is not given
-}% not linewidth
-\end{lrbox}%
-\unskip%
-\KFLT at findenvboxwidth%
-\begin{turn}{\KFLT at r}%
-%    \end{macrocode}
-% Encapsulate the frame in case the
-% custom frame commands used pars:
-%    \begin{macrocode}
-% \begin{minipage}{\KFLTimageboxwidth}%
-\KFLT at frame{\usebox{\KFLT at envbox}}%
-% \end{minipage}%
-\unskip%
-\end{turn}%
+                {\includegraphics[scale=\KFLT at s]{\KFLT at i}}%
+        }% width is not given
+    }% not linewidth
+    {% linewidth given
+        \includegraphics[scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}%
+    }%
+    \end{lrbox}%
+    \unskip%
+    \KFLT at findenvboxwidth%
+    \begin{turn}{\KFLT at r}%
+    \KFLT at frame{\usebox{\KFLT at envbox}}%
+    \unskip%
+    \end{turn}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2616,7 +2606,7 @@
 
 
 
-% \subsection{Printing the Caption}
+% \subsection{Printing the caption}
 %
 %
 % \begin{macro}{\KFLT at captioniftype} \marg{|figure| or |table|} \marg{\mainsubarg}
@@ -2627,9 +2617,9 @@
 % |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
 %    \begin{macrocode}
 \newcommand*{\KFLT at captioniftype}[2]{%
-\ifthenelse{\equal{\csname KFLT@#2type\endcsname}{#1}}%
-{\KFLT at caption{#2}}%
-{}%
+    \ifcsstring{KFLT@#2type}{#1}%
+        {\KFLT at caption{#2}}%
+        {}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2644,14 +2634,10 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\KFLT at 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}}}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2684,47 +2670,47 @@
 %    \end{macrocode}
 % Is this a figure?
 %    \begin{macrocode}
-\ifthenelse{\equal{\csname KFLT@#4type\endcsname}{figure}}%
-{% figure
+    \ifcsstring{KFLT@#4type}{figure}%
+    {% figure
 %    \end{macrocode}
 % Is the last name empty?  Assume no artist if so.
 %    \begin{macrocode}
-\ifcsempty{KFLT@#4al}%
-{% figure w/o artist
+        \ifcsempty{KFLT@#4al}%
+        {% figure w/o artist
 %    \end{macrocode}
 % A figure without an artist uses the simple caption.
 %    \begin{macrocode}
-\KFLT at dosimplecaption{#1}{#2}{#3}%
-}% figure w/o artist
-{% figure with an artist
+            \KFLT at dosimplecaption{#1}{#2}{#3}%
+        }% figure w/o artist
+        {% figure with an artist
 %    \end{macrocode}
 % A figure with an artist uses the \pkg{tocdata} \cs{captionartist} macro,
 % which also creates an index entry.
 %    \begin{macrocode}
-\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:
+            \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:
 %    \end{macrocode}
 % If it isn't a figure, ignore artist information and create a simple caption:
 %    \begin{macrocode}
-\KFLT at dosimplecaption{#1}{#2}{#3}%
-}% not a figure
+        \KFLT at dosimplecaption{#1}{#2}{#3}%
+    }% not a figure
 }% KFLT at tocdata
 }% tocdata loaded
 {% no tocdata
@@ -2733,17 +2719,17 @@
 %    \end{macrocode}
 % If \pkg{tocdata} is not loaded, use a simple caption.
 %    \begin{macrocode}
-\KFLT at dosimplecaption{#1}{#2}{#3}%
+    \KFLT at dosimplecaption{#1}{#2}{#3}%
 %    \end{macrocode}
 % Create an index entry depending on whether there is a last, first name:
 %    \begin{macrocode}
-\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
+    \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 at docaption
 }% no tocdata
 %    \end{macrocode}
@@ -2764,100 +2750,100 @@
 %    \end{macrocode}
 % A starred caption is printed but not numbered.
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT@#1cstar}}% starred caption?
+    \ifbool{KFLT@#1cstar}% starred caption?
 %    \end{macrocode}
 % This is a starred caption:
 %    \begin{macrocode}
-{%starred caption
+    {%starred caption
 %    \end{macrocode}
 % A key given as |cstar={}| yields a float with no caption at all.
 %    \begin{macrocode}
-\ifcsempty{KFLT@#1c}% cstar={}?
-{}%
+        \ifcsempty{KFLT@#1c}% cstar={}?
+        {}%
 %    \end{macrocode}
 % Non-empty starred caption might have a \acro{LOF} entry
 % if it has a short caption |sc| key:
 %    \begin{macrocode}
-{% non-empty starred caption
-\ifcsempty{KFLT@#1sc}%
+        {% non-empty starred caption
+            \ifcsempty{KFLT@#1sc}%
 %    \end{macrocode}
 % No |sc| short caption, but there is a |cstar|, so no \acro{LOF} entry:
 %    \begin{macrocode}
-{}%
+            {}%
 %    \end{macrocode}
 % Both |cstar| and |sc| were given, so add a \acro{LOF} entry:
 %    \begin{macrocode}
-{% non-empty cstar and sc:
-\addcontentsline{\KFLT at listtype}%
-{\csname KFLT@#1type\endcsname}{\KFLT at sc}%
-}% non-empty cstar and sc
+            {% non-empty cstar and sc:
+                \addcontentsline{\KFLT at listtype}%
+                {\csname KFLT@#1type\endcsname}{\KFLT at sc}%
+            }% non-empty cstar and sc
 %    \end{macrocode}
 % |cstar| was given, so create an unnumbered caption:
 %    \begin{macrocode}
-\KFLT at docaption*{\csname KFLT@#1c\endcsname}{#1}%
-}%
-}% starred caption
+            \KFLT at docaption*{\csname KFLT@#1c\endcsname}{#1}%
+        }%
+    }% starred caption
 %    \end{macrocode}
 % Unstarred caption |c| was given, so number this float:
 %    \begin{macrocode}
-{% unstarred caption
-\ifcsempty{KFLT@#1sc}%
-{% no short cap
-\KFLT at docaption{\csname KFLT@#1c\endcsname}{#1}%
-}% no short cap
-{% short cap
-\KFLT at docaption[\csname KFLT@#1sc\endcsname]%
-{\csname KFLT@#1c\endcsname}{#1}%
-}% short cap
+    {% unstarred caption
+        \ifcsempty{KFLT@#1sc}%
+        {% no short cap
+            \KFLT at docaption{\csname KFLT@#1c\endcsname}{#1}%
+        }% no short cap
+        {% short cap
+            \KFLT at docaption[\csname KFLT@#1sc\endcsname]%
+            {\csname KFLT@#1c\endcsname}{#1}%
+        }% short cap
 %    \end{macrocode}
 % Optional label:
 %    \begin{macrocode}
-\ifcsempty{KFLT@#1l}%
-{}%
-{\label{\csname KFLT@#1l\endcsname}}%
-}% unstarred caption
+        \ifcsempty{KFLT@#1l}%
+        {}%
+        {\label{\csname KFLT@#1l\endcsname}}%
+    }% unstarred caption
 }
 %    \end{macrocode}
 % \end{macro}
 
 
-% \subsection{Defaults for a New Float}
+% \subsection{Defaults for a new float}
 
 % \begin{macro}{\KFLT at defaults} Defaults all settings before reading the keys.
 %    \begin{macrocode}
 \newcommand*{\KFLT at defaults}{%
-\setboolean{KFLT at cont}{false}%
-\renewcommand{\KFLT at c}{}%
-\setboolean{KFLT at cstar}{false}%
-\renewcommand{\KFLT at sc}{}%
-\setboolean{KFLT at scgiven}{false}%
-\renewcommand{\KFLT at type}{figure}%
-\renewcommand{\KFLT at listtype}{lof}%
-\renewcommand{\KFLT at l}{}%
-\renewcommand{\KFLT at ap}{}%
-\renewcommand{\KFLT at af}{}%
-\renewcommand{\KFLT at al}{}%
-\renewcommand{\KFLT at as}{}%
-\renewcommand{\KFLT at t}{}%
-\renewcommand{\KFLT at textalign}{}%
-\tdtextjustify%
-\renewcommand{\KFLT at i}{}%
-\renewcommand{\KFLT at lw}{}%
-\setlength{\KFLT at w}{0pt}%
-\setlength{\KFLT at h}{0pt}%
-\renewcommand{\KFLT at s}{1}%
-\renewcommand{\KFLT at r}{0}%
-\setboolean{KFLT at f}{false}%
-\setboolean{KFLT at ft}{false}%
-\renewcommand{\KFLT at stretch}{1}%
-\setlength{\KFLT at mo}{-1.2ex}%
-\renewcommand{\KFLT at wp}{O}%
-\renewcommand{\KFLT at va}{c}%
+    \setboolean{KFLT at cont}{false}%
+    \renewcommand{\KFLT at c}{}%
+    \setboolean{KFLT at cstar}{false}%
+    \renewcommand{\KFLT at sc}{}%
+    \setboolean{KFLT at scgiven}{false}%
+    \renewcommand{\KFLT at type}{figure}%
+    \renewcommand{\KFLT at listtype}{lof}%
+    \renewcommand{\KFLT at l}{}%
+    \renewcommand{\KFLT at ap}{}%
+    \renewcommand{\KFLT at af}{}%
+    \renewcommand{\KFLT at al}{}%
+    \renewcommand{\KFLT at as}{}%
+    \renewcommand{\KFLT at t}{}%
+    \renewcommand{\KFLT at textalign}{}%
+    \tdtextjustify%
+    \renewcommand{\KFLT at i}{}%
+    \renewcommand{\KFLT at lw}{}%
+    \setlength{\KFLT at w}{0pt}%
+    \setlength{\KFLT at h}{0pt}%
+    \renewcommand{\KFLT at s}{1}%
+    \renewcommand{\KFLT at r}{0}%
+    \setboolean{KFLT at f}{false}%
+    \setboolean{KFLT at ft}{false}%
+    \renewcommand{\KFLT at stretch}{1}%
+    \setlength{\KFLT at mo}{-1.2ex}%
+    \renewcommand{\KFLT at wp}{O}%
+    \renewcommand{\KFLT at va}{c}%
 }
 %    \end{macrocode}
 % \end{macro}
 
-% \subsection{Row Start/End Processing}
+% \subsection{Row start/end processing}
 
 % \begin{macro}{\KFLT at maybestartfloatrow} Counts rows
 %
@@ -2865,8 +2851,8 @@
 % The use of \cs{defcounter} makes this counter change local.
 %    \begin{macrocode}
 \newcommand*{\KFLT at maybestartfloatrow}{%
-\KFLT at maybeendfloatrow%
-\defcounter{KFLT at thiscol}{\value{KFLT at thiscol}+1}%
+    \KFLT at maybeendfloatrow%
+    \defcounter{KFLT at thiscol}{\value{KFLT at thiscol}+1}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2878,13 +2864,14 @@
 % The use of \cs{defcounter} makes this counter change local.
 %    \begin{macrocode}
 \newcommand*{\KFLT at maybeendfloatrow}{%
-\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>=}{\value{KFLT at numcols}}}%
-{%
+    \ifnumless{\value{KFLT at thiscol}}{\value{KFLT at numcols}}%
+    {}% thiscol < numcols
+    {% >=
 
-\addvspace{.75\floatsep}%
+        \addvspace{.75\floatsep}
 
-\defcounter{KFLT at thiscol}{0}%
-}{}%
+        \defcounter{KFLT at thiscol}{0}%
+    }%
 }%
 %    \end{macrocode}
 % \end{macro}
@@ -2894,7 +2881,7 @@
 
 
 
-% \subsection{Key Environment Helper Macros}
+% \subsection{Key environment helper macros}
 
 
 % \begin{macro}{\KFLT at trackrows} Tracks and spaces rows and columns.
@@ -2904,22 +2891,23 @@
 %    \end{macrocode}
 % If are nested inside a keyfloats or a subfloat:
 %    \begin{macrocode}
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{% nested
+    \ifboolexpr{%
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
+        bool{KFLT at inkeysubfloats}%
+    }%
+    {% nested
 %    \end{macrocode}
 % Tracks row start and end:
 %    \begin{macrocode}
-\KFLT at maybestartfloatrow%
+        \KFLT at maybestartfloatrow%
 %    \end{macrocode}
 % Possibly fill space between columns:
 %    \begin{macrocode}
-\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>}{1}}%
-{\hfill}{}%
-}% nested
-{}% not nested
+        \ifnumgreater{\value{KFLT at thiscol}}{1}%
+            {\hfill}%
+            {}%
+    }% nested
+    {}% not nested
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2926,9 +2914,6 @@
 
 
 
-
-
-
 % \begin{macro}{\KFLT at addtext} \marg{\mainsubarg}
 %
 % Adds optional additional text.
@@ -2944,34 +2929,34 @@
 %    \end{macrocode}
 % Is there text to add?
 %    \begin{macrocode}
-\ifcsempty{KFLT@#1t}%
-{}% no text
-{% text to add
-{% local
+    \ifcsempty{KFLT@#1t}%
+    {}% no text
+    {% text to add
+        {% local
 %    \end{macrocode}
 % Add some space, then create a full-width minipage to contain the text:
 %    \begin{macrocode}
-\unskip%
-\addvspace{2ex}%
-\begin{minipage}{\linewidth}%
+        \unskip%
+        \addvspace{2ex}%
+        \begin{minipage}{\linewidth}%
 %    \end{macrocode}
 % Set the alignment and some text parameters:
 %    \begin{macrocode}
-\csname KFLT@#1textalign\endcsname%
-\footnotesize%
-\setlength{\parskip}{1.5ex}%
-\setlength{\parindent}{0em}%
+        \csname KFLT@#1textalign\endcsname%
+        \footnotesize%
+        \setlength{\parskip}{1.5ex}%
+        \setlength{\parindent}{0em}%
 %    \end{macrocode}
 % Typeset the actual text:
 %    \begin{macrocode}
-\csname KFLT@#1t\endcsname%
+        \csname KFLT@#1t\endcsname%
 %    \end{macrocode}
 % Close it all out with a little more space:
 %    \begin{macrocode}
-\end{minipage}%
-\par\addvspace{2ex}%
-}% local
-}% text to add
+        \end{minipage}%
+        \par\addvspace{2ex}%
+        }% local
+    }% text to add
 }
 %    \end{macrocode}
 % \end{macro}
@@ -2985,9 +2970,9 @@
 %    \begin{macrocode}
 \newcommand{\KFLT at optionalname}[1]
 {%
-\ifthenelse{\equal{#1}{}}%
-{}%
-{#1~}%
+    \ifblank{#1}%
+        {}%
+        {#1~}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3021,25 +3006,25 @@
 %    \end{macrocode}
 % Only use the artist name if this is a figure:
 %    \begin{macrocode}
-\ifthenelse{\equal{\csname KFLT@#1type\endcsname}{figure}}%
-{% figure
+    \ifcsstring{KFLT@#1type}{figure}%
+    {% figure
 %    \end{macrocode}
 % Only use the artist name if a last name is given:
 %    \begin{macrocode}
-\ifcsempty{KFLT@#1al}%
+        \ifcsempty{KFLT@#1al}%
 %    \end{macrocode}
 % A figure but no artist:
 %    \begin{macrocode}
-{\KFLT at addtext{#1}}%
+            {\KFLT at addtext{#1}}%
 %    \end{macrocode}
 % A figure with an artist: will be handled by \pkg{tocdata} when the caption is created.
 %    \begin{macrocode}
-{}% fig w/ artist: text will be added by \captionartist in \KFLT at caption
-}% figure
+            {}% fig w/ artist: text will be added by \captionartist in \KFLT at caption
+    }% figure
 %    \end{macrocode}
 % If not a figure, ignore artist information:
 %    \begin{macrocode}
-{\KFLT at addtext{#1}}%
+    {\KFLT at addtext{#1}}%
 }% KFLT at addartisttext
 }% tocdata loaded
 %    \end{macrocode}
@@ -3051,29 +3036,29 @@
 %    \end{macrocode}
 % Only use the artist information if a last name is given:
 %    \begin{macrocode}
-\ifcsempty{KFLT@#1al}%
-{}% last name not given
-{% last name given
+    \ifcsempty{KFLT@#1al}%
+    {}% last name not given
+    {% last name given
 %    \end{macrocode}
 % Add space and create the name inside a full-width minipage:
 %    \begin{macrocode}
-\addvspace{2ex}%
-\begin{minipage}{\linewidth}%
+        \addvspace{2ex}%
+        \begin{minipage}{\linewidth}%
 %    \end{macrocode}
 % If \pkg{tocdata} is not used, the artist's name is always centered:
 %    \begin{macrocode}
-\centering\footnotesize\textsc{%
-\KFLT at optionalname{\csname KFLT@#1ap\endcsname}%
-\KFLT at optionalname{\csname KFLT@#1af\endcsname}%
-\csname KFLT@#1al\endcsname\csname KFLT@#1as\endcsname%
-}%
-\end{minipage}%
-\par\addvspace{2ex}%
-}% last name given
+        \centering\footnotesize\textsc{%
+        \KFLT at optionalname{\csname KFLT@#1ap\endcsname}%
+        \KFLT at optionalname{\csname KFLT@#1af\endcsname}%
+        \csname KFLT@#1al\endcsname\csname KFLT@#1as\endcsname%
+        }%
+        \end{minipage}%
+        \par\addvspace{2ex}%
+    }% last name given
 %    \end{macrocode}
 % Any additional text follows the artist's name:
 %    \begin{macrocode}
-\KFLT at addtext{#1}%
+    \KFLT at addtext{#1}%
 }% KFLT at addartisttext
 }% tocdata not loaded
 %    \end{macrocode}
@@ -3102,37 +3087,37 @@
 %    \end{macrocode}
 % (Possibly) frame the contents of an \env{lrbox}:
 %    \begin{macrocode}
-\begin{lrbox}{\KFLT at envbox}%
+    \begin{lrbox}{\KFLT at envbox}%
 %    \end{macrocode}
 % Rotate the contents:
 %    \begin{macrocode}
-\turn{\KFLT at r}%
+    \turn{\KFLT at r}%
 %    \end{macrocode}
 % Box the contents in the width computed by \cs{KFLT at findwidths}:
 %    \begin{macrocode}
-\minipage{\KFLT at imagewidth}%
+    \minipage{\KFLT at imagewidth}%
 %    \end{macrocode}
 % Spacing inside the box.
 % Also default to regular justified text alignment.
 %    \begin{macrocode}
-\setlength{\parskip}{2ex}%
-\renewcommand{\arraystretch}{\KFLT at stretch}%
+    \setlength{\parskip}{2ex}%
+    \renewcommand{\arraystretch}{\KFLT at stretch}%
 }% keyboxinner
 %    \end{macrocode}
 % End of the environment:
 %    \begin{macrocode}
 {% endkeyboxinner
-\endminipage%
+    \endminipage%
 %    \end{macrocode}
 % End the rotated box:
 %    \begin{macrocode}
-\endturn%
+    \endturn%
 %    \end{macrocode}
 % Possibly frame:
 %    \begin{macrocode}
-\end{lrbox}%
-\KFLT at frame{\usebox{\KFLT at envbox}}%
-\par\addvspace{2ex}%
+    \end{lrbox}%
+    \KFLT at frame{\usebox{\KFLT at envbox}}%
+    \par\addvspace{2ex}%
 }% endkeyboxinner
 %    \end{macrocode}
 % \end{environment}
@@ -3144,10 +3129,10 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\KFLT at boxkeys}{+m m m}
 {%
-\KFLT at defaults%
-\renewcommand{\KFLT at type}{#2}%
-\renewcommand{\KFLT at listtype}{#3}%
-\setkeys{KFLT at keys}{#1}%
+    \KFLT at defaults%
+    \renewcommand{\KFLT at type}{#2}%
+    \renewcommand{\KFLT at listtype}{#3}%
+    \setkeys{KFLT at keys}{#1}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3174,20 +3159,20 @@
 %
 % Start the new subfigure or subtable, of the given width:
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT at inkeysubfloats}}%
-{\csname sub\KFLT at type\endcsname{\KFLT at rowboxwidth}}% subfloat
+    \ifbool{KFLT at inkeysubfloats}%
+    {\csname sub\KFLT at type\endcsname{\KFLT at rowboxwidth}}% subfloat
 %    \end{macrocode}
 % If \env{keyfloats}, place the contents inside a \env{minipage}:
 %    \begin{macrocode}
-{% not subfloat:
-\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}%
-{% keyfloats
-\ifbool{KFLT at keywrap}
-{\minipage[t]{\KFLT at rowboxwidth}}%
-{\minipage[\KFLT at va]{\KFLT at rowboxwidth}}%
-\captionsetup*{type=\KFLT at type}%
-}% keyfloats
-{% not keyfloats
+    {% not subfloat:
+        \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}%
+        {% keyfloats
+            \ifbool{KFLT at keywrap}%
+                {\minipage[t]{\KFLT at rowboxwidth}}%
+                {\minipage[\KFLT at va]{\KFLT at rowboxwidth}}%
+            \captionsetup*{type=\KFLT at type}%
+        }% keyfloats
+        {% not keyfloats
 %    \end{macrocode}
 %
 % Not a subfloat or \env{keyfloats}, so create a single float.
@@ -3195,91 +3180,94 @@
 % See if inside a \env{keywrap}.
 % If so, force [H] and vertical align top.
 %    \begin{macrocode}
-\ifbool{KFLT at keywrap}%
-{%
-\par\addvspace{\baselineskip}%
-\noindent\minipage[t]{\linewidth}%
-\captionsetup{type=\KFLT at type}%
-}%
-{% not a keywrap
+            \ifbool{KFLT at keywrap}%
+            {%
+                \par\addvspace{\baselineskip}%
+                \noindent\minipage[t]{\linewidth}%
+                \captionsetup{type=\KFLT at type}%
+            }%
+            {% not a keywrap
 %    \end{macrocode}
 %
 % See if the float should [W]rap:
 %
 %    \begin{macrocode}
-\ifthenelse{\equal{#2}{W}}%
+                \ifstrequal{#2}{W}%
 %    \end{macrocode}
 % Place [W], so create a wrapfloat from the \pkg{wrapfig} package:
 %    \begin{macrocode}
-{% [W]
+                {% [W]
 %    \end{macrocode}
 % Temporarily figure out \cs{KFLT at imagewidth},
 % and make the wrapped figure environment as wide as the
 % desired image size plus frame:
 %    \begin{macrocode}
-\KFLT at findwidths%
-\csname wrap\KFLT at type\endcsname{\KFLT at wp}%
-{\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                \KFLT at findwidths%
+                \csname wrap\KFLT at type\endcsname{\KFLT at wp}%
+                {\KFLT at imagewidth+2\KFLTlooseframewidth}%
 %    \end{macrocode}
 % Change the interior image to the discovered fixed width.
 %    \begin{macrocode}
-\renewcommand{\KFLT at lw}{}%
-\renewcommand{\KFLT at w}{\KFLT at imagewidth}%
-}% [W]
-{% not [W]
+                \renewcommand{\KFLT at lw}{}%
+                \renewcommand{\KFLT at w}{\KFLT at imagewidth}%
+                }% [W]
+                {% not [W]
+%    \end{macrocode}
 %
 % See if the float should be positioned in the [M]argin:
 %    \begin{macrocode}
-\ifthenelse{\equal{#2}{M}}%
+                    \ifstrequal{#2}{M}%
 %    \end{macrocode}
 % Place [M], so create a marginfloat:
 %    \begin{macrocode}
-{% [M]
-\csname margin\KFLT at type\endcsname[\KFLT at mo]%
-\captionsetup{type=\KFLT at type}%
-}% [M]
-{% not [M}
+                    {% [M]
+                        \csname margin\KFLT at type\endcsname[\KFLT at mo]%
+                        \captionsetup{type=\KFLT at type}%
+                    }% [M]
+                    {% not [M}
+%    \end{macrocode}
 %
 % See if the float should be positioned [H]ere:
 %    \begin{macrocode}
-\ifthenelse{\equal{#2}{H}}%
+                        \ifstrequal{#2}{H}%
 %    \end{macrocode}
 % Place [H], so create an inline minipage:
 %    \begin{macrocode}
-{% [H]
-\par\addvspace{\baselineskip}%
-\noindent\minipage[\KFLT at va]{\linewidth}%
-\captionsetup{type=\KFLT at type}%
-}% [H]
+                        {% [H]
+                            \par\addvspace{\baselineskip}%
+                            \noindent\minipage[\KFLT at va]{\linewidth}%
+                            \captionsetup{type=\KFLT at type}%
+                        }% [H]
 %    \end{macrocode}
 % Not [H], so create a float:
 % For a starred float, make a two-column table in a two-col format.
 %    \begin{macrocode}
-{% not [H]
-\IfBooleanTF{#1}%
-{\csname \KFLT at type*\endcsname[#2]}{\csname \KFLT at type\endcsname[#2]}%
-}% not [H]
-}% not [M]
-}% not [W]
-}% not keywrap
-}% not keyfloats
-}% not subfloat
+                        {% not [H]
+                            \IfBooleanTF{#1}%
+                                {\csname \KFLT at type*\endcsname[#2]}%
+                                {\csname \KFLT at type\endcsname[#2]}%
+                        }% not [H]
+                    }% not [M]
+                }% not [W]
+            }% not keywrap
+        }% not keyfloats
+    }% not subfloat
 %    \end{macrocode}
 % Handle a continued float.  Ignored if in a subfloat.
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT at cont}}{\ContinuedFloat}{}%
+    \ifbool{KFLT at cont}{\ContinuedFloat}{}%
 %    \end{macrocode}
 % Figure out image and parbox widths for the contents:
 %    \begin{macrocode}
-\KFLT at findwidths%
+    \KFLT at findwidths%
 %    \end{macrocode}
 % If a table, place the caption above the contents:
 %    \begin{macrocode}
-\KFLT at captioniftype{table}{}%
+    \KFLT at captioniftype{table}{}%
 %    \end{macrocode}
 % Typeset the contents:
 %    \begin{macrocode}
-\center\unskip%
+    \center\unskip%
 }% boxouter
 %    \end{macrocode}
 %
@@ -3287,26 +3275,26 @@
 %
 %    \begin{macrocode}
 {% endboxouter
-\endcenter\unskip%
+    \endcenter\unskip%
 %    \end{macrocode}
 % Optionally print artist's name and additional text:
 %    \begin{macrocode}
-\KFLT at addartisttext{}%
+    \KFLT at addartisttext{}%
 %    \end{macrocode}
 % If a figure, typeset the caption below the contents:
 %    \begin{macrocode}
-\KFLT at captioniftype{figure}{}%
+    \KFLT at captioniftype{figure}{}%
 %    \end{macrocode}
 % If are inside \env{keysubtabs}, end the subtable:
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT at inkeysubfloats}}%
-{
-\csname endsub\KFLT at type\endcsname
-}% subfloat
-{% not subfloat
-\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}% keyfloats?
-{\endminipage}% keyfloats
-{% not keyfloats
+    \ifbool{KFLT at inkeysubfloats}%
+    {%
+        \csname endsub\KFLT at type\endcsname%
+    }% subfloat
+    {% not subfloat
+        \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}% keyfloats?
+        {\endminipage}% keyfloats
+        {% not keyfloats
 %    \end{macrocode}
 %
 % Not subfloat or \env{keyfloats}, so is an individual float.
@@ -3315,48 +3303,50 @@
 %
 % See if in a \env{keywrap}:
 %    \begin{macrocode}
-\ifbool{KFLT at keywrap}{%
-\endminipage%
-\par\addvspace{\baselineskip}%
-}
-{% not keywrap
+            \ifbool{KFLT at keywrap}{%
+                \endminipage%
+                \par\addvspace{\baselineskip}%
+            }%
+            {% not keywrap
 %    \end{macrocode}
 %
 % See if the float should [W]rap:
 %    \begin{macrocode}
-\ifthenelse{\equal{#2}{W}}%
+                \ifstrequal{#2}{W}%
 %    \end{macrocode}
 % Place [W], so close the wrap float:
 %    \begin{macrocode}
-{% [W]
-\csname endwrap\KFLT at type\endcsname%
-}% [W]
-{% not[W]
+                {% [W]
+                    \csname endwrap\KFLT at type\endcsname%
+                }% [W]
+                {% not[W]
+%    \end{macrocode}
 %
 % See if the float should be positioned in the [M]argin:
 %    \begin{macrocode}
-\ifthenelse{\equal{#2}{M}}%
+                    \ifstrequal{#2}{M}%
 %    \end{macrocode}
 % Place [M], so close the marginfloat:
 %    \begin{macrocode}
-{% [M]
-\csname endmargin\KFLT at type\endcsname%
-}% [M]
-{% not [M]
-\ifthenelse{\equal{#2}{H}}%
-{%
-\endminipage% [H]
-\par\addvspace{\baselineskip}%
-}%
-{% not [H]
-\IfBooleanTF{#1}% starred float?
-{\csname end\KFLT at type*\endcsname}{\csname end\KFLT at type\endcsname}%
-}% not [H]
-}% not [M]
-}% not [W]
-}% not keywrap
-}% not keyfloats
-}% not subfloat
+                    {% [M]
+                        \csname endmargin\KFLT at type\endcsname%
+                    }% [M]
+                    {% not [M]
+                        \ifstrequal{#2}{H}%
+                        {%
+                            \endminipage% [H]
+                            \par\addvspace{\baselineskip}%
+                        }%
+                        {% not [H]
+                            \IfBooleanTF{#1}% starred float?
+                                {\csname end\KFLT at type*\endcsname}%
+                                {\csname end\KFLT at type\endcsname}%
+                        }% not [H]
+                    }% not [M]
+                }% not [W]
+            }% not keywrap
+        }% not keyfloats
+    }% not subfloat
 }% endkeyboxouter
 %    \end{macrocode}
 % \end{environment}
@@ -3363,19 +3353,19 @@
 
 
 
-% \subsection{The \env{keyfigure} Environment}
+% \subsection{The \env{keyfigure} environment}
 
 % \begin{environment}{keyfigure} * \oarg{loc} \marg{\keyvalsarg}
 %    \begin{macrocode}
 \NewDocumentEnvironment{keyfigure}{s O{tbp} +m}
 {%
-\KFLT at boxkeys{#3}{figure}{lof}%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
+    \KFLT at boxkeys{#3}{figure}{lof}%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
 }%
 {%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3387,12 +3377,12 @@
 %
 %    \begin{macrocode}
 \BeforeBeginEnvironment{keyfigure}{%
-\KFLT at trackrows%
+    \KFLT at trackrows%
 }
 %    \end{macrocode}
 
 
-% \subsection{The \cs{keyfig} Macro}
+% \subsection{The \cs{keyfig} macro}
 
 % \begin{macro}{\keyfig} * \oarg{2: loc} \marg{3: \keyvalsarg} \marg{4: image filename}
 %
@@ -3404,17 +3394,17 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\keyfig}{s O{tbp} +m m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{figure}{lof}%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{figure}{lof}%
 %    \end{macrocode}
 % After setting default values, override with the filename:
 %    \begin{macrocode}
-\renewcommand{\KFLT at i}{#4}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at onefigureimage%
-\endKFLT at boxouter%
-\endgroup%
+    \renewcommand{\KFLT at i}{#4}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at onefigureimage%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3421,7 +3411,7 @@
 
 
 
-% \subsection{The \cs{keyfigbox} Macro}
+% \subsection{The \cs{keyfigbox} macro}
 
 % \begin{macro}{\keyfigbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents}
 %
@@ -3433,21 +3423,21 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{figure}{lof}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-#4%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
-\endgroup%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{figure}{lof}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    #4%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 %    \end{macrocode}
 % \end{macro}
 
 
-% \subsection{The \cs{keyparbox} Macro}
+% \subsection{The \cs{keyparbox} macro}
 
 % \begin{macro}{\keyparbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents}
 %
@@ -3461,29 +3451,29 @@
 %    \begin{macrocode}
 \NewDocumentCommand{\keyparbox}{s O{tbp} +m +m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{figure}{lof}%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{figure}{lof}%
 %    \end{macrocode}
 % Force |cstar={}|:
 %    \begin{macrocode}
-\renewcommand{\KFLT at c}{}%
-\setboolean{KFLT at cstar}{true}%
+    \renewcommand{\KFLT at c}{}%
+    \setboolean{KFLT at cstar}{true}%
 %    \end{macrocode}
 % Continue like \cs{figbox}:
 %    \begin{macrocode}
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-#4%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
-\endgroup%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    #4%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 %    \end{macrocode}
 % \end{macro}
 
 
-% \subsection{The \cs{keytab} Macro}
+% \subsection{The \cs{keytab} macro}
 
 % \begin{macro}{\keytab} * \oarg{loc} \marg{\keyvalsarg} \marg{tabular contents}
 %
@@ -3495,35 +3485,35 @@
 %    \begin{macrocode}+
 \NewDocumentCommand{\keytab}{s O{tbp} +m +m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{table}{lot}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-\centering%
-#4%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
-\endgroup%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{table}{lot}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    \centering%
+    #4%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 %    \end{macrocode}
 % \end{macro}
 
 
-% \subsection{The \env{keytable} Environment}
+% \subsection{The \env{keytable} environment}
 
 % \begin{environment}{keytable} * \oarg{loc} \marg{\keyvalsarg}
 %    \begin{macrocode}
 \NewDocumentEnvironment{keytable}{s O{tbp} +m}
 {%
-\KFLT at boxkeys{#3}{table}{lot}%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-\centering%
+    \KFLT at boxkeys{#3}{table}{lot}%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    \centering%
 }%
 {%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3535,33 +3525,39 @@
 %
 %    \begin{macrocode}
 \BeforeBeginEnvironment{keytable}{%
-\KFLT at trackrows%
+    \KFLT at trackrows%
 }
 %    \end{macrocode}
 
 
 
-% \subsection{A Row of Floats}
+% \subsection{A row of floats}
 
 % \begin{macro}{\KFLT at nonest} Error message if tried to nest subfloats.
 %    \begin{macrocode}
 \newcommand*{\KFLT at nonest}{%
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at 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 at keyfloatdepth}}{0}} or
+        bool {KFLT at 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.%
+        }%
+    }%
+    {}%
 }
 %    \end{macrocode}
 % \end{macro}
 
+
 % \begin{environment}{keyfloats} * \oarg{loc} \marg{num columns}
 %
 % User-level macro to create rows of figures/tables.
@@ -3587,69 +3583,74 @@
 %    \end{macrocode}
 % Nest the environment:
 %    \begin{macrocode}
-\addtocounter{KFLT at keyfloatdepth}{1}%
+    \addtocounter{KFLT at keyfloatdepth}{1}%
 %    \end{macrocode}
 % If [H], nested, subfloats, or keywrap, use a minipage instead of a float:
 %    \begin{macrocode}
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-\OR\boolean{KFLT at keywrap}%
-}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+        bool {KFLT at inkeysubfloats} or
+        bool {KFLT at keywrap}
+    }%
 %    \end{macrocode}
 % Create an inline minipage:
 %    \begin{macrocode}
-{% [H] or nested
+    {% [H] or nested
 %    \end{macrocode}
 % If nested, use different spacing as was computed in the outer nesting level:
 %    \begin{macrocode}
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{\noindent%
-\begin{minipage}{\KFLT at rowboxwidth}%
-}%
-{\bigbreak%
-\noindent\begin{minipage}{\linewidth}}%
+        \ifboolexpr{%
+            test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+            bool {KFLT at inkeysubfloats}
+        }%
+        {%
+            \noindent%
+            \begin{minipage}{\KFLT at rowboxwidth}%
+        }%
+        {%
+            \bigbreak%
+            \noindent\begin{minipage}{\linewidth}%
+        }%
 %    \end{macrocode}
 % If inside subfloats, generate subfigures by default:
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT at inkeysubfloats}}%
-{}{\captionsetup*{type=figure}}%
-}% [H] or nested
+        \ifbool{KFLT at inkeysubfloats}%
+            {}%
+            {\captionsetup*{type=figure}}%
+    }% [H] or nested
 %    \end{macrocode}
 % Isn't [H] or nested, so create a figure:
 %    \begin{macrocode}
-{% figure
-\IfBooleanTF{#1}% starred figure, two-col figure in a two-col format
-{\begin{figure*}[#2]}{\begin{figure}[#2]}%
-}% figure
+    {% figure
+        \IfBooleanTF{#1}% starred figure, two-col figure in a two-col format
+            {\begin{figure*}[#2]}%
+            {\begin{figure}[#2]}%
+    }% figure
 %    \end{macrocode}
 % Compute the width of each entry:
 %    \begin{macrocode}
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
+    \ifboolexpr{%
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+        bool {KFLT at inkeysubfloats}
+    }%
 %    \end{macrocode}
 % Nested or subfloats:
 %    \begin{macrocode}
-{\setlength{\KFLT at rowboxwidth}{.9\KFLT at rowboxwidth/\real{#3}}}%
+        {\setlength{\KFLT at rowboxwidth}{.9\KFLT at rowboxwidth/\real{#3}}}%
 %    \end{macrocode}
 % Keyfloats:
 %    \begin{macrocode}
-{\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
+        {\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
 %    \end{macrocode}
 % Center the contents:
 %    \begin{macrocode}
-\centering%
+    \centering%
 %    \end{macrocode}
 % Count columns using \cs{defcounter} for a local effect:
 %    \begin{macrocode}
-\defcounter{KFLT at numcols}{#3}%
-\defcounter{KFLT at thiscol}{0}%
+    \defcounter{KFLT at numcols}{#3}%
+    \defcounter{KFLT at thiscol}{0}%
 }% starting keyfloats environment
 %    \end{macrocode}
 %
@@ -3659,33 +3660,34 @@
 %    \end{macrocode}
 % [H] or rows/subfigs? Close a minipage:
 %    \begin{macrocode}
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{\end{minipage}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+        bool {KFLT at inkeysubfloats} or
+        bool {KFLT at keywrap}
+    }%
+    {% was [H], etc.
+        \end{minipage}%
 %    \end{macrocode}
 % Spacing if nested:
 %    \begin{macrocode}
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{}{\bigbreak}%
-}% was [H]
+        \ifboolexpr{%
+            test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
+            bool {KFLT at keywrap}
+        }%
+        {}{\bigbreak}%
+    }% was [H], etc.
 %    \end{macrocode}
 % Was not [H], so close a figure:
 %    \begin{macrocode}
-{% not [H]
-\IfBooleanTF{#1}% starred figure?
-{\end{figure*}}{\end{figure}}%
-}% not [H]
+    {% not [H], etc.
+        \IfBooleanTF{#1}% starred figure?
+            {\end{figure*}}{\end{figure}}%
+    }% not [H], etc.
 %    \end{macrocode}
 % Unnest the environment:
 %    \begin{macrocode}
-\addtocounter{KFLT at keyfloatdepth}{-1}%
+    \addtocounter{KFLT at keyfloatdepth}{-1}%
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3702,16 +3704,18 @@
 %    \end{macrocode}
 % Track rows:
 %    \begin{macrocode}
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{\KFLT at maybestartfloatrow}{}%
+    \ifboolexpr{%
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
+        bool {KFLT at inkeysubfloats}
+    }%
+        {\KFLT at maybestartfloatrow}%
+        {}%
 %    \end{macrocode}
 % Possibly fill space between columns:
 %    \begin{macrocode}
-\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>}{1}}%
-{\hfill}{}%
+    \ifnumgreater{\value{KFLT at thiscol}}{1}%
+        {\hfill}%
+        {}%
 }
 %    \end{macrocode}
 
@@ -3721,20 +3725,20 @@
 % \begin{macro}{\KFLT at subgrpdefaults} Sets defaults before reading the keys.
 %    \begin{macrocode}
 \newcommand*{\KFLT at subgrpdefaults}{%
-\setboolean{KFLT at subgrpcont}{false}%
-\renewcommand{\KFLT at subgrpc}{}%
-\setboolean{KFLT at subgrpcstar}{false}%
-\renewcommand{\KFLT at subgrpsc}{}%
-\setboolean{KFLT at subgrpscgiven}{false}%
-\KFLT at setsubgrpfigure%
-\renewcommand{\KFLT at subgrpl}{}%
-\renewcommand{\KFLT at subgrpap}{}%
-\renewcommand{\KFLT at subgrpaf}{}%
-\renewcommand{\KFLT at subgrpal}{}%
-\renewcommand{\KFLT at subgrpas}{}%
-\renewcommand{\KFLT at subgrpt}{}%
-\renewcommand{\KFLT at subgrptextalign}{}
-\tdtextjustify
+    \setboolean{KFLT at subgrpcont}{false}%
+    \renewcommand{\KFLT at subgrpc}{}%
+    \setboolean{KFLT at subgrpcstar}{false}%
+    \renewcommand{\KFLT at subgrpsc}{}%
+    \setboolean{KFLT at subgrpscgiven}{false}%
+    \KFLT at setsubgrpfigure%
+    \renewcommand{\KFLT at subgrpl}{}%
+    \renewcommand{\KFLT at subgrpap}{}%
+    \renewcommand{\KFLT at subgrpaf}{}%
+    \renewcommand{\KFLT at subgrpal}{}%
+    \renewcommand{\KFLT at subgrpas}{}%
+    \renewcommand{\KFLT at subgrpt}{}%
+    \renewcommand{\KFLT at subgrptextalign}{}%
+    \tdtextjustify%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3756,63 +3760,66 @@
 %    \end{macrocode}
 % Parse the key-value combinations:
 %    \begin{macrocode}
-\setkeys{KFLT at subgrpkeys}{#4}%
+    \setkeys{KFLT at subgrpkeys}{#4}%
 %    \end{macrocode}
 % Nest the environment:
 %    \begin{macrocode}
-\setboolean{KFLT at inkeysubfloats}{true}%
+    \setboolean{KFLT at inkeysubfloats}{true}%
 %    \end{macrocode}
 % Figure out the width of each subfloat.
 % If starred, use the full-page \cs{textwidth}, else use \cs{linewidth}.
 % .9 is used to leave a little room between columns.
 %    \begin{macrocode}
-\IfBooleanTF{#1}%
-{\setlength{\KFLT at rowboxwidth}{.9\textwidth/\real{#3}}}%
-{\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
+    \IfBooleanTF{#1}%
+        {\setlength{\KFLT at rowboxwidth}{.9\textwidth/\real{#3}}}%
+        {\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
 %    \end{macrocode}
 % If [H], or in a \env{keywrap}, create an inline minipage:
 %    \begin{macrocode}
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{%
-\bigbreak\noindent\begin{minipage}{\linewidth}%
-}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        bool {KFLT at keywrap}
+    }%
+    {%
+        \bigbreak\noindent\begin{minipage}{\linewidth}%
+    }%
 %    \end{macrocode}
 % Isn't [H], so create a float, possibly starred:
 %    \begin{macrocode}
-{%
-\IfBooleanTF{#1}%
-{\begin{\KFLT at subgrptype*}[#2]}{\begin{\KFLT at subgrptype}[#2]}%
-}%
+    {%
+        \IfBooleanTF{#1}%
+            {\begin{\KFLT at subgrptype*}[#2]}%
+            {\begin{\KFLT at subgrptype}[#2]}%
+    }%
 %    \end{macrocode}
 % Set the caption type:
 %    \begin{macrocode}
-\captionsetup*{type=\KFLT at subgrptype}%
+    \captionsetup*{type=\KFLT at subgrptype}%
 %    \end{macrocode}
 % Process continued floats:
 %    \begin{macrocode}
-\ifthenelse{\boolean{KFLT at subgrpcont}}{\ContinuedFloat}{}%
+    \ifbool{KFLT at subgrpcont}%
+        {\ContinuedFloat}%
+        {}%
 %    \end{macrocode}
 % Center the contents:
 %    \begin{macrocode}
-\center\unskip%
+    \center\unskip%
 %    \end{macrocode}
 % If this is a table, place the caption above the contents:
 %    \begin{macrocode}
-\KFLT at captioniftype{table}{subgrp}%
+    \KFLT at captioniftype{table}{subgrp}%
 %    \end{macrocode}
 % Not yet started a row of subfloats.
 % The use of \cs{defcounter} makes these changes local.
 %    \begin{macrocode}
-\defcounter{KFLT at numcols}{#3}%
-\defcounter{KFLT at thiscol}{0}%
+    \defcounter{KFLT at numcols}{#3}%
+    \defcounter{KFLT at thiscol}{0}%
 %    \end{macrocode}
 % Creat a group for the subfloats.
 % Necessary in case they change \cs{tdtextcenter}, etc.
 %    \begin{macrocode}
-\begingroup%
+    \begingroup%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3827,36 +3834,37 @@
 %    \end{macrocode}
 % End the group containing the subfloats:
 %    \begin{macrocode}
-\endgroup%
-\unskip\endcenter%
+    \endgroup%
+    \unskip\endcenter%
 %    \end{macrocode}
 % A little extra space at the bottom:
 %    \begin{macrocode}
-\par\addvspace{\bigskipamount}%
+    \par\addvspace{\bigskipamount}%
 %    \end{macrocode}
 % Optionally print artist's name and additional text:
 %    \begin{macrocode}
-\KFLT at addartisttext{subgrp}%
+    \KFLT at addartisttext{subgrp}%
 %    \end{macrocode}
 % If this was a figure, place the caption below the contents:
 %    \begin{macrocode}
-\KFLT at captioniftype{figure}{subgrp}%
+    \KFLT at captioniftype{figure}{subgrp}%
 %    \end{macrocode}
 % End the float or minipage:
 %    \begin{macrocode}
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{\end{minipage}\bigbreak}% was [H]
-{% not [H]:
-\IfBooleanTF{#1}% starred?
-{\end{\KFLT at subgrptype*}}{\end{\KFLT at subgrptype}}%
-}% not [H]
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        bool{KFLT at keywrap}
+    }%
+        {\end{minipage}\bigbreak}% was [H]
+        {% not [H]:
+            \IfBooleanTF{#1}% starred?
+                {\end{\KFLT at subgrptype*}}%
+                {\end{\KFLT at subgrptype}}%
+        }% not [H]
 %    \end{macrocode}
 % Unnest the environment:
 %    \begin{macrocode}
-\setboolean{KFLT at inkeysubfloats}{false}%
+    \setboolean{KFLT at inkeysubfloats}{false}%
 }
 %    \end{macrocode}
 % \end{macro}
@@ -3872,21 +3880,21 @@
 %    \end{macrocode}
 % Error if trying to nest environments:
 %    \begin{macrocode}
-\KFLT at nonest%
+    \KFLT at nonest%
 %    \end{macrocode}
 % Default the options:
 %    \begin{macrocode}
-\KFLT at subgrpdefaults%
+    \KFLT at subgrpdefaults%
 %    \end{macrocode}
 % Start of the environment:
 %    \begin{macrocode}
-\KFLT at subfloats{#1}{#2}{#3}{#4}%
+    \KFLT at subfloats{#1}{#2}{#3}{#4}%
 }% the start of the environment
 %    \end{macrocode}
 % end of the environment:
 %    \begin{macrocode}
 {%
-\KFLT at endsubfloats{#1}{#2}%
+    \KFLT at endsubfloats{#1}{#2}%
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3901,25 +3909,25 @@
 %    \end{macrocode}
 % Error if trying to nest environments:
 %    \begin{macrocode}
-\KFLT at nonest%
+    \KFLT at nonest%
 %    \end{macrocode}
 % Default the options:
 %    \begin{macrocode}
-\KFLT at subgrpdefaults%
+    \KFLT at subgrpdefaults%
 %    \end{macrocode}
 % Default to table float type:
 %    \begin{macrocode}
-\KFLT at setsubgrptable%
+    \KFLT at setsubgrptable%
 %    \end{macrocode}
 % Start of the environment:
 %    \begin{macrocode}
-\KFLT at subfloats{#1}{#2}{#3}{#4}%
+    \KFLT at subfloats{#1}{#2}{#3}{#4}%
 }% the start of the environment
 %    \end{macrocode}
 % End of the environment:
 %    \begin{macrocode}
 {%
-\KFLT at endsubfloats{#1}{#2}%
+    \KFLT at endsubfloats{#1}{#2}%
 }
 %    \end{macrocode}
 % \end{environment}
@@ -3929,7 +3937,7 @@
 %
 %
 %
-% \subsection{Margin Floats}
+% \subsection{Margin floats}
 %
 % \begin{environment}{KFLT at marginfloat} \oarg{offset} \marg{type}
 %    \begin{macrocode}
@@ -3937,17 +3945,18 @@
 
 \NewDocumentEnvironment{KFLT at marginfloat}{O{-1.2ex} m}
 {% start
-\FloatBarrier% keep floats in order
-\begin{lrbox}{\KFLT at marginfloatbox}%
-\begin{minipage}{\marginparwidth}%
-\captionsetup{type=#2}%
-\hbox{}\vspace*{#1}%
-\noindent%
+    \FloatBarrier% keep floats in order
+    \begin{lrbox}{\KFLT at marginfloatbox}%
+    \begin{minipage}{\marginparwidth}%
+    \captionsetup{type=#2}%
+    \hbox{}\vspace*{#1}%
+    \noindent%
 }% start
-{\end{minipage}%
-\end{lrbox}%
-\marginpar{\usebox{\KFLT at marginfloatbox}}%
-}
+{% end
+    \end{minipage}%
+    \end{lrbox}%
+    \marginpar{\usebox{\KFLT at marginfloatbox}}%
+}% end
 %    \end{macrocode}
 % \end{environment}
 %
@@ -4004,32 +4013,32 @@
 %    \begin{macrocode}
 \DeclareDocumentEnvironment{keywrap}{m +m}
 {%
-\par%
-\setlength{\KFLT at keywrapwidth}{\linewidth}%
-\addtolength{\KFLT at keywrapwidth}{-#1}%
-\addtolength{\KFLT at keywrapwidth}{-2em}%
-\minipage[t]{\KFLT at keywrapwidth}%
-%
-\setlength{\parskip}{\KFLT at keywrapparskip}%
-\setlength{\parindent}{\KFLT at keywrapparindent}%
-\booltrue{KFLT at keywrap}%
+    \par%
+    \setlength{\KFLT at keywrapwidth}{\linewidth}%
+    \addtolength{\KFLT at keywrapwidth}{-#1}%
+    \addtolength{\KFLT at keywrapwidth}{-2em}%
+    \minipage[t]{\KFLT at keywrapwidth}%
+    %
+    \setlength{\parskip}{\KFLT at keywrapparskip}%
+    \setlength{\parindent}{\KFLT at keywrapparindent}%
+    \booltrue{KFLT at keywrap}%
 }
 {%
-\par
-\endminipage%
-\hfill%
-\begin{minipage}[t]{#1}%
-\booltrue{KFLT at keywrap}%
-#2%
-\par
-\unskip\vspace{\smallskipamount}
-\end{minipage}%
-\par
+    \par%
+    \endminipage%
+    \hfill%
+    \begin{minipage}[t]{#1}%
+    \booltrue{KFLT at keywrap}%
+    #2%
+    \par%
+    \unskip\vspace{\smallskipamount}%
+    \end{minipage}%
+    \par%
 }
 
-\BeforeBeginEnvironment{keywrap}{
-\setlength{\KFLT at keywrapparskip}{\parskip}
-\setlength{\KFLT at keywrapparindent}{\parindent}
+\BeforeBeginEnvironment{keywrap}{%
+    \setlength{\KFLT at keywrapparskip}{\parskip}%
+    \setlength{\KFLT at keywrapparindent}{\parindent}%
 }
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty	2019-01-12 23:07:09 UTC (rev 49682)
+++ trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty	2019-01-12 23:07:32 UTC (rev 49683)
@@ -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,11 +36,15 @@
 \@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.%
+}
+}
 {}
 
 \PassOptionsToPackage{expand}{gettitlestring}
@@ -72,13 +73,15 @@
 \define at key{KFLT at keys}{cont}[true]{\setboolean{KFLT at cont}{#1}}
 \newcommand{\KFLT at c}{}
 \newboolean{KFLT at cstar}
-\define at key{KFLT at keys}{c}%
-{\renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{false}}
-\define at key{KFLT at keys}{cstar}%
-{\renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{true}}
+\define at key{KFLT at keys}{c}{%
+    \renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{false}%
+}
+\define at key{KFLT at keys}{cstar}{%
+    \renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{true}%
+}
 \define at key{KFLT at keys}{sc}{%
-\renewcommand{\KFLT at sc}{#1}%
-\setboolean{KFLT at scgiven}{true}%
+    \renewcommand{\KFLT at sc}{#1}%
+    \setboolean{KFLT at scgiven}{true}%
 }
 \newcommand{\KFLT at sc}{}
 \newboolean{KFLT at scgiven}
@@ -104,35 +107,35 @@
 \providecommand{\tdnamecenter}{}
 \providecommand{\tdnameleft}{}
 \providecommand{\tdnameright}{}
-\define at key{KFLT at keys}{t}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{}
-\tdtextjustify
+\define at key{KFLT at keys}{t}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{}%
+    \tdtextjustify%
 }
-\define at key{KFLT at keys}{tc}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{\centering}
-\tdtextcenter
+\define at key{KFLT at keys}{tc}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{\centering}%
+    \tdtextcenter%
 }
-\define at key{KFLT at keys}{tr}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{\raggedleft}
-\tdtextright
+\define at key{KFLT at keys}{tr}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{\raggedleft}%
+    \tdtextright%
 }
-\define at key{KFLT at keys}{tl}{
-\renewcommand{\KFLT at t}{#1}
-\renewcommand{\KFLT at textalign}{\raggedright}
-\tdtextleft
+\define at key{KFLT at keys}{tl}{%
+    \renewcommand{\KFLT at t}{#1}%
+    \renewcommand{\KFLT at textalign}{\raggedright}%
+    \tdtextleft%
 }
 \newcommand*{\KFLT at i}{}
 \define at key{KFLT at keys}{lw}{%
-\renewcommand{\KFLT at lw}{#1}%
-\setlength{\KFLT at w}{0pt}%
+    \renewcommand{\KFLT at lw}{#1}%
+    \setlength{\KFLT at w}{0pt}%
 }
 \newcommand*{\KFLT at lw}{}
 \define at key{KFLT at keys}{w}{%
-\setlength{\KFLT at w}{#1}%
-\renewcommand{\KFLT at lw}{}%
+    \setlength{\KFLT at w}{#1}%
+    \renewcommand{\KFLT at lw}{}%
 }
 \newlength{\KFLT at w}
 \define at key{KFLT at keys}{h}{\setlength{\KFLT at h}{#1}}
@@ -169,19 +172,21 @@
 
 \newboolean{KFLT at subgrpcont}{}
 \define at key{KFLT at subgrpkeys}{cont}[true]{%
-\setboolean{KFLT at subgrpcont}{#1}%
+    \setboolean{KFLT at subgrpcont}{#1}%
 }
 
 \newcommand{\KFLT at subgrpc}{}
 
 \newboolean{KFLT at subgrpcstar}
-\define at key{KFLT at subgrpkeys}{c}
-{\renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{false}}
-\define at key{KFLT at subgrpkeys}{cstar}
-{\renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{true}}
+\define at key{KFLT at subgrpkeys}{c}{%
+    \renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{false}%
+}
+\define at key{KFLT at subgrpkeys}{cstar}{%
+    \renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{true}%
+}
 \define at key{KFLT at subgrpkeys}{sc}{%
-\renewcommand{\KFLT at subgrpsc}{#1}%
-\setboolean{KFLT at subgrpscgiven}{true}%
+    \renewcommand{\KFLT at subgrpsc}{#1}%
+    \setboolean{KFLT at subgrpscgiven}{true}%
 }
 
 \newcommand{\KFLT at subgrpsc}{}
@@ -193,37 +198,37 @@
 \newcommand*{\KFLT at subgrplisttype}{}
 
 \newcommand*{\KFLT at setsubgrpfigure}{%
-\renewcommand{\KFLT at subgrptype}{figure}%
-\renewcommand{\KFLT at subgrplisttype}{lof}%
+    \renewcommand{\KFLT at subgrptype}{figure}%
+    \renewcommand{\KFLT at subgrplisttype}{lof}%
 }
 
 \newcommand*{\KFLT at setsubgrptable}{%
-\renewcommand{\KFLT at subgrptype}{table}%
-\renewcommand{\KFLT at subgrplisttype}{lot}%
+    \renewcommand{\KFLT at subgrptype}{table}%
+    \renewcommand{\KFLT at subgrplisttype}{lot}%
 }
 \define at key{KFLT at subgrpkeys}{l}{\renewcommand{\KFLT at subgrpl}{#1}}
 \newcommand*{\KFLT at subgrpl}{}
 \newcommand*{\KFLT at subgrptextalign}{}
 \newcommand{\KFLT at subgrpt}{}
-\define at key{KFLT at subgrpkeys}{t}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{}
-\tdtextjustify
+\define at key{KFLT at subgrpkeys}{t}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{}%
+    \tdtextjustify%
 }
-\define at key{KFLT at subgrpkeys}{tc}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{\centering}
-\tdtextcenter
+\define at key{KFLT at subgrpkeys}{tc}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{\centering}%
+    \tdtextcenter%
 }
-\define at key{KFLT at subgrpkeys}{tl}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{\raggedright}
-\tdtextleft
+\define at key{KFLT at subgrpkeys}{tl}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{\raggedright}%
+    \tdtextleft%
 }
-\define at key{KFLT at subgrpkeys}{tr}{
-\renewcommand{\KFLT at subgrpt}{#1}
-\renewcommand{\KFLT at subgrptextalign}{\raggedleft}
-\tdtextright
+\define at key{KFLT at subgrpkeys}{tr}{%
+    \renewcommand{\KFLT at subgrpt}{#1}%
+    \renewcommand{\KFLT at subgrptextalign}{\raggedleft}%
+    \tdtextright%
 }
 \define at key{KFLT at subgrpkeys}{ap}{\renewcommand{\KFLT at subgrpap}{#1}}
 \newcommand*{\KFLT at subgrpap}{}
@@ -233,7 +238,6 @@
 \newcommand*{\KFLT at subgrpal}{}
 \define at key{KFLT at subgrpkeys}{as}{\renewcommand{\KFLT at subgrpas}{#1}}
 \newcommand*{\KFLT at subgrpas}{}
-%%
 
 
 \newlength{\KFLT at imagewidth}
@@ -240,305 +244,302 @@
 
 \newlength{\KFLT at boxwidth}
 \newcommand*{\KFLT at findwidths}{%
-\ifthenelse{\boolean{KFLT at ft}}% tight frame?
-{\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTtightframewidth}}%
-{% not tight frame
-\ifthenelse{\boolean{KFLT at f}}% loose frame?
-{\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTlooseframewidth}}%
-{\setlength{\KFLT at boxwidth}{\linewidth}}% no frame
-}% not tight frame
-\ifthenelse{\dimtest{\KFLT at w}{>}{0pt}}%
-{\setlength{\KFLT at imagewidth}{\KFLT at w}}%
-{% width not given
-\ifcsempty{\KFLT at lw}%
-{\setlength{\KFLT at imagewidth}{\KFLT at boxwidth}}%
-{\setlength{\KFLT at imagewidth}{\KFLT at lw\KFLT at boxwidth}}%
-}% width not given
+    \ifbool{KFLT at ft}% tight frame?
+        {\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTtightframewidth}}%
+        {% not tight frame
+            \ifbool{KFLT at f}% loose frame?
+                {\setlength{\KFLT at boxwidth}{\linewidth - 2\KFLTlooseframewidth}}%
+                {\setlength{\KFLT at boxwidth}{\linewidth}}% no frame
+        }% not tight frame
+    \ifdimgreater{\KFLT at w}{0pt}%
+        {\setlength{\KFLT at imagewidth}{\KFLT at w}}%
+        {% width not given
+            \ifcsempty{\KFLT at lw}%
+            {\setlength{\KFLT at imagewidth}{\KFLT at boxwidth}}%
+            {\setlength{\KFLT at imagewidth}{\KFLT at lw\KFLT at 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 at frame}[1]
 {%
-\ifthenelse{\boolean{KFLT at ft}}%
-{\KFLTtightframe{#1}}%
-{% not tightframe
-\ifthenelse{\boolean{KFLT at f}}%
-{\KFLTlooseframe{#1}}%
-{#1}% no frame
-}% not looseframe
+    \ifbool{KFLT at ft}%
+        {\KFLTtightframe{#1}}%
+        {% not tightframe
+            \ifbool{KFLT at f}%
+                {\KFLTlooseframe{#1}}%
+                {#1}% no frame
+        }% not looseframe
 }
 \newcommand{\KFLT at findenvboxwidth}{%
-\settowidth{\KFLTimageboxwidth}{\usebox{\KFLT at envbox}}%
-\ifthenelse{\boolean{KFLT at ft}}%
-{\addtolength{\KFLTimageboxwidth}{2\KFLTtightframewidth}}%
-{% not tightframe
-\ifthenelse{\boolean{KFLT at f}}%
-{\addtolength{\KFLTimageboxwidth}{2\KFLTlooseframewidth}}%
-{}% no frame
-}% not looseframe
+    \settowidth{\KFLTimageboxwidth}{\usebox{\KFLT at envbox}}%
+    \ifbool{KFLT at ft}%
+        {\addtolength{\KFLTimageboxwidth}{2\KFLTtightframewidth}}%
+        {% not tightframe
+            \ifbool{KFLT at f}%
+                {\addtolength{\KFLTimageboxwidth}{2\KFLTlooseframewidth}}%
+                {}% no frame
+        }% not looseframe
 }
 \NewDocumentCommand{\KFLT at onefigureimage}{}
 {%
-\begin{lrbox}{\KFLT at envbox}%
-\ifthenelse{\NOT\equal{\KFLT at lw}{}}%
-{\includegraphics%
-[scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}}%
-{% not linewidth
-\ifthenelse{\dimtest{\KFLT at w}{>}{0pt}}%
-{% width is given
-\ifthenelse{\dimtest{\KFLT at h}{>}{0pt}}%
-{% w and h
-\includegraphics%
-[scale=\KFLT at s,%
-width=\KFLT at imagewidth,height=\KFLT at h]{\KFLT at i}%
-}% w and h
-{% only w
-\includegraphics%
-[scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}%
-}% only w
-}% width is given
-{% width is not given
-\ifthenelse{\dimtest{\KFLT at h}{>}{0pt}}%
-{\includegraphics%
-[scale=\KFLT at s,height=\KFLT at h]{\KFLT at i}}%
-{\includegraphics%
-[scale=\KFLT at s]{\KFLT at i}}%
-}% width is not given
-}% not linewidth
-\end{lrbox}%
-\unskip%
-\KFLT at findenvboxwidth%
-\begin{turn}{\KFLT at r}%
-\KFLT at frame{\usebox{\KFLT at envbox}}%
-\unskip%
-\end{turn}%
+    \begin{lrbox}{\KFLT at envbox}%
+    \ifdefempty{\KFLT at lw}%
+    {% not linewidth
+        \ifdimgreater{\KFLT at w}{0pt}%
+        {% width is given
+            \ifdimgreater{\KFLT at h}{0pt}%
+            {% w and h
+                \includegraphics%
+                [scale=\KFLT at s,%
+                width=\KFLT at imagewidth,height=\KFLT at h]{\KFLT at i}%
+            }% w and h
+            {% only w
+                \includegraphics%
+                [scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}%
+            }% only w
+        }% width is given
+        {% width is not given
+            \ifdimgreater{\KFLT at h}{0pt}%
+                {\includegraphics[scale=\KFLT at s,height=\KFLT at h]{\KFLT at i}}%
+                {\includegraphics[scale=\KFLT at s]{\KFLT at i}}%
+        }% width is not given
+    }% not linewidth
+    {% linewidth given
+        \includegraphics[scale=\KFLT at s,width=\KFLT at imagewidth]{\KFLT at i}%
+    }%
+    \end{lrbox}%
+    \unskip%
+    \KFLT at findenvboxwidth%
+    \begin{turn}{\KFLT at r}%
+    \KFLT at frame{\usebox{\KFLT at envbox}}%
+    \unskip%
+    \end{turn}%
 }
 
 \newcommand*{\KFLT at captioniftype}[2]{%
-\ifthenelse{\equal{\csname KFLT@#2type\endcsname}{#1}}%
-{\KFLT at caption{#2}}%
-{}%
+    \ifcsstring{KFLT@#2type}{#1}%
+        {\KFLT at caption{#2}}%
+        {}%
 }
 
 \NewDocumentCommand{\KFLT at 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 at docaption}{s o m m}
 {%
-\ifthenelse{\equal{\csname KFLT@#4type\endcsname}{figure}}%
-{% figure
-\ifcsempty{KFLT@#4al}%
-{% figure w/o artist
-\KFLT at 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 at dosimplecaption{#1}{#2}{#3}%
-}% not a figure
+    \ifcsstring{KFLT@#4type}{figure}%
+    {% figure
+        \ifcsempty{KFLT@#4al}%
+        {% figure w/o artist
+            \KFLT at 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 at dosimplecaption{#1}{#2}{#3}%
+    }% not a figure
 }% KFLT at tocdata
 }% tocdata loaded
 {% no tocdata
 \NewDocumentCommand{\KFLT at docaption}{s o m m}
 {%
-\KFLT at 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 at 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 at docaption
 }% no tocdata
 
 \newcommand{\KFLT at 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 at listtype}%
-{\csname KFLT@#1type\endcsname}{\KFLT at sc}%
-}% non-empty cstar and sc
-\KFLT at docaption*{\csname KFLT@#1c\endcsname}{#1}%
-}%
-}% starred caption
-{% unstarred caption
-\ifcsempty{KFLT@#1sc}%
-{% no short cap
-\KFLT at docaption{\csname KFLT@#1c\endcsname}{#1}%
-}% no short cap
-{% short cap
-\KFLT at 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 at listtype}%
+                {\csname KFLT@#1type\endcsname}{\KFLT at sc}%
+            }% non-empty cstar and sc
+            \KFLT at docaption*{\csname KFLT@#1c\endcsname}{#1}%
+        }%
+    }% starred caption
+    {% unstarred caption
+        \ifcsempty{KFLT@#1sc}%
+        {% no short cap
+            \KFLT at docaption{\csname KFLT@#1c\endcsname}{#1}%
+        }% no short cap
+        {% short cap
+            \KFLT at docaption[\csname KFLT@#1sc\endcsname]%
+            {\csname KFLT@#1c\endcsname}{#1}%
+        }% short cap
+        \ifcsempty{KFLT@#1l}%
+        {}%
+        {\label{\csname KFLT@#1l\endcsname}}%
+    }% unstarred caption
 }
 
 
 \newcommand*{\KFLT at defaults}{%
-\setboolean{KFLT at cont}{false}%
-\renewcommand{\KFLT at c}{}%
-\setboolean{KFLT at cstar}{false}%
-\renewcommand{\KFLT at sc}{}%
-\setboolean{KFLT at scgiven}{false}%
-\renewcommand{\KFLT at type}{figure}%
-\renewcommand{\KFLT at listtype}{lof}%
-\renewcommand{\KFLT at l}{}%
-\renewcommand{\KFLT at ap}{}%
-\renewcommand{\KFLT at af}{}%
-\renewcommand{\KFLT at al}{}%
-\renewcommand{\KFLT at as}{}%
-\renewcommand{\KFLT at t}{}%
-\renewcommand{\KFLT at textalign}{}%
-\tdtextjustify%
-\renewcommand{\KFLT at i}{}%
-\renewcommand{\KFLT at lw}{}%
-\setlength{\KFLT at w}{0pt}%
-\setlength{\KFLT at h}{0pt}%
-\renewcommand{\KFLT at s}{1}%
-\renewcommand{\KFLT at r}{0}%
-\setboolean{KFLT at f}{false}%
-\setboolean{KFLT at ft}{false}%
-\renewcommand{\KFLT at stretch}{1}%
-\setlength{\KFLT at mo}{-1.2ex}%
-\renewcommand{\KFLT at wp}{O}%
-\renewcommand{\KFLT at va}{c}%
+    \setboolean{KFLT at cont}{false}%
+    \renewcommand{\KFLT at c}{}%
+    \setboolean{KFLT at cstar}{false}%
+    \renewcommand{\KFLT at sc}{}%
+    \setboolean{KFLT at scgiven}{false}%
+    \renewcommand{\KFLT at type}{figure}%
+    \renewcommand{\KFLT at listtype}{lof}%
+    \renewcommand{\KFLT at l}{}%
+    \renewcommand{\KFLT at ap}{}%
+    \renewcommand{\KFLT at af}{}%
+    \renewcommand{\KFLT at al}{}%
+    \renewcommand{\KFLT at as}{}%
+    \renewcommand{\KFLT at t}{}%
+    \renewcommand{\KFLT at textalign}{}%
+    \tdtextjustify%
+    \renewcommand{\KFLT at i}{}%
+    \renewcommand{\KFLT at lw}{}%
+    \setlength{\KFLT at w}{0pt}%
+    \setlength{\KFLT at h}{0pt}%
+    \renewcommand{\KFLT at s}{1}%
+    \renewcommand{\KFLT at r}{0}%
+    \setboolean{KFLT at f}{false}%
+    \setboolean{KFLT at ft}{false}%
+    \renewcommand{\KFLT at stretch}{1}%
+    \setlength{\KFLT at mo}{-1.2ex}%
+    \renewcommand{\KFLT at wp}{O}%
+    \renewcommand{\KFLT at va}{c}%
 }
 
 
 \newcommand*{\KFLT at maybestartfloatrow}{%
-\KFLT at maybeendfloatrow%
-\defcounter{KFLT at thiscol}{\value{KFLT at thiscol}+1}%
+    \KFLT at maybeendfloatrow%
+    \defcounter{KFLT at thiscol}{\value{KFLT at thiscol}+1}%
 }
 
 \newcommand*{\KFLT at maybeendfloatrow}{%
-\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>=}{\value{KFLT at numcols}}}%
-{%
+    \ifnumless{\value{KFLT at thiscol}}{\value{KFLT at numcols}}%
+    {}% thiscol < numcols
+    {% >=
 
-\addvspace{.75\floatsep}%
+        \addvspace{.75\floatsep}
 
-\defcounter{KFLT at thiscol}{0}%
-}{}%
+        \defcounter{KFLT at thiscol}{0}%
+    }%
 }%
 
 
 \newcommand{\KFLT at trackrows}
 {%
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{% nested
-\KFLT at maybestartfloatrow%
-\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>}{1}}%
-{\hfill}{}%
-}% nested
-{}% not nested
+    \ifboolexpr{%
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
+        bool{KFLT at inkeysubfloats}%
+    }%
+    {% nested
+        \KFLT at maybestartfloatrow%
+        \ifnumgreater{\value{KFLT at thiscol}}{1}%
+            {\hfill}%
+            {}%
+    }% nested
+    {}% not nested
 }
 
 \newcommand{\KFLT at 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 at optionalname}[1]
 {%
-\ifthenelse{\equal{#1}{}}%
-{}%
-{#1~}%
+    \ifblank{#1}%
+        {}%
+        {#1~}%
 }
 \@ifpackageloaded{tocdata}
 {% tocdata loaded
 \newcommand{\KFLT at addartisttext}[1]
 {%
-\ifthenelse{\equal{\csname KFLT@#1type\endcsname}{figure}}%
-{% figure
-\ifcsempty{KFLT@#1al}%
-{\KFLT at addtext{#1}}%
-{}% fig w/ artist: text will be added by \captionartist in \KFLT at caption
-}% figure
-{\KFLT at addtext{#1}}%
+    \ifcsstring{KFLT@#1type}{figure}%
+    {% figure
+        \ifcsempty{KFLT@#1al}%
+            {\KFLT at addtext{#1}}%
+            {}% fig w/ artist: text will be added by \captionartist in \KFLT at caption
+    }% figure
+    {\KFLT at addtext{#1}}%
 }% KFLT at addartisttext
 }% tocdata loaded
 {% tocdata not loaded
 \newcommand{\KFLT at addartisttext}[1]
 {%
-\ifcsempty{KFLT@#1al}%
-{}% last name not given
-{% last name given
-\addvspace{2ex}%
-\begin{minipage}{\linewidth}%
-\centering\footnotesize\textsc{%
-\KFLT at optionalname{\csname KFLT@#1ap\endcsname}%
-\KFLT at optionalname{\csname KFLT@#1af\endcsname}%
-\csname KFLT@#1al\endcsname\csname KFLT@#1as\endcsname%
-}%
-\end{minipage}%
-\par\addvspace{2ex}%
-}% last name given
-\KFLT at addtext{#1}%
+    \ifcsempty{KFLT@#1al}%
+    {}% last name not given
+    {% last name given
+        \addvspace{2ex}%
+        \begin{minipage}{\linewidth}%
+        \centering\footnotesize\textsc{%
+        \KFLT at optionalname{\csname KFLT@#1ap\endcsname}%
+        \KFLT at optionalname{\csname KFLT@#1af\endcsname}%
+        \csname KFLT@#1al\endcsname\csname KFLT@#1as\endcsname%
+        }%
+        \end{minipage}%
+        \par\addvspace{2ex}%
+    }% last name given
+    \KFLT at addtext{#1}%
 }% KFLT at addartisttext
 }% tocdata not loaded
 
@@ -548,398 +549,418 @@
 
 \NewDocumentEnvironment{KFLT at boxinner}{}
 {% keyboxinner
-\begin{lrbox}{\KFLT at envbox}%
-\turn{\KFLT at r}%
-\minipage{\KFLT at imagewidth}%
-\setlength{\parskip}{2ex}%
-\renewcommand{\arraystretch}{\KFLT at stretch}%
+    \begin{lrbox}{\KFLT at envbox}%
+    \turn{\KFLT at r}%
+    \minipage{\KFLT at imagewidth}%
+    \setlength{\parskip}{2ex}%
+    \renewcommand{\arraystretch}{\KFLT at stretch}%
 }% keyboxinner
 {% endkeyboxinner
-\endminipage%
-\endturn%
-\end{lrbox}%
-\KFLT at frame{\usebox{\KFLT at envbox}}%
-\par\addvspace{2ex}%
+    \endminipage%
+    \endturn%
+    \end{lrbox}%
+    \KFLT at frame{\usebox{\KFLT at envbox}}%
+    \par\addvspace{2ex}%
 }% endkeyboxinner
 
 \NewDocumentCommand{\KFLT at boxkeys}{+m m m}
 {%
-\KFLT at defaults%
-\renewcommand{\KFLT at type}{#2}%
-\renewcommand{\KFLT at listtype}{#3}%
-\setkeys{KFLT at keys}{#1}%
+    \KFLT at defaults%
+    \renewcommand{\KFLT at type}{#2}%
+    \renewcommand{\KFLT at listtype}{#3}%
+    \setkeys{KFLT at keys}{#1}%
 }
 
 \NewDocumentEnvironment{KFLT at boxouter}{m m}
 {% boxouter
-\ifthenelse{\boolean{KFLT at inkeysubfloats}}%
-{\csname sub\KFLT at type\endcsname{\KFLT at rowboxwidth}}% subfloat
-{% not subfloat:
-\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}%
-{% keyfloats
-\ifbool{KFLT at keywrap}
-{\minipage[t]{\KFLT at rowboxwidth}}%
-{\minipage[\KFLT at va]{\KFLT at rowboxwidth}}%
-\captionsetup*{type=\KFLT at type}%
-}% keyfloats
-{% not keyfloats
-\ifbool{KFLT at keywrap}%
-{%
-\par\addvspace{\baselineskip}%
-\noindent\minipage[t]{\linewidth}%
-\captionsetup{type=\KFLT at type}%
-}%
-{% not a keywrap
-\ifthenelse{\equal{#2}{W}}%
-{% [W]
-\KFLT at findwidths%
-\csname wrap\KFLT at type\endcsname{\KFLT at wp}%
-{\KFLT at imagewidth+2\KFLTlooseframewidth}%
-\renewcommand{\KFLT at lw}{}%
-\renewcommand{\KFLT at w}{\KFLT at imagewidth}%
-}% [W]
-{% not [W]
-\ifthenelse{\equal{#2}{M}}%
-{% [M]
-\csname margin\KFLT at type\endcsname[\KFLT at mo]%
-\captionsetup{type=\KFLT at type}%
-}% [M]
-{% not [M}
-\ifthenelse{\equal{#2}{H}}%
-{% [H]
-\par\addvspace{\baselineskip}%
-\noindent\minipage[\KFLT at va]{\linewidth}%
-\captionsetup{type=\KFLT at type}%
-}% [H]
-{% not [H]
-\IfBooleanTF{#1}%
-{\csname \KFLT at type*\endcsname[#2]}{\csname \KFLT at type\endcsname[#2]}%
-}% not [H]
-}% not [M]
-}% not [W]
-}% not keywrap
-}% not keyfloats
-}% not subfloat
-\ifthenelse{\boolean{KFLT at cont}}{\ContinuedFloat}{}%
-\KFLT at findwidths%
-\KFLT at captioniftype{table}{}%
-\center\unskip%
+    \ifbool{KFLT at inkeysubfloats}%
+    {\csname sub\KFLT at type\endcsname{\KFLT at rowboxwidth}}% subfloat
+    {% not subfloat:
+        \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}%
+        {% keyfloats
+            \ifbool{KFLT at keywrap}%
+                {\minipage[t]{\KFLT at rowboxwidth}}%
+                {\minipage[\KFLT at va]{\KFLT at rowboxwidth}}%
+            \captionsetup*{type=\KFLT at type}%
+        }% keyfloats
+        {% not keyfloats
+            \ifbool{KFLT at keywrap}%
+            {%
+                \par\addvspace{\baselineskip}%
+                \noindent\minipage[t]{\linewidth}%
+                \captionsetup{type=\KFLT at type}%
+            }%
+            {% not a keywrap
+                \ifstrequal{#2}{W}%
+                {% [W]
+                \KFLT at findwidths%
+                \csname wrap\KFLT at type\endcsname{\KFLT at wp}%
+                {\KFLT at imagewidth+2\KFLTlooseframewidth}%
+                \renewcommand{\KFLT at lw}{}%
+                \renewcommand{\KFLT at w}{\KFLT at imagewidth}%
+                }% [W]
+                {% not [W]
+                    \ifstrequal{#2}{M}%
+                    {% [M]
+                        \csname margin\KFLT at type\endcsname[\KFLT at mo]%
+                        \captionsetup{type=\KFLT at type}%
+                    }% [M]
+                    {% not [M}
+                        \ifstrequal{#2}{H}%
+                        {% [H]
+                            \par\addvspace{\baselineskip}%
+                            \noindent\minipage[\KFLT at va]{\linewidth}%
+                            \captionsetup{type=\KFLT at type}%
+                        }% [H]
+                        {% not [H]
+                            \IfBooleanTF{#1}%
+                                {\csname \KFLT at type*\endcsname[#2]}%
+                                {\csname \KFLT at type\endcsname[#2]}%
+                        }% not [H]
+                    }% not [M]
+                }% not [W]
+            }% not keywrap
+        }% not keyfloats
+    }% not subfloat
+    \ifbool{KFLT at cont}{\ContinuedFloat}{}%
+    \KFLT at findwidths%
+    \KFLT at captioniftype{table}{}%
+    \center\unskip%
 }% boxouter
 {% endboxouter
-\endcenter\unskip%
-\KFLT at addartisttext{}%
-\KFLT at captioniftype{figure}{}%
-\ifthenelse{\boolean{KFLT at inkeysubfloats}}%
-{
-\csname endsub\KFLT at type\endcsname
-}% subfloat
-{% not subfloat
-\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}% keyfloats?
-{\endminipage}% keyfloats
-{% not keyfloats
-\ifbool{KFLT at keywrap}{%
-\endminipage%
-\par\addvspace{\baselineskip}%
-}
-{% not keywrap
-\ifthenelse{\equal{#2}{W}}%
-{% [W]
-\csname endwrap\KFLT at type\endcsname%
-}% [W]
-{% not[W]
-\ifthenelse{\equal{#2}{M}}%
-{% [M]
-\csname endmargin\KFLT at type\endcsname%
-}% [M]
-{% not [M]
-\ifthenelse{\equal{#2}{H}}%
-{%
-\endminipage% [H]
-\par\addvspace{\baselineskip}%
-}%
-{% not [H]
-\IfBooleanTF{#1}% starred float?
-{\csname end\KFLT at type*\endcsname}{\csname end\KFLT at type\endcsname}%
-}% not [H]
-}% not [M]
-}% not [W]
-}% not keywrap
-}% not keyfloats
-}% not subfloat
+    \endcenter\unskip%
+    \KFLT at addartisttext{}%
+    \KFLT at captioniftype{figure}{}%
+    \ifbool{KFLT at inkeysubfloats}%
+    {%
+        \csname endsub\KFLT at type\endcsname%
+    }% subfloat
+    {% not subfloat
+        \ifnumgreater{\value{KFLT at keyfloatdepth}}{0}% keyfloats?
+        {\endminipage}% keyfloats
+        {% not keyfloats
+            \ifbool{KFLT at keywrap}{%
+                \endminipage%
+                \par\addvspace{\baselineskip}%
+            }%
+            {% not keywrap
+                \ifstrequal{#2}{W}%
+                {% [W]
+                    \csname endwrap\KFLT at type\endcsname%
+                }% [W]
+                {% not[W]
+                    \ifstrequal{#2}{M}%
+                    {% [M]
+                        \csname endmargin\KFLT at type\endcsname%
+                    }% [M]
+                    {% not [M]
+                        \ifstrequal{#2}{H}%
+                        {%
+                            \endminipage% [H]
+                            \par\addvspace{\baselineskip}%
+                        }%
+                        {% not [H]
+                            \IfBooleanTF{#1}% starred float?
+                                {\csname end\KFLT at type*\endcsname}%
+                                {\csname end\KFLT at type\endcsname}%
+                        }% not [H]
+                    }% not [M]
+                }% not [W]
+            }% not keywrap
+        }% not keyfloats
+    }% not subfloat
 }% endkeyboxouter
 
 
 \NewDocumentEnvironment{keyfigure}{s O{tbp} +m}
 {%
-\KFLT at boxkeys{#3}{figure}{lof}%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
+    \KFLT at boxkeys{#3}{figure}{lof}%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
 }%
 {%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
 }
 
 \BeforeBeginEnvironment{keyfigure}{%
-\KFLT at trackrows%
+    \KFLT at trackrows%
 }
 
 
 \NewDocumentCommand{\keyfig}{s O{tbp} +m m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{figure}{lof}%
-\renewcommand{\KFLT at i}{#4}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at onefigureimage%
-\endKFLT at boxouter%
-\endgroup%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{figure}{lof}%
+    \renewcommand{\KFLT at i}{#4}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at onefigureimage%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 
 
 \NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{figure}{lof}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-#4%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
-\endgroup%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{figure}{lof}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    #4%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 
 
 \NewDocumentCommand{\keyparbox}{s O{tbp} +m +m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{figure}{lof}%
-\renewcommand{\KFLT at c}{}%
-\setboolean{KFLT at cstar}{true}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-#4%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
-\endgroup%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{figure}{lof}%
+    \renewcommand{\KFLT at c}{}%
+    \setboolean{KFLT at cstar}{true}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    #4%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 
 
 \NewDocumentCommand{\keytab}{s O{tbp} +m +m}
 {%
-\KFLT at trackrows%
-\KFLT at boxkeys{#3}{table}{lot}%
-\begingroup%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-\centering%
-#4%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
-\endgroup%
+    \KFLT at trackrows%
+    \KFLT at boxkeys{#3}{table}{lot}%
+    \begingroup%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    \centering%
+    #4%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
+    \endgroup%
 }
 
 
 \NewDocumentEnvironment{keytable}{s O{tbp} +m}
 {%
-\KFLT at boxkeys{#3}{table}{lot}%
-\KFLT at boxouter{#1}{#2}%
-\KFLT at boxinner%
-\centering%
+    \KFLT at boxkeys{#3}{table}{lot}%
+    \KFLT at boxouter{#1}{#2}%
+    \KFLT at boxinner%
+    \centering%
 }%
 {%
-\endKFLT at boxinner%
-\endKFLT at boxouter%
+    \endKFLT at boxinner%
+    \endKFLT at boxouter%
 }
 
 \BeforeBeginEnvironment{keytable}{%
-\KFLT at trackrows%
+    \KFLT at trackrows%
 }
 
 
 \newcommand*{\KFLT at nonest}{%
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at 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 at keyfloatdepth}}{0}} or
+        bool {KFLT at 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 at keyfloatdepth}{1}%
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{% [H] or nested
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{\noindent%
-\begin{minipage}{\KFLT at rowboxwidth}%
-}%
-{\bigbreak%
-\noindent\begin{minipage}{\linewidth}}%
-\ifthenelse{\boolean{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
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{\setlength{\KFLT at rowboxwidth}{.9\KFLT at rowboxwidth/\real{#3}}}%
-{\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
-\centering%
-\defcounter{KFLT at numcols}{#3}%
-\defcounter{KFLT at thiscol}{0}%
+    \addtocounter{KFLT at keyfloatdepth}{1}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+        bool {KFLT at inkeysubfloats} or
+        bool {KFLT at keywrap}
+    }%
+    {% [H] or nested
+        \ifboolexpr{%
+            test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+            bool {KFLT at inkeysubfloats}
+        }%
+        {%
+            \noindent%
+            \begin{minipage}{\KFLT at rowboxwidth}%
+        }%
+        {%
+            \bigbreak%
+            \noindent\begin{minipage}{\linewidth}%
+        }%
+        \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
+    \ifboolexpr{%
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+        bool {KFLT at inkeysubfloats}
+    }%
+        {\setlength{\KFLT at rowboxwidth}{.9\KFLT at rowboxwidth/\real{#3}}}%
+        {\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
+    \centering%
+    \defcounter{KFLT at numcols}{#3}%
+    \defcounter{KFLT at thiscol}{0}%
 }% starting keyfloats environment
 {% ending keyfloats environment
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
-\OR\boolean{KFLT at inkeysubfloats}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{\end{minipage}%
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{}{\bigbreak}%
-}% was [H]
-{% not [H]
-\IfBooleanTF{#1}% starred figure?
-{\end{figure*}}{\end{figure}}%
-}% not [H]
-\addtocounter{KFLT at keyfloatdepth}{-1}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{1}} or
+        bool {KFLT at inkeysubfloats} or
+        bool {KFLT at keywrap}
+    }%
+    {% was [H], etc.
+        \end{minipage}%
+        \ifboolexpr{%
+            test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
+            bool {KFLT at keywrap}
+        }%
+        {}{\bigbreak}%
+    }% was [H], etc.
+    {% not [H], etc.
+        \IfBooleanTF{#1}% starred figure?
+            {\end{figure*}}{\end{figure}}%
+    }% not [H], etc.
+    \addtocounter{KFLT at keyfloatdepth}{-1}%
 }
 
 \BeforeBeginEnvironment{keyfloats}{%
-\ifthenelse{%
-\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
-\OR\boolean{KFLT at inkeysubfloats}%
-}%
-{\KFLT at maybestartfloatrow}{}%
-\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>}{1}}%
-{\hfill}{}%
+    \ifboolexpr{%
+        test {\ifnumgreater{\value{KFLT at keyfloatdepth}}{0}} or
+        bool {KFLT at inkeysubfloats}
+    }%
+        {\KFLT at maybestartfloatrow}%
+        {}%
+    \ifnumgreater{\value{KFLT at thiscol}}{1}%
+        {\hfill}%
+        {}%
 }
 
 
 \newcommand*{\KFLT at subgrpdefaults}{%
-\setboolean{KFLT at subgrpcont}{false}%
-\renewcommand{\KFLT at subgrpc}{}%
-\setboolean{KFLT at subgrpcstar}{false}%
-\renewcommand{\KFLT at subgrpsc}{}%
-\setboolean{KFLT at subgrpscgiven}{false}%
-\KFLT at setsubgrpfigure%
-\renewcommand{\KFLT at subgrpl}{}%
-\renewcommand{\KFLT at subgrpap}{}%
-\renewcommand{\KFLT at subgrpaf}{}%
-\renewcommand{\KFLT at subgrpal}{}%
-\renewcommand{\KFLT at subgrpas}{}%
-\renewcommand{\KFLT at subgrpt}{}%
-\renewcommand{\KFLT at subgrptextalign}{}
-\tdtextjustify
+    \setboolean{KFLT at subgrpcont}{false}%
+    \renewcommand{\KFLT at subgrpc}{}%
+    \setboolean{KFLT at subgrpcstar}{false}%
+    \renewcommand{\KFLT at subgrpsc}{}%
+    \setboolean{KFLT at subgrpscgiven}{false}%
+    \KFLT at setsubgrpfigure%
+    \renewcommand{\KFLT at subgrpl}{}%
+    \renewcommand{\KFLT at subgrpap}{}%
+    \renewcommand{\KFLT at subgrpaf}{}%
+    \renewcommand{\KFLT at subgrpal}{}%
+    \renewcommand{\KFLT at subgrpas}{}%
+    \renewcommand{\KFLT at subgrpt}{}%
+    \renewcommand{\KFLT at subgrptextalign}{}%
+    \tdtextjustify%
 }
 
 \NewDocumentCommand{\KFLT at subfloats}{m m m +m}
 {%
-\setkeys{KFLT at subgrpkeys}{#4}%
-\setboolean{KFLT at inkeysubfloats}{true}%
-\IfBooleanTF{#1}%
-{\setlength{\KFLT at rowboxwidth}{.9\textwidth/\real{#3}}}%
-{\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{%
-\bigbreak\noindent\begin{minipage}{\linewidth}%
-}%
-{%
-\IfBooleanTF{#1}%
-{\begin{\KFLT at subgrptype*}[#2]}{\begin{\KFLT at subgrptype}[#2]}%
-}%
-\captionsetup*{type=\KFLT at subgrptype}%
-\ifthenelse{\boolean{KFLT at subgrpcont}}{\ContinuedFloat}{}%
-\center\unskip%
-\KFLT at captioniftype{table}{subgrp}%
-\defcounter{KFLT at numcols}{#3}%
-\defcounter{KFLT at thiscol}{0}%
-\begingroup%
+    \setkeys{KFLT at subgrpkeys}{#4}%
+    \setboolean{KFLT at inkeysubfloats}{true}%
+    \IfBooleanTF{#1}%
+        {\setlength{\KFLT at rowboxwidth}{.9\textwidth/\real{#3}}}%
+        {\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        bool {KFLT at keywrap}
+    }%
+    {%
+        \bigbreak\noindent\begin{minipage}{\linewidth}%
+    }%
+    {%
+        \IfBooleanTF{#1}%
+            {\begin{\KFLT at subgrptype*}[#2]}%
+            {\begin{\KFLT at subgrptype}[#2]}%
+    }%
+    \captionsetup*{type=\KFLT at subgrptype}%
+    \ifbool{KFLT at subgrpcont}%
+        {\ContinuedFloat}%
+        {}%
+    \center\unskip%
+    \KFLT at captioniftype{table}{subgrp}%
+    \defcounter{KFLT at numcols}{#3}%
+    \defcounter{KFLT at thiscol}{0}%
+    \begingroup%
 }
 
 \newcommand*{\KFLT at endsubfloats}[2]{%
-\endgroup%
-\unskip\endcenter%
-\par\addvspace{\bigskipamount}%
-\KFLT at addartisttext{subgrp}%
-\KFLT at captioniftype{figure}{subgrp}%
-\ifthenelse{%
-\equal{#2}{H}%
-\OR\boolean{KFLT at keywrap}%
-}%
-{\end{minipage}\bigbreak}% was [H]
-{% not [H]:
-\IfBooleanTF{#1}% starred?
-{\end{\KFLT at subgrptype*}}{\end{\KFLT at subgrptype}}%
-}% not [H]
-\setboolean{KFLT at inkeysubfloats}{false}%
+    \endgroup%
+    \unskip\endcenter%
+    \par\addvspace{\bigskipamount}%
+    \KFLT at addartisttext{subgrp}%
+    \KFLT at captioniftype{figure}{subgrp}%
+    \ifboolexpr{%
+        test {\ifstrequal{#2}{H}} or
+        bool{KFLT at keywrap}
+    }%
+        {\end{minipage}\bigbreak}% was [H]
+        {% not [H]:
+            \IfBooleanTF{#1}% starred?
+                {\end{\KFLT at subgrptype*}}%
+                {\end{\KFLT at subgrptype}}%
+        }% not [H]
+    \setboolean{KFLT at inkeysubfloats}{false}%
 }
 
 \NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m}
 {%
-\KFLT at nonest%
-\KFLT at subgrpdefaults%
-\KFLT at subfloats{#1}{#2}{#3}{#4}%
+    \KFLT at nonest%
+    \KFLT at subgrpdefaults%
+    \KFLT at subfloats{#1}{#2}{#3}{#4}%
 }% the start of the environment
 {%
-\KFLT at endsubfloats{#1}{#2}%
+    \KFLT at endsubfloats{#1}{#2}%
 }
 
 \NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m}
 {%
-\KFLT at nonest%
-\KFLT at subgrpdefaults%
-\KFLT at setsubgrptable%
-\KFLT at subfloats{#1}{#2}{#3}{#4}%
+    \KFLT at nonest%
+    \KFLT at subgrpdefaults%
+    \KFLT at setsubgrptable%
+    \KFLT at subfloats{#1}{#2}{#3}{#4}%
 }% the start of the environment
 {%
-\KFLT at endsubfloats{#1}{#2}%
+    \KFLT at endsubfloats{#1}{#2}%
 }
 \newsavebox{\KFLT at marginfloatbox}
 
 \NewDocumentEnvironment{KFLT at marginfloat}{O{-1.2ex} m}
 {% start
-\FloatBarrier% keep floats in order
-\begin{lrbox}{\KFLT at marginfloatbox}%
-\begin{minipage}{\marginparwidth}%
-\captionsetup{type=#2}%
-\hbox{}\vspace*{#1}%
-\noindent%
+    \FloatBarrier% keep floats in order
+    \begin{lrbox}{\KFLT at marginfloatbox}%
+    \begin{minipage}{\marginparwidth}%
+    \captionsetup{type=#2}%
+    \hbox{}\vspace*{#1}%
+    \noindent%
 }% start
-{\end{minipage}%
-\end{lrbox}%
-\marginpar{\usebox{\KFLT at marginfloatbox}}%
-}
+{% end
+    \end{minipage}%
+    \end{lrbox}%
+    \marginpar{\usebox{\KFLT at marginfloatbox}}%
+}% end
 \ProvideDocumentEnvironment{marginfigure}{O{-1.2ex}}
   {\begin{KFLT at marginfloat}[#1]{figure}}
   {\end{KFLT at marginfloat}}
@@ -953,31 +974,32 @@
 \newlength{\KFLT at keywrapparindent}
 \DeclareDocumentEnvironment{keywrap}{m +m}
 {%
-\par%
-\setlength{\KFLT at keywrapwidth}{\linewidth}%
-\addtolength{\KFLT at keywrapwidth}{-#1}%
-\addtolength{\KFLT at keywrapwidth}{-2em}%
-\minipage[t]{\KFLT at keywrapwidth}%
-\setlength{\parskip}{\KFLT at keywrapparskip}%
-\setlength{\parindent}{\KFLT at keywrapparindent}%
-\booltrue{KFLT at keywrap}%
+    \par%
+    \setlength{\KFLT at keywrapwidth}{\linewidth}%
+    \addtolength{\KFLT at keywrapwidth}{-#1}%
+    \addtolength{\KFLT at keywrapwidth}{-2em}%
+    \minipage[t]{\KFLT at keywrapwidth}%
+    %
+    \setlength{\parskip}{\KFLT at keywrapparskip}%
+    \setlength{\parindent}{\KFLT at keywrapparindent}%
+    \booltrue{KFLT at keywrap}%
 }
 {%
-\par
-\endminipage%
-\hfill%
-\begin{minipage}[t]{#1}%
-\booltrue{KFLT at keywrap}%
-#2%
-\par
-\unskip\vspace{\smallskipamount}
-\end{minipage}%
-\par
+    \par%
+    \endminipage%
+    \hfill%
+    \begin{minipage}[t]{#1}%
+    \booltrue{KFLT at keywrap}%
+    #2%
+    \par%
+    \unskip\vspace{\smallskipamount}%
+    \end{minipage}%
+    \par%
 }
 
-\BeforeBeginEnvironment{keywrap}{
-\setlength{\KFLT at keywrapparskip}{\parskip}
-\setlength{\KFLT at keywrapparindent}{\parindent}
+\BeforeBeginEnvironment{keywrap}{%
+    \setlength{\KFLT at keywrapparskip}{\parskip}%
+    \setlength{\KFLT at keywrapparindent}{\parindent}%
 }
 \endinput
 %%



More information about the tex-live-commits mailing list