summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/boxhandler/boxhandler.sty
blob: 083fd3b311e98d5b7d2aa3ce764218230efb88b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
%%
%% This is file `boxhandler.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% boxhandler.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from boxhandler.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file boxhandler.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% boxhandler.sty
%% Copyright Steven B. Segletes.
%%
%% This file may be redistributed and/or modified with attribution.
%%
%% This is boxhandler.sty, derived from earlier incarnations of savcap.sty &
%% arlcaptions.sty.
%%
\ProvidesPackage{boxhandler}
[2006/07/29 v1.10
    Flexible Captioning Styles and Deferred Box/List Printing]
\NeedsTeXFormat{LaTeX2e}
%% Examples of a number of calls provided in this style are given below,
%% in no particular order:
%%
%%|                                                                 |\\
%%|\bxtable[t]                                                      |\\
%%|  {This is a test of nonwrapping caption\label{tb:mytable}}      |\\
%%|  {                                                              |\\
%%|  \begin{tabular}{|c|c|c|}                                       |\\
%%|    \hline                                                       |\\
%%|    column 1 data & 2nd column data & and the third column data\\|\\
%%|    \hline                                                       |\\
%%|  \end{tabular}                                                  |\\
%%|  }                                                              |\\
%%|                                                                 |\\
%%|\usepackage{graphicx}                                            |\\
%%|\bxfigure[h]                                                     |\\
%%|  {Here is an example of a particularly long caption that will   |\\
%%|          test wrapping}                                         |\\
%%|  {\includegraphics[width=3.64in,height=4.30in]{Atest1.eps}}     |\\
%%|                                                                 |\\
%%|\relaxCaptionWidth[2in]                                          |\\
%%|                                                                 |\\
%%|\captionStyle{}{c}                                               |\\
%%|                                                                 |\\
%%|\setlength\captionGap{3ex}                                       |\\
%%|                                                                 |\\
%%|\setcounter{abovecaptionskipterm}{10}                            |\\
%%|\setcounter{belowcaptionskipterm}{0}                             |\\
%%|                                                                 |\\
%%|\TableFontSize\normalsize                                        |\\
%%|                                                                 |\\
%%|\LRFigurePlacement{flushleft}                                    |\\
%%|                                                                 |\\
%%|\killtableofcontents                                             |\\
%%|                                                                 |\\
%%|\holdFigures                                                     |\\
%%|                                                                 |\\
%%|\clearFigures                                                    |\\
%%|                                                                 |\\
%%|\newsavebox{\mybox}                                              |\\
%%|\SaveCBox{\mybox}{\framebox(200,100){Ack!}}                      |\\
%%|                                                                 |\\
%%|\ReciteFigure[h]{\figcapii}{\figii}{\figcapwdthii}               |\\
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pbox}
\newcounter{TableIndex}          \setcounter{TableIndex}{0}
\newcounter{FigureIndex}         \setcounter{FigureIndex}{0}
\newcounter{TableClearedIndex}   \setcounter{TableClearedIndex}{0}
\newcounter{FigureClearedIndex}  \setcounter{FigureClearedIndex}{0}
\let\old@makecaption \@makecaption% SAVE PREVAILING \@makecaption STYLE
\newlength\oldabovecaptionskip
\setlength\oldabovecaptionskip \abovecaptionskip
\newlength\oldbelowcaptionskip
\setlength\oldbelowcaptionskip \belowcaptionskip
%% \captionGap CAN BE INCREASED TO PLACE MORE SPACE BETWEEN THE CAPTION
%% LABEL AND THE ACTUAL CAPTION TEXT.
\newlength\captionGap          \setlength\captionGap{1ex}
%% \TableDeadMargin AND \FigureDeadMargin REFER TO THE TABLE & FIGURE
%% MARGIN OF A BOX THAT COUNTS TOWARDS ITS SIZE, BUT IN WHICH NO
%% ACTIVE DATA FALLS; DEADMARGIN ASSUMED ON BOTH LEFT & RIGHT SIDE.
\newlength\TableDeadMargin     \setlength\TableDeadMargin{0.375em}
\newlength\FigureDeadMargin    \setlength\FigureDeadMargin{0em}
%% INITIALIZE \above- AND \belowcaptionskip VALUES; CAN BE RESET
%% USED TO SET GAPS ABOVE & BELOW CAPTIONS
\newcounter{abovecaptionskipterm}  \setcounter{abovecaptionskipterm}{10}
\newcounter{belowcaptionskipterm}  \setcounter{belowcaptionskipterm}{7}
%% RESET \@minCaptionBoxWidth TO Default VALUE WITH \relaxCaptionWidth
%% SET \@minCaptionBoxWidth TO USER VALUE WITH \relaxCaptionWidth[<len>]
\newlength\@minCaptionBoxWidth
\newlength\@minCaptionBoxWidthDefault
\setlength\@minCaptionBoxWidthDefault{1in}
%% RESET \@maxCaptionBoxWidth TO Default WITH \limitCaptionWidth
%% SET \@maxCaptionBoxWidth WITH \limitCaptionWidth[<len>]
\newlength\@maxCaptionBoxWidth
\newlength\@maxCaptionBoxWidthDefault
\setlength\@maxCaptionBoxWidthDefault{\textwidth}
%% DEFINE promptTablesFlag & PROVIDE ROUTINE TO CHANGE IT FROM
%% "PROMPT"(1) TO "ON HOLD"(0)
\newcounter{promptTablesFlag}    \setcounter{promptTablesFlag}{1}
\newcommand\holdTables{\setcounter{promptTablesFlag}{0}}
%% SAME FOR promptFiguresFlag
\newcounter{promptFiguresFlag}   \setcounter{promptFiguresFlag}{1}
\newcommand\holdFigures{\setcounter{promptFiguresFlag}{0}}
%% DEFAULT CaptionFontSize & TableFontSize AS \small; CAN BE RESET
\let \CaptionFontSize \small
\let \TableFontSize \small
%% DEFAULT TABLE & FIGURE LR ALIGNMENT TO center;
%% CAN RESET TO flushleft/-right
\def \LRTablePlacement {center}
\def \LRFigurePlacement {center}
%% WITHIN-CAPTION JUSTIFICATION CAN BE SET
%% OPTIONS: {}, {\raggedleft}, {\raggedright}, or {\centering}
\def\CaptionJustification{} % <---DEFAULT IS FULL JUSTIFICATION
%% WORKING VARIABLES
\newlength\DeadMargin
\newlength\@DataBoxWidth
\newlength\CaptionBoxWidth
\newlength\@DataBoxOffset
\newlength\@CaptionBoxOffset
\newlength\@captionIDwidth
\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}
  \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
        \rule{\@CaptionBoxOffset}{0em}%
        \parbox{\CaptionBoxWidth}{\caption {#2}}%
        \rule{\@CaptionBoxOffset}{0em}%
        \par
        \rule{\@DataBoxOffset}{0in}%
        \usebox{#3}
        \rule{\@DataBoxOffset}{0in}%
      \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}
%%  \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}
  }\fi
}

\newcommand\clearTables{
  \clearpage
  \clearlistoftables
  \clearpage
%%DO UNTIL ALL HELD TABLES ARE CLEARED
  \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}
  }
}

%% \theClearedTable CAN BE RENEWED IF DIFFERENT OUTPUT FORMAT IS DESIRED
\newcommand\theClearedTable[4][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}
  \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
        \rule{\@DataBoxOffset}{0in}%
        \usebox{#3}%
        \rule{\@DataBoxOffset}{0in}%
        \par
        \rule{\@CaptionBoxOffset}{0em}%
        \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}
%%  \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}
  }\fi
}

\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.
%%  \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}
  }
}

%% \theClearedFigure CAN BE RENEWED IF DIFFERENT OUTPUT FORMAT DESIRED
\newcommand\theClearedFigure[4][h]{
%%  CLEAR THIS FIGURE ON A PAGE BY ITSELF, CENTERED VERTICALLY
  \vspace*{\fill}
  \ReciteFigure[#1]{#2}{#3}{#4}
  \vspace*{\fill}
  \clearpage
}

\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
  \fi
}
\limitCaptionWidth% SET INITIAL \@maxCaptionBoxWidth TO DEFAULT VALUE

\newcommand\constrainCaptionWidth[2][-1in]{
  \ifdim #1 < 0in
    \setlength\@minCaptionBoxWidth{#2}
    \setlength\@maxCaptionBoxWidth{#2}
  \else
    \ifdim #1 < #2
      \setlength\@minCaptionBoxWidth{#1}
      \setlength\@maxCaptionBoxWidth{#2}
    \else
      \setlength\@minCaptionBoxWidth{#2}
      \setlength\@maxCaptionBoxWidth{#1}
    \fi
  \fi
}

\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@DataBoxWidth[1]{
  \setlength {\@DataBoxWidth}{\widthof{\usebox{#1}}}
}

\newcommand\set@CaptionBoxWidth{
  \setlength\CaptionBoxWidth\@DataBoxWidth
  \addtolength{\CaptionBoxWidth}{-2\DeadMargin}
  \ifdim \CaptionBoxWidth < \@minCaptionBoxWidth
    \setlength\CaptionBoxWidth\@minCaptionBoxWidth
  \fi
  \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}
  \else
    \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}
                  {\CaptionJustification\CaptionFontSize{#2.}}%
}

\long\def\nooffset@caption#1#2{%
  \CaptionJustification\CaptionFontSize #1.\rule{\captionGap}{0in}#2.%
}

\long\def\shortleft@caption#1#2{%
  \raggedright         \CaptionFontSize #1.\rule{\captionGap}{0in}#2.%
}

\long\def\shortcenter@caption#1#2{%
  \centering           \CaptionFontSize #1.\rule{\captionGap}{0in}#2.%
}

\long\def\shortright@caption#1#2{%
  \raggedleft          \CaptionFontSize #1.\rule{\captionGap}{0in}#2.%
}

\long\def\new@makecaption#1#2{%
  \vskip\abovecaptionskip
  \sbox\@tempboxa{\CaptionFontSize #1.\rule{\captionGap}{0in}#2.}%
  \ifdim \wd\@tempboxa >\hsize
    \long@caption{#1}{#2}
  \else
    \short@caption{#1}{#2}
  \fi
  \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
}

%% SET DEFAULT CAPTION STYLE: CAPTION ID OFFSET FOR LONG CAPTIONS,
%%                            SHORT CAPTIONS LEFT ALIGNED
\captionStyle{o}{l}

\newcommand\killtableofcontents{
  \renewcommand\tableofcontents{}
}

%%LIST OF FIGURES HANDLING:
\newcounter{lofInvocations}   \setcounter{lofInvocations}{0}
\newcounter{lofPrints}        \setcounter{lofPrints}{0}
\let\oldlistoffigures\listoffigures

\newcommand\killlistoffigures{
  \def\oldlistoffigures {}
  \renewcommand\listoffigures{}
}

\newcommand\holdlistoffigures{
  \renewcommand\listoffigures{\addtocounter{lofInvocations}{1}}
}

\newcommand\clearlistoffigures{
  \whiledo{\arabic{lofPrints} < \arabic{lofInvocations}}{
    \addtocounter{lofPrints}{1}
    \oldlistoffigures
  }
}

%%LIST OF TABLES HANDLING:
\newcounter{lotInvocations}   \setcounter{lotInvocations}{0}
\newcounter{lotPrints}        \setcounter{lotPrints}{0}
\let\oldlistoftables\listoftables

\newcommand\killlistoftables{
  \def\oldlistoftables {}
  \renewcommand\listoftables{}
}

\newcommand\holdlistoftables{
  \renewcommand\listoftables{\addtocounter{lotInvocations}{1}}
}

\newcommand\clearlistoftables{
  \whiledo{\arabic{lotPrints} < \arabic{lotInvocations}}{
    \addtocounter{lotPrints}{1}
    \oldlistoftables
  }
}

%% TO RETAIN BACKWARD COMPATIBILITY WITH THE PREDECESSOR TO boxhandler,
%% THE FOLLOWING ASSIGNMENTS ARE MADE.
\let\arltable\bxtable
\let\arlfigure\bxfigure

\endinput
%%
%% End of file `boxhandler.sty'.