summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/kluwer/klufloa.sty
blob: 0e77ca52e9823d968bb260c64f5184001ef224cb (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
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
%
%<*other>
%
%
\ifcat a\noexpand @\let\next\relax\else \def\next{%
\documentclass{kluwer}\usepackage{doc}\MakePercentIgnore}\fi\next
\def\filedate{1998/03/13}
%\changes{v??}{1997/07/10}{Fixes in @klu@caption: inserted [b] and moved
%               kaprotate code from the else to after the fi.}
\def\filename{klufloa.sty}
%\DoNotIndex{\@M,\def,\c@secnumdepth,\baselineskip,\@pnumwidth,\else,\fi}
%\DoNotIndex{\newcommand,\z@,\relax,\renewcommand,\ifnum,\csname,\endcsname}
%\DoNotIndex{\baselineskip,\vskip,\hskip,\relax,\secdef,\gdef,\@cla,\@clb}
%\DoNotIndex{\normalsize,\protect,\global,\setbox,\hbox,\vbox,\endinput}
%\DoNotIndex{\egroup,\endgroup,\bgroup,\begingroup,\let}
%\CodelineIndex
%\newcommand{\Bs}{$\backslash$}
%\parindent=0pt
%\parskip=3pt
%\hfuzz=10pt
%\MakeShortVerb{\|}
%\setlength{\marginparwidth}{0in}
%\addtolength{\textwidth}{4pc}
%\begin{document}
%\begin{opening}
%\title{\filename}
%\date{\filedate}
%\author{T. \surname{Hoekwater}}
%\institute{Kluwer Academic Publishers, Dordrecht}
%\begin{abstract}
% This internal stylefile takes care of floats and the |kaprotate| macro's \\
%
%\noindent
%{\bf Disclaimer:}  This stylefile is to be used by Kluwer Academic
% Publishers in the contruction of full class files. Therefore, the
% user interface is not very high-level, and is definately not meant
% for normal usage. This stylefile is provided {\bf as is}, i.e. we
% accept no responsibilities whatsoever. You are free to use this file
% in any way you like, provided you do not make {\it any\/} changes.
% If you {\it do\/} make changes, you have to rename the changed file.
%\end{abstract}
%\end{opening}
%\tableofcontents
%\newpage\section{Usage}
% At this moment, there are three float environments done here:
% |table|, |figure| (with their starred and sub... forms) and |algorithm|.
%                                  
%
% In order to facilitate customization, the following commands are
% exported:
%
% \def\pitem[#1]{\item[\ttfamily\string #1]\SpecialUsageIndex{#1}}
%\begin{description}
%\pitem[\tabwidth]  Allows setting the width of a table that has to be
%centered, but does not contain a |tabular| or |TABULAR|. Also,
%it might be handy for tables that contain more than one |tabular|.
%(e.g. |\tabwidth{20pc}|)                                             
%\pitem[\tabfont]  Font specification for the main text of tables.\\
%           (default value |\footnotesize|)
%\pitem[\tabcapfont]  Font specification for table captions.
%               (default value |\footnotesize|)
%\pitem[\figcapfont]  Font specification for caption of figures. There is no
% definition for the font of the text of figures.
%               (defaultvalue |\footnotesize|)
%\pitem[\tableindent] Indentation for tables. 
%               (default given by stylefile)
% Tables and figures can be either indented over a specified width, or
% centered. This can be done independent of each other, but both
% always use the same indentation. i.e: You cannot
% have figures indented 4 picas and tables 2 picas, but you can have
% indented tables with centered figures.
%\pitem[\figindent] Indentation for figures. From the note above for these
%two commands it follows that if both are given, they have to set the same
% value. If they don't, the last given value will prevail.
%               (default given by stylefile)
%\pitem[\figtabdot] The dot after the number. (default value |.|)         
%\pitem[\captionskip] Vertical skip between caption and main body of float.
%           (default value 6pt)
%\pitem[\tabcapspace] Space between heading of caption and
%text of caption. This is a vertical or horizontal skip, depending on
%whether captions are split or not. Default value .5em.
%\pitem[\splittabcaptions] Splits the table captions in two parts.
%\pitem[\splitfigcaptions] Splits the figure captions in two parts.
%\pitem[\splitcaptions] Combines both.
%\pitem[\indentedcaptions] Ordinarily, captions are centered above or below
%the float. This setting allows you to specify a specific indentation. 
%\pitem[\captionindent] Value used for the previous option The default value
%is 0pt (appears to make most sense).
%\end{description}                  
%
%
% 
%\newpage\section{Implementation}
%
% The |klutab| is necesarry here, because we need the definitions 
% of tabular \& co that set the correct widths. It also makes sure that
% these two are nicely tied in to eachother (version control problems).
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{klufloa}[\filedate ]
\RequirePackage{klutab}[1997/05/30]
%    \end{macrocode}
%\subsection{Float parameters}
% These are standard as in \LaTeXe.
%    \begin{macrocode}
%</other>
%<*main>
\setcounter{topnumber}{2}
\setcounter{bottomnumber}{1}
\setcounter{totalnumber}{3}
\setcounter{dbltopnumber}{2}
%    \end{macrocode}
% The parameters below try to ensure that there are not so many float
% pages. (prevents empty white space). 
%
% In the old stylefiles, 
% |\topfraction| was $.99$, but that was bit to much, resulting in
% pages with a huge float and only two text lines. Now a float has
% to be $>.85$|\textheight| before it will result in a float page.
% (oversimplified, but this is the general idea). This leaves
% space on the page for a few more textlines.
%
% |\bottomfraction| used to be $.3$,  but that is to small for almost 
% any float this style generates; there are split captions and tabnotes
% to account for, so the value has increased a bit.
%    \begin{macrocode}
\renewcommand{\topfraction}{.85}
\renewcommand{\textfraction}{.01}
\renewcommand{\bottomfraction}{.4}
\renewcommand{\floatpagefraction}{.84}
\renewcommand{\dblfloatpagefraction}{.84}
\renewcommand{\dbltopfraction}{.7}
%    \end{macrocode}
%\newpage
% \subsection{Helper macros}
% |\figtabdot| serves the same purpose as |\sectiondot| elsewhere,
% and the 
% names of various strings.
%    \begin{macrocode}
\def\figtabdot{.}
\def\tablename{Table}%
\def\figurename{Figure}%
\def\algorithmname{Algorithm}%
%    \end{macrocode}
% |\maxfloatwidth| is the allowed width of the table.\\
% (If this is a rotated table or figure, it will use all of the
% page. Of course, |\maxfloatwidth| then is |\textheight|.)\\
% |\figtabbox| will contain the total float as a vbox.
% |\floatindent| is the indentation skip for indented tables \& figures. 
% The last defined value will overwrite the previous one.\\
% |\@tabskip| is an aid in helping to decide indentation of rotated tables.\\
% |\cap@type| is an aid in keeping track of caption types\\
% |\captionskip| is the vertical skip between caption and main body.
%    \begin{macrocode}
\newdimen\maxfloatwidth
\newbox\figtabbox
\newdimen\floatindent
\newdimen\@tabskip
\gdef\cap@type{0}
\newdimen\captionskip
\setlength\captionskip{6pt}
%    \end{macrocode}
%
%
% |\@tabwidth| is
% supposed to contain the width of the table. (the width of |\figtabbox| is
% probably either |\textwidth| or zero.) |tabular| and |TABULAR| from 
% |klutab.sty| set
% this value automatically, but so should every |table|. If your table
% does not contain a |tabular|, you can set this value yourself:
% just say |\tabwidth{..}| somewhere in your table.  Your text will
% be typeset inside a |\vbox| with width |\maxfloatwidth|.
%    \begin{macrocode}
\newdimen\@tabwidth
\setlength\@tabwidth{\textwidth}
\def\tabwidth#1{\global\setlength\@tabwidth{#1}}
%    \end{macrocode}
%
% |\@getindent| calculates the value of |\maxfloatwidth|, 
% It is called from figure and table. 
%
% For rotated floats, |\maxfloatwidth| == |\vsize|. The use
% of |\vsize| here is probably 
% better than |\textheight|, because it allows use of minipages and
% |\vbox|es to get special effects (where |\textheight| $>$ |\vsize|).
%
% |\@floatcorrect| fixes indentation for rotated floats. This and\\
% |\hbox@to@floatwidth| are just shortcuts. 
%    \begin{macrocode}
\def\@getmaxwidth{\maxfloatwidth=\hsize
    \if@kaprotate \maxfloatwidth=\textheight \fi }
\def\@floatcorrect{\if@kaprotate\else 
  \advance\maxfloatwidth -\floatindent \fi }
\def\hbox@to@floatwidth#1{\leavevmode
        \hbox to \@tabwidth{#1}}
%    \end{macrocode}
%
% |\@getindent| calculates the values for |\@tabskip| and
% |\@floatindent|. The first check initializes |\@tabwidth| for
% anything except tables. The macro\\ |\@centeredfloat| does the
% hard work for centered floats, where |\floatindent| is not given
% beforehand.
%    \begin{macrocode}
\def\@getindent{%
   \ifnum\cap@type=2 \else 
        \@tabwidth=\if@kaprotate \textheight \else \hsize \fi 
        \if@figindent\advance \@tabwidth -\floatindent \fi\fi
   \ifnum\cap@type=1
     \if@figindent \@tabskip\floatindent
       \else \@centeredfloat \fi
   \else \ifnum\cap@type=2  
            \if@tabindent \@tabskip\floatindent 
               \else \@centeredfloat  \fi
            \ifdim \@tabwidth > \maxfloatwidth
                \@tabskip 0pt
                \floatindent 0pt
            \fi
         \else
            \@centeredfloat
         \fi
   \fi        
}
%    \end{macrocode}
%
% |\@centeredfloat|\\
% Calculate |\@tabskip| for centering. In this macro, we know the
% float will be centered. We calculate |\floatindent| ourselves from
% |\maxfloatwidth|.
% 
% We need to maintain this indentation for rotated floats (so they
%   will be vertically centered), but |\@tabskip| needs to be re-done.
%
%    \begin{macrocode}
\def\@centeredfloat{%
     \floatindent\maxfloatwidth
     \advance\floatindent by -\@tabwidth
     \divide\floatindent by 2
     \@tabskip\floatindent
     \if@kaprotate 
       \@tabskip\hsize
       \advance\@tabskip by -\ht\figtabbox
       \advance\@tabskip by -\dp\figtabbox
       \divide\@tabskip by 2
     \fi
}    
%    \end{macrocode}
%
% \subsection{Table caption commands}
% Here is the code for the captions.
%
%
% |\indentedcaptions| is a user option that indents captions instead 
% (over a default value of 0pt).  
%    \begin{macrocode}
\newif\if@centeredfigcaption 
\newif\if@centeredtabcaption 
\@centeredtabcaptiontrue
\@centeredfigcaptiontrue
\def\indentedtabcaptions{\global\@centeredtabcaptionfalse }
\def\indentedfigcaptions{\global\@centeredfigcaptionfalse }
\def\indentedcaptions{\global\@centeredtabcaptionfalse
    \global\@centeredfigcaptionfalse}
\newdimen\captionindent
\setlength\captionindent{0pt}
\newtoks\@floatcaption
\def\tabcapspace{.5em}
\def\tabcapfont{\footnotesize }
\long\def\@maketabcaption#1#2{\global\@floatcaption={#2}%
   \message{\tablename\space\thetable \if@kaprotate 
     \space(rotated) \fi}}
%    \end{macrocode}
%
% Captions are centered above the table by default.\footnote{
% In real life, {\tt @klu@caption} would be called {\tt make@caption},
% since these do the typesetting}. This code is called from |\endtable|. 
%    \begin{macrocode}
\def\@klu@caption{%
  \setbox1=\hbox{\tabcapfont\fnum@table\hskip\tabcapspace
    \the\@floatcaption}%
  \noindent
  \ifdim\wd1 >\@tabwidth
     {\if@centeredtabcaption\centering\else \hskip \captionindent\fi 
     \parbox[b]{\@tabwidth}{\tabcapfont\unhbox1}}%
  \else
     \hbox to \@tabwidth{%
       \if@centeredtabcaption \hfil \else \hskip \captionindent\fi
       \tabcapfont\fnum@table
       \hskip\tabcapspace{\tabcapfont\the\@floatcaption}\hfil }% 
  \fi 
  \if@kaprotate \else \par \vskip -\baselineskip \fi
  \par 
}
\def\@klu@figcaption{%
  \setbox1=\hbox{\figcapfont\fnum@figure\hskip\tabcapspace
            \the\@floatcaption}%
  \noindent
  \ifdim\wd1 >\@tabwidth
     {\if@centeredfigcaption\centering\else \hskip \captionindent\fi 
     \parbox{\@tabwidth}{\figcapfont\unhbox1}}%
  \else
     \hbox to \@tabwidth{%
       \if@centeredfigcaption \hfil\else \hskip \captionindent\fi
       \tabcapfont\fnum@figure
       \hskip\tabcapspace{\figcapfont\the\@floatcaption}\hfil}%
  \fi 
  \par 
}
%    \end{macrocode}
%
% |\splitcaptions| is a user option to generate a caption in which the
% `Table 1' is separated from the caption text. The resulting
% definitions depend on being inside a
% vbox when called.
%    \begin{macrocode}
\def\splitcaptions{\splittabcaptions\splitfigcaptions}
\def\splittabcaptions{
  \def\@klu@caption{%
    \setbox1=\hbox{\tabcapfont\the\@floatcaption}%
    \noindent
    \ifdim\wd1 >\@tabwidth 
     \hbox to \@tabwidth{\if@centeredtabcaption\hss\else 
       \hskip\captionindent\fi
     \tabcapfont\fnum@table\hss}\vskip \tabcapspace
       \vskip 6pt
     {\if@centeredtabcaption\centering\fi 
       \hskip \captionindent
          \parbox{\@tabwidth}{\tabcapfont\unhbox1}}%
   \else
     \hbox to \@tabwidth{%
       \if@centeredtabcaption \hfil\else \hskip\captionindent\fi
       \tabcapfont\fnum@table\strut\hfil }\vskip \tabcapspace
      \hbox to \@tabwidth{%
       \if@centeredtabcaption \hfil\else \hskip\captionindent \fi
       \tabcapfont\the\@floatcaption \hfil }%
       \if@kaprotate \else \par \vskip -\baselineskip \fi
   \fi 
   \par 
}}
\def\splitfigcaptions{\def\@klu@figcaption{%
    \setbox1=\hbox{\figcapfont\the\@floatcaption}%
    \noindent
    \ifdim\wd1 >\@tabwidth 
     \hbox to \@tabwidth{\if@centeredfigcaption\hfil\else 
       \hskip\captionindent\fi
            \figcapfont\fnum@figure\hfil}\vskip \tabcapspace
       \vskip 6pt
     {\if@centeredfigcaption\centering\fi \hskip \captionindent
            \parbox{\@tabwidth}{\figcapfont\unhbox1}}%
   \else
     \hbox to \@tabwidth{%
       \if@centeredfigcaption \hfil\else \hskip\captionindent\fi
       \figcapfont\fnum@figure\strut\hfil }\vskip \tabcapspace
      \hbox to \@tabwidth{%
       \if@centeredfigcaption \hfil\else \hskip\captionindent\fi
       \figcapfont\the\@floatcaption \hfil }%
   \fi 
   \par 
}}%
%    \end{macrocode}
%\newpage
%\subsection{Table}
% Standard \LaTeX\ definitions first:
%
% |\newcounter| removed 7/6/96 to prevent errors when used as package.
% (`counter |\c@table| already defined')
%    \begin{macrocode}
\@ifundefined{thetable}{\newcounter{table}}{}
\def\thetable{\arabic{table}}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename~\thetable\figtabdot}
%    \end{macrocode}
% Now the switch to control indentation.
%
%    \begin{macrocode}
\newif\if@tabindent \@tabindentfalse
\def\tableindent#1{%
   \global\floatindent= #1\global\@tabindenttrue }
%    \end{macrocode}
% Default font for tables.
% This could also be used to redefine the font
% defaults like family and shape.
%    \begin{macrocode}
\def\tabfont{\footnotesize}
%    \end{macrocode}
% |\tabnotes| is intended to be used as `footnote' to a tabular
% environment. |\@tabnotes| will be cleared before every table.
%    \begin{macrocode}
\def\@tabnotes{}
\newcounter{tabnote}
\def\tabnotemark{\ensuremath{^{\thetabnote}}}
\def\thetabnote{\arabic{tabnote}}
\def\tabnotesep{\par}
\def\tabnote#1{\stepcounter{tabnote}%
    \rlap{\tabnotemark }%
    \begingroup
    \let\tabnotesep\relax
    \xdef\@tabnotes{\@tabnotes\tabnotesep \tabnotemark #1\par}%
    \endgroup }
\long\def\tabnotes#1{\gdef\@tabnotes{{\tabfont\noindent #1\par}}}
%    \end{macrocode}
% Now for the macro's that set the table itself. Just to recall: \\[6pt]
%|\maxfloatwidth|== max. width of table\\
%|\@tabskip|== horizontal offset\\
%|\floatindent|==indent before table proper\\
%|\@tabnotes|==macro containing tabnotes (in Tabfont)\\
%|\figtabbox|==vbox containing table (minus caption \& tabnotes)
%
% Non-rotated version:\\
% Check width of caption. If it is too wide to fit on one line, put it
% in a |\parbox| with proper |\floatindent| before it.
%
%    \begin{macrocode}
\def\@setnotrotatedtabbox{%
  \setbox4=\hbox to \maxfloatwidth{\vbox{\hsize=\maxfloatwidth
     \@klu@caption 
     \vskip\captionskip \leavevmode
     \unvbox\figtabbox\par
     \noindent\parbox{\@tabwidth}{\tabfont\@tabnotes}\par}}% 
      \if@fixedfloat\calc@fixedspace4\fi                  
  \noindent\kern \floatindent\box4
 }
%    \end{macrocode}
% Rotated version. We are inside a |\vbox| here, so we typeset 3
% hboxes (and a |\vskip|).
%
% |\maxfloatwidth| is |\textheight| here, causing overfull boxes.
%
%    \begin{macrocode}
\def\@setrotatedtabbox{\begingroup \hfuzz=\vsize   
     \setbox2\hbox to \textheight{\hfil
        \vbox to \hsize{\hsize=\vsize
         \vfil
         \hbox{\hbox@to@floatwidth{\vbox{\@klu@caption }}}
         \vskip\captionskip 
         \hbox{\hbox@to@floatwidth{\box\figtabbox\hss}}%        
         \hbox{\hbox@to@floatwidth{\parbox{\@tabwidth}{\tabfont\@tabnotes}\hfil }}%
         \vss                
    }\hss}\rotl{2}\endgroup
}
%    \end{macrocode}
% |\@makecaption| will be |\let| to |\@maketabcaption| in for the
% duration of the table.
%
% This is quite simple code, apart from handling the optional argument
% ourselves. |kaprotate| effectively kills Overfull and Underfull
% hbox-es. I don't like that, but I also don't like the messages I
% always get (Overfull hbox with width = |\textheight| $-$ |\textwidth|).
%    \begin{macrocode}
\def\table{\let\@makecaption\@maketabcaption
    \global\@floatcaption={}%
    \gdef\@tabnotes{}\setcounter{tabnote}{0}\gdef\cap@type{2}%
    \@ifnextchar[{\t@blewithoptions}{\t@blewithoptions[tbp]}}
\def\t@blewithoptions[#1]{%
    \if H#1\@fixedtable \else \@float{table}[#1]\fi
    \@getmaxwidth \if@tabindent \@floatcorrect \fi
    \setbox\figtabbox\vbox\bgroup\tabfont
    \if@kaprotate\hfuzz=\vsize\fi }%
%    \end{macrocode}
%
% This |\hfuzz| is a bit more precise. At least ik will warn if the
%    tabular itself is too large.
%    \begin{macrocode}
\def\endtable{\egroup \@getindent
  \gdef\cap@type{0}\noindent
  \hfuzz=\floatindent 
    \if@kaprotate \@setrotatedtabbox 
    \else \@setnotrotatedtabbox \fi 
  \if@fixedfloat \vskip\intextsep \@fixedfloatfalse   
  \else \end@float \fi 
  \hfuzz =0.1pt }%
%    \end{macrocode}
%\subsection{Table starred} 
% This code is basically identical to the code above.
% Multicolumn `Here' floats in twocolumn layout don't work, for obvious
%  reasons. If you need something like that, fake it with the
%  twocolumn package.
%    \begin{macrocode}
\@namedef{table*}{\let\@makecaption\@maketabcaption
    \global\@floatcaption={}%
    \gdef\@tabnotes{}\setcounter{tabnote}{0}\gdef\cap@type{2}%
    \@ifnextchar[{\dt@blewithoptions}{\dt@blewithoptions[tbp]}}
\def\dt@blewithoptions[#1]{%
    \if H#1\if@twocolumn \@dblfloat{table}[t]\else \@fixedtable\fi 
    \else \@dblfloat{table}[#1]\fi
    \@getmaxwidth \if@tabindent \@floatcorrect \fi
    \setbox\figtabbox\vbox\bgroup\tabfont
    \if@kaprotate \hfuzz=\vsize \fi }%
%    \end{macrocode}
%
%    \begin{macrocode}
\@namedef{endtable*}{\egroup  \@getindent
    \gdef\cap@type{0}\noindent
    \hfuzz=\floatindent
    \if@kaprotate \@setrotatedtabbox
    \else \@setnotrotatedtabbox \fi
    \if@fixedfloat  \vskip\intextsep \@fixedfloatfalse   
    \else \end@dblfloat \fi 
    \hfuzz=0.1pt }%
%    \end{macrocode}
% \subsection{fixed point tables and figures}
% The fixedtable option. If there is enough room on the page, the 
% box is typeset right away. If there is not enough space, the page is
% ended and the box is typeset at the top of the next page. This may
% conflict with following `top' floats, but the exact location in
% the text is maintained.
%
% Don't try to use |[H]| on rotated tables, and twocolumn will produce
% overlapping text in the second column, also, these will not appear
%    in a `list of tables' unless you specifically ask that.
%    \begin{macrocode}
\newif\if@fixedfloat
\def\@fixedtable{\vskip\intextsep \@fixedfloattrue  
    \def\caption{\@ifnextchar[{\f@xedcap{table}}%
      {\f@xedcap{table}[]}}}
\def\@fixedfigure{\vskip\intextsep \@fixedfloattrue
    \def\caption{\@ifnextchar[{\f@xedcap{figure}}%
      {\f@xedcap{figure}[]}}}
\def\f@xedcap#1[#2]#3{\refstepcounter{#1}\def\@tempa{#2}%
  \ifx\@tempa\empty
  \else \addcontentsline{\csname ext@#1\endcsname}{#1}{#2}\fi
    \message{#1\space\csname the#1\endcsname \space (fixed)}%
    \global\@floatcaption={#3}}
\def\calc@fixedspace#1{%                 
       \@tempdima=\pagegoal    
       \@tempdimb=\dp#1      
       \advance\@tempdimb \ht#1      
       \advance\@tempdima -\pagetotal
       \advance\@tempdima -2\intextsep
         \wlog{pageleft= \the\@tempdima, 
           size= \the\@tempdimb }%
       \ifdim\@tempdima>\@tempdimb \else \newpage \fi}    
%    \end{macrocode}
%
%\newpage \subsection{Figure}
% Now we are going to do this all over again for
% figures. Documentation will only mark important differences.
%
% Parameters.
%
%    \begin{macrocode}
\@ifundefined{thefigure}{\newcounter{figure}}{}
\def\thefigure{\arabic{figure}}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure\figtabdot}
%    \end{macrocode}
% Indentation, font and caption.
%    \begin{macrocode}
\newif\if@figindent   \@figindentfalse   
\def\figindent#1{%
  \global\floatindent #1
  \global\@figindenttrue }
\def\figcapfont{\footnotesize}
\long\def\@makefigcaption#1#2{%
  \message{\figurename\space\thefigure 
      \if@kaprotate \space (rotated)\fi }%
  \global\@floatcaption={#2}}
%    \end{macrocode}
% 
% The |fixed| option. 
% 
%    \begin{macrocode}
%    \end{macrocode}
% The figure environment itself.
%    \begin{macrocode}
\def\figure{%
   \gdef\cap@type{1}%
   \let\@makecaption\@makefigcaption
   \global\@floatcaption={}%
   \@ifnextchar[{\f@gurewithoptions}{\f@gurewithoptions[tbp]}}%
\def\f@gurewithoptions[#1]{%
  \let\saved@centerline\centerline
  \if H#1\@fixedfigure \else \@float{figure}[#1]\fi
    \@getmaxwidth \if@figindent \@floatcorrect 
        \def\centerline##1{##1}\fi
  \setbox\figtabbox\vbox\bgroup }%
\def\endfigure{\egroup   
       \@getindent \gdef\cap@type{0}%
       \hfuzz=\floatindent
       \if@kaprotate \@setrotatedfigbox \pagebreak
       \else \@setnotrotatedfigbox \fi 
       \let\centerline\saved@centerline
       \if@fixedfloat \vskip\intextsep \@fixedfloatfalse   
       \else \end@float \fi 
       \hfuzz=0.1pt }%
%    \end{macrocode}
% \subsection{figure starred}
%    \begin{macrocode}
\@namedef{figure*}{%
    \def\cap@type{1}%
    \let\@makecaption\@makefigcaption
    \global\@floatcaption={}%
    \@ifnextchar[{\df@gurewithoptions}{\df@gurewithoptions[ttp]}}
\def\df@gurewithoptions[#1]{%
  \let\saved@centerline\centerline
  \if H#1 \@fixedfigure \else \@dblfloat{figure}[#1]\fi
    \@getmaxwidth \if@figindent \@floatcorrect 
        \def\centerline##1{##1}\fi
     \setbox\figtabbox\vbox\bgroup }%
\@namedef{endfigure*}{\egroup
        \@getindent \gdef\cap@type{0}% 
        \hfuzz=\floatindent
        \if@kaprotate \@setrotatedfigbox
        \else \@setnotrotatedfigbox \fi 
         \let\centerline\saved@centerline
        \if@fixedfloat \vskip\intextsep \@fixedfloatfalse
        \else \end@dblfloat \fi
        \hfuzz=0.1pt }%
%    \end{macrocode}
% Non-rotated version (in figures |\caption| is done last):
%    \begin{macrocode}
\def\@setnotrotatedfigbox{%
  \setbox4=\hbox to \maxfloatwidth{\vbox{\hsize=\maxfloatwidth
     \unvbox\figtabbox
     \vskip\captionskip 
     \@klu@figcaption }}% 
      \if@fixedfloat\calc@fixedspace4 \fi                  
  \noindent\kern \floatindent\box4 
}
%    \end{macrocode}
% Rotated version: 
%
%    \begin{macrocode}
\def\@setrotatedfigbox{%
     \setbox2\vbox to \hsize{\hsize=\textheight
         \leavevmode
         \vrule width \textheight height 0pt depth 0pt\par
         \vskip \@tabskip                                      
         \hbox to \textheight{\hss\box\figtabbox\hss}%
         \vskip\captionskip 
         \hbox to \textheight{\vbox{\@klu@figcaption }}
         \vss
    }\rotl{2}}%
%    \end{macrocode}
%\newpage \subsection{Algorithm} 
% This is a `standard' float. 
%    \begin{macrocode}
\newcounter{algorithm}
\def\thealgorithm{\arabic{algorithm}}
\def\fps@algorithm{tbp}
\def\ftype@algorithm{4}
\def\ext@algorithm{lof}
\long\def\@makealgocaption#1#2{%
     \hbox to \hsize{\parbox[t]{\hsize}{{\vskip 1ex \tabcapfont
     #1\figtabdot~~#2}}}}
\def\fnum@algorithm{\algorithmname\space \thealgorithm}
\def\algorithm{\let\@makecaption\@makealgocaption
                \@float{algorithm}\footnotesize\obeyspaces\obeylines}
\let\endalgorithm\end@float
%    \end{macrocode}
%\subsection{subtable and subfigure}
% These are the sub... environments. If you need comment on what
% happens, please see |kluthm.sty|, definition of |subequation|.
%    \begin{macrocode}
\def\subtable{\@ifnextchar[{\@subtable}{\@subtable[alph]}}
\def\@subtable[#1]{\refstepcounter{table}%
  \def\@testoption{arabic}\def\@testparam{#1}%
  \begingroup
  \edef\old@table{\the\c@table}%
  \edef\old@thetable{\thetable}%
  \setcounter{table}{0}%
  \ifx\@testoption\@testparam
     \def\thetable{\old@thetable.\csname #1\endcsname{table}}%
  \else
     \def\thetable{\old@thetable\csname #1\endcsname{table}}%
  \fi}
\def\endsubtable{\setcounter{table}{\old@table}%
  \endgroup \global\@ignoretrue}
\def\subfigure{\@ifnextchar[{\@subfigure}{\@subfigure[alph]}}
\def\@subfigure[#1]{\refstepcounter{figure}%
  \def\@testoption{arabic}\def\@testparam{#1}%
  \begingroup
  \edef\old@figure{\the\c@figure}%
  \edef\old@thefigure{\thefigure}%
  \setcounter{figure}{0}%
  \ifx\@testoption\@testparam
     \def\thefigure{\old@thefigure.\csname #1\endcsname{figure}}%
   \else
     \def\thefigure{\old@thefigure\csname #1\endcsname{figure}}%
   \fi}
\def\endsubfigure{\setcounter{figure}{\old@figure}%
  \endgroup \global\@ignoretrue}
%    \end{macrocode}
% \subsection{kaprotate}
% This appears to be an afterthought now, but in fact it is a quite
% handy command.  The environment is defined in this file, because
% this reflects common usage, and this allows loading as a package
% in e.g. |article|.
%
%    \begin{macrocode}

\newif\if@kaprotate \@kaprotatefalse
\def\kaprotate{\global\@kaprotatetrue}
\def\endkaprotate{\global\@kaprotatefalse}

%    \end{macrocode}
%
% \subsubsection{Rotation macros}
% These are used in the |kaprotate| environment. Note that these
% macros depend on PostScript output at this moment. Later,
% I might include commands for (at least) Tpic.
%
% These are just a few macro's, so it isn't really worth including |graphicx|
% at the moment.
%
% |\rotl| and |\rotr| rotate a given box over resp. 270 and 90 degrees
% while typesetting that box. The new box has $wd_{new}=dp_1 + ht_1$ and
% $ht_{new}=wd_1$, with $dp_{new} ==0$.
%    \begin{macrocode} 
\newdimen\rotdimen
\def\rotstart#1{\special{ps: gsave currentpoint currentpoint translate
    #1 neg exch neg exch translate}}
\def\rotfinish{\special{ps: currentpoint grestore moveto}}
\def\rotl#1{\rotdimen=\ht#1\advance\rotdimen by \dp#1
    \hbox to \rotdimen{\vbox to\wd#1{\vskip \wd#1
    \rotstart{270 rotate}\box #1\vss}\hss}\rotfinish}
\def\rotr#1{\rotdimen=\ht #1\advance\rotdimen by \dp#1
    \hbox to \rotdimen{\vbox to \wd#1{\vskip \wd#1
    \rotstart{90 rotate}\box #1\vss}\hss}\rotfinish}
%</main>
%<*other>
\endinput
%    \end{macrocode}
%\newpage
%\def\IndexParms{\hbadness=10000}
%\PrintIndex
%\end{document}
% end of klufloa.sty
%</other>