diff options
author | Karl Berry <karl@freefriends.org> | 2016-12-09 22:52:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-12-09 22:52:39 +0000 |
commit | 275ad8a0bdbe28776c421f0387b3e7de14abb488 (patch) | |
tree | 4c6e840c350916088f72a31108e1ac9307dc6597 /Master/texmf-dist/source | |
parent | 30ed8d918cbb70e45a28309fba2e067c46d6c5d5 (diff) |
keyfloat (9dec16)
git-svn-id: svn://tug.org/texlive/trunk@42662 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx | 811 |
1 files changed, 554 insertions, 257 deletions
diff --git a/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx b/Master/texmf-dist/source/latex/keyfloat/keyfloat.dtx index 117db6fc025..a9455f2ca39 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> [2016/12/02 v0.11 Key/value interface for floats and the subcaption package.] +%<package> [2016/12/09 v0.12 Key/value interface for floats and the subcaption package.] % %<*driver> \documentclass{ltxdoc} @@ -25,7 +25,6 @@ \newcommand*{\mypackagename}{keyfloat} \newcommand{\quicksummary}{Provides a key/value interface for generating floats.} -\usepackage{fourier}% for the \danger symbol \usepackage{lmodern} % \usepackage{libertine} @@ -33,6 +32,19 @@ \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides \degree, \textquotesingle, \textmu + +\newcommand*{\TakeFourierOrnament}[1]{{% +\fontencoding{U}\fontfamily{futs}\selectfont\char#1}} + +\newcommand*{\textwarning}{\TakeFourierOrnament{66}} + +% copy/paste special unicode symbols: +\input{glyphtounicode} +\pdfglyphtounicode{prime}{2032}% hex +\pdfglyphtounicode{diameter}{2300}% diameter +\pdfglyphtounicode{warningsign}{26A0}% warning sign +\pdfgentounicode=1 + \usepackage{newunicodechar} \newunicodechar{ff}{ff} \newunicodechar{fi}{fi} @@ -53,6 +65,7 @@ % \newunicodechar{¶}{\P} % \newunicodechar{†}{\dag} \newunicodechar{‡}{\ddag} +\newunicodechar{⚠}{\textwarning} \usepackage{microtype} @@ -90,7 +103,7 @@ name=Example, placement=hbp ]{example} -\captionsetup[example]{ +\captionsetup*[example]{ format=hang, font=bf, justification=raggedright, @@ -99,30 +112,53 @@ skip=0pt, position=top, } -\captionsetup[figure]{ +\captionsetup{labelfont={small,bf},textfont={small,bf}} + +\captionsetup*[figure]{ style=default, justification=centering, margin=0pt, parskip=0pt, skip=2ex, labelfont={small,bf},textfont={small,bf} } -\captionsetup[table]{ +\captionsetup*[table]{ style=default, justification=centering, margin=0pt, parskip=0pt, skip=1ex, labelfont={small,bf},textfont={small,bf} } -\captionsetup[subfigure]{ +\captionsetup*[subfigure]{ style=default, justification=centering, margin=0pt, parskip=0pt, skip=2ex, labelfont={small},textfont={small} } -\captionsetup[subtable]{ +\captionsetup*[subtable]{ style=default, justification=centering, margin=0pt, parskip=0pt, skip=1ex, labelfont={small},textfont={small} } +\captionsetup*[example]{ + format=plain, justification=justified, + margin=0pt, parskip=0pt, skip=0ex, + labelfont={bf},textfont={bf} +} + +\captionsetup*[wrapfigure]{ + style=default, justification=centering, + margin=0pt, parskip=0pt, skip=2ex, + labelfont={small,bf},textfont={small,bf} +} + +\captionsetup*[wraptable]{ + style=default, justification=centering, + margin=0pt, parskip=0pt, skip=1ex, + labelfont={small,bf},textfont={small,bf} +} + + + +\usepackage{lipsum} @@ -182,24 +218,9 @@ frametitlerulewidth=1pt,frametitleaboveskip=5pt,% \pagestyle{pageheadfoot} +\usepackage{dtxdescribe} -\usepackage[pdftex,bookmarks=true,hidelinks,% -colorlinks,linkcolor=mylinkcolor,urlcolor=myurlcolor,% -pageanchor=true,hyperindex=false, -]{hyperref} - -\hypersetup{% -pdfinfo={% -Title={The LaTeX \mypackagename\ package},% -Author={Brian Dunn},% -Subject={A key/value interface for LaTeX floats.},% -Keywords={LaTeX, floats, key/val, subcaption, rows}% -}} - - -\usepackage{cleveref} - \newcommand*{\lmacro}[1]{\textbackslash#1} \newcommand*{\cmds}[1]{\texttt{#1}} \newcommand*{\env}[1]{\texttt{#1}} @@ -208,105 +229,6 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% -% \begin{newexample}[cross-reference commands / notes]{caption} -% code listing to be typeset and then executed -% \end{example} -% -% Using a minipage to keep the results on one page, -% reads the code listing as a verbatim input using -% the fancybox package, then displays the code listing -% as a verbatim output, and also executes the code -% and displays the result immediatly -% after the environment, followed by a closing \cs{hrule}. -% A title caption is specified, -% along with optional cross-referencing commands to -% refer to the resulting float if there is one. - -\definecolor{examplerulecolor}{rgb}{.9,.9,.9} - -\NewDocumentEnvironment{newexample}{+O{} m} -{% -% Copy the environment's contents to the file kf_cut.tex: -\VerbatimOut[gobble=2,tabsize=4]{kf_cut.tex}} -{\endVerbatimOut -% Typeset the example: -\addvspace{2ex} -\minipage{\linewidth} -\captionsetup{type=example}% -\bigskip\hrule\medskip -\caption{#2} -\textcolor{examplerulecolor}{\smallskip\hrule} -% Typeset the contents as verbatim: -\VerbatimInput[tabsize=4]{kf_cut.tex} -\unskip -\ifstrempty{#1} -{} -{{\textcolor{examplerulecolor}{\hrule}\medskip\itshape\small #1}} -\par\smallskip\hrule height .8pt\medskip -\endminipage -} - -% Outside of the environment's scope, input the example to generate its output -% and labels: -\AfterEndEnvironment{newexample} -{\par\unskip\input{kf_cut.tex}% -} - - - - - -% Indexing improvements: -\makeatletter - -\newcommand*{\Desc@Type}[1]{\raggedleft{\scriptsize#1}\quad} - -% \Describe@Usage{name}{margin tag}{index tag} -\newcommand*{\Describe@Usage}[3]{% -% \@bsphack% -\leavevmode\marginpar{\Desc@Type{#2}\texttt{#1}}% -\index{#1\actualchar{\protect\ttfamily#1} (#3)\encapchar usage}% -\index{#3s:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar usage}% -% \@esphack% -\ignorespaces% -} - -% \Describe@CmdUsage{name}{margin tag}{index tag} -% where name is a \macro -\newcommand*{\Describe@CmdUsage}[3]{% -% \@bsphack% -\leavevmode\marginpar{\Desc@Type{#2}\cmd{#1}}% -\SpecialIndex@{#1}{ (#3)\encapchar usage}% -\index{#3s:\levelchar\cmd{#1}\encapchar usage}\ignorespaces% -% \@esphack% -\ignorespaces% -} - -\newcommand*{\DescribeCommand}[1]{\Describe@Usage{#1}{Cmd}{command}} -\newcommand*{\DescribeFile}[1]{\Describe@Usage{#1}{File}{file}} -\newcommand*{\DescribePackage}[1]{\Describe@Usage{#1}{Pkg}{package}} -\newcommand*{\DescribeOption}[1]{\Describe@Usage{#1}{Opt}{option}} -\newcommand*{\DescribeArgument}[1]{\Describe@Usage{#1}{Arg}{argument}} -\newcommand*{\DescribeBoolean}[1]{\Describe@Usage{#1}{Bool}{boolean}} -\newcommand*{\DescribeLength}[1]{\Describe@CmdUsage{#1}{Len}{length}} -\newcommand*{\DescribeCounter}[1]{\Describe@Usage{#1}{Ctr}{counter}} -\newcommand*{\DescribeSimple}[1]{\leavevmode\marginpar{\raggedleft\texttt{#1}}\index{#1=\texttt{#1}}\ignorespaces} -\renewcommand{\PrintEnvName}[1]{\strut \MacroFont {\scriptsize{}Env\quad}#1\ } -\renewcommand{\PrintDescribeEnv}[1]{\strut \MacroFont {\scriptsize{}Env\quad}#1\ } - -\newcommand*{\DescribeKey}[1]{% -\Describe@Usage{#1}{Key}{key}% -} - - -\newcommand{\margintag}[1]{% -\marginpar{\raggedleft\textcolor{blue!70!black}{#1}}% -\ignorespaces% -} - -\makeatother - - % \newcommand*{\tikz}{Ti\textit{k}z} \newcommand*{\htmlfive}{\acro{HTML}\oldstylenums{5}} \newcommand*{\cssthree}{\acro{CSS}\oldstylenums{3}} @@ -318,20 +240,12 @@ Keywords={LaTeX, floats, key/val, subcaption, rows}% \hfill\minipage{.9\linewidth}\raggedright#1\smallskip\hrule\medskip} {\smallskip\hrule\endminipage\hspace*{\fill}\par\addvspace{1.5ex}} -\makeatletter -\newcommand{\watchout}[1][]{% -\@bsphack% -\marginpar{\hspace*{\fill}%\includegraphics[height=3ex]{symbol_warning.pdf} -\textcolor{DarkRed}{\large\danger\normalsize\quad#1}}% -\@esphack% -} -\makeatother % \setlength{\marginparsep}{1em} -% \setlength{\marginparpush}{.7ex} +\setlength{\marginparpush}{2.5ex} \setlength{\parindent}{0em} \setlength{\parskip}{2ex} \setlength{\IndexMin}{40ex} @@ -364,9 +278,27 @@ D & E & F \\ \setlength{\dblfloatsep}{5ex plus 1ex minus 1ex} - \usepackage{\mypackagename} + +\usepackage[pdftex,bookmarks=true,hidelinks,% +colorlinks,linkcolor=mylinkcolor,urlcolor=myurlcolor,% +pageanchor=true,hyperindex=true, +]{hyperref} + +\hypersetup{% +pdfinfo={% +Title={The LaTeX \mypackagename\ package},% +Author={Brian Dunn},% +Subject={A key/value interface for LaTeX floats.},% +Keywords={LaTeX, floats, key/val, subcaption, rows}% +}} + + +\usepackage{cleveref} + + + \setcounter{IndexColumns}{2} \DisableCrossrefs @@ -384,7 +316,7 @@ D & E & F \\ %<*package> % \fi % -% \CheckSum{0} +% \CheckSum{1013} % % \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 @@ -404,6 +336,10 @@ D & E & F \\ % \changes{v0.10}{2016/12/01}{\ 2016/12/01 Initial ver.} % \changes{v0.11}{2016/12/02}{\ 2016/12/02} +% \changes{v0.12}{2016/12/09}{\ 2016/12/09} +% \changes{v0.12}{2016/12/02}{Docs: Loading keyfloat.} +% \changes{v0.12}{2016/12/05}{Docs: Improved index.} + @@ -448,11 +384,13 @@ D & E & F \\ % % \vfill % +% % \begin{abstract} % \noindent % The \pkg{keyfloat} package provides a key/value user interface for quickly % creating figures with a single image each, figures with arbitrary contents, -% tables, subfloats, rows of floats, and floats [H]. +% tables, subfloats, rows of floats, floats located [H]ere, +% floats in the [M]argin, and floats with text [W]rapped around them. % % Key/value combinations may specify a caption and label, a width proportional % to \cs{linewidth}, a fixed width and/or height, rotation, scaling, a @@ -567,6 +505,11 @@ D & E & F \\ % \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[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 into the margin. % \end{description} % % Additional features include: @@ -577,7 +520,8 @@ D & E & F \\ % or \env{keysubtabs} environment. % \item The number of columns is specified, and extra % floats are placed onto additional rows. -% \item Floats may be placed [H]ere +% \item Floats may be placed [H]ere. +% \item Floats may be placed in the [M]argin. % \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. @@ -615,6 +559,23 @@ D & E & F \\ % % \section{Using the \pkg{keyfloat} Package} % +% \subsection{Loading \pkg{keyfloat}} +% +% \pkg{keyfloat} is loaded with the usual command: +% \begin{verbatim} +% \usepackage{keyfloat} +% \end{verbatim} +% +% If you wish to have artist's names appear in the table of contents, +% as provided by the \pkg{tocdata} package, +% load either \pkg{tocloft} or \pkg{titletoc}, +% followed by \pkg{tocdata}, then \pkg{keyfloat}: +% \begin{verbatim} +% \usepackage{titletoc}% or titletoc +% \usepackage{tocdata} +% \usepackage{keyfloat} +% \end{verbatim} +% % % \subsection{Macros and Environments} % @@ -657,31 +618,59 @@ D & E & F \\ % See \cref{ex:keyfloats}. % % \DescribeEnv{keysubfigs} * \oarg{loc} \marg{numcols} \marg{keys} \\ +% A group of subfigures typeset in rows. +% May not be nested. +% See \cref{ex:keysubfigs}. +% % \DescribeEnv{keysubtabs} * \oarg{loc} \marg{numcols} \marg{keys} \\ -% A group of subfigures or subtables typeset in rows. +% A group of subtables typeset in rows. % May not be nested. % See \cref{ex:keysubfigs}. % +% \DescribeEnv{marginfigure} \oarg{offset} \\ +% A figure placed into the margin, with an optional vertical offset. +% \cs{keyfloat} uses the version provided by the |tufte-book| class if available, +% or provides its own version otherwise. +% See \cref{ex:marginfigure}. +% +% \DescribeEnv{margintable} \oarg{offset} \\ +% A table placed into the margin, with an optional vertical offset. +% \cs{keyfloat} uses the version provided by the |tufte-book| class if available, +% or provides its own version otherwise. +% See \cref{ex:margintable}. +% % \bigskip\hrule % -% The star option create floats which span both columns in a two-column % \DescribeArgument{*} +% The star option create floats which span both columns in a two-column % document. % -% The [H] location may be used to force a figure to be ``Here'', in the % \DescribeArgument{{[H]}} -% form of a minipage instead of a float. A caption and label may +% The |[H]| location forces a figure to be ``Here'', in the +% form of a minipage instead of a float. A caption, label, etc.\ may % still be assigned. % -% The star and [loc] options are ignored for floats inside a \env{keyfloats}, +% \DescribeArgument{{[M]}} +% The |[M]| location places the float into the margin. When the |tufte-book| class +% is used, its \env{marginfigure} and \env{margintable} environments are used, +% otherwise \pkg{keyfloat} provides and uses its own versions of the same environments. +% See \cref{ex:keyfigm,ex:keytablem}. +% +% \DescribeArgument{{[W]}}\DescribePackage{wrapfig} +% The |[W]| location wraps text around the float. Use this just before the start of +% 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. +% % \DescribeArgument{{[loc]}} +% The star and [loc] options are ignored for floats inside a \env{keyfloats}, % \env{keysubfigs}, or \env{keysubtabs} environment. Note that these % container environments may have their own star and [loc] options. % % % % -% +% \clearpage % % \subsection{Keys and Values} % @@ -755,6 +744,11 @@ D & E & F \\ % ft & Selects a tight frame with no \cs{fboxsep}. Useful for photographs, % or diagrams which already have some margin built in. & ft \\ % stretch & Sets \cs{arraystretch} inside the float. & stretch=1.5 \\ +% mo & Sets the vertical offset for a margin float. & mo=-1.2ex \\ +% wp & Sets the wrap placement for a wrapped float. The default +% is |O|, which places the wrapped float at the outside edge of the text. +% See \cref{tab:wrapplacement}. +% & wp=I \\ % \bottomrule % \end{tabular} % \begin{tablenotes} @@ -821,6 +815,30 @@ D & E & F \\ % \end{keytable} % % +% \Cref{tab:wrapplacement} shows the wrapped-float placement +% \margintag{wrapped float placement} +% options for the |wp| key +% for floats placed |[W]|. +% +% \begin{keytable}{c=Wrapped-Float Placement Options,l=tab:wrapplacement} +% \index{float>wrapped placement}\index{wrapped float placement} +% \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 \\ +% i & I & to the inside margin \\ +% o & O & to the outside margin \\ +% \bottomrule +% \end{tabular} +% +% \raggedright\small +% The un-capitalized key attempts to place the float ``here'', and +% the capitalized key allows \LaTeX\ to try to find the best location. +% The default is |O|. +% \end{keytable} + % % % @@ -832,9 +850,9 @@ D & E & F \\ % \subsubsection{Single Floats} % % -% \begin{newexample}[\Cref{fig:simple}]{Figure with an image from a file} +% \begin{dtxexample}[\Cref{fig:simple}]{Figure with an image from a file} % \keyfig{c=A \cs{keyfig} with an image,l=fig:simple}{image} -% \end{newexample} +% \end{dtxexample} % % This float (\cref{fig:simple}) is shown at its natural size % \margintag{natural size} @@ -843,10 +861,10 @@ D & E & F \\ % \index{image>natural size} % % -% \begin{newexample}[\Cref{fig:figbox}]{Figure with arbitrary contents\label{ex:keyfigbox}} +% \begin{dtxexample}[\Cref{fig:figbox}]{Figure with arbitrary contents\label{ex:keyfigbox}} % \keyfigbox{f,c={A \cs{keyfigbox}},l=fig:figbox} % {Some text. More text. \par Another paragraph.} -% \end{newexample} +% \end{dtxexample} % % The \cs{keyfigbox} creates a figure with a box of arbitrary contents, instead of % an image from a file. Its default width is the full \cs{linewidth},\margintag{default width} @@ -854,7 +872,7 @@ D & E & F \\ % unless |w| or |lw| keys are used. % % -% \begin{newexample}[\Cref{fig:environment}] +% \begin{dtxexample}[\Cref{fig:environment}] % {Figure environment with arbitrary contents\label{ex:keyfigure}} % \begin{keyfigure}{f,c={A \env{keyfigure} environment}, % l=fig:environment} @@ -862,14 +880,14 @@ D & E & F \\ % % Including multiple paragraphs. % \end{keyfigure} -% \end{newexample} +% \end{dtxexample} % % The \env{keyfigure} environment is preferred over the \cs{keyfigbox} macro when % multiple lines of contents are to be included. % -% \begin{newexample}[\Cref{tab:simpletable}]{Table macro} +% \begin{dtxexample}[\Cref{tab:simpletable}]{Table macro} % \keytab{c=A \cs{keytab} table,l=tab:simpletable}{\testtable} -% \end{newexample} +% \end{dtxexample} % % Do not try to use tables which overflow the page. % @@ -881,22 +899,22 @@ D & E & F \\ % \index{troubleshooting>large tables} % % -% \begin{newexample}[\Cref{tab:environment}] +% \begin{dtxexample}[\Cref{tab:environment}] % {Table environment with arbitrary contents\label{ex:keytable}} % \begin{keytable}{f,c={A \env{keytable} environment}, % l=tab:environment} -% Arbitrary contents may go here. +% Arbitrary contents may go here.\footnote{A footnote.} % % \testtable % \end{keytable} -% \end{newexample} +% \end{dtxexample} % % The \env{keytable} environment is preferred over the \cs{keytab} macro % since most tables are multi-line creations. % % \clearpage % -% \begin{newexample}[\Cref{fig:options}]{Figure with many options selected} +% \begin{dtxexample}[\Cref{fig:options}]{Figure with many options selected} % \keyfig{ % w=2in,ft,r=15, % c=A figure with many options, @@ -908,7 +926,7 @@ D & E & F \\ % instead of \texttt{t}}, % l=fig:options % }{image} -% \end{newexample} +% \end{dtxexample} % % Width is fixed at 2\,in, a tight frame is specified (\cs{fboxsep} of 0\,pt), % a short caption appears in the List of Figures, and the additional text @@ -919,9 +937,9 @@ D & E & F \\ % % \clearpage % -% \begin{newexample}[\Cref{fig:linewidth}]{Using \cs{linewidth}} +% \begin{dtxexample}[\Cref{fig:linewidth}]{Using \cs{linewidth}} % \keyfig{lw=.5,c=Half of \cs{linewidth},l=fig:linewidth}{image} -% \end{newexample} +% \end{dtxexample} % % \Cref{fig:linewidth} is half of \cs{linewidth} in size. % \margintag{\cs{linewidth}} @@ -938,7 +956,7 @@ D & E & F \\ % % \clearpage % -% \begin{newexample}[\Cref% +% \begin{dtxexample}[\Cref% % {fig:looseframe,fig:tightframe,tab:looseframe,tab:tightframe}% % ]{Using frames} % \begin{keyfloats}[hbp]{4} @@ -947,7 +965,7 @@ D & E & F \\ % \keytab{f,c=Loosely-framed table,l=tab:looseframe}{\testtable} % \keytab{ft,c=Tightly-framed table,l=tab:tightframe}{\testtable} % \end{keyfloats} -% \end{newexample} +% \end{dtxexample} % % The |f| key adds a loose frame with the current \cs{fboxsep}. % This is desirable in most cases. @@ -964,12 +982,12 @@ D & E & F \\ % % \clearpage % -% \begin{newexample}[\Cref{tab:rotated}]{Using rotation with boxes} +% \begin{dtxexample}[\Cref{tab:rotated}]{Using rotation with boxes} % \keytab{f,w=.8in,c={Table, rotated}, % r=70,l=tab:rotated, % tc=(Framed to show box width.)} % {\testwidetable} -% \end{newexample} +% \end{dtxexample} % % Unless a width is given, a box is the full \cs{linewidth}. % \margintag{rotated whitespace} @@ -986,9 +1004,9 @@ D & E & F \\ % \margintag{frame rotation}\index{frame>rotation} % \index{troubleshooting>rotating>frame} % -% \begin{newexample}[\Cref{fig:here}]{Located [H]ere} +% \begin{dtxexample}[\Cref{fig:here}]{Located [H]ere} % \keytab[H]{c={A table [H]},l=fig:here}{\testtable} -% \end{newexample} +% \end{dtxexample} % % \Cref{fig:here} is to be placed ``[H]ere'', and therefore may appear % \watchout[Out of sequence] @@ -998,9 +1016,9 @@ D & E & F \\ % % % -% \begin{newexample}[See fig: ``A starred caption''.]{Unnumbered float} +% \begin{dtxexample}[See fig: ``A starred caption''.]{Unnumbered float} % \keyfig[H]{f,cstar={A starred caption}}{image} -% \end{newexample} +% \end{dtxexample} % % A starred caption creates a float without a number, and without % an entry in the List of Figures unless there is a non-empty short caption. @@ -1011,26 +1029,26 @@ D & E & F \\ % \index{troubleshooting>missing label} % % -% \begin{newexample} +% \begin{dtxexample} % [See fig: ``Starred caption with a short caption''.] % {Unnumbered float with a \acro{LOF} entry} % \keyfig{ % f,cstar={Starred caption with a short caption.}, % sc={Starred short caption} % }{image} -% \end{newexample} +% \end{dtxexample} % % A starred caption with a non-empty short caption creates an % unnumbered entry in the List of Figures. % % -% \begin{newexample} +% \begin{dtxexample} % [See fig: ``Optional text which is not a caption.''] % {An unnumbered in-text image} % \keyfig[H]{f,cstar={}, % tc={Optional text which is not a caption.} % }{image2} -% \end{newexample} +% \end{dtxexample} % % By using [H] and |cstar={}|, the image is placed inline % without a number or \acro{LOF} entry. @@ -1038,7 +1056,7 @@ D & E & F \\ % Also see \cref{ex:keyparbox}. % % -% \begin{newexample}[\Cref{fig:nexttoparbox}, and the box to its left.] +% \begin{dtxexample}[\Cref{fig:nexttoparbox}, and the box to its left.] % {A box without a caption.\label{ex:keyparbox}} % \begin{keyfloats}{2} % \keyparbox{ @@ -1048,7 +1066,7 @@ D & E & F \\ % \keyfig{c=Next to a \cs{keyparbox},l=fig:nexttoparbox}{image} % \end{keyfloats} % \keyparbox[H]{f,lw=.5}{A \cs{keyparbox} [H], outside the floatrow.} -% \end{newexample} +% \end{dtxexample} % % A \cs{keyparbox} is a \cs{keyfigbox} with |cstar={}|, % and is mostly useful as an information box inside a row or a set of subfloats. @@ -1060,7 +1078,7 @@ D & E & F \\ % % \subsubsection{Groups of Floats} % -% \begin{newexample}[\Cref{fig:firstinrow} to \Cref{tab:seventhinrow}]{Groups of figures — \env{keyfloats} environment\label{ex:keyfloats}} +% \begin{dtxexample}[\Cref{fig:firstinrow} to \Cref{tab:seventhinrow}]{Groups of figures — \env{keyfloats} environment\label{ex:keyfloats}} % \begin{keyfloats}{2} % \keyfig{lw=1,f,c={First in a group}, % l=fig:firstinrow,tl={\cs{raggedright} text} @@ -1077,7 +1095,7 @@ D & E & F \\ % \end{keyfloats} % \keytab{c={Seventh in a group},l=tab:seventhinrow}{\testwidetable} % \end{keyfloats} -% \end{newexample} +% \end{dtxexample} % % % \Cref{fig:firstinrow} to \cref{tab:seventhinrow} are in a \env{keyfloats} environment. @@ -1116,7 +1134,7 @@ D & E & F \\ % % % -% \begin{newexample}[\Cref{fig:subfigs}]{Subfigures — \env{keysubfigs} environment\label{ex:keysubfigs}} +% \begin{dtxexample}[\Cref{fig:subfigs}]{Subfigures — \env{keysubfigs} environment\label{ex:keysubfigs}} % \begin{keysubfigs}{3}{c=Subfigures,l=fig:subfigs} % \keyfig{lw=1,f,c={First Subfigure}, % l=fig:firstsubfig,t=Some Text}{image} @@ -1130,7 +1148,7 @@ D & E & F \\ % \keyfig{lw=.5,f,c={Fifth subfigure},l=fig:fifthsubfig}{image} % \end{keyfloats} % \end{keysubfigs} -% \end{newexample} +% \end{dtxexample} % % \Crefrange{fig:firstsubfig}{fig:fifthsubfig} are in % the \cref{fig:subfigs} \env{keysubfigs} environment. @@ -1181,12 +1199,12 @@ D & E & F \\ % The label may be placed in a continued float, and will still % receive the same float number as the prior non-continued float. % -% \begin{newexample}[\Cref{fig:firstcontinued}]{Continued figure} +% \begin{dtxexample}[\Cref{fig:firstcontinued}]{Continued figure} % \begin{keyfloats}{2} % \keyfig{,c=Figure to be continued}{image} % \keyfig{c={\dots continued},cont,l=fig:firstcontinued}{image2} % \end{keyfloats} -% \end{newexample} +% \end{dtxexample} % % % \clearpage @@ -1197,7 +1215,7 @@ D & E & F \\ % The containing environment's float receives the same number as the previous float % (presumably another subfloat container). % -% \begin{newexample}[\Cref{fig:continuedfigures}]{Continued subfloats} +% \begin{dtxexample}[\Cref{fig:continuedfigures}]{Continued subfloats} % \begin{keysubfigs}{2}{c={A set of figures},l=fig:continuedfigures} % \keyfig{c={First of a set},l=fig:contfirst}{image} % \keyfig{c={Second of a set},l=fig:contsecond}{image} @@ -1206,7 +1224,116 @@ D & E & F \\ % \keyfig{c={Third of a set},l=fig:contthird}{image2} % \keyfig{c={Fourth of a set},l=fig:contfourth}{image2} % \end{keysubfigs} -% \end{newexample} +% \end{dtxexample} +% +% +% \clearpage +% \subsubsection{Margin Floats} +% \changes{v0.12}{2016/12/02}{Docs: Margin float examples.} +% +% When a keyfloat is located [M], it will be placed in the margin. +% +% \DescribeClass{tufte-book} +% When the |tufte-book| class is used, its \env{marginfigure} or \env{margintable} +% environments will be used, otherwise \pkg{keyfloat} provides environments +% of the same name and uses those instead. +% +% \begin{dtxexample}[\Cref{fig:marginfigure}]{The \env{marginfigure} environment\label{ex:marginfigure}} +% \begin{marginfigure} +% \centering +% \includegraphics[width=.75\linewidth]{image} +% +% Some text added by hand. +% \caption{A \env{marginfigure}} +% \label{fig:marginfigure} +% \end{marginfigure} +% \end{dtxexample} +% +% +% \begin{dtxexample}[\Cref{fig:margintable}]{The \env{margintable} environment\label{ex:margintable}} +% \begin{margintable} +% \centering +% \testwidetable +% \caption{A \env{margintable}} +% \label{fig:margintable} +% \end{margintable} +% \end{dtxexample} +% +% +% \begin{dtxexample}[\Cref{fig:keyfigm}]{Using \cs{keyfig}\texttt{[M]}\label{ex:keyfigm}} +% \keyfig[M]{c={A \cs{keyfig}\texttt{[M]}},l=fig:keyfigm,ft, +% t=Additional text. +% Text text text text text text. +% +% More paragraphs. +% }{image2} +% \end{dtxexample} +% +% +% \begin{dtxexample}[\Cref{tab:keytablem}] +% {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} +% \testwidetable +% \end{keytable} +% \end{dtxexample} +% +% A negative offset was used to shift the table upwards +% \margintag{margin float offset} +% to the top of the example. +% +% To set the minimum-allowed distance between \cs{marginpar}s and margin floats: +% \margintag{distance between floats} +% \index{distance between floats}\index{float>distance between} +% \begin{verbatim} +% \setlength{\marginparpush}{3ex} +% \end{verbatim} +% +% +% +% \clearpage +% \subsubsection{Wrapped Floats} +% \changes{v0.12}{2016/12/03}{Docs: Wrapped float examples.} +% +% \begin{dtxexample}[\Cref{fig:keyfigw,tab:keytabw}] +% {Using \cs{keyfig}\texttt{[W]} and \cs{keytab}\texttt{[W]}\label{ex:keyfigw}} +% \keyfig[W]{c={A \cs{keyfig}\texttt{[W]}}, +% l=fig:keyfigw,ft,lw=.4,wp=I, +% t={.4\cs{linewidth} wide, placed \texttt{I}.} +% }{image2} +% \lipsum[1] +% \keytab[W]{c={A \cs{keytab}\texttt{[W]}},l=tab:keytabw,w=.75in, +% }{\testtable} +% \lipsum[2] +% \end{dtxexample} +% +% \begin{dtxexample}[\Cref{fig:keyfigboxw} and the \cs{keyparbox}.] +% {Using \cs{keyfigbox}\texttt{[W]} and \cs{keyparbox}\texttt{[W]}\label{ex:keyfigboxw}} +% \keyfigbox[W]{c={A \cs{keyfigbox}\texttt{[W]}}, +% l=fig:keyfigboxw,f,lw=.25,wp=I, +% t=Text text text text text text text text text +% }{The contents.} +% \lipsum[1] +% \keyparbox[W]{w=.75in}{\centering A \cs{keyparbox.}} +% \lipsum[2] +% \end{dtxexample} +% +% +% \begin{dtxexample}[\Cref{fig:keyfigurew,tab:keytablew}] +% {Using \cs{keyfigure}\texttt{[W]} and \cs{keytable}[W]\label{ex:keyfiguretablew}} +% \begin{keyfigure}[W]{c={A \cs{keyfigure}\texttt{[W]}}, +% l=fig:keyfigurew,f,w=1.5in} +% This is a keyfigure. +% \end{keyfigure} +% \lipsum[1] +% +% \begin{keytable}[W]{c={A \env{keytable}\texttt{[W]}}, +% l=tab:keytablew,w=2in,wp=L,tc=Placed \texttt{L} and 2in wide.} +% \testwidetable +% \end{keytable} +% \lipsum[2] +% \end{dtxexample} +% % % % @@ -1214,7 +1341,7 @@ D & E & F \\ % \subsubsection{Custom Frames} % % -% \begin{newexample}[\Cref{fig:customframe,fig:customlooseframe}] +% \begin{dtxexample}[\Cref{fig:customframe,fig:customlooseframe}] % {Custom frames with \pkg{mdframed}\label{ex:customframe}} % \renewcommand{\KFLTtightframe}[1]{% % \begin{mdtightframe}% @@ -1233,7 +1360,7 @@ D & E & F \\ % \keyfig{ft,c=Custom-framed image,l=fig:customframe}{image} % \keyfigbox{f,c=Custom loosely-framed box, % l=fig:customlooseframe}{A loosely-framed box.} -% \end{newexample} +% \end{dtxexample} % % \DescribePackage{mdframed} % \Cref{ex:customframe} shows custom frames @@ -1247,7 +1374,7 @@ D & E & F \\ % % See \cref{sec:customframes} for more details. % -% \begin{newexample}[\Cref{fig:customshadow,fig:customlooseshadow}] +% \begin{dtxexample}[\Cref{fig:customshadow,fig:customlooseshadow}] % {Custom shadows with \pkg{fancybox}\label{ex:customshadow}} % \renewcommand{\KFLTtightframe}[1]{% % \setlength{\fboxrule}{.4pt} @@ -1268,7 +1395,7 @@ D & E & F \\ % \keyfig{ft,c=Custom shadow,l=fig:customshadow}{image} % \keyfigbox{f,c=Custom loosely-framed shadow,lw=.5, % l=fig:customlooseshadow}{A loosely-framed shadow box.} -% \end{newexample} +% \end{dtxexample} % % \DescribePackage{fancybox} % \Cref{ex:customshadow} shows custom shadow frames @@ -1302,14 +1429,14 @@ D & E & F \\ % \clearpage % \subsubsection{Artist's Name} % -% \begin{newexample}[\Cref{fig:artist}]{Artist's name — image} +% \begin{dtxexample}[\Cref{fig:artist}]{Artist's name — image} % \keyfig{ft,ap=Mr.,af=First,al=Last,as={~III}, % tc={\textit{About the illustration.}}, % c=Artist's name — image,l=fig:artist}{image} -% \end{newexample} +% \end{dtxexample} % % -% \begin{newexample}[\Cref{fig:artistpar}]{Artist's name — arbitary contents} +% \begin{dtxexample}[\Cref{fig:artistpar}]{Artist's name — arbitary contents} % \tdnameright % \begin{keyfigure}{f,ap=Mr.,al=Last, % c=Artist's name — arbitrary contents,l=fig:artistpar} @@ -1317,7 +1444,7 @@ D & E & F \\ % anything not an image file. % \end{keyfigure} % \tdnamecenter -% \end{newexample} +% \end{dtxexample} % % The artist's name and optional prefix/suffix are printed below the figure, % and an index entry is made for the name in (Last, First) format, @@ -1329,7 +1456,7 @@ D & E & F \\ % % \clearpage % -% \begin{newexample}[\Cref{fig:artistcollection}]{Subfloats with an artist} +% \begin{dtxexample}[\Cref{fig:artistcollection}]{Subfloats with an artist} % \begin{keysubfigs}{2}{ % c=Artist's collection, l=fig:artistcollection, % t={Some fully-justified text just for illustrative purposes, @@ -1342,7 +1469,7 @@ D & E & F \\ % \keyfig{c=Artist's Second Work, % tc={Commentary about the work.}}{image2} % \end{keysubfigs} -% \end{newexample} +% \end{dtxexample} % % A group of figures may be placed into a subfloat container, % which may have its own artist keys and additional text. @@ -1421,9 +1548,12 @@ D & E & F \\ % \index{caption>formatting} % The settings used in this documentation are: % \begin{verbatim} +% % default applied to margin floats: +% \captionsetup{labelfont={small,bf},textfont={small,bf}} +% % \captionsetup[figure]{ % style=default, justification=centering, -% margin=0pt, parskip=0pt, skip=1ex, +% margin=0pt, parskip=0pt, skip=2ex, % labelfont={small,bf},textfont={small,bf} % } % @@ -1435,7 +1565,7 @@ D & E & F \\ % % \captionsetup[subfigure]{ % style=default, justification=centering, -% margin=0pt, parskip=0pt, skip=1ex, +% margin=0pt, parskip=0pt, skip=2ex, % labelfont={small},textfont={small} % } % @@ -1496,6 +1626,15 @@ D & E & F \\ % \begin{macrocode} \RequirePackage{rotating} % \end{macrocode} +% \DescribePackage{placeins} Provides \FloatBarrier to process existing floats before adding new ones. +% \begin{macrocode} +\RequirePackage{placeins} +% \end{macrocode} +% \DescribePackage{wrapfig} Provides figure wrapping code. +% \begin{macrocode} +\RequirePackage{wrapfig} +% \end{macrocode} + % Rows of floats are created by a simple \env{minipage} environment, % instead of relying on a preexisting package. This proved to be @@ -1547,6 +1686,10 @@ D & E & F \\ \newlength{\KFLT@rowboxwidth} % \end{macrocode} + + + + % \subsection{Float Key Handling} % \DescribeBoolean{KFLT@cont} Continued float? @@ -1554,7 +1697,7 @@ D & E & F \\ \newboolean{KFLT@cont}{} % \end{macrocode} % -% \DescribeKey{cont} Continued float? +% \DescribeKey[main]{cont} Continued float? % % \begin{macrocode} \define@key{KFLT@keys}{cont}[true]{\setboolean{KFLT@cont}{#1}} @@ -1571,21 +1714,21 @@ D & E & F \\ \newboolean{KFLT@cstar} % \end{macrocode} % -% \DescribeKey{c} Caption +% \DescribeKey[main]{c} Caption % % \begin{macrocode} \define@key{KFLT@keys}{c}% {\renewcommand{\KFLT@c}{#1}\setboolean{KFLT@cstar}{false}} % \end{macrocode} % -% \DescribeKey{cstar} Caption starred? +% \DescribeKey[main]{cstar} Caption starred? % % \begin{macrocode} \define@key{KFLT@keys}{cstar}% {\renewcommand{\KFLT@c}{#1}\setboolean{KFLT@cstar}{true}} % \end{macrocode} % -% \DescribeKey{sc} Short caption +% \DescribeKey[main]{sc} Short caption % % \begin{macrocode} \define@key{KFLT@keys}{sc}{% @@ -1618,7 +1761,7 @@ D & E & F \\ % \end{macro} % % -% \DescribeKey{l} Label +% \DescribeKey[main]{l} Label % \begin{macrocode} \define@key{KFLT@keys}{l}{\renewcommand{\KFLT@l}{#1}} % \end{macrocode} @@ -1630,9 +1773,9 @@ D & E & F \\ % \end{macro} % % -% For the \pkg{tocdata} package: +% For the artist/author keys: % -% \DescribeKey{ap} Artist prefix +% \DescribeKey[main]{ap} Artist prefix % \begin{macrocode} \define@key{KFLT@keys}{ap}{\renewcommand{\KFLT@ap}{#1}} % \end{macrocode} @@ -1643,7 +1786,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{af} Artist first name +% \DescribeKey[main]{af} Artist first name % \begin{macrocode} \define@key{KFLT@keys}{af}{\renewcommand{\KFLT@af}{#1}} % \end{macrocode} @@ -1654,7 +1797,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{al} Artist last name +% \DescribeKey[main]{al} Artist last name % \begin{macrocode} \define@key{KFLT@keys}{al}{\renewcommand{\KFLT@al}{#1}} % \end{macrocode} @@ -1665,7 +1808,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{as} Artist suffix +% \DescribeKey[main]{as} Artist suffix % \begin{macrocode} \define@key{KFLT@keys}{as}{\renewcommand{\KFLT@as}{#1}} % \end{macrocode} @@ -1698,23 +1841,20 @@ D & E & F \\ % \end{macro} % % -% Create replacement macros if \pkg{tocdata} is not loaded: +% Create replacement macros in case \pkg{tocdata} is not loaded: +% \changes{v0.12}{2016/12/02}{Adapts to older version of tocdata.} % \begin{macrocode} -\@ifpackageloaded{tocdata} -{} -{ -\newcommand{\tdtextjustify}{} -\newcommand{\tdtextcenter}{} -\newcommand{\tdtextleft}{} -\newcommand{\tdtextright}{} -\newcommand{\tdnamejustify}{} -\newcommand{\tdnamecenter}{} -\newcommand{\tdnameleft}{} -\newcommand{\tdnameright}{} -} +\providecommand{\tdtextjustify}{} +\providecommand{\tdtextcenter}{} +\providecommand{\tdtextleft}{} +\providecommand{\tdtextright}{} +\providecommand{\tdnamejustify}{} +\providecommand{\tdnamecenter}{} +\providecommand{\tdnameleft}{} +\providecommand{\tdnameright}{} % \end{macrocode} % -% \DescribeKey{t} Additional text, justified alignment. +% \DescribeKey[main]{t} Additional text, justified alignment. % \begin{macrocode} \define@key{KFLT@keys}{t}{ \renewcommand{\KFLT@t}{#1} @@ -1723,7 +1863,7 @@ D & E & F \\ } % \end{macrocode} % -% \DescribeKey{tc} Additional text, centered alignment. +% \DescribeKey[main]{tc} Additional text, centered alignment. % \begin{macrocode} \define@key{KFLT@keys}{tc}{ \renewcommand{\KFLT@t}{#1} @@ -1732,7 +1872,7 @@ D & E & F \\ } % \end{macrocode} % -% \DescribeKey{tr} Additional text, aligned to the right. +% \DescribeKey[main]{tr} Additional text, aligned to the right. % \begin{macrocode} \define@key{KFLT@keys}{tr}{ \renewcommand{\KFLT@t}{#1} @@ -1741,7 +1881,7 @@ D & E & F \\ } % \end{macrocode} % -% \DescribeKey{tl} Additional text, aligned to the left. +% \DescribeKey[main]{tl} Additional text, aligned to the left. % \begin{macrocode} \define@key{KFLT@keys}{tl}{ \renewcommand{\KFLT@t}{#1} @@ -1759,7 +1899,7 @@ D & E & F \\ % \end{macro} % % -% \DescribeKey{lw} Fraction of \cs{linewidth} +% \DescribeKey[main]{lw} Fraction of \cs{linewidth} % \begin{macrocode} \define@key{KFLT@keys}{lw}{% \renewcommand{\KFLT@lw}{#1}% @@ -1773,7 +1913,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{w} Fixed width +% \DescribeKey[main]{w} Fixed width % \begin{macrocode} \define@key{KFLT@keys}{w}{% \setlength{\KFLT@w}{#1}% @@ -1787,7 +1927,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{h} Fixed height +% \DescribeKey[main]{h} Fixed height % \begin{macrocode} \define@key{KFLT@keys}{h}{\setlength{\KFLT@h}{#1}} % \end{macrocode} @@ -1798,7 +1938,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{s} Scale +% \DescribeKey[main]{s} Scale % \begin{macrocode} \define@key{KFLT@keys}{s}{\renewcommand{\KFLT@s}{#1}} % \end{macrocode} @@ -1809,7 +1949,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{r} Angle. 90 is counter-clockwise 90 degrees. +% \DescribeKey[main]{r} Angle. 90 is counter-clockwise 90 degrees. % \begin{macrocode} \define@key{KFLT@keys}{r}{\renewcommand{\KFLT@r}{#1}} % \end{macrocode} @@ -1820,7 +1960,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{f} Frame the image with \cs{KFLTlooseframe}. +% \DescribeKey[main]{f} Frame the image with \cs{KFLTlooseframe}. % \begin{macrocode} \define@key{KFLT@keys}{f}[true]{\setboolean{KFLT@f}{#1}} % \end{macrocode} @@ -1830,7 +1970,7 @@ D & E & F \\ \newboolean{KFLT@f} % \end{macrocode} -% \DescribeKey{ft} Tightly frame the image using \cs{KFLTtightframe}. +% \DescribeKey[main]{ft} Tightly frame the image using \cs{KFLTtightframe}. % This is useful for photographs, or diagrams which % already have built-in margins. % \begin{macrocode} @@ -1843,7 +1983,7 @@ D & E & F \\ % \end{macrocode} -% \DescribeKey{stretch} Set \cs{arraystretch} inside the table environment. +% \DescribeKey[main]{stretch} Set \cs{arraystretch} inside the table environment. % \begin{macrocode} \define@key{KFLT@keys}{stretch}{\renewcommand{\KFLT@stretch}{#1}} % \end{macrocode} @@ -1855,6 +1995,36 @@ D & E & F \\ % \end{macro} +% \DescribeKey[main]{mo} Set vertical offset for a margin float. +% \changes{v0.12}{2016/12/03}{Added \texttt{mo} key.} +% \begin{macrocode} +\define@key{KFLT@keys}{mo}{\setlength{\KFLT@mo}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@mo} Storage for the vertical margin offset. +% \begin{macrocode} +\newlength{\KFLT@mo} +% \end{macrocode} +% \end{macro} + + +% \DescribeKey[main]{wp} Set wrap placement for a wrapped float. +% +% See \cref{tab:wrapplacement} on \cpageref{tab:wrapplacement}. +% +% \changes{v0.12}{2016/12/03}{Added \texttt{wp} key.} +% \begin{macrocode} +\define@key{KFLT@keys}{wp}{\renewcommand{\KFLT@wp}{#1}} +% \end{macrocode} +% +% \begin{macro}{\KFLT@wp} Storage for the vertical margin offset. +% \begin{macrocode} +\newcommand{\KFLT@wp}{O} +% \end{macrocode} +% \end{macro} + + + % \subsection{Nesting Control} @@ -1882,7 +2052,7 @@ D & E & F \\ \newboolean{KFLT@subgrpcont}{} % \end{macrocode} % -% \DescribeKey{cont} Continued float +% \DescribeKey[subfloat container]{cont} Continued float % \begin{macrocode} \define@key{KFLT@subgrpkeys}{cont}[true]{% \setboolean{KFLT@subgrpcont}{#1}% @@ -1900,19 +2070,19 @@ D & E & F \\ \newboolean{KFLT@subgrpcstar} % \end{macrocode} % -% \DescribeKey{c} Caption +% \DescribeKey[subfloat container]{c} Caption % \begin{macrocode} \define@key{KFLT@subgrpkeys}{c} {\renewcommand{\KFLT@subgrpc}{#1}\setboolean{KFLT@subgrpcstar}{false}} % \end{macrocode} % -% \DescribeKey{cstar} Starred caption? +% \DescribeKey[subfloat container]{cstar} Starred caption? % \begin{macrocode} \define@key{KFLT@subgrpkeys}{cstar} {\renewcommand{\KFLT@subgrpc}{#1}\setboolean{KFLT@subgrpcstar}{true}} % \end{macrocode} % -% \DescribeKey{sc} Short caption +% \DescribeKey[subfloat container]{sc} Short caption % \begin{macrocode} \define@key{KFLT@subgrpkeys}{sc}{% \renewcommand{\KFLT@subgrpsc}{#1}% @@ -1964,7 +2134,7 @@ D & E & F \\ % \end{macro} % % -% \DescribeKey{l} Label +% \DescribeKey[subfloat container]{l} Label % \begin{macrocode} \define@key{KFLT@subgrpkeys}{l}{\renewcommand{\KFLT@subgrpl}{#1}} \newcommand*{\KFLT@subgrpl}{} @@ -1989,7 +2159,7 @@ D & E & F \\ % \end{macro} % % -% \DescribeKey{t} Additional text — full justification +% \DescribeKey[subfloat container]{t} Additional text — full justification % \begin{macrocode} \define@key{KFLT@subgrpkeys}{t}{ \renewcommand{\KFLT@subgrpt}{#1} @@ -1998,7 +2168,7 @@ D & E & F \\ } % \end{macrocode} % -% \DescribeKey{t} Additional text — center justification +% \DescribeKey[subfloat container]{t} Additional text — center justification % \begin{macrocode} \define@key{KFLT@subgrpkeys}{tc}{ \renewcommand{\KFLT@subgrpt}{#1} @@ -2007,7 +2177,7 @@ D & E & F \\ } % \end{macrocode} % -% \DescribeKey{t} Additional text — aligned left +% \DescribeKey[subfloat container]{t} Additional text — aligned left % \begin{macrocode} \define@key{KFLT@subgrpkeys}{tl}{ \renewcommand{\KFLT@subgrpt}{#1} @@ -2016,7 +2186,7 @@ D & E & F \\ } % \end{macrocode} % -% \DescribeKey{t} Additional text — aligned right +% \DescribeKey[subfloat container]{t} Additional text — aligned right % \begin{macrocode} \define@key{KFLT@subgrpkeys}{tr}{ \renewcommand{\KFLT@subgrpt}{#1} @@ -2029,7 +2199,7 @@ D & E & F \\ % % For the \pkg{tocdata} package: % -% \DescribeKey{ap} Artist prefix +% \DescribeKey[subfloat container]{ap} Artist prefix % \begin{macrocode} \define@key{KFLT@subgrpkeys}{ap}{\renewcommand{\KFLT@subgrpap}{#1}} % \end{macrocode} @@ -2040,7 +2210,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{af} Artist first name +% \DescribeKey[subfloat container]{af} Artist first name % \begin{macrocode} \define@key{KFLT@subgrpkeys}{af}{\renewcommand{\KFLT@subgrpaf}{#1}} % \end{macrocode} @@ -2051,7 +2221,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{al} Artist last name +% \DescribeKey[subfloat container]{al} Artist last name % \begin{macrocode} \define@key{KFLT@subgrpkeys}{al}{\renewcommand{\KFLT@subgrpal}{#1}} % \end{macrocode} @@ -2062,7 +2232,7 @@ D & E & F \\ % \end{macrocode} % \end{macro} % -% \DescribeKey{as} Artist suffix +% \DescribeKey[subfloat container]{as} Artist suffix % \begin{macrocode} \define@key{KFLT@subgrpkeys}{as}{\renewcommand{\KFLT@subgrpas}{#1}} % \end{macrocode} @@ -2292,8 +2462,6 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \end{minipage}% \unskip% \end{turn}% -\par% -\addvspace{2ex}% } % \end{macrocode} % \end{macro} @@ -2530,6 +2698,8 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \setboolean{KFLT@f}{false}% \setboolean{KFLT@ft}{false}% \renewcommand{\KFLT@stretch}{1}% +\setlength{\KFLT@mo}{-1.2ex}% +\renewcommand{\KFLT@wp}{O}% } % \end{macrocode} % \end{macro} @@ -2798,7 +2968,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % \begin{macrocode} \end{lrbox}% \KFLT@frame{\usebox{\KFLT@envbox}}% -\par\addvspace{\medskipamount}% +\par\addvspace{2ex}% }% endkeyboxinner % \end{macrocode} % \end{environment} @@ -2825,12 +2995,13 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % Boxes the contents of figures and floats. % % Not used by subfigures. +% +% \changes{v0.12}{2016/12/03}{[M] and [W] floats.} % \begin{macrocode} \NewDocumentEnvironment{KFLT@boxouter}{m m} -{% keyboxouter +{% boxouter % \end{macrocode} -% The \env{keytable} environment boxes the contents inside an optional frame of hrules, -% then handles them in either of +% The \env{keytable} environment handles the contents in either of % three possible ways, depending on whether it is % called alone, inside a \env{keyfloats} environment, or % inside a \env{keysubtabs} environment. @@ -2846,13 +3017,49 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% {% keyfloats \minipage{\KFLT@rowboxwidth}% -\captionsetup{type=\KFLT@type}% +\captionsetup*{type=\KFLT@type}% }% keyfloats {% not keyfloats % \end{macrocode} % % Not a subfloat or \env{keyfloats}, so create a single float. % +% See if the float should [W]rap: +% \begin{macrocode} +\ifthenelse{\equal{#2}{W}}% +% \end{macrocode} +% Place [W], so create a wrapfloat: +% \begin{macrocode} +{% [W] +% \end{macrocode} +% Temporarily figure out \cs{KFLT@imagewidth}, +% and make the wrapped figure environment as wide as the +% desired image size plus frame: +% \begin{macrocode} +\KFLT@findwidths% +\csname wrap\KFLT@type\endcsname{\KFLT@wp}% +{\KFLT@imagewidth+2\KFLTlooseframewidth}% +% \end{macrocode} +% The interior contents default to the full linewidth. +% This may be changed by a fixed width when +% \cs{KFLT@findwidths} is about to be done again. +% \begin{macrocode} +\renewcommand{\KFLT@lw}{1}% +}% [W] +{% not [W] +% +% See if the float should be positioned in the [M]argin: +% \begin{macrocode} +\ifthenelse{\equal{#2}{M}}% +% \end{macrocode} +% Place [M], so create a marginfloat: +% \begin{macrocode} +{% [M] +\csname margin\KFLT@type\endcsname[\KFLT@mo]% +\captionsetup{type=\KFLT@type}% +}% [M] +{% not [M} +% % See if the float should be positioned [H]ere: % \begin{macrocode} \ifthenelse{\equal{#2}{H}}% @@ -2871,6 +3078,8 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \IfBooleanTF{#1}% {\csname \KFLT@type*\endcsname[#2]}{\csname \KFLT@type\endcsname[#2]}% }% not [H] +}% not [M] +}% not [W] }% not keyfloats }% not subfloat % \end{macrocode} @@ -2892,16 +3101,16 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \unskip% \minipage{\linewidth}% \centering% -}% keyboxouter +}% boxouter % \end{macrocode} % -% End of the keyboxouter environment: +% End of the KFLT@boxouter environment: % % \begin{macrocode} {% endboxouter \endminipage% \end{center}% -\unskip\addvspace{\medskipamount}% +\unskip\addvspace{2ex}% % \end{macrocode} % Optionally print artist's name and additional text: % \begin{macrocode} @@ -2916,7 +3125,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% \ifthenelse{\boolean{KFLT@inkeysubfloats}}% {\csname endsub\KFLT@type\endcsname}% subfloat {% not subfloat -\ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% keyfloat? +\ifthenelse{\cnttest{\value{KFLT@keyfloatdepth}}>{0}}% keyfloats? {\endminipage}% keyfloats {% not keyfloats % \end{macrocode} @@ -2924,15 +3133,38 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % Not subfloat or \env{keyfloats}, so is an individual float. % % Close the minipage or float: +% +% See if the float should [W]rap: +% \begin{macrocode} +\ifthenelse{\equal{#2}{W}}% +% \end{macrocode} +% Place [W], so close the wrap float: +% \begin{macrocode} +{% [W] +\csname endwrap\KFLT@type\endcsname% +}% [W] +{% not[W] +% +% See if the float should be positioned in the [M]argin: +% \begin{macrocode} +\ifthenelse{\equal{#2}{M}}% +% \end{macrocode} +% Place [M], so close the marginfloat: % \begin{macrocode} +{% [M] +\csname endmargin\KFLT@type\endcsname% +}% [M] +{% not [M] \ifthenelse{\equal{#2}{H}}% {% \endminipage% [H] }% {% not [H] -\IfBooleanTF{#1}% starred table? +\IfBooleanTF{#1}% starred float? {\csname end\KFLT@type*\endcsname}{\csname end\KFLT@type\endcsname}% }% not [H] +}% not [M] +}% not [W] }% not keyfloats }% not subfloat }% endkeyboxouter @@ -2959,7 +3191,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % \end{environment} % Extra code to track rows outside of the \env{keyfigure} environment, -% \DescribeSimple{Before \env{keyfigure}} +% \DescribeObject{Before \env{keyfigure}} % before it starts. This is done to allow nesting without losing track % of the prior level. % @@ -2977,6 +3209,8 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % 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.} % \begin{macrocode} \NewDocumentCommand{\keyfig}{s O{tbp} +m m} {% @@ -2986,9 +3220,11 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % After setting default values, overridge with the filename: % \begin{macrocode} \renewcommand{\KFLT@i}{#4}% +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@onefigureimage% \endKFLT@boxouter% +\endgroup% } % \end{macrocode} % \end{macro} @@ -3002,16 +3238,20 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % A user-level macro to generate a figure with arbitrary paragraph contents. % This may be used by itself, or inside a \env{keyfloats} or % \env{keysubtabs} environment. +% +% \changes{v0.12}{2016/12/03}{Group around contents.} % \begin{macrocode} \NewDocumentCommand{\keyfigbox}{s O{tbp} +m +m} {% \KFLT@trackrows% \KFLT@boxkeys{#3}{figure}{lof}% +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% #4% \endKFLT@boxinner% \endKFLT@boxouter% +\endgroup% } % \end{macrocode} % \end{macro} @@ -3026,6 +3266,8 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % This is equal to a \cs{keyfigbox} with |cstar={}|. % 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} \NewDocumentCommand{\keyparbox}{s O{tbp} +m +m} {% @@ -3039,11 +3281,13 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % \end{macrocode} % Continue like \cs{figbox}: % \begin{macrocode} +\begingroup% \KFLT@boxouter{#1}{#2}% \KFLT@boxinner% #4% \endKFLT@boxinner% \endKFLT@boxouter% +\endgroup% } % \end{macrocode} % \end{macro} @@ -3056,17 +3300,21 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % A user-level macro to generate a table with tabular contents. % This may be used by itself, or inside a \env{keyfloats} or % \env{keysubtabs} environment. +% +% \changes{v0.12}{2016/12/03}{Group around contents.} % \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% } % \end{macrocode} % \end{macro} @@ -3091,7 +3339,7 @@ width=\KFLT@imagewidth,height=\KFLT@h]{\KFLT@i}% % \end{environment} % Extra code to track rows outside of the \env{keytable} environment, -% \DescribeSimple{Before \env{keytable}} +% \DescribeObject{Before \env{keytable}} % before it starts. This is done to allow nesting without losing track % of the prior level. % @@ -3175,7 +3423,7 @@ environment inside another, or inside a keyfloats.}% % If inside subfloats, generate subfigures by default: % \begin{macrocode} \ifthenelse{\boolean{KFLT@inkeysubfloats}}% -{}{\captionsetup{type=figure}}% +{}{\captionsetup*{type=figure}}% }% [H] or nested % \end{macrocode} % Isn't [H] or nested, so create a figure: @@ -3247,7 +3495,7 @@ environment inside another, or inside a keyfloats.}% % Extra code to track rows outside of the \env{keyfloats} environment, -% \DescribeSimple{Before \env{keyfloats}} +% \DescribeObject{Before \env{keyfloats}} % before it starts. This is done to allow nesting without losing track % of the prior level. % @@ -3270,7 +3518,7 @@ environment inside another, or inside a keyfloats.}% % \end{macrocode} -% \subsection{Subfigures} +% \subsection{Subfloats} % \begin{macro}{\KFLT@subgrpdefaults} Sets defaults before reading the keys. % \begin{macrocode} @@ -3338,7 +3586,7 @@ environment inside another, or inside a keyfloats.}% % \end{macrocode} % Set the caption type: % \begin{macrocode} -\captionsetup{type=\KFLT@subgrptype}% +\captionsetup*{type=\KFLT@subgrptype}% % \end{macrocode} % Process continued floats: % \begin{macrocode} @@ -3468,6 +3716,54 @@ environment inside another, or inside a keyfloats.}% } % \end{macrocode} % \end{environment} +% +% +% +% +% +% +% \subsection{Margin Floats} +% +% \begin{environment}{KFLT@marginfloat} \oarg{offset} \marg{type} +% \begin{macrocode} +\newsavebox{\KFLT@marginfloatbox} + +\NewDocumentEnvironment{KFLT@marginfloat}{O{-1.2ex} m} +{% start +\FloatBarrier% keep floats in order +\begin{lrbox}{\KFLT@marginfloatbox}% +\begin{minipage}{\marginparwidth}% +\captionsetup{type=#2}% +\hbox{}\vspace*{#1}% +\noindent% +}% start +{\end{minipage}% +\end{lrbox}% +\marginpar{\usebox{\KFLT@marginfloatbox}}% +} +% \end{macrocode} +% \end{environment} +% +% +% \begin{environment}{marginfigure} \oarg{offset} +% \changes{v0.12}{2016/12/03}{Added.} +% \begin{macrocode} +\ProvideDocumentEnvironment{marginfigure}{O{-1.2ex}} + {\begin{KFLT@marginfloat}[#1]{figure}} + {\end{KFLT@marginfloat}} +% \end{macrocode} +% \end{environment} +% +% +% \begin{environment}{margintable} \oarg{offset} +% \changes{v0.12}{2016/12/03}{Added.} +% \begin{macrocode} +\ProvideDocumentEnvironment{margintable}{O{-1.2ex}} + {\begin{KFLT@marginfloat}[#1]{table}} + {\end{KFLT@marginfloat}} +% \end{macrocode} +% \end{environment} + @@ -3488,6 +3784,7 @@ environment inside another, or inside a keyfloats.}% % \renewcommand{\thepart}{} % \part{Change History and Index} % +% % \Finale - +% \endinput |