diff options
author | Karl Berry <karl@freefriends.org> | 2008-09-08 01:01:40 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-09-08 01:01:40 +0000 |
commit | e12b07d0e9e9f99f79a6c965d873e75901a407f5 (patch) | |
tree | fa980714a44698ba01776452e231f35ca8d46f4b /Master/texmf-dist/tex/latex/boxhandler | |
parent | f895455a9a2877d51ad52bf7dae4b5c8efc00de8 (diff) |
boxhandler update (18aug08)
git-svn-id: svn://tug.org/texlive/trunk@10480 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/boxhandler')
-rw-r--r-- | Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty | 526 |
1 files changed, 302 insertions, 224 deletions
diff --git a/Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty b/Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty index 083fd3b311e..00c1e2cd3ac 100644 --- a/Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty +++ b/Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty @@ -30,8 +30,9 @@ %% arlcaptions.sty. %% \ProvidesPackage{boxhandler} -[2006/07/29 v1.10 - Flexible Captioning Styles and Deferred Box/List Printing] +[2008/08/16 v1.21 + Tools for Optimizing Captions, Presentation, and + Placement of Tables and Figures] \NeedsTeXFormat{LaTeX2e} %% Examples of a number of calls provided in this style are given below, %% in no particular order: @@ -75,7 +76,8 @@ %%|\newsavebox{\mybox} |\\ %%|\SaveCBox{\mybox}{\framebox(200,100){Ack!}} |\\ %%| |\\ -%%|\ReciteFigure[h]{\figcapii}{\figii}{\figcapwdthii} |\\ +%%|\ReciteFigure[h]{\figcapii}{\figii}{\figcapwdthii}% |\\ +%%| {\figwrapii}{\figwrapstatusii} |\\ %% %% \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 @@ -93,6 +95,7 @@ %% Grave accent \` Left brace \{ Vertical bar \| %% Right brace \} Tilde \~} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{ifthen} \usepackage{pbox} \newcounter{TableIndex} \setcounter{TableIndex}{0} \newcounter{FigureIndex} \setcounter{FigureIndex}{0} @@ -142,6 +145,7 @@ %% WITHIN-CAPTION JUSTIFICATION CAN BE SET %% OPTIONS: {}, {\raggedleft}, {\raggedright}, or {\centering} \def\CaptionJustification{} % <---DEFAULT IS FULL JUSTIFICATION + %% WORKING VARIABLES \newlength\DeadMargin \newlength\@DataBoxWidth @@ -152,265 +156,339 @@ \newlength\@captionWidth \newlength\@DataBoxSurplus -\newcommand\bxtable[3][t]{ - \StoreTable[#1]{#2}{#3} - \ifnum \arabic{promptTablesFlag} = 1 - \addtocounter{TableClearedIndex}{1} - \def\TableBoxLabel{tbl\roman{TableIndex}} - \def\TableCaptionLabel{tblcap\roman{TableIndex}} - \def\TblCaptionWidthLabel{tblcapwdth\roman{TableIndex}} - \ReciteTable[#1]{\csname\TableCaptionLabel\endcsname} - {\csname\TableBoxLabel\endcsname} - {\csname\TblCaptionWidthLabel\endcsname} +%% FIGURE & TABLE WRAPPER INITIALIZATIONS +\def\wrapper{F} +\def\WrapperTextStyle{\bf\small} +\def\WrapperTextDefault{DEFAULT WRAPPER} +\global\def\WrapperText{\noexpand\WrapperTextStyle\WrapperTextDefault} +\newcommand\WrapperOn[1][]{% + \def\wrapper{T}% + \ifthenelse{\equal{#1}{}}% + {}{\def\WrapperTextDefault{\noexpand#1}}% + \global\def% + \WrapperText{\noexpand\WrapperTextStyle\WrapperTextDefault}% +} +\newcommand\WrapperOff{\def\wrapper{F}} +\newcommand\Wrapper[1]{\global\def% + \WrapperText{\noexpand\WrapperTextStyle\noexpand#1}} + +\newcommand\bxtable[3][t]{% + \StoreTable[#1]{#2}{#3}{\WrapperText}{\wrapper}% + \ifnum\arabic{promptTablesFlag}=1% + \addtocounter{TableClearedIndex}{1}% + \def\TableBoxLabel{tbl\roman{TableIndex}}% + \def\TableCaptionLabel{tblcap\roman{TableIndex}}% + \def\TblCaptionWidthLabel{tblcapwdth\roman{TableIndex}}% + \def\TableWrapper{tblwrap\roman{TableIndex}}% + \def\WrapperStatus{tblwrapstatus\roman{TableIndex}}% + \ReciteTable[#1]{\csname\TableCaptionLabel\endcsname}% + {\csname\TableBoxLabel\endcsname}% + {\csname\TblCaptionWidthLabel\endcsname}% + {\csname\TableWrapper\endcsname}% + {\csname\WrapperStatus\endcsname}% \fi } -\newcommand\StoreTable[3][]{ - \addtocounter{TableIndex}{1} - \setlength\DeadMargin\TableDeadMargin - \def\TableBoxLabel{tbl\roman{TableIndex}} - \def\TableCaptionLabel{tblcap\roman{TableIndex}} - \def\TblCaptionWidthLabel{tblcapwdth\roman{TableIndex}} - \expandafter\SaveCBox\csname\TableBoxLabel\endcsname{\TableFontSize#3} - \expandafter\def\csname\TableCaptionLabel\endcsname{#2} - \expandafter\newlength\csname\TblCaptionWidthLabel\endcsname - \expandafter\setlength\csname\TblCaptionWidthLabel\endcsname - \CaptionBoxWidth -} - -\newcommand\ReciteTable[4][h]{ - \begin{table}[#1] - \begin{\LRTablePlacement} - \let\@makecaption \new@makecaption - \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@} - \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@} - \set@DataBoxWidth{#3} - \setlength\CaptionBoxWidth{#4} - \set@BoxOffsets +\newcommand\StoreTable[5][]{% + \addtocounter{TableIndex}{1}% + \setlength\DeadMargin\TableDeadMargin% + \def\TableBoxLabel{tbl\roman{TableIndex}}% + \def\TableCaptionLabel{tblcap\roman{TableIndex}}% + \def\TblCaptionWidthLabel{tblcapwdth\roman{TableIndex}}% + \def\TableWrapper{tblwrap\roman{TableIndex}}% + \def\WrapperStatus{tblwrapstatus\roman{TableIndex}}% + \expandafter\SaveCBox\csname\TableBoxLabel\endcsname{\TableFontSize#3}% + \expandafter\def\csname\TableCaptionLabel\endcsname{#2}% + \expandafter\newlength\csname\TblCaptionWidthLabel\endcsname% + \expandafter\setlength\csname\TblCaptionWidthLabel\endcsname% + \CaptionBoxWidth% + \expandafter\edef\csname\TableWrapper\endcsname{#4}% + \expandafter\edef\csname\WrapperStatus\endcsname{#5}% +%% After storing table, reset wrapper to default value + \global\def% + \WrapperText{\noexpand\WrapperTextStyle\WrapperTextDefault}% +} + +\newcommand\ReciteTable[6][h]{% + \begin{table}[#1]% + \begin{\LRTablePlacement}% + \let\@makecaption\new@makecaption% + \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@}% + \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@}% + \set@DataBoxWidth{#3}% + \setlength\CaptionBoxWidth{#4}% + \set@BoxOffsets% + \if T#6% + \rule{\@DataBoxOffset}{0in}% + \makebox[\@DataBoxWidth][l]{#5}% + \rule{\@DataBoxOffset}{0in}\\% + \fi \rule{\@CaptionBoxOffset}{0em}% - \parbox{\CaptionBoxWidth}{\caption {#2}}% + \parbox{\CaptionBoxWidth}{\caption{#2}}% \rule{\@CaptionBoxOffset}{0em}% - \par + \par% \rule{\@DataBoxOffset}{0in}% - \usebox{#3} + \usebox{#3}% + \rule{\@DataBoxOffset}{0in}\\% + \if T#6% + \rule{\@DataBoxOffset}{0in}\\% + \makebox[\@DataBoxWidth][r]{#5}% \rule{\@DataBoxOffset}{0in}% - \let\@makecaption \old@makecaption - \setlength\abovecaptionskip \oldabovecaptionskip - \setlength\belowcaptionskip \oldbelowcaptionskip - \end{\LRTablePlacement} - \end{table} + \fi + \let\@makecaption\old@makecaption% + \setlength\abovecaptionskip \oldabovecaptionskip% + \setlength\belowcaptionskip \oldbelowcaptionskip% + \end{\LRTablePlacement}% + \end{table}% } -\newcommand\nextTable[1][h]{ - \ifnum \arabic{TableClearedIndex} < \arabic{TableIndex}{ - \addtocounter{TableClearedIndex}{1} +\newcommand\nextTable[1][h]{% + \ifnum\arabic{TableClearedIndex}<\arabic{TableIndex}{% + \addtocounter{TableClearedIndex}{1}% %% \TableBoxLabel : tbli, tblii, tbliii, tbliv, etc. %% \TableCaptionLabel : tblcapi, tblcapii, tblcapiii, tblcapiv, etc. %% \TblCaptionWidthLabel: tblcapwdthi, tblcapwdthii, tblcapwdthiii,etc. - \def\TableBoxLabel{tbl\roman{TableClearedIndex}} - \def\TableCaptionLabel{tblcap\roman{TableClearedIndex}} - \def\TblCaptionWidthLabel{tblcapwdth\roman{TableClearedIndex}} - \ReciteTable[#1]{\csname\TableCaptionLabel\endcsname} - {\csname\TableBoxLabel\endcsname} - {\csname\TblCaptionWidthLabel\endcsname} + \def\TableBoxLabel{tbl\roman{TableClearedIndex}}% + \def\TableCaptionLabel{tblcap\roman{TableClearedIndex}}% + \def\TblCaptionWidthLabel{tblcapwdth\roman{TableClearedIndex}}% + \def\TableWrapper{tblwrap\roman{TableClearedIndex}}% + \def\WrapperStatus{tblwrapstatus\roman{TableClearedIndex}}% + \ReciteTable[#1]{\csname\TableCaptionLabel\endcsname}% + {\csname\TableBoxLabel\endcsname}% + {\csname\TblCaptionWidthLabel\endcsname}% + {\csname\TableWrapper\endcsname}% + {\csname\WrapperStatus\endcsname}% }\fi } -\newcommand\clearTables{ - \clearpage - \clearlistoftables - \clearpage +\newcommand\clearTables{% + \clearpage% + \clearlistoftables% + \clearpage% %%DO UNTIL ALL HELD TABLES ARE CLEARED - \whiledo{\arabic{TableClearedIndex} < \arabic{TableIndex}}{ - \addtocounter{TableClearedIndex}{1} + \whiledo{\arabic{TableClearedIndex}<\arabic{TableIndex}}{% + \addtocounter{TableClearedIndex}{1}% %% \TableBoxLabel : tbli, tblii, tbliii, tbliv, etc. %% \TableCaptionLabel : tblcapi, tblcapii, tblcapiii, tblcapiv, etc. %% \TblCaptionWidthLabel: tblcapwdthi, tblcapwdthii, tblcapwdthiii,etc. - \def\TableBoxLabel{tbl\roman{TableClearedIndex}} - \def\TableCaptionLabel{tblcap\roman{TableClearedIndex}} - \def\TblCaptionWidthLabel{tblcapwdth\roman{TableClearedIndex}} - \theClearedTable{\csname\TableCaptionLabel\endcsname} - {\csname\TableBoxLabel\endcsname} - {\csname\TblCaptionWidthLabel\endcsname} - } + \def\TableBoxLabel{tbl\roman{TableClearedIndex}}% + \def\TableCaptionLabel{tblcap\roman{TableClearedIndex}}% + \def\TblCaptionWidthLabel{tblcapwdth\roman{TableClearedIndex}}% + \def\TableWrapper{tblwrap\roman{TableClearedIndex}}% + \def\WrapperStatus{tblwrapstatus\roman{TableClearedIndex}}% + \theClearedTable{\csname\TableCaptionLabel\endcsname}% + {\csname\TableBoxLabel\endcsname}% + {\csname\TblCaptionWidthLabel\endcsname}% + {\csname\TableWrapper\endcsname}% + {\csname\WrapperStatus\endcsname}% + }% } %% \theClearedTable CAN BE RENEWED IF DIFFERENT OUTPUT FORMAT IS DESIRED -\newcommand\theClearedTable[4][h]{ +\newcommand\theClearedTable[6][h]{% %% CLEAR THIS TABLE ON A PAGE BY ITSELF, CENTERED VERTICALLY - \vspace*{\fill} - \ReciteTable[#1]{#2}{#3}{#4} - \vspace*{\fill} - \clearpage -} - -\newcommand\bxfigure[3][t]{ - \StoreFigure[#1]{#2}{#3} - \ifnum \arabic{promptFiguresFlag} = 1 - \addtocounter{FigureClearedIndex}{1} - \def\FigureBoxLabel{fig\roman{FigureIndex}} - \def\FigureCaptionLabel{figcap\roman{FigureIndex}} - \def\FigCaptionWidthLabel{figcapwdth\roman{FigureIndex}} - \ReciteFigure[#1]{\csname\FigureCaptionLabel\endcsname} - {\csname\FigureBoxLabel\endcsname} - {\csname\FigCaptionWidthLabel\endcsname} + \vspace*{\fill}% + \ReciteTable[#1]{#2}{#3}{#4}{#5}{#6}% + \vspace*{\fill}% + \clearpage% +} + +\newcommand\bxfigure[3][t]{% + \StoreFigure[#1]{#2}{#3}{\WrapperText}{\wrapper}% + \ifnum\arabic{promptFiguresFlag}=1% + \addtocounter{FigureClearedIndex}{1}% + \def\FigureBoxLabel{fig\roman{FigureIndex}}% + \def\FigureCaptionLabel{figcap\roman{FigureIndex}}% + \def\FigCaptionWidthLabel{figcapwdth\roman{FigureIndex}}% + \def\FigureWrapper{figwrap\roman{FigureIndex}}% + \def\WrapperStatus{figwrapstatus\roman{FigureIndex}}% + \ReciteFigure[#1]{\csname\FigureCaptionLabel\endcsname}% + {\csname\FigureBoxLabel\endcsname}% + {\csname\FigCaptionWidthLabel\endcsname}% + {\csname\FigureWrapper\endcsname}% + {\csname\WrapperStatus\endcsname}% \fi } -\newcommand\StoreFigure[3][]{ - \addtocounter{FigureIndex}{1} - \setlength\DeadMargin\FigureDeadMargin - \def\FigureBoxLabel{fig\roman{FigureIndex}} - \def\FigureCaptionLabel{figcap\roman{FigureIndex}} - \def\FigCaptionWidthLabel{figcapwdth\roman{FigureIndex}} - \expandafter\SaveCBox\csname\FigureBoxLabel\endcsname{#3} - \expandafter\def\csname\FigureCaptionLabel\endcsname{#2} - \expandafter\newlength\csname\FigCaptionWidthLabel\endcsname - \expandafter\setlength\csname\FigCaptionWidthLabel\endcsname - \CaptionBoxWidth -} - -\newcommand\ReciteFigure[4][h]{ - \begin{figure}[#1] - \begin{\LRFigurePlacement} - \let\@makecaption \new@makecaption - \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@} - \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@} - \set@DataBoxWidth{#3} - \setlength\CaptionBoxWidth{#4} - \set@BoxOffsets +\newcommand\StoreFigure[5][]{% + \addtocounter{FigureIndex}{1}% + \setlength\DeadMargin\FigureDeadMargin% + \def\FigureBoxLabel{fig\roman{FigureIndex}}% + \def\FigureCaptionLabel{figcap\roman{FigureIndex}}% + \def\FigCaptionWidthLabel{figcapwdth\roman{FigureIndex}}% + \def\FigureWrapper{figwrap\roman{FigureIndex}}% + \def\WrapperStatus{figwrapstatus\roman{FigureIndex}}% + \expandafter\SaveCBox\csname\FigureBoxLabel\endcsname{#3}% + \expandafter\def\csname\FigureCaptionLabel\endcsname{#2}% + \expandafter\newlength\csname\FigCaptionWidthLabel\endcsname% + \expandafter\setlength\csname\FigCaptionWidthLabel\endcsname% + \CaptionBoxWidth% + \expandafter\edef\csname\FigureWrapper\endcsname{#4}% + \expandafter\edef\csname\WrapperStatus\endcsname{#5}% +%% After storing figure, reset wrapper to default value + \global\def% + \WrapperText{\noexpand\WrapperTextStyle\WrapperTextDefault}% +} + +\newcommand\ReciteFigure[6][h]{% + \begin{figure}[#1]% + \begin{\LRFigurePlacement}% + \let\@makecaption\new@makecaption% + \setlength\abovecaptionskip{\arabic{abovecaptionskipterm}\p@}% + \setlength\belowcaptionskip{\arabic{belowcaptionskipterm}\p@}% + \set@DataBoxWidth{#3}% + \setlength\CaptionBoxWidth{#4}% + \set@BoxOffsets% + \if T#6% + \rule{\@DataBoxOffset}{0in}% + \makebox[\@DataBoxWidth][l]{#5}% + \rule{\@DataBoxOffset}{0in}\\% + \fi \rule{\@DataBoxOffset}{0in}% \usebox{#3}% \rule{\@DataBoxOffset}{0in}% - \par + \par% \rule{\@CaptionBoxOffset}{0em}% - \parbox{\CaptionBoxWidth}{\caption {#2}}% + \parbox{\CaptionBoxWidth}{\caption{#2}}% \rule{\@CaptionBoxOffset}{0em}% - \let\@makecaption \old@makecaption - \setlength\abovecaptionskip \oldabovecaptionskip - \setlength\belowcaptionskip \oldbelowcaptionskip - \end{\LRFigurePlacement} - \end{figure} -} - -\newcommand\nextFigure[1][h]{ - \ifnum \arabic{FigureClearedIndex} < \arabic{FigureIndex}{ - \addtocounter{FigureClearedIndex}{1} + \if T#6% + \rule{\@DataBoxOffset}{0in}\\% + \makebox[\@DataBoxWidth][r]{#5}% + \rule{\@DataBoxOffset}{0in}% + \fi + \let\@makecaption\old@makecaption% + \setlength\abovecaptionskip\oldabovecaptionskip% + \setlength\belowcaptionskip\oldbelowcaptionskip% + \end{\LRFigurePlacement}% + \end{figure}% +} + +\newcommand\nextFigure[1][h]{% + \ifnum\arabic{FigureClearedIndex}<\arabic{FigureIndex}{% + \addtocounter{FigureClearedIndex}{1}% %% \FigureBoxLabel: : figi, figii, figiii, figiv, etc. %% \FigureCaptionLabel : figcapi, figcapii, figcapiii, figcapiv, etc. %% \FigCaptionWidthLabel: figcapwdthi, figcapwdthii, figcapwdthiii,etc. - \def\FigureBoxLabel{fig\roman{FigureClearedIndex}} - \def\FigureCaptionLabel{figcap\roman{FigureClearedIndex}} - \def\FigCaptionWidthLabel{figcapwdth\roman{FigureClearedIndex}} - \ReciteFigure[#1]{\csname\FigureCaptionLabel\endcsname} - {\csname\FigureBoxLabel\endcsname} - {\csname\FigCaptionWidthLabel\endcsname} + \def\FigureBoxLabel{fig\roman{FigureClearedIndex}}% + \def\FigureCaptionLabel{figcap\roman{FigureClearedIndex}}% + \def\FigCaptionWidthLabel{figcapwdth\roman{FigureClearedIndex}}% + \def\FigureWrapper{figwrap\roman{FigureClearedIndex}}% + \def\WrapperStatus{figwrapstatus\roman{FigureClearedIndex}}% + \ReciteFigure[#1]{\csname\FigureCaptionLabel\endcsname}% + {\csname\FigureBoxLabel\endcsname}% + {\csname\FigCaptionWidthLabel\endcsname}% + {\csname\FigureWrapper\endcsname}% + {\csname\WrapperStatus\endcsname}% }\fi } -\newcommand\clearFigures{ - \clearpage - \clearlistoffigures - \clearpage +\newcommand\clearFigures{% + \clearpage% + \clearlistoffigures% + \clearpage% %%DO UNTIL ALL HELD FIGURES ARE CLEARED - \whiledo{\arabic{FigureClearedIndex} < \arabic{FigureIndex}}{ - \addtocounter{FigureClearedIndex}{1} -%% \FigureBoxLabel: : figi, figii, figiii, figiv, etc. + \whiledo{\arabic{FigureClearedIndex}<\arabic{FigureIndex}}{% + \addtocounter{FigureClearedIndex}{1}% +%% \FigureBoxLabel : figi, figii, figiii, figiv, etc. %% \FigureCaptionLabel : figcapi, figcapii, figcapiii, figcapiv, etc. %% \FigCaptionWidthLabel: figcapwdthi, figcapwdthii, figcapwdthiii,etc. - \def\FigureBoxLabel{fig\roman{FigureClearedIndex}} - \def\FigureCaptionLabel{figcap\roman{FigureClearedIndex}} - \def\FigCaptionWidthLabel{figcapwdth\roman{FigureClearedIndex}} - \theClearedFigure{\csname\FigureCaptionLabel\endcsname} - {\csname\FigureBoxLabel\endcsname} - {\csname\FigCaptionWidthLabel\endcsname} - } + \def\FigureBoxLabel{fig\roman{FigureClearedIndex}}% + \def\FigureCaptionLabel{figcap\roman{FigureClearedIndex}}% + \def\FigCaptionWidthLabel{figcapwdth\roman{FigureClearedIndex}}% + \def\FigureWrapper{figwrap\roman{FigureClearedIndex}}% + \def\WrapperStatus{figwrapstatus\roman{FigureClearedIndex}}% + \theClearedFigure{\csname\FigureCaptionLabel\endcsname}% + {\csname\FigureBoxLabel\endcsname}% + {\csname\FigCaptionWidthLabel\endcsname}% + {\csname\FigureWrapper\endcsname}% + {\csname\WrapperStatus\endcsname}% + }% } %% \theClearedFigure CAN BE RENEWED IF DIFFERENT OUTPUT FORMAT DESIRED -\newcommand\theClearedFigure[4][h]{ +\newcommand\theClearedFigure[6][h]{% %% CLEAR THIS FIGURE ON A PAGE BY ITSELF, CENTERED VERTICALLY - \vspace*{\fill} - \ReciteFigure[#1]{#2}{#3}{#4} - \vspace*{\fill} - \clearpage + \vspace*{\fill}% + \ReciteFigure[#1]{#2}{#3}{#4}{#5}{#6}% + \vspace*{\fill}% + \clearpage% } -\newcommand\relaxCaptionWidth[1][\@minCaptionBoxWidthDefault]{ - \setlength\@minCaptionBoxWidth{#1} - \ifdim \@minCaptionBoxWidth > \@maxCaptionBoxWidth - \setlength\@maxCaptionBoxWidth\@minCaptionBoxWidth +\newcommand\relaxCaptionWidth[1][\@minCaptionBoxWidthDefault]{% + \setlength\@minCaptionBoxWidth{#1}% + \ifdim \@minCaptionBoxWidth > \@maxCaptionBoxWidth% + \setlength\@maxCaptionBoxWidth\@minCaptionBoxWidth% \fi } \relaxCaptionWidth% SET INITIAL \@minCaptionBoxWidth TO DEFAULT VALUE -\newcommand\limitCaptionWidth[1][\@maxCaptionBoxWidthDefault]{ - \setlength\@maxCaptionBoxWidth{#1} - \ifdim \@maxCaptionBoxWidth < \@minCaptionBoxWidth - \setlength\@minCaptionBoxWidth\@maxCaptionBoxWidth +\newcommand\limitCaptionWidth[1][\@maxCaptionBoxWidthDefault]{% + \setlength\@maxCaptionBoxWidth{#1}% + \ifdim \@maxCaptionBoxWidth < \@minCaptionBoxWidth% + \setlength\@minCaptionBoxWidth\@maxCaptionBoxWidth% \fi } \limitCaptionWidth% SET INITIAL \@maxCaptionBoxWidth TO DEFAULT VALUE -\newcommand\constrainCaptionWidth[2][-1in]{ - \ifdim #1 < 0in - \setlength\@minCaptionBoxWidth{#2} - \setlength\@maxCaptionBoxWidth{#2} +\newcommand\constrainCaptionWidth[2][-1in]{% + \ifdim #1 < 0in% + \setlength\@minCaptionBoxWidth{#2}% + \setlength\@maxCaptionBoxWidth{#2}% \else - \ifdim #1 < #2 - \setlength\@minCaptionBoxWidth{#1} - \setlength\@maxCaptionBoxWidth{#2} + \ifdim #1 < #2% + \setlength\@minCaptionBoxWidth{#1}% + \setlength\@maxCaptionBoxWidth{#2}% \else - \setlength\@minCaptionBoxWidth{#2} - \setlength\@maxCaptionBoxWidth{#1} + \setlength\@minCaptionBoxWidth{#2}% + \setlength\@maxCaptionBoxWidth{#1}% \fi \fi } -\newcommand\SaveCBox[2]{ - \newsavebox{#1} - \sbox{#1}{#2} - \set@BoxWidths{#1} +\newcommand\SaveCBox[2]{% + \newsavebox{#1}% + \sbox{#1}{#2}% + \set@BoxWidths{#1}% } -\newcommand\set@BoxWidths[1]{% of DataBox & CaptionBox (-2\DeadMargin) - \set@DataBoxWidth{#1} - \set@CaptionBoxWidth +\newcommand\set@BoxWidths[1]{% of DataBox & CaptionBox (-2\DeadMargin)% + \set@DataBoxWidth{#1}% + \set@CaptionBoxWidth% } -\newcommand\set@DataBoxWidth[1]{ - \setlength {\@DataBoxWidth}{\widthof{\usebox{#1}}} +\newcommand\set@DataBoxWidth[1]{% + \setlength {\@DataBoxWidth}{\widthof{\usebox{#1}}}% } -\newcommand\set@CaptionBoxWidth{ - \setlength\CaptionBoxWidth\@DataBoxWidth - \addtolength{\CaptionBoxWidth}{-2\DeadMargin} - \ifdim \CaptionBoxWidth < \@minCaptionBoxWidth - \setlength\CaptionBoxWidth\@minCaptionBoxWidth +\newcommand\set@CaptionBoxWidth{% + \setlength\CaptionBoxWidth\@DataBoxWidth% + \addtolength{\CaptionBoxWidth}{-2\DeadMargin}% + \ifdim \CaptionBoxWidth < \@minCaptionBoxWidth% + \setlength\CaptionBoxWidth\@minCaptionBoxWidth% \fi - \ifdim \CaptionBoxWidth > \@maxCaptionBoxWidth - \setlength\CaptionBoxWidth\@maxCaptionBoxWidth + \ifdim \CaptionBoxWidth > \@maxCaptionBoxWidth% + \setlength\CaptionBoxWidth\@maxCaptionBoxWidth% \fi } -\newcommand\set@BoxOffsets{ - \setlength\@DataBoxSurplus{\@DataBoxWidth} - \addtolength\@DataBoxSurplus{-\CaptionBoxWidth} - \ifdim \@DataBoxSurplus > 0in - \setlength\@CaptionBoxOffset{0.5\@DataBoxSurplus} - \setlength\@DataBoxOffset{0in} +\newcommand\set@BoxOffsets{% + \setlength\@DataBoxSurplus{\@DataBoxWidth}% + \addtolength\@DataBoxSurplus{-\CaptionBoxWidth}% + \ifdim \@DataBoxSurplus > 0in% + \setlength\@CaptionBoxOffset{0.5\@DataBoxSurplus}% + \setlength\@DataBoxOffset{0in}% \else - \setlength\@CaptionBoxOffset{0in} - \setlength\@DataBoxOffset{-0.5\@DataBoxSurplus} + \setlength\@CaptionBoxOffset{0in}% + \setlength\@DataBoxOffset{-0.5\@DataBoxSurplus}% \fi } -\long\def\offset@caption#1#2{ - \setlength\@captionIDwidth{\widthofpbox{\CaptionFontSize{#1.}}} - \addtolength\@captionIDwidth\captionGap - \setlength\@captionWidth\CaptionBoxWidth - \addtolength\@captionWidth{-\@captionIDwidth} - \CaptionFontSize{#1.}\hfill\parbox[t]{\@captionWidth} +\long\def\offset@caption#1#2{% + \setlength\@captionIDwidth{\widthofpbox{\CaptionFontSize{#1.}}}% + \addtolength\@captionIDwidth\captionGap% + \setlength\@captionWidth\CaptionBoxWidth% + \addtolength\@captionWidth{-\@captionIDwidth}% + \CaptionFontSize{#1.}\hfill\parbox[t]{\@captionWidth}% {\CaptionJustification\CaptionFontSize{#2.}}% } @@ -419,42 +497,42 @@ } \long\def\shortleft@caption#1#2{% - \raggedright \CaptionFontSize #1.\rule{\captionGap}{0in}#2.% + \raggedright\CaptionFontSize #1.\rule{\captionGap}{0in}#2.% } \long\def\shortcenter@caption#1#2{% - \centering \CaptionFontSize #1.\rule{\captionGap}{0in}#2.% + \centering\CaptionFontSize #1.\rule{\captionGap}{0in}#2.% } \long\def\shortright@caption#1#2{% - \raggedleft \CaptionFontSize #1.\rule{\captionGap}{0in}#2.% + \raggedleft\CaptionFontSize #1.\rule{\captionGap}{0in}#2.% } \long\def\new@makecaption#1#2{% - \vskip\abovecaptionskip + \vskip\abovecaptionskip% \sbox\@tempboxa{\CaptionFontSize #1.\rule{\captionGap}{0in}#2.}% - \ifdim \wd\@tempboxa >\hsize - \long@caption{#1}{#2} + \ifdim \wd\@tempboxa >\hsize% + \long@caption{#1}{#2}% \else - \short@caption{#1}{#2} + \short@caption{#1}{#2}% \fi - \vskip\belowcaptionskip + \vskip\belowcaptionskip% } -\newcommand\captionStyle[2]{ - \if o#1 \let\long@caption \offset@caption \fi - \if n#1 \let\long@caption \nooffset@caption \fi - \if l#2 \let\short@caption \shortleft@caption \fi - \if c#2 \let\short@caption \shortcenter@caption \fi - \if r#2 \let\short@caption \shortright@caption \fi +\newcommand\captionStyle[2]{% + \if o#1\let\long@caption\offset@caption\fi + \if n#1\let\long@caption\nooffset@caption\fi + \if l#2\let\short@caption\shortleft@caption\fi + \if c#2\let\short@caption\shortcenter@caption\fi + \if r#2\let\short@caption\shortright@caption\fi } %% SET DEFAULT CAPTION STYLE: CAPTION ID OFFSET FOR LONG CAPTIONS, %% SHORT CAPTIONS LEFT ALIGNED \captionStyle{o}{l} -\newcommand\killtableofcontents{ - \renewcommand\tableofcontents{} +\newcommand\killtableofcontents{% + \renewcommand\tableofcontents{}% } %%LIST OF FIGURES HANDLING: @@ -462,20 +540,20 @@ \newcounter{lofPrints} \setcounter{lofPrints}{0} \let\oldlistoffigures\listoffigures -\newcommand\killlistoffigures{ - \def\oldlistoffigures {} - \renewcommand\listoffigures{} +\newcommand\killlistoffigures{% + \def\oldlistoffigures {}% + \renewcommand\listoffigures{}% } -\newcommand\holdlistoffigures{ - \renewcommand\listoffigures{\addtocounter{lofInvocations}{1}} +\newcommand\holdlistoffigures{% + \renewcommand\listoffigures{\addtocounter{lofInvocations}{1}}% } -\newcommand\clearlistoffigures{ - \whiledo{\arabic{lofPrints} < \arabic{lofInvocations}}{ - \addtocounter{lofPrints}{1} - \oldlistoffigures - } +\newcommand\clearlistoffigures{% + \whiledo{\arabic{lofPrints} < \arabic{lofInvocations}}{% + \addtocounter{lofPrints}{1}% + \oldlistoffigures% + }% } %%LIST OF TABLES HANDLING: @@ -483,20 +561,20 @@ \newcounter{lotPrints} \setcounter{lotPrints}{0} \let\oldlistoftables\listoftables -\newcommand\killlistoftables{ - \def\oldlistoftables {} - \renewcommand\listoftables{} +\newcommand\killlistoftables{% + \def\oldlistoftables {}% + \renewcommand\listoftables{}% } -\newcommand\holdlistoftables{ - \renewcommand\listoftables{\addtocounter{lotInvocations}{1}} +\newcommand\holdlistoftables{% + \renewcommand\listoftables{\addtocounter{lotInvocations}{1}}% } -\newcommand\clearlistoftables{ - \whiledo{\arabic{lotPrints} < \arabic{lotInvocations}}{ - \addtocounter{lotPrints}{1} - \oldlistoftables - } +\newcommand\clearlistoftables{% + \whiledo{\arabic{lotPrints} < \arabic{lotInvocations}}{% + \addtocounter{lotPrints}{1}% + \oldlistoftables% + }% } %% TO RETAIN BACKWARD COMPATIBILITY WITH THE PREDECESSOR TO boxhandler, |