texlive[42622] Master: keyfloat (2dec16)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 2 23:57:05 CET 2016


Revision: 42622
          http://tug.org/svn/texlive?view=revision&revision=42622
Author:   karl
Date:     2016-12-02 23:57:05 +0100 (Fri, 02 Dec 2016)
Log Message:
-----------
keyfloat (2dec16)

Modified Paths:
--------------
    trunk/Master/tlpkg/bin/tlpkg-ctan-check
    trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/keyfloat/
    trunk/Master/texmf-dist/doc/latex/keyfloat/README
    trunk/Master/texmf-dist/doc/latex/keyfloat/images/
    trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.pdf
    trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.svg
    trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.pdf
    trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.svg
    trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf
    trunk/Master/texmf-dist/source/latex/keyfloat/
    trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx
    trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.ins
    trunk/Master/texmf-dist/tex/latex/keyfloat/
    trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
    trunk/Master/tlpkg/tlpsrc/keyfloat.tlpsrc

Added: trunk/Master/texmf-dist/doc/latex/keyfloat/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/README	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/README	2016-12-02 22:57:05 UTC (rev 42622)
@@ -0,0 +1,24 @@
+The LaTeX keyfloat package
+Provides a key/value interface for generating floats.
+
+v0.11 — 2016/12/02
+Copyright 2016 Brian Dunn — www.BDTechConcepts.com
+LaTeX Project Public License, version 1.3
+
+The keyfloat package provides a key/value user interface for quickly creating
+figures with a single image each, figures with arbitrary contents, tables,
+subfloats, rows of floats, and floats [H].
+
+Key/value combinations may specify a caption and label, a width
+proportional to \linewidth, a fixed width and/or height, rotation, scaling,
+a tight or loose frame, an \arraystretch, a continued float, additional
+supplemental text, and an artist/author's name with automatic index entry.
+When used with the tocdata package, the name also appears in the List of
+Figures.
+
+Floats may be placed into a row environment, and are typeset to fit within
+the given number of columns, continuing to the next row if 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.

Added: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.pdf	2016-12-02 22:56:27 UTC (rev 42621)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.pdf	2016-12-02 22:57:05 UTC (rev 42622)

Property changes on: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.svg
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.svg	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/images/image.svg	2016-12-02 22:57:05 UTC (rev 42622)
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="49.831249"
+   height="19.308453"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.5 r10040"
+   sodipodi:docname="image.pdf">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="5.6"
+     inkscape:cx="12.423968"
+     inkscape:cy="-19.541387"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     fit-margin-top="3"
+     fit-margin-left="3"
+     fit-margin-right="3"
+     fit-margin-bottom="3"
+     inkscape:window-width="1914"
+     inkscape:window-height="1126"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-322.77429,-458.49648)">
+    <text
+       xml:space="preserve"
+       style="font-size:10px;font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Libertinus Serif;-inkscape-font-specification:Libertinus Serif Bold Italic"
+       x="325.71429"
+       y="468.07648"
+       id="text2985"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan2987"
+         x="325.71429"
+         y="468.07648">An image.</tspan></text>
+    <path
+       style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+       d="m 331.33004,470.76685 33.33503,1.51523 -32.57742,1.76777 27.52666,0.50508"
+       id="path3001"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>

Added: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.pdf	2016-12-02 22:56:27 UTC (rev 42621)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.pdf	2016-12-02 22:57:05 UTC (rev 42622)

Property changes on: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.svg
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.svg	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/images/image2.svg	2016-12-02 22:57:05 UTC (rev 42622)
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="52.571426"
+   height="34"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.5 r10040"
+   sodipodi:docname="image.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="5.6"
+     inkscape:cx="21.536983"
+     inkscape:cy="21.62295"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     fit-margin-top="3"
+     fit-margin-left="3"
+     fit-margin-right="3"
+     fit-margin-bottom="3"
+     inkscape:window-width="1914"
+     inkscape:window-height="1126"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-333.36358,-483.84064)">
+    <path
+       sodipodi:type="arc"
+       style="fill:#e6e6e6;stroke:#000000;stroke-width:0.50000000000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;fill-opacity:1"
+       id="path3049"
+       sodipodi:cx="37.94643"
+       sodipodi:cy="40.379883"
+       sodipodi:rx="23.035713"
+       sodipodi:ry="13.749999"
+       d="m 60.982143,40.379883 c 0,7.593915 -10.31344,13.749999 -23.035713,13.749999 -12.722273,0 -23.035713,-6.156084 -23.035713,-13.749999 0,-7.593915 10.31344,-13.749999 23.035713,-13.749999 12.722273,0 23.035713,6.156084 23.035713,13.749999 z"
+       transform="translate(321.70286,460.46076)" />
+    <text
+       xml:space="preserve"
+       style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:TeX Gyre Heros;-inkscape-font-specification:TeX Gyre Heros"
+       x="359.62921"
+       y="498.57422"
+       id="text3039"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan3041"
+         x="359.62921"
+         y="498.57422">Another</tspan><tspan
+         sodipodi:role="line"
+         x="359.62921"
+         y="511.07422"
+         id="tspan3051">image</tspan></text>
+  </g>
+</svg>

Added: trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf	2016-12-02 22:56:27 UTC (rev 42621)
+++ trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf	2016-12-02 22:57:05 UTC (rev 42622)

Property changes on: trunk/Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx	2016-12-02 22:57:05 UTC (rev 42622)
@@ -0,0 +1,3493 @@
+
+% \iffalse meta-comment
+%
+% Copyright 2016 Brian Dunn
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+%   http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% \fi
+
+%
+% \iffalse
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{keyfloat}
+%<package>    [2016/12/02 v0.11 Key/value interface for floats and the subcaption package.]
+%
+%<*driver>
+\documentclass{ltxdoc}
+
+\newcommand*{\mypackagename}{keyfloat}
+\newcommand{\quicksummary}{Provides a key/value interface for generating floats.}
+
+\usepackage{fourier}% for the \danger symbol
+
+\usepackage{lmodern}
+% \usepackage{libertine}
+\usepackage[T1]{fontenc}
+\usepackage[utf8]{inputenc}
+\usepackage{textcomp}	% provides \degree, \textquotesingle, \textmu
+
+\usepackage{newunicodechar}
+\newunicodechar{ff}{ff}
+\newunicodechar{fi}{fi}
+\newunicodechar{fl}{fl}
+\newunicodechar{ffi}{ffi}
+\newunicodechar{ffl}{ffl}
+% \newunicodechar{°}{\degree}
+\newunicodechar{ρ}{\ensuremath{\rho}}
+\newunicodechar{⨯}{\texttimes}
+\newunicodechar{⁄}{\textfractionsolidus}
+% \newunicodechar{®}{\textregistered}
+% \newunicodechar{©}{\textcopyright}
+\newunicodechar{—}{---}
+\newunicodechar{–}{--}
+% \newunicodechar{”}{''}
+% \newunicodechar{“}{``}
+% \newunicodechar{§}{\S}
+% \newunicodechar{¶}{\P}
+% \newunicodechar{†}{\dag}
+\newunicodechar{‡}{\ddag}
+
+\usepackage{microtype}
+
+\usepackage{etoolbox}
+
+\usepackage[log-declarations=false]{xparse}
+
+\usepackage[svgnames]{xcolor}
+\definecolor{myurlcolor}{rgb}{0,0,.7}
+\definecolor{mylinkcolor}{rgb}{.7,0,0}
+\definecolor{codecolor}{rgb}{0,.4,.2}
+\definecolor{overviewcolor}{rgb}{0,.2,.4}
+
+
+\usepackage{graphicx}
+\graphicspath{{images/}}
+
+\usepackage{enumitem}
+
+\usepackage{array}
+\usepackage{booktabs}
+\usepackage{threeparttable}
+
+\usepackage{fancybox}% must be loaded before fancyvrb
+\usepackage{fancyvrb}
+
+
+\usepackage{caption}
+\usepackage{newfloat}
+
+\DeclareFloatingEnvironment[
+fileext=lox,
+listname={List of Examples},
+name=Example,
+placement=hbp
+]{example}
+
+\captionsetup[example]{
+format=hang,
+font=bf,
+justification=raggedright,
+singlelinecheck=false,
+skip=0pt,
+position=top,
+}
+
+\captionsetup[figure]{
+	style=default, justification=centering,
+	margin=0pt, parskip=0pt, skip=2ex,
+	labelfont={small,bf},textfont={small,bf}
+}
+
+\captionsetup[table]{
+	style=default, justification=centering,
+	margin=0pt, parskip=0pt, skip=1ex,
+	labelfont={small,bf},textfont={small,bf}
+}
+
+\captionsetup[subfigure]{
+	style=default, justification=centering,
+	margin=0pt, parskip=0pt, skip=2ex,
+	labelfont={small},textfont={small}
+}
+
+\captionsetup[subtable]{
+	style=default, justification=centering,
+	margin=0pt, parskip=0pt, skip=1ex,
+	labelfont={small},textfont={small}
+}
+
+
+
+
+\usepackage{tikz}
+\usetikzlibrary{positioning,fit,backgrounds,calc,shapes.geometric,shadows}
+
+\usepackage[framemethod=tikz]{mdframed}
+
+\mdfdefinestyle{boxroundshadow}{linewidth=1pt,innerleftmargin=0in,innerrightmargin=0in,%
+innertopmargin=0in,innerbottommargin=0in,%
+align=center,roundcorner=3pt,shadow=true,shadowcolor=black!50,shadowsize=4pt,%
+leftmargin=0pt,rightmargin=0pt,%
+frametitlebackgroundcolor=black!15,%
+skipabove=0ex,skipbelow=0ex,%
+frametitlerulewidth=1pt,frametitleaboveskip=5pt,%
+}
+
+\newmdenv[style=boxroundshadow,align=center]{mdtightframe}
+
+\newmdenv[style=boxroundshadow,align=center,%
+	innertopmargin=3pt,innerbottommargin=3pt,%
+	innerleftmargin=3pt,innerrightmargin=3pt]{mdlooseframe}
+
+
+\usepackage[normalem]{ulem}
+
+% \usepackage{verbatim}
+% \usepackage{fancyvrb}
+
+% \usepackage{comment}
+% \excludecomment{testing}
+
+% \usepackage{morefloats}
+% \usepackage{marginfix}
+
+\usepackage{tocloft}
+\setlength{\cftsubsecnumwidth}{3em}
+\setlength{\cftsubsubsecindent}{2.8em}
+\setlength{\cftsubsubsecnumwidth}{4em}
+\setlength{\cftbeforesubsecskip}{1ex}
+
+% \usepackage{titletoc}
+
+\usepackage{tocdata}[2016/12/02]% v0.12 or later
+
+
+
+\usepackage{titleps}
+
+\newpagestyle{pageheadfoot}{
+	\headrule
+	\sethead{\pkg{\mypackagename}}{}{\thepage}
+% 	\renewcommand{\makefootrule}{\rule[2.5ex]{\linewidth}{.4pt}}
+	\setfoot{}{}{}
+}
+
+\pagestyle{pageheadfoot}
+
+
+
+
+\usepackage[pdftex,bookmarks=true,hidelinks,%
+colorlinks,linkcolor=mylinkcolor,urlcolor=myurlcolor,%
+pageanchor=true,hyperindex=false,
+]{hyperref}
+
+\hypersetup{%
+pdfinfo={%
+Title={The LaTeX \mypackagename\ package},%
+Author={Brian Dunn},%
+Subject={A key/value interface for LaTeX floats.},%
+Keywords={LaTeX, floats, key/val, subcaption, rows}%
+}}
+
+
+\usepackage{cleveref}
+
+\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}}}
+
+
+
+% \begin{newexample}[cross-reference commands / notes]{caption}
+% code listing to be typeset and then executed
+% \end{example}
+%
+% Using a minipage to keep the results on one page,
+% reads the code listing as a verbatim input using
+% the fancybox package, then displays the code listing
+% as a verbatim output, and also executes the code
+% and displays the result immediatly
+% after the environment, followed by a closing \cs{hrule}.
+% A title caption is specified,
+% along with optional cross-referencing commands to
+% refer to the resulting float if there is one.
+
+\definecolor{examplerulecolor}{rgb}{.9,.9,.9}
+
+\NewDocumentEnvironment{newexample}{+O{} m}
+{%
+% Copy the environment's contents to the file kf_cut.tex:
+\VerbatimOut[gobble=2,tabsize=4]{kf_cut.tex}}
+{\endVerbatimOut
+% Typeset the example:
+\addvspace{2ex}
+\minipage{\linewidth}
+\captionsetup{type=example}%
+\bigskip\hrule\medskip
+\caption{#2}
+\textcolor{examplerulecolor}{\smallskip\hrule}
+% Typeset the contents as verbatim:
+\VerbatimInput[tabsize=4]{kf_cut.tex}
+\unskip
+\ifstrempty{#1}
+{}
+{{\textcolor{examplerulecolor}{\hrule}\medskip\itshape\small #1}}
+\par\smallskip\hrule height .8pt\medskip
+\endminipage
+}
+
+% Outside of the environment's scope, input the example to generate its output
+% and labels:
+\AfterEndEnvironment{newexample}
+{\par\unskip\input{kf_cut.tex}%
+}
+
+
+
+
+
+% Indexing improvements:
+\makeatletter
+
+\newcommand*{\Desc at Type}[1]{\raggedleft{\scriptsize#1}\quad}
+
+% \Describe at Usage{name}{margin tag}{index tag}
+\newcommand*{\Describe at Usage}[3]{%
+% \@bsphack%
+\leavevmode\marginpar{\Desc at Type{#2}\texttt{#1}}%
+\index{#1\actualchar{\protect\ttfamily#1} (#3)\encapchar usage}%
+\index{#3s:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar usage}%
+% \@esphack%
+\ignorespaces%
+}
+
+% \Describe at CmdUsage{name}{margin tag}{index tag}
+% where name is a \macro
+\newcommand*{\Describe at CmdUsage}[3]{%
+% \@bsphack%
+\leavevmode\marginpar{\Desc at Type{#2}\cmd{#1}}%
+\SpecialIndex@{#1}{ (#3)\encapchar usage}%
+\index{#3s:\levelchar\cmd{#1}\encapchar usage}\ignorespaces%
+% \@esphack%
+\ignorespaces%
+}
+
+\newcommand*{\DescribeCommand}[1]{\Describe at Usage{#1}{Cmd}{command}}
+\newcommand*{\DescribeFile}[1]{\Describe at Usage{#1}{File}{file}}
+\newcommand*{\DescribePackage}[1]{\Describe at Usage{#1}{Pkg}{package}}
+\newcommand*{\DescribeOption}[1]{\Describe at Usage{#1}{Opt}{option}}
+\newcommand*{\DescribeArgument}[1]{\Describe at Usage{#1}{Arg}{argument}}
+\newcommand*{\DescribeBoolean}[1]{\Describe at Usage{#1}{Bool}{boolean}}
+\newcommand*{\DescribeLength}[1]{\Describe at CmdUsage{#1}{Len}{length}}
+\newcommand*{\DescribeCounter}[1]{\Describe at Usage{#1}{Ctr}{counter}}
+\newcommand*{\DescribeSimple}[1]{\leavevmode\marginpar{\raggedleft\texttt{#1}}\index{#1=\texttt{#1}}\ignorespaces}
+\renewcommand{\PrintEnvName}[1]{\strut \MacroFont {\scriptsize{}Env\quad}#1\ }
+\renewcommand{\PrintDescribeEnv}[1]{\strut \MacroFont {\scriptsize{}Env\quad}#1\ }
+
+\newcommand*{\DescribeKey}[1]{%
+\Describe at Usage{#1}{Key}{key}%
+}
+
+
+\newcommand{\margintag}[1]{%
+\marginpar{\raggedleft\textcolor{blue!70!black}{#1}}%
+\ignorespaces%
+}
+
+\makeatother
+
+
+% \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}}
+
+\makeatletter
+\newcommand{\watchout}[1][]{%
+\@bsphack%
+\marginpar{\hspace*{\fill}%\includegraphics[height=3ex]{symbol_warning.pdf}
+\textcolor{DarkRed}{\large\danger\normalsize\quad#1}}%
+\@esphack%
+}
+\makeatother
+
+
+
+
+% \setlength{\marginparsep}{1em}
+% \setlength{\marginparpush}{.7ex}
+\setlength{\parindent}{0em}
+\setlength{\parskip}{2ex}
+\setlength{\IndexMin}{40ex}
+
+
+
+\newcommand{\testtable}{%
+\begin{tabular}{cc}%
+\hline\rule{0pt}{2.7ex}%
+A & B \\
+C & D \\
+\hline
+\end{tabular}%
+}
+
+\newcommand{\testwidetable}{%
+\begin{tabular}{cccc}%
+\hline\rule{0pt}{2.7ex}%
+A & B & C \\
+D & E & F \\
+\hline
+\end{tabular}%
+}
+
+
+\newcommand{\mainsubarg}{\texttt{\{\}} or \texttt{subgrp}}
+\newcommand{\keyvalsarg}{keys/values}
+
+\setlength{\floatsep}{5ex plus 1ex minus 1ex}
+\setlength{\dblfloatsep}{5ex plus 1ex minus 1ex}
+
+
+
+\usepackage{\mypackagename}
+
+\setcounter{IndexColumns}{2}
+
+\DisableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+  \DocInput{\mypackagename.dtx}
+\end{document}
+%
+%</driver>
+% 
+% \fi
+%
+% \iffalse
+%<*package>
+% \fi
+%
+% \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
+%   Lower-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
+%   Digits        \0\1\2\3\4\5\6\7\8\9
+%   Exclamation   \!     Double quote \"      Hash (number) \#
+%   Dollar        \$     Percent       \%     Ampersand     \&
+%   Acute accent \'      Left paren    \(     Right paren   \)
+%   Asterisk      \*     Plus          \+     Comma         \,
+%   Minus         \-     Point         \.     Solidus       \/
+%   Colon         \:     Semicolon     \;     Less than     \<
+%   Equals        \=     Greater than \>      Question mark \?
+%   Commercial at \@     Left bracket \[      Backslash     \\
+%   Right bracket \]     Circumflex    \^     Underscore    \_
+%   Grave accent \`      Left brace    \{     Vertical bar \|
+%   Right brace   \}     Tilde         \~}
+
+% \changes{v0.10}{2016/12/01}{\ 2016/12/01 Initial ver.}
+% \changes{v0.11}{2016/12/02}{\ 2016/12/02}
+
+
+
+% \GetFileInfo{\mypackagename.sty}
+%
+% \DoNotIndex{\newcommand,\renewcommand,\addtocounter,\begin,\end,\begingroup,\endgroup}
+% \DoNotIndex{\global,\ifbool,\ifthenelse,\isequivalentto,\let}
+% \DoNotIndex{\booltrue,\boolfalse}
+% \expandafter\DoNotIndex\expandafter{\detokenize{\(,\),\,,\\,\#,\$,\%,\^,\_,\~,\ ,\&,\{,\}}}
+%
+%
+% \thispagestyle{empty}
+% \begin{center}
+% \vfill
+% ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf}
+% \vfill
+% {\Huge The \LaTeX\ \pkg{\mypackagename} Package}
+% \bigskip
+%
+% \fileversion{} --- \filedate
+%
+% \bigskip
+%
+% {\small\copyright{} 2016} Brian Dunn\\ \small \texttt{bd at BDTechConcepts.com}
+%
+% \vspace{.5in}
+%
+% {\Large \textup{\quicksummary}}
+%
+%
+% \vfill
+%
+% 
+% ^^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 % \published{}
+% ^^A % \subtitle{\textup{Subtitle}}
+% ^^A %
+% ^^A % \maketitle
+%
+% \vfill
+%
+% \begin{abstract}
+% \noindent
+% The \pkg{keyfloat} package provides a key/value user interface for quickly
+% creating figures with a single image each, figures with arbitrary contents,
+% tables, subfloats, rows of floats, and floats [H].
+%
+% Key/value combinations may specify a caption and label, a width proportional
+% to \cs{linewidth}, a fixed width and/or height, rotation, scaling, a
+% tight or loose frame, an \cs{arraystretch}, a continued float,
+% additional supplemental text,
+% and an artist/author's name with automatic index entry.
+% When used with the \pkg{tocdata} package, the name also appears in the
+% List of Figures.
+%
+% Floats may be placed into a row environment, and are
+% typeset to fit within the given number of columns,
+% continuing to the next row if 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
+% As an example, a typical command to include a figure with a framed image of half \cs{linewidth}
+% could be: \\
+% \hspace*{1em}\verb|\keyfig*[hbp]{f,lw=.5,c={A caption},l={fig:label}}{image}|
+% \end{abstract}
+%
+% \vspace*{\fill}
+% \vspace*{\fill}
+% \vspace*{\fill}
+% \end{center}
+% \clearpage
+%
+% \tableofcontents
+% \listofexamples
+% \listoffigures
+% \listoftables
+%
+%
+% \thispagestyle{pageheadfoot}
+%
+% \clearpage
+%
+%^^A \part{keyfloat.sty}
+%
+% \section{Introduction}
+%
+% The \pkg{keyfloat} package simplifies the creation
+% of \LaTeX\ floats, while still allowing a number of useful features.
+%
+%
+% \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{figure}
+% \centering
+% \includegraphics[width=3in]{filename}
+% \caption{A Figure}
+% \label{fig:somelabel}
+% \end{figure}
+% \end{verbatim}
+% \unskip
+%
+% When doing that often enough, it makes sense to factor the common code:
+% \begin{verbatim}
+% \onefigure[3in]{filename}{A Figure}{fig:somelabel}
+% \end{verbatim}
+% \unskip
+% 
+% Expanding the capability of \cs{onefigure} via \pkg{xparse} can lead to the general case of:
+% \begin{verbatim}
+% \onefigure*[loc](width){filename}(add'l text)[shortcap]{caption}*[label]
+% \end{verbatim}
+% \unskip
+% Attempting to add additional features such as frames and continued floats
+% hits the limit of nine parameters for a \TeX\ macro,
+% requiring that new features use some kind of change-state macros instead.
+% Attempting to support rows of floats or subfloats only made things more complicated still.
+% 
+% A key/value system solves the problem of adding more features,
+% does not require much additional typing, is a more self-documenting
+% syntax, and allows the sharing of keys with subfloats as well.
+% Thus, the \pkg{keyfloat} package.
+%
+% \subsection{The \pkg{keyfloat} Package}
+% 
+% Using \pkg{keyfloat}, the first example above becomes:
+% \begin{verbatim}
+% \keyfig{w=3in,c=A Figure,l=fig:somelabel}{filename}
+% \end{verbatim}
+% \unskip
+% 
+% The \cs{onefigure} example above becomes:
+% \begin{verbatim}
+% \keyfig*[loc]{w=width,t={add'l text},sc=shortcap,cstar=caption,
+%     l=label}{filename}
+% \end{verbatim}
+%
+% \subsection{Features}
+%
+% The macros and environments provided by \pkg{keyfloat} include:
+% \begin{description}
+% \item[\cs{keyfig}:] A figure with an image.
+% \item[\cs{keyfigbox}:] A figure with arbitrary contents.
+% \item[\cs{keyparbox}:] A ``figure'' without a caption, useful
+%	to place uncaptioned text inside a group,
+% \item[\cs{keytab}:] A table.
+% \item[keyfigure:] A figure environment.
+% \item[keytable:] A table environment.
+% \item[keyfloats:] A group of rows and columns of floats.
+% \item[keysubfigs:] A figure containing a group of rows and columns of subfigures.
+% \item[keysubtabs:] A table containing a group of rows and columns of subtables.
+% \end{description}
+%
+% Additional features include:
+% \begin{itemize}
+% \item Rows and columns of floats may be generated by placing them inside a \env{keyfloats}
+% environment.
+% \item Subfloats may be generated by placing them inside a \env{keysubfigs}
+% or \env{keysubtabs} environment.
+% \item The number of columns is specified, and extra
+% floats are placed onto additional rows.
+% \item Floats may be placed [H]ere
+% \item Floats may be starred to span two columns.
+% \item Continued floats may be used to repeat the previous float number.
+% \item A figure may contain an image, with additional sizing, rotation, and a frame.
+% \item Tables may be stretched.
+% \item Boxes of arbitrary contents may be assigned a width and framed.
+% \item Floats may be moved into and out of the grouping environments as needed.
+% \item An artist/author's name may be added to a figure and the index.
+% \item If the \pkg{tocdata} package is loaded (use v0.12+),
+%	the name is also added to the \acro{LOF}.
+% \item Additional descriptive text may be added as well.
+% \item Frames may be customized.
+% \end{itemize}
+%
+% A large number of examples are provided, each showing \LaTeX\ source and
+% \margintag{examples}
+% the resulting float.
+%
+% A customized index is included at the back of the documentation.
+% \margintag{index}
+%
+% Blue margin tags are used to help quickly find information, and often
+% \margintag{margin tags}
+% indicate the destination of index entires.
+%
+% Several warnings are noted in the text.  Watch out for these special cases.
+% \watchout[warnings]
+%
+% See the ``troubleshooting'' section of the index for help
+% \margintag{problems}
+% with specific problems which may occur.
+%
+%
+%
+% \clearpage
+%
+% \section{Using the \pkg{keyfloat} Package}
+%
+% 
+% \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.
+%
+% \DescribeMacro{\keyfigbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents} \\
+% A macro to generate a figure with arbitrary paragraph contents.
+% See \cref{ex:keyfigbox}.
+%
+% \DescribeMacro{\keyparbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents} \\
+% A macro to generate a figure with arbitrary paragraph contents,
+% but no number or caption. This is equal to a \cs{keyfigbox} with |cstar={}|.
+% Mostly useful to add supplemental information inside a row of floats or subfloats.
+% See \cref{ex:keyparbox}.
+%
+% \DescribeMacro{\keytab} * \oarg{loc} \marg{\keyvalsarg} \marg{tabular contents} \\
+% A macro to generate a table with tabular contents.
+% Usually use the \env{keytable} environment instead.
+%
+% \DescribeEnv{keyfigure} * \oarg{loc} \marg{\keyvalsarg} \\
+% An environment to generate a figure with arbitrary contents.
+% Useful for multi-paragraph contents.
+% See \cref{ex:keyfigure}.
+%
+% \DescribeEnv{keytable} * \oarg{loc} \marg{\keyvalsarg} \\
+% An environment to generate a table with arbitrary contents.
+% Useful for larger tables.
+% See \cref{ex:keytable}.
+%
+% \medskip\hrule
+% The above macros and environments may be used by themselves,
+% or inside the following \env{keyfloats}, \env{keysubfigs}, or
+% \env{keysubtabs} environments.
+% \medskip\hrule
+%
+%
+% \DescribeEnv{keyfloats} * \oarg{loc} \marg{num columns} \\
+% A group of figures or tables typeset in rows.  May be nested.
+% See \cref{ex:keyfloats}.
+%
+% \DescribeEnv{keysubfigs} * \oarg{loc} \marg{numcols} \marg{keys} \\
+% \DescribeEnv{keysubtabs} * \oarg{loc} \marg{numcols} \marg{keys} \\
+% A group of subfigures or subtables typeset in rows.
+% May not be nested.
+% See \cref{ex:keysubfigs}.
+%
+% \bigskip\hrule
+%
+% The star option create floats which span both columns in a two-column
+% \DescribeArgument{*}
+% document.
+%
+% The [H] location may be used to force a figure to be ``Here'', in the
+% \DescribeArgument{{[H]}}
+% form of a minipage instead of a float.  A caption and label may
+% still be assigned.
+%
+% The star and [loc] options are ignored for floats inside a \env{keyfloats},
+% \DescribeArgument{{[loc]}}
+% \env{keysubfigs}, or \env{keysubtabs} environment.  Note that these
+% container environments may have their own star and [loc] options.
+%
+%
+%
+%
+%
+%
+% \subsection{Keys and Values}
+%
+%
+% \newcommand{\largebullet}{{\Large\textbullet}}
+%
+% \begin{keytable}[bp]{c={Keys and Values — Part I},l={tab:keyvals},stretch=1.5}
+% \index{keys>and values}
+% \begin{threeparttable}
+% \small
+% \begin{tabular}{>{\ttfamily}cc>{\raggedright}p{2.5in}>{\centering\arraybackslash}>{\ttfamily\arraybackslash}p{1in}}
+% \toprule
+% \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} \\
+% 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} \\
+% 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  \\
+% ap & \largebullet & Artist's prefix, such as ``Mr.''\tnote{b} & ap=Mr. \\
+% af & \largebullet & Artist's first name.\tnote{b} & af=First \\
+% al & \largebullet & Artist's last name.\tnote{b} & al=Last \\
+% as & \largebullet & Artist's suffix, such as |~III|.\tnote{b} & |al=~III| \\
+% t & \largebullet &  Additional text.  May include paragraphs. \\
+% 	Enclose in braces if a comma is included. 
+%	May need \cs{protect} before macro calls.
+%	Fully-justified alignment.
+%	& t={Paragraphs} \\
+% tc & \largebullet & Additional text, aligned to the center. & tc={Paragraphs} \\
+% tl & \largebullet & Additional text, aligned to the left. & tl={Paragraphs} \\
+% tr & \largebullet & Additional text, aligned to the right. & tr={Paragraphs} \\
+% \bottomrule
+% \end{tabular}
+% \begin{tablenotes}
+% \item[a:] All the keys in Part I may be used with the
+%	\env{keysubfigs} and \env{keysubtabs} environments.
+% \item[b:] Artist keys: Only used in Figure floats.
+%	A fixed-width non-breakable space is placed between names, except that
+%	the optional suffix is connected directly to the last name, allowing
+%	``|as={, Title}|'', for example.
+% \end{tablenotes}
+% \smallskip
+% \hrule\medskip\centering
+% {\footnotesize \dots\ continued}
+% \end{threeparttable}
+% \end{keytable}
+
+
+
+% \begin{keytable}{
+%	c={Keys and Values — Part II},cont,stretch=1.5}
+% \index{keys>and values}
+% \begin{threeparttable}
+% \small
+% \begin{tabular}{>{\ttfamily}c>{\raggedright}p{2.5in}>{\centering\arraybackslash}>{\ttfamily\arraybackslash}p{1in}}
+% \toprule
+% \textrm{Key}\tnote{a} & Description & \textrm{Example} \\
+% \midrule
+% lw &  Set the width to a fraction of \cs{linewidth}.  Cancels |w|.
+% 	If a non-image float, sets the width of the text box. & lw=.5 \\  
+% w &  Set the actual width.  Cancels |lw|.
+% 	If a non-image float, sets the width of the text box. & w=2in \\
+% h &  Set the actual height, images only.  & w=2in \\
+% s &  Set the image scale, images only.  & s=3 \\
+% a &  Set the rotation angle; counter-clockwise degrees. & r=90 \\
+% f &  Selects a loose frame with the current \cs{fboxsep}.
+%	Only rotated with \cs{keyfig}.  & f \\
+% ft &  Selects a tight frame with no \cs{fboxsep}.  Useful for photographs,
+% 	or diagrams which already have some margin built in. & ft \\
+% stretch & Sets \cs{arraystretch} inside the float. & stretch=1.5 \\
+% \bottomrule
+% \end{tabular}
+% \begin{tablenotes}
+% \item[a:] None of the keys in Part II are used in the
+%	\env{keysubfigs} and \env{keysubtabs} environments.
+% \end{tablenotes}
+% \end{threeparttable}
+% \end{keytable}
+%
+% \Cref{tab:keyvals} shows the key/value combinations which are allowed.
+% In most cases these may be used in any order and any combination,
+% except for the following:
+%
+% The keys labeled "Sub"\margintag{subfloat keys}
+% \index{subfloat>keys}\index{keys>subfloats}
+% may be used for the \env{keysubfigs} and
+% \env{keysubtabs} environments, which group a number of subfloats together under
+% one master float.  The master float has its own caption, label, and text, and
+% each subfloat inside the group likewise has its own set of keys.
+%
+% \env{keyfloats} does not accept any keys at all.\margintag{keyfloats keys}
+% \index{keyfloats>keys}\index{keys>keyfloats}
+%
+% The ``artist'' keys |ap|, |af|, |al|, and |as| are only used by figures.
+%
+% The |stretch| key increases space between tabular elements.
+%
+% The rest of the macros
+% and environments accept all of the keys, as they each create an individual
+% float or subfloat, and each may have its own assigned dimensions and frame.
+%
+% \Cref{tab:captions} shows the combinations of the caption-related keys
+% \margintag{short/long\\caption combinations}
+% |c|, |cstar|, and |sc|, and how they control the caption numbering and
+% entries in the \acro{LOF}/\acro{LOT}.
+% 
+%
+% \begin{keytable}{c={Caption-Related Key Combinations},l=tab:captions,stretch=1.5}
+% \index{caption>options}
+% \begin{threeparttable}
+% \small
+% \begin{tabular}{ccccc}
+% \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} \\
+% \cmidrule(r){1-3} \cmidrule(l){4-5}
+% \largebullet & — & — & Numbered & Caption \\
+% \largebullet & — & \largebullet & Numbered & Short Caption \\
+% \midrule
+% — & \largebullet & — & Unnumbered & None \\
+% — & \largebullet & \largebullet & Unnumbered & Short Caption \\
+% \midrule
+% — & |cstar={}| & Ignored & None & None \\
+% \bottomrule
+% \end{tabular}
+% \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
+% will appear in the List of Figures or List of Tables, or if there will be no listing.
+% \end{tablenotes}
+% \end{threeparttable}
+% \end{keytable}
+%
+%
+%
+%
+%
+% \clearpage
+%
+% \subsection{Examples}
+%
+%
+% \subsubsection{Single Floats}
+%
+%
+% \begin{newexample}[\Cref{fig:simple}]{Figure with an image from a file}
+% \keyfig{c=A \cs{keyfig} with an image,l=fig:simple}{image}
+% \end{newexample}
+%
+% This float (\cref{fig:simple}) is shown at its natural size
+% \margintag{natural size}
+% because no width or height modifiers were specified.  When used alone like this,
+% a regular float is created.
+% \index{image>natural size}
+%
+%
+% \begin{newexample}[\Cref{fig:figbox}]{Figure with arbitrary contents\label{ex:keyfigbox}}
+% \keyfigbox{f,c={A \cs{keyfigbox}},l=fig:figbox}
+% 	{Some text.  More text. \par  Another paragraph.}
+% \end{newexample}
+%
+% The \cs{keyfigbox} creates a figure with a box of arbitrary contents, instead of
+% an image from a file.  Its default width is the full \cs{linewidth},\margintag{default width}
+% \index{float>default width}
+% unless |w| or |lw| keys are used.
+%
+%
+% \begin{newexample}[\Cref{fig:environment}]
+% {Figure environment with arbitrary contents\label{ex:keyfigure}}
+% \begin{keyfigure}{f,c={A \env{keyfigure} environment},
+% 	l=fig:environment}
+% Arbitrary contents may go here.
+% 
+% Including multiple paragraphs.
+% \end{keyfigure}
+% \end{newexample}
+%
+% The \env{keyfigure} environment is preferred over the \cs{keyfigbox} macro when
+% multiple lines of contents are to be included.
+%
+% \begin{newexample}[\Cref{tab:simpletable}]{Table macro}
+% \keytab{c=A \cs{keytab} table,l=tab:simpletable}{\testtable}
+% \end{newexample}
+%
+% Do not try to use tables which overflow the page.
+%
+% For anything other than a simple table, use the \env{keytable} environment.
+% See \cref{ex:keytable}.
+%
+% For large tables, use the \pkg{longtable} or \pkg{supertabular} packages.
+% \margintag{large tables}\index{tables>large}
+% \index{troubleshooting>large tables}
+%
+%
+% \begin{newexample}[\Cref{tab:environment}]
+% {Table environment with arbitrary contents\label{ex:keytable}}
+% \begin{keytable}{f,c={A \env{keytable} environment},
+% 	l=tab:environment}
+% Arbitrary contents may go here.
+%
+% \testtable
+% \end{keytable}
+% \end{newexample}
+%
+% The \env{keytable} environment is preferred over the \cs{keytab} macro
+% since most tables are multi-line creations.
+%
+% \clearpage
+%
+% \begin{newexample}[\Cref{fig:options}]{Figure with many options selected}
+% \keyfig{
+% 	w=2in,ft,r=15,
+% 	c=A figure with many options,
+% 	sc=A figure with options,
+% 	t={Additional text.  Multiple paragraphs may be used.
+% 	The entire text is enclosed in braces because a comma
+% 	is included. Alignment may be set by using
+% 	tags \texttt{tc}, \texttt{tl}, or \texttt{tr}
+% 	instead of \texttt{t}},
+% 	l=fig:options
+% }{image}
+% \end{newexample}
+%
+% Width is fixed at 2\,in, a tight frame is specified (\cs{fboxsep} of 0\,pt),
+% a short caption appears in the List of Figures, and the additional text
+% is using the default fully-justified alignment.
+%
+% Since \cref{fig:options} is a float, it may appear on the following page.
+%
+%
+% \clearpage
+%
+% \begin{newexample}[\Cref{fig:linewidth}]{Using \cs{linewidth}}
+% \keyfig{lw=.5,c=Half of \cs{linewidth},l=fig:linewidth}{image}
+% \end{newexample}
+%
+% \Cref{fig:linewidth} is half of \cs{linewidth} in size.
+% \margintag{\cs{linewidth}}
+% \index{image>\cs{linewidth}}\index{\cs{linewidth}}
+% \index{subfloat>\cs{linewidth}}\index{keyfloats>\cs{linewidth}}
+% When the |lw| key is used inside a \env{keyfloats} or \env{keysubfigs} environment,
+% the \cs{linewidth} will be proportional to the sub-box for each element.
+% When used alone, such as here, the \cs{linewidth} is the full width of the text on
+% this page.
+%
+% |lw| and |w| are not used at the same time.
+% If both |lw| and |w| are specified, the last one cancels any previous ones.
+%
+%
+% \clearpage
+%
+% \begin{newexample}[\Cref%
+%     {fig:looseframe,fig:tightframe,tab:looseframe,tab:tightframe}%
+% ]{Using frames}
+% \begin{keyfloats}[hbp]{4}
+% \keyfig{f,c=Loosely-framed figure,l=fig:looseframe}{image}
+% \keyfig{ft,c=Tightly-framed figure,l=fig:tightframe}{image}
+% \keytab{f,c=Loosely-framed table,l=tab:looseframe}{\testtable}
+% \keytab{ft,c=Tightly-framed table,l=tab:tightframe}{\testtable}
+% \end{keyfloats}
+% \end{newexample}
+%
+% The |f| key adds a loose frame with the current \cs{fboxsep}.
+% This is desirable in most cases.
+%
+% The |tf| key adds a tight frame with no separation.
+% This is useful for framing a photograph, or a diagram which already has a margin.
+%
+% Framing tables is seldom recommended.  In the case of the tight frame, \cref{tab:tightframe},
+% note that the external frame almost overwrites the table's natural horizontal rules.
+%
+% Also see \cref{sec:customframes} for customizing frames.
+% \margintag{custom frames}
+%
+%
+% \clearpage
+%
+% \begin{newexample}[\Cref{tab:rotated}]{Using rotation with boxes}
+% \keytab{f,w=.8in,c={Table, rotated},
+% 	r=70,l=tab:rotated,
+% 	tc=(Framed to show box width.)}
+% 	{\testwidetable}
+% \end{newexample}
+%
+% Unless a width is given, a box is the full \cs{linewidth}.
+% \margintag{rotated whitespace}
+% When rotated, this extra horizontal space is rotated into extra vertical space.
+% \index{rotate>box width and vertical space}\index{\cs{linewidth}>with rotation}
+% \index{troubleshooting>rotating>extra space}
+% To avoid this extra space, set a |w| or |lw| to be wide enough
+% \watchout[box width]
+% for the table or other contents,
+% but not much wider.  When this box is rotated, it will not take much more
+% vertical space than necessary.
+%
+% Unlike an image, the frame of a box does not rotate with its contents.
+% \margintag{frame rotation}\index{frame>rotation}
+% \index{troubleshooting>rotating>frame}
+%
+% \begin{newexample}[\Cref{fig:here}]{Located [H]ere}
+% \keytab[H]{c={A table [H]},l=fig:here}{\testtable}
+% \end{newexample}
+%
+% \Cref{fig:here} is 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}
+% Place a \cs{clearpage} before or after to re-sync, if necessary.
+%
+%
+%
+% \begin{newexample}[See fig: ``A starred caption''.]{Unnumbered float}
+% \keyfig[H]{f,cstar={A starred caption}}{image}
+% \end{newexample}
+%
+% A starred caption creates a float without a number, and without
+% an entry in the List of Figures unless there is a non-empty short caption.
+% (See the next example.)
+%
+% Labels cannot be used when there is no number for a float.
+% \watchout[No label]
+% \index{troubleshooting>missing label}
+%
+%
+% \begin{newexample}
+% 	[See fig: ``Starred caption with a short caption''.]
+% 	{Unnumbered float with a \acro{LOF} entry}
+% \keyfig{
+% 	f,cstar={Starred caption with a short caption.},
+% 	sc={Starred short caption}
+% }{image}
+% \end{newexample}
+%
+% A starred caption with a non-empty short caption creates an
+% unnumbered entry in the List of Figures.
+%
+%
+% \begin{newexample}
+% 	[See fig: ``Optional text which is not a caption.'']
+% 	{An unnumbered in-text image}
+% \keyfig[H]{f,cstar={},
+% 	tc={Optional text which is not a caption.}
+% }{image2}
+% \end{newexample}
+%
+% By using [H] and |cstar={}|, the image is placed inline
+% without a number or \acro{LOF} entry.
+%
+% Also see \cref{ex:keyparbox}.
+%
+%
+% \begin{newexample}[\Cref{fig:nexttoparbox}, and the box to its left.]
+% 	{A box without a caption.\label{ex:keyparbox}}
+% \begin{keyfloats}{2}
+% \keyparbox{
+% 	f,lw=.5,
+% 	tc={A \cs{keyparbox} with no number or label.}
+% }{Some contents.}
+% \keyfig{c=Next to a \cs{keyparbox},l=fig:nexttoparbox}{image}
+% \end{keyfloats}
+% \keyparbox[H]{f,lw=.5}{A \cs{keyparbox} [H], outside the floatrow.}
+% \end{newexample}
+%
+% A \cs{keyparbox} is a \cs{keyfigbox} with |cstar={}|,
+% and is mostly useful as an information box inside a row or a set of subfloats.
+%
+%
+%
+%
+% \clearpage
+%
+% \subsubsection{Groups of Floats}
+%
+% \begin{newexample}[\Cref{fig:firstinrow} to \Cref{tab:seventhinrow}]{Groups of figures — \env{keyfloats} environment\label{ex:keyfloats}}
+% \begin{keyfloats}{2}
+% \keyfig{lw=1,f,c={First in a group},
+% 	l=fig:firstinrow,tl={\cs{raggedright} text}
+% 	}{image}
+% \keyparbox{}{\centering A \cs{keyparbox} describing something.
+% 	\par With several paragraphs.}
+% \begin{keyfloats}{2}
+% \keyfig{lw=1,c={Third in a group},
+% 	l=fig:thirdinarow}{image}
+% \keyfig{lw=1,c={Fourth in a group}}{image2}
+% \keyfig{lw=1,c={Fifth in a group}}{image}
+% \keyfig{lw=1,c={Sixth in a group},
+% 	l=fig:sixthinarow}{image2}
+% \end{keyfloats}
+% \keytab{c={Seventh in a group},l=tab:seventhinrow}{\testwidetable}
+% \end{keyfloats}
+% \end{newexample}
+%
+% 
+% \Cref{fig:firstinrow} to \cref{tab:seventhinrow} are in a \env{keyfloats} environment.
+% Furthermore, \Crefrange{fig:thirdinarow}{fig:sixthinarow} are in an
+% additional nested \env{keyfloats} environment, forming a small box of floats inside
+% the larger group.
+%
+% The \env{keyfloats} environment takes an argument for the number of columns.
+% Additional floats are automatically placed on following rows.
+% Changing the number of columns will cause the floats to automatically readjust as
+% necessary.  Leftovers will be centered on the last row.
+%
+% Note that \cs{linewidth} is adjusted for each row and nested row,
+% \watchout[\cs{linewidth}]
+% so the |lw| key will need to be changed if a float is moved to a different nesting level.
+% \index{troubleshooting>\cs{linewidth}}\index{\cs{linewidth}>subfloats}
+% \index{subfloat>\cs{linewidth}}
+%
+% Fixed-width or fixed-height floats may be too large to fit
+% \watchout[image too large]
+% if they are moved into a group.
+% It is the user's responsibility to adjust |w|, |h|, or |lw| as necessary.
+% \index{troubleshooting>image too large}
+%
+% Keyfloats may be positioned [H]: \\
+% \hspace*{2em}|\begin{keyfloats}[H}{2}| \dots
+%
+% Keyfloats may be starred to span both columns in a two-column format: \\
+% \hspace*{2em}|\begin{keyfloats}*{2}| \dots
+%
+%
+% \clearpage
+%
+% \subsubsection{Subfloats}
+%
+%
+%
+%
+% \begin{newexample}[\Cref{fig:subfigs}]{Subfigures — \env{keysubfigs} environment\label{ex:keysubfigs}}
+% \begin{keysubfigs}{3}{c=Subfigures,l=fig:subfigs}
+% \keyfig{lw=1,f,c={First Subfigure},
+% 	l=fig:firstsubfig,t=Some Text}{image}
+% \keyfig{lw=1,f,r=90,c={Second subfigure},
+% 	l=fig:secondsubfig,
+% 	t=Lots of lots of lots of lots of text.}
+% 	{image2}
+% \begin{keyfloats}{1}
+% \keyfig{lw=1,f,c={Third subfigure},l=fig:thirdsubfig}{image}
+% \keytab{c={Fourth subfigure},l=fig:fourthsubfig}{\testtable}
+% \keyfig{lw=.5,f,c={Fifth subfigure},l=fig:fifthsubfig}{image}
+% \end{keyfloats}
+% \end{keysubfigs}
+% \end{newexample}
+% 
+% \Crefrange{fig:firstsubfig}{fig:fifthsubfig} are in
+% the \cref{fig:subfigs} \env{keysubfigs} environment.
+% The \cs{keysubtabs} environment is similar.
+% Mixed types have the type of their container, as shown with \cref{fig:fourthsubfig}.
+%
+% Subfloats are associated floats (a, b, \dots) collected together into one common float
+% (the enclosing \cs{keysubfigs} or \cs{keysubtabs} environment).
+% The enclosing float can have its own caption (call ``Sub-Figures'' in the example),
+% which appears in the \acro{LOF}/\acro{LOT}, and also a label.
+% Each subfloat can have its own caption and label as well, but the
+% subcaption does not appear in the \acro{LOF}/\acro{LOT}.
+%
+% All subfloats are forced to have the same type as
+% its containing float.\index{troubleshooting>mixed subfloats}
+% \watchout[mixed subfloats]
+% A table inside a figure will be labeled as a figure, for example.
+% This avoids miss-labeling as each subfloat must clearly be identified
+% as a child of its containing float.
+%
+% \cs{keysubfigs} and \cs{keysubtabs} may not be used inside\watchout[nested subfloats]
+% \index{troubleshooting>nested subfloats}\index{subfloat>nested}
+% the \env{keyfloats} environment,
+% and cannot be nested inside each other.  (No subfloat |12aa|, |12ab|, |12ba|, etc.)
+%
+% The \env{keyfloats} environment may be used inside \cs{keysubfigs} or
+% \margintag{nested keyfloats}\index{keyfloats>nested}
+% \cs{keysubtabs} to gather subfloats together, such as the
+% three right-most figures in \cref{fig:subfigs}.
+%
+% Subfloats may be located |H|: \\
+% \hspace*{2em}|\begin{keysubfigs}[H]{3}{|key/vals \dots|}|
+% 
+% Subfloats may be starred to span both columns in a two-column format: \\
+% \hspace*{2em}|\begin{keysubfigs}*{2}{|key/vals \dots|}|
+%
+%
+%
+% \clearpage
+%
+% \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,
+% and it is assumed that they are the same float, except that
+% they are separated for some reason such as size on the page.
+%
+% The label may be placed in a continued float, and will still
+% receive the same float number as the prior non-continued float.
+%
+% \begin{newexample}[\Cref{fig:firstcontinued}]{Continued figure}
+% \begin{keyfloats}{2}
+% \keyfig{,c=Figure to be continued}{image}
+% \keyfig{c={\dots continued},cont,l=fig:firstcontinued}{image2}
+% \end{keyfloats}
+% \end{newexample}
+%
+%
+% \clearpage
+% \subsubsection{Continued Subfloats}
+% 
+% The \env{keysubfigs} and \env{keysubtabs} environments may also
+% be given the |cont| key.
+% The containing environment's float receives the same number as the previous float
+% (presumably another subfloat container).
+%
+% \begin{newexample}[\Cref{fig:continuedfigures}]{Continued subfloats}
+% \begin{keysubfigs}{2}{c={A set of figures},l=fig:continuedfigures}
+% \keyfig{c={First of a set},l=fig:contfirst}{image}
+% \keyfig{c={Second of a set},l=fig:contsecond}{image}
+% \end{keysubfigs}
+% \begin{keysubfigs}{2}{c={\dots continued},cont}
+% \keyfig{c={Third of a set},l=fig:contthird}{image2}
+% \keyfig{c={Fourth of a set},l=fig:contfourth}{image2}
+% \end{keysubfigs}
+% \end{newexample}
+%
+%
+%
+% \clearpage
+% \subsubsection{Custom Frames}
+%
+% 
+% \begin{newexample}[\Cref{fig:customframe,fig:customlooseframe}]
+%	{Custom frames with \pkg{mdframed}\label{ex:customframe}}
+% \renewcommand{\KFLTtightframe}[1]{%
+% \begin{mdtightframe}%
+% #1
+% \end{mdtightframe}%
+% }
+% \setlength{\KFLTtightframewidth}{1pt}
+%
+% \renewcommand{\KFLTlooseframe}[1]{%
+% \begin{mdlooseframe}[leftmargin=1.5in,rightmargin=1.5in]%
+% #1
+% \end{mdlooseframe}%
+% }
+% \setlength{\KFLTlooseframewidth}{4pt}
+%
+% \keyfig{ft,c=Custom-framed image,l=fig:customframe}{image}
+% \keyfigbox{f,c=Custom loosely-framed box,
+% 	l=fig:customlooseframe}{A loosely-framed box.}
+% \end{newexample}
+%
+% \DescribePackage{mdframed}
+% \Cref{ex:customframe} shows custom frames
+% created with the \pkg{mdframed} package along with \pkg{tikz}.
+% Note that \pkg{mdframed} uses the full \cs{linewidth}
+% \watchout[\pkg{mdframed} width]
+% even if the left/right margins are explicitly set, which
+% causes extra vertical space when rotated.
+% \index{troubleshooting>rotating>extra space}
+% \index{troubleshooting>mdframed}
+%
+% See \cref{sec:customframes} for more details.
+%
+% \begin{newexample}[\Cref{fig:customshadow,fig:customlooseshadow}]
+%	{Custom shadows with \pkg{fancybox}\label{ex:customshadow}}
+% \renewcommand{\KFLTtightframe}[1]{%
+% \setlength{\fboxrule}{.4pt}
+% \setlength{\fboxsep}{0pt}
+% \setlength{\shadowsize}{2pt}
+% \shadowbox{#1}%
+% }
+% \setlength{\KFLTtightframewidth}{0.4pt}
+%
+% \renewcommand{\KFLTlooseframe}[1]{%
+% \setlength{\fboxrule}{.4pt}
+% \setlength{\fboxsep}{3pt}
+% \setlength{\shadowsize}{2pt}
+% \shadowbox{#1}%
+% }
+% \setlength{\KFLTlooseframewidth}{3.4pt}
+%
+% \keyfig{ft,c=Custom shadow,l=fig:customshadow}{image}
+% \keyfigbox{f,c=Custom loosely-framed shadow,lw=.5,
+% 	l=fig:customlooseshadow}{A loosely-framed shadow box.}
+% \end{newexample}
+%
+% \DescribePackage{fancybox}
+% \Cref{ex:customshadow} shows custom shadow frames
+% created with the \pkg{fancybox} package.
+% This combination respects |lw| and |w|.
+%
+% See \cref{sec:customframes} for more details.
+%
+%
+%
+%
+%
+% \renewcommand{\KFLTtightframe}[1]{%
+% \setlength{\fboxsep}{0pt}%
+% \setlength{\fboxrule}{.4pt}%
+% \fbox{#1}%
+% }
+% \setlength{\KFLTtightframewidth}{.4pt}
+% 
+% \renewcommand{\KFLTlooseframe}[1]{%
+% \setlength{\fboxsep}{3pt}%
+% \setlength{\fboxrule}{.4pt}%
+% \fbox{#1}%
+% }
+% \setlength{\KFLTlooseframewidth}{3.4pt}
+%
+%
+%
+%
+%
+% \clearpage
+% \subsubsection{Artist's Name}
+%
+% \begin{newexample}[\Cref{fig:artist}]{Artist's name — image}
+% \keyfig{ft,ap=Mr.,af=First,al=Last,as={~III},
+%	tc={\textit{About the illustration.}},
+%	c=Artist's name — image,l=fig:artist}{image}
+% \end{newexample}
+%
+%
+% \begin{newexample}[\Cref{fig:artistpar}]{Artist's name — arbitary contents}
+% \tdnameright
+% \begin{keyfigure}{f,ap=Mr.,al=Last,
+%	c=Artist's name — arbitrary contents,l=fig:artistpar}
+% \centering Some text, a quotation, a TikZ\ diagram —
+% anything not an image file.
+% \end{keyfigure}
+% \tdnamecenter
+% \end{newexample}
+%
+% The artist's name and optional prefix/suffix are printed below the figure,
+% and an index entry is made for the name in (Last, First) format,
+% or (Last) if there is no first name.
+% If the \pkg{tocdata} package is loaded, the artist's name is also added to
+% the List of Figures, and the \pkg{tocdata} \cs{tdname}\dots\ macros
+% may be used to align the name.
+%
+%
+% \clearpage
+%
+% \begin{newexample}[\Cref{fig:artistcollection}]{Subfloats with an artist}
+% \begin{keysubfigs}{2}{
+% 	c=Artist's collection, l=fig:artistcollection,
+% 	t={Some fully-justified text just for illustrative purposes,
+% 	in case you have use for large explanations.
+% 	This text may be the full \cs{linewidth} in size. \par
+% 	Multiple paragraphs of text are allowed.},
+% 	ap=Prefix,af=First,al=Last,as={, Suffix}
+% }
+% 	\keyfig{c=Artist's First Work}{image}
+% 	\keyfig{c=Artist's Second Work,
+% 		tc={Commentary about the work.}}{image2}
+% \end{keysubfigs}
+% \end{newexample}
+%
+% A group of figures may be placed into a subfloat container,
+% which may have its own artist keys and additional text.
+% Furthermore, each subfloat inside the collection may also have its
+% own artist tags and additional text.
+%
+%
+% \clearpage
+%
+% \subsection{Customization}
+%
+% \subsubsection{Custom Frames}
+% \label{sec:customframes}
+%
+% \index{frame>custom}
+%
+% There are two user-redefinable framing macros: \\
+% \hspace*{2em}\cs{KFLTtightframe} and \cs{KFLTlooseframe}
+%
+% A float's contents are placed into a box,
+% which is passed to either of these two macros
+% depending on the key |f| or |tf|.
+%
+% Each macro takes one argument and frames it.
+%
+% Each macro has an associated \LaTeX\ length: \\
+% \hspace*{2em}\cs{KFLTtightframewidth} and \cs{KFLTlooseframewidth}
+%
+% These lengths must be redefined to the expected
+% total frame width, equal to the frame thickness plus
+% separation.
+%
+% The defaults definitions are:
+% \begin{Verbatim}[gobble=2]
+% \newcommand{\KFLTtightframe}[1]{%
+% \setlength{\fboxsep}{0pt}%
+% \setlength{\fboxrule}{.4pt}%
+% \fbox{#1}%
+% }
+% \setlength{\KFLTtightframewidth}{.4pt}
+% 
+% \newcommand{\KFLTlooseframe}[1]{%
+% \setlength{\fboxsep}{3pt}%
+% \setlength{\fboxrule}{.4pt}%
+% \fbox{#1}%
+% }
+% \setlength{\KFLTlooseframewidth}{3.4pt}
+% \end{Verbatim}
+%
+% See \cref{ex:customframe} for an example
+% created with the \pkg{mdframed} package,
+% and \cref{ex:customshadow} for an example
+% created with the \pkg{fancybox} package.
+%
+%
+%
+% \subsubsection{Distance between Floats and Rows}
+% \index{distance between floats}
+% \index{subfloat>distance between}
+% \index{float>distance between}
+% \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}
+% \setlength{\floatsep}{5ex plus 1ex minus 1ex}
+% \setlength{\dblfloatsep}{5ex plus 1ex minus 1ex}
+% \end{verbatim}
+%
+%
+% \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}
+% \captionsetup[figure]{
+% 	style=default, justification=centering,
+% 	margin=0pt, parskip=0pt, skip=1ex,
+% 	labelfont={small,bf},textfont={small,bf}
+% }
+% 
+% \captionsetup[table]{
+% 	style=default, justification=centering,
+% 	margin=0pt, parskip=0pt, skip=1ex,
+% 	labelfont={small,bf},textfont={small,bf}
+% }
+% 
+% \captionsetup[subfigure]{
+% 	style=default, justification=centering,
+% 	margin=0pt, parskip=0pt, skip=1ex,
+% 	labelfont={small},textfont={small}
+% }
+% 
+% \captionsetup[subtable]{
+% 	style=default, justification=centering,
+% 	margin=0pt, parskip=0pt, skip=1ex,
+% 	labelfont={small},textfont={small}
+% }
+% \end{verbatim}
+
+
+
+% \clearpage
+%
+% \StopEventually{\PrintChanges\PrintIndex}
+% 
+%
+%
+% \section{Code}
+%
+%
+%
+%
+%
+%
+% \subsection{Required Packages}
+%
+% \DescribePackage{etoolbox} v2.6 or later
+%	for \cs{BeforeBeginEnvironment}, \cs{AfterEndEnvironment}
+%    \begin{macrocode}
+\RequirePackage{etoolbox}[2011/01/03]%
+
+\RequirePackage{xparse}
+
+\RequirePackage{xifthen}
+%    \end{macrocode}
+% \DescribePackage{keyval} Key processing:
+%    \begin{macrocode}
+\RequirePackage{xkeyval}
+%    \end{macrocode}
+% \DescribePackage{graphicx} For \cs{includegraphics} and \pkg{rotating}:
+%    \begin{macrocode}
+\RequirePackage{graphicx}
+%    \end{macrocode}
+% \DescribePackage{caption} Handles all caption-related functions:
+%    \begin{macrocode}
+\RequirePackage{caption}[2010/10/31]% v3.2 to support \phantomcaption
+%    \end{macrocode}
+% \DescribePackage{subcaption} Derived from \pkg{caption}, used to handle subfloats:
+%    \begin{macrocode}
+\RequirePackage{subcaption}
+%    \end{macrocode}
+% \DescribePackage{calc} Used to compute box width minus frame sep and width.
+%    \begin{macrocode}
+\RequirePackage{calc}
+%    \end{macrocode}
+% \DescribePackage{rotating} Provides rotation via then \env{turn} environment:
+%    \begin{macrocode}
+\RequirePackage{rotating}
+%    \end{macrocode}
+
+% Rows of floats are created by a simple \env{minipage} environment,
+% instead of relying on a preexisting package.  This proved to be
+% advantageous when support was added for multiple rows in one
+% environment.
+%
+
+% \subsection{In-line Figures and Tables}
+
+% These macros are commonly used by others.
+
+% \begin{environment}{tablehere} Place a table exactly [H].
+%    \begin{macrocode}
+\ProvideDocumentEnvironment{tablehere}{}
+  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{table}}
+  {\endminipage\bigbreak}
+%    \end{macrocode}
+% \end{environment}
+
+% \begin{environment}{figurehere} Place a figure exactly [H].
+%    \begin{macrocode}
+\ProvideDocumentEnvironment{figurehere}{}
+  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{figure}}
+  {\endminipage\bigbreak}
+%    \end{macrocode}
+% \end{environment}
+
+
+
+% \subsection{Row Counting and Control}
+
+% Used to count position and wrap at end of each row.
+
+
+% \DescribeCounter{KFLT at numcols} Columns per row.
+%    \begin{macrocode}
+\newcounter{KFLT at numcols}
+%    \end{macrocode}
+
+% \DescribeCounter{KFLT at thiscol} Column currently processing.
+% |0| if not yet in a keyfloats or subfloat.
+%
+%    \begin{macrocode}
+\newcounter{KFLT at thiscol}
+%    \end{macrocode}
+
+% \DescribeLength{\KFLT at rowboxwidth} How wide is each box in the row.
+%    \begin{macrocode}
+\newlength{\KFLT at rowboxwidth}
+%    \end{macrocode}
+
+% \subsection{Float Key Handling}
+
+% \DescribeBoolean{KFLT at cont} Continued float?
+%    \begin{macrocode}
+\newboolean{KFLT at cont}{}
+%    \end{macrocode}
+%
+% \DescribeKey{cont} Continued float?
+%
+%    \begin{macrocode}
+\define at key{KFLT at keys}{cont}[true]{\setboolean{KFLT at cont}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at c} Caption storage
+%    \begin{macrocode}
+\newcommand{\KFLT at c}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeBoolean{KFLT at cstar} Starred caption?
+%    \begin{macrocode}
+\newboolean{KFLT at cstar}
+%    \end{macrocode}
+%
+% \DescribeKey{c} Caption
+%
+%    \begin{macrocode}
+\define at key{KFLT at keys}{c}%
+	{\renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{false}}
+%    \end{macrocode}
+%
+% \DescribeKey{cstar} Caption starred?
+%
+%    \begin{macrocode}
+\define at key{KFLT at keys}{cstar}%
+	{\renewcommand{\KFLT at c}{#1}\setboolean{KFLT at cstar}{true}}
+%    \end{macrocode}
+%
+% \DescribeKey{sc} Short caption
+%
+%    \begin{macrocode}
+\define at key{KFLT at keys}{sc}{%
+\renewcommand{\KFLT at sc}{#1}%
+\setboolean{KFLT at scgiven}{true}%
+}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at sc} Short caption storage
+%    \begin{macrocode}
+\newcommand{\KFLT at sc}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeBoolean{KFLT at scgiven} Was a short caption given?
+%    \begin{macrocode}
+\newboolean{KFLT at scgiven}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at type} Float type: ``|figure|'', ``|table|''
+%    \begin{macrocode}
+\newcommand*{\KFLT at type}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\KFLT at listtype} List type: ``|lof|'', ``|lot|''
+%    \begin{macrocode}
+\newcommand*{\KFLT at listtype}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \DescribeKey{l} Label
+%    \begin{macrocode}
+\define at key{KFLT at keys}{l}{\renewcommand{\KFLT at l}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at l} Label storage
+%    \begin{macrocode}
+\newcommand*{\KFLT at l}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% For the \pkg{tocdata} package:
+%
+% \DescribeKey{ap} Artist prefix
+%    \begin{macrocode}
+\define at key{KFLT at keys}{ap}{\renewcommand{\KFLT at ap}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at ap} Storage for artist prefix
+%    \begin{macrocode}
+\newcommand*{\KFLT at ap}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{af} Artist first name
+%    \begin{macrocode}
+\define at key{KFLT at keys}{af}{\renewcommand{\KFLT at af}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at af} Storage for artist first name
+%    \begin{macrocode}
+\newcommand*{\KFLT at af}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{al} Artist last name
+%    \begin{macrocode}
+\define at key{KFLT at keys}{al}{\renewcommand{\KFLT at al}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at al} Storage for artist last name
+%    \begin{macrocode}
+\newcommand*{\KFLT at al}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{as} Artist suffix
+%    \begin{macrocode}
+\define at key{KFLT at keys}{as}{\renewcommand{\KFLT at as}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at as} Storage for artist suffix
+%    \begin{macrocode}
+\newcommand*{\KFLT at as}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+%
+%
+% \begin{macro}{\KFLT at textalign} Storage for text alignment.
+%
+% Used for the additional text in the float.
+%    \begin{macrocode}
+\newcommand*{\KFLT at textalign}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\KFLT at t} Additional text storage
+%
+% Used for the additional text in the float.
+%    \begin{macrocode}
+\newcommand{\KFLT at t}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% Create replacement macros if \pkg{tocdata} is not loaded:
+%    \begin{macrocode}
+\@ifpackageloaded{tocdata}
+{}
+{
+\newcommand{\tdtextjustify}{}
+\newcommand{\tdtextcenter}{}
+\newcommand{\tdtextleft}{}
+\newcommand{\tdtextright}{}
+\newcommand{\tdnamejustify}{}
+\newcommand{\tdnamecenter}{}
+\newcommand{\tdnameleft}{}
+\newcommand{\tdnameright}{}
+}
+%    \end{macrocode}
+%
+% \DescribeKey{t} Additional text, justified alignment.
+%    \begin{macrocode}
+\define at key{KFLT at keys}{t}{
+\renewcommand{\KFLT at t}{#1}
+\renewcommand{\KFLT at textalign}{}
+\tdtextjustify
+}
+%    \end{macrocode}
+%
+% \DescribeKey{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
+}
+%    \end{macrocode}
+%
+% \DescribeKey{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
+}
+%    \end{macrocode}
+%
+% \DescribeKey{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
+}
+%    \end{macrocode}
+%
+%
+%
+% \begin{macro}{\KFLT at i} Image filename storage
+%    \begin{macrocode}
+\newcommand*{\KFLT at i}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \DescribeKey{lw} Fraction of \cs{linewidth}
+%    \begin{macrocode}
+\define at key{KFLT at keys}{lw}{%
+\renewcommand{\KFLT at lw}{#1}%
+\setlength{\KFLT at w}{0pt}%
+}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at lw} Fraction of linewidth storage: ``|.5|''
+%    \begin{macrocode}
+\newcommand*{\KFLT at lw}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{w} Fixed width
+%    \begin{macrocode}
+\define at key{KFLT at keys}{w}{%
+\setlength{\KFLT at w}{#1}%
+\renewcommand{\KFLT at lw}{}%
+}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at w} Width storage: ``3cm''
+%    \begin{macrocode}
+\newlength{\KFLT at w}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{h} Fixed height
+%    \begin{macrocode}
+\define at key{KFLT at keys}{h}{\setlength{\KFLT at h}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at h} Height storage: ``2in''
+%    \begin{macrocode}
+\newlength{\KFLT at h}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{s} Scale
+%    \begin{macrocode}
+\define at key{KFLT at keys}{s}{\renewcommand{\KFLT at s}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at s} Scale storage: ``3''
+%    \begin{macrocode}
+\newcommand*{\KFLT at s}{1}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{r} Angle.  90 is counter-clockwise 90 degrees.
+%    \begin{macrocode}
+\define at key{KFLT at keys}{r}{\renewcommand{\KFLT at r}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at r} Angle storage: ``90''
+%    \begin{macrocode}
+\newcommand*{\KFLT at r}{0}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{f} Frame the image with \cs{KFLTlooseframe}.
+%    \begin{macrocode}
+\define at key{KFLT at keys}{f}[true]{\setboolean{KFLT at f}{#1}}
+%    \end{macrocode}
+%
+% \DescribeBoolean{KFLT at f} Frame the image?
+%    \begin{macrocode}
+\newboolean{KFLT at f}
+%    \end{macrocode}
+
+% \DescribeKey{ft} Tightly frame the image using \cs{KFLTtightframe}.
+%	This is useful for photographs, or diagrams which
+%	already have built-in margins.
+%    \begin{macrocode}
+\define at key{KFLT at keys}{ft}[true]{\setboolean{KFLT at ft}{#1}}
+%    \end{macrocode}
+%
+% \DescribeBoolean{KFLT at ft} Tightly frame the image?
+%    \begin{macrocode}
+\newboolean{KFLT at ft}
+%    \end{macrocode}
+
+
+% \DescribeKey{stretch} Set \cs{arraystretch} inside the table environment.
+%    \begin{macrocode}
+\define at key{KFLT at keys}{stretch}{\renewcommand{\KFLT at stretch}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at stretch} Storage for \cs{arraystretch}.
+%    \begin{macrocode}
+\newcommand*{\KFLT at stretch}{1}
+%    \end{macrocode}
+% \end{macro}
+
+
+
+
+% \subsection{Nesting Control}
+
+% \DescribeCounter{KFLT at keyfloatdepth} Depth inside a keyfigs environment
+%    \begin{macrocode}
+\newcounter{KFLT at keyfloatdepth}
+\setcounter{KFLT at keyfloatdepth}{0}
+%    \end{macrocode}
+
+% \DescribeBoolean{KFLT at inkeysubfloats} Inside a keysubfigs environment?
+%    \begin{macrocode}
+\newboolean{KFLT at inkeysubfloats}
+\setboolean{KFLT at inkeysubfloats}{false}
+%    \end{macrocode}
+
+
+
+% \subsection{Subfloat Key Handling}
+%
+% These keys are for the container holding a collection of subfigures.
+
+% \DescribeBoolean{KFLT at subgrpcont} Continued float?
+%    \begin{macrocode}
+\newboolean{KFLT at subgrpcont}{}
+%    \end{macrocode}
+%
+% \DescribeKey{cont} Continued float
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{cont}[true]{%
+\setboolean{KFLT at subgrpcont}{#1}%
+}
+%    \end{macrocode}
+
+% \begin{macro}{\KFLT at subgrpc} Sub-caption storage
+%    \begin{macrocode}
+\newcommand{\KFLT at subgrpc}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \DescribeBoolean{KFLT at subgrpcstart} Sub-caption starred?
+%    \begin{macrocode}
+\newboolean{KFLT at subgrpcstar}
+%    \end{macrocode}
+%
+% \DescribeKey{c} Caption
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{c}
+	{\renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{false}}
+%    \end{macrocode}
+%
+% \DescribeKey{cstar} Starred caption?
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{cstar}
+	{\renewcommand{\KFLT at subgrpc}{#1}\setboolean{KFLT at subgrpcstar}{true}}
+%    \end{macrocode}
+%
+% \DescribeKey{sc} Short caption
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{sc}{%
+\renewcommand{\KFLT at subgrpsc}{#1}%
+\setboolean{KFLT at subgrpscgiven}{true}%
+}
+%    \end{macrocode}
+
+% \begin{macro}{\KFLT at subgrpsc} Sub-shortcaption storage
+%    \begin{macrocode}
+\newcommand{\KFLT at subgrpsc}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \DescribeBoolean{KFLT at subgrpscgiven} Sub-shortcaption was given?
+%    \begin{macrocode}
+\newboolean{KFLT at subgrpscgiven}
+%    \end{macrocode}
+
+% \begin{macro}{\KFLT at subgrptype} Subfloats collection type storage:
+%	``|figure|'', ``|table|''
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrptype}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\KFLT at subgrptype} Subfloats collection list type storage:
+%	``|lof|'', ``|lot|''
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrplisttype}{}
+%    \end{macrocode}
+% \end{macro}
+
+% \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}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \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}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \DescribeKey{l} Label
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{l}{\renewcommand{\KFLT at subgrpl}{#1}}
+\newcommand*{\KFLT at subgrpl}{}
+%    \end{macrocode}
+%
+%
+%
+% \begin{macro}{\KFLT at subgrptextalign} Storage for text alignment.
+%
+% Used for the additional text in the float.
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrptextalign}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\KFLT at subgrpt} Additional text storage
+%
+% Used for the additional text in the float.
+%    \begin{macrocode}
+\newcommand{\KFLT at subgrpt}{}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \DescribeKey{t} Additional text — full justification
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{t}{
+\renewcommand{\KFLT at subgrpt}{#1}
+\renewcommand{\KFLT at subgrptextalign}{}
+\tdtextjustify
+}
+%    \end{macrocode}
+%
+% \DescribeKey{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
+}
+%    \end{macrocode}
+%
+% \DescribeKey{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
+}
+%    \end{macrocode}
+%
+% \DescribeKey{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
+}
+%    \end{macrocode}
+%
+%
+%
+% For the \pkg{tocdata} package:
+%
+% \DescribeKey{ap} Artist prefix
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{ap}{\renewcommand{\KFLT at subgrpap}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at subgrpap} Storage for artist prefix
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrpap}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{af} Artist first name
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{af}{\renewcommand{\KFLT at subgrpaf}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at subgrpaf} Storage for artist first name
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrpaf}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{al} Artist last name
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{al}{\renewcommand{\KFLT at subgrpal}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at subgrpal} Storage for artist last name
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrpal}{}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeKey{as} Artist suffix
+%    \begin{macrocode}
+\define at key{KFLT at subgrpkeys}{as}{\renewcommand{\KFLT at subgrpas}{#1}}
+%    \end{macrocode}
+%
+% \begin{macro}{\KFLT at subgrpas} Storage for artist suffix
+%    \begin{macrocode}
+\newcommand*{\KFLT at subgrpas}{}
+%    \end{macrocode}
+% \end{macro}
+%%
+%
+%
+%
+%
+%
+%
+%
+%
+
+
+% \subsection{Computing Image Width}
+
+% \DescribeLength{\KFLT at imagewidth} Computed width of the image
+%    \begin{macrocode}
+\newlength{\KFLT at imagewidth}
+%    \end{macrocode}
+
+% \DescribeLength{\KFLT at boxwidth} Computed width of the container box
+%    \begin{macrocode}
+\newlength{\KFLT at boxwidth}
+%    \end{macrocode}
+%
+%
+%
+%
+%
+% \begin{macro}{\KFLT at findwidths} Figure out how wide to make an image and its container
+%    \begin{macrocode}
+\newcommand*{\KFLT at findwidths}{%
+%    \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
+%    \end{macrocode}
+% Several width options exist.  First see if width was given:
+%    \begin{macrocode}
+\ifthenelse{\dimtest{\KFLT at w}{>}{0pt}}%
+%    \end{macrocode}
+%  Width was given:
+%    \begin{macrocode}
+{\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
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \subsection{Framing and Rotation}
+%
+%
+% A user-redefinable macro and length to tightly frame the contents.
+%
+% \cs{KFLTtightframe} may be redefined to a macro which frames its contents.
+% \cs{KFLTtightframewidth} should be redefine to the total width of the new
+% frame and its separation.
+%
+% \begin{macro}{\KFLT at tightframe} \marg{contents}
+%    \begin{macrocode}
+\newcommand{\KFLTtightframe}[1]{%
+\setlength{\fboxsep}{0pt}%
+\setlength{\fboxrule}{.4pt}%
+\fbox{#1}%
+}
+
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeLength{\KFLTtightframewidth} Combined width of the frame and separation.
+%    \begin{macrocode}
+\newlength{\KFLTtightframewidth}
+\setlength{\KFLTtightframewidth}{.4pt}
+%    \end{macrocode}
+%
+%
+% \begin{macro}{\KFLTlooseframe} \marg{contents}
+%
+% A user-redefinable macro and length to loosely frame the contents.
+%
+% \cs{KFLTlooseframe} may be redefined to a macro which frames its contents.
+% \cs{KFLTlooseframewidth} should be redefine to the total width of the new
+% frame and its separation.
+%
+%    \begin{macrocode}
+\newcommand{\KFLTlooseframe}[1]{%
+\setlength{\fboxsep}{3pt}%
+\setlength{\fboxrule}{.4pt}%
+\fbox{#1}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+% \DescribeLength{\KFLTlooseframewidth} Combined width of the frame and separation.
+%    \begin{macrocode}
+\newlength{\KFLTlooseframewidth}
+\setlength{\KFLTlooseframewidth}{3.4pt}
+%    \end{macrocode}
+%
+%
+% \begin{macro}{\KFLT at frame} \marg{contents}
+%
+% Frames the contents according to the |f| key.  To be nested for further processing.
+%    \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
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{KFLT at findenvboxwidth}
+% Figures the width of the contents of \cs{KFLT at envbox} plus the frame:
+%    \begin{macrocode}
+\newcommand{\KFLT at findenvboxwidth}{%
+\settowidth{\KFLT at envboxwidth}{\usebox{\KFLT at envbox}}%
+\ifthenelse{\boolean{KFLT at ft}}%
+{\addtolength{\KFLT at envboxwidth}{2\KFLTtightframewidth}}%
+{% not tightframe
+\ifthenelse{\boolean{KFLT at f}}%
+{\addtolength{\KFLT at envboxwidth}{2\KFLTlooseframewidth}}%
+{}% no frame
+}% not looseframe
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
+% \subsection{A Graphics Image from a File}
+%
+% \begin{macro}{\KFLT at onefigureimage} Create a stand-alone figure with an image.
+%    \begin{macrocode}
+\NewDocumentCommand{\KFLT at onefigureimage}{}
+{%
+%    \end{macrocode}
+% Several possible combinations of linewidth, width, and height are available,
+% and each is treated separately.
+% Scaling and width/height are done first, then framing, then rotation.
+%    \begin{macrocode}
+\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
+%    \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}}%
+%    \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
+%    \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
+%    \end{macrocode}
+% Width was not given, so maybe handle |h| alone:
+%    \begin{macrocode}
+{% width is not given
+\ifthenelse{\dimtest{\KFLT at h}{>}{0pt}}%
+%    \end{macrocode}
+% |h| was given:
+%    \begin{macrocode}
+{\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}{\KFLT at envboxwidth}%
+\KFLT at frame{\usebox{\KFLT at envbox}}%
+\end{minipage}%
+\unskip%
+\end{turn}%
+\par%
+\addvspace{2ex}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+
+
+% \subsection{Printing the Caption}
+%
+%
+% \begin{macro}{\KFLT at captioniftype} \marg{|figure| or |table|} \marg{\mainsubarg}
+%
+% Create a caption only if is of this float type.
+%
+% The second argument is |{}| if a regular float, or
+% |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}}%
+{}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+
+
+% \begin{macro}{\KFLT at dosimplecaption} \marg{star?} \marg{short cap or |-NO VALUE-|} \marg{caption}
+%
+% Calls \cs{caption} depending on several combinations of star and short captions
+% being given.
+%    \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
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\KFLT at docaption} * \oarg{short caption} \marg{caption} \marg{\mainsubarg}
+%
+% Depending on whether the \pkg{tocdata} package is present,
+% and an artist is specified,
+% use either \cs{caption} or \cs{captionartist}.
+%
+% The fourth argument is |{}| if a regular float, or
+% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+%
+% See Table \ref{tab:captions} for the possible combinations of
+% the caption-related keys: |c|, |cstar|, and |sc|.
+%    \begin{macrocode}
+%    \end{macrocode}
+% There are two versions, depending on whether \pkg{tocdata} is loaded.
+%    \begin{macrocode}
+\@ifpackageloaded{tocdata}
+{% tocdata loaded
+%    \end{macrocode}
+% \pkg{tocdata} is loaded:
+%    \begin{macrocode}
+\NewDocumentCommand{\KFLT at docaption}{s o m m}
+{%
+%    \end{macrocode}
+% Is this a figure?
+%    \begin{macrocode}
+\ifthenelse{\equal{\csname KFLT@#4type\endcsname}{figure}}%
+{% figure
+%    \end{macrocode}
+% Is the last name empty?  Assume no artist if so.
+%    \begin{macrocode}
+\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
+%    \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:
+%    \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 tocdata
+}% tocdata loaded
+{% no tocdata
+\NewDocumentCommand{\KFLT at docaption}{s o m m}
+{%
+%    \end{macrocode}
+% If \pkg{tocdata} is not loaded, use a simple caption.
+%    \begin{macrocode}
+\KFLT at dosimplecaption{#1}{#2}{#3}%
+%    \end{macrocode}
+% Create an index entry depending on whether there is a first name:
+%    \begin{macrocode}
+\ifcsempty{KFLT@#4af}%
+{\index{\csname KFLT@#4al\endcsname}}%
+{\index{\csname KFLT@#4al\endcsname, \csname KFLT@#4af\endcsname}}%
+}% KFLT at docaption
+}% no tocdata
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\KFLT at caption} \marg{\mainsubarg}
+%
+% Caption-creation logic.
+%
+% The argument is |{}| if a regular float, or
+% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+%
+% See Table \ref{tab:captions} for the possible combinations of
+% the caption-related keys: |c|, |cstar|, and |sc|.
+%    \begin{macrocode}
+\newcommand{\KFLT at caption}[1]{%
+%    \end{macrocode}
+% A starred caption is printed but not numbered.
+%    \begin{macrocode}
+\ifthenelse{\boolean{KFLT@#1cstar}}% starred caption?
+%    \end{macrocode}
+% This is a starred caption:
+%    \begin{macrocode}
+{%starred caption
+%    \end{macrocode}
+% A key given as |cstar={}| yields a float with no caption at all.
+%    \begin{macrocode}
+\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}%
+%    \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
+%    \end{macrocode}
+% |cstar| was given, so create an unnumbered caption:
+%    \begin{macrocode}
+\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
+%    \end{macrocode}
+% Optional label:
+%    \begin{macrocode}
+\ifcsempty{KFLT@#1l}%
+{}%
+{\label{\csname KFLT@#1l\endcsname}}%
+}% unstarred caption
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \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}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \subsection{Row Start/End Processing}
+
+% \begin{macro}{\KFLT at maybestartfloatrow} Counts rows
+%
+% After ending a preexisting row, move to the next row.
+% 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}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\KFLT at maybeendfloatrow} Counts rows
+%
+% Adds vertical space then resets to allow the start of a new row.
+% 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}}}%
+{%
+
+\addvspace{.75\floatsep}%
+
+\defcounter{KFLT at thiscol}{0}%
+}{}%
+}%
+%    \end{macrocode}
+% \end{macro}
+
+
+
+
+
+
+% \subsection{Key Environment Helper Macros}
+
+
+% \begin{macro}{\KFLT at trackrows} Tracks and spaces rows and columns.
+%    \begin{macrocode}
+\newcommand{\KFLT at trackrows}
+{%
+%    \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
+%    \end{macrocode}
+% Tracks row start and end:
+%    \begin{macrocode}
+\KFLT at maybestartfloatrow%
+%    \end{macrocode}
+% Possibly fill space between columns:
+%    \begin{macrocode}
+\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>}{1}}%
+{\hfill}{}%
+}% nested
+{}% not nested
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+
+
+
+
+% \begin{macro}{\KFLT at addtext} \marg{\mainsubarg}
+%
+% Adds optional additional text.
+%
+% The argument is |{}| if a regular float, or
+% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+%
+% \changes{v0.11}{2016/12/02}{Improved paragraph handling.}
+%
+%    \begin{macrocode}
+\newcommand{\KFLT at addtext}[1]
+{%
+%    \end{macrocode}
+% Is there text to add?
+%    \begin{macrocode}
+\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}
+\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}%
+%    \end{macrocode}
+% Typeset the actual text:
+%    \begin{macrocode}
+\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{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\KFLT at optionalname} \marg{name}
+%
+% Adds optional artist's name and the following space.
+%
+%    \begin{macrocode}
+\newcommand{\KFLT at optionalname}[1]
+{%
+\ifthenelse{\equal{#1}{}}%
+{}%
+{#1~}%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\KFLT at addartisttext} \marg{\mainsubarg}
+%
+% Adds optional artist's name and add'l text.
+%
+% The argument is |{}| if a regular float, or
+% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}.
+%
+% One of two versions is used, depending on whether the \pkg{tocdata}
+% package is available.
+%
+% If \pkg{tocdata} is loaded, this float is a figure, and artist information
+% is given, then the float's artist's information and optional text will be printed
+% elsewhere by \cs{KFLT at caption}.  Otherwise, it is printed here along with the text.
+%    \begin{macrocode}
+%    \end{macrocode}
+% Two versions, depending on whether \pkg{tocdata} is loaded:
+%    \begin{macrocode}
+\@ifpackageloaded{tocdata}
+{% tocdata loaded
+%    \end{macrocode}
+% If \pkg{tocdata} is loaded:
+%    \begin{macrocode}
+\newcommand{\KFLT at addartisttext}[1]
+{%
+%    \end{macrocode}
+% Only use the artist name if this is a figure:
+%    \begin{macrocode}
+\ifthenelse{\equal{\csname KFLT@#1type\endcsname}{figure}}%
+{% figure
+%    \end{macrocode}
+% Only use the artist name if a last name is given:
+%    \begin{macrocode}
+\ifcsempty{KFLT@#1al}%
+%    \end{macrocode}
+% A figure but no artist:
+%    \begin{macrocode}
+{\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
+%    \end{macrocode}
+% If not a figure, ignore artist information:
+%    \begin{macrocode}
+{\KFLT at addtext{#1}}%
+}% KFLT at addartisttext
+}% tocdata loaded
+%    \end{macrocode}
+% If \pkg{tocdata} is not loaded:
+%    \begin{macrocode}
+{% tocdata not loaded
+\newcommand{\KFLT at addartisttext}[1]
+{%
+%    \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
+%    \end{macrocode}
+% Add space and create the name inside a full-width minipage:
+%    \begin{macrocode}
+\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
+%    \end{macrocode}
+% Any additional text follows the artist's name:
+%    \begin{macrocode}
+\KFLT at addtext{#1}%
+}% KFLT at addartisttext
+}% tocdata not loaded
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{environment}{KFLT at boxinner}
+%
+% Typeset the contents in a width which depends on the keys.
+%    \begin{macrocode}
+\newsavebox{\KFLT at envbox}
+\newlength{\KFLT at envboxwidth}
+
+\NewDocumentEnvironment{KFLT at boxinner}{}
+{% keyboxinner
+%    \end{macrocode}
+% (Possibly) frame the contents of an \env{lrbox}:
+%    \begin{macrocode}
+\begin{lrbox}{\KFLT at envbox}%
+%    \end{macrocode}
+% Rotate the contents:
+%    \begin{macrocode}
+\turn{\KFLT at r}%
+%    \end{macrocode}
+% Box the contents in the width computed by \cs{KFLT at findwidths}:
+%    \begin{macrocode}
+\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}%
+}% keyboxinner
+%    \end{macrocode}
+% End of the environment:
+%    \begin{macrocode}
+{% endkeyboxinner
+\endminipage%
+%    \end{macrocode}
+% End the rotated box:
+%    \begin{macrocode}
+\endturn%
+%    \end{macrocode}
+% Possibly frame:
+%    \begin{macrocode}
+\end{lrbox}%
+\KFLT at frame{\usebox{\KFLT at envbox}}%
+\par\addvspace{\medskipamount}%
+}% endkeyboxinner
+%    \end{macrocode}
+% \end{environment}
+
+
+% \begin{macro}{\KFLT at boxkeys} \marg{keys} \marg{|figure|/|table|} \marg{|lof|/|lot|}
+%
+% Default the options, adjust for a table, then parse the keys:
+%    \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}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{environment}{KFLT at boxouter}
+%	\marg{star?} \marg{loc}
+%
+% Boxes the contents of figures and floats.
+%
+% Not used by subfigures.
+%    \begin{macrocode}
+\NewDocumentEnvironment{KFLT at boxouter}{m m}
+{% keyboxouter
+%    \end{macrocode}
+% The \env{keytable} environment boxes the contents inside an optional frame of hrules,
+% then handles them in either of
+% three possible ways, depending on whether it is
+% called alone, inside a \env{keyfloats} environment, or
+% inside a \env{keysubtabs} environment.
+%
+% 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
+%    \end{macrocode}
+% If \env{keyfloats}, place the contents inside a \env{minipage}:
+%    \begin{macrocode}
+{% not subfloat:
+\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}%
+{% keyfloats
+\minipage{\KFLT at rowboxwidth}%
+\captionsetup{type=\KFLT at type}%
+}% keyfloats
+{% not keyfloats
+%    \end{macrocode}
+%
+% Not a subfloat or \env{keyfloats}, so create a single float.
+%
+% See if the float should be positioned [H]ere:
+%    \begin{macrocode}
+\ifthenelse{\equal{#2}{H}}%
+%    \end{macrocode}
+% Place [H], so create an inline minipage:
+%    \begin{macrocode}
+{% [H]
+\noindent\minipage{\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 keyfloats
+}% not subfloat
+%    \end{macrocode}
+% Handle a continued float.  Ignored if in a subfloat.
+%    \begin{macrocode}
+\ifthenelse{\boolean{KFLT at cont}}{\ContinuedFloat}{}%
+%    \end{macrocode}
+% Figure out image and parbox widths for the contents:
+%    \begin{macrocode}
+\KFLT at findwidths%
+%    \end{macrocode}
+% If a table, place the caption above the contents:
+%    \begin{macrocode}
+\KFLT at captioniftype{table}{}%
+%    \end{macrocode}
+% Typeset the contents:
+%    \begin{macrocode}
+\begin{center}%
+\unskip%
+\minipage{\linewidth}%
+\centering%
+}% keyboxouter
+%    \end{macrocode}
+%
+% End of the keyboxouter environment:
+%
+%    \begin{macrocode}
+{% endboxouter
+\endminipage%
+\end{center}%
+\unskip\addvspace{\medskipamount}%
+%    \end{macrocode}
+% Optionally print artist's name and additional text:
+%    \begin{macrocode}
+\KFLT at addartisttext{}%
+%    \end{macrocode}
+% If a figure, typeset the caption below the contents:
+%    \begin{macrocode}
+\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}}% keyfloat?
+{\endminipage}% keyfloats
+{% not keyfloats
+%    \end{macrocode}
+%
+% Not subfloat or \env{keyfloats}, so is an individual float.
+%
+% Close the minipage or float:
+%    \begin{macrocode}
+\ifthenelse{\equal{#2}{H}}%
+{%
+\endminipage% [H]
+}%
+{% not [H]
+\IfBooleanTF{#1}% starred table?
+{\csname end\KFLT at type*\endcsname}{\csname end\KFLT at type\endcsname}%
+}% not [H]
+}% not keyfloats
+}% not subfloat
+}% endkeyboxouter
+%    \end{macrocode}
+% \end{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%
+}%
+{%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+%    \end{macrocode}
+% \end{environment}
+
+% Extra code to track rows outside of the \env{keyfigure} environment,
+% \DescribeSimple{Before \env{keyfigure}}
+% before it starts.  This is done to allow nesting without losing track
+% of the prior level.
+%
+%    \begin{macrocode}
+\BeforeBeginEnvironment{keyfigure}{%
+\KFLT at trackrows%
+}
+%    \end{macrocode}
+
+
+% \subsection{The \cs{keyfig} Macro}
+
+% \begin{macro}{\keyfig} * \oarg{loc} \marg{\keyvalsarg} \marg{image filename}
+%
+% A user-level macro to generate a figure with an image.
+% This may be used by itself, or inside a \env{keyfloats} or
+% \env{keysubfigs} environment.
+%    \begin{macrocode}
+\NewDocumentCommand{\keyfig}{s O{tbp} +m m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{figure}{lof}%
+%    \end{macrocode}
+% After setting default values, overridge with the filename:
+%    \begin{macrocode}
+\renewcommand{\KFLT at i}{#4}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at onefigureimage%
+\endKFLT at boxouter%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+
+% \subsection{The \cs{keyfigbox} Macro}
+
+% \begin{macro}{\keyfigbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents}
+%
+% A user-level macro to generate a figure with arbitrary paragraph contents.
+% This may be used by itself, or inside a \env{keyfloats} or
+% \env{keysubtabs} environment.
+%    \begin{macrocode}
+\NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{figure}{lof}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+#4%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \subsection{The \cs{keyparbox} Macro}
+
+% \begin{macro}{\keyparbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents}
+%
+% A user-level macro to generate a figure with arbitrary paragraph contents,
+% but no number or caption.
+% This is equal to a \cs{keyfigbox} with |cstar={}|.
+% This may be used by itself, or inside a \env{keyfloats} or
+% \env{keysubtabs} environment.
+%    \begin{macrocode}
+\NewDocumentCommand{\keyparbox}{s O{tbp} +m +m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{figure}{lof}%
+%    \end{macrocode}
+% Force |cstar={}|:
+%    \begin{macrocode}
+\renewcommand{\KFLT at c}{}%
+\setboolean{KFLT at cstar}{true}%
+%    \end{macrocode}
+% Continue like \cs{figbox}:
+%    \begin{macrocode}
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+#4%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \subsection{The \cs{keytab} Macro}
+
+% \begin{macro}{\keytab} * \oarg{loc} \marg{\keyvalsarg} \marg{tabular contents}
+%
+% A user-level macro to generate a table with tabular contents.
+% This may be used by itself, or inside a \env{keyfloats} or
+% \env{keysubtabs} environment.
+%    \begin{macrocode}+
+\NewDocumentCommand{\keytab}{s O{tbp} +m +m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{table}{lot}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+\centering%
+#4%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \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%
+}%
+{%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+%    \end{macrocode}
+% \end{environment}
+
+% Extra code to track rows outside of the \env{keytable} environment,
+% \DescribeSimple{Before \env{keytable}}
+% before it starts.  This is done to allow nesting without losing track
+% of the prior level.
+%
+%    \begin{macrocode}
+\BeforeBeginEnvironment{keytable}{%
+\KFLT at trackrows%
+}
+%    \end{macrocode}
+
+
+
+% \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.}%
+}%
+{}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+% \begin{environment}{keyfloats} * \oarg{loc} \marg{num columns}
+%
+% User-level macro to create rows of figures/tables.
+% Wrapping occurs after the number of specified columns.
+% \env{keyfloats} environments may be nested to create
+% a vertical set of figures next to a single larger figure,
+% for example.
+%
+% Place \cs{keyfig}, \cs{keyfigbox}, and \cs{keytab} commands
+% inside the \env{keyfloats} environment.
+%
+% Note that |lw| linewidth keys may need to be adjusted inside
+% a \env{keyfloats}, \cs{keysubfigs}, or \cs{keysubtabs}, since
+% \cs{linewidth} changes depending on the number of columns.
+% Likewise, manually-selected |w| width and |h| tags may need to be
+% adjusted to prevent overflow.
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{keyfloats}{s O{tbp} m}
+{%
+%    \end{macrocode}
+% Nest the environment:
+%    \begin{macrocode}
+\addtocounter{KFLT at keyfloatdepth}{1}%
+%    \end{macrocode}
+% If [H] or nested, 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}%
+}%
+%    \end{macrocode}
+% Create an inline minipage:
+%    \begin{macrocode}
+{% [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}}%
+%    \end{macrocode}
+% If inside subfloats, generate subfigures by default:
+%    \begin{macrocode}
+\ifthenelse{\boolean{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
+%    \end{macrocode}
+% Compute the width of each entry:
+%    \begin{macrocode}
+\ifthenelse{%
+\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
+\OR\boolean{KFLT at inkeysubfloats}%
+}%
+%    \end{macrocode}
+% Nested or subfloats:
+%    \begin{macrocode}
+{\setlength{\KFLT at rowboxwidth}{.9\KFLT at rowboxwidth/\real{#3}}}%
+%    \end{macrocode}
+% Keyfloats:
+%    \begin{macrocode}
+{\setlength{\KFLT at rowboxwidth}{.9\linewidth/\real{#3}}}%
+%    \end{macrocode}
+% Center the contents:
+%    \begin{macrocode}
+\centering%
+%    \end{macrocode}
+% Count columns using \cs{defcounter} for a local effect:
+%    \begin{macrocode}
+\defcounter{KFLT at numcols}{#3}%
+\defcounter{KFLT at thiscol}{0}%
+}% starting keyfloats environment
+%    \end{macrocode}
+%
+% When ending a \env{keyfloats} environment:
+%    \begin{macrocode}
+{% ending keyfloats environment
+%    \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}%
+}%
+{\end{minipage}%
+%    \end{macrocode}
+% Spacing if nested:
+%    \begin{macrocode}
+\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}%
+{}{\bigbreak}%
+}% was [H]
+%    \end{macrocode}
+% Was not [H], so close a figure:
+%    \begin{macrocode}
+{% not [H]
+\IfBooleanTF{#1}% starred figure?
+{\end{figure*}}{\end{figure}}%
+}% not [H]
+%    \end{macrocode}
+% Unnest the environment:
+%    \begin{macrocode}
+\addtocounter{KFLT at keyfloatdepth}{-1}%
+}
+%    \end{macrocode}
+% \end{environment}
+
+
+
+% Extra code to track rows outside of the \env{keyfloats} environment,
+% \DescribeSimple{Before \env{keyfloats}}
+% before it starts.  This is done to allow nesting without losing track
+% of the prior level.
+%
+%    \begin{macrocode}
+\BeforeBeginEnvironment{keyfloats}{%
+%    \end{macrocode}
+% Track rows:
+%    \begin{macrocode}
+\ifthenelse{%
+\cnttest{\value{KFLT at keyfloatdepth}}>{0}%
+\OR\boolean{KFLT at inkeysubfloats}%
+}%
+{\KFLT at maybestartfloatrow}{}%
+%    \end{macrocode}
+% Possibly fill space between columns:
+%    \begin{macrocode}
+\ifthenelse{\cnttest{\value{KFLT at thiscol}}{>}{1}}%
+{\hfill}{}%
+}
+%    \end{macrocode}
+
+
+% \subsection{Subfigures}
+
+% \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}%
+\renewcommand{\KFLT at subgrptype}{figure}%
+\renewcommand{\KFLT at subgrplisttype}{lof}%
+\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}
+
+
+
+
+
+
+% \begin{macro}{\KFLT at subfloats} \marg{starred?} \marg{loc} \marg{cols} \marg{\keyvalsarg}
+%
+% Start a subfloat environment
+%    \begin{macrocode}
+\NewDocumentCommand{\KFLT at subfloats}{m m m +m}
+{%
+%    \end{macrocode}
+% Parse the key-value combinations:
+%    \begin{macrocode}
+\setkeys{KFLT at subgrpkeys}{#4}%
+%    \end{macrocode}
+% Nest the environment:
+%    \begin{macrocode}
+\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}}}%
+%    \end{macrocode}
+% If [H], create an inline minipage:
+%    \begin{macrocode}
+\ifthenelse{\equal{#2}{H}}%
+{%
+\bigbreak\noindent\begin{minipage}{\linewidth}%
+}%
+%    \end{macrocode}
+% Isn't [H], so create a float, possibly starred:
+%    \begin{macrocode}
+{%
+\IfBooleanTF{#1}%
+{\begin{\KFLT at type*}[#2]}{\begin{\KFLT at type}[#2]}%
+}%
+%    \end{macrocode}
+% Set the caption type:
+%    \begin{macrocode}
+\captionsetup{type=\KFLT at subgrptype}%
+%    \end{macrocode}
+% Process continued floats:
+%    \begin{macrocode}
+\ifthenelse{\boolean{KFLT at subgrpcont}}{\ContinuedFloat}{}%
+%    \end{macrocode}
+% Center the contents:
+%    \begin{macrocode}
+\centering%
+%    \end{macrocode}
+% If this is a table, place the caption above the contents:
+%    \begin{macrocode}
+\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}%
+%    \end{macrocode}
+% Creat a group for the subfloats.
+% Necessary in case they change \cs{tdtextcenter}, etc.
+%    \begin{macrocode}
+\begingroup%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+
+% \begin{macro}{\KFLT at endsubfloats} \marg{starred?} \marg{loc}
+%
+% Ends a subfloat environment.
+%    \begin{macrocode}
+\newcommand*{\KFLT at endsubfloats}[2]{%
+%    \end{macrocode}
+% End the group containing the subfloats:
+%    \begin{macrocode}
+\endgroup%
+%    \end{macrocode}
+% A little extra space at the bottom:
+%    \begin{macrocode}
+\par\addvspace{\bigskipamount}%
+%    \end{macrocode}
+% Optionally print artist's name and additional text:
+%    \begin{macrocode}
+\KFLT at addartisttext{subgrp}%
+%    \end{macrocode}
+% If this was a figure, place the caption below the contents:
+%    \begin{macrocode}
+\KFLT at captioniftype{figure}{subgrp}%
+%    \end{macrocode}
+% End the float or minipage:
+%    \begin{macrocode}
+\ifthenelse{\equal{#2}{H}}%
+{\end{minipage}\bigbreak}% was [H]
+{% not [H]:
+\IfBooleanTF{#1}% starred?
+{\end{\KFLT at type*}}{\end{\KFLT at type}}%
+}% not [H]
+%    \end{macrocode}
+% Unnest the environment:
+%    \begin{macrocode}
+\setboolean{KFLT at inkeysubfloats}{false}%
+}
+%    \end{macrocode}
+% \end{macro}
+
+
+% \begin{environment}{keysubfigs} * \oarg{loc} \marg{numcols} \marg{\keyvalsarg}
+%
+% A group of subfigures typeset in rows.
+%
+%    \begin{macrocode}
+\NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m}
+{%
+%    \end{macrocode}
+% Error if trying to nest environments:
+%    \begin{macrocode}
+\KFLT at nonest%
+%    \end{macrocode}
+% Default the options:
+%    \begin{macrocode}
+\KFLT at subgrpdefaults%
+%    \end{macrocode}
+% Start of the environment:
+%    \begin{macrocode}
+\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}%
+}
+%    \end{macrocode}
+% \end{environment}
+
+
+% \begin{environment}{keysubtabs} * \oarg{loc} \marg{numcols} \marg{\keyvalsarg}
+%
+% A group of subtables typeset in rows.
+%    \begin{macrocode}
+\NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m}
+{%
+%    \end{macrocode}
+% Error if trying to nest environments:
+%    \begin{macrocode}
+\KFLT at nonest%
+%    \end{macrocode}
+% Default the options:
+%    \begin{macrocode}
+\KFLT at subgrpdefaults%
+%    \end{macrocode}
+% Default to table float type:
+%    \begin{macrocode}
+\KFLT at setsubgrptable%
+%    \end{macrocode}
+% Start of the environment:
+%    \begin{macrocode}
+\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}%
+}
+%    \end{macrocode}
+% \end{environment}
+
+
+
+
+%
+%
+% \iffalse
+%</package>
+% \fi
+
+
+
+
+% \clearpage
+% \pagestyle{plain}
+%
+% \renewcommand{\partname}{}
+% \renewcommand{\thepart}{}
+% \part{Change History and Index}
+%
+% \Finale
+
+\endinput

Added: trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.ins	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/keyfloat/keyfloat.ins	2016-12-02 22:57:05 UTC (rev 42622)
@@ -0,0 +1,47 @@
+%% keyfloat.ins
+%% Copyright 2016 Brian Dunn
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%% 
+%% The Current Maintainer of this work is Brian Dunn.
+%%
+%% This work consists of the files keyfloat.dtx and keyfloat.ins
+%% and the derived file keyfloat.sty.
+\input docstrip.tex
+\keepsilent
+\usedir{tex/latex/ package }
+\preamble
+This is a generated file.
+Copyright 2016 Brian Dunn
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+  http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+\endpreamble
+\askforoverwritefalse
+\generate{\file{keyfloat.sty}{\from{keyfloat.dtx}{package}}}
+\Msg{*********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the}
+\Msg{* following file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space keyfloat.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file keyfloat.dtx}
+\Msg{* through LaTeX.}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*********************************************************}
+\endbatchfile

Added: trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty	                        (rev 0)
+++ trunk/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty	2016-12-02 22:57:05 UTC (rev 42622)
@@ -0,0 +1,847 @@
+%%
+%% This is file `keyfloat.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% keyfloat.dtx  (with options: `package')
+%% This is a generated file.
+%% Copyright 2016 Brian Dunn
+%% 
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%%   http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{keyfloat}
+    [2016/12/02 v0.11 Key/value interface for floats and the subcaption package.]
+
+
+
+
+\RequirePackage{etoolbox}[2011/01/03]%
+
+\RequirePackage{xparse}
+
+\RequirePackage{xifthen}
+\RequirePackage{xkeyval}
+\RequirePackage{graphicx}
+\RequirePackage{caption}[2010/10/31]% v3.2 to support \phantomcaption
+\RequirePackage{subcaption}
+\RequirePackage{calc}
+\RequirePackage{rotating}
+
+
+
+
+\ProvideDocumentEnvironment{tablehere}{}
+  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{table}}
+  {\endminipage\bigbreak}
+
+\ProvideDocumentEnvironment{figurehere}{}
+  {\bigbreak\noindent\minipage{\linewidth}\def\@captype{figure}}
+  {\endminipage\bigbreak}
+
+
+
+\newcounter{KFLT at numcols}
+
+\newcounter{KFLT at thiscol}
+
+\newlength{\KFLT at rowboxwidth}
+
+
+\newboolean{KFLT at cont}{}
+\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}{sc}{%
+\renewcommand{\KFLT at sc}{#1}%
+\setboolean{KFLT at scgiven}{true}%
+}
+\newcommand{\KFLT at sc}{}
+\newboolean{KFLT at scgiven}
+\newcommand*{\KFLT at type}{}
+\newcommand*{\KFLT at listtype}{}
+\define at key{KFLT at keys}{l}{\renewcommand{\KFLT at l}{#1}}
+\newcommand*{\KFLT at l}{}
+\define at key{KFLT at keys}{ap}{\renewcommand{\KFLT at ap}{#1}}
+\newcommand*{\KFLT at ap}{}
+\define at key{KFLT at keys}{af}{\renewcommand{\KFLT at af}{#1}}
+\newcommand*{\KFLT at af}{}
+\define at key{KFLT at keys}{al}{\renewcommand{\KFLT at al}{#1}}
+\newcommand*{\KFLT at al}{}
+\define at key{KFLT at keys}{as}{\renewcommand{\KFLT at as}{#1}}
+\newcommand*{\KFLT at as}{}
+\newcommand*{\KFLT at textalign}{}
+\newcommand{\KFLT at t}{}
+\@ifpackageloaded{tocdata}
+{}
+{
+\newcommand{\tdtextjustify}{}
+\newcommand{\tdtextcenter}{}
+\newcommand{\tdtextleft}{}
+\newcommand{\tdtextright}{}
+\newcommand{\tdnamejustify}{}
+\newcommand{\tdnamecenter}{}
+\newcommand{\tdnameleft}{}
+\newcommand{\tdnameright}{}
+}
+\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}{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
+}
+\newcommand*{\KFLT at i}{}
+\define at key{KFLT at keys}{lw}{%
+\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}{}%
+}
+\newlength{\KFLT at w}
+\define at key{KFLT at keys}{h}{\setlength{\KFLT at h}{#1}}
+\newlength{\KFLT at h}
+\define at key{KFLT at keys}{s}{\renewcommand{\KFLT at s}{#1}}
+\newcommand*{\KFLT at s}{1}
+\define at key{KFLT at keys}{r}{\renewcommand{\KFLT at r}{#1}}
+\newcommand*{\KFLT at r}{0}
+\define at key{KFLT at keys}{f}[true]{\setboolean{KFLT at f}{#1}}
+\newboolean{KFLT at f}
+
+\define at key{KFLT at keys}{ft}[true]{\setboolean{KFLT at ft}{#1}}
+\newboolean{KFLT at ft}
+
+\define at key{KFLT at keys}{stretch}{\renewcommand{\KFLT at stretch}{#1}}
+\newcommand*{\KFLT at stretch}{1}
+
+
+\newcounter{KFLT at keyfloatdepth}
+\setcounter{KFLT at keyfloatdepth}{0}
+
+\newboolean{KFLT at inkeysubfloats}
+\setboolean{KFLT at inkeysubfloats}{false}
+
+
+\newboolean{KFLT at subgrpcont}{}
+\define at key{KFLT at subgrpkeys}{cont}[true]{%
+\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}{sc}{%
+\renewcommand{\KFLT at subgrpsc}{#1}%
+\setboolean{KFLT at subgrpscgiven}{true}%
+}
+
+\newcommand{\KFLT at subgrpsc}{}
+
+\newboolean{KFLT at subgrpscgiven}
+
+\newcommand*{\KFLT at subgrptype}{}
+
+\newcommand*{\KFLT at subgrplisttype}{}
+
+\newcommand*{\KFLT at setsubgrpfigure}{%
+\renewcommand{\KFLT at subgrptype}{figure}%
+\renewcommand{\KFLT at subgrplisttype}{lof}%
+}
+
+\newcommand*{\KFLT at setsubgrptable}{%
+\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}{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}{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}{}
+\define at key{KFLT at subgrpkeys}{af}{\renewcommand{\KFLT at subgrpaf}{#1}}
+\newcommand*{\KFLT at subgrpaf}{}
+\define at key{KFLT at subgrpkeys}{al}{\renewcommand{\KFLT at subgrpal}{#1}}
+\newcommand*{\KFLT at subgrpal}{}
+\define at key{KFLT at subgrpkeys}{as}{\renewcommand{\KFLT at subgrpas}{#1}}
+\newcommand*{\KFLT at subgrpas}{}
+%%
+
+
+\newlength{\KFLT at imagewidth}
+
+\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
+}
+\newcommand{\KFLTtightframe}[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}%
+}
+\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
+}
+\newcommand{\KFLT at findenvboxwidth}{%
+\settowidth{\KFLT at envboxwidth}{\usebox{\KFLT at envbox}}%
+\ifthenelse{\boolean{KFLT at ft}}%
+{\addtolength{\KFLT at envboxwidth}{2\KFLTtightframewidth}}%
+{% not tightframe
+\ifthenelse{\boolean{KFLT at f}}%
+{\addtolength{\KFLT at envboxwidth}{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}%
+\begin{minipage}{\KFLT at envboxwidth}%
+\KFLT at frame{\usebox{\KFLT at envbox}}%
+\end{minipage}%
+\unskip%
+\end{turn}%
+\par%
+\addvspace{2ex}%
+}
+
+\newcommand*{\KFLT at captioniftype}[2]{%
+\ifthenelse{\equal{\csname KFLT@#2type\endcsname}{#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
+}
+\@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
+}% KFLT at tocdata
+}% tocdata loaded
+{% no tocdata
+\NewDocumentCommand{\KFLT at docaption}{s o m m}
+{%
+\KFLT at dosimplecaption{#1}{#2}{#3}%
+\ifcsempty{KFLT@#4af}%
+{\index{\csname KFLT@#4al\endcsname}}%
+{\index{\csname KFLT@#4al\endcsname, \csname KFLT@#4af\endcsname}}%
+}% 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
+}
+
+
+\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}%
+}
+
+
+\newcommand*{\KFLT at maybestartfloatrow}{%
+\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}}}%
+{%
+
+\addvspace{.75\floatsep}%
+
+\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
+}
+
+\newcommand{\KFLT at addtext}[1]
+{%
+\ifcsempty{KFLT@#1t}%
+{}% no text
+{% text to add
+{% local
+\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~}%
+}
+\@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}}%
+}% 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}%
+}% KFLT at addartisttext
+}% tocdata not loaded
+
+\newsavebox{\KFLT at envbox}
+\newlength{\KFLT at envboxwidth}
+
+\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}%
+}% keyboxinner
+{% endkeyboxinner
+\endminipage%
+\endturn%
+\end{lrbox}%
+\KFLT at frame{\usebox{\KFLT at envbox}}%
+\par\addvspace{\medskipamount}%
+}% 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}%
+}
+
+\NewDocumentEnvironment{KFLT at boxouter}{m m}
+{% keyboxouter
+\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
+\minipage{\KFLT at rowboxwidth}%
+\captionsetup{type=\KFLT at type}%
+}% keyfloats
+{% not keyfloats
+\ifthenelse{\equal{#2}{H}}%
+{% [H]
+\noindent\minipage{\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 keyfloats
+}% not subfloat
+\ifthenelse{\boolean{KFLT at cont}}{\ContinuedFloat}{}%
+\KFLT at findwidths%
+\KFLT at captioniftype{table}{}%
+\begin{center}%
+\unskip%
+\minipage{\linewidth}%
+\centering%
+}% keyboxouter
+{% endboxouter
+\endminipage%
+\end{center}%
+\unskip\addvspace{\medskipamount}%
+\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}}% keyfloat?
+{\endminipage}% keyfloats
+{% not keyfloats
+\ifthenelse{\equal{#2}{H}}%
+{%
+\endminipage% [H]
+}%
+{% not [H]
+\IfBooleanTF{#1}% starred table?
+{\csname end\KFLT at type*\endcsname}{\csname end\KFLT at type\endcsname}%
+}% not [H]
+}% 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%
+}%
+{%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+
+\BeforeBeginEnvironment{keyfigure}{%
+\KFLT at trackrows%
+}
+
+
+\NewDocumentCommand{\keyfig}{s O{tbp} +m m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{figure}{lof}%
+\renewcommand{\KFLT at i}{#4}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at onefigureimage%
+\endKFLT at boxouter%
+}
+
+
+\NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{figure}{lof}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+#4%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+
+
+\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}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+#4%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+
+
+\NewDocumentCommand{\keytab}{s O{tbp} +m +m}
+{%
+\KFLT at trackrows%
+\KFLT at boxkeys{#3}{table}{lot}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+\centering%
+#4%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+
+
+\NewDocumentEnvironment{keytable}{s O{tbp} +m}
+{%
+\KFLT at boxkeys{#3}{table}{lot}%
+\KFLT at boxouter{#1}{#2}%
+\KFLT at boxinner%
+\centering%
+}%
+{%
+\endKFLT at boxinner%
+\endKFLT at boxouter%
+}
+
+\BeforeBeginEnvironment{keytable}{%
+\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.}%
+}%
+{}%
+}
+
+\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}%
+}%
+{% [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}%
+}% starting keyfloats environment
+{% ending keyfloats environment
+\ifthenelse{%
+\equal{#2}{H}%
+\OR\cnttest{\value{KFLT at keyfloatdepth}}>{1}%
+\OR\boolean{KFLT at inkeysubfloats}%
+}%
+{\end{minipage}%
+\ifthenelse{\cnttest{\value{KFLT at keyfloatdepth}}>{0}}%
+{}{\bigbreak}%
+}% was [H]
+{% not [H]
+\IfBooleanTF{#1}% starred figure?
+{\end{figure*}}{\end{figure}}%
+}% not [H]
+\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}{}%
+}
+
+
+\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}%
+\renewcommand{\KFLT at subgrptype}{figure}%
+\renewcommand{\KFLT at subgrplisttype}{lof}%
+\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}}%
+{%
+\bigbreak\noindent\begin{minipage}{\linewidth}%
+}%
+{%
+\IfBooleanTF{#1}%
+{\begin{\KFLT at type*}[#2]}{\begin{\KFLT at type}[#2]}%
+}%
+\captionsetup{type=\KFLT at subgrptype}%
+\ifthenelse{\boolean{KFLT at subgrpcont}}{\ContinuedFloat}{}%
+\centering%
+\KFLT at captioniftype{table}{subgrp}%
+\defcounter{KFLT at numcols}{#3}%
+\defcounter{KFLT at thiscol}{0}%
+\begingroup%
+}
+
+\newcommand*{\KFLT at endsubfloats}[2]{%
+\endgroup%
+\par\addvspace{\bigskipamount}%
+\KFLT at addartisttext{subgrp}%
+\KFLT at captioniftype{figure}{subgrp}%
+\ifthenelse{\equal{#2}{H}}%
+{\end{minipage}\bigbreak}% was [H]
+{% not [H]:
+\IfBooleanTF{#1}% starred?
+{\end{\KFLT at type*}}{\end{\KFLT at type}}%
+}% 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}%
+}% the start of the environment
+{%
+\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}%
+}% the start of the environment
+{%
+\KFLT at endsubfloats{#1}{#2}%
+}
+
+
+
+\endinput
+%%
+%% End of file `keyfloat.sty'.

Modified: trunk/Master/tlpkg/bin/tlpkg-ctan-check
===================================================================
--- trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-12-02 22:56:27 UTC (rev 42621)
+++ trunk/Master/tlpkg/bin/tlpkg-ctan-check	2016-12-02 22:57:05 UTC (rev 42622)
@@ -332,7 +332,7 @@
     jslectureplanner jumplines junicode
     jura juraabbrev jurabib juramisc jurarsp js-misc jvlisting
   kantlipsum karnaugh karnaugh-map karnaughmap kastrup kdgdocs kerkis kerntest
-    keycommand keyreader keystroke keyval2e keyvaltable kix kixfont
+    keycommand keyfloat keyreader keystroke keyval2e keyvaltable kix kixfont
     knitting knittingpattern knuth knuth-lib knuth-local
     koma-moderncvclassic koma-script koma-script-examples koma-script-sfs
     komacv kotex-oblivoir kotex-plain kotex-utf kotex-utils

Modified: trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
===================================================================
--- trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-12-02 22:56:27 UTC (rev 42621)
+++ trunk/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc	2016-12-02 22:57:05 UTC (rev 42622)
@@ -540,6 +540,7 @@
 depend kantlipsum
 depend kerntest
 depend keycommand
+depend keyfloat
 depend keyreader
 depend keystroke
 depend keyval2e

Added: trunk/Master/tlpkg/tlpsrc/keyfloat.tlpsrc
===================================================================


More information about the tex-live-commits mailing list