diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/boxhandler/README | 40 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/boxhandler/boxhandler.pdf | bin | 224542 -> 238178 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/boxhandler/boxhandler.dtx | 748 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty | 526 |
4 files changed, 786 insertions, 528 deletions
diff --git a/Master/texmf-dist/doc/latex/boxhandler/README b/Master/texmf-dist/doc/latex/boxhandler/README index 5796322f19a..aeff54b5380 100644 --- a/Master/texmf-dist/doc/latex/boxhandler/README +++ b/Master/texmf-dist/doc/latex/boxhandler/README @@ -1,22 +1,28 @@ The boxhandler package ====================== -This package provides a powerful, yet simple, interface for managing and -manipulating the captions of boxed objects (e.g., tables and figures). -In addition to providing wide flexibility in the presentation style of -the captions, this package, when used in combination with conditionally -compiled LaTeX source codes, provides the ability to defer or preempt -the presentation of figures, tables, and their associated lists. - -In this way, one can, for example, by changing a single line of source -code in the .tex file, change the output of LaTeX from a technical -report with tables and figures interspersed in the text, to a -journal-manuscript submission, with figures collected at the end of -document, as well as lof and lot deferred or preempted. - -These routines for table and figure deferral may also be employed to -allow all your figure and table definitions to reside in a separate file -and yet still print out in the proper location in the document. + Tools for Optimizing Captions, Presentation, and Placement + of Tables and Figures + + +This package facilitates the optimized presentation of LaTeX tables and +figures. Not only can boxhandler conveniently lay out table and figure +captions with a wide variety of stylistic appearances, but allows for +figures and tables to be ``wrapped'' in a manner consistent with many +business and government documents. + +For a document that might appear in different venues with different +formatting, boxhandler very powerfully permits the creation of a LaTeX +source document that can, with a single-line change in the source code, +produce an output that has vastly different layout from the baseline +configuration, not only in terms of caption style, but more importantly +in terms of the locations where figures, tables and lists appear (or +not) in the document. + +Deferral routines also allow one to keep all figure and table data in a +separate source file, while nonetheless producing a document with +figures and tables appearing in the desired location in the document. + Run `boxhandler.ins' through LaTeX to produce boxhandler.sty from boxhandler.dtx. @@ -25,4 +31,4 @@ Run `boxhandler.dtx' through LaTeX to produce the documentation. This program can be redistributed and/or modified, with attribution. Steven Segletes <steven@arl.army.mil> - 29 July 2006 + 16 August 2008 diff --git a/Master/texmf-dist/doc/latex/boxhandler/boxhandler.pdf b/Master/texmf-dist/doc/latex/boxhandler/boxhandler.pdf Binary files differindex e8eb5e3659f..def9585ce2b 100644 --- a/Master/texmf-dist/doc/latex/boxhandler/boxhandler.pdf +++ b/Master/texmf-dist/doc/latex/boxhandler/boxhandler.pdf diff --git a/Master/texmf-dist/source/latex/boxhandler/boxhandler.dtx b/Master/texmf-dist/source/latex/boxhandler/boxhandler.dtx index c9f692b48cf..644aab9c6e1 100644 --- a/Master/texmf-dist/source/latex/boxhandler/boxhandler.dtx +++ b/Master/texmf-dist/source/latex/boxhandler/boxhandler.dtx @@ -1,4 +1,4 @@ -% \CheckSum{726} +% \CheckSum{930} % \iffalse %% %% boxhandler.sty @@ -10,8 +10,9 @@ %% arlcaptions.sty. %% %<package>\ProvidesPackage{boxhandler} -%<package>[2006/07/29 v1.10 -%<package> Flexible Captioning Styles and Deferred Box/List Printing] +%<package>[2008/08/16 v1.21 +%<package> Tools for Optimizing Captions, Presentation, and +%<package> Placement of Tables and Figures] %<package>\NeedsTeXFormat{LaTeX2e} %<*driver> % V1.02-Corrected minor grammar issue in documentation. @@ -26,6 +27,12 @@ % a single table or figure at a time. % -explained in documentation how to handle captions with % citations in boxhandler environment. +% V1.11-added RequirePackage{ifthen}, which should have been there +% all along (got by, since pbox required it). +% -corrected a typo. +% V1.12-added % to end of every key line to prevent extraneous spaces. +% V1.20-added support for figure and table wrappers +% V1.21-modified documentation slightly \documentclass{ltxdoc} \usepackage{boxhandler} \DisableCrossrefs @@ -53,18 +60,22 @@ % \fi % \parskip 1ex % \begin{abstract} -% This package facilitates the handling of \LaTeX{} -% tables and figures, especially for conditionally compiled documents. -% With these tools, not only can one conveniently define table and figure -% captions with a wide variety of stylistic appearances, but one can -% create a single \LaTeX{} document that can, with a single-line change +% This package facilitates the optimized presentation of \LaTeX{} +% tables and figures. +% Not only can boxhandler conveniently lay out table and figure +% captions with a wide variety of stylistic appearances, but allows +% for figures and tables to be ``wrapped'' in a manner consistent with +% many business and government documents. For a document that might +% appear in different venues with different formatting, boxhandler +% very powerfully permits the creation of a \LaTeX{} source +% document that can, with a single-line change % in the source code, produce an output that has vastly different layout % from the baseline configuration, both in terms of caption style, % and in terms of the locations where figures, tables and lists -% appear (or not) in the document. The deferral routines also allow -% one to keep all figure and table data in a separate file, which -% nonetheless produces a document with figures and tables appearing -% in the proper location in the document. +% appear (or not) in the document. Deferral routines also allow +% one to keep all figure and table data in a separate source file, while +% nonetheless producing a document with figures and tables appearing +% in the desired location in the document. % % \end{abstract} % @@ -161,7 +172,7 @@ % \ref{tbl:wide}. In the first table, the default minimum caption width % of 1~inch is retained, resulting in an unwieldy caption. The second % table has been printed following an invocation of -% |\relaxCaptionWidth[4.0in]|. Using |\relaxcaption| with no argument +% |\relaxCaptionWidth[4.0in]|. Using |\relaxCaptionWidth| with no argument % resets the minimum allowed caption width to the default value of 1 % inch. % @@ -326,16 +337,6 @@ % bxfigure, and do not affect the |\abovecaptionskip| and % |\belowcaptionskip| definitions intrinsic to your default document % class. -% \begin{picture} (0,0) -% \put(-63,191){\makebox(20,0)[l] -% {\small\tt\bs abovecaption-}} -% \put(-63,182){\makebox(20,0)[l] -% {\small~~|skipterm| = 3~~$\rightarrow$}} -% \put(-90,164){\makebox(20,0)[l] -% {\small\tt\bs FigureDeadMargin\rm = 1em~$\uparrow$}} -% \put(-90,155){\makebox(20,0)[l] -% {\small (1em on left; 1em on right)}} -% \end{picture} % % \DescribeMacro{\CaptionFontSize} % |\CaptionFontSize| defines the default size of the caption font, for @@ -363,44 +364,102 @@ % caption box, the definition should be set to |\raggedright|. For the % brave and daring, |\raggedleft| and/or |\centering| can be explored. % Use |\def\CaptionJustification{}| to reset subsequent captions for full -% flushing. +% flushing.% % % Figure~\ref{fig:ragged} is provided to demonstrate some of these % features including: caption justification (|\raggedright|), caption gap % (2.5~ex), caption font size (|\scriptsize|), LR figure placement % (|flushright|), |abovecaptionskipterm| (3), and a value for % |\FigureDeadMargin| of 1em. +% \clearpage% +% \captionStyle{o}{l}% +% \setlength\captionGap{2.5ex}% +% \def\CaptionJustification{\raggedright}% +% \let\CaptionFontSize\scriptsize% +% \setcounter{abovecaptionskipterm}{3}% +% \def\LRFigurePlacement{flushright}% +% \setlength\FigureDeadMargin{1em}% +% \bxfigure[t]{Here is one example of a caption that has been set for% +% a ragged right justification. Justification, or ``flushing,''% +% is different than caption alignment, which is specified% +% independently and deals with how short captions are% +% aligned with respect to the boxed object\label{fig:ragged}}% +% {\framebox(263,60)% +% {\parbox{3.5in}{Boxed Object:\\% +% \small \hspace*{2.05in}% +% |flushright| \textit{placement $\rightarrow$\\% +% \hspace*{.17in} \uq 2.5ex \hspace*{0.45in}% +% \tt\bs\rm|scriptsize|\iq\\% +% caption gap \hfill caption font size \hfill% +% \uq\tt\bs\rm{|raggedright|} \iq justification}\\% +% \hspace*{.50in} $\downarrow$ \hfill $\downarrow$% +% \hfill \hfill $\downarrow$~~~}% +% }% +% }% +% \setlength\captionGap{1ex}% +% \def\CaptionJustification{}% +% \let\CaptionFontSize\small% +% \setcounter{abovecaptionskipterm}{10}% +% \def\LRFigurePlacement{center}% +% \setlength\FigureDeadMargin{0em}% +% \begin{picture} (0,0)% +% \put(-4,95){\makebox(20,0)[l]% +% {\small\tt\bs abovecaption-}}% +% \put(-4,86){\makebox(20,0)[l]% +% {\small~~|skipterm| = 3~~$\rightarrow$}}% +% \put(-31,68){\makebox(20,0)[l]% +% {\small\tt\bs FigureDeadMargin\rm = 1em~$\uparrow$}}% +% \put(-31,59){\makebox(20,0)[l]% +% {\small (1em on left; 1em on right)}}% +% \end{picture}% +% \section{Figure and Table ``Wrappers''} +% +% With \boxhandler v1.20, figure and table wrappers have been added. +% A wrapper is here defined to mean an item that bounds a figure or +% table by appearing in the upper-left and lower-right corners of +% the figure or table. It could be an iconic image such as the company +% logo, a reminder such as ``COMPANY PROPRIETARY'', or some other such +% delimiter to the figure/table. The relevant commands to use them are +% as follows: +% +% \begin{verse} +% |\WrapperOn[|\iq default wrapper\uq|]|\\ +% |\WrapperOff|\\ +% |\Wrapper{|\iq custom wrapper\uq|}|\\ +% |\def\WrapperTextStyle{|\iq text style\uq|}|\\ +% \end{verse} +% +% By default, wrappers are turned off in boxhandler. They may be +% activated with the command |\WrapperOn|. The optional argument to +% |\WrapperOn|, which should be used on the initial invocation, +% specifies the default wrapper. Likewise, +% wrappers may be disabled with the command |\WrapperOff|. When wrappers +% are activated, every table and figure subsequently created will be +% wrapped using the default wrapper. +% +% If, however, the user would like +% for a given figure or table to have a custom wrapper different than the +% default, the |\Wrapper{}| command should be used within the second +% mandatory argument of the call to |\bxtable| or |\bxfigure|. That is +% to say, the call to |\Wrapper| should be included within the argument +% where the actual figure or table contents are defined. Here is an +% example +% +% \begin{verse} +% |\bxfigure[h]{Widget details for the XMC-7936}%|\\ +% | {\fbox{\hspace{1in}\rule[-.5ex]{3ex}{3ex} $\rightarrow$%|\\ +% | \rule[-.2ex]{2ex}{2ex}\hspace{1in}}\Wrapper{PROPRIETARY}}%|\\ +% \end{verse} % -% \captionStyle{o}{l} -% \setlength\captionGap{2.5ex} -% \def\CaptionJustification{\raggedright} -% \let\CaptionFontSize\scriptsize -% \setcounter{abovecaptionskipterm}{3} -% \def\LRFigurePlacement{flushright} -% \setlength\FigureDeadMargin{1em} -% \bxfigure[t]{Here is one example of a caption that has been set for -% a ragged right justification. Justification, or ``flushing,'' -% is different than caption alignment, which is specified -% independently and deals with how short captions are -% aligned with respect to the boxed object\label{fig:ragged}} -% {\framebox(263,60) -% {\parbox{3.5in}{Boxed Object:\\ -% \small \hspace*{2.05in} -% |flushright| \textit{placement $\rightarrow$\\ -% \hspace*{.17in} \uq 2.5ex \hspace*{0.45in} -% \tt\bs\rm|scriptsize| \iq \\ -% caption gap \hfill caption font size \hfill -% \uq\tt\bs\rm{|raggedright|} \iq justification}\\ -% \hspace*{.50in} $\downarrow$ \hfill $\downarrow$ -% \hfill \hfill $\downarrow$~~~} -% } -% } -% \setlength\captionGap{1ex} -% \def\CaptionJustification{} -% \let\CaptionFontSize\small -% \setcounter{abovecaptionskipterm}{10} -% \def\LRFigurePlacement{center} -% \setlength\FigureDeadMargin{0em} +% \WrapperOn +% \bxfigure[h]{Widget details for the XMC-7936}% +% {\fbox{\hspace{1in}\rule[-.5ex]{3ex}{3ex} $\rightarrow$% +% \rule[-.2ex]{2ex}{2ex}\hspace{1in}}\Wrapper{PROPRIETARY}% +% } +% \WrapperOff +% Wrapper text (both default and custom) are given a style defined by +% |\WrapperTextStyle|. The default style is small, boldface text, +% |\bf\small|. % % \section{Box and List Deferral/Preemption} % @@ -664,7 +723,7 @@ % % The unique utility of the |\nextTable| and |\nextFigure| commands % is in allowing one to define all the document's figures and tables -% "up front," at the beginning of the document, perhaps even in a +% ``up front,'' at the beginning of the document, perhaps even in a % seperate file that is |\input| into the document. Then, when a table % or figure is referred to in the text, all that need be included in % the main document is an occurance of |\nextTable| or |\nextFigure|. @@ -705,17 +764,19 @@ % |TableIndex, FigureIndex, TableClearedIndex,|\\ % |FigureClearedIndex, promptTablesFlag, promptFiguresFlag|\\ % \underline{Macros:}\\ -% |\StoreTable{|\iq caption\uq|}{|\iq boxed object\uq|}|\\ -% |\StoreFigure{|\iq caption\uq|}{|\iq boxed object\uq|}|\\ +% |\StoreTable{|\iq caption\uq|}{|\iq boxed object\uq +% |}{|\iq wrapper\uq|}{|\iq wrapper status\uq|}|\\ +% |\StoreFigure{|\iq caption\uq|}{|\iq boxed object\uq +% |}{|\iq wrapper\uq|}{|\iq wrapper status\uq|}|\\ % |\SaveCBox{|\iq new cmd\uq|}{|\iq boxed object\uq|}|\\ % |\ReciteTable[|\iq loc\uq|]{|\iq caption\uq|}{|\iq cmd\uq -% |}{|\iq wdth\uq|}|\\ +% |}{|\iq wdth\uq|}{|\iq wrapper\uq|}{|\iq wrapper status\uq|}|\\ % |\ReciteFigure[|\iq loc\uq|]{|\iq caption\uq|}{|\iq cmd\uq -% |}{|\iq wdth\uq|}|\\ +% |}{|\iq wdth\uq|}{|\iq wrapper\uq|}{|\iq wrapper status\uq|}|\\ % |\theClearedTable[|\iq loc\uq|]{|\iq caption\uq|}{|\iq cmd\uq -% |}{|\iq wdth\uq|}|\\ +% |}{|\iq wdth\uq|}{|\iq wrapper\uq|}{|\iq wrapper status\uq|}|\\ % |\theClearedFigure[|\iq loc\uq|]{|\iq caption\uq|}{|\iq cmd\uq -% |}{|\iq wdth\uq|}|\\ +% |}{|\iq wdth\uq|}{|\iq wrapper\uq|}{|\iq wrapper status\uq|}|\\ % \end{verse} % % \DescribeMacro{TableIndex} @@ -746,11 +807,12 @@ % \DescribeMacro{\StoreTable} % \DescribeMacro{\StoreFigure} % The macros |\StoreTable| and |\StoreFigure| use the same form of -% caption and data arguments as |\bxtable| and |\bxfigure|. In fact, the +% caption and data arguments as |\bxtable| and |\bxfigure|, with two +% additional wrapper variables added. In fact, the % |\bx...| commands call upon the |\Store...| macros. The difference % is that the |\StoreTable| and |\StoreFigure| macros will save the % boxed object without printing it, regardless of whether a |\hold...| -% command has been issued. The saved information will consist of three +% command has been issued. The saved information will consist of five % pointers necessary to recreate the table or figure. These pointers % will be named according to \textsf{boxhandler}'s internal naming % convention. @@ -759,20 +821,26 @@ % used by \boxhandler to store the variables for figures and tables. % The saved information resulting from a |\StoreTable| or |\StoreFigure| % command will consist of a pointer to a saved box, a pointer to the -% caption text, and a pointer to the calculated width of the caption box +% caption text, a pointer to the calculated width of the caption box % (based on the state of the \boxhandler parameters at the time of the -% function call). +% function call), and pointers to the wrapper and a flag indicating +% whether wrappers are active for this figure or table. % % The counters |TableIndex| and |FigureIndex| are used to create a unique % part of these pointer names, in the form of |\roman{|\iq % indexname\uq|}|. Saved box pointers have the prefix |tbl-| or |fig-|, % saved caption pointers have the prefix |tblcap-| or |figcap-| and % caption-width pointers have the prefix |tblcapwdth-| and |figcapwdth-|. +% The wrapper pointer has the prefix |tblwrap-| and the pointer to flag +% indicating the status of wrapper activity is |tblwrapstatus-|. % Thus, for example, the fourth invocation of |\bxtable| or |\StoreTable| % will create an sbox named |\tbliv| that is used to store the boxed % (e.g., tabular) data, a pointer |\tblcapiv| that is used to store the -% caption text, and a length pointer |\tblcapwdthiv| that stores the -% value of the calculated caption width. When avoiding creative +% caption text, a length pointer |\tblcapwdthiv| that stores the +% value of the calculated caption width, a wrapper pointer |\tblwrapiv|, +% which stores the wrapper, and a pointer |\tblwrapstatusiv|, which +% stores a `T' or `F' to indicate whether wrappers are currently active +% or not. When avoiding creative % programming, the pointer index (e.g., `iv' in this example) will % correspond to the actual Table or Figure number (i.e., `4') appearing % in the caption ID label. However, it is wise to remember, @@ -853,7 +921,7 @@ %| |\\ %|\newcommand\theClearedTable[4][h]{|\\ %| \vspace*{\fill}|\\ -%| \ReciteTable[#1]{#2}{#3}{#4}|\\ +%| \ReciteTable[#1]{#2}{#3}{#4}{#5}{#6}|\\ %| \vspace*{\fill}|\\ %| \clearpage|\\ %|}|\\ @@ -871,9 +939,9 @@ %| \addtocounter{toggle}{1}|\\ %| \ifnum \arabic{toggle} = 2 \setcounter{toggle}{0} \fi|\\ %| \ifnum \arabic{toggle} = 1|\\ -%| \ReciteTable[t]{#2}{#3}{#4}|\\ +%| \ReciteTable[t]{#2}{#3}{#4}{#5}{#6}|\\ %| \else|\\ -%| \ReciteTable[b]{#2}{#3}{#4}|\\ +%| \ReciteTable[b]{#2}{#3}{#4}{#5}{#6}|\\ %| \clearpage|\\ %| \fi|\\ %|}| @@ -925,7 +993,8 @@ %%|\newsavebox{\mybox} |\\ %%|\SaveCBox{\mybox}{\framebox(200,100){Ack!}} |\\ %%| |\\ -%%|\ReciteFigure[h]{\figcapii}{\figii}{\figcapwdthii} |\\ +%%|\ReciteFigure[h]{\figcapii}{\figii}{\figcapwdthii}% |\\ +%%| {\figwrapii}{\figwrapstatusii} |\\ %% % \vspace{-1em} % \section {Vestigials} @@ -985,6 +1054,7 @@ %% Right brace \} Tilde \~} % \StopEventually{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% \clearpage % \vspace{-0.8em} % \begin{macro}{boxhandler.sty} % \section{Code Listing} @@ -998,9 +1068,10 @@ % \end{macro} % % \begin{macro}{pbox} -% This package makes use of the \textsf{pbox} style package to aid -% in the boxing of captions. +% This package makes use of the \textsf{ifthen} and \textsf{pbox} style +% packages to aid in the boxing of captions. % \begin{macrocode} +\RequirePackage{ifthen} \usepackage{pbox} % \end{macrocode} % \end{macro} @@ -1174,6 +1245,7 @@ %% WITHIN-CAPTION JUSTIFICATION CAN BE SET %% OPTIONS: {}, {\raggedleft}, {\raggedright}, or {\centering} \def\CaptionJustification{} % <---DEFAULT IS FULL JUSTIFICATION + % \end{macrocode} % \end{macro} % @@ -1233,6 +1305,50 @@ % \end{macro} % \end{macro} % \end{macro} +% \begin{macro}{\WrapperOn} +% \begin{macro}{\WrapperOff} +% \begin{macro}{\Wrapper} +% \begin{macro}{\WrapperTextStyle} +% Wrappers are identifying text (or icons) that bound figures and +% tables in the +% upper-left and lower-right corners. Initially disabled, |\WrapperOn| +% turns wrappers on. The optional argument of |\WrapperOn|, which +% should be used on the first invocation, specifies the default wrapper. +% Wrappers can be turned off with |\WrapperOff|. +% The default wrapper can be changed with a subsequent invocation +% to |\WrapperOn|. +% +% However, the wrapper for any given figure +% or table may be individually specified (without changing the default +% wrapper) by way of the +% argument to |\Wrapper|. Both the default wrapper as well as one +% passed as an argument to |\Wrapper| are presented with the style +% given in |\WrapperTextStyle|, which defaults to small, bold font, +% |\bf\small|. The command |\Wrapper|, if used, should be placed within +% the second mandatory argument of |\bxtable| and |\bxfigure|, if a +% wrapper other than the default is desired. +% \begin{macrocode} +%% 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}} + +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\bxtable} % The routine |\bxtable| will store the specified table. If @@ -1243,16 +1359,20 @@ % in the pointer |\tblcapvii|, and the calculated caption width would be % stored in the pointer |\tblcapwdthvii|. % \begin{macrocode} -\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} +\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 } @@ -1267,17 +1387,24 @@ % and the calculated caption width. Note that the optional first % argument, \textit{loc}, is a dummy argument that is not used here. % \begin{macrocode} -\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\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}% } % \end{macrocode} @@ -1297,27 +1424,37 @@ % restored, the table placement environment is concluded and the table % itself is ended. % \begin{macrocode} -\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\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 - \rule{\@DataBoxOffset}{0in}% - \usebox{#3} + \par% \rule{\@DataBoxOffset}{0in}% - \let\@makecaption \old@makecaption - \setlength\abovecaptionskip \oldabovecaptionskip - \setlength\belowcaptionskip \oldbelowcaptionskip - \end{\LRTablePlacement} - \end{table} + \usebox{#3}% + \rule{\@DataBoxOffset}{0in}\\% + \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{\LRTablePlacement}% + \end{table}% } % \end{macrocode} @@ -1331,18 +1468,22 @@ % standard \LaTeX{} logic. If there are no uncleared tables left to % format, then the command has no effect. % \begin{macrocode} -\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 } @@ -1360,23 +1501,27 @@ % |\theClearedTable| which defines the format for clearing and actually % calls for the table to be recited. % \begin{macrocode} -\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}% + }% } % \end{macrocode} @@ -1388,12 +1533,12 @@ % different clearing format is desired. % \begin{macrocode} %% \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 + \vspace*{\fill}% + \ReciteTable[#1]{#2}{#3}{#4}{#5}{#6}% + \vspace*{\fill}% + \clearpage% } % \end{macrocode} @@ -1404,16 +1549,20 @@ % pointers which save the figure use a |\fig-| prefix, instead of a % |\tbl-| prefix. % \begin{macrocode} -\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} +\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 } @@ -1423,17 +1572,24 @@ % \begin{macro}{\StoreFigure} % This routine is analogous to |\StoreTable| in every way. % \begin{macrocode} -\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\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}% } % \end{macrocode} @@ -1444,27 +1600,37 @@ % In the case of |\ReciteFigure|, the figure-data box is output % \textbf{before} the caption, not after. % \begin{macrocode} -\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\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} + \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}% } % \end{macrocode} @@ -1473,18 +1639,22 @@ % \begin{macro}{\nextFigure} % This routine is analogous to |\nextTable| in every way. % \begin{macrocode} -\newcommand\nextFigure[1][h]{ - \ifnum \arabic{FigureClearedIndex} < \arabic{FigureIndex}{ - \addtocounter{FigureClearedIndex}{1} +\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 } @@ -1493,23 +1663,27 @@ % \begin{macro}{\clearFigures} % This routine is analogous to |\clearTables| in every way. % \begin{macrocode} -\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}% + }% } % \end{macrocode} @@ -1520,12 +1694,12 @@ % figure per page, vertically centered. % \begin{macrocode} %% \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% } % \end{macrocode} @@ -1538,10 +1712,10 @@ % up, so as to remain greater than or equal the minimum allowed caption % width. % \begin{macrocode} -\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 @@ -1556,10 +1730,10 @@ % be reduced, so as to remain less than or equal the maximum allowed % caption width. % \begin{macrocode} -\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 @@ -1572,17 +1746,17 @@ % Only twist: if only one argument given, both min- and max-caption % widths set to that value. % \begin{macrocode} -\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 } @@ -1594,10 +1768,10 @@ % Low-level routine to save box data in an |sbox|. Also, calculates data % box width and associated caption box width. % \begin{macrocode} -\newcommand\SaveCBox[2]{ - \newsavebox{#1} - \sbox{#1}{#2} - \set@BoxWidths{#1} +\newcommand\SaveCBox[2]{% + \newsavebox{#1}% + \sbox{#1}{#2}% + \set@BoxWidths{#1}% } % \end{macrocode} @@ -1607,9 +1781,9 @@ % Call successive routines to define |\@DataBoxWidth| and % |\CaptionBoxWidth|. % \begin{macrocode} -\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% } % \end{macrocode} @@ -1618,8 +1792,8 @@ % \begin{macro}{\set@DataBoxWidth} % Calculate and set data-box width. % \begin{macrocode} -\newcommand\set@DataBoxWidth[1]{ - \setlength {\@DataBoxWidth}{\widthof{\usebox{#1}}} +\newcommand\set@DataBoxWidth[1]{% + \setlength {\@DataBoxWidth}{\widthof{\usebox{#1}}}% } % \end{macrocode} @@ -1629,14 +1803,14 @@ % Calculate and set caption-box width, subject to constraints of dead % margin as well as caption-box min/max allowable widths. % \begin{macrocode} -\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 } @@ -1649,15 +1823,15 @@ % box with respect to the associated caption box. Use it to set % |\@DataBoxOffset| and |\@CaptionBoxOffset|. % \begin{macrocode} -\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 } @@ -1669,12 +1843,12 @@ % Define the code for placing offset- and nooffset-captions in the % caption box. % \begin{macrocode} -\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.}}% } @@ -1693,15 +1867,15 @@ % captions in the caption box. % \begin{macrocode} \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.% } % \end{macrocode} @@ -1715,14 +1889,14 @@ % long- and short-caption definitions, that can be changed on the fly. % \begin{macrocode} \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% } % \end{macrocode} @@ -1735,12 +1909,12 @@ % redefine the captions styles for long and short captions, % respectively. % \begin{macrocode} -\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 } % \end{macrocode} @@ -1761,8 +1935,8 @@ % Kills subsequent calls for the Table of Contents by renewing the % command as null. % \begin{macrocode} -\newcommand\killtableofcontents{ - \renewcommand\tableofcontents{} +\newcommand\killtableofcontents{% + \renewcommand\tableofcontents{}% } % \end{macrocode} @@ -1789,9 +1963,9 @@ % Kills subsequent calls for List of Figures by renewing the command (and % redefining the saved command) as null. % \begin{macrocode} -\newcommand\killlistoffigures{ - \def\oldlistoffigures {} - \renewcommand\listoffigures{} +\newcommand\killlistoffigures{% + \def\oldlistoffigures {}% + \renewcommand\listoffigures{}% } % \end{macrocode} @@ -1801,8 +1975,8 @@ % To put the \textit{lof} ``on hold,'' we merely redefine % |\listoffigures| to increment the |lofInvocations| counter. % \begin{macrocode} -\newcommand\holdlistoffigures{ - \renewcommand\listoffigures{\addtocounter{lofInvocations}{1}} +\newcommand\holdlistoffigures{% + \renewcommand\listoffigures{\addtocounter{lofInvocations}{1}}% } % \end{macrocode} @@ -1814,11 +1988,11 @@ % does this by incrementing |lofPrints| until it reaches a value of % |lofInvocations|. % \begin{macrocode} -\newcommand\clearlistoffigures{ - \whiledo{\arabic{lofPrints} < \arabic{lofInvocations}}{ - \addtocounter{lofPrints}{1} - \oldlistoffigures - } +\newcommand\clearlistoffigures{% + \whiledo{\arabic{lofPrints} < \arabic{lofInvocations}}{% + \addtocounter{lofPrints}{1}% + \oldlistoffigures% + }% } % \end{macrocode} @@ -1838,20 +2012,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% + }% } % \end{macrocode} 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, |