% This macro source file is from the four volume series
% "TeX in Practice" by Stephan von Bechtolsheim, published
% 1993 by Springer-Verlag, New York.
% Copyright 1993 Stephan von Bechtolsheim.
% No warranty or liability is assumed.
% This macro may be copied freely if no fees other than
% media cost or shipping charges are charged and as long
% as this copyright and the following source code itself
% is not changed. Please see the series for further information.
%
% Version: 1.0
% Date: May 1, 1993
%
%
% This source code is documented in 35.9.3, p. IV-128.
% Original source in file "o2.TEX", starting line 2156.
\wlog{L: "ts-float.tip" ["o2.TEX," l. 2156, p. IV-128]}%
% This file DOES belong to format "texip."
\InputD{dblarg.tip}
\InputD{centpar.tip}
\InputD{futlet.tip}
\InputD{compst.tip}
\InputD{topinfix.tip}
\catcode`\@ = 11
\NewCounter{FigureNo}{\arabic}%
{\TheCounter{ChapterNo}.\TheCounter{FigureNo}}%
{\TheCounter{ChapterNo}.\TheCounter{FigureNo}}%
\NewCounter{TableNo}{\arabic}%
{\TheCounter{ChapterNo}.\TheCounter{TableNo}}%
{\TheCounter{ChapterNo}.\TheCounter{TableNo}}%
\AddCounterToResetList{FigureNo}{ChapterNo}
\AddCounterToResetList{TableNo}{ChapterNo}
\def\Caption{\DblArg{\@Caption}}
\def\@Caption [#1]#2{%
\errmessage{\string\@Caption: caption out of place, caption
text = #1.}%
}
\def\BeginFigure{%
\DoFutureLet{\ifx}{[}{\@BeginFigure}{\@BeginFigure[t]}%
}
\newif\if@FigureInsertOk
\def\@BeginFigure[#1]{%
\begingroup
\def\@UseThisInsert{}%
\@FigureInsertOkfalse
\if\StringsEqualConditional{#1}{t}%
\def\@UseThisInsert{\topinsert}%
\@FigureInsertOktrue
\fi
\if\StringsEqualConditional{#1}{p}%
\def\@UseThisInsert{\pageinsert}%
\@FigureInsertOktrue
\fi
\if@FigureInsertOk
\else
\errmessage{\string\@BeginFigure: illegal argument
"#1." Use [t] instead.}%
\def\@UseThisInsert{\topinsert}%
\fi
\gdef\FigureCaptionText{}%
\gdef\FigureCaptionTextLof{}%
\StepCounter{FigureNo}%
\def\Label ##1{\@Label{##1}{\RefCounter{FigureNo}}{0}}%
\def\@Caption [##1]##2{%
\gdef\FigureCaptionTextLof{##1}%
\gdef\FigureCaptionText{##2}%
\wlog{\noexpand\@Caption (figures), caption text saved:
##2.}%
}%
\setbox 0 = \vbox\bgroup
}
\def\EndFigure{%
\egroup
\@UseThisInsert
\box0
\if\EmptyStringConditional{\FigureCaptionText}%
\else
\bigskip
\CenterOrParagraph{%
\small
Figure~\PrintCounter{FigureNo}.
\FigureCaptionText
}%
\WriteToAuxSpecial{lof}{1}{\PrintCounter{FigureNo}}%
{\FigureCaptionTextLof}{\PrintCounter{PageNo}}%
\fi
\endinsert
\endgroup
}
\def\BeginTable{%
\begingroup
\gdef\TableCaptionText{}%
\gdef\TableCaptionTextLot{}%
\StepCounter{TableNo}%
\def\Label ##1{\@Label{##1}{\RefCounter{TableNo}}{0}}%
\def\@Caption [##1]##2{%
\gdef\TableCaptionText{##2}%
\gdef\TableCaptionTextLot{##1}%
\wlog{\noexpand\@Caption for tables: ##2}%
}%
\setbox 0 = \vbox\bgroup
}
\def\EndTable{%
\egroup
\topinsert
\if\EmptyStringConditional{\TableCaptionText}%
\else
\smallskip
\CenterOrParagraph{%
\small
Table~\PrintCounter{TableNo}.
\TableCaptionText}%
\WriteToAuxSpecial{lot}{1}{\PrintCounter{TableNo}}%
{\TableCaptionTextLot}{\PrintCounter{PageNo}}%
\smallskip
\fi
\box0
\endinsert
\endgroup
}
\catcode`\@ = 12