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