diff options
author | Karl Berry <karl@freefriends.org> | 2015-08-17 22:18:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-08-17 22:18:08 +0000 |
commit | b8487f5800276cf85bb543f7405b7315580bc450 (patch) | |
tree | a02af59ec34eb1767a98e2fd13b08f983b598aae | |
parent | dbd534c337f7d26212191f5dbbea8a83c45d3fd9 (diff) |
fitbox (17aug15)
git-svn-id: svn://tug.org/texlive/trunk@38139 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/Makefile | 61 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/README | 7 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/fitbox.bib | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/fitbox.pdf | bin | 0 -> 256045 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/sample.pdf | bin | 0 -> 83215 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/sample.tex | 40 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/fitbox/vitruvian.jpg | bin | 0 -> 63756 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/fitbox/fitbox.dtx | 366 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/fitbox/fitbox.ins | 26 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/fitbox/fitbox.sty | 124 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-pictures.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/fitbox.tlpsrc | 0 |
13 files changed, 632 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/fitbox/Makefile b/Master/texmf-dist/doc/latex/fitbox/Makefile new file mode 100644 index 00000000000..d5bc79b993f --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/Makefile @@ -0,0 +1,61 @@ +# +# +# This file is in public domain +# +# $Id: Makefile,v 1.2 2015-02-27 22:01:15 boris Exp $ +# + +PACKAGE=fitbox +SAMPLES = sample.tex + +all: $(PACKAGE).pdf ${SAMPLES:%.tex=%.pdf} + +%.pdf: %.dtx $(PACKAGE).sty + pdflatex $< + - bibtex $* + pdflatex $< + - makeindex -s gind.ist -o $*.ind $*.idx + - makeindex -s gglo.ist -o $*.gls $*.glo + pdflatex $< + while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \ + do pdflatex $<; done + + + + +%.sty: %.ins %.dtx + pdflatex $< + +%.pdf: %.tex $(PACKAGE).sty + pdflatex $* + -bibtex $* + pdflatex $* + while ( grep -q '^LaTeX Warning: Label(s) may have changed' $*.log) \ + do pdflatex $*; done + + +.PRECIOUS: $(PACKAGE).cfg $(PACKAGE).sty + + +clean: + $(RM) $(PACKAGE).sty *.log *.aux \ + *.cfg *.glo *.idx *.toc \ + *.ilg *.ind *.out *.lof \ + *.lot *.bbl *.blg *.gls *.hd \ + *.dvi *.ps *.tgz *.zip *.brf + +veryclean: clean + $(RM) $(PACKAGE).pdf ${SAMPLES:%.tex=%.pdf} + +distclean: veryclean + +# +# Archive for the distribution. Includes typeset documentation +# +archive: all clean + tar -czvf $(PACKAGE).tgz -C .. --exclude '*~' --exclude '*.tgz' --exclude CVS $(PACKAGE) + +zip: all clean + ${MAKE} $(PACKAGE).sty + $(RM) *.log + zip -r $(PACKAGE).zip * -x '*~' -x '*.tgz' -x '*.zip' -x CVS -x 'CVS/*'
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/fitbox/README b/Master/texmf-dist/doc/latex/fitbox/README new file mode 100644 index 00000000000..48232ed90eb --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/README @@ -0,0 +1,7 @@ + Fit graphics on a page + Boris Veytsman + +The fitbox package allows a box (usually an \includegraphics box) to +fit on the page. It scales the box to the maximal allowed size within +the user-set limits. If there there is not enough space on the page, +the box is moved to the next one. diff --git a/Master/texmf-dist/doc/latex/fitbox/fitbox.bib b/Master/texmf-dist/doc/latex/fitbox/fitbox.bib new file mode 100644 index 00000000000..8e3f9e1727f --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/fitbox.bib @@ -0,0 +1,6 @@ +@misc{TeXFAQ, + author = {{UK \TeX{} Users Group}}, + howpublished = {\url{http://www.tex.ac.uk/cgi-bin/texfaq2html}}, + title = {{UK} List of {\TeX} Frequently Asked Questions}, + year = {2015}, +} diff --git a/Master/texmf-dist/doc/latex/fitbox/fitbox.pdf b/Master/texmf-dist/doc/latex/fitbox/fitbox.pdf Binary files differnew file mode 100644 index 00000000000..995ff4f73e1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/fitbox.pdf diff --git a/Master/texmf-dist/doc/latex/fitbox/sample.pdf b/Master/texmf-dist/doc/latex/fitbox/sample.pdf Binary files differnew file mode 100644 index 00000000000..8a3f6e5ab42 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/sample.pdf diff --git a/Master/texmf-dist/doc/latex/fitbox/sample.tex b/Master/texmf-dist/doc/latex/fitbox/sample.tex new file mode 100644 index 00000000000..ea8c2b60ad3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/sample.tex @@ -0,0 +1,40 @@ +\documentclass{article} +\usepackage{graphicx} +\usepackage{fitbox} +\begin{document} + +We start from an image at maximal size: + +{\centering\fitbox{\includegraphics{vitruvian}}\par} + +Now it is resized. Here we allow down to 50\% of scale: + +{\centering\fitbox[minheight=0.5\fitboxnatheight, + minwidth=0.5\fitboxnatwidth]{\includegraphics{vitruvian}}\par} + + + + +Now we make the figure smaller: + +{\centering\fitbox[maxwidth=\fitboxnatwidth, + maxheight=\fitboxnatwidth]{\includegraphics{vitruvian}}\par} + +{\centering\fitbox[maxwidth=\fitboxnatwidth, + maxheight=\fitboxnatwidth]{\includegraphics{vitruvian}}\par} + + + +We leave some space, so the full size figure would not fit anymore: + +{\centering\fitbox{\includegraphics{vitruvian}}\par} + +The figure is now on the next page. Let us leave some space under the +next figure: + +{\centering\fitbox[minheight=0.5\fitboxnatheight, + minwidth=0.5\fitboxnatwidth, + belowboxspace=\baselineskip]{\includegraphics{vitruvian}}\par} +We left some space for a caption. + +\end{document} diff --git a/Master/texmf-dist/doc/latex/fitbox/vitruvian.jpg b/Master/texmf-dist/doc/latex/fitbox/vitruvian.jpg Binary files differnew file mode 100644 index 00000000000..406573b7d0e --- /dev/null +++ b/Master/texmf-dist/doc/latex/fitbox/vitruvian.jpg diff --git a/Master/texmf-dist/source/latex/fitbox/fitbox.dtx b/Master/texmf-dist/source/latex/fitbox/fitbox.dtx new file mode 100644 index 00000000000..2603e758efb --- /dev/null +++ b/Master/texmf-dist/source/latex/fitbox/fitbox.dtx @@ -0,0 +1,366 @@ +% \iffalse +% $Id: fitbox.dtx,v 1.6 2015/08/16 18:11:50 boris Exp $ +% +%% Copyright 2015, Boris Veytsman <borisv@lk.net +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Boris Veytsman +%% +% \begin{macrocode} +%<style>\NeedsTeXFormat{LaTeX2e} +%<*gobble> +\ProvidesFile{fitbox.dtx} +%</gobble> +%<style>\ProvidesPackage{fitbox} +%<*style> +[2015/02/02 v1.00 Fitting boxes on a page] +% \end{macrocode} +%</style> +%<*gobble> +% \fi +% \CheckSum{188} +% +% +%% \CharacterTable +%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +%% Digits \0\1\2\3\4\5\6\7\8\9 +%% Exclamation \! Double quote \" Hash (number) \# +%% Dollar \$ Percent \% Ampersand \& +%% Acute accent \' Left paren \( Right paren \) +%% Asterisk \* Plus \+ Comma \, +%% Minus \- Point \. Solidus \/ +%% Colon \: Semicolon \; Less than \< +%% Equals \= Greater than \> Question mark \? +%% Commercial at \@ Left bracket \[ Backslash \\ +%% Right bracket \] Circumflex \^ Underscore \_ +%% Grave accent \` Left brace \{ Vertical bar \| +%% Right brace \} Tilde \~} +% +%\iffalse +% \begin{macrocode} +\documentclass{ltxdoc} +\usepackage{hypdoc} +\PageIndex +\CodelineIndex +\RecordChanges +\EnableCrossrefs +\begin{document} + \DocInput{fitbox.dtx} +\end{document} +% \end{macrocode} +%</gobble> +% \fi +% \MakeShortVerb{|} +% \GetFileInfo{fitbox.dtx} +% +% +% \title{Fit graphics on a page\thanks{\copyright 2015 Boris Veytsman} +% \thanks{This package was commissined by Neadwerx, \url{http://www.neadwerx.com/}}} +% \author{Boris Veytsman \thanks{borisv@lk.net}} +% \date{\filedate, \fileversion} +% \maketitle +% +% \begin{abstract} +% The \textsl{fitbox} package allows a box (usually an +% |\includegraphics| box) to fit on the page. It scales the box +% to the maximal allowed size within the user-set limits. If there +% there is not enough space on the page, the box is moved to the +% next one. +% \end{abstract} +% +% \tableofcontents +% +% \clearpage +% +%\section{Introduction} +%\label{sec:intro} +% +% How often one puts a picture on a page only to see that \LaTeX\ +% decides to move it to the next one because there is not enough +% space---while shaving a millimeter off the height would make the +% difference? This package is intended to alleviate this difference. +% It uses several strategies to fit a picture on the page, and only if +% they fail, the picture is moved to the next one. +% +%\section{User Guide} +%\label{sec:ug} +% +% +%\subsection{Installation} +%\label{sec:ug_install} +% +% The installation of the class follows the usual +% practice~\cite{TeXFAQ} for \LaTeX{} packages: +% \begin{enumerate} +% \item Run \textsf{latex} on |fitbox.ins|. This will produce the file +% |fitbox.sty|. +% \item Put the file |fitbox.sty| to +% the place where \LaTeX{} can find it (see +% \cite{TeXFAQ} or the documentation for your \TeX{} +% system).\label{item:install} +% \item Update the database of file names. Again, see \cite{TeXFAQ} +% or the documentation for your \TeX{} system for the system-specific +% details.\label{item:update} +% \item The file |fitbox.pdf| provides the documentation for the +% package +% \end{enumerate} +% As an alternative to items~\ref{item:install} and~\ref{item:update} +% you can just put the files in the working directory where your +% |.tex| file is. +% +% +% +%\subsection{Usage} +%\label{sec:usage} +% +% To use the package, add to the preamble of your document +% \begin{verbatim} +% \usepackage{fitbox} +% \end{verbatim} +% +% \DescribeMacro{\fitbox}% +% The main command of the package is +% \cs{fitbox}\oarg{options}\marg{stuff}. The \marg{stuff} will be +% typeset in a box according to the \oarg{options}. In most cases +% \marg{stuff} is an \cs{includegraphics} command, but anything that +% fits into an LR-box can be typeset in this way. +% +% The \marg{stuff} is typeset in a box, and then the box is put on the +% page according to the following algorithm: +% \begin{enumerate} +% \item \TeX\ starts a new paragraph. +% \item The box is scaled up to the maximal dimensions specified by +% the user (while keeping the aspect ratio). +% \item If there is not enough space on the page to fit the box, the +% latter is scaled down as neccessary, but no smaller than the +% minimal dimensions specified by the user. +% \item If there is still not enough space, \TeX\ tries to enlarge the +% page up to the specified limit. +% \item If this also fails, \TeX\ starts a new page and fits the box +% there. +% \end{enumerate} +% +% +% \DescribeMacro{\fitboxset}% +% The options can be set individually for each \cs{fitbox} command, or +% globally using the command \cs{fitboxset}, for example, +% \begin{verbatim} +% \fitboxset{maxwidth=\textwidth, minwidth=\fitboxnatwidth} +% \end{verbatim} +% +% +% \DescribeMacro{\fitboxnatwidth}% +% \DescribeMacro{\fitboxnatheight}% +% The options of the package use key-value interface. Often +% the values are dimensions; in these cases the special dimensions +% \cs{fitboxnatwidth} and \cs{fitboxnatheight} can be used; they are +% equal to natural dimensions of the box. Note that |height| and +% \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} +% \end{verbatim} +% means that the box cannot be scaled down more than 50\%. +% +% The following options are recognized: +% \begin{description} +% \item[maxheight:] The maximal total height of the box. By default +% \cs{textheight}. +% \item[maxwidth:] The maximal width of the box. By default +% \cs{textwidth}. +% \item[minheight:] The minimal height of the box. By default +% \cs{fitboxnatheight}. +% \item[minwidth:] The minimal width of the box. By default +% \cs{fitboxnatwidth}. +% \item[belowboxspace:] The height of the space that must be left +% below the box (e.g. for a caption). By default zero. +% \item[maxenlargepage:] The maximal amount to add to the current +% page. By default zero. +% \end{description} +% +% +%\StopEventually{\clearpage +% \bibliography{fitbox} +% \bibliographystyle{unsrt}} +% +% \clearpage +% +% \section{Implementation} +% \label{sec:implementation} +% +% \begin{macrocode} +%<*style> +% \end{macrocode} +% +% +%\subsection{Setting up parameters} +%\label{sec:params} +% +% +% +% +% \begin{macro}{\fitboxnatheight} +% The total height of the box +% \begin{macrocode} +\newdimen\fitboxnatheight +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\fitboxnatwidth} +% The total width of the box +% \begin{macrocode} +\newdimen\fitboxnatwidth +% \end{macrocode} +% +% \end{macro} +% +% +% +% We use |xkeyval| interface: +% \begin{macrocode} +\RequirePackage{xkeyval} +\define@cmdkeys{FTBX}{maxheight, minheight, maxwidth, minwidth, + belowboxspace, maxenlargepage} +% \end{macrocode} +% +% \begin{macro}{\fitboxset} +% Setting everything +% \begin{macrocode} +\def\fitboxset#1{\setkeys{FTBX}{#1}} +% \end{macrocode} +% +% \end{macro} +% +% The defaults +% \begin{macrocode} +\fitboxset{maxheight=\textheight, minheight=\fitboxnatheight, + maxwidth=\textwidth, minwidth=\fitboxnatwidth, + belowboxspace=0pt, maxenlargepage=0pt} +% \end{macrocode} +% +% +%\subsection{Main command} +%\label{sec:main_command} +% +% \begin{macro}{\FTBX@box} +% The box which will held the stuff to be typeset +% \begin{macrocode} +\newbox\FTBX@box +% \end{macrocode} +% +% \end{macro} +% +% \begin{macro}{\FTBX@desired@maxheight} +% The desired maximal height +\newdimen\FTBX@desired@maxheight +% \end{macro} +% +% +% \begin{macro}{\FTBX@desired@minheight} +% The desired minimal height +\newdimen\FTBX@desired@minheight +% \end{macro} +% +% \begin{macro}{\FTBX@available@height} +% The desired available height +\newdimen\FTBX@available@height +% \end{macro} +% +% \begin{macro}{\fitbox} +% The main command +% \begin{macrocode} +\newcommand\fitbox[2][]{\leavevmode + \fitboxset{#1}% + \setbox\FTBX@box=\hbox{#2}% + \fitboxnatwidth=\wd\FTBX@box\relax + \fitboxnatheight=\ht\FTBX@box\relax + \advance\fitboxnatheight by \dp\FTBX@box\relax + % Checking the sizes + \expandafter\ifdim\cmdKV@FTBX@minwidth>\columnwidth\relax + \PackageWarning{fitbox}{Minimal width is larger than page + width. Adjusting...}% + \def\cmd@KV@FTBX@minwidth{\columnwidth}% + \fi + \expandafter\ifdim\cmdKV@FTBX@maxwidth>\columnwidth\relax + \PackageWarning{fitbox}{Desired width is larger than page + width. Adjusting...}% + \def\cmd@KV@FTBX@maxwidth{\columnwidth}% + \fi + \expandafter\ifdim\cmdKV@FTBX@minheight>\textheight\relax + \PackageWarning{fitbox}{Minimal height is larger than page + height. Adjusting...}% + \def\cmd@KV@FTBX@minheight{\textheight}% + \fi + \expandafter\ifdim\cmdKV@FTBX@maxheight>\textheight\relax + \PackageWarning{fitbox}{Desired height is larger than page + height. Adjusting...}% + \def\cmd@KV@FTBX@maxheight{\textheight}% + \fi + % Calculating the minimal and maximal height + \Gscale@div{\@tempa}{\cmdKV@FTBX@maxwidth}{\fitboxnatwidth}% + \FTBX@desired@maxheight=\@tempa\fitboxnatheight\relax + \expandafter\ifdim\cmdKV@FTBX@maxheight<\FTBX@desired@maxheight\relax + \expandafter\FTBX@desired@maxheight=\cmdKV@FTBX@maxheight\relax + \fi + \Gscale@div{\@tempa}{\cmdKV@FTBX@minwidth}{\fitboxnatwidth}% + \FTBX@desired@minheight=\@tempa\fitboxnatheight\relax + \expandafter\ifdim\cmdKV@FTBX@minheight>\FTBX@desired@minheight\relax + \expandafter\FTBX@desired@minheight=\cmdKV@FTBX@minheight\relax + \fi + \ifdim\FTBX@desired@minheight>\FTBX@desired@maxheight\relax + \PackageWarning{fitbox}{Desired min scale exceeds desired min + scale. Adjusting...}% + \FTBX@desired@minheight=\FTBX@desired@maxheight\relax + \fi + \FTBX@available@height=\pagegoal\relax + \ifdim\FTBX@available@height>\vsize\relax + \FTBX@available@height=\vsize + \fi + \advance\FTBX@available@height by -\pagetotal\relax + \advance\FTBX@available@height by -\cmdKV@FTBX@belowboxspace\relax + \advance\FTBX@available@height by -\baselineskip\relax + \ifdim\FTBX@desired@maxheight>\FTBX@available@height\relax + \ifdim\FTBX@available@height<\FTBX@desired@minheight\relax + \@tempdima=\FTBX@desired@minheight\relax + \advance\@tempdima by + -\FTBX@available@height\relax + \expandafter\ifdim\cmdKV@FTBX@maxenlargepage<\@tempdima\relax + \newpage + \resizebox*{!}{\FTBX@desired@maxheight}{\box\FTBX@box}% + \else + \enlargethispage{\@tempdima}% + \resizebox*{!}{\FTBX@desired@minheight}{\box\FTBX@box}% + \fi + \else + \resizebox*{!}{\FTBX@available@height}{\box\FTBX@box}% + \fi + \else + \resizebox*{!}{\FTBX@desired@maxheight}{\box\FTBX@box}% + \fi +} +% \end{macrocode} +% +% \end{macro} +% +% \begin{macrocode} +%</style> +% \end{macrocode} +%\Finale +%\clearpage +% +%\PrintChanges +%\clearpage +%\PrintIndex +% +\endinput diff --git a/Master/texmf-dist/source/latex/fitbox/fitbox.ins b/Master/texmf-dist/source/latex/fitbox/fitbox.ins new file mode 100644 index 00000000000..6d4e2cf3f0d --- /dev/null +++ b/Master/texmf-dist/source/latex/fitbox/fitbox.ins @@ -0,0 +1,26 @@ +% +% Doctrip file for fitbox +% This file is in public domain +% $Id: fitbox.ins,v 1.1 2015-02-02 19:59:36 boris Exp $ +% +\def\batchfile{fitbox.ins} +\input docstrip +\keepsilent +\showprogress + + +\askforoverwritefalse + +\generate{% + \file{fitbox.sty}{\from{fitbox.dtx}{style}}} + +\obeyspaces +\Msg{*****************************************************}% +\Msg{* Congratulations! You successfully generated the *}% +\Msg{* fitbox package. *}% +\Msg{* *}% +\Msg{* Please move the file fitbox.sty to the place *}% +\Msg{* where LaTeX files are kept in your system *}% +\Msg{* *}% +\Msg{* Happy TeXing! *}% +\Msg{*****************************************************}%
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/fitbox/fitbox.sty b/Master/texmf-dist/tex/latex/fitbox/fitbox.sty new file mode 100644 index 00000000000..4e0d63b964d --- /dev/null +++ b/Master/texmf-dist/tex/latex/fitbox/fitbox.sty @@ -0,0 +1,124 @@ +%% +%% This is file `fitbox.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% fitbox.dtx (with options: `style') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from fitbox.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file fitbox.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% Copyright 2015, Boris Veytsman <borisv@lk.net +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any +%% later version. +%% The latest version of the license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2003/06/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Boris Veytsman +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fitbox} +[2015/02/02 v1.00 Fitting boxes on a page] +\newdimen\fitboxnatheight +\newdimen\fitboxnatwidth +\RequirePackage{xkeyval} +\define@cmdkeys{FTBX}{maxheight, minheight, maxwidth, minwidth, + belowboxspace, maxenlargepage} +\def\fitboxset#1{\setkeys{FTBX}{#1}} +\fitboxset{maxheight=\textheight, minheight=\fitboxnatheight, + maxwidth=\textwidth, minwidth=\fitboxnatwidth, + belowboxspace=0pt, maxenlargepage=0pt} +\newbox\FTBX@box +\newdimen\FTBX@desired@maxheight +\newdimen\FTBX@desired@minheight +\newdimen\FTBX@available@height +\newcommand\fitbox[2][]{\leavevmode + \fitboxset{#1}% + \setbox\FTBX@box=\hbox{#2}% + \fitboxnatwidth=\wd\FTBX@box\relax + \fitboxnatheight=\ht\FTBX@box\relax + \advance\fitboxnatheight by \dp\FTBX@box\relax + % Checking the sizes + \expandafter\ifdim\cmdKV@FTBX@minwidth>\columnwidth\relax + \PackageWarning{fitbox}{Minimal width is larger than page + width. Adjusting...}% + \def\cmd@KV@FTBX@minwidth{\columnwidth}% + \fi + \expandafter\ifdim\cmdKV@FTBX@maxwidth>\columnwidth\relax + \PackageWarning{fitbox}{Desired width is larger than page + width. Adjusting...}% + \def\cmd@KV@FTBX@maxwidth{\columnwidth}% + \fi + \expandafter\ifdim\cmdKV@FTBX@minheight>\textheight\relax + \PackageWarning{fitbox}{Minimal height is larger than page + height. Adjusting...}% + \def\cmd@KV@FTBX@minheight{\textheight}% + \fi + \expandafter\ifdim\cmdKV@FTBX@maxheight>\textheight\relax + \PackageWarning{fitbox}{Desired height is larger than page + height. Adjusting...}% + \def\cmd@KV@FTBX@maxheight{\textheight}% + \fi + % Calculating the minimal and maximal height + \Gscale@div{\@tempa}{\cmdKV@FTBX@maxwidth}{\fitboxnatwidth}% + \FTBX@desired@maxheight=\@tempa\fitboxnatheight\relax + \expandafter\ifdim\cmdKV@FTBX@maxheight<\FTBX@desired@maxheight\relax + \expandafter\FTBX@desired@maxheight=\cmdKV@FTBX@maxheight\relax + \fi + \Gscale@div{\@tempa}{\cmdKV@FTBX@minwidth}{\fitboxnatwidth}% + \FTBX@desired@minheight=\@tempa\fitboxnatheight\relax + \expandafter\ifdim\cmdKV@FTBX@minheight>\FTBX@desired@minheight\relax + \expandafter\FTBX@desired@minheight=\cmdKV@FTBX@minheight\relax + \fi + \ifdim\FTBX@desired@minheight>\FTBX@desired@maxheight\relax + \PackageWarning{fitbox}{Desired min scale exceeds desired min + scale. Adjusting...}% + \FTBX@desired@minheight=\FTBX@desired@maxheight\relax + \fi + \FTBX@available@height=\pagegoal\relax + \ifdim\FTBX@available@height>\vsize\relax + \FTBX@available@height=\vsize + \fi + \advance\FTBX@available@height by -\pagetotal\relax + \advance\FTBX@available@height by -\cmdKV@FTBX@belowboxspace\relax + \advance\FTBX@available@height by -\baselineskip\relax + \ifdim\FTBX@desired@maxheight>\FTBX@available@height\relax + \ifdim\FTBX@available@height<\FTBX@desired@minheight\relax + \@tempdima=\FTBX@desired@minheight\relax + \advance\@tempdima by + -\FTBX@available@height\relax + \expandafter\ifdim\cmdKV@FTBX@maxenlargepage<\@tempdima\relax + \newpage + \resizebox*{!}{\FTBX@desired@maxheight}{\box\FTBX@box}% + \else + \enlargethispage{\@tempdima}% + \resizebox*{!}{\FTBX@desired@minheight}{\box\FTBX@box}% + \fi + \else + \resizebox*{!}{\FTBX@available@height}{\box\FTBX@box}% + \fi + \else + \resizebox*{!}{\FTBX@desired@maxheight}{\box\FTBX@box}% + \fi +} +\endinput +%% +%% End of file `fitbox.sty'. diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 3e45a2ae563..7c569ebdbc7 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -235,7 +235,7 @@ my @TLP_working = qw( fetamont feupphdteses feyn feynmf feynmp-auto fge fifinddo-info fifo-stack fig4latex figbas figbib figflow figsize filecontents filedate filehook fileinfo filemod - findhyph fink finstrut fira first-latex-doc fithesis + findhyph fink finstrut fira first-latex-doc fitbox fithesis fix2col fixfoot fixlatvian fixltxhyph fixme fixmetodonotes fixpdfmag fjodor diff --git a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc index 54c35618f6f..e653854d52d 100644 --- a/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-pictures.tlpsrc @@ -40,6 +40,7 @@ depend epspdfconversion depend esk depend fast-diagram depend fig4latex +depend fitbox depend flowchart depend forest depend genealogytree diff --git a/Master/tlpkg/tlpsrc/fitbox.tlpsrc b/Master/tlpkg/tlpsrc/fitbox.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/fitbox.tlpsrc |