Merge branch 'topic/sync-to-go-2'
[s-roff.git] / man / l_roff-history.7.in
blobf4be428ca8f416c5cfcecf9b3099001813e626eb
1 '\" t -- preprocess: tbl(1)
2 .ig
3 @ @L_ROFF@-history.7
5 Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
7 Copyright (C) 2000 - 2004, 2006 - 2008
8 Free Software Foundation, Inc.
9 written by Bernd Warken <bwarken@mayn.de>
10 maintained by Werner Lemberg <wl@gnu.org>
12 Permission is granted to copy, distribute and/or modify this document
13 under the terms of the GNU Free Documentation License, Version 1.1 or
14 any later version published by the Free Software Foundation; with the
15 Invariant Sections being this .ig-section and AUTHORS, with no
16 Front-Cover Texts, and with no Back-Cover Texts.
18 You should have received a copy of the Free Documentation License
19 as part of the file COPYING; also located in the main directory of the
20 source package of this program.
23 .\"
24 .\" Local macros
26 .de Esc
27 .  ds @1 \\$1
28 .  shift
29 .  nop \f[B]\[rs]\\*[@1]\f[]\\$*
30 .  rm @1
34 .de QuotedChar
35 .  ds @1 \\$1
36 .  shift
37 .  nop `\f[B]\\*[@1]\f[]'\\$*
38 .  rm @1
42 .\"
43 .\" Title
44 .\"
46 .TH @U_ROFF@-HISTORY @MAN7EXT@ "@MDATE@" "@T_ROFF@ v@VERSION@"
47 .SH NAME
48 @T_ROFF@-history \- concepts and history of roff typesetting
51 .\"
52 .SH DESCRIPTION
53 .\"
55 .I roff
56 is the general name for a set of text formatting programs, known under
57 names like
58 .BR troff ,
59 .BR nroff ,
60 .BR ditroff
61 etc.
64 .I roff
65 system consists of an extensible text formatting language and a set of
66 programs for printing and converting to other text formats.
68 Unix-like operating systems distribute a
69 .I roff
70 system as a core package.
73 The most common
74 .I roff
75 system today is the free software implementation \f[CR]GNU\f[]
76 .IR roff.
77 @T_ROFF@ is an deriviative.
78 Both implement the look-and-feel and functionality of its ancestors, with
79 many extensions.
82 The ancestry of
83 .I roff
84 is described in section
85 .BR HISTORY .
87 In this document, the term
88 .I roff
89 always refers to the general class of roff programs, not to the
90 .B roff
91 command provided in early UNIX systems.
94 In spite of its age,
95 .I roff
96 is in wide use today, for example, the manual pages on UNIX systems
97 .RI ( man\~pages\/ ),
98 many software books, system documentation, standards, and corporate
99 documents are written in roff.
102 .I roff
103 output for text devices is still unmatched, and its graphical output
104 has the same quality as other free type-setting programs and is better
105 than some of the commercial systems.
108 .I roff
109 is used to format UNIX
110 .IR "manual pages" ,
112 .IR "man pages" ),
113 the standard documentation system on many UNIX-derived operating systems.
116 This document describes the history of the development of the
117 .IR "roff system" ;
118 some usage aspects common to all
119 .I roff
120 versions, details on the
121 .I roff
122 pipeline, which is usually hidden behind front-ends like
123 .BR @L_ROFF@ (@MAN1EXT@);
124 a general overview of the formatting language; some tips for editing
125 .I roff
126 files; and many pointers to further readings.
130 .SH "HISTORY"
133 Document formatting by computer dates back to the 1960s.
136 .I roff
137 system itself is intimately connected to the Unix operating system, but its
138 roots go back to the earlier operating systems CTSS and Multics.
142 .SS "The Predecessor RUNOFF"
145 .BR roff 's
146 ancestor
147 .B RUNOFF
148 was written in the MAD language by
149 .I Jerry Saltzer
150 for the
151 .IR "Compatible Time Sharing System (CTSS)" ,
152 a project of the Massachusetts Institute of Technology (MIT), in 1963 and
153 1964 \[en] note that CTSS commands were all uppercase.
156 In 1965, MIT's Project MAC teamed with Bell Telephone Laboratories (BTL)
157 and General Electric to begin the
158 .UR http://\:www.multicians.org
159 .I Multics
160 system
161 .UE .
163 A command called
164 .B runoff
165 was written for Multics in the late 60s in the BCPL language, by
166 .IR "Bob Morris" ,
167 .IR "Doug McIlroy" ,
168 and other members of the Multics team.
171 Like its CTSS ancestor, Multics
172 .B runoff
173 formatted an input file consisting of text and command lines; commands began
174 with a period and were two letters.
176 Output from these commands was to terminal devices such as IBM Selectric
177 terminals.
179 Multics
180 .B runoff
181 had additional features added, such as the ability to do two-pass
182 formatting; it became the main format for Multics documentation and text
183 processing.
186 BCPL and
187 .B runoff
188 were ported to the GCOS system at Bell Labs when BTL left the development of
189 Multics.
193 .SS "The Classical nroff/troff System"
196 At BTL, there was a need to drive the
197 .I Graphic Systems CAT
198 typesetter, a graphical output device from a PDP-11 computer running Unix.
201 .B runoff
202 was too limited for this task it was further developed into a more
203 powerful text formatting system by
204 .IR "Joseph F.\& Ossanna" ,
205 who already programmed several runoff ports.
208 The name
209 .I runoff
210 was shortened to
211 .IR roff .
213 The greatly enlarged language of Ossanna's version already included all
214 elements of a full
215 .IR "roff system" .
217 All modern
218 .I roff
219 systems try to implement compatibility to this system.
221 So Joe Ossanna can be called the father of all
222 .I roff
223 systems.
226 This first
227 .I roff system
228 had three formatter programs.
231 .B troff
232 .RI ( "typesetter roff\/" )
233 generated a graphical output for the
234 .I CAT
235 typesetter as its only device.
238 .B nroff
239 produced text output suitable for terminals and line printers.
242 .B roff
243 was the reimplementation of the former
244 .B runoff
245 program with its limited features; this program was abandoned in later
246 versions.
248 Today, the name
249 .I roff
250 is used to refer to a
251 .I troff/\:nroff
252 sytem as a whole.
255 Ossanna's first version was written in the PDP-11 assembly language and
256 released in 1973.
258 .I Brian Kernighan
259 joined the
260 .I roff
261 development by rewriting it in the C\~programming language.
263 The C\~version was released in 1975.
266 The syntax of the formatting language of the
267 .BR nroff /\: troff
268 programs was documented in the famous
269 .IR "Troff User's Manual [CSTR\~#54]" ,
270 first published in 1976, with further revisions up to 1992 by Brian
271 Kernighan.
273 This document is the specification of the
274 .IR "classical troff" .
276 All later
277 .I roff
278 systems tried to establish compatibility with this specification.
281 After Ossanna's death in 1977, Kernighan went on with developing
282 .IR troff .
284 In the late 1970s, Kernighan equipped
285 .I troff
286 with a general interface to support more devices, the intermediate
287 output format, and the postprocessor system.
289 This completed the structure of a
290 .I "roff system"
291 as it is still in use today; see section
292 .BR "USING ROFF" .
294 In 1979, these novelties were described in the paper
295 .IR "[CSTR\~#97]" .
297 This new
298 .I troff
299 version is the basis for all existing newer troff systems, including
300 .IR @L_ROFF@ .
302 On some systems, this
303 .I device independent troff
304 got a binary of its own, called
305 .BR ditroff (@MAN7EXT@).
307 All modern
308 .B troff
309 programs already provide the full
310 .B ditroff
311 capabilities automatically.
315 .SS "Availability"
318 The source code of both the ancient Unix and classical
319 .I troff
320 weren't available for two decades.
322 Meanwhile, it is accessible again (on-line) for non-commercial use,
323 cf.\& section
324 .BR "SEE ALSO" .
328 .SS "Free roff"
331 The most important free
332 .I roff
333 project was the \f[CR]GNU\f[] implementation of
334 .IR troff ,
335 written from scratch by
336 .I James Clark
337 and put under the
338 .UR http://\:www.gnu.org/\:copyleft
339 GNU Public License
340 .UE .
342 It was called
343 .I groff
344 (\f[CR]GNU\f[]
345 .IR roff ).
347 Further forks exists.
349 .BR @L_ROFF@ (@MAN1EXT@)
350 for an overview.
352 It is compatible to the classical
353 .IR troff ,
354 but many extensions were added.
356 It is the first
357 .I roff
358 system that is available on almost all operating systems \[en] and it is
359 free.
362 An alternative is the
363 .UR https://\:github.com/\:n-t-roff/\:heirloom-doctools
365 project, started in 2005, which provides enhanced versions of the various
366 roff tools found in the OpenSolaris and Plan\~9 operating systems, now
367 available under free licenses.
371 .SH "USING ROFF"
374 Most people won't even notice that they are actually using
375 .IR roff .
377 When you read a system manual page (man page)
378 .I roff
379 is working in the background.
382 Some
383 .I roff
384 implementations provide wrapper programs that make it easy to use the
385 .I roff
386 system on the shell command line.
388 For example, the \f[CR]GNU\f[]
389 .I roff
390 implementation
391 .BR groff (@MAN1EXT@)
392 provides command line options to avoid the long command pipes of
393 classical
394 .IR troff .
398 .SS "The roff Pipe"
401 Each
402 .I roff
403 system consists of preprocessors,
404 .I roff
405 formatter programs, and a set of device postprocessors.
407 This concept makes heavy use of the
408 .I piping
409 mechanism, that is, a series of programs is called one after the other,
410 where the output of each program in the queue is taken as the input
411 for the next program.
415 cat \f[I]file\f[P] \
416 | .\|.\|. \
417 | \f[I]preproc\f[P] \
418 | .\|.\|. \
419 | troff \f[I]options\f[P] \
420 | \f[I]postproc\f[P]
424 The preprocessors generate
425 .I roff
426 code that is fed into a
427 .I roff
428 formatter (e.g.\&
429 .BR troff ),
430 which in turn generates
431 .I intermediate output
432 that is fed into a device postprocessor program for printing or final
433 output.
436 All of these parts use programming languages of their own; each
437 language is totally unrelated to the other parts.
439 Moreover,
440 .I roff
441 macro packages that were tailored for special purposes can be
442 included.
445 Most
446 .I roff
447 documents use the macros of some package, intermixed with code for one
448 or more preprocessors, spiced with some elements from the plain
449 .I roff
450 language.
452 The full power of the
453 .I roff
454 formatting language is seldom needed by users; only programmers of
455 macro packages need to know about the gory details.
460 .SS "Preprocessors"
464 .I roff
465 preprocessor is any program that generates output that syntactically
466 obeys the rules of the
467 .I roff
468 formatting language.
470 Each preprocessor defines a language of its own that is translated
471 into
472 .I roff
473 code when run through the preprocessor program.
475 Parts written in these languages may be included within a
476 .I roff
477 document; they are identified by special
478 .I roff
479 requests or macros.
481 Each document that is enhanced by preprocessor code must be run
482 through all corresponding preprocessors before it is fed into the
483 actual
484 .I roff
485 formatter program, for the formatter just ignores all alien code.
487 The preprocessor programs extract and transform only the document
488 parts that are determined for them.
491 There are a lot of free and commercial
492 .I roff
493 preprocessors.
495 Some of them aren't available on each system, but there is a small
496 set of preprocessors that are considered as an integral part of each
497 .I roff
498 system.
500 The classical preprocessors are
504 tab (@);
505 lb l.
506 tbl@for tables.
507 eqn@for mathematical formul\[ae].
508 pic@for drawing diagrams.
509 refer@for bibliographic references.
510 soelim@for including macro files from standard locations.
511 chem@for drawing chemical formul\[ae].
516 Other known preprocessors that are not available on all systems
517 include
521 tab (@);
522 lb l.
523 grap@for constructing graphical elements.
524 grn@for including \fBgremlin\fR(1) pictures.
529 .SS "Formatter Programs"
533 .I roff formatter
534 is a program that parses documents written in the
535 .I roff
536 formatting language or uses some of the
537 .I roff
538 macro packages.
540 It generates
541 .IR "intermediate output" ,
542 which is intended to be fed into a single device postprocessor that
543 must be specified by a command-line option to the formatter program.
545 The documents must have been run through all necessary preprocessors
546 before.
549 The output produced by a
550 .I roff
551 formatter is represented in yet another language, the
552 .IR "intermediate output format"
554 .IR "troff output" .
556 This language was first specified in
557 .IR "[CSTR\~#97]" ;
558 its @T_ROFF@ extension is documented in
559 .BR @L_ROFF@-out (@MAN5EXT@).
561 The intermediate output language is a kind of assembly language
562 compared to the high-level
563 .I roff
564 language.
566 The generated intermediate output is optimized for a special device,
567 but the language is the same for every device.
571 .I roff
572 formatter is the heart of the
573 .I roff
574 system.
576 The traditional
577 .I roff
578 had two formatters,
579 .B nroff
580 for text devices and
581 .B troff
582 for graphical devices.
585 Often, the name
586 .I troff
587 is used as a general term to refer to both formatters.
591 .SS "Devices and Postprocessors"
594 Devices are hardware interfaces like printers, text or graphical
595 terminals, etc., or software interfaces such as a conversion into a
596 different text or graphical format.
600 .I roff
601 postprocessor is a program that transforms
602 .I troff
603 output into a form suitable for a special device.
606 .I roff
607 postprocessors are like device drivers for the output target.
610 For each device there is a postprocessor program that fits the device
611 optimally.
613 The postprocessor parses the generated intermediate output and
614 generates device-specific code that is sent directly to the device.
617 The names of the devices and the postprocessor programs are not fixed
618 because they greatly depend on the software and hardware abilities of
619 the actual computer.
621 For example, the classical devices mentioned in
622 .I [CSTR\~#54]
623 have greatly changed since the classical times.
625 The old hardware doesn't exist any longer and the old graphical
626 conversions were quite imprecise when compared to their modern
627 counterparts.
630 For example, the Postscript device
631 .I post
632 in classical
633 .I troff
634 had a resolution of 720 units per inch, while
635 .IR @T_ROFF@ 's
636 .I ps
637 device has 72000, a refinement of factor 100.
640 Today the operating systems provide device drivers for most
641 printer-like hardware, so it isn't necessary to write a special
642 hardware postprocessor for each printer.
646 .SH "ROFF PROGRAMMING"
649 Documents using
650 .I roff
651 are normal text files decorated by
652 .I roff
653 formatting elements.
656 .I roff
657 formatting language is quite powerful; it is almost a full programming
658 language and provides elements to enlarge the language.
660 With these, it became possible to develop macro packages that are
661 tailored for special applications.
663 Such macro packages are much handier than plain
664 .IR roff .
666 So most people will choose a macro package without worrying about the
667 internals of the
668 .I roff
669 language.
673 .SS "Macro Packages"
676 Macro packages are collections of macros that are suitable to format a
677 special kind of documents in a convenient way.
679 This greatly eases the usage of
680 .IR roff .
682 The macro definitions of a package are kept in a file called
683 .IB name .tmac
684 (classically
685 .BI tmac. name\c
688 All tmac files are stored in one or more directories at standardized
689 positions.
691 Details on the naming of macro packages and their placement is found
693 .BR @L_ROFF@-tmac (@MAN5EXT@).
696 A macro package that is to be used in a document can be announced to
697 the formatter by the command line option
698 .BR \-m ,
700 .BR @L_TROFF@ (@MAN1EXT@),
701 or it can be specified within a document using the file inclusion
702 requests of the
703 .I roff
704 language, see
705 .BR @L_ROFF@ (@MAN7EXT@).
708 Famous classical macro packages are
709 .I man
710 for traditional man pages,
711 .I mdoc
712 for \f[CR]BSD\f[]-style manual pages;
713 the macro sets for books, articles, and letters are
714 .I me
715 (probably from the first name of its creator
716 .I Eric
717 Allman),
718 .I ms
719 (from
720 .IR "Manuscript Macros\/" ),
722 .I mm
723 (from
724 .IR "Memorandum Macros\/" ).
728 .SS "The roff Formatting Language"
731 The classical
732 .I roff
733 formatting language is documented in the
734 .I Troff User's Manual
735 .IR "[CSTR\~#54]" .
738 .I roff
739 language is a full programming language providing requests, definition
740 of macros, escape sequences, string variables, number or size
741 registers, and flow controls.
744 .I Requests
745 are the predefined basic formatting commands similar to the commands
746 at the shell prompt.
748 The user can define request-like elements using predefined
749 .I roff
750 elements.
752 These are then called
753 .IR macros .
755 A document writer will not note any difference in usage for requests
756 or macros; both are written on a line on their own starting with a dot.
759 .I Escape sequences
761 .I roff
762 elements starting with a backslash
763 .QuotedChar \[rs] .
765 They can be inserted anywhere, also in the midst of text in a line.
767 They are used to implement various features, including the insertion of
768 non-\f[CR]ASCII\f[] characters with
769 .Esc ( ,
770 font changes with
771 .Esc f ,
772 in-line comments with
773 .Esc \[dq] ,
774 the escaping of special control characters like
775 .Esc \[rs] ,
776 and many other features.
779 .I Strings
780 are variables that can store a string.
782 A string is stored by the
783 .B .ds
784 request.
786 The stored string can be retrieved later by the
787 .B \[rs]*
788 escape sequence.
791 .I Registers
792 store numbers and sizes.
794 A register can be set with the request
795 .B .nr
796 and its value can be retrieved by the escape sequence
797 .BR "\[rs]n" .
801 .SH "FILE NAME EXTENSIONS"
804 Manual pages (man pages) take the section number as a file name
805 extension, e.g., the filename for this document is
806 .IR roff.7 ,
807 i.e., it is kept in section\~7
808 of the man pages.
811 The classical macro packages take the package name as an extension, e.g.\&
812 .IB file. me
813 for a document using the
814 .I me
815 macro package,
816 .IB file. mm
818 .IR mm ,
819 .IB file. ms
821 .IR ms ,
822 .IB file. pic
824 .I pic
825 files,
826 etc.
829 But there is no general naming scheme for
830 .I roff
831 documents, though
832 .IB file. tr
834 .I troff file
835 is seen now and then.
837 Maybe there should be a standardization for the filename extensions of
838 .I roff
839 files.
842 File name extensions can be very handy in conjunction with the
843 .BR less (1)
844 pager.
846 It provides the possibility to feed all input into a command-line pipe
847 that is specified in the shell environment variable
848 .BR LESSOPEN .
850 This process is not well documented, so here an example:
855 LESSOPEN='|lesspipe %s'
860 where
861 .B lesspipe
862 is either a system supplied command or a shell script of your own.
865 .SH "SEE ALSO"
867 There is a lot of documentation on
868 .IR roff .
870 The original papers on classical
871 .I troff
872 are still available, and all aspects of
873 .I @T_ROFF@
874 are documented in great detail.
878 .SS "Internet sites"
882 troff.org
883 .UR http://\:www.troff.org
884 The historical troff site
886 provides an overview and pointers to all historical aspects of
887 .IR roff .
890 Multics
891 .UR http://\:www.multicians.org
892 The Multics site
894 contains a lot of information on the MIT projects, CTSS, Multics,
895 early Unix, including
896 .IR runoff ;
897 especially useful are a glossary and the many links to ancient
898 documents.
901 Unix Archive
902 .UR http://\:www.tuhs.org/\:Archive/
903 The Ancient Unixes Archive
906 provides the source code and some binaries of the ancient Unixes
907 (including the source code of
908 .I troff
909 and its documentation) that were made public by Caldera since 2001,
910 e.g.\& of the famous Unix version\~7 for PDP-11 at the
911 .UR http://\:www.tuhs.org/\:Archive/\:PDP-11/\:Trees/\:V7
912 Unix V7 site
913 .UE .
916 Developers at AT&T Bell Labs
917 .UR http://\:www.bell-labs.com/
918 Bell Labs Computing and Mathematical Sciences Research
921 provides a search facility for tracking information on the early
922 developers.
925 Plan 9
926 .UR http://\:plan9.bell-labs.com
927 The Plan\~9 operating system
930 by AT&T Bell Labs.
933 runoff
934 .UR http://\:web.mit.edu/\:Saltzer/\:www/\:publications/\:pubs.html
935 Jerry Saltzer's home page
938 stores some documents using the ancient RUNOFF formatting language.
941 CSTR Papers
942 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr.html
943 The Bell Labs CSTR site
946 stores the original
947 .I troff
948 manuals (CSTR #54, #97, #114, #116, #122) and famous historical
949 documents on programming.
952 \f[CR]GNU\f[] \f[I]roff\f[]
953 .UR http://\:www.gnu.org/\:software/\:groff
954 The GNU troff web site
956 provides the free
957 .I roff
958 implementation
959 .IR groff .
963 .SS "Historical roff Documentation"
966 Many classical
967 .B troff
968 documents are still available on-line.
970 The two main manuals of the
971 .I troff
972 language are
975 [CSTR\~#54]
976 J.\& F.\& Ossanna,
977 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:54.ps.gz
978 .I "Nroff/\:Troff User's Manual"
979 .UE ;
981 Bell Labs, 1976; revised by Brian Kernighan, 1992.
984 [CSTR\~#97]
985 Brian W.\& Kernighan,
986 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:97.ps.gz
987 .I "A Typesetter-independent TROFF"
988 .UE ,
990 Bell Labs, 1981, revised March 1982.
993 The \[lq]little language\[rq]
994 .I roff
995 papers are
998 [CSTR\~#114]
999 J\. L.\& Bentley and Brian W.\& Kernighan,
1000 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:114.ps.gz
1001 .I "GRAP \[en] A Language for Typesetting Graphs"
1002 .UE ;
1004 Bell Labs, August 1984.
1007 [CSTR\~#116]
1008 Brian W.\& Kernighan,
1009 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:116.ps.gz
1010 .I "PIC \[en] A Graphics Language for Typesetting"
1011 .UE ;
1013 Bell Labs, December 1984.
1016 [CSTR\~#122]
1017 J.\& L.\& Bentley, L.\& W.\& Jelinski, and B.\& W.\& Kernighan,
1018 .UR http://\:cm.bell-labs.com/\:cm/\:cs/\:cstr/\:122.ps.gz
1019 .I "CHEM \[en] A Program for Typesetting Chemical Structure Diagrams,"
1020 .I "Computers and Chemistry"
1021 .UE ;
1023 Bell Labs, April 1986.
1026 .SS "Manual Pages"
1028 Due to its complex structure, a full
1029 .I roff
1030 system has many man pages, each describing a single aspect of
1031 .IR roff .
1033 Unfortunately, there is no general naming scheme for the documentation
1034 among the different
1035 .I roff
1036 implementations.
1040 .IR @T_ROFF@ ,
1041 the man page
1042 .BR @L_ROFF@ (@MAN1EXT@)
1043 contains a survey of all documentation available in
1044 .IR @T_ROFF@ .
1047 On other systems, you are on your own, but
1048 .BR troff (@MAN1EXT@)
1049 might be a good starting point.
1053 .SH AUTHORS
1056 Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
1058 Copyright (C) 2000 - 2004, 2006 - 2008
1059 Free Software Foundation, Inc.
1062 This document is distributed under the terms of the \f[CR]FDL\f[]
1063 (\f[CR]GNU Free Documentation License\f[]) version 1.1 or later.
1065 You should have received a copy of the \f[CR]FDL\f[] on your system,
1066 it is also available on-line at the
1067 .UR http://\:www.gnu.org/\:copyleft/\:fdl.html
1068 GNU copyleft site
1069 .UE .
1072 This document was written by
1073 .MT bwarken@mayn.de
1074 Bernd Warken
1075 .ME .
1077 .\" s-ts-mode