summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/genmisc/ruler.tex
blob: c35928e6a6887993c2d403c832e22dd91d99e0f3 (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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Typographic ruler for TeX, version 1.1
% Copyright Victor Eijkhout 1999
% file name: ruler.tex
%
% Author:
% Victor Eijkhout
% Department of Computer Science
% University of Tennessee, Knoxville TN 37996
%
% victor@eijkhout.net
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
% 
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% For a copy of the GNU General Public License, write to the 
% Free Software Foundation, Inc.,
% 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA,
% or find it on the net, for instance at
% http://www.gnu.org/copyleft/gpl.html
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is identical to an earlier version which was on ctan and
% other archive sites; only the license and copyright information
% has changed.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\hsize=14.5cm \vsize=32cm \voffset=-1.5cm 
\nopagenumbers \raggedbottom
\overfullrule=0pt
%\tracingoutput=1 
\showboxbreadth=20 \showboxdepth=7

\font\tiny=cmr5 \font\ss=cmr8 
\font\big=cmss10 scaled \magstep3
\font\manual=cmr10

%\font\tiny=helv at 5pt \font\ss=helv at 8pt 
%\font\big=helv at 16pt
%\font\manual=times at 10pt 

\let\tt=\ss \let\rm=\ss
\parindent=0cm \offinterlineskip
\def\\{\hfill\break}

\newdimen\margin \margin=.5cm
\newdimen\linewidth \linewidth=0.05mm
\newdimen\scalewidth \scalewidth=6mm \newdimen\magboxwidth
\newdimen\gridheight \gridheight=8cm
\newdimen\rulewidth \rulewidth=\scalewidth
\newdimen\ruleboxheight \ruleboxheight=6mm

\newbox\magscalenames \newbox\scale \newbox\grid 
\newbox\stairs \newbox\ruler
\newcount\ncol \newcount\nrow
\newcount\tempcount \newcount\tempcountb \newcount\tempcounth
\newbox\tempboxa \newbox\tempboxb
\newskip\tempskip \newskip\tempskipb
\newdimen\tempdimen \newdimen\tempdimenb \newdimen\tempdimenc

\newbox\storea \newbox\storeb \newbox\storec 
\newbox\stored \newbox\storee \newbox\storef
\newbox\storeg \newbox\storeh \newbox\storei
\newbox\storej

\def\gobble#1{}
\def\gobbletwo#1#2{}
\def\gobblethree#1#2#3{}
\def\gobblefive#1#2#3#4#5{}

\def\hfilll{\hskip 0cm plus 1filll\relax}

%%%%%%%%%%%%%%%% trace
%\tracingonline=1 
%\tracingmacros=1

%%%%%%%%%%%%%%%% auxiliaries
\def\decimala     %% #1=getal; a-> 1 plaats achter de komma
    #1{{\tempcounth=#1\relax
        \tempcountb=\tempcounth
        \divide\tempcountb by 10\relax
        \number\tempcountb.%
        \multiply\tempcountb by 10\relax
        \advance\tempcounth by -\tempcountb
        \number\tempcounth}}
        
\def\decimalb     %% #1=getal; b-> 2 plaatsen achter de komma
    #1{{\tempcounth=#1\relax
        \tempcountb=\tempcounth
        \divide\tempcountb by 100\relax
        \number\tempcountb.%
        \multiply\tempcountb by 100\relax
        \advance\tempcounth by -\tempcountb
        \ifnum\tempcounth<10 0\fi
        \number\tempcounth}}
        
\def\hundred#1{{\tempcounth=#1 
                \tempcountb=\tempcounth
                \divide\tempcounth by 100\relax
                \ifnum\tempcounth>0 
                            \number\tempcounth.\fi
                \multiply\tempcounth by 100
                \advance\tempcountb by -\tempcounth
                \ifnum\tempcountb<10 0\fi
                \number\tempcountb}}

\def\thousand#1{{\tempcount=#1 \tempcountb=\tempcount
                 \divide\tempcount by 1000
                 \ifnum\tempcount>0 \number\tempcount.\fi
                 \multiply\tempcount by 1000
                 \advance\tempcountb by -\tempcount
                 \ifnum\tempcountb<100 0\fi
                 \ifnum\tempcountb<10 0\fi
                 \number\tempcountb}}

\def\headedbox        %% #1=heading text #2=vbox
    #1#2{\vtop{\vbox to 0cm{\vss\setbox0=\hbox to 0cm{\tt #1\hss} \dp0=0cm 
                            \box0 \vskip2pt}
               #2}}
\def\boxit#1{\vbox{\hrule
                   \hbox{\vrule #1\vrule}
                   \hrule}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%% baseline measurement %%%%%%%%%%%%%%%%%%%%%%%%
\newskip\liftskip
%% what baselineskips are needed?
\def\baselinedist#1{\ifcase#1\or 5\or 6\or 7\or 8\or 9\or 10\or
           11\or 12\or 13\or 14\or 15\or 16\or 17\or
           18\or 20\or 22\or 25\or 30\fi}

%% first one step in a ladder of baselineskips
\def\baselinebox      %% #1=size #2=number label
    #1#2{\vbox to #1pt{\vfil
                 \moveright .5\hsize\vbox{\hrule height \linewidth 
                                          width .5\hsize}
                 \vfil\vbox to 0cm{\vss\hskip2pt\tiny\number#2\vskip\liftskip}
                 \hrule height \linewidth}}

%% next a whole ladder of baselineskips
\def\baselinescale    %% #1=number of steps #2=point size
    #1#2{\ifnum#2<7 \liftskip=0pt \else \liftskip=2pt \fi
         \setbox\scale=\vbox{}%
         \baselinescalei 1{#1}{#2}%
         \edef\tcs{{#2}{\box\scale}}\expandafter\headedbox\tcs}
\def\baselinescalei   %% #1=label #2=number of steps #3=point size
    #1#2#3{\ifnum#1>#2 \def\tcs{0}\let\next=\gobblethree
           \else\tempcount=#1 \advance\tempcount by 1
                \setbox\scale=\vtop{\hsize=\scalewidth
                                    \advance\hsize by -\linewidth
                                    \unvbox\scale
                                    \baselinebox{#3}{#1}}%
                \let\next\baselinescalei \edef\tcs{{\number\tempcount}}\fi
           \expandafter\next\tcs{#2}{#3}}

%% finally a grid of ladders of baselineskips
\def\baselinegrid     %% #1=number of baseline scales #2=storage box
    #1#2{\setbox\grid=\hbox{}%
         \setbox#2=\vtop{\hrule height 0pt depth \linewidth
             \baselinegridi 1{#1}
             \hrule height \linewidth}}
\def\baselinegridi    %% #1=current number #2=total number of baseline scales
    #1#2{\ifnum#1>#2 \hbox{\vsize=\gridheight \unhbox\grid
                           \vrule width \linewidth}
         \else\tempcount=\gridheight \tempskip=\baselinedist{#1}pt
              \divide\tempcount by \tempskip \edef\tcs{{\number\tempcount}}
              \setbox\grid=
                  \hbox{\vsize=\gridheight \unhbox\grid
                        \vrule width \linewidth
                        \expandafter\baselinescale\tcs{\baselinedist{#1}}}
              \tempcount=#1 \advance\tempcount by 1 \edef\tcs{{\number\tempcount}}
              \expandafter\baselinegridi\tcs{#2}\fi}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% magnified font sizes %%%%%%%%%%%%%%%%%%%%%%%%%
\newcount\honcor
\long\def\bungeltext#1#2{
    \hrule height \linewidth
    \kern1mm
    \vbox{\hsize=#1\relax \rightskip=0cm plus 1fil
          \lineskiplimit=0pt \lineskip=0pt \baselineskip=6pt
          \tiny #2\par}}

\def\magstep#1{\ifcase#1 1000\or 1095\or 1200\or 1440\or 1728\or 
                         2074\or 2488\fi}
\def\tienstep#1{\ifcase#1 10\or 10.95\or 12\or 14.4\or 17.28\or
                         20.74\or 24.88\fi}
\def\zevenstep#1{\ifcase#1 7\or 7.67\or 8.4\or 10.08\or 12.10\or
                         14.52\or 17.42\fi}
\def\vijfstep#1{\ifcase#1 5\or 5.48\or 6\or 7.2\or 8.64\or
                         10.37\or 12.44\fi}

\def\magname#1{\ifcase#1 0\or half\or 1\or 2\or 3\or 4\or 5\fi}
\def\cmmagbox#1{{\divide\tempdimen by 1000
                 \multiply\tempdimen by \magstep#1%
                 \tempdimenb=.01mm \tempdimenc=\tempdimen 
                 \divide\tempdimenc by \tempdimenb
                 \tempcount=\tempdimenc
                 \edef\next{\the\tempcount}%
                 \divide\honcor by 1000
                 \multiply \honcor by \magstep#1\relax
                 \tempdimenc=.01pt \divide\honcor by \tempdimenc
                 \edef\mixt{\the\honcor}%
                 \edef\next{\noexpand\magbox{\the\tempdimen}{\magname#1}%
                             {\noexpand\hundred{\next}}
                             {\noexpand\corrout#1}}\next}}
\def\magbox  %% #1=height #2=first text #3=second #4=third
    #1#2#3#4{\vtop{\hbox{\vrule width\linewidth
                       \vbox{\hrule width \magboxwidth height \linewidth 
                             \kern #1}}
                   \bungeltext\magboxwidth
                        {#2\par #3\par #4\par}
                  }}

\def\magsteps{\vtop{\hbox{\cmmagbox0\cmmagbox1\cmmagbox2%
                          \cmmagbox3\cmmagbox4\cmmagbox5\cmmagbox6%
                          \vrule width \linewidth depth 0cm}}}

\def\magrow           %% #1=name #2=unit numerator #3=unit denominator
                      %% #4=unit size #5=design size #6=store box
  #1#2#3#4#5#6{\tempdimen=#4 \divide\tempdimen by #3
               \multiply\tempdimen by #2
               \tempdimenb=#5pt \honcor=\tempdimenb
               \ifnum#5=10 \let\corrout\tienstep
                     \else\ifnum#5=7 \let\corrout\zevenstep
                     \else \let\corrout\vijfstep \fi\fi
               \magboxwidth=\scalewidth \setbox\tempboxa=\magsteps
               \setbox\tempboxb=
                       \vtop{\vbox{\hsize=1.2cm 
                                   \lineskiplimit=0pt \lineskip=0pt
                                   \baselineskip=6pt
                                   \def\\{\hfil\break} \tiny #1
                                   \par \kern1mm}
                             \setbox0=\hbox{\tiny point size }
                             \bungeltext{\wd0}{magstep\par 
                                               mm \par point size\par}}
               \tempdimen=\wd\tempboxa \advance\tempdimen by \wd\tempboxb
               \advance\tempdimen by 2mm
               \setbox#6=
                 \hbox to \tempdimen{\box\tempboxa \kern2mm \box\tempboxb}}
   
\def\magsizebox      %% #1=text
    #1{\hbox to 1.5\scalewidth{\hfil \tiny #1\hfil}}

%%%%%%%%%%%%%%%%%%%%%%%% general magrows %%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\gmagsteps        %% #1=from #2=by #3=to
    #1#2#3{\tempcount=#1\relax
           {\multiply\tempdimen by \tempcount \tempcountb=\tempdimen
            \tempdimenc=.01mm \divide\tempcountb by \tempdimenc
            \edef\next{\the\tempcountb}%
            \edef\next{\noexpand\magbox{\the\tempdimen}{\the\tempcount}%
                                       {\noexpand\hundred{\next}}{}}%
            \next}%
           \advance\tempcount by #2%
           \ifnum\tempcount=#3\relax\vrule width \linewidth depth 0cm
           \else\edef\next{\noexpand\gmagsteps
                             {\number\tempcount}{#2}{#3}}\next\fi}

\def\gmagrow          %% #1=name #2=unit numerator #3=unit denominator
                      %% #4=unit size #5=from #6=by #7=to #8=store box
    #1#2#3#4#5#6#7#8{\tempdimen=#4 \divide\tempdimen by #3
       \multiply\tempdimen by #2 
       \setbox#8=\hbox{\magboxwidth\scalewidth \gmagsteps{#5}{#6}{#7}
                       \ {}
                       \vtop{\kern0cm
                             \setbox0=\hbox{\tiny point size }
                             \bungeltext{\wd0}{point size\\mm}}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% rulers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifleftruler \newdimen\stapje \newdimen\Stap \newdimen\hstapje
\newcount\halfway \newcount\alltheway
\newbox\onerulerbox
\newdimen\vollebreedte \newdimen\vollebreedteplus
\newdimen\overschot \overschot=.75mm

\def\doalltheway
    #1#2#3{#3{#1}\relax
           \ifnum#1=#2\relax\else
           \tempcount=#1 \advance\tempcount by 1
           \expandafter\doalltheway\expandafter
                {\number\tempcount}{#2}{#3}\fi}

\def\centimeterruler{\Stap=1cm \leftrulerfalse
                     \vollebreedte=1cm\relax
                     \def\rulename{centimeter}%
                     \let\ruledigitfont=\rm
                     \alltheway=10 \doruler{cm}}
\def\inchruler{\Stap=1in \leftrulertrue 
               \vollebreedte=1cm\relax
               \def\rulename{inch}%
               \let\ruledigitfont=\rm
               \alltheway=8 \doruler{inch}}
\def\picaruler{\Stap=12pt \leftrulerfalse 
               \vollebreedte=1cm\relax
               \def\rulename{pica}%
               \let\ruledigitfont=\tiny
               \alltheway=6 \doruler{pica}}
\def\rulerpiece
    #1{\vbox to \stapje{\vfil \rulerhalfline \vfil \rulerline{#1}}}
\def\rulerline %% streepje over aantal mm; halfweg volle breedte
    #1{\ifnum#1=\halfway \tempskipb=\vollebreedteplus
       \else \tempskipb=#1\hstapje
             \advance\tempskipb by \overschot \fi
       \hbox to \vollebreedteplus
            {\maybeleft \vrule width\tempskipb height\linewidth
             \mayberight }}
\def\rulerhalfline
    {\tempskipb=.5\hstapje \advance\tempskipb by \overschot
     \hbox to \vollebreedteplus
          {\maybeleft\vrule width\tempskipb height\linewidth
           \mayberight}}
\def\rulerbox         %% #1=label
    #1{\vbox to 0cm{\kern.75mm\relax %was .5\stapje
                    \hbox to \vollebreedteplus
                                {\mayberight
                                 \kern.75mm\ruledigitfont 
                                 #1\kern.75mm
                                 \maybeleft}
                    \vss}
       \copy\onerulerbox}
\def\makerulerbox{\global\setbox\onerulerbox=
       \vbox to \Stap{\vbox to 0cm
                {\hbox{\ifleftruler\kern\overschot\fi
                       \kern.5\vollebreedte
                       \vrule depth \Stap width\linewidth}
                 \vss}
                       \doalltheway1{\alltheway}{\rulerpiece}
                       \vss}}
\def\doruler  %% #1=unit name #2=length #3=storage box 
    #1#2#3{\ifleftruler \let\maybeleft\relax \let\mayberight\hfil
           \else        \let\maybeleft\hfil  \let\mayberight\relax
           \fi
       \bgroup \halfway=\alltheway \divide\halfway by 2\relax
               \stapje=\Stap \divide\stapje by \alltheway
               \hstapje=\vollebreedte \divide\hstapje by \alltheway
       \vollebreedteplus=\vollebreedte
       \advance\vollebreedteplus by \overschot
       \makerulerbox
       \setbox\ruler=\vbox{\hrule width \vollebreedteplus height\linewidth}%
       \doruleri 0{#2}\relax
       \global\setbox\ruler=
           \hbox{\ifleftruler\else\vrule width\linewidth\fi
                 \box\ruler
                 \ifleftruler \vrule width\linewidth \fi}%
       \xdef\tcs{{#1}{\box\ruler}}\egroup
       \setbox#3\expandafter\headedbox\tcs}
 \def\doruleri
    #1#2{\ifnum#1>#2 \let\next=\gobbletwo \def\tcs{0}%
         \else \setbox\ruler=
                   \vtop{\unvbox\ruler\rulerbox{#1}}%
               \let\next=\doruleri
               \tempcount=#1\relax \advance\tempcount by 1 
               \edef\tcs{{\number\tempcount}}\fi
         \expandafter\next\tcs{#2}}

%%%%%%%%%%%%%%%%%%%%%%%%%% paper size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\papersize#1#2{\vtop
    {\kern0cm\vbox to #2{
     \vbox to #1{\vfil\hrule width 2mm height 0cm depth \linewidth}
                 \vfil\hrule width 2mm height 0cm depth \linewidth}}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%% rule thickness %%%%%%%%%%%%%%%%%%%%%%%%%%
\newdimen\rulelength \rulelength=.75\scalewidth
\newdimen\interruleskip \interruleskip=.5\scalewidth

\def\ruleboxh         %% #1=rule thickness #2=label
    #1#2{\setbox\tempbox=
                  \vbox{\hsize=\rulewidth 
                        \vfill \vskip10pt \hbox{\tiny \rulenum{#2}}
                        \vskip1pt \hrule height #1 width \rulewidth}%
         \ifdim\ht\tempbox<\ruleboxheight
               \vbox to \ruleboxheight{\unvbox\tempbox}%
         \else\box\tempbox\fi}
\def\ruleboxv         %% #1=rule thickness #2=label
    #1#2{\vtop{\kern0cm
               \hbox{\hbox to 5mm{\tiny \hfil \rulenum{#2}\kern1mm}%
                     \vrule height \rulelength width #1}
               \kern \interruleskip}}
\let\rulebox=\ruleboxv
\def\rulestackhead    %% #1=minimal label #2=label step
                      %% #3=minimal dimen #4=dimen step
                      %% #5=maximal label #6=storage box #7=header
    #1#2#3#4#5#6#7{\setbox\scale=\vbox{}%
             \rulestacki{#1}{#2}{#3}{#4}{#5}%
             \setbox#6=\headedbox{#7}{\box\scale}}
\def\rulestack        %% #1=minimal label #2=label step
                      %% #3=minimal dimen #4=dimen step
                      %% #5=maximal label #6=storage box
    #1#2#3#4#5#6{\setbox\scale=\vbox{}%
             \rulestacki{#1}{#2}{#3}{#4}{#5}%
             \setbox#6=\box\scale}
\def\rulestacki       %% #1=curr label #2=label step 
                      %% #3=curr dimen #4=dimen step #5=total dimen
    #1#2#3#4#5{\ifnum#1>#5%
                     \setbox\scale=
                        \vtop{\unvbox\scale \setbox0=\lastbox}%
                     \let\next=\gobblefive \def\tcs{0}%
               \else \setbox\scale=
                        \vtop{\unvbox\scale
                              \rulebox{#3}{#1}}%
                     \tempskip=#3\relax \advance\tempskip by #4\relax
                     \tempcount=#1\relax \advance\tempcount by #2\relax
                     \let\next=\rulestacki
                     \edef\tcs{{\number\tempcount}}\fi
               \expandafter\next\tcs{#2}{\tempskip}{#4}{#5}}
                     

%%%%%%%%%%%%%%%%%%%%%%%%%% conversion table %%%%%%%%%%%%%%%%%%%%%%%%
\def\num{\ss\enspace\hfill}
\def\me#1{\ifcase#1\relax\or pt\or pc\or dd\or cc\or bp\or mm\or in\fi}
\def\table{\halign{\strut\hbox to 1cm{\tt##\hfil}\vrule\enspace
                   &\num##&\num##&\num##&\num##&\num##&\num##&\num##\cr
    \hfill&\tt \me1&\tt \me2&\tt \me3&\tt \me4&\tt \me5&\tt \me6&\tt \me7\cr
   \noalign{\hrule}
    \me1&1&.0833&&&&.351&.0138\cr
    \me2&12&1&&&&4.218&.166\cr
    \me3&&&1&.0833&&.376&.0148\cr
    \me4&&&12&1&&4.513&.1777\cr
    \me5&&&&&1&.383&.0139\cr
    \me6&2.845&.237&2.659&.222&2.835&1&.0394\cr
    \me7&72.27&6.0225&67.54&5.628&72&25.4&1\cr
          }}
%%%%%%%%%%%%%%%%%%%%%%%%%% the whole sheet %%%%%%%%%%%%%%%%%%%%%%%%%

\def\opskip{\vskip.5mm\relax}
\let\neerskip\opskip

\output{}

\begingroup\hsize=12cm \vsize=8in
\parindent=0pt \parskip=6pt
\rightskip=0cm plus 5cm \normalbaselines

\hbox{}\vskip3cm
\big The \TeX\ ruler

\manual
This is the \TeX\ ruler, a measuring device for
typographical designers working with \TeX. It includes ordinary
rulers in inches, centimeters, and picas.
It can be used to measure font sizes, baseline distances,
and rule weights. The design is based on a ruler
by Inge~Eijkhout, implementation in \TeX\ is by 
Victor~Eijkhout.

The \TeX\ ruler is shareware, distributed under the GNU Public License.
If you want to show your appreciation, send a contribution
to the address below.

How to format and print this file

This file will give you three pages. Most likely the second one
cannot be handled by your printer, but I've included it for
completeness. At the top of the source file, 3 fonts are
declared. Please change the CM fonts to something more pretty,
eg Helvetica.

How to use the \TeX\ ruler

Rulers. Use them like ordinary rulers. It is suggested
that you print the \TeX\ ruler on transparent plastic and
cut the edges along the rulers.

Baseline distances. Put the top line along the baseline
of some line of text. Then see in what column the other
lines of text line up.

Font sizes: cap height. Take an uppercase letter
such as `K' or `H'. Find the line with its font name,
or use the first line. See what box on that line
it fits in best, with the character completely between
the lines. Read out the magnification and size of the
font. Alternately check on all lines which box fits
best, then read out the size.

General remark: all lines have a width of .05 millimeter. 
This is less than the dot width of a 300dpi
laser printer, so beware of some inaccuracies.
Also your printer driver may introduce 
inaccuracies.

\leavevmode
{\obeylines \parskip=0pt %
Victor Eijkhout
Department of Computer Science
University of Tennessee
Knoxville, TN 37996
USA\par {\tt victor@eijkhout.net}}

\vfil
Copyright 1990-99 by Victor Eijkhout
\eject
\endgroup

\endlinechar-1

\def\BigSheet{\leavevmode
\leftrulertrue \inchruler{11}{\storea}
\box\storea
\papersize{8.5in}{11in}
%
\vtop{
  \baselinegrid{18}\storea \box\storea
  \kern1mm
  \moveright2mm
  \vbox{\hbox{\ss Baseline distances}
        \neerskip \hrule}
  \kern5mm
  %
 \moveright2mm
 \hbox{
 \vtop{\vbox{\hrule \opskip \hbox{\ss Cap heights}}
       \kern-3mm
  \def\a{\kern2mm}
  \magrow{cmr10\\cmbx10\\cmss10\\cmmi10}{250}{36}{1pt}{10}\storec
  \magrow{cmtt10\\cmff10}{220}{36}{1pt}{10}\stored
  \magrow{cmr7\\cmbx7\\cmmi7}{175}{36}{1pt}7\storee
  \magrow{cmr5\\cmbx5\\cmmi5}{125}{36}{1pt}5\storef
  \vbox{\a\box\storec \a\box\stored
        \a\box\storee \a\box\storef}
  %
  \gmagrow{cmr10}{25}{36}{1pt}51{14}\storec
  \gmagrow{cmr10}{25}{36}{1pt}{15}1{24}\stored
  \gmagrow{cmr10}{25}{36}{1pt}{26}2{44}\storee
  \gmagrow{cmr10}{25}{36}{1pt}{46}2{64}\storef
  \vbox{\a\box\storec \a\box\stored
        \a\box\storee \a\box\storef}
  %
  \leftrulertrue \picaruler{19}{\storea}
  \setbox\storeb=\vtop{\kern0cm 
                       \def\a{}%{\moveright1cm}
                       \a\vbox{\hrule \opskip
                               \hbox{\strut\ss Conversion of units}}
                       \kern2mm
                       \halign{\vrule height8pt depth3pt width0pt
                               \ss##\ &${}={}$\hfil\ \ss##&$\,$##\cr
                               1{\tt in}& 72.27&{\tt pt}\cr
                               1{\tt in}& 72&{\tt bp}\cr
                               1{\tt in}& 25.4&{\tt mm}\cr
                               1157{\tt dd}& 1238&{\tt pt}\cr
                               1{\tt pt}& 65536&{\tt sp}\cr}
                       \kern2mm \table
                       \kern8mm
                       \hbox{\hskip1cm \big The \TeX\ Ruler}
                       \kern2pt
                       \hbox{\hskip1cm \tiny Design:\ {}
                             Inge and Victor Eijkhout 1990--96}}
  \kern4mm
  \hbox{\box\storea \kern2mm \box\storeb}
  }%end of \vtop
 \kern-1cm
 \vtop{\vbox{\hrule \opskip \hbox{\ss Rule weights}}
       \kern5mm
   \let\rulenum=\decimalb
   \rulestackhead{5}{5}{0.05mm}{0.05mm}{100}\storeg{mm}
   \rulestack    {100}{25}{1mm}{0.25mm}{525}\storeh
   \let\rulenum=\decimala
   \rulestackhead{5}{5}{.5pt}{.5pt}{151}\storei{pt}
   \hbox{\box\storeg \kern3mm \box\storeh \kern3mm \box\storei}
  }%end of second \vtop
 }%end of \hbox
  }
%
\kern2mm\relax
\leftrulerfalse \centimeterruler {29}{\storea}
\papersize{21cm}{29.7cm}
\box\storea
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\smallsheet{\leavevmode
\leftrulertrue \inchruler{9}{\storea}
\box\storea \kern2mm
%
\vtop{
  \baselinegrid{18}\storea \box\storea
  \kern1mm
  \moveright2mm
  \vbox{\hbox{\ss Baseline distances}
        \neerskip \hrule}
  \kern5mm
  %
 \moveright2mm
 \hbox{
 \vtop{\vbox{\hrule \opskip \hbox{\ss Cap heights}}
       \kern-3mm
  \def\a{\kern2mm}
  \magrow{cmr10\\cmbx10\\cmss10\\cmmi10}{250}{36}{1pt}{10}\storec
  \magrow{cmtt10\\cmff10}{220}{36}{1pt}{10}\stored
  \magrow{cmr7\\cmbx7\\cmmi7}{175}{36}{1pt}7\storee
  \magrow{cmr5\\cmbx5\\cmmi5}{125}{36}{1pt}5\storef
  \vbox{\a\box\storec \a\box\stored
        \a\box\storee \a\box\storef}
%
  \leftrulertrue \picaruler{19}{\storea}%\showbox\storea
  \setbox\storeb=\vtop{\kern0cm 
                       \def\a{}%{\moveright1cm}
                       \a\vbox{\hrule \opskip
                               \hbox{\strut\ss Conversion of units}}
                       \kern2mm
                       \halign{\vrule height8pt depth3pt width0pt
                               \ss##\ &${}={}$\hfil\ \ss##&$\,$##\cr
                               1{\tt in}& 72.27&{\tt pt}\cr
                               1{\tt in}& 72&{\tt bp}\cr
                               1{\tt in}& 25.4&{\tt mm}\cr
                               1157{\tt dd}& 1238&{\tt pt}\cr
                               1{\tt pt}& 65536&{\tt sp}\cr}
                       \kern2mm \table
                       \kern8mm
                       \hbox{\hskip1cm \big The \TeX\ Ruler}
                       \kern2pt
                       \hbox{\hskip1cm \tiny Design:\ {}
                             Inge and Victor Eijkhout 1990--96}}
  \kern4mm
  \hbox{\box\storea \kern2mm \box\storeb}
  }%end of \vtop
 \kern-1cm
 \vtop{\vbox{\hrule \opskip \hbox{\ss Rule weights}}
       \kern5mm
   \let\rulenum=\decimalb
   \rulestackhead{5}{5}{0.05mm}{0.05mm}{50}\storeg{mm}
   \rulestack    {50}{10}{.5mm}{0.1mm}{160}\storeh
   \let\rulenum=\decimala
   \rulestackhead{5}{5}{.5pt}{.5pt}{101}\storei{pt}
   \hbox{\box\storeg \kern3mm \box\storeh \kern3mm \box\storei}
  }%end of second \vtop
 }%end of \hbox
  }
%
\kern2mm\relax
\leftrulerfalse \centimeterruler {23}{\storea}
\box\storea
}


\count0=2
\BigSheet
\vfill\eject
\count0=3
\smallsheet

\end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%