texlive[50088] Master/texmf-dist: fitbox (22feb19)

commits+karl at tug.org commits+karl at tug.org
Sat Feb 23 00:12:27 CET 2019


Revision: 50088
          http://tug.org/svn/texlive?view=revision&revision=50088
Author:   karl
Date:     2019-02-23 00:12:27 +0100 (Sat, 23 Feb 2019)
Log Message:
-----------
fitbox (22feb19)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/fitbox/README
    trunk/Master/texmf-dist/doc/latex/fitbox/fitbox.bib
    trunk/Master/texmf-dist/doc/latex/fitbox/fitbox.pdf
    trunk/Master/texmf-dist/doc/latex/fitbox/sample.pdf
    trunk/Master/texmf-dist/source/latex/fitbox/Makefile
    trunk/Master/texmf-dist/source/latex/fitbox/fitbox.dtx
    trunk/Master/texmf-dist/tex/latex/fitbox/fitbox.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/fitbox/napoleon.png
    trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.pdf
    trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.tex

Modified: trunk/Master/texmf-dist/doc/latex/fitbox/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fitbox/README	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/doc/latex/fitbox/README	2019-02-22 23:12:27 UTC (rev 50088)
@@ -6,7 +6,13 @@
 the user-set limits. If there there is not enough space on the page,
 the box is moved to the next one.
 
+
+version 1.02 2019/02/20   Bug fixes
+	     		  New command \fitbox* for boxes inside floats
+			  New command \SetFitboxLayout for emulation of figsize
+			  package functionality
+
 version 1.01 2019/02/10   Use the width of the box around the graphics for
                           default max width.
 			  Do not adjust user provided values even if they
-			  seem nonsensical (but warn the user)
\ No newline at end of file
+			  seem nonsensical (but warn the user)

Modified: trunk/Master/texmf-dist/doc/latex/fitbox/fitbox.bib
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fitbox/fitbox.bib	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/doc/latex/fitbox/fitbox.bib	2019-02-22 23:12:27 UTC (rev 50088)
@@ -4,3 +4,11 @@
   title =         {{UK} List of {\TeX} Frequently Asked Questions},
   year =          {2015},
 }
+
+ at Manual{FigSize,
+  title = 	 {The \textsl{FigSize} Package},
+  author = 	 {Anthony A. Tanbakuchi},
+  month = 	 {March},
+  year = 	 2002,
+  note = 	 {\url{https://ctan.org/pkg/figsize}}}
+

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

Added: trunk/Master/texmf-dist/doc/latex/fitbox/napoleon.png
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/fitbox/napoleon.png
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fitbox/napoleon.png	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/doc/latex/fitbox/napoleon.png	2019-02-22 23:12:27 UTC (rev 50088)

Property changes on: trunk/Master/texmf-dist/doc/latex/fitbox/napoleon.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.pdf
===================================================================
(Binary files differ)

Index: trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.pdf
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.pdf	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.pdf	2019-02-22 23:12:27 UTC (rev 50088)

Property changes on: trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/pdf
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.tex	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.tex	2019-02-22 23:12:27 UTC (rev 50088)
@@ -0,0 +1,73 @@
+\documentclass{article}
+\usepackage{graphicx}
+\usepackage{fitbox}
+\usepackage{subfig}
+\begin{document}
+
+The use of fitbox with a subfigure.  Note that the optional argument
+for the command counts the lines for the subcaptions.  
+
+\SetFitboxLayout[subcaplines=1]{3}{2}
+
+
+
+
+\begin{figure}
+  \centering
+  \subfloat[First
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Second
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\\
+  \subfloat[Third
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Fourth
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\\
+  \subfloat[Fifth
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Sixth
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}
+  \caption{Six Napoleons, \texttt{\textbackslash SetFitboxLayout[subcaplines=1]\{3\}\{2\}}}
+  \label{fig:napoleons}
+\end{figure}
+
+\SetFitboxLayout{3}{2}
+
+\begin{figure}
+  \centering
+  \subfloat{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat{\fitbox*{\includegraphics{napoleon}}}\\
+  \subfloat{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat{\fitbox*{\includegraphics{napoleon}}}\\
+  \subfloat{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat{\fitbox*{\includegraphics{napoleon}}}
+  \caption{Six Napoleons, no subcaptions, \texttt{\textbackslash SetFitboxLayout\{3\}\{2\}}}
+  \label{fig:napoleons1}
+\end{figure}
+
+\SetFitboxLayout[subcaplines=1, maincaplines=2]{2}{3}
+
+
+
+
+\begin{figure}
+  \centering
+  \subfloat[First
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Second
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Third
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\\
+  \subfloat[Fourth
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Fifth
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}\quad
+  \subfloat[Sixth
+  Napoleon]{\fitbox*{\includegraphics{napoleon}}}
+  \caption{Six Napoleons, another arrangement\\
+    \texttt{\textbackslash SetFitboxLayout[subcaplines=1,
+      maincaplines=2]\{2\}\{3\}}} 
+  \label{fig:napoleons3}
+\end{figure}
+
+
+\end{document}


Property changes on: trunk/Master/texmf-dist/doc/latex/fitbox/sample-subfigure.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/fitbox/sample.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/fitbox/Makefile
===================================================================
--- trunk/Master/texmf-dist/source/latex/fitbox/Makefile	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/source/latex/fitbox/Makefile	2019-02-22 23:12:27 UTC (rev 50088)
@@ -6,7 +6,7 @@
 #
 
 PACKAGE=fitbox
-SAMPLES = sample.tex
+SAMPLES = sample.tex sample-subfigure.tex
 
 all:  $(PACKAGE).pdf ${SAMPLES:%.tex=%.pdf} 
 

Modified: trunk/Master/texmf-dist/source/latex/fitbox/fitbox.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/fitbox/fitbox.dtx	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/source/latex/fitbox/fitbox.dtx	2019-02-22 23:12:27 UTC (rev 50088)
@@ -21,7 +21,7 @@
 %</gobble>
 %<style>\ProvidesPackage{fitbox}
 %<*style>
-[2019/02/10 v1.01 Fitting boxes on a page]
+[2019/02/20 v1.02 Fitting boxes on a page]
 %    \end{macrocode}
 %</style>
 %<*gobble>
@@ -62,7 +62,7 @@
 % \GetFileInfo{fitbox.dtx}
 % 
 % 
-% \title{Fit graphics on a page\thanks{\copyright 2015 Boris Veytsman}
+% \title{Fit graphics on a page\thanks{\copyright 2015--2019 Boris Veytsman}
 % \thanks{This package was commissined by Neadwerx, \url{http://www.neadwerx.com/}}}
 % \author{Boris Veytsman \thanks{borisv at lk.net}}
 % \date{\filedate, \fileversion}
@@ -147,8 +147,13 @@
 % \item If this also fails, \TeX\ starts a new page and fits the box
 % there.  
 % \end{enumerate}
-% 
 %
+% \DescribeMacro{\fitbox*}%
+% The starred version \cs{fitbox*} is intended to be used inside
+% floats, where page length is not well defined.  This command uses
+% only the first two steps of the alogithm above, scaling the box up
+% to the maximal dimensions provided by the user.
+%
 % \DescribeMacro{\fitboxset}%
 % The options can be set individually for each \cs{fitbox} command, or
 % globally using the command \cs{fitboxset}, for example,
@@ -166,11 +171,11 @@
 % \cs{fitboxnatheight} are actually \emph{total heights}, including
 % both height and depth of the corresponding boxes.  For example,
 % \begin{verbatim}
-% \fitboxeset{minheight=0.5\fitboxnatheight}
+% \fitboxset{minheight=0.5\fitboxnatheight}
 % \end{verbatim}
 % means that the box cannot be scaled down more than 50\%.  
 % 
-% The following options are recognized:
+% The following options are recognized by the \cs{fitbox} command:
 % \begin{description}
 % \item[maxheight:] The maximal total height of the box.  By default
 % \cs{textheight}. 
@@ -185,6 +190,42 @@
 % \item[maxenlargepage:] The maximal amount to add to the current
 % page.  By default zero.
 % \end{description}
+%
+% \DescribeMacro{\SetFitboxLayout}%
+% Since version 1.02 the package added the functionality of
+% \textsl{FigSize} package~\cite{FigSize}.  The latter has a handy
+% command \cs{SetFigLayout}, which can be used to scale all figures on
+% a page.  This package uses the command \cs{SetFitboxLayout} that
+% somewhat mimics \cs{SetFigLayout}.  The macro has the arguments
+% \cs{SetFitboxLayout}\oarg{keys}\marg{rows}\marg{columns}, and helps
+% to scale the boxes into a grid.  However, unlike \textsl{FigSize}
+% package, we do not redefine \cs{includegraphics} command: you should
+% use \cs{fitbox} for your graphics.  The command \cs{SetFitboxLayout}
+% is just \cs{fitboxset} with special values of the parameters.  These
+% commands can be mixed, with the latest command overriding the
+% previous ones.
+%
+% The following keys are recognized by the \cs{SetFitboxLayout} command:
+% \begin{description}
+% \item[colsep:] the distance between the columns; by default the size
+% of \cs{quad}.
+% \item[colsepexpr:] if set, the width of the expression becomes
+% \texttt{colsep}.  For example, \path{colsepexpr=\quad} makes
+% separation between the columns the size of \cs{quad}.
+% \item[maincapheight:] The height of the main caption.  By default,
+% $\cs{abovecaptionskip}+\cs{belowcaptionskip}+
+% n\cs{baselineskip})$ 
+% where $n$ is the expected number of lines in the main caption (by
+% default 1).
+% \item[maincaplines:] The number of lines in the main caption.  By
+% default 1.
+% \item[subcapheight:] The height of the subcaption.  By default,
+%   $\cs{abovecaptionskip}+\cs{belowcaptionskip}+m\cs{baselineskip}$
+%   where $m$ is the expected number of lines in the subcaptions (by
+%   default 0).
+% \item[subcaplines:] The number of lines in the subcaptions.  By
+% default 0.
+% \end{description}
 % 
 %
 %\StopEventually{\clearpage
@@ -224,14 +265,41 @@
 % \end{macro}
 %
 % 
-%
+% \changes{v1.01}{2019/02/20}{New keys for \cs{SetFitboxLayout}}
 % We use |xkeyval| interface:
 %    \begin{macrocode}
 \RequirePackage{xkeyval}
 \define at cmdkeys{FTBX}{maxheight, minheight, maxwidth, minwidth,
-  belowboxspace, maxenlargepage}
+  belowboxspace, maxenlargepage, colsep, maincapheight,
+  subcapheight}
 %    \end{macrocode}
 %
+% Setting some keys changes other keys
+%    \begin{macrocode}
+\define at key{FTBX}{colsepexpr}{%
+  \setbox\@tempboxa=\hbox{#1}%
+  \edef\cmdKV at FTBX@colsep{\wd\@tempboxa}}
+\define at key{FTBX}{maincaplines}{%
+  \@tempdima=\z@
+  \advance\@tempdima by #1\baselineskip\relax
+  \ifnum#1>0\relax
+     \advance\@tempdima by \parskip
+  \fi 
+  \advance\@tempdima by \abovecaptionskip
+  \advance\@tempdima by \belowcaptionskip
+  \edef\cmdKV at FTBX@maincapheight{\the\@tempdima}}
+\define at key{FTBX}{subcaplines}{%
+  \@tempdima=\z@
+  \advance\@tempdima by #1\baselineskip\relax
+  \ifnum#1>0\relax
+     \advance\@tempdima by \parskip
+  \fi 
+  \advance\@tempdima by \abovecaptionskip
+  \advance\@tempdima by \belowcaptionskip
+  \edef\cmdKV at FTBX@subcapheight{\the\@tempdima}}  
+%    \end{macrocode}
+% 
+%
 % \begin{macro}{\fitboxset}
 %   Setting everything
 %    \begin{macrocode}
@@ -245,7 +313,8 @@
 %    \begin{macrocode}
 \fitboxset{maxheight=\textheight, minheight=\fitboxnatheight,
   maxwidth=\hsize, minwidth=\fitboxnatwidth,
-  belowboxspace=0pt, maxenlargepage=0pt}
+  belowboxspace=0pt, maxenlargepage=0pt, colsepexpr={aaa},
+  maincaplines=1, subcaplines=0}
 %    \end{macrocode}
 % 
 %
@@ -262,25 +331,43 @@
 %
 % \begin{macro}{\FTBX at desired@maxheight}
 %   The desired maximal height
+%    \begin{macrocode}
 \newdimen\FTBX at desired@maxheight
+%    \end{macrocode}
 % \end{macro}
 %
 %
 % \begin{macro}{\FTBX at desired@minheight}
-%   The desired minimal height
+% The desired minimal height
+%    \begin{macrocode}
 \newdimen\FTBX at desired@minheight
+%    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\FTBX at available@height}
-%   The desired available height
+% The desired available height
+%    \begin{macrocode}
 \newdimen\FTBX at available@height
+%    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\fitbox}
-%\changes{v1.01}{2019/02/10}{Do not force adjusting the width}
-%   The main command
+% \changes{v1.02}{2019/02/18}{Split into normal and starred version}
+% The main command
 %    \begin{macrocode}
-\newcommand\fitbox[2][]{\leavevmode
+\def\fitbox{\@ifstar\@@fitbox\@fitbox}
+%    \end{macrocode}
+% 
+% \end{macro}
+%
+% \begin{macro}{\@fitbox}
+% \changes{v1.01}{2019/02/10}{Do not force width adjustment}
+% \changes{v1.02}{2019/02/17}{\cs{noident} instead of \cs{leavevmode}
+% (suggested by Frank Mittelbach)}
+% \changes{v1.02}{2019/02/18}{Split into normal and starred version}
+%   The main command---``normal'' version
+%    \begin{macrocode}
+\newcommand\@fitbox[2][]{\noindent
   \fitboxset{#1}%
   \setbox\FTBX at box=\hbox{#2}%
   \fitboxnatwidth=\wd\FTBX at box\relax
@@ -300,17 +387,17 @@
         Consider changing it to \the\textheight}%
   \fi
   \expandafter\ifdim\cmdKV at FTBX@maxheight>\textheight\relax
-      \PackageWarning{fitbox}{Desired height is too laege.
+      \PackageWarning{fitbox}{Desired height is too large.
         Consider changing it to \the\textheight}%
   \fi
   % Calculating the minimal and maximal height
-  \Gscale at div{\@tempa}{\cmdKV at FTBX@maxwidth}{\fitboxnatwidth}%
-  \FTBX at desired@maxheight=\@tempa\fitboxnatheight\relax
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@maxwidth}{\fitboxnatwidth}%
+  \FTBX at desired@maxheight=\@FTBX at tempa\fitboxnatheight\relax
   \expandafter\ifdim\cmdKV at FTBX@maxheight<\FTBX at desired@maxheight\relax
      \expandafter\FTBX at desired@maxheight=\cmdKV at FTBX@maxheight\relax
   \fi
-  \Gscale at div{\@tempa}{\cmdKV at FTBX@minwidth}{\fitboxnatwidth}%
-  \FTBX at desired@minheight=\@tempa\fitboxnatheight\relax
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@minwidth}{\fitboxnatwidth}%
+  \FTBX at desired@minheight=\@FTBX at tempa\fitboxnatheight\relax
   \expandafter\ifdim\cmdKV at FTBX@minheight>\FTBX at desired@minheight\relax
      \expandafter\FTBX at desired@minheight=\cmdKV at FTBX@minheight\relax
   \fi
@@ -348,7 +435,88 @@
 %   
 % \end{macro}
 %
+% \begin{macro}{\@@fitbox}
+% \changes{v1.01}{2019/02/10}{Do not force width adjustment}
+% \changes{v1.02}{2019/02/17}{\cs{noident} instead of \cs{leavevmode}
+% (suggested by Frank Mittelbach)}
+% \changes{v1.02}{2019/02/18}{Split into normal and starred version}
+%   The main command---``starred'' version.  Simplified computations.
 %    \begin{macrocode}
+\newcommand\@@fitbox[2][]{\noindent
+  \fitboxset{#1}%
+  \setbox\FTBX at box=\hbox{#2}%
+  \fitboxnatwidth=\wd\FTBX at box\relax
+  \fitboxnatheight=\ht\FTBX at box\relax
+  \advance\fitboxnatheight by \dp\FTBX at box\relax
+  % Checking the sizes
+  \expandafter\ifdim\cmdKV at FTBX@minwidth>\columnwidth\relax
+      \PackageWarning{fitbox}{Minimal width is too large.  Consider
+        changing it to \the\hsize}%
+  \fi
+  \expandafter\ifdim\cmdKV at FTBX@maxwidth>\hsize\relax
+      \PackageWarning{fitbox}{Desired width is too large.  Consider
+        changing it to \the\hsize}%
+  \fi
+  \expandafter\ifdim\cmdKV at FTBX@minheight>\textheight\relax
+      \PackageWarning{fitbox}{Minimal height is too large.  
+        Consider changing it to \the\textheight}%
+  \fi
+  \expandafter\ifdim\cmdKV at FTBX@maxheight>\textheight\relax
+      \PackageWarning{fitbox}{Desired height is too large.
+        Consider changing it to \the\textheight}%
+  \fi
+  % Calculating the minimal and maximal height
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@maxwidth}{\fitboxnatwidth}%
+  \FTBX at desired@maxheight=\@FTBX at tempa\fitboxnatheight\relax
+  \expandafter\ifdim\cmdKV at FTBX@maxheight<\FTBX at desired@maxheight\relax
+     \expandafter\FTBX at desired@maxheight=\cmdKV at FTBX@maxheight\relax
+  \fi
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@minwidth}{\fitboxnatwidth}%
+  \FTBX at desired@minheight=\@FTBX at tempa\fitboxnatheight\relax
+  \expandafter\ifdim\cmdKV at FTBX@minheight>\FTBX at desired@minheight\relax
+     \expandafter\FTBX at desired@minheight=\cmdKV at FTBX@minheight\relax
+  \fi
+  \ifdim\FTBX at desired@minheight>\FTBX at desired@maxheight\relax
+      \PackageWarning{fitbox}{Desired min scale exceeds desired max
+        scale.}% 
+  \fi  
+  \resizebox*{!}{\FTBX at desired@maxheight}{\box\FTBX at box}%
+}
+%    \end{macrocode}
+%   
+% \end{macro}
+%
+%
+%\subsection{Multi-figure layout}
+%\label{sec:layout}
+%
+%
+%
+% \begin{macro}{\SetFitboxLayout}
+% \changes{v1.02}{2019/02/17}{New macro}
+% \changes{v1.02}{2019/02/20}{Key-value interface}
+% A macro styles after \cs{SetFigsizeLayout} of \textsl{FigSize}
+% package.
+%    \begin{macrocode}
+\newcommand\SetFitboxLayout[3][]{%
+  \fitboxset{#1}%
+  \@tempdima=\textheight
+  \advance\@tempdima by -\cmdKV at FTBX@maincapheight\relax
+  \divide\@tempdima by #2\relax
+  \advance\@tempdima by -\cmdKV at FTBX@subcapheight\relax
+  \edef\cmdKV at FTBX@maxheight{\the\@tempdima}%
+  \@tempdima=\columnwidth
+  \@tempdimb=\cmdKV at FTBX@colsep\relax
+  \advance\@tempdima by -#3\@tempdimb\relax
+  \advance\@tempdima by \@tempdimb\relax
+  \divide\@tempdima by #3\relax
+  \edef\cmdKV at FTBX@maxwidth{\the\@tempdima}%
+}
+%    \end{macrocode}
+% 
+% \end{macro}
+%
+%    \begin{macrocode}
 %</style>
 %    \end{macrocode}
 %\Finale

Modified: trunk/Master/texmf-dist/tex/latex/fitbox/fitbox.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/fitbox/fitbox.sty	2019-02-22 23:12:06 UTC (rev 50087)
+++ trunk/Master/texmf-dist/tex/latex/fitbox/fitbox.sty	2019-02-22 23:12:27 UTC (rev 50088)
@@ -36,21 +36,45 @@
 %%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{fitbox}
-[2019/02/10 v1.01 Fitting boxes on a page]
+[2019/02/20 v1.02 Fitting boxes on a page]
 \newdimen\fitboxnatheight
 \newdimen\fitboxnatwidth
 \RequirePackage{xkeyval}
 \define at cmdkeys{FTBX}{maxheight, minheight, maxwidth, minwidth,
-  belowboxspace, maxenlargepage}
+  belowboxspace, maxenlargepage, colsep, maincapheight,
+  subcapheight}
+\define at key{FTBX}{colsepexpr}{%
+  \setbox\@tempboxa=\hbox{#1}%
+  \edef\cmdKV at FTBX@colsep{\wd\@tempboxa}}
+\define at key{FTBX}{maincaplines}{%
+  \@tempdima=\z@
+  \advance\@tempdima by #1\baselineskip\relax
+  \ifnum#1>0\relax
+     \advance\@tempdima by \parskip
+  \fi
+  \advance\@tempdima by \abovecaptionskip
+  \advance\@tempdima by \belowcaptionskip
+  \edef\cmdKV at FTBX@maincapheight{\the\@tempdima}}
+\define at key{FTBX}{subcaplines}{%
+  \@tempdima=\z@
+  \advance\@tempdima by #1\baselineskip\relax
+  \ifnum#1>0\relax
+     \advance\@tempdima by \parskip
+  \fi
+  \advance\@tempdima by \abovecaptionskip
+  \advance\@tempdima by \belowcaptionskip
+  \edef\cmdKV at FTBX@subcapheight{\the\@tempdima}}
 \def\fitboxset#1{\setkeys{FTBX}{#1}}
 \fitboxset{maxheight=\textheight, minheight=\fitboxnatheight,
   maxwidth=\hsize, minwidth=\fitboxnatwidth,
-  belowboxspace=0pt, maxenlargepage=0pt}
+  belowboxspace=0pt, maxenlargepage=0pt, colsepexpr={aaa},
+  maincaplines=1, subcaplines=0}
 \newbox\FTBX at box
 \newdimen\FTBX at desired@maxheight
 \newdimen\FTBX at desired@minheight
 \newdimen\FTBX at available@height
-\newcommand\fitbox[2][]{\leavevmode
+\def\fitbox{\@ifstar\@@fitbox\@fitbox}
+\newcommand\@fitbox[2][]{\noindent
   \fitboxset{#1}%
   \setbox\FTBX at box=\hbox{#2}%
   \fitboxnatwidth=\wd\FTBX at box\relax
@@ -70,17 +94,17 @@
         Consider changing it to \the\textheight}%
   \fi
   \expandafter\ifdim\cmdKV at FTBX@maxheight>\textheight\relax
-      \PackageWarning{fitbox}{Desired height is too laege.
+      \PackageWarning{fitbox}{Desired height is too large.
         Consider changing it to \the\textheight}%
   \fi
   % Calculating the minimal and maximal height
-  \Gscale at div{\@tempa}{\cmdKV at FTBX@maxwidth}{\fitboxnatwidth}%
-  \FTBX at desired@maxheight=\@tempa\fitboxnatheight\relax
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@maxwidth}{\fitboxnatwidth}%
+  \FTBX at desired@maxheight=\@FTBX at tempa\fitboxnatheight\relax
   \expandafter\ifdim\cmdKV at FTBX@maxheight<\FTBX at desired@maxheight\relax
      \expandafter\FTBX at desired@maxheight=\cmdKV at FTBX@maxheight\relax
   \fi
-  \Gscale at div{\@tempa}{\cmdKV at FTBX@minwidth}{\fitboxnatwidth}%
-  \FTBX at desired@minheight=\@tempa\fitboxnatheight\relax
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@minwidth}{\fitboxnatwidth}%
+  \FTBX at desired@minheight=\@FTBX at tempa\fitboxnatheight\relax
   \expandafter\ifdim\cmdKV at FTBX@minheight>\FTBX at desired@minheight\relax
      \expandafter\FTBX at desired@minheight=\cmdKV at FTBX@minheight\relax
   \fi
@@ -114,6 +138,60 @@
      \resizebox*{!}{\FTBX at desired@maxheight}{\box\FTBX at box}%
   \fi
 }
+\newcommand\@@fitbox[2][]{\noindent
+  \fitboxset{#1}%
+  \setbox\FTBX at box=\hbox{#2}%
+  \fitboxnatwidth=\wd\FTBX at box\relax
+  \fitboxnatheight=\ht\FTBX at box\relax
+  \advance\fitboxnatheight by \dp\FTBX at box\relax
+  % Checking the sizes
+  \expandafter\ifdim\cmdKV at FTBX@minwidth>\columnwidth\relax
+      \PackageWarning{fitbox}{Minimal width is too large.  Consider
+        changing it to \the\hsize}%
+  \fi
+  \expandafter\ifdim\cmdKV at FTBX@maxwidth>\hsize\relax
+      \PackageWarning{fitbox}{Desired width is too large.  Consider
+        changing it to \the\hsize}%
+  \fi
+  \expandafter\ifdim\cmdKV at FTBX@minheight>\textheight\relax
+      \PackageWarning{fitbox}{Minimal height is too large.
+        Consider changing it to \the\textheight}%
+  \fi
+  \expandafter\ifdim\cmdKV at FTBX@maxheight>\textheight\relax
+      \PackageWarning{fitbox}{Desired height is too large.
+        Consider changing it to \the\textheight}%
+  \fi
+  % Calculating the minimal and maximal height
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@maxwidth}{\fitboxnatwidth}%
+  \FTBX at desired@maxheight=\@FTBX at tempa\fitboxnatheight\relax
+  \expandafter\ifdim\cmdKV at FTBX@maxheight<\FTBX at desired@maxheight\relax
+     \expandafter\FTBX at desired@maxheight=\cmdKV at FTBX@maxheight\relax
+  \fi
+  \Gscale at div{\@FTBX at tempa}{\cmdKV at FTBX@minwidth}{\fitboxnatwidth}%
+  \FTBX at desired@minheight=\@FTBX at tempa\fitboxnatheight\relax
+  \expandafter\ifdim\cmdKV at FTBX@minheight>\FTBX at desired@minheight\relax
+     \expandafter\FTBX at desired@minheight=\cmdKV at FTBX@minheight\relax
+  \fi
+  \ifdim\FTBX at desired@minheight>\FTBX at desired@maxheight\relax
+      \PackageWarning{fitbox}{Desired min scale exceeds desired max
+        scale.}%
+  \fi
+  \resizebox*{!}{\FTBX at desired@maxheight}{\box\FTBX at box}%
+}
+\newcommand\SetFitboxLayout[3][]{%
+  \fitboxset{#1}%
+  \@tempdima=\textheight
+  \advance\@tempdima by -\cmdKV at FTBX@maincapheight\relax
+  \divide\@tempdima by #2\relax
+  \advance\@tempdima by -\cmdKV at FTBX@subcapheight\relax
+  \edef\cmdKV at FTBX@maxheight{\the\@tempdima}%
+  \@tempdima=\columnwidth
+  \@tempdimb=\cmdKV at FTBX@colsep\relax
+  \advance\@tempdima by -#3\@tempdimb\relax
+  \advance\@tempdima by \@tempdimb\relax
+  \divide\@tempdima by #3\relax
+  \edef\cmdKV at FTBX@maxwidth{\the\@tempdima}%
+}
 \endinput
 %%
 %% End of file `fitbox.sty'.



More information about the tex-live-commits mailing list