summaryrefslogtreecommitdiff
path: root/info/examples/tip/ts-float.tip
blob: 1ecb25db718cd90478cabe4b2dc2560ee2ac1117 (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
% 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