summaryrefslogtreecommitdiff
path: root/info/examples/tip/orcards.tip
blob: 337a7d88b625baab0a799659613e2cb2e15a0101 (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
% 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 34.5.1, p. IV-70.
% Original source in file "o1.TEX", starting line 532.
\wlog{L: "orcards.tip" ["o1.TEX," l. 532, p. IV-70]}%
% This file DOES NOT belong to format "texip."
\InputD{box-mac.tip}
\InputD{modonead.tip}
\InputD{nlm.tip}
\hsize = 3.0in
\baselineskip = 12pt
\topskip = 10pt plus 10pt
\vsize = 9\baselineskip
\countdef\PageNo = 0
\newcount\CardCount
\CardCount = 0
\def\Card #1{% 
    \vfill\eject
    \advance\CardCount by 1
    \noindent
    {\bf #1}
    \par
    \def\CardTitle{#1}%
}
\newdimen\RuleSpace     \RuleSpace = 10pt
\newdimen\BetweenRules  \BetweenRules = 20pt
\newdimen\BaseLineSkipSave
\BaseLineSkipSave = \baselineskip
\newcount\PositionCount
\PositionCount = 0
\def\HeadLine{%
    \line{%
        \strut
        {\it Cards, page \the\PageNo}% 
        \hfil
        \tt\jobname
    }% 
}
\def\FootLine{%
    \line{\strut*****\hfil*****}% 
}
\newbox\OutTopBox
\newbox\OutMidBox
\newbox\OutBotBox
\def\CardOutputRoutine{%
    \NewLineMessage{\string\CardOutputRoutine:
        card number: \the\CardCount,
        PositionCounter: \the\PositionCount,}%
    \NewLineMessage{page number: \the\PageNo,
        \string\outputpenalty: \the\outputpenalty.}%
    \ifnum\outputpenalty < -9999
        \setbox0 = \hbox{\strut}
    \else
        \setbox0 = \line{%
            \strut
            \hfil
            \it
            \CardTitle\space con't\/\dots
        }%
    \fi
    \setbox 2 = \vbox{%
        \offinterlineskip
        \hrule
        \vskip\RuleSpace
        \VboxR to \vsize{\unvbox 255 \vfill}
        \box0
        \vskip\RuleSpace
        \hrule
    }
    \global\setbox
        \ifcase\PositionCount
            \OutTopBox \or
            \OutMidBox \or
            \OutBotBox
        \fi
        = \box2
    \ifnum\PositionCount = 2
        \shipout\vbox{%
            \offinterlineskip
            \VboxR{
                \HeadLine
                \vskip\BaseLineSkipSave

                \box\OutTopBox
                \vskip\BetweenRules
                \box\OutMidBox
                \vskip\BetweenRules
                \box\OutBotBox

                \vskip\BaseLineSkipSave
                \FootLine
            }
        }
    \fi
    \ifnum\outputpenalty = -20000
        \NewLineMessage{\string\supereject\space encountered.}
        \ifnum\PositionCount < 2
            \line{}
            \vfill
            \supereject
        \fi
    \fi
    \ifnum\ModuloOneAdvanceNumCond{\PositionCount}{3} = 0 
        \global\advance\pageno by 1
    \fi
}
\output = {\CardOutputRoutine}