summaryrefslogtreecommitdiff
path: root/info/examples/tip/font-cpp.tip
blob: c127d76ed56d3b296d77dfebf365cc7cfcedce29 (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
% 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 16.2.11, p. II-283.
% Original source in file "fonts2.TEX", starting line 1007.
\wlog{L: "font-cpp.tip" ["fonts2.TEX," l. 1007, p. II-283]}%
% This file DOES belong to format "texip."
\InputD{leadingz.tip}
\InputD{imodn.tip}
\def\CharactersPerPica #1{% 
    \setbox0 = \hbox{%
        #1\relax
        This paragraph has 423 characters. We know that
        because we counted it. It is very simple to count, because
        the Emacs editor we are using has a function ``advance
        by one character.'' And with the prefix command (that's
        Emacs terminology) you can execute ``advance by
        one character'' 423~times. Now, let's hope that this text
        is representative of ordinary text so that our average
        number of characters per pica is correct.
    }%
    {%
        \count1 = \wd0
        \divide\count1 by 100
        \count0 = 423
        \multiply\count0 by 65536
        \multiply\count0 by 12
        \divide\count0 by \count1
        \count2 = \count0
        \divide\count2 by 100
        \IModN{\count0}{100}{\count3}%
        \the\count2.\LeadingZ{\count3}%
    }%
}