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
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
|
6-Jan-87 14:26:26-PST,19188;000000000000
Return-Path: <mcvax!nplpsg!jrp@seismo.CSS.GOV>
Received: from seismo.CSS.GOV by SU-SCORE.ARPA with TCP; Tue 6 Jan 87 14:24:36-PST
Received: from mcvax.UUCP by seismo.CSS.GOV (5.54/1.14) with UUCP
id AA12122; Tue, 6 Jan 87 17:26:41 EST
Received: by mcvax.cwi.nl; Tue, 6 Jan 87 23:09:20 +0100 (MET)
Received: from nplpsg.uucp by eagle.Ukc.AC.UK with UUCP id a011462;
6 Jan 87 21:59 GMT
Received: from suna by suna.psg.npl.co.uk; Tue, 6 Jan 87 21:36:58 GMT
To: TeXhax@score.stanford.edu, unix-tex@ward.cs.washington.edu
Subject: TeX V troff
Return-Receipt-To: mcvax!psg.npl.co.uk!jrp@seismo.CSS.GOV
Date: Tue, 06 Jan 87 21:36:56 GMT
Message-Id: <3417.536967416@psg.npl.co.uk>
From: John Pavel <mcvax!nplpsg!jrp@seismo.CSS.GOV>
Here is a slightly more readable version of the paper that I sent out at
the end of last year.
It was processed with the dvidoc program available from ken@rochester.arpa.
John Pavel
----snip--------snip--------snip--------snip--------snip--------snip----
Document Preparation:
Some Notes on TeX and troff
John Pavel
National Physical Laboratory
Division of Information Technology and Computing
Protocol Standards Group
1.15 dated 86/12/23 at 11:38:13
Abstract
This document gives a short comparison of
various features of the text formatters troff
and TeX.
Any opinions expressed here are the personal
opinions of the author.
The document is, at present incomplete. The
main features lacking are
1. A good bibliography;
2. A list of sources;
3. Some conclusions.
Contents
1The Formatters 2
1.1troff ::::: :::::: ::::: :::::: ::::: ::::: : 2
1.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 2
2Cost 3
2.1troff ::::: :::::: ::::: :::::: ::::: ::::: : 3
2.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 3
3Markup Codes 3
3.1troff ::::: :::::: ::::: :::::: ::::: ::::: : 3
3.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 4
3.3Macro Packages ::: ::::: :::::: ::::: ::::: : 4
4Driving Output Devices 6
4.1troff ::::: :::::: ::::: :::::: ::::: ::::: : 6
4.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 7
5User Interface 8
5.1troff ::::: :::::: ::::: :::::: ::::: ::::: : 8
5.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 8
6Fonts 8
6.1Restrictions ::::: ::::: :::::: ::::: ::::: : 9
7Typesetting Mathematics 9
7.1troff and eqn :::: ::::: :::::: ::::: ::::: : 9
7.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 9
8Tables, Lines and Boxes 9
8.1troff and tbl :::: ::::: :::::: ::::: ::::: : 9
8.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: : 9
9Graphics 10
9.1troff ::::: :::::: ::::: :::::: ::::: ::::: :10
9.2TeX :: ::::: :::::: ::::: :::::: ::::: ::::: :10
1Documentation 11
1Other Utilities 11
11.Slide Preparation ::::: :::::: ::::: ::::: :11
11.Program Grinding : ::::: :::::: ::::: ::::: :11
11.Bibliographic Citation : :::::: ::::: ::::: :12
1
1 The Formatters
The two computerised text formatting systems
considered in this note are TeX and troff .
1.1 troff
troff was developed by Ossanna and is available
only on Unix1 systems (which runs on almost
all machines known to man. ). It is probably
less sophisticated than TeX, but has very
nice preprocessors for tables, mathematics and
figures.
1.2 TeX
TeX was developed at Stanford by Donald Knuth.
It runs on almost all machines known to
man, including the VAX2 (under both ULTRIX3
(4.2bsd) and VMS4), Sun, IBM PC5, the big
IBM VMCMS7 machines, and the Macintosh8 . It
can produce exquisite results, particularly for
mathematics. It is especially skillful at
line-, paragraph-, and page-break selection.
There is a TeX Users Group with over 1000
members. It publishes a semi-annual journal
----------------------
1Unix is a trademark of AT&T Bell
Laboratories.
2VAX is a trademark of Digital Equipment
Corporation.
3ULTRIX is a trademark of Digital Equipment
Corporation.
4VMS is a trademark of Digital Equipment
Corporation.
5IBM PC is a trademark of International
B6VMniss aactrademarkncoofoInternational Business
Machines, Incorporated.
7CMS is a trademark of International Business
Machines, Incorporated.
8Macintosh is a trademark of Apple Computer,
Incorporated.
2
2 Cost
2.1 troff
troff comes as part of any Unix system. A
more recent version called ditroff is available
part of a package of tools called the
Documentor's Work Bench (DWB) at an extra cost
of about $3,000.
2.2 TeX
The Unix version of TeX is available for the
cost of a magnetic tape.
3 Markup Codes
Both TeX and troff operate on formatting
commands embedded in the source text. This
makes it easy to
?transfer documents using electronic mail;
?use the full power of the available text
manipulation tools for transforming the
input.
3.1 troff
The majority of troff markup codes consist
mainly of two-letter dot-prefixed commands
starting at the beginning of a line. For
example,
This text appears on one page.
.bp
Starts a new page.
.sp 3i
leaves a three inch gap.
Blank lines can be used to break paragraphs and
indented ones force indentation.
3
3.2 TeX
The majority of TeX markup codes are backslash-
prefixed words. Braces, or brackets enclose
arguments and contexts. For example,
Text entry is free format.
However, a blank line starts off a new paragraph,
which, in the default mode, produces no ex-
tra vertical
spacing, but a some extra indentation, just like in a
proper book.
{\em The text in these braces will be empha-
sised.} While
this following text will not.
\centerline{The text in this argument will be centered}
When formatted, this produces
Text entry is free format.
However, a blank line starts off a new
paragraph, which, in the default mode,
produces no extra vertical spacing, but
a some extra indentation, just like in a
proper book.
The text in these braces will be
emphasised. While this following text
will not.
The text in this argument will be centered
3.3 Macro Packages
Both TeX and troff operate on very low-level
commands. A number of macro packages exist for
both systems to allow the user to express his
formatting requirements at a "higher" level.
In general, a macro cannot be distinguished
from a more primitive command.
4
3.3.1 troff
-ms: This basic package is almost universally
available with troff , which makes it attractive
when portability of marked texts is important.
It is very simple to use. Although it is
fairly restricted in scope, it suffices for the
majority of papers and memos.
-me: This package comes only with the bsd
systems. It is also fairly simple (probably
about the complexity of Pages). It is cleaner
than the -ms macros in the sense that if you do
have a slightly unusual requirement and need to
descend into troff you are much less likely to
upset the -me.
-mm: This relatively recent package comes only
with System V Unix systems and is, in some
sense, the future standard one to be used with
troff. It is much more extensive than the -ms
macros and allows easier "tuning" of document
appearance.
3.3.2 TeX
LaTeX: This is an excellent general-purpose
macro, suitable for articles, reports, letters,
books, etc. LaTeX is straightforward to
use, although it can be frustrating if you
want to drop into "manual override". A
document can then be formatted according to a
specified "style" without altering the source
text. A number of basic styles, as well as
styles for some well-known computing journals
such as CACM, are available. LaTeX has good
support for indexing and cross-referencing. It
is rapidly becoming the standard TeX macro
package.
AMS-TeX : This is similar to LaTeX, but biased
more towards mathematicians (AMS stands for the
5
American Mathematical Society).
texinfo: This is a public-domain macro package
for producing program documentation. It is
a lot less powerful than any of the packages
previously mentioned but, as well as the
possibility of typeset output, tree-structured
documentation packages may be produced.
4 Driving Output Devices
In both cases, the user types in a marked
up document, processes it using TeX or troff,
producing an output file which can be used
to drive a huge variety of output devices,
including the Sun screen.
4.1 troff
troff has a sister program called nroff which
accepts exactly the same input as troff but is
designed to drive fixed-width character devices
such as daisy-wheel printers. Configuring
a new type of printer is straightforwardly
achieved by completing a table.
troff drivers are available also available
from the suppliers of the major laser printer
suppliers. For example,
?Imagen (8/300, 12/300),
?Apple (LaserWriter and LaserWriter Plus),
?HP (Laserjet and LaserJet Plus),
?QMS (800 or 1200 Lasergrafix printers),
?Xerox laser printers.
Configuring troff itself for a new typesetter
is a significantly more difficult task.
Drivers are known to exist for the
?Mergenthaler Linotron 202,
6
?Wang CAT,
?Autologic APS-5,
and the
?Monotype Lasercomp
typesetters.
ditroff output may be previewed on a
Tektronix 4014 terminal.
4.2 TeX
Configuring TeX for a new device is also a
fairly involved task. However, many more such
drivers exist than for troff. For example,
?Epson, IBM, Toshiba, Okidata dot matrix
printers,
?IBM PC with
-- Hercules Graphics Card,
-- IBM Enhanced Graphics Adapter,
-- Tecmar Graphics Master Card,
?AT&T 6300 PC (no card required),
?Olivetti M24 PC (no card required),
?vt100s terminals,
?the laser printers mentioned above and the
Data Products LNZ-2660,
?Linotype L100 and L300 phototypesetters.
It is known that John Wiley & Sons,
Addison-Wesley and Springer-Verlag will accept
and assist in the publication of books and
articles typeset using TeX.
7
5 User Interface
5.1 troff
troff is completely non-interactive. A small
number of error messages can arise, but
most errors are discovered by looking at the
formatted output, usually by running through
nroff to the VDU screen. This turns out to be
less of a problem in practise than it might at
first sound.
5.2 TeX
TeX complains and stops upon finding a syntax
error in the input, allowing the user to take
take simple remedial action (e.g., by inserting
the correct spelling of a command, or by asking
TeX to ignore a number of subsequent tokens).
6 Fonts
The available fonts depend on the output
device. A number of devices use the
public domain Computer Modern fonts designed by
Donald Knuth with METAFONT. This font family
comprises some 75 different fonts in the common
sizes in the range 5 to 72 points. TeX
can magnify these to provide an even greater
variety. Many, many mathematical symbols,
accent marks and other symbols are available.
Cyrilic and OCR (Optical Character Recognition)
fonts are also available for TeX.
In the unlikely event of being unable find
a suitable special character, the expert may
resort to METAFONT. There are also various
public domain pixel-based character generators.
These facilities are probably most likely to be
required only for logo design, however.
8
6.1 Restrictions
Older versions of troff allow no more than four
different styles of font per document (e.g.,
roman, bold, italic and special). There are no
such restrictions in TeX or ditroff.
7 Typesetting Mathematics
7.1 troff and eqn
troff has a preprocessor called eqn which al-
lows the "pronounceable" entry of mathematical
equations. It was designed to be easy to
use for typist and casual users, assuming
that they have an elementary comprehension of
mathematics. It produces reasonable results.
7.2 TeX
TeX has a built-in mathematics mode. It is
slightly more cryptic than eqn. For users
setting a lot of mathematics, requiring perfect
results, there is only TeX.
8 Tables, Lines and Boxes
8.1 troff and tbl
troff has a preprocessor called tbl which
permits very easy composition of tables. It
can even be used for the production of simple
line diagrams. This is one of troff 's
strongest features.
8.2 TeX
TeX has built-in alignment facilities. These
are very powerful, but much more frightening
and verbose than tbl. However, LaTeX provides
9
table drawing facilities which are almost as
good as tbl. All manner of lines and boxes are
also possible.
9 Graphics
Neither troff nor TeX were designed for the
production of sophisticated artwork and this is
certainly an area of weakness.
9.1 troff
The Documentor's Workbench has several ditroff
preprocessors:
pic: which allow easy descriptive of line
figures comprised of lines, arrows, circles
and ellipses.
ideal: is similar to pic, but uses simultaneous
equations and co-ordinates to determine the
positions of points. ideal can also specify
dashed circles and shaded regions.
grap: is a preprocessor for pic for designed for
producing graphs. It is highly spoken of.
9.2 TeX
LaTeX has an picture sketching facility with
similar capabilities to pic. However, it is
much harder to use, since the user has to
perform more of his own calculations. It
should eventually be possible to incorporate
pictures from the Macintosh into TeX output.
TeX packages for typsetting representa-
tions of organic molecules and other semi-
sophisticated graphics also exist.
10
10 Documentation
Both troff and TeX are extensively documented.
A wider choice of textbook is available for
troff, since it is much older.
11 Other Utilities
11.1 Slide Preparation
11.1.1 troff
troff has no special facilities for producing
slides. However, it is possible to use a
normal macro package and large point sizes with
reasonable success.
ditroff comes with a set of macros (-mv) for
simple viewgraph and slide production.
11.1.2 TeX
SliTeX/ is a variant of the LaTeX macro
package designed for slide production. It is
particularly good for managing the production
of large collections of slides and of
multi-layer slides (overlays).
11.2 Program Grinding
tgrind is a useful little utility which,
given a few facts about the punctuation of a
programming language, will "grind" out a TeX
source file which can be turned into a nicely
formatted listing. A ground listing of a
Pascal program is shown in Figure 1.
A similar facility for use with troff called
vgrind also exists, but appears to function
only on Berkeley Unix driving a Versatec
printer.
11
-----------------------------------------------------
program hello(output);
procedure welcome;
begin
writeln("Hello World.")
end;
begin
f This is a little demonstration program in Pascal. g
10
welcome
end.
-----------------------------------------------------
11.3 Bibliographic Citation
It is convenient to be able to keep
databases of literature references and have
bibliographies generated automatically from
citations inserted into the source texts.
11.3.1 troff
The troff preprocessor for fleshing out
citations from a set of keywords embedded in
the source text is called refer. lookbib and
addbib allow examination and extension of refer
bibliographic databases.
11.3.2 TeX
BibTeX is the LaTeX equivalent of refer.
It requires precise citations which makes
it slightly less convenient for normal use
than refer. However, BibTeX is programmable
and can be used to format the references
into any conceivable style. A number of
different bibliographic styles are available,
particularly for the more prestigious computing
journals.
12
A facility called Tib to use refer-formatted
bibliographic databases with TeX also exists.
13
-------
|