diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/keyfloat/README.txt | 2 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/keyfloat/keyfloat.pdf | bin | 488412 -> 504960 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx | 1206 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty | 605 |
4 files changed, 1219 insertions, 594 deletions
diff --git a/Master/texmf-dist/doc/latex/keyfloat/README.txt b/Master/texmf-dist/doc/latex/keyfloat/README.txt index 1fa8933259d..f628b5cbd78 100644 --- a/Master/texmf-dist/doc/latex/keyfloat/README.txt +++ b/Master/texmf-dist/doc/latex/keyfloat/README.txt @@ -1,7 +1,7 @@ The LaTeX keyfloat package Provides a key/value interface for generating floats. -v1.00 — 2019/01/11 +v2.00 — 2019/03/21 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 065e9c83f0f..4319e0db590 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 6fd2e46961b..980abeba9c4 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> [2019/01/11 v1.00 Key/value interface for floats and subfloats.] +%<package> [2019/03/21 v2.00 Key/value interface for floats and subfloats.] % %<*driver> \documentclass{ltxdoc} @@ -140,7 +140,8 @@ position=top, \captionsetup*[table]{ style=default, justification=centering, margin=0pt, parskip=0pt, skip=1ex, - labelfont={small,bf},textfont={small,bf} + labelfont={small,bf},textfont={small,bf}, + position=top } \captionsetup*[subfigure]{ @@ -152,7 +153,8 @@ position=top, \captionsetup*[subtable]{ style=default, justification=centering, margin=0pt, parskip=0pt, skip=1ex, - labelfont={small},textfont={small} + labelfont={small},textfont={small}, + position=top } \captionsetup*[example]{ @@ -203,6 +205,8 @@ frametitlerulewidth=1pt,frametitleaboveskip=5pt,% \usepackage[normalem]{ulem} +\usepackage{tocdata}[2019/03/21]% v2.02 or later + \usepackage{tocloft} \setlength{\cftsubsecnumwidth}{3em} \setlength{\cftsubsubsecindent}{2.8em} @@ -211,8 +215,6 @@ frametitlerulewidth=1pt,frametitleaboveskip=5pt,% % \usepackage{titletoc} -\usepackage{tocdata}[2016/12/02]% v0.12 or later - \usepackage{titleps} @@ -313,7 +315,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% %<*package> % \fi % -% \CheckSum{0} +% \CheckSum{1174} % % \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 @@ -342,8 +344,11 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \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}{Docs \PDF\ bookmark improvements.} % \changes{v1.00}{2019/01/08}{Removed spurious spaces.} +% \changes{v2.00}{2019/03/21}{\ 2019/03/21} +% \changes{v2.00}{2019/03/17}{Added custom float types.} +% \changes{v2.00}{2019/03/17}{Added float authors.} @@ -413,14 +418,23 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % two small figures placed vertically next to % one larger figure. % -% -% \bigskip +% \vfill % % \noindent % As an example, a typical command to include a figure with a framed image of half \cs{linewidth} % could be: \\ % \hspace*{1em}\verb|\keyfig*[hbp]{f,lw=.5,c={A caption},l={fig:label}}{image}| -% \bigskip +% +% \vfill +% +% \noindent \pkg{keyfloat} uses the \pkg{caption}, \pkg{subcaption}, +% \pkg{newfloat}, and \pkg{wrapfig} packages, +% \watchout +% and cannot be used with the +% \pkg{subfig}, \pkg{subfigure}, \pkg{subfloat}, \pkg{floatrow}, \pkg{float}, +% or \pkg{floatflt} packages. +% +% \vfill % % \footnotesize % \begin{description} @@ -516,21 +530,24 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % The macros and environments provided by \pkg{keyfloat} include: % \begin{description} % \item[\cs{keyfig}:] A figure with an image. +% \item[\cs{keytab}:] A table. +% \item[\cs{keyflt}:] An arbitrary float type macro. % \item[\cs{keyfigbox}:] A figure with arbitrary contents. % \item[\cs{keyparbox}:] A ``figure'' without a caption, useful % to place uncaptioned text inside a group, -% \item[\cs{keytab}:] A table. -% \item[keyfigure:] A figure environment. -% \item[keytable:] A table environment. -% \item[keyfloats:] A group of rows and columns of floats. -% \item[keysubfigs:] A figure containing a group of rows and columns of subfigures. -% \item[keysubtabs:] A table containing a group of rows and columns of subtables. -% \item[keywrap:] Wraps a keyfloat around an environment of text. Usable inside a list. -% \item[marginfigure:] A figure environment placed into +% \item[\env{keyfigure}:] A figure environment. +% \item[\env{keytable}:] A table environment. +% \item[\env{keyfloat}:] An arbitrary float type environment. +% \item[\env{keyfloats}:] A group of rows and columns of floats. +% \item[\env{keysubfigs}:] A figure containing a group of rows and columns of subfigures. +% \item[\env{keysubtabs}:] A table containing a group of rows and columns of subtables. +% \item[\env{keysubfloats}:] A float of arbitrary type containing a group of rows and columns of subfloats. +% \item[\env{keywrap}:] Wraps a keyfloat around an environment of text. Usable inside a list. +% \item[\env{marginfigure}:] A figure environment placed into % the margin.\footnote{\env{marginfigure} and \env{margintable}: The environments % provided by the |tufte-book| class are used if loaded, % otherwise \pkg{keyfloat} provides its own versions.} -% \item[margintable:] A table environment placed in the margin. +% \item[\env{margintable}:] A table environment placed in the margin. % \end{description} % % Additional features include: @@ -542,13 +559,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \item Dynamic layout: The number of columns is specified. Extra % floats are placed onto additional rows as needed, with the final row % adjusted to compensate for leftovers. -% \item Floats may be placed [H]ere. -% \item Floats may be placed in the [M]argin. -% \item Floats may be placed with text [W]rapped around them. +% \item Floats may be placed \optn{[H]}ere. +% \item Floats may be placed in the \optn{[M]}argin. +% \item Floats may be placed with text \optn{[W]}rapped around them. % \item Floats may be starred to span two columns. % \item Continued floats may be used to repeat the previous float number. % \item A figure may contain an image, with additional sizing, rotation, and a frame. -% \item Tables may be stretched. +% \item Tables may be stretched. (\cs{arraystretch}) % \item Boxes of arbitrary contents may be assigned a width and framed. % \item Floats may be moved into and out of the grouping environments as needed. % \item An artist/author's name may be added to a figure and the index. @@ -582,29 +599,72 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \section{Using the \pkg{keyfloat} package} % -% \subsection{Loading \pkg{keyfloat}} +% \subsection{Loading \pkg{keyfloat} and related packages} % % \pkg{keyfloat} is loaded with the usual command: % \begin{sourcedisplay} % \cs{usepackage}\{keyfloat\} % \end{sourcedisplay} % -% If you wish to have artist's names appear in the table of contents, +% +% If you wish to have artist's names appear in the list of figures, +% \DescribePackage{tocdata} +% \DescribePackage{tocloft} +% \DescribePackage{titletoc} % as provided by the \pkg{tocdata} package, -% load either \pkg{tocloft} or \pkg{titletoc}, -% followed by \pkg{tocdata}, then \pkg{keyfloat}: +% load \pkg{tocdata}, +% optionally followed by either \pkg{tocloft} or \pkg{titletoc}, +% then \pkg{keyfloat}: % \begin{sourcedisplay} -% \cs{usepackage}\{titletoc\}\% or titletoc \\ % \cs{usepackage}\{tocdata\} \\ +% \cs{usepackage}\{titletoc\}\% or titletoc, or neither \\ % \cs{usepackage}\{keyfloat\} % \end{sourcedisplay} -% -% +% +% To use custom float types, use the \pkg{newfloat} package: +% \DescribePackage{newfloat} +% \begin{sourceverb} +% \usepackage{newfloat} +% \DeclareFloatingEnvironment[ +% fileext={lod}, +% listname={List of Diagrams}, +% name={Diagram}, +% ]{diagram} +% \end{sourceverb} +% +% For the \pkg{caption} package, to have table captions appear above the tables, and +% \DescribePackage{caption} +% to use custom float types: +% \begin{sourceverb} +% \usepackage[tableposition=top]{caption} +% \captionsetup[diagram]{ +% style=default, justification=centering, +% margin=0pt, parskip=0pt, skip=1ex, +% labelfont={small,bf},textfont={small,bf} +% } +% \end{sourceverb} +% +% To use custom float and subfloat types with \pkg{cleveref}: +% \DescribePackage{cleveref} +% \begin{sourceverb} +% \usepackage{cleveref} +% \crefname{diagram}{diagram}{diagrams} +% \crefname{subdiagram}{subdiagram}{subdiagrams} +% \end{sourceverb} +% +% % \subsection{Macros and environments} % % \DescribeMacro{\keyfig} * \oarg{loc} \marg{\keyvalsarg} \marg{image filename} \\ % A macro to generate a figure with an image from a file. % +% \DescribeMacro{\keytab} * \oarg{loc} \marg{\keyvalsarg} \marg{tabular contents} \\ +% A macro to generate a table with tabular contents. +% Usually use the \env{keytable} environment instead. +% +% \DescribeMacro{\keyflt} * \oarg{loc} \marg{float type} \marg{keys/values} \marg{contents} \\ +% A macro to generate an arbitrary float type with its contents. +% % \DescribeMacro{\keyfigbox} * \oarg{loc} \marg{\keyvalsarg} \marg{box contents} \\ % A macro to generate a figure with arbitrary paragraph contents. % See \cref{ex:keyfigbox}. @@ -615,10 +675,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Mostly useful to add supplemental information inside a row of floats or subfloats. % See \cref{ex:keyparbox}. % -% \DescribeMacro{\keytab} * \oarg{loc} \marg{\keyvalsarg} \marg{tabular contents} \\ -% A macro to generate a table with tabular contents. -% Usually use the \env{keytable} environment instead. -% % \DescribeEnv{keyfigure} * \oarg{loc} \marg{\keyvalsarg} \\ % An environment to generate a figure with arbitrary contents. % Useful for multi-paragraph contents. @@ -629,6 +685,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Useful for larger tables. % See \cref{ex:keytable}. % +% \DescribeEnv{keyfloat} * \oarg{loc} \marg{float type} \marg{\keyvalsarg} \\ +% An environment to generate an arbitrary float type with its contents. +% Useful for multi-paragraph contents. +% % \begin{docsidebar} % \textbf{The above macros and environments may be used by themselves, % or inside the following \env{keyfloats}, \env{keysubfigs}, or @@ -650,6 +710,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % May not be nested. % See \cref{ex:keysubtabs}. % +% \DescribeEnv{keysubfloats} * \oarg{loc} \marg{float type} \marg{numcols} \marg{keys} \\ +% A group of subfloats typeset in rows. +% May not be nested. +% % \DescribeEnv{keywrap} \marg{width of keyfloat} \marg{keyfloat} \\ % Displays a keyfloat next to an environment of text. Usable inside a list item, % where [W] will not work. \meta{keyfloat} may be any of \cs{keyfig}, \env{keyfigure}, @@ -690,6 +754,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % a paragraph with contents large enough to wrap around the float. Do not use this % inside a list environment. Select placement with the |wp| key; see % the \pkg{wrapfig} package documentation for more information. +% Watch the log for warnings from \pkg{wrapfig}.\watchout[\pkg{wrapfig} warnings] % % \DescribeArgument{{[loc]}} % The star and [loc] options are ignored for floats inside a \env{keyfloats}, @@ -707,6 +772,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \newcommand{\largebullet}{{\Large\textbullet}} % % \begin{keytable}[bp]{c={Keys and values — part I},l={tab:keyvals},stretch=1.5} +% \centering % \index{keys>and values} % \begin{threeparttable} % \small @@ -722,10 +788,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % cont & \largebullet & Continued float? & cont \\ % l & \largebullet & The label. Enclose in braces if a comma is included. % Ignored in unnumbered floats. & l=fig:A name \\ -% ap & \largebullet & Artist's prefix, such as ``Mr.''\tnote{b} & ap=Mr. \\ -% af & \largebullet & Artist's first name.\tnote{b} & af=First \\ -% al & \largebullet & Artist's last name.\tnote{b} & al=Last \\ -% as & \largebullet & Artist's suffix, such as |~III|.\tnote{b} & |al=~III| \\ +% ap, aup & \largebullet & Artist/author's prefix, such as ``Mr.''\tnote{b} & ap=Mr. \\ +% af, auf & \largebullet & Artist/author's first name.\tnote{b} & af=First \\ +% al, aul & \largebullet & Artist/author's last name.\tnote{b} & al=Last \\ +% as, aus & \largebullet & Artist/author's suffix, such as |~III|.\tnote{b} & |al=~III| \\ % t & \largebullet & Additional text. May include paragraphs. \\ % Enclose in braces if a comma is included. % May need \cs{protect} before macro calls. @@ -739,8 +805,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{tablenotes} % \item[a:] All the keys in Part I may be used with the % \env{keysubfigs} and \env{keysubtabs} environments. -% \item[b:] Artist keys: Only used in Figure floats. -% A fixed-width non-breakable space is placed between names, except that +% \item[b:] Artist \Slash author keys: +% |al| is an artist's last name, |aul| is an author's last name, etc. +% Artists names are printed centered, authors are flush right. +% A fixed-width non-breakable space is placed between parts of names, except that % the optional suffix is connected directly to the last name, allowing % ``|as={, Title}|'', for example. % \end{tablenotes} @@ -754,6 +822,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{keytable}{ % c={Keys and values — part II},cont,stretch=1.5} +% \centering % \index{keys>and values} % \begin{threeparttable} % \small @@ -820,6 +889,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \begin{keytable}{c={Caption-related key combinations},l=tab:captions,stretch=1.5} % \index{caption>options} +% \centering % \begin{threeparttable} % \small % \begin{tabular}{ccccc} @@ -854,12 +924,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \begin{keytable}{c={Wrapped float placement options},l=tab:wrapplacement} % \index{float>wrapped placement}\index{wrapped float placement} +% \centering % \begin{tabular}{ccl} % \toprule % \multicolumn{2}{c}{Key} & Location \\ % \cmidrule(r){1-2}\cmidrule{3-3} -% r & R & to the right of the text \\ -% l & L & to the left of the text \\ +% r & R & to the right of the text body \\ +% l & L & to the left of the text body \\ % i & I & to the inside margin \\ % o & O & to the outside margin \\ % \bottomrule @@ -966,6 +1037,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % The \env{keytable} environment is preferred over the \cs{keytab} macro % since most tables are multi-line creations. % +% \cs{keytab} centers the table, but \env{keytable} does not. +% Add \cs{centering} if desired. +% % \clearpage % % \begin{dtxexample}[\Cref{fig:options}]{Figure with many options selected} @@ -1344,6 +1418,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % {Using \env{keytable}\texttt{[M]} and an offset\label{ex:keytablem}} % \begin{keytable}[M]{c={A \env{keytable}\texttt{[M]}}, % l=tab:keytablem,mo=-.9in} +% \centering % \testwidetable % \end{keytable} % \end{dtxexample} @@ -1399,6 +1474,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \begin{keytable}[W]{c={A \env{keytable}\texttt{[W]}}, % l=tab:keytablew,w=2in,wp=L,tc=Placed \texttt{L} and 2in wide.} +% \centering % \testwidetable % \end{keytable} % \lipsum[2] @@ -1408,7 +1484,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \clearpage % % \begin{dtxexample}[\Cref{fig:keywrapfig}] -% {Using \cs{keywrap} with a \cs{keyfig}\label{ex:keywrapkeyfig}} +% {Using \env{keywrap} with a \cs{keyfig}\label{ex:keywrapkeyfig}} % \begin{itemize} % \item First item. % Several lines of text text text text text @@ -1542,13 +1618,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % % \begin{dtxexample}[\Cref{fig:artistpar}]{Artist's name — arbitrary contents} -% \tdnameright +% \tdartistright % \begin{keyfigure}{f,ap=Mr.,al=Last, % c=Artist's name — arbitrary contents,l=fig:artistpar} % \centering Some text, a quotation, a TikZ\ diagram — % anything not an image file. % \end{keyfigure} -% \tdnamecenter +% \tdartistcenter % \end{dtxexample} % % The artist's name and optional prefix/suffix are printed below the figure, @@ -1691,7 +1767,73 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \section{Code} % % +% \subsection{Older packages} +% +% Ensure that \pkg{tocdata}, if loaded, is new enough: +% \begin{macrocode} +\@ifpackageloaded{tocdata}{ + \@ifpackagelater{tocdata}{2019/03/21}{}{ + \PackageError{keyfloat} + {% + The tocdata package is out of date.\MessageBreak + Update to tocdata v2.02 2019/03/21 or later\MessageBreak + to use use this version of keyfloat% + } + {% + Please update the tocdata package. It's worth it!% + } + } +}{} +% \end{macrocode} +% +% \subsection{Prohibited packages} +% +% Prohibits the use of a certain other packages. +% +% \begin{macro}{\KFLT@@prohibitpackage} \marg{packagename} +% \begin{macrocode} +\newcommand*{\KFLT@@prohibitpackage}[2]{% +\@ifpackageloaded{#1} +{ + \PackageError{keyfloat} + {% + The keyfloat package conflicts with the #1\MessageBreak + package. Remove #1 to use keyfloat.\MessageBreak + Alternative(s):\MessageBreak + \space\space#2% + } + {% + Keyfloat uses the caption, subcaption, newfloat, and wrapfig packages.% + } +}{} +} +% \end{macrocode} +% \end{macro} +% +% +% \begin{macro}{\KFLT@prohibitpackage} \marg{packagename} +% +% Prohibits the use of another package, both now and also \cs{AtBeginDocument}. +% +% \changes{v2.00}{2019/03/11}{Improved package conflict detection.} +% \begin{macrocode} +\newcommand*{\KFLT@prohibitpackage}[2]{ + \KFLT@@prohibitpackage{#1}{#2} + \AtBeginDocument{\KFLT@@prohibitpackage{#1}{#2}} +} +% \end{macrocode} +% \end{macro} +% % +% The list of prohibited packages: +% \begin{macrocode} +\KFLT@prohibitpackage{floatrow}{caption and subcaption} +\KFLT@prohibitpackage{subfig}{subcaption} +\KFLT@prohibitpackage{subfigure}{subcaption} +\KFLT@prohibitpackage{subfloat}{subcaption} +\KFLT@prohibitpackage{float}{newfloat} +\KFLT@prohibitpackage{floatflt}{wrapfig} +% \end{macrocode} % % % @@ -1740,26 +1882,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \RequirePackage{wrapfig} % \end{macrocode} % -% -% Package error if floatrow was loaded: -% -% \changes{v0.13}{2017/01/12}{Error if \pkg{floatrow} was loaded.} -% -% \begin{macrocode} -\@ifpackageloaded{floatrow} -{ -\PackageError{keyfloat} -{% - 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} + @@ -1893,12 +2016,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % \end{macro} % -% \begin{macro}{\KFLT@listtype} List type: ``|lof|'', ``|lot|'' -% \begin{macrocode} -\newcommand*{\KFLT@listtype}{} -% \end{macrocode} -% \end{macro} -% % % \DescribeKey[main]{l} Label % \begin{macrocode} @@ -1959,6 +2076,50 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macro} % % +% \DescribeKey[main]{aup} Author prefix +% \begin{macrocode} +\define@key{KFLT@keys}{aup}{\renewcommand{\KFLT@aup}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@aup} Storage for author prefix +% \begin{macrocode} +\newcommand*{\KFLT@aup}{} +% \end{macrocode} +% \end{macro} +% +% \DescribeKey[main]{auf} Author first name +% \begin{macrocode} +\define@key{KFLT@keys}{auf}{\renewcommand{\KFLT@auf}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@auf} Storage for author first name +% \begin{macrocode} +\newcommand*{\KFLT@auf}{} +% \end{macrocode} +% \end{macro} +% +% \DescribeKey[main]{aul} Author last name +% \begin{macrocode} +\define@key{KFLT@keys}{aul}{\renewcommand{\KFLT@aul}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@al} Storage for author last name +% \begin{macrocode} +\newcommand*{\KFLT@aul}{} +% \end{macrocode} +% \end{macro} +% +% \DescribeKey[main]{aus} Author suffix +% \begin{macrocode} +\define@key{KFLT@keys}{aus}{\renewcommand{\KFLT@aus}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@aus} Storage for author suffix +% \begin{macrocode} +\newcommand*{\KFLT@aus}{} +% \end{macrocode} +% \end{macro} +% % % % @@ -1982,15 +2143,24 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % Create replacement macros in case \pkg{tocdata} is not loaded: % \changes{v0.12}{2016/12/02}{Adapts to older version of tocdata.} -% \begin{macrocode} -\providecommand{\tdtextjustify}{} -\providecommand{\tdtextcenter}{} -\providecommand{\tdtextleft}{} -\providecommand{\tdtextright}{} -\providecommand{\tdnamejustify}{} -\providecommand{\tdnamecenter}{} -\providecommand{\tdnameleft}{} -\providecommand{\tdnameright}{} +% \changes{v2.00}{2019/03/20}{Adjustments for \pkg{tocdata} v2.00.} +% \begin{macrocode} +\providecommand{\tdartisttextjustify}{} +\providecommand{\tdartisttextcenter}{} +\providecommand{\tdartisttextleft}{} +\providecommand{\tdartisttextright}{} +\providecommand{\tdauthortextjustify}{} +\providecommand{\tdauthortextcenter}{} +\providecommand{\tdauthortextleft}{} +\providecommand{\tdauthortextright}{} +\providecommand{\tdartistjustify}{} +\providecommand{\tdartistcenter}{} +\providecommand{\tdartistleft}{} +\providecommand{\tdartistright}{} +\providecommand{\tdauthorjustify}{} +\providecommand{\tdauthorcenter}{} +\providecommand{\tdauthorleft}{} +\providecommand{\tdauthorright}{} % \end{macrocode} % % \DescribeKey[main]{t} Additional text, justified alignment. @@ -1998,7 +2168,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@keys}{t}{% \renewcommand{\KFLT@t}{#1}% \renewcommand{\KFLT@textalign}{}% - \tdtextjustify% } % \end{macrocode} % @@ -2007,7 +2176,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@keys}{tc}{% \renewcommand{\KFLT@t}{#1}% \renewcommand{\KFLT@textalign}{\centering}% - \tdtextcenter% } % \end{macrocode} % @@ -2016,7 +2184,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@keys}{tr}{% \renewcommand{\KFLT@t}{#1}% \renewcommand{\KFLT@textalign}{\raggedleft}% - \tdtextright% } % \end{macrocode} % @@ -2025,19 +2192,11 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@keys}{tl}{% \renewcommand{\KFLT@t}{#1}% \renewcommand{\KFLT@textalign}{\raggedright}% - \tdtextleft% } % \end{macrocode} % % % -% \begin{macro}{\KFLT@i} Image filename storage -% \begin{macrocode} -\newcommand*{\KFLT@i}{} -% \end{macrocode} -% \end{macro} -% -% % \DescribeKey[main]{lw} Fraction of \cs{linewidth} % \begin{macrocode} \define@key{KFLT@keys}{lw}{% @@ -2263,31 +2422,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % \end{macro} -% \begin{macro}{\KFLT@subgrptype} Subfloats collection list type storage: -% ``|lof|'', ``|lot|'' -% \begin{macrocode} -\newcommand*{\KFLT@subgrplisttype}{} -% \end{macrocode} -% \end{macro} - -% \begin{macro}{\KFLT@setsubgrpfigure} Set to figure type -% \begin{macrocode} -\newcommand*{\KFLT@setsubgrpfigure}{% - \renewcommand{\KFLT@subgrptype}{figure}% - \renewcommand{\KFLT@subgrplisttype}{lof}% -} -% \end{macrocode} -% \end{macro} -% \begin{macro}{\KFLT@setsubgrptable} Set to table type -% \begin{macrocode} -\newcommand*{\KFLT@setsubgrptable}{% - \renewcommand{\KFLT@subgrptype}{table}% - \renewcommand{\KFLT@subgrplisttype}{lot}% -} -% \end{macrocode} -% \end{macro} -% % % \DescribeKey[subfloat container]{l} Label % \begin{macrocode} @@ -2319,7 +2454,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@subgrpkeys}{t}{% \renewcommand{\KFLT@subgrpt}{#1}% \renewcommand{\KFLT@subgrptextalign}{}% - \tdtextjustify% } % \end{macrocode} % @@ -2328,7 +2462,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@subgrpkeys}{tc}{% \renewcommand{\KFLT@subgrpt}{#1}% \renewcommand{\KFLT@subgrptextalign}{\centering}% - \tdtextcenter% } % \end{macrocode} % @@ -2337,7 +2470,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@subgrpkeys}{tl}{% \renewcommand{\KFLT@subgrpt}{#1}% \renewcommand{\KFLT@subgrptextalign}{\raggedright}% - \tdtextleft% } % \end{macrocode} % @@ -2346,7 +2478,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \define@key{KFLT@subgrpkeys}{tr}{% \renewcommand{\KFLT@subgrpt}{#1}% \renewcommand{\KFLT@subgrptextalign}{\raggedleft}% - \tdtextright% } % \end{macrocode} % @@ -2398,6 +2529,49 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % \end{macro} +% \DescribeKey[subfloat container]{aup} Author prefix +% \begin{macrocode} +\define@key{KFLT@subgrpkeys}{aup}{\renewcommand{\KFLT@subgrpaup}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@subgrpaup} Storage for author prefix +% \begin{macrocode} +\newcommand*{\KFLT@subgrpaup}{} +% \end{macrocode} +% \end{macro} +% +% \DescribeKey[subfloat container]{auf} Author first name +% \begin{macrocode} +\define@key{KFLT@subgrpkeys}{auf}{\renewcommand{\KFLT@subgrpauf}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@subgrpauf} Storage for author first name +% \begin{macrocode} +\newcommand*{\KFLT@subgrpauf}{} +% \end{macrocode} +% \end{macro} +% +% \DescribeKey[subfloat container]{aul} Author last name +% \begin{macrocode} +\define@key{KFLT@subgrpkeys}{aul}{\renewcommand{\KFLT@subgrpaul}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@subgrpaul} Storage for author last name +% \begin{macrocode} +\newcommand*{\KFLT@subgrpaul}{} +% \end{macrocode} +% \end{macro} +% +% \DescribeKey[subfloat container]{aus} Author suffix +% \begin{macrocode} +\define@key{KFLT@subgrpkeys}{aus}{\renewcommand{\KFLT@subgrpaus}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@subgrpaus} Storage for author suffix +% \begin{macrocode} +\newcommand*{\KFLT@subgrpaus}{} +% \end{macrocode} +% \end{macro} % \subsection{Computing image width} @@ -2439,8 +2613,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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}}% + {\setlength{\KFLT@imagewidth}{\KFLT@boxwidth}}% + {\setlength{\KFLT@imagewidth}{\KFLT@lw\KFLT@boxwidth}}% }% width not given } % \end{macrocode} @@ -2453,10 +2627,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % A user-redefinable macro and length to tightly frame the contents. % % \cs{KFLTtightframe} may be redefined to a macro which frames its contents. -% \cs{KFLTtightframewidth} should be redefine to the total width of the new +% \cs{KFLTtightframewidth} should be redefined to the total width of the new % frame and its separation. % -% \begin{macro}{\KFLT@tightframe} \marg{contents} +% \begin{macro}{\KFLTtightframe} \marg{contents} % \begin{macrocode} \newcommand{\KFLTtightframe}[1]{% \setlength{\fboxsep}{0pt}% @@ -2467,7 +2641,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % \end{macro} % -% \DescribeLength{\KFLTtightframewidth} Combined width of the frame and separation. +% \DescribeLength{\KFLTtightframewidth} Must be set to the combined width of +% the tight frame and separation used by \cs{KFLTtightframe}. % \begin{macrocode} \newlength{\KFLTtightframewidth} \setlength{\KFLTtightframewidth}{.4pt} @@ -2491,7 +2666,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % \end{macro} % -% \DescribeLength{\KFLTlooseframewidth} Combined width of the frame and separation. +% \DescribeLength{\KFLTlooseframewidth} Must be set to the combined width of +% the loose frame and separation used by \cs{KFLTlooseframe}. % \begin{macrocode} \newlength{\KFLTlooseframewidth} \setlength{\KFLTlooseframewidth}{3.4pt} @@ -2537,9 +2713,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \subsection{A graphics image from a file} % -% \begin{macro}{\KFLT@onefigureimage} Create a stand-alone figure with an image. +% \begin{macro}{\KFLT@onefigureimage} \marg{filename} +% +% Create an image with size, frame, and turn. +% +% \changes{v2.00}{2019/03/12}{Filename in arg instead of \cs{KFLT@i}.} % \begin{macrocode} -\NewDocumentCommand{\KFLT@onefigureimage}{} +\NewDocumentCommand{\KFLT@onefigureimage}{m}% {% % \end{macrocode} % Several possible combinations of linewidth, width, and height are available, @@ -2564,14 +2744,14 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {% w and h \includegraphics% [scale=\KFLT@s,% - width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% + width=\KFLT@imagewidth,height=\KFLT@h]{#1}% }% w and h % \end{macrocode} % Only width: % \begin{macrocode} {% only w \includegraphics% - [scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}% + [scale=\KFLT@s,width=\KFLT@imagewidth]{#1}% }% only w }% width is given % \end{macrocode} @@ -2582,15 +2762,15 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % |h| was given: % \begin{macrocode} - {\includegraphics[scale=\KFLT@s,height=\KFLT@h]{\KFLT@i}}% + {\includegraphics[scale=\KFLT@s,height=\KFLT@h]{#1}}% % \end{macrocode} % If none were given, use the image's natural size: % \begin{macrocode} - {\includegraphics[scale=\KFLT@s]{\KFLT@i}}% + {\includegraphics[scale=\KFLT@s]{#1}}% }% width is not given }% not linewidth {% linewidth given - \includegraphics[scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}% + \includegraphics[scale=\KFLT@s,width=\KFLT@imagewidth]{#1}% }% \end{lrbox}% \unskip% @@ -2609,24 +2789,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \subsection{Printing the caption} % % -% \begin{macro}{\KFLT@captioniftype} \marg{|figure| or |table|} \marg{\mainsubarg} -% -% Create a caption only if is of this float type. -% -% The second argument is |{}| if a regular float, or -% |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}. -% \begin{macrocode} -\newcommand*{\KFLT@captioniftype}[2]{% - \ifcsstring{KFLT@#2type}{#1}% - {\KFLT@caption{#2}}% - {}% -} -% \end{macrocode} -% \end{macro} - - - - % \begin{macro}{\KFLT@dosimplecaption} \marg{star?} \marg{short cap or |-NO VALUE-|} \marg{caption} % % Calls \cs{caption} depending on several combinations of star and short captions @@ -2644,7 +2806,70 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % % -% \begin{macro}{\KFLT@docaption} * \oarg{short caption} \marg{caption} \marg{\mainsubarg} +% There are two versions of \cs{KFLT@docaption}, +% depending on whether \pkg{tocdata} is loaded. +% +% \begin{macrocode} +\@ifpackageloaded{tocdata} +{% tocdata loaded +% \end{macrocode} +% +% +% \begin{macro}{\KFLT@@docaption} {1: artist/author} \marg{2: empty or ''u''} +% \marg{3: star?} +% \marg{4: short caption} \marg{5: caption} +% \marg{6: \mainsubarg} +% \changes{v2.00}{2019/03/19}{Factored.} +% \begin{macrocode} +\newcommand*{\KFLT@@docaption}[6]{% +% \end{macrocode} +% (\pkg{tocdata} does not expand its text argument before checking for empty.) +% \begin{macrocode} +\addvspace{\smallskipamount}% +\ifcsempty{KFLT@#6t}{% + \IfBooleanTF{#3}% + {% + \csuse{caption#1}*[#4]{#5}% + []% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }{% + \csuse{caption#1}[#4]{#5}% + []% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }% +}{% + \ifcsstring{KFLT@#6textalign}{}{\csuse{td#1textjustify}}{}% + \ifcsstring{KFLT@#6textalign}{\centering}{\csuse{td#1textcenter}}{}% + \ifcsstring{KFLT@#6textalign}{\raggedleft}{\csuse{td#1textright}}{}% + \ifcsstring{KFLT@#6textalign}{\raggedright}{\csuse{td#1textleft}}{}% + \IfBooleanTF{#3}% + {% + \csuse{caption#1}*[#4]{#5}% + [\csuse{KFLT@#6t}]% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }{% + \csuse{caption#1}[#4]{#5}% + [\csuse{KFLT@#6t}]% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }% +}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\KFLT@docaption} * \oarg{2:short caption} \marg{3:caption} \marg{4: \mainsubarg} % % Depending on whether the \pkg{tocdata} package is present, % and an artist is specified, @@ -2658,62 +2883,49 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \changes{v0.14}{2017/02/09}{Fix: No index entry if no artist given.} % -% There are two versions, depending on whether \pkg{tocdata} is loaded. -% \begin{macrocode} -\@ifpackageloaded{tocdata} -{% tocdata loaded -% \end{macrocode} -% \pkg{tocdata} is loaded: +% With \pkg{tocdata}: +% % \begin{macrocode} \NewDocumentCommand{\KFLT@docaption}{s o m m} {% % \end{macrocode} -% Is this a figure? -% \begin{macrocode} - \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 + \ifcsempty{KFLT@#4aul}% + {% figure w/o artist or author % \end{macrocode} -% A figure without an artist uses the simple caption. +% A figure without an artist or author uses the simple caption. % \begin{macrocode} \KFLT@dosimplecaption{#1}{#2}{#3}% - }% figure w/o artist - {% figure with an artist + }% figure w/o artist or author % \end{macrocode} -% A figure with an artist uses the \pkg{tocdata} \cs{captionartist} macro, +% A figure with an author uses the \pkg{tocdata} \cs{captionauthor} 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: + {% figure w/ author + \KFLT@@docaption{author}{u}{#1}{#2}{#3}{#4}% + }% figure w/ author + }% figure w/o artist + {% figure with an artist % \end{macrocode} -% If it isn't a figure, ignore artist information and create a simple caption: +% A figure with an artist uses the \pkg{tocdata} \cs{captionartist} macro, +% which also creates an index entry. % \begin{macrocode} - \KFLT@dosimplecaption{#1}{#2}{#3}% - }% not a figure + \KFLT@@docaption{artist}{}{#1}{#2}{#3}{#4}% + }% figure with an artist }% KFLT@tocdata }% tocdata loaded {% no tocdata +% \end{macrocode} +% \end{macro} +% +% Without \pkg{tocdata}: +% +% \begin{macro}{\KFLT@docaption} * \oarg{2:short caption} \marg{3:caption} \marg{4: \mainsubarg} +% \changes{v2.00}{2019/03/19}{Added support for authors.} +% \begin{macrocode} \NewDocumentCommand{\KFLT@docaption}{s o m m} {% % \end{macrocode} @@ -2724,11 +2936,19 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Create an index entry depending on whether there is a last, first name: % \begin{macrocode} \ifcsempty{KFLT@#4al}% - {}% no artist + {% + \ifcsempty{KFLT@#4aul}% + {}% + {% yes author + \ifcsempty{KFLT@#4auf}% + {\index{\csuse{KFLT@#4aul}}}% + {\index{\csuse{KFLT@#4aul}, \csuse{KFLT@#4auf}}}% + }% yes author + }% no artist {% yes artist \ifcsempty{KFLT@#4af}% - {\index{\csname KFLT@#4al\endcsname}}% - {\index{\csname KFLT@#4al\endcsname, \csname KFLT@#4af\endcsname}}% + {\index{\csuse{KFLT@#4al}}}% + {\index{\csuse{KFLT@#4al}, \csuse{KFLT@#4af}}}% }% yes artist }% KFLT@docaption }% no tocdata @@ -2772,15 +2992,17 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {}% % \end{macrocode} % Both |cstar| and |sc| were given, so add a \acro{LOF} entry: +% \changes{v2.00}{2019/01/22}{Generalized for float type.} % \begin{macrocode} {% non-empty cstar and sc: - \addcontentsline{\KFLT@listtype}% - {\csname KFLT@#1type\endcsname}{\KFLT@sc}% + \edef\KFLT@listtype{\csuse{KFLT@#1type}}% + \addcontentsline{\csuse{ext@\KFLT@listtype}}% + {\csuse{KFLT@#1type}}{\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}% + \KFLT@docaption*{\csuse{KFLT@#1c}}{#1}% }% }% starred caption % \end{macrocode} @@ -2789,18 +3011,18 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {% unstarred caption \ifcsempty{KFLT@#1sc}% {% no short cap - \KFLT@docaption{\csname KFLT@#1c\endcsname}{#1}% + \KFLT@docaption{\csuse{KFLT@#1c}}{#1}% }% no short cap {% short cap - \KFLT@docaption[\csname KFLT@#1sc\endcsname]% - {\csname KFLT@#1c\endcsname}{#1}% + \KFLT@docaption[\csuse{KFLT@#1sc}]% + {\csuse{KFLT@#1c}}{#1}% }% short cap % \end{macrocode} % Optional label: % \begin{macrocode} \ifcsempty{KFLT@#1l}% {}% - {\label{\csname KFLT@#1l\endcsname}}% + {\label{\csuse{KFLT@#1l}}}% }% unstarred caption } % \end{macrocode} @@ -2818,16 +3040,17 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \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@aup}{}% + \renewcommand{\KFLT@auf}{}% + \renewcommand{\KFLT@aul}{}% + \renewcommand{\KFLT@aus}{}% \renewcommand{\KFLT@t}{}% \renewcommand{\KFLT@textalign}{}% - \tdtextjustify% - \renewcommand{\KFLT@i}{}% \renewcommand{\KFLT@lw}{}% \setlength{\KFLT@w}{0pt}% \setlength{\KFLT@h}{0pt}% @@ -2867,9 +3090,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \ifnumless{\value{KFLT@thiscol}}{\value{KFLT@numcols}}% {}% thiscol < numcols {% >= - - \addvspace{.75\floatsep} - + \par% + \addvspace{.75\floatsep}% \defcounter{KFLT@thiscol}{0}% }% }% @@ -2886,13 +3108,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macro}{\KFLT@trackrows} Tracks and spaces rows and columns. % \begin{macrocode} -\newcommand{\KFLT@trackrows} +\newcommand{\KFLT@trackrows}% {% % \end{macrocode} % If are nested inside a keyfloats or a subfloat: % \begin{macrocode} \ifboolexpr{% - test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or + test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or% bool{KFLT@inkeysubfloats}% }% {% nested @@ -2936,20 +3158,19 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macrocode} % Add some space, then create a full-width minipage to contain the text: % \begin{macrocode} - \unskip% - \addvspace{2ex}% + \addvspace{\smallskipamount}% \begin{minipage}{\linewidth}% % \end{macrocode} % Set the alignment and some text parameters: % \begin{macrocode} - \csname KFLT@#1textalign\endcsname% + \csuse{KFLT@#1textalign}% \footnotesize% \setlength{\parskip}{1.5ex}% \setlength{\parindent}{0em}% % \end{macrocode} % Typeset the actual text: % \begin{macrocode} - \csname KFLT@#1t\endcsname% + \csuse{KFLT@#1t}% % \end{macrocode} % Close it all out with a little more space: % \begin{macrocode} @@ -2981,7 +3202,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \begin{macro}{\KFLT@addartisttext} \marg{\mainsubarg} % -% Adds optional artist's name and add'l text. +% Adds optional additional text. % % The argument is |{}| if a regular float, or % |subgrp| if \cs{keysubfigs} or \cs{keysubtabs}. @@ -2989,11 +3210,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % One of two versions is used, depending on whether the \pkg{tocdata} % package is available. % -% If \pkg{tocdata} is loaded, this float is a figure, and artist information -% is given, then the float's artist's information and optional text will be printed -% elsewhere by \cs{KFLT@caption}. Otherwise, it is printed here along with the text. -% \begin{macrocode} -% \end{macrocode} +% If \pkg{tocdata} is loaded and this float has an artist or author, +% then the float's artist's information and optional text will be printed +% elsewhere by \cs{KFLT@caption}. Otherwise, the text is printed here. +% % Two versions, depending on whether \pkg{tocdata} is loaded: % \begin{macrocode} \@ifpackageloaded{tocdata} @@ -3004,57 +3224,67 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \newcommand{\KFLT@addartisttext}[1] {% % \end{macrocode} -% Only use the artist name if this is a figure: +% Only add text if is a figure without an artist or author name. +% If an artist or author is given, the name and text will be added +% by \pkg{tocdata}. % \begin{macrocode} - \ifcsstring{KFLT@#1type}{figure}% - {% figure + \ifcsempty{KFLT@#1al}% artist last name + {% + \ifcsempty{KFLT@#1aul}% author last name + {\KFLT@addtext{#1}} + {}% + }% + {}% fig w/ artist: text will be added by \captionartist in \KFLT@caption +}% KFLT@addartisttext +}% tocdata loaded % \end{macrocode} -% Only use the artist name if a last name is given: +% If \pkg{tocdata} is not loaded, the name and text are added here: % \begin{macrocode} - \ifcsempty{KFLT@#1al}% +{% tocdata not loaded % \end{macrocode} -% A figure but no artist: + +% Factored from \cs{KFLT@addartisttext} % \begin{macrocode} - {\KFLT@addtext{#1}}% +\newcommand*{\KFLT@@addartisttext}[3]{% % \end{macrocode} -% A figure with an artist: will be handled by \pkg{tocdata} when the caption is created. +% Add space and create the name inside a full-width minipage: % \begin{macrocode} - {}% fig w/ artist: text will be added by \captionartist in \KFLT@caption - }% figure + \addvspace{\medskipamount}% + \begin{minipage}{\linewidth}% % \end{macrocode} -% If not a figure, ignore artist information: +% Text alignment is |#3|, and depends on artist or author: % \begin{macrocode} - {\KFLT@addtext{#1}}% -}% KFLT@addartisttext -}% tocdata loaded + #3% % \end{macrocode} -% If \pkg{tocdata} is not loaded: +% |#1| is empty or '|subgrp'| \\ +% |#2| is empty for artist, `|u|' for author: % \begin{macrocode} -{% tocdata not loaded + \footnotesize\textsc{% + \KFLT@optionalname{\csuse{KFLT@#1a#2p}}% + \KFLT@optionalname{\csuse{KFLT@#1a#2f}}% + \csuse{KFLT@#1a#2l}% + \csuse{KFLT@#1a#2s}% + }% + \end{minipage}% + \par\addvspace{2ex}% +} + \newcommand{\KFLT@addartisttext}[1] {% % \end{macrocode} % Only use the artist information if a last name is given: % \begin{macrocode} \ifcsempty{KFLT@#1al}% - {}% last name not given - {% last name given -% \end{macrocode} -% Add space and create the name inside a full-width minipage: -% \begin{macrocode} - \addvspace{2ex}% - \begin{minipage}{\linewidth}% -% \end{macrocode} -% If \pkg{tocdata} is not used, the artist's name is always centered: -% \begin{macrocode} - \centering\footnotesize\textsc{% - \KFLT@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 + {% artist last name not given + \ifcsempty{KFLT@#1aul}% + {}% author last name not given + {% author last name given + \KFLT@@addartisttext{#1}{u}{\raggedleft}% + }% author last name given + }% artist last name not given + {% artist last name given + \KFLT@@addartisttext{#1}{}{\centering}% + }% % \end{macrocode} % Any additional text follows the artist's name: % \begin{macrocode} @@ -3117,29 +3347,41 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \end{lrbox}% \KFLT@frame{\usebox{\KFLT@envbox}}% - \par\addvspace{2ex}% + \par% }% endkeyboxinner % \end{macrocode} % \end{environment} -% \begin{macro}{\KFLT@boxkeys} \marg{keys} \marg{|figure|/|table|} \marg{|lof|/|lot|} +% \begin{macro}{\KFLT@boxkeys} \marg{keys} \marg{float type} % % Default the options, adjust for a table, then parse the keys: % \begin{macrocode} -\NewDocumentCommand{\KFLT@boxkeys}{+m m m} +\NewDocumentCommand{\KFLT@boxkeys}{+m m} {% \KFLT@defaults% \renewcommand{\KFLT@type}{#2}% - \renewcommand{\KFLT@listtype}{#3}% \setkeys{KFLT@keys}{#1}% } % \end{macrocode} % \end{macro} -% \begin{environment}{KFLT@boxouter} -% \marg{star?} \marg{loc} +% \begin{macro}{\KFLT@LWR@hook@boxouter} Used by \pkg{lwarp}. +% \begin{macrocode} +\newcommand*{\KFLT@LWR@hook@boxouter}{}% +% \end{macrocode} +% \end{macro} + +% \begin{environment}{KFLT@LWR@hook@boxouter@minipage} Used by \pkg{lwarp}. +% \begin{macrocode} +\newenvironment*{KFLT@LWR@hook@boxouter@minipage}[2][] + {\minipage[#1]{#2}} + {\endminipage} +% \end{macrocode} +% \end{environment} + +% \begin{environment}{KFLT@boxouter} \marg{star?} \marg{loc} % % Boxes the contents of figures and floats. % @@ -3160,7 +3402,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Start the new subfigure or subtable, of the given width: % \begin{macrocode} \ifbool{KFLT@inkeysubfloats}% - {\csname sub\KFLT@type\endcsname{\KFLT@rowboxwidth}}% subfloat + {\csuse{sub\KFLT@type}{\KFLT@rowboxwidth}}% subfloat % \end{macrocode} % If \env{keyfloats}, place the contents inside a \env{minipage}: % \begin{macrocode} @@ -3168,12 +3410,16 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% {% keyfloats \ifbool{KFLT@keywrap}% - {\minipage[t]{\KFLT@rowboxwidth}}% + {\KFLT@LWR@hook@boxouter@minipage[t]{\KFLT@rowboxwidth}}% {\minipage[\KFLT@va]{\KFLT@rowboxwidth}}% \captionsetup*{type=\KFLT@type}% }% keyfloats {% not keyfloats % \end{macrocode} +% A hook for \pkg{lwarp} to set \cs{linewidth}, etc. +% \begin{macrocode} + \KFLT@LWR@hook@boxouter% +% \end{macrocode} % % Not a subfloat or \env{keyfloats}, so create a single float. % @@ -3183,7 +3429,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \ifbool{KFLT@keywrap}% {% \par\addvspace{\baselineskip}% - \noindent\minipage[t]{\linewidth}% + \noindent% + \KFLT@LWR@hook@boxouter@minipage[t]{\linewidth}% \captionsetup{type=\KFLT@type}% }% {% not a keywrap @@ -3202,14 +3449,14 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % 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% + \wrapfloat{\KFLT@type}{\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}% + \renewcommand{\KFLT@lw}{}% + \renewcommand{\KFLT@w}{\KFLT@imagewidth}% }% [W] {% not [W] % \end{macrocode} @@ -3219,9 +3466,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \ifstrequal{#2}{M}% % \end{macrocode} % Place [M], so create a marginfloat: +% \changes{v2.00}{2019/03/18}{Added custom float types.} % \begin{macrocode} {% [M] - \csname margin\KFLT@type\endcsname[\KFLT@mo]% + \KFLT@marginfloat[\KFLT@mo]{\KFLT@type}% \captionsetup{type=\KFLT@type}% }% [M] {% not [M} @@ -3244,8 +3492,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} {% not [H] \IfBooleanTF{#1}% - {\csname \KFLT@type*\endcsname[#2]}% - {\csname \KFLT@type\endcsname[#2]}% + {\csuse{\KFLT@type*}[#2]}% + {\csuse{\KFLT@type}[#2]}% }% not [H] }% not [M] }% not [W] @@ -3261,9 +3509,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \KFLT@findwidths% % \end{macrocode} -% If a table, place the caption above the contents: +% Place the caption above the contents depending on \pkg{caption} \optn{position} option: % \begin{macrocode} - \KFLT@captioniftype{table}{}% + \caption@iftop{\KFLT@caption{}}{}% % \end{macrocode} % Typeset the contents: % \begin{macrocode} @@ -3276,24 +3524,27 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} {% endboxouter \endcenter\unskip% + \addvspace{\smallskipamount}% % \end{macrocode} % Optionally print artist's name and additional text: % \begin{macrocode} \KFLT@addartisttext{}% % \end{macrocode} -% If a figure, typeset the caption below the contents: +% Place the caption below the contents depending on \pkg{caption} \optn{position} option: % \begin{macrocode} - \KFLT@captioniftype{figure}{}% + \caption@iftop{}{\KFLT@caption{}}% % \end{macrocode} % If are inside \env{keysubtabs}, end the subtable: % \begin{macrocode} \ifbool{KFLT@inkeysubfloats}% {% - \csname endsub\KFLT@type\endcsname% + \csuse{endsub\KFLT@type}% }% subfloat {% not subfloat \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% keyfloats? - {\endminipage}% keyfloats + {% + \endminipage% + }% keyfloats {% not keyfloats % \end{macrocode} % @@ -3304,7 +3555,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % See if in a \env{keywrap}: % \begin{macrocode} \ifbool{KFLT@keywrap}{% - \endminipage% + \endKFLT@LWR@hook@boxouter@minipage% \par\addvspace{\baselineskip}% }% {% not keywrap @@ -3317,7 +3568,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Place [W], so close the wrap float: % \begin{macrocode} {% [W] - \csname endwrap\KFLT@type\endcsname% + \endwrapfloat% }% [W] {% not[W] % \end{macrocode} @@ -3327,9 +3578,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \ifstrequal{#2}{M}% % \end{macrocode} % Place [M], so close the marginfloat: +% \changes{v2.00}{2019/03/18}{Added custom float types.} % \begin{macrocode} {% [M] - \csname endmargin\KFLT@type\endcsname% + \endKFLT@marginfloat% }% [M] {% not [M] \ifstrequal{#2}{H}% @@ -3339,8 +3591,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% }% {% not [H] \IfBooleanTF{#1}% starred float? - {\csname end\KFLT@type*\endcsname}% - {\csname end\KFLT@type\endcsname}% + {\csuse{end\KFLT@type*}}% + {\csuse{end\KFLT@type}}% }% not [H] }% not [M] }% not [W] @@ -3352,6 +3604,172 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{environment} +% \begin{macro}{\KFLT@@ignorespaces} \marg{commandname} +% Only do command if not nested inside something. +% \changes{v2.00}{2019/01/22}{Added.} +% \begin{macrocode} +\newcommand*{\KFLT@@ignorespaces}[1]{% + \ifboolexpr{% + test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or% + bool{KFLT@inkeysubfloats}% + }{}{\csuse{#1}}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\KFLT@ignorespaces} +% Only \cs{ignorespaces} if not nested inside something. +% \changes{v2.00}{2019/01/22}{Added.} +% \begin{macrocode} +\newcommand*{\KFLT@ignorespaces}{% + \KFLT@@ignorespaces{ignorespaces}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\KFLT@envignorespaces} +% Only \cs{ignorespaces} if not nested inside something. +% \changes{v2.00}{2019/01/22}{Added.} +% \begin{macrocode} +\newcommand*{\KFLT@envignorespaces}{% + \KFLT@@ignorespaces{ignorespacesafterend}% +} +% \end{macrocode} +% \end{macro} + + +% \subsection{The \cs{KFLT@keyflt} macro} +% +% \begin{macro}{\KFLT@keyflt} +% \marg{1:star} \marg{2:loc} \marg{3:type} \marg{4:\keyvalsarg} \marg{5:contents} +% +% A lower-level macro to generate a float with its contents. +% This is used by \cs{keyfig} and \cs{keyflt}. +% +% \changes{v2.00}{2019/03/17}{Added.} +% \begin{macrocode} +\NewDocumentCommand{\KFLT@keyflt}{m m m +m +m} +{% + \ifcsdef{l@#3}{}{% + \PackageError{keyfloat}% + {% + \protect\keyflt: Invalid float type.\MessageBreak% + \protect\keyflt*[loc]{type}{keys/values}{contents}\MessageBreak% + Also, \protect\keyflt\space is not an environment + }% + {% + Check argument order and float type. + }% + }% + \KFLT@ignorespaces% + \KFLT@trackrows% + \KFLT@boxkeys{#4}{#3}% + \begingroup% + \KFLT@boxouter{#1}{#2}% + #5% + \endKFLT@boxouter% + \endgroup% + \KFLT@ignorespaces% +} +% \end{macrocode} +% \end{macro} + + +% \subsection{The \cs{keyflt} macro} + +% \begin{macro}{\keyflt} * \oarg{loc} \marg{type} \marg{\keyvalsarg} \marg{contents} +% +% A user-level macro to generate a float with its contents +% centered inside an inner box. +% This may be used by itself, or inside a \env{keyfloats} or +% \env{keysubtabs} environment. +% +% \changes{v0.12}{2016/12/03}{Group around contents.} +% \changes{v2.00}{2019/03/17}{Added.} +% \begin{macrocode} +\NewDocumentCommand{\keyflt}{s O{tbp} m +m +m} +{% + \KFLT@keyflt{#1}{#2}{#3}{#4}{% + \KFLT@boxinner% + \centering% + #5% + \endKFLT@boxinner% + }% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\endkeyflt} +% +% Generates an error in case the user tried to use \cs{keyflt} as an environment. +% \changes{v2.00}{2019/03/17}{Added.} +% \begin{macrocode} +\def\endkeyflt{% + \PackageError{keyfloat} + {% + \protect\end{keyflt}:\MessageBreak + \protect\keyflt\space is a macro, not an environment.\MessageBreak + Perhaps you want the keyfloat environment instead% + } + {% + Use \protect\begin{keyfloat} ... \protect\end{keyfloat}. + } +} +% \end{macrocode} +% \end{macro} + + +% \subsection{The \env{keyfloat} environment} + +% \begin{macro}{\KFLT@keyfloatstart} \marg{star?} \marg{loc} \marg{float type} \marg{\keyvalsarg} +% \changes{v2.00}{2019/03/18}{Factored.} +% \begin{macrocode} +\newcommand{\KFLT@keyfloatstart}[4]{% + \KFLT@envignorespaces% + \KFLT@boxkeys{#4}{#3}% + \KFLT@boxouter{#1}{#2}% + \KFLT@boxinner% +} +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\KFLT@keyfloatend} +% \changes{v2.00}{2019/03/18}{Factored.} +% \begin{macrocode} +\newcommand{\KFLT@keyfloatend}{% + \endKFLT@boxinner% + \endKFLT@boxouter% + \KFLT@envignorespaces% +} +% \end{macrocode} +% \end{macro} + +% \begin{environment}{keyfloat} * \oarg{loc} \marg{float type} \marg{\keyvalsarg} +% \changes{v2.00}{2019/03/18}{Added.} +% \begin{macrocode} +\NewDocumentEnvironment{keyfloat}{s O{tbp} m +m} +{% + \KFLT@keyfloatstart{#1}{#2}{#3}{#4}% +}% +{% + \KFLT@keyfloatend% +} +% \end{macrocode} +% \end{environment} + +% Extra code to track rows outside of the \env{keyfloat} environment, +% \DescribeObject{Before \env{keyfloat}} +% before it starts. This is done to allow nesting without losing track +% of the prior level. +% +% \begin{macrocode} +\BeforeBeginEnvironment{keyfloat}{% + \KFLT@trackrows% +} +% \end{macrocode} + % \subsection{The \env{keyfigure} environment} @@ -3359,13 +3777,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \NewDocumentEnvironment{keyfigure}{s O{tbp} +m} {% - \KFLT@boxkeys{#3}{figure}{lof}% - \KFLT@boxouter{#1}{#2}% - \KFLT@boxinner% + \KFLT@keyfloatstart{#1}{#2}{figure}{#3}% }% {% - \endKFLT@boxinner% - \endKFLT@boxouter% + \KFLT@keyfloatend% } % \end{macrocode} % \end{environment} @@ -3384,27 +3799,19 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \subsection{The \cs{keyfig} macro} -% \begin{macro}{\keyfig} * \oarg{2: loc} \marg{3: \keyvalsarg} \marg{4: image filename} +% \begin{macro}{\keyfig} * \oarg{2:loc} \marg{3:\keyvalsarg} \marg{4:image filename} % % A user-level macro to generate a figure with an image. % This may be used by itself, or inside a \env{keyfloats} or % \env{keysubfigs} environment. % -% \changes{v0.12}{2016/12/03}{Group around contents.} +% \changes{v2.00}{2019/03/17}{Factored.} % \begin{macrocode} \NewDocumentCommand{\keyfig}{s O{tbp} +m m} {% - \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% + \KFLT@keyflt{#1}{#2}{figure}{#3}{% + \KFLT@onefigureimage{#4}% + }% } % \end{macrocode} % \end{macro} @@ -3423,8 +3830,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m} {% + \KFLT@ignorespaces% \KFLT@trackrows% - \KFLT@boxkeys{#3}{figure}{lof}% + \KFLT@boxkeys{#3}{figure}% \begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% @@ -3432,6 +3840,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \endKFLT@boxinner% \endKFLT@boxouter% \endgroup% + \KFLT@ignorespaces% } % \end{macrocode} % \end{macro} @@ -3451,8 +3860,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \NewDocumentCommand{\keyparbox}{s O{tbp} +m +m} {% + \KFLT@ignorespaces% \KFLT@trackrows% - \KFLT@boxkeys{#3}{figure}{lof}% + \KFLT@boxkeys{#3}{figure}% % \end{macrocode} % Force |cstar={}|: % \begin{macrocode} @@ -3468,6 +3878,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \endKFLT@boxinner% \endKFLT@boxouter% \endgroup% + \KFLT@ignorespaces% } % \end{macrocode} % \end{macro} @@ -3481,20 +3892,15 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % This may be used by itself, or inside a \env{keyfloats} or % \env{keysubtabs} environment. % -% \changes{v0.12}{2016/12/03}{Group around contents.} -% \begin{macrocode}+ +% \changes{v2.00}{2019/03/17}{Factored.} +% \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% + \IfBooleanTF{#1}{% + \keyflt*[#2]{table}{#3}{#4}% + }{% + \keyflt[#2]{table}{#3}{#4}% + }% } % \end{macrocode} % \end{macro} @@ -3506,14 +3912,10 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \NewDocumentEnvironment{keytable}{s O{tbp} +m} {% - \KFLT@boxkeys{#3}{table}{lot}% - \KFLT@boxouter{#1}{#2}% - \KFLT@boxinner% - \centering% + \KFLT@keyfloatstart{#1}{#2}{table}{#3}% }% {% - \endKFLT@boxinner% - \endKFLT@boxouter% + \KFLT@keyfloatend% } % \end{macrocode} % \end{environment} @@ -3543,13 +3945,14 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% {% \PackageError{keyfloat}% {% - Cannot nest keysubfigs or keysubtabs.% + Cannot nest keysubfigs or keysubtabs.\MessageBreak% (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.% + The subcaption package do not support nested environments,\MessageBreak + so the keyfloat package cannot place a\MessageBreak + keysubfigs or keysubtabs environment inside another,\MessageBreak + or inside a keyfloats.% }% }% {}% @@ -3558,6 +3961,22 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{macro} +% \begin{macro}{\KFLT@LWR@hook@keyfloats} Used by \pkg{lwarp}. +% \begin{macrocode} +\newcommand*{\KFLT@LWR@hook@keyfloats}{}% +% \end{macrocode} +% \end{macro} + + +% \begin{environment}{KFLT@LWR@hook@keyfloatsminipage} Modified by \pkg{lwarp}. +% \begin{macrocode} +\newenvironment*{KFLT@LWR@hook@keyfloatsminipage}[1] + {\noindent\minipage{#1}} + {\endminipage}% +% \end{macrocode} +% \end{environment} + + % \begin{environment}{keyfloats} * \oarg{loc} \marg{num columns} % % User-level macro to create rows of figures/tables. @@ -3580,8 +3999,13 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \NewDocumentEnvironment{keyfloats}{s O{tbp} m} {% + \KFLT@envignorespaces% % \end{macrocode} -% Nest the environment: +% A hook for \pkg{lwarp} to set \cs{linewidth}, etc. +% \begin{macrocode} + \KFLT@LWR@hook@keyfloats% +% \end{macrocode} +% Track the depth: % \begin{macrocode} \addtocounter{KFLT@keyfloatdepth}{1}% % \end{macrocode} @@ -3591,7 +4015,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% test {\ifstrequal{#2}{H}} or test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{1}} or bool {KFLT@inkeysubfloats} or - bool {KFLT@keywrap} + bool {KFLT@keywrap}% }% % \end{macrocode} % Create an inline minipage: @@ -3605,12 +4029,11 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% bool {KFLT@inkeysubfloats} }% {% - \noindent% - \begin{minipage}{\KFLT@rowboxwidth}% + \KFLT@LWR@hook@keyfloatsminipage{\KFLT@rowboxwidth}% }% {% \bigbreak% - \noindent\begin{minipage}{\linewidth}% + \KFLT@LWR@hook@keyfloatsminipage{\linewidth}% }% % \end{macrocode} % If inside subfloats, generate subfigures by default: @@ -3667,15 +4090,18 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% bool {KFLT@keywrap} }% {% was [H], etc. - \end{minipage}% + \endKFLT@LWR@hook@keyfloatsminipage% +% \end{minipage}% % \end{macrocode} % Spacing if nested: % \begin{macrocode} - \ifboolexpr{% + \ifboolexpr{ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or bool {KFLT@keywrap} }% - {}{\bigbreak}% + {}{% + \bigbreak% + }% }% was [H], etc. % \end{macrocode} % Was not [H], so close a figure: @@ -3688,6 +4114,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Unnest the environment: % \begin{macrocode} \addtocounter{KFLT@keyfloatdepth}{-1}% + \KFLT@envignorespaces% } % \end{macrocode} % \end{environment} @@ -3701,21 +4128,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % \begin{macrocode} \BeforeBeginEnvironment{keyfloats}{% -% \end{macrocode} -% Track rows: -% \begin{macrocode} - \ifboolexpr{% - test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or - bool {KFLT@inkeysubfloats} - }% - {\KFLT@maybestartfloatrow}% - {}% -% \end{macrocode} -% Possibly fill space between columns: -% \begin{macrocode} - \ifnumgreater{\value{KFLT@thiscol}}{1}% - {\hfill}% - {}% + \KFLT@trackrows% } % \end{macrocode} @@ -3730,24 +4143,23 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \setboolean{KFLT@subgrpcstar}{false}% \renewcommand{\KFLT@subgrpsc}{}% \setboolean{KFLT@subgrpscgiven}{false}% - \KFLT@setsubgrpfigure% + \renewcommand{\KFLT@subgrptype}{figure}% \renewcommand{\KFLT@subgrpl}{}% \renewcommand{\KFLT@subgrpap}{}% \renewcommand{\KFLT@subgrpaf}{}% \renewcommand{\KFLT@subgrpal}{}% \renewcommand{\KFLT@subgrpas}{}% + \renewcommand{\KFLT@subgrpaup}{}% + \renewcommand{\KFLT@subgrpauf}{}% + \renewcommand{\KFLT@subgrpaul}{}% + \renewcommand{\KFLT@subgrpaus}{}% \renewcommand{\KFLT@subgrpt}{}% \renewcommand{\KFLT@subgrptextalign}{}% - \tdtextjustify% } % \end{macrocode} % \end{macro} - - - - % \begin{macro}{\KFLT@subfloats} \marg{starred?} \marg{loc} \marg{cols} \marg{\keyvalsarg} % % \changes{v0.13}{2017/01/16}{Fix: Subfloat type selection.} @@ -3757,6 +4169,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \NewDocumentCommand{\KFLT@subfloats}{m m m +m} {% + \KFLT@envignorespaces% % \end{macrocode} % Parse the key-value combinations: % \begin{macrocode} @@ -3806,9 +4219,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \center\unskip% % \end{macrocode} -% If this is a table, place the caption above the contents: +% Place the caption above the contents depending on \pkg{caption} \optn{position} option: % \begin{macrocode} - \KFLT@captioniftype{table}{subgrp}% + \caption@iftop{\KFLT@caption{subgrp}}{}% % \end{macrocode} % Not yet started a row of subfloats. % The use of \cs{defcounter} makes these changes local. @@ -3817,7 +4230,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \defcounter{KFLT@thiscol}{0}% % \end{macrocode} % Creat a group for the subfloats. -% Necessary in case they change \cs{tdtextcenter}, etc. +% Necessary in case they change \cs{tdartisttextcenter}, etc. % \begin{macrocode} \begingroup% } @@ -3835,7 +4248,8 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % End the group containing the subfloats: % \begin{macrocode} \endgroup% - \unskip\endcenter% + \unskip% + \endcenter% % \end{macrocode} % A little extra space at the bottom: % \begin{macrocode} @@ -3845,9 +4259,9 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \begin{macrocode} \KFLT@addartisttext{subgrp}% % \end{macrocode} -% If this was a figure, place the caption below the contents: +% Place the caption below the contents depending on \pkg{caption} \optn{position} option: % \begin{macrocode} - \KFLT@captioniftype{figure}{subgrp}% + \caption@iftop{}{\KFLT@caption{subgrp}}% % \end{macrocode} % End the float or minipage: % \begin{macrocode} @@ -3865,30 +4279,45 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % Unnest the environment: % \begin{macrocode} \setboolean{KFLT@inkeysubfloats}{false}% + \KFLT@envignorespaces% } % \end{macrocode} % \end{macro} -% \begin{environment}{keysubfigs} * \oarg{loc} \marg{numcols} \marg{\keyvalsarg} +% \begin{macro}{\KFLT@LWR@hook@keysubfloats} Used by \pkg{lwarp}. +% \begin{macrocode} +\newcommand*{\KFLT@LWR@hook@keysubfloats}{} +% \end{macrocode} +% \end{macro} + +% \begin{environment}{KFLT@keysubfloats} \marg{star?} \marg{loc} \marg{float type} \marg{numcols} \marg{\keyvalsarg} % % A group of subfigures typeset in rows. % % \begin{macrocode} -\NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m} +\NewDocumentEnvironment{KFLT@keysubfloats}{m m m m +m} {% % \end{macrocode} % Error if trying to nest environments: % \begin{macrocode} \KFLT@nonest% % \end{macrocode} +% A hook for \pkg{lwarp} to set \cs{linewidth}, etc. +% \begin{macrocode} + \KFLT@LWR@hook@keysubfloats% +% \end{macrocode} % Default the options: % \begin{macrocode} \KFLT@subgrpdefaults% % \end{macrocode} +% Default to figure float type: +% \begin{macrocode} + \renewcommand{\KFLT@subgrptype}{#3}% +% \end{macrocode} % Start of the environment: % \begin{macrocode} - \KFLT@subfloats{#1}{#2}{#3}{#4}% + \KFLT@subfloats{#1}{#2}{#4}{#5}% }% the start of the environment % \end{macrocode} % end of the environment: @@ -3900,34 +4329,45 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % \end{environment} -% \begin{environment}{keysubtabs} * \oarg{loc} \marg{numcols} \marg{\keyvalsarg} +% \begin{environment}{keysubfloats} * \oarg{loc} \marg{float type} \marg{numcols} \marg{\keyvalsarg} +% +% A group of subfloats typeset in rows. % -% A group of subtables typeset in rows. % \begin{macrocode} -\NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m} +\NewDocumentEnvironment{keysubfloats}{s O{tbp} m m +m} {% + \KFLT@keysubfloats{#1}{#2}{#3}{#4}{#5}% +}{% + \endKFLT@keysubfloats% +} % \end{macrocode} -% Error if trying to nest environments: -% \begin{macrocode} - \KFLT@nonest% -% \end{macrocode} -% Default the options: -% \begin{macrocode} - \KFLT@subgrpdefaults% -% \end{macrocode} -% Default to table float type: -% \begin{macrocode} - \KFLT@setsubgrptable% -% \end{macrocode} -% Start of the environment: +% \end{environment} + + +% \begin{environment}{keysubfigs} * \oarg{loc} \marg{numcols} \marg{\keyvalsarg} +% +% A group of subfigures typeset in rows. +% % \begin{macrocode} - \KFLT@subfloats{#1}{#2}{#3}{#4}% -}% the start of the environment +\NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m} +{% + \KFLT@keysubfloats{#1}{#2}{figure}{#3}{#4}% +}{% + \endKFLT@keysubfloats% +} % \end{macrocode} -% End of the environment: +% \end{environment} + + +% \begin{environment}{keysubtabs} * \oarg{loc} \marg{numcols} \marg{\keyvalsarg} +% +% A group of subtables typeset in rows. % \begin{macrocode} +\NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m} {% - \KFLT@endsubfloats{#1}{#2}% + \KFLT@keysubfloats{#1}{#2}{table}{#3}{#4}% +}{% + \endKFLT@keysubfloats% } % \end{macrocode} % \end{environment} @@ -3946,6 +4386,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \NewDocumentEnvironment{KFLT@marginfloat}{O{-1.2ex} m} {% start \FloatBarrier% keep floats in order + \KFLT@envignorespaces% \begin{lrbox}{\KFLT@marginfloatbox}% \begin{minipage}{\marginparwidth}% \captionsetup{type=#2}% @@ -3956,11 +4397,14 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \end{minipage}% \end{lrbox}% \marginpar{\usebox{\KFLT@marginfloatbox}}% + \KFLT@envignorespaces% }% end % \end{macrocode} % \end{environment} % % +% Provided in case \pkg{tufte-book} is not loaded: +% % \begin{environment}{marginfigure} \oarg{offset} % \changes{v0.12}{2016/12/03}{Added.} % \begin{macrocode} @@ -3983,7 +4427,7 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% % % % -% +% \subsection{Wrapped floats} % % \DescribeBoolean{KFL@keywrap} Tells the next keyfloat to wrap around some text. % \begin{macrocode} diff --git a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty index 4bc84196c9c..0a8b5d6ceef 100644 --- a/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty +++ b/Master/texmf-dist/tex/latex/keyfloat/keyfloat.sty @@ -18,11 +18,49 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{keyfloat} - [2019/01/11 v1.00 Key/value interface for floats and subfloats.] + [2019/03/21 v2.00 Key/value interface for floats and subfloats.] +\@ifpackageloaded{tocdata}{ + \@ifpackagelater{tocdata}{2019/03/21}{}{ + \PackageError{keyfloat} + {% + The tocdata package is out of date.\MessageBreak + Update to tocdata v2.02 2019/03/21 or later\MessageBreak + to use use this version of keyfloat% + } + {% + Please update the tocdata package. It's worth it!% + } + } +}{} +\newcommand*{\KFLT@@prohibitpackage}[2]{% +\@ifpackageloaded{#1} +{ + \PackageError{keyfloat} + {% + The keyfloat package conflicts with the #1\MessageBreak + package. Remove #1 to use keyfloat.\MessageBreak + Alternative(s):\MessageBreak + \space\space#2% + } + {% + Keyfloat uses the caption, subcaption, newfloat, and wrapfig packages.% + } +}{} +} +\newcommand*{\KFLT@prohibitpackage}[2]{ + \KFLT@@prohibitpackage{#1}{#2} + \AtBeginDocument{\KFLT@@prohibitpackage{#1}{#2}} +} +\KFLT@prohibitpackage{floatrow}{caption and subcaption} +\KFLT@prohibitpackage{subfig}{subcaption} +\KFLT@prohibitpackage{subfigure}{subcaption} +\KFLT@prohibitpackage{subfloat}{subcaption} +\KFLT@prohibitpackage{float}{newfloat} +\KFLT@prohibitpackage{floatflt}{wrapfig} \RequirePackage{etoolbox}[2011/01/03]% \RequirePackage{xparse} \RequirePackage{xkeyval} @@ -33,19 +71,6 @@ \RequirePackage{rotating} \RequirePackage{placeins} \RequirePackage{wrapfig} -\@ifpackageloaded{floatrow} -{ -\PackageError{keyfloat} -{% - The keyfloat package conflicts with the floatrow package. - Remove floatrow to use keyfloat.% -} -{% - Keyfloat uses the caption and subcaption packages to - provide similar functionality to floatrow.% -} -} -{} \PassOptionsToPackage{expand}{gettitlestring} @@ -86,7 +111,6 @@ \newcommand{\KFLT@sc}{} \newboolean{KFLT@scgiven} \newcommand*{\KFLT@type}{} -\newcommand*{\KFLT@listtype}{} \define@key{KFLT@keys}{l}{\renewcommand{\KFLT@l}{#1}} \newcommand*{\KFLT@l}{} \define@key{KFLT@keys}{ap}{\renewcommand{\KFLT@ap}{#1}} @@ -97,37 +121,48 @@ \newcommand*{\KFLT@al}{} \define@key{KFLT@keys}{as}{\renewcommand{\KFLT@as}{#1}} \newcommand*{\KFLT@as}{} +\define@key{KFLT@keys}{aup}{\renewcommand{\KFLT@aup}{#1}} +\newcommand*{\KFLT@aup}{} +\define@key{KFLT@keys}{auf}{\renewcommand{\KFLT@auf}{#1}} +\newcommand*{\KFLT@auf}{} +\define@key{KFLT@keys}{aul}{\renewcommand{\KFLT@aul}{#1}} +\newcommand*{\KFLT@aul}{} +\define@key{KFLT@keys}{aus}{\renewcommand{\KFLT@aus}{#1}} +\newcommand*{\KFLT@aus}{} \newcommand*{\KFLT@textalign}{} \newcommand{\KFLT@t}{} -\providecommand{\tdtextjustify}{} -\providecommand{\tdtextcenter}{} -\providecommand{\tdtextleft}{} -\providecommand{\tdtextright}{} -\providecommand{\tdnamejustify}{} -\providecommand{\tdnamecenter}{} -\providecommand{\tdnameleft}{} -\providecommand{\tdnameright}{} +\providecommand{\tdartisttextjustify}{} +\providecommand{\tdartisttextcenter}{} +\providecommand{\tdartisttextleft}{} +\providecommand{\tdartisttextright}{} +\providecommand{\tdauthortextjustify}{} +\providecommand{\tdauthortextcenter}{} +\providecommand{\tdauthortextleft}{} +\providecommand{\tdauthortextright}{} +\providecommand{\tdartistjustify}{} +\providecommand{\tdartistcenter}{} +\providecommand{\tdartistleft}{} +\providecommand{\tdartistright}{} +\providecommand{\tdauthorjustify}{} +\providecommand{\tdauthorcenter}{} +\providecommand{\tdauthorleft}{} +\providecommand{\tdauthorright}{} \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}% @@ -195,17 +230,6 @@ \newcommand*{\KFLT@subgrptype}{} -\newcommand*{\KFLT@subgrplisttype}{} - -\newcommand*{\KFLT@setsubgrpfigure}{% - \renewcommand{\KFLT@subgrptype}{figure}% - \renewcommand{\KFLT@subgrplisttype}{lof}% -} - -\newcommand*{\KFLT@setsubgrptable}{% - \renewcommand{\KFLT@subgrptype}{table}% - \renewcommand{\KFLT@subgrplisttype}{lot}% -} \define@key{KFLT@subgrpkeys}{l}{\renewcommand{\KFLT@subgrpl}{#1}} \newcommand*{\KFLT@subgrpl}{} \newcommand*{\KFLT@subgrptextalign}{} @@ -213,22 +237,18 @@ \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}{} @@ -239,6 +259,15 @@ \define@key{KFLT@subgrpkeys}{as}{\renewcommand{\KFLT@subgrpas}{#1}} \newcommand*{\KFLT@subgrpas}{} +\define@key{KFLT@subgrpkeys}{aup}{\renewcommand{\KFLT@subgrpaup}{#1}} +\newcommand*{\KFLT@subgrpaup}{} +\define@key{KFLT@subgrpkeys}{auf}{\renewcommand{\KFLT@subgrpauf}{#1}} +\newcommand*{\KFLT@subgrpauf}{} +\define@key{KFLT@subgrpkeys}{aul}{\renewcommand{\KFLT@subgrpaul}{#1}} +\newcommand*{\KFLT@subgrpaul}{} +\define@key{KFLT@subgrpkeys}{aus}{\renewcommand{\KFLT@subgrpaus}{#1}} +\newcommand*{\KFLT@subgrpaus}{} + \newlength{\KFLT@imagewidth} @@ -255,8 +284,8 @@ {\setlength{\KFLT@imagewidth}{\KFLT@w}}% {% width not given \ifcsempty{\KFLT@lw}% - {\setlength{\KFLT@imagewidth}{\KFLT@boxwidth}}% - {\setlength{\KFLT@imagewidth}{\KFLT@lw\KFLT@boxwidth}}% + {\setlength{\KFLT@imagewidth}{\KFLT@boxwidth}}% + {\setlength{\KFLT@imagewidth}{\KFLT@lw\KFLT@boxwidth}}% }% width not given } \newcommand{\KFLTtightframe}[1]{% @@ -294,7 +323,7 @@ {}% no frame }% not looseframe } -\NewDocumentCommand{\KFLT@onefigureimage}{} +\NewDocumentCommand{\KFLT@onefigureimage}{m}% {% \begin{lrbox}{\KFLT@envbox}% \ifdefempty{\KFLT@lw}% @@ -305,21 +334,21 @@ {% w and h \includegraphics% [scale=\KFLT@s,% - width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% + width=\KFLT@imagewidth,height=\KFLT@h]{#1}% }% w and h {% only w \includegraphics% - [scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}% + [scale=\KFLT@s,width=\KFLT@imagewidth]{#1}% }% 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}}% + {\includegraphics[scale=\KFLT@s,height=\KFLT@h]{#1}}% + {\includegraphics[scale=\KFLT@s]{#1}}% }% width is not given }% not linewidth {% linewidth given - \includegraphics[scale=\KFLT@s,width=\KFLT@imagewidth]{\KFLT@i}% + \includegraphics[scale=\KFLT@s,width=\KFLT@imagewidth]{#1}% }% \end{lrbox}% \unskip% @@ -330,12 +359,6 @@ \end{turn}% } -\newcommand*{\KFLT@captioniftype}[2]{% - \ifcsstring{KFLT@#2type}{#1}% - {\KFLT@caption{#2}}% - {}% -} - \NewDocumentCommand{\KFLT@dosimplecaption}{m m m} {% \unskip% @@ -345,36 +368,63 @@ } \@ifpackageloaded{tocdata} {% tocdata loaded +\newcommand*{\KFLT@@docaption}[6]{% +\addvspace{\smallskipamount}% +\ifcsempty{KFLT@#6t}{% + \IfBooleanTF{#3}% + {% + \csuse{caption#1}*[#4]{#5}% + []% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }{% + \csuse{caption#1}[#4]{#5}% + []% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }% +}{% + \ifcsstring{KFLT@#6textalign}{}{\csuse{td#1textjustify}}{}% + \ifcsstring{KFLT@#6textalign}{\centering}{\csuse{td#1textcenter}}{}% + \ifcsstring{KFLT@#6textalign}{\raggedleft}{\csuse{td#1textright}}{}% + \ifcsstring{KFLT@#6textalign}{\raggedright}{\csuse{td#1textleft}}{}% + \IfBooleanTF{#3}% + {% + \csuse{caption#1}*[#4]{#5}% + [\csuse{KFLT@#6t}]% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }{% + \csuse{caption#1}[#4]{#5}% + [\csuse{KFLT@#6t}]% + [\csuse{KFLT@#6a#2p}]% + {\csuse{KFLT@#6a#2f}}% + {\csuse{KFLT@#6a#2l}}% + [\csuse{KFLT@#6a#2s}]% + }% +}% +} \NewDocumentCommand{\KFLT@docaption}{s o m m} {% - \ifcsstring{KFLT@#4type}{figure}% - {% figure - \ifcsempty{KFLT@#4al}% - {% figure w/o artist + \ifcsempty{KFLT@#4al}% + {% figure w/o artist + \ifcsempty{KFLT@#4aul}% + {% figure w/o artist or author \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 + }% figure w/o artist or author + {% figure w/ author + \KFLT@@docaption{author}{u}{#1}{#2}{#3}{#4}% + }% figure w/ author + }% figure w/o artist + {% figure with an artist + \KFLT@@docaption{artist}{}{#1}{#2}{#3}{#4}% + }% figure with an artist }% KFLT@tocdata }% tocdata loaded {% no tocdata @@ -382,11 +432,19 @@ {% \KFLT@dosimplecaption{#1}{#2}{#3}% \ifcsempty{KFLT@#4al}% - {}% no artist + {% + \ifcsempty{KFLT@#4aul}% + {}% + {% yes author + \ifcsempty{KFLT@#4auf}% + {\index{\csuse{KFLT@#4aul}}}% + {\index{\csuse{KFLT@#4aul}, \csuse{KFLT@#4auf}}}% + }% yes author + }% no artist {% yes artist \ifcsempty{KFLT@#4af}% - {\index{\csname KFLT@#4al\endcsname}}% - {\index{\csname KFLT@#4al\endcsname, \csname KFLT@#4af\endcsname}}% + {\index{\csuse{KFLT@#4al}}}% + {\index{\csuse{KFLT@#4al}, \csuse{KFLT@#4af}}}% }% yes artist }% KFLT@docaption }% no tocdata @@ -400,24 +458,25 @@ \ifcsempty{KFLT@#1sc}% {}% {% non-empty cstar and sc: - \addcontentsline{\KFLT@listtype}% - {\csname KFLT@#1type\endcsname}{\KFLT@sc}% + \edef\KFLT@listtype{\csuse{KFLT@#1type}}% + \addcontentsline{\csuse{ext@\KFLT@listtype}}% + {\csuse{KFLT@#1type}}{\KFLT@sc}% }% non-empty cstar and sc - \KFLT@docaption*{\csname KFLT@#1c\endcsname}{#1}% + \KFLT@docaption*{\csuse{KFLT@#1c}}{#1}% }% }% starred caption {% unstarred caption \ifcsempty{KFLT@#1sc}% {% no short cap - \KFLT@docaption{\csname KFLT@#1c\endcsname}{#1}% + \KFLT@docaption{\csuse{KFLT@#1c}}{#1}% }% no short cap {% short cap - \KFLT@docaption[\csname KFLT@#1sc\endcsname]% - {\csname KFLT@#1c\endcsname}{#1}% + \KFLT@docaption[\csuse{KFLT@#1sc}]% + {\csuse{KFLT@#1c}}{#1}% }% short cap \ifcsempty{KFLT@#1l}% {}% - {\label{\csname KFLT@#1l\endcsname}}% + {\label{\csuse{KFLT@#1l}}}% }% unstarred caption } @@ -429,16 +488,17 @@ \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@aup}{}% + \renewcommand{\KFLT@auf}{}% + \renewcommand{\KFLT@aul}{}% + \renewcommand{\KFLT@aus}{}% \renewcommand{\KFLT@t}{}% \renewcommand{\KFLT@textalign}{}% - \tdtextjustify% - \renewcommand{\KFLT@i}{}% \renewcommand{\KFLT@lw}{}% \setlength{\KFLT@w}{0pt}% \setlength{\KFLT@h}{0pt}% @@ -462,18 +522,17 @@ \ifnumless{\value{KFLT@thiscol}}{\value{KFLT@numcols}}% {}% thiscol < numcols {% >= - - \addvspace{.75\floatsep} - + \par% + \addvspace{.75\floatsep}% \defcounter{KFLT@thiscol}{0}% }% }% -\newcommand{\KFLT@trackrows} +\newcommand{\KFLT@trackrows}% {% \ifboolexpr{% - test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or + test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or% bool{KFLT@inkeysubfloats}% }% {% nested @@ -491,14 +550,13 @@ {}% no text {% text to add {% local - \unskip% - \addvspace{2ex}% + \addvspace{\smallskipamount}% \begin{minipage}{\linewidth}% - \csname KFLT@#1textalign\endcsname% + \csuse{KFLT@#1textalign}% \footnotesize% \setlength{\parskip}{1.5ex}% \setlength{\parindent}{0em}% - \csname KFLT@#1t\endcsname% + \csuse{KFLT@#1t}% \end{minipage}% \par\addvspace{2ex}% }% local @@ -514,31 +572,44 @@ {% tocdata loaded \newcommand{\KFLT@addartisttext}[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}}% + \ifcsempty{KFLT@#1al}% artist last name + {% + \ifcsempty{KFLT@#1aul}% author last name + {\KFLT@addtext{#1}} + {}% + }% + {}% fig w/ artist: text will be added by \captionartist in \KFLT@caption }% KFLT@addartisttext }% tocdata loaded {% tocdata not loaded + +\newcommand*{\KFLT@@addartisttext}[3]{% + \addvspace{\medskipamount}% + \begin{minipage}{\linewidth}% + #3% + \footnotesize\textsc{% + \KFLT@optionalname{\csuse{KFLT@#1a#2p}}% + \KFLT@optionalname{\csuse{KFLT@#1a#2f}}% + \csuse{KFLT@#1a#2l}% + \csuse{KFLT@#1a#2s}% + }% + \end{minipage}% + \par\addvspace{2ex}% +} + \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 + {% artist last name not given + \ifcsempty{KFLT@#1aul}% + {}% author last name not given + {% author last name given + \KFLT@@addartisttext{#1}{u}{\raggedleft}% + }% author last name given + }% artist last name not given + {% artist last name given + \KFLT@@addartisttext{#1}{}{\centering}% + }% \KFLT@addtext{#1}% }% KFLT@addartisttext }% tocdata not loaded @@ -560,49 +631,56 @@ \endturn% \end{lrbox}% \KFLT@frame{\usebox{\KFLT@envbox}}% - \par\addvspace{2ex}% + \par% }% endkeyboxinner -\NewDocumentCommand{\KFLT@boxkeys}{+m m m} +\NewDocumentCommand{\KFLT@boxkeys}{+m m} {% \KFLT@defaults% \renewcommand{\KFLT@type}{#2}% - \renewcommand{\KFLT@listtype}{#3}% \setkeys{KFLT@keys}{#1}% } +\newcommand*{\KFLT@LWR@hook@boxouter}{}% + +\newenvironment*{KFLT@LWR@hook@boxouter@minipage}[2][] + {\minipage[#1]{#2}} + {\endminipage} + \NewDocumentEnvironment{KFLT@boxouter}{m m} {% boxouter \ifbool{KFLT@inkeysubfloats}% - {\csname sub\KFLT@type\endcsname{\KFLT@rowboxwidth}}% subfloat + {\csuse{sub\KFLT@type}{\KFLT@rowboxwidth}}% subfloat {% not subfloat: \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% {% keyfloats \ifbool{KFLT@keywrap}% - {\minipage[t]{\KFLT@rowboxwidth}}% + {\KFLT@LWR@hook@boxouter@minipage[t]{\KFLT@rowboxwidth}}% {\minipage[\KFLT@va]{\KFLT@rowboxwidth}}% \captionsetup*{type=\KFLT@type}% }% keyfloats {% not keyfloats + \KFLT@LWR@hook@boxouter% \ifbool{KFLT@keywrap}% {% \par\addvspace{\baselineskip}% - \noindent\minipage[t]{\linewidth}% + \noindent% + \KFLT@LWR@hook@boxouter@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}% + \KFLT@findwidths% + \wrapfloat{\KFLT@type}{\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]% + \KFLT@marginfloat[\KFLT@mo]{\KFLT@type}% \captionsetup{type=\KFLT@type}% }% [M] {% not [M} @@ -614,8 +692,8 @@ }% [H] {% not [H] \IfBooleanTF{#1}% - {\csname \KFLT@type*\endcsname[#2]}% - {\csname \KFLT@type\endcsname[#2]}% + {\csuse{\KFLT@type*}[#2]}% + {\csuse{\KFLT@type}[#2]}% }% not [H] }% not [M] }% not [W] @@ -624,34 +702,37 @@ }% not subfloat \ifbool{KFLT@cont}{\ContinuedFloat}{}% \KFLT@findwidths% - \KFLT@captioniftype{table}{}% + \caption@iftop{\KFLT@caption{}}{}% \center\unskip% }% boxouter {% endboxouter \endcenter\unskip% + \addvspace{\smallskipamount}% \KFLT@addartisttext{}% - \KFLT@captioniftype{figure}{}% + \caption@iftop{}{\KFLT@caption{}}% \ifbool{KFLT@inkeysubfloats}% {% - \csname endsub\KFLT@type\endcsname% + \csuse{endsub\KFLT@type}% }% subfloat {% not subfloat \ifnumgreater{\value{KFLT@keyfloatdepth}}{0}% keyfloats? - {\endminipage}% keyfloats + {% + \endminipage% + }% keyfloats {% not keyfloats \ifbool{KFLT@keywrap}{% - \endminipage% + \endKFLT@LWR@hook@boxouter@minipage% \par\addvspace{\baselineskip}% }% {% not keywrap \ifstrequal{#2}{W}% {% [W] - \csname endwrap\KFLT@type\endcsname% + \endwrapfloat% }% [W] {% not[W] \ifstrequal{#2}{M}% {% [M] - \csname endmargin\KFLT@type\endcsname% + \endKFLT@marginfloat% }% [M] {% not [M] \ifstrequal{#2}{H}% @@ -661,8 +742,8 @@ }% {% not [H] \IfBooleanTF{#1}% starred float? - {\csname end\KFLT@type*\endcsname}% - {\csname end\KFLT@type\endcsname}% + {\csuse{end\KFLT@type*}}% + {\csuse{end\KFLT@type}}% }% not [H] }% not [M] }% not [W] @@ -671,16 +752,101 @@ }% not subfloat }% endkeyboxouter +\newcommand*{\KFLT@@ignorespaces}[1]{% + \ifboolexpr{% + test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or% + bool{KFLT@inkeysubfloats}% + }{}{\csuse{#1}}% +} -\NewDocumentEnvironment{keyfigure}{s O{tbp} +m} +\newcommand*{\KFLT@ignorespaces}{% + \KFLT@@ignorespaces{ignorespaces}% +} + +\newcommand*{\KFLT@envignorespaces}{% + \KFLT@@ignorespaces{ignorespacesafterend}% +} + +\NewDocumentCommand{\KFLT@keyflt}{m m m +m +m} {% - \KFLT@boxkeys{#3}{figure}{lof}% + \ifcsdef{l@#3}{}{% + \PackageError{keyfloat}% + {% + \protect\keyflt: Invalid float type.\MessageBreak% + \protect\keyflt*[loc]{type}{keys/values}{contents}\MessageBreak% + Also, \protect\keyflt\space is not an environment + }% + {% + Check argument order and float type. + }% + }% + \KFLT@ignorespaces% + \KFLT@trackrows% + \KFLT@boxkeys{#4}{#3}% + \begingroup% \KFLT@boxouter{#1}{#2}% - \KFLT@boxinner% -}% + #5% + \endKFLT@boxouter% + \endgroup% + \KFLT@ignorespaces% +} + + +\NewDocumentCommand{\keyflt}{s O{tbp} m +m +m} {% + \KFLT@keyflt{#1}{#2}{#3}{#4}{% + \KFLT@boxinner% + \centering% + #5% + \endKFLT@boxinner% + }% +} + +\def\endkeyflt{% + \PackageError{keyfloat} + {% + \protect\end{keyflt}:\MessageBreak + \protect\keyflt\space is a macro, not an environment.\MessageBreak + Perhaps you want the keyfloat environment instead% + } + {% + Use \protect\begin{keyfloat} ... \protect\end{keyfloat}. + } +} + + +\newcommand{\KFLT@keyfloatstart}[4]{% + \KFLT@envignorespaces% + \KFLT@boxkeys{#4}{#3}% + \KFLT@boxouter{#1}{#2}% + \KFLT@boxinner% +} + +\newcommand{\KFLT@keyfloatend}{% \endKFLT@boxinner% \endKFLT@boxouter% + \KFLT@envignorespaces% +} + +\NewDocumentEnvironment{keyfloat}{s O{tbp} m +m} +{% + \KFLT@keyfloatstart{#1}{#2}{#3}{#4}% +}% +{% + \KFLT@keyfloatend% +} + +\BeforeBeginEnvironment{keyfloat}{% + \KFLT@trackrows% +} + + +\NewDocumentEnvironment{keyfigure}{s O{tbp} +m} +{% + \KFLT@keyfloatstart{#1}{#2}{figure}{#3}% +}% +{% + \KFLT@keyfloatend% } \BeforeBeginEnvironment{keyfigure}{% @@ -690,21 +856,17 @@ \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@keyflt{#1}{#2}{figure}{#3}{% + \KFLT@onefigureimage{#4}% + }% } \NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m} {% + \KFLT@ignorespaces% \KFLT@trackrows% - \KFLT@boxkeys{#3}{figure}{lof}% + \KFLT@boxkeys{#3}{figure}% \begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% @@ -712,13 +874,15 @@ \endKFLT@boxinner% \endKFLT@boxouter% \endgroup% + \KFLT@ignorespaces% } \NewDocumentCommand{\keyparbox}{s O{tbp} +m +m} {% + \KFLT@ignorespaces% \KFLT@trackrows% - \KFLT@boxkeys{#3}{figure}{lof}% + \KFLT@boxkeys{#3}{figure}% \renewcommand{\KFLT@c}{}% \setboolean{KFLT@cstar}{true}% \begingroup% @@ -728,34 +892,26 @@ \endKFLT@boxinner% \endKFLT@boxouter% \endgroup% + \KFLT@ignorespaces% } \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% + \IfBooleanTF{#1}{% + \keyflt*[#2]{table}{#3}{#4}% + }{% + \keyflt[#2]{table}{#3}{#4}% + }% } \NewDocumentEnvironment{keytable}{s O{tbp} +m} {% - \KFLT@boxkeys{#3}{table}{lot}% - \KFLT@boxouter{#1}{#2}% - \KFLT@boxinner% - \centering% + \KFLT@keyfloatstart{#1}{#2}{table}{#3}% }% {% - \endKFLT@boxinner% - \endKFLT@boxouter% + \KFLT@keyfloatend% } \BeforeBeginEnvironment{keytable}{% @@ -771,26 +927,35 @@ {% \PackageError{keyfloat}% {% - Cannot nest keysubfigs or keysubtabs.% + Cannot nest keysubfigs or keysubtabs.\MessageBreak% (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.% + The subcaption package do not support nested environments,\MessageBreak + so the keyfloat package cannot place a\MessageBreak + keysubfigs or keysubtabs environment inside another,\MessageBreak + or inside a keyfloats.% }% }% {}% } +\newcommand*{\KFLT@LWR@hook@keyfloats}{}% + +\newenvironment*{KFLT@LWR@hook@keyfloatsminipage}[1] + {\noindent\minipage{#1}} + {\endminipage}% + \NewDocumentEnvironment{keyfloats}{s O{tbp} m} {% + \KFLT@envignorespaces% + \KFLT@LWR@hook@keyfloats% \addtocounter{KFLT@keyfloatdepth}{1}% \ifboolexpr{% test {\ifstrequal{#2}{H}} or test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{1}} or bool {KFLT@inkeysubfloats} or - bool {KFLT@keywrap} + bool {KFLT@keywrap}% }% {% [H] or nested \ifboolexpr{% @@ -798,12 +963,11 @@ bool {KFLT@inkeysubfloats} }% {% - \noindent% - \begin{minipage}{\KFLT@rowboxwidth}% + \KFLT@LWR@hook@keyfloatsminipage{\KFLT@rowboxwidth}% }% {% \bigbreak% - \noindent\begin{minipage}{\linewidth}% + \KFLT@LWR@hook@keyfloatsminipage{\linewidth}% }% \ifbool{KFLT@inkeysubfloats}% {}% @@ -832,30 +996,25 @@ bool {KFLT@keywrap} }% {% was [H], etc. - \end{minipage}% - \ifboolexpr{% + \endKFLT@LWR@hook@keyfloatsminipage% + \ifboolexpr{ test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or bool {KFLT@keywrap} }% - {}{\bigbreak}% + {}{% + \bigbreak% + }% }% was [H], etc. {% not [H], etc. \IfBooleanTF{#1}% starred figure? {\end{figure*}}{\end{figure}}% }% not [H], etc. \addtocounter{KFLT@keyfloatdepth}{-1}% + \KFLT@envignorespaces% } \BeforeBeginEnvironment{keyfloats}{% - \ifboolexpr{% - test {\ifnumgreater{\value{KFLT@keyfloatdepth}}{0}} or - bool {KFLT@inkeysubfloats} - }% - {\KFLT@maybestartfloatrow}% - {}% - \ifnumgreater{\value{KFLT@thiscol}}{1}% - {\hfill}% - {}% + \KFLT@trackrows% } @@ -865,19 +1024,23 @@ \setboolean{KFLT@subgrpcstar}{false}% \renewcommand{\KFLT@subgrpsc}{}% \setboolean{KFLT@subgrpscgiven}{false}% - \KFLT@setsubgrpfigure% + \renewcommand{\KFLT@subgrptype}{figure}% \renewcommand{\KFLT@subgrpl}{}% \renewcommand{\KFLT@subgrpap}{}% \renewcommand{\KFLT@subgrpaf}{}% \renewcommand{\KFLT@subgrpal}{}% \renewcommand{\KFLT@subgrpas}{}% + \renewcommand{\KFLT@subgrpaup}{}% + \renewcommand{\KFLT@subgrpauf}{}% + \renewcommand{\KFLT@subgrpaul}{}% + \renewcommand{\KFLT@subgrpaus}{}% \renewcommand{\KFLT@subgrpt}{}% \renewcommand{\KFLT@subgrptextalign}{}% - \tdtextjustify% } \NewDocumentCommand{\KFLT@subfloats}{m m m +m} {% + \KFLT@envignorespaces% \setkeys{KFLT@subgrpkeys}{#4}% \setboolean{KFLT@inkeysubfloats}{true}% \IfBooleanTF{#1}% @@ -900,7 +1063,7 @@ {\ContinuedFloat}% {}% \center\unskip% - \KFLT@captioniftype{table}{subgrp}% + \caption@iftop{\KFLT@caption{subgrp}}{}% \defcounter{KFLT@numcols}{#3}% \defcounter{KFLT@thiscol}{0}% \begingroup% @@ -908,10 +1071,11 @@ \newcommand*{\KFLT@endsubfloats}[2]{% \endgroup% - \unskip\endcenter% + \unskip% + \endcenter% \par\addvspace{\bigskipamount}% \KFLT@addartisttext{subgrp}% - \KFLT@captioniftype{figure}{subgrp}% + \caption@iftop{}{\KFLT@caption{subgrp}}% \ifboolexpr{% test {\ifstrequal{#2}{H}} or bool{KFLT@keywrap} @@ -923,33 +1087,49 @@ {\end{\KFLT@subgrptype}}% }% not [H] \setboolean{KFLT@inkeysubfloats}{false}% + \KFLT@envignorespaces% } -\NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m} +\newcommand*{\KFLT@LWR@hook@keysubfloats}{} + +\NewDocumentEnvironment{KFLT@keysubfloats}{m m m m +m} {% \KFLT@nonest% + \KFLT@LWR@hook@keysubfloats% \KFLT@subgrpdefaults% - \KFLT@subfloats{#1}{#2}{#3}{#4}% + \renewcommand{\KFLT@subgrptype}{#3}% + \KFLT@subfloats{#1}{#2}{#4}{#5}% }% the start of the environment {% \KFLT@endsubfloats{#1}{#2}% } -\NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m} +\NewDocumentEnvironment{keysubfloats}{s O{tbp} m m +m} {% - \KFLT@nonest% - \KFLT@subgrpdefaults% - \KFLT@setsubgrptable% - \KFLT@subfloats{#1}{#2}{#3}{#4}% -}% the start of the environment + \KFLT@keysubfloats{#1}{#2}{#3}{#4}{#5}% +}{% + \endKFLT@keysubfloats% +} + +\NewDocumentEnvironment{keysubfigs}{s O{tbp} m +m} {% - \KFLT@endsubfloats{#1}{#2}% + \KFLT@keysubfloats{#1}{#2}{figure}{#3}{#4}% +}{% + \endKFLT@keysubfloats% +} + +\NewDocumentEnvironment{keysubtabs}{s O{tbp} m +m} +{% + \KFLT@keysubfloats{#1}{#2}{table}{#3}{#4}% +}{% + \endKFLT@keysubfloats% } \newsavebox{\KFLT@marginfloatbox} \NewDocumentEnvironment{KFLT@marginfloat}{O{-1.2ex} m} {% start \FloatBarrier% keep floats in order + \KFLT@envignorespaces% \begin{lrbox}{\KFLT@marginfloatbox}% \begin{minipage}{\marginparwidth}% \captionsetup{type=#2}% @@ -960,6 +1140,7 @@ \end{minipage}% \end{lrbox}% \marginpar{\usebox{\KFLT@marginfloatbox}}% + \KFLT@envignorespaces% }% end \ProvideDocumentEnvironment{marginfigure}{O{-1.2ex}} {\begin{KFLT@marginfloat}[#1]{figure}} |