2 .TH ROFF @MAN7EXT@ "@MDATE@" "groff @VERSION@"
4 roff \- concepts and history of roff typesetting
6 .\" this is the man page roff.7
9 .\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
14 .\" ====================================================================
16 .\" ====================================================================
18 .\" Copyright (C) 2000-2018 Free Software Foundation, Inc.
20 .\" This file is part of groff, the GNU roff type-setting system.
22 .\" Permission is granted to copy, distribute and/or modify this
23 .\" document under the terms of the GNU Free Documentation License,
24 .\" Version 1.3 or any later version published by the Free Software
25 .\" Foundation; with no Invariant Sections, with no Front-Cover Texts,
26 .\" and with no Back-Cover Texts.
28 .\" A copy of the Free Documentation License is included as a file
29 .\" called FDL in the main directory of the groff source package.
32 .\" ====================================================================
38 . nop \f[B]\[rs]\\*[@1]\f[]\\$*
46 . nop \[oq]\f[B]\\*[@1]\f[]\[cq]\\$*
50 .\" ====================================================================
52 .\" ====================================================================
55 is the general name for a set of text formatting programs, known under
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
70 system as a core package.
76 system today is the free software implementation \f[CR]GNU\f[]
78 .BR groff (@MAN1EXT@).
81 implements the look-and-feel and functionality of its ancestors, with
88 is described in section \[lq]History\[rq] below.
90 In this document, the term
92 always refers to the general class of roff programs, not to the
94 command provided in early Unix systems.
100 is in wide use today, for example, the manual pages on Unix systems
102 many software books, system documentation, standards, and corporate
103 documents are written in roff.
107 output for text devices is still unmatched, and its graphical output
108 has the same quality as other free type-setting programs and is better
109 than some of the commercial systems.
114 is used to format Unix
118 the standard documentation system on many Unix-derived operating
123 This document describes the history of the development of the
125 some usage aspects common to all
127 versions, details on the
129 pipeline, which is usually hidden behind front-ends like
130 .BR groff (@MAN1EXT@);
131 a general overview of the formatting language; some tips for editing
133 files; and many pointers to further readings.
136 .\" ====================================================================
138 .\" ====================================================================
140 Document formatting by computer dates back to the 1960s.
144 system itself is intimately connected to the Unix operating system, but
145 its roots go back to the earlier operating systems CTSS and Multics.
148 .\" ====================================================================
149 .SS "The Predecessor RUNOFF"
150 .\" ====================================================================
155 was written in the MAD language by
158 .IR "Compatible Time Sharing System (CTSS)" ,
159 a project of the Massachusetts Institute of Technology (MIT), in 1963
160 and 1964\[em]note that CTSS commands were all uppercase.
163 In 1965, MIT's Project MAC teamed with Bell Telephone Laboratories
164 (BTL) and General Electric to begin the
165 .UR http://\:www.multicians.org
172 was written for Multics in the late 60s in the BCPL language, by
175 and other members of the Multics team.
179 Like its CTSS ancestor, Multics
181 formatted an input file consisting of text and command lines; commands
182 began with a period and were two letters.
184 Output from these commands was to terminal devices such as IBM Selectric
189 had additional features added, such as the ability to do two-pass
190 formatting; it became the main format for Multics documentation and text
197 were ported to the GCOS system at Bell Labs when BTL left the
198 development of Multics.
202 There is a free archive about
206 You can get it anonymously by the shell command
209 $git clone https://github.com/bwarken/RUNOFF_historical.git
215 As well, there is a new project for writing a program that can read
217 but it does not yet work so far.
219 You can get an early version anonymously by the shell command
222 $git clone https://github.com/bwarken/runoff.git
227 .\" ====================================================================
228 .SS "The Classical nroff/troff System"
229 .\" ====================================================================
231 At BTL, there was a need to drive the
232 .I Graphic Systems CAT
233 typesetter, a graphical output device from a PDP-11 computer running
238 was too limited for this task it was further developed into a more
239 powerful text formatting system by
240 .IR "Joseph F.\& Ossanna" ,
241 who already programmed several runoff ports.
250 The greatly enlarged language of Ossanna's version already
251 included all elements of a full
256 systems try to implement compatibility to this system.
258 So Joe Ossanna can be called the father of all
266 had three formatter programs.
270 .RI ( "typesetter roff\/" )
271 generated a graphical output for the
273 typesetter as its only device.
277 produced text output suitable for terminals and line printers.
281 was the reimplementation of the former
283 program with its limited features; this program was abandoned in later
288 is used to refer to a
294 Ossanna's first version was written in the PDP-11 assembly
295 language and released in 1973.
300 development by rewriting it in the C\~programming language.
302 The C\~version was released in 1975.
306 The syntax of the formatting language of the
308 programs was documented in the famous
309 .I "Troff User's Manual"
311 first published in 1976, with further revisions up to 1992 by Brian
314 This document is the specification of the
315 .IR "classical troff" .
319 systems tried to establish compatibility with this specification.
323 After Ossanna's death in 1977, Kernighan went on with developing
326 In the late 1970s, Kernighan equipped
328 with a general interface to support more devices, the intermediate
329 output format, and the postprocessor system.
331 This completed the structure of a
333 as it is still in use today;
334 see section \[lq]Using Roff\[rq] below.
336 In 1979, these novelties were described in the paper
341 version is the basis for all existing newer troff systems, including
344 On some systems, this
345 .I device independent troff
346 got a binary of its own, called
347 .BR ditroff (@MAN7EXT@).
351 programs already provide the full
353 capabilities automatically.
356 .\" ====================================================================
358 .\" ====================================================================
360 The source code of both the ancient Unix and classical
362 weren't available for two decades.
364 Nowadays, it is accessible again (on-line) for non-commercial use;
370 .\" ====================================================================
371 .SS "groff \[em] free GNU roff"
372 .\" ====================================================================
374 The most important free
376 project was the \f[CR]GNU\f[] implementation of
378 written from scratch by
381 .UR http://\:www.gnu.org/\:copyleft
391 .BR groff (@MAN1EXT@)
398 system is still actively developed.
400 It is compatible to the classical
402 but many extensions were added.
406 system that is available on almost all operating systems \[em] and it
416 .\" ====================================================================
417 .SS "Free Heirloom roff"
418 .\" ====================================================================
421 .UR https://\:github.com/\:n\-t\-roff/\:heirloom\-doctools
422 .I Gunnar Ritter's Heirloom roff project
424 project, started in 2005, which provides enhanced versions of the
425 various roff tools found in the OpenSolaris and Plan\~9 operating
426 systems, now available under free licenses.
428 You can get this package with the shell command:
431 \[Do] git clone https://github.com/n\-t\-roff/heirloom\-doctools
437 Moreover, one finds there the
438 .UR https://\:github.com/\:n\-t\-roff/\:DWB3.3
439 .I Original Documenter's Workbench Release 3.3
443 .\" ====================================================================
445 .\" ====================================================================
447 Most people won't even notice that they are actually using
450 When you read a system manual page (man page)
452 is working in the background.
456 explicitly isn't difficult either.
462 implementations provide wrapper programs that make it easy to use the
464 system on the shell command line.
466 For example, the \f[CR]GNU\f[]
469 .BR groff (@MAN1EXT@)
470 provides command-line options to avoid the long command pipes of
475 tries to guess from the document which arguments should be used for a
478 people who do not like specifying command-line options should try the
479 .BR groffer (@MAN1EXT@)
480 program for graphically displaying
485 .\" ====================================================================
487 .\" ====================================================================
491 system consists of preprocessors,
493 formatter programs, and a set of device postprocessors.
495 This concept makes heavy use of the
497 mechanism, that is, a series of programs is called one after the other,
498 where the output of each program in the queue is taken as the input
499 for the next program.
505 | \f[I]preproc\f[P] \
507 | troff \f[I]options\f[P] \
513 The preprocessors generate
515 code that is fed into a
519 which in turn generates
520 .I intermediate output
521 that is fed into a device postprocessor program for printing or final
526 All of these parts use programming languages of their own; each
527 language is totally unrelated to the other parts.
531 macro packages that were tailored for special purposes can be
538 documents use the macros of some package, intermixed with code for one
539 or more preprocessors, spiced with some elements from the plain
543 The full power of the
545 formatting language is seldom needed by users; only programmers of
546 macro packages need to know about the gory details.
550 .\" ====================================================================
552 .\" ====================================================================
556 preprocessor is any program that generates output that syntactically
557 obeys the rules of the
561 Each preprocessor defines a language of its own that is translated
564 code when run through the preprocessor program.
566 Parts written in these languages may be included within a
568 document; they are identified by special
572 Each document that is enhanced by preprocessor code must be run
573 through all corresponding preprocessors before it is fed into the
576 formatter program, for the formatter just ignores all alien code.
578 The preprocessor programs extract and transform only the document
579 parts that are determined for them.
583 There are a lot of free and commercial
587 Some of them aren't available on each system, but there is a small
588 set of preprocessors that are considered as an integral part of each
592 The classical preprocessors are
599 eqn@for mathematical formulae.
600 pic@for drawing diagrams.
601 refer@for bibliographic references.
602 soelim@for including macro files from standard locations.
603 chem@for drawing chemical formul\[ae].
609 Other known preprocessors that are not available on all systems
616 grap@for constructing graphical elements.
617 grn@for including \fBgremlin\fR(1) pictures.
622 .\" ====================================================================
623 .SS "Formatter Programs"
624 .\" ====================================================================
628 is a program that parses documents written in the
630 formatting language or uses some of the
635 .IR "intermediate output" ,
636 which is intended to be fed into a single device postprocessor that
637 must be specified by a command-line option to the formatter program.
639 The documents must have been run through all necessary preprocessors
644 The output produced by a
646 formatter is represented in yet another language, the
647 .IR "intermediate output format"
651 This language was first specified in
653 its \f[CR]GNU\f[] extension is documented in
654 .BR groff_out (@MAN5EXT@).
656 The intermediate output language is a kind of assembly language
657 compared to the high-level
661 The generated intermediate output is optimized for a special device,
662 but the language is the same for every device.
668 formatter is the heart of the
678 for graphical devices.
684 is used as a general term to refer to both formatters.
687 .\" ====================================================================
688 .SS "Devices and Postprocessors"
689 .\" ====================================================================
691 Devices are hardware interfaces like printers, text or graphical
692 terminals, etc., or software interfaces such as a conversion into a
693 different text or graphical format.
699 postprocessor is a program that transforms
701 output into a form suitable for a special device.
705 postprocessors are like device drivers for the output target.
709 For each device there is a postprocessor program that fits the device
712 The postprocessor parses the generated intermediate output and
713 generates device-specific code that is sent directly to the device.
717 The names of the devices and the postprocessor programs are not fixed
718 because they greatly depend on the software and hardware abilities of
721 For example, the classical devices mentioned in
723 have greatly changed since the classical times.
725 The old hardware doesn't exist any longer and the old graphical
726 conversions were quite imprecise when compared to their modern
731 For example, the PostScript device
735 had a resolution of 720 units per inch, while
738 device has 72000, a refinement of factor 100.
742 Today the operating systems provide device drivers for most
743 printer-like hardware, so it isn't necessary to write a special
744 hardware postprocessor for each printer.
747 .\" ====================================================================
748 .SH "ROFF PROGRAMMING"
749 .\" ====================================================================
753 are normal text files decorated by
759 formatting language is quite powerful; it is almost a full programming
760 language and provides elements to enlarge the language.
762 With these, it became possible to develop macro packages that are
763 tailored for special applications.
765 Such macro packages are much handier than plain
768 So most people will choose a macro package without worrying about the
774 .\" ====================================================================
776 .\" ====================================================================
778 Macro packages are collections of macros that are suitable to format a
779 special kind of documents in a convenient way.
781 This greatly eases the usage of
784 The macro definitions of a package are kept in a file called
787 .BI tmac. name\/\c\" Italic correction comes before \c !
790 All tmac files are stored in one or more directories at standardized
793 Details on the naming of macro packages and their placement is found
795 .BR groff_tmac (@MAN5EXT@).
799 A macro package that is to be used in a document can be announced to
800 the formatter by the command-line option
803 .BR troff (@MAN1EXT@),
804 or it can be specified within a document using the file inclusion
808 .BR groff (@MAN7EXT@).
812 Famous classical macro packages are
814 for traditional man pages,
816 for \f[CR]BSD\f[]-style manual pages;
817 the macro sets for books, articles, and letters are
819 (probably from the first name of its creator
824 .IR "Manuscript Macros\/" ),
828 .IR "Memorandum Macros\/" ).
831 .\" ====================================================================
832 .SS "The roff Formatting Language"
833 .\" ====================================================================
837 formatting language is documented in the
838 .I Troff User's Manual
843 language is a full programming language providing requests, definition
844 of macros, escape sequences, string variables, number or size
845 registers, and flow controls.
850 are the predefined basic formatting commands similar to the commands
853 The user can define request-like elements using predefined
857 These are then called
860 A document writer will not note any difference in usage for requests
861 or macros; both are written on a line on their own starting with a dot.
868 elements starting with a backslash
871 They can be inserted anywhere, also in the midst of text in a line.
873 They are used to implement various features, including the insertion of
874 non-\f[CR]ASCII\f[] characters with
878 in-line comments with
880 the escaping of special control characters like
882 and many other features.
887 are variables that can store a string.
889 A string is stored by the
893 The stored string can be retrieved later by the
900 store numbers and sizes.
902 A register can be set with the request
904 and its value can be retrieved by the escape sequence
908 .\" ====================================================================
909 .SH "FILE NAME EXTENSIONS"
910 .\" ====================================================================
912 Manual pages (man pages) take the section number as a file name
913 extension, e.g., the filename for this document is
915 i.e., it is kept in section\~7
920 The classical macro packages take the package name as an extension,
923 for a document using the
940 But there is no general naming scheme for
946 is seen now and then.
948 Maybe there should be a standardization for the filename extensions of
954 File name extensions can be very handy in conjunction with the
958 It provides the possibility to feed all input into a command-line pipe
959 that is specified in the shell environment variable
962 This process is not well documented, so here an example:
967 LESSOPEN='|lesspipe %s'
975 is either a system supplied command or a shell script of your own.
980 .I file name extensions
982 .BR groff_filenames (5).
985 .\" ====================================================================
987 .\" ====================================================================
991 formatters provide automated line breaks and horizontal and vertical
994 In order to not disturb this, the following tips can be helpful.
997 Never include empty or blank lines in a
1001 Instead, use the empty request (a line consisting of a dot only) or a
1004 if a structuring element is needed.
1007 Never start a line with whitespace because this can lead to unexpected
1010 Indented paragraphs can be constructed in a controlled way by
1015 Start each sentence on a line of its own, for the spacing after a dot
1016 is handled differently depending on whether it terminates an
1017 abbreviation or a sentence.
1019 To distinguish both cases, do a line break after each sentence.
1022 To additionally use the auto-fill mode in Emacs, it is best to insert
1025 request (a line consisting of a dot only) after each sentence.
1029 The following example shows judicious line breaking in a
1036 .\" Keep the text width to 65 columns or fewer in this example so that
1037 .\" it doesn't overrun the right margin when set in Courier (-Tps,
1039 This is an example of a
1041 document that you can type into your text editor.
1044 This is the next sentence in the same paragraph.
1047 This is a longer sentence stretching over several input lines;
1048 abbreviations like cf.\& are easily identified because the dot is
1049 not followed by a line break.
1052 In the output, this sentence continues the same paragraph.
1057 .\" ====================================================================
1058 .SS "Editing with Emacs"
1059 .\" ====================================================================
1061 The best program for editing a
1063 document is Emacs (or XEmacs); see
1068 mode that is suitable for all kinds of
1072 This mode can be activated by the following methods.
1076 When editing a file within Emacs the mode can be changed by typing
1077 .RI \[oq] "M-x nroff\-mode" \[cq],
1080 means to hold down the
1090 But it is also possible to have the mode automatically selected when
1091 the file is loaded into the editor.
1094 The most general method is to include the following 3 comment lines at
1095 the end of the file.
1100 \&.\[rs]" Local Variables:
1101 \&.\[rs]" mode: nroff
1107 There is a set of file name extensions, e.g.\& the man pages that
1108 trigger the automatic activation of the
1113 Theoretically, it is possible to write the sequence
1118 \&.\[rs]" \%\-*\-\ nroff\ \-*\-\""
1123 as the first line of a file to have it started in
1127 Unfortunately, some applications such as the
1129 program are confused by this; so this is deprecated.
1132 .\" ====================================================================
1133 .SS "Editing with Vim"
1134 .\" ====================================================================
1136 .\" TODO: elvis, vile. Nvi does not support highlighting at all, and
1137 .\" gedit does but has no rules for roff yet. Other editors TBD.
1138 Besides Emacs, some other editors provide
1140 style files too, e.g.\&
1146 Vim's highlighting can be made to recognize
1148 files by setting the
1153 For this feature to work, your copy of
1155 must be built with support for, and configured to enable, several
1156 features; consult the editor's online help topics
1157 \[lq]auto\-setting\[rq], \[lq]filetype\[rq], and \[lq]syntax\[rq].
1159 Then put the following at the end of your
1161 files, after any Emacs configuration:
1162 .\" ...because Emacs pattern-matches against ~3000 bytes from the end of
1163 .\" the buffer for "Local variables:", but Vim only checks as many lines
1164 .\" as its 'modelines' variable tells it to. A common default is "5",
1165 .\" but Emacs settings can be longer than that.
1172 \&.\[rs]" vim: set filetype=groff:
1178 Replace \[lq]groff\[rq] in the above with \[lq]nroff\[rq] if you want
1179 highlighing that does
1181 recognize many of the \f[CR]GNU\f[] extensions to
1183 such as request, register, and string names longer than two characters.
1186 .\" ====================================================================
1188 .\" ====================================================================
1189 This document was written by
1190 .MT groff\-bernd.warken\-72@\:web.de
1195 .\" ====================================================================
1197 .\" ====================================================================
1199 There is a lot of documentation on
1202 The original papers on classical
1204 are still available, and all aspects of
1206 are documented in great detail.
1209 .\" ====================================================================
1210 .SS "Internet sites"
1211 .\" ====================================================================
1214 History of Unix Manpages
1215 .UR http://\:manpages.bsd.lv/\:history.html
1218 of the mdocml project provides an overview of
1220 development up to date, with links to original documentation
1221 and comments of the original authors.
1225 .UR http://\:www.troff.org
1226 The historical troff site
1228 provides an overview and pointers to the historical aspects of
1233 .UR http://\:www.multicians.org
1236 contains a lot of information on the MIT projects, CTSS, Multics,
1237 early Unix, including
1239 especially useful are a glossary and the many links to ancient
1244 .UR http://\:www.tuhs.org/\:Archive/
1245 The Ancient Unixes Archive
1248 provides the source code and some binaries of the ancient Unixes
1249 (including the source code of
1251 and its documentation) that were made public by Caldera since 2001,
1252 e.g.\& of the famous Unix version\~7 for PDP-11 at the
1253 .UR http://\:www.tuhs.org/\:Archive/\:PDP\-11/\:Trees/\:V7
1258 Developers at AT&T Bell Labs
1259 .UR http://\:www.bell\-labs.com/
1260 Bell Labs Computing and Mathematical Sciences Research
1263 provides a search facility for tracking information on the early
1268 .UR http://\:plan9.bell\-labs.com
1269 The Plan\~9 operating system
1276 .UR http://\:web.mit.edu/\:Saltzer/\:www/\:publications/\:pubs.html
1277 Jerry Saltzer's home page
1280 stores some documents using the ancient RUNOFF formatting language.
1284 .UR https://\:www.alcatel\-lucent.com/\:bell\-labs\-journals
1285 The Bell Labs (now Alcatel) CSTR site
1290 manuals (CSTR #54, #97, #114, #116, #122) and famous historical
1291 documents on programming.
1294 \f[CR]GNU\f[] \f[I]roff\f[]
1295 .UR http://\:www.gnu.org/\:software/\:groff
1306 .\" ====================================================================
1307 .SS "Historical roff Documentation"
1308 .\" ====================================================================
1312 documents are still available on-line.
1314 The two main manuals of the
1321 .UR http://\:www.troff.org/\:54.pdf
1322 .I "Nroff/\:Troff User's Manual"
1325 Bell Labs, 1976; revised by Brian Kernighan, 1992.
1330 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:cstr/\:97.ps.gz
1331 .I "A Typesetter-independent TROFF"
1334 Bell Labs, 1981, revised March 1982.
1337 The \[lq]little language\[rq]
1343 Jon L.\& Bentley and Brian W.\& Kernighan,
1344 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:cstr/\:114.ps.gz
1345 .I "GRAP \[en] A Language for Typesetting Graphs"
1348 Bell Labs, August 1984.
1352 Brian W.\& Kernighan,
1353 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:cstr/\:116.ps.gz
1354 .I "PIC \[en] A Graphics Language for Typesetting"
1357 Bell Labs, December 1984.
1361 J.\& L.\& Bentley, L.\& W.\& Jelinski, and B.\& W.\& Kernighan,
1362 .UR http://\:cm.bell\-labs.com/\:cm/\:cs/\:cstr/\:122.ps.gz
1363 .I "CHEM \[en] A Program for Typesetting Chemical Structure Diagrams,"
1364 .I "Computers and Chemistry"
1367 Bell Labs, April 1986.
1371 You can get an archive with most
1372 .I classical roff documentation
1381 $ git clone https://github.com/bwarken/roff_classical.git
1386 .\" ====================================================================
1388 .\" ====================================================================
1390 Due to its complex structure, a full
1392 system has many man pages, each describing a single aspect of
1395 Unfortunately, there is no general naming scheme for the documentation
1405 .BR groff (@MAN1EXT@)
1406 contains a survey of all documentation available in
1411 On other systems, you are on your own, but
1413 might be a good starting point.
1416 .\" Restore compatibility mode (for, e.g., Solaris 10/11).
1420 .\" ====================================================================
1422 .\" ====================================================================
1424 .\" Local Variables:
1428 .\" vim: set filetype=groff textwidth=72: