Troff

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
Line 10: Line 10:
 
troff is part of a confusing universe of software packages, utilities, and formats with names like troff, nroff, roff, groff, ditroff, TYPSET, and RUNOFF (and some of these names have multiple meanings).
 
troff is part of a confusing universe of software packages, utilities, and formats with names like troff, nroff, roff, groff, ditroff, TYPSET, and RUNOFF (and some of these names have multiple meanings).
  
Currently, the most widely-used version of the troff software is ''groff'' (''GNU troff''). Note that the groff software includes utilities named both "groff" and "troff" (as well as "nroff"), which have different functions.
+
Currently, the most widely-used version of the troff software is ''groff'' (GNU troff). Note that the groff software includes utilities named both "groff" and "troff" (as well as "nroff"), which have different functions.
  
 
== Macro packages ==
 
== Macro packages ==
Line 17: Line 17:
 
troff and related utilities usually accept a <code>-m</code> option, to use a macro package. Some macro packages are deliberately given a name that begins with the letter "m", while their internal name has the "m" stripped off. For example, the <code>-man</code> option will read a macro package known as "man", but ''really'' named "an" (the macros would be in a file named "an.tmac"). Apparently, the theory is that <code>-man</code> looks better than the more logical <code>-mman</code> (though the packages often have aliases, so <code>-mman</code> might work as well).
 
troff and related utilities usually accept a <code>-m</code> option, to use a macro package. Some macro packages are deliberately given a name that begins with the letter "m", while their internal name has the "m" stripped off. For example, the <code>-man</code> option will read a macro package known as "man", but ''really'' named "an" (the macros would be in a file named "an.tmac"). Apparently, the theory is that <code>-man</code> looks better than the more logical <code>-mman</code> (though the packages often have aliases, so <code>-mman</code> might work as well).
  
A troff file's filename extension may suggest what macro package to use. Supposedly there is a way to indicate this in the content of the file, but for some reason this feature is not always used.
+
A troff file's filename extension may suggest what macro package to use. Supposedly there is a way to indicate this in the contents of the file, but for some reason this feature is not always used.
 +
 
 +
== Examples ==
 +
The nroff utility can help to display troff files on a terminal. For example:
 +
  $ nroff -ms example.ms | less -R
  
 
== Software ==
 
== Software ==
 
* [http://www.gnu.org/software/groff/ GNU troff (groff)]
 
* [http://www.gnu.org/software/groff/ GNU troff (groff)]
 +
 +
== Sample files ==
 +
* http://ftp.x.org/pub/unsupported/doc/Xserver/
  
 
== See also ==
 
== See also ==

Revision as of 23:26, 7 August 2014

File Format
Name troff
Ontology
Extension(s) .tmac, .man, .mom, .ms, many others
Released ~1976

troff is a typesetting utility and associated document format, used mainly on Unix-based systems. Its most common use is to render man pages, but it is capable of much more.

troff is part of a confusing universe of software packages, utilities, and formats with names like troff, nroff, roff, groff, ditroff, TYPSET, and RUNOFF (and some of these names have multiple meanings).

Currently, the most widely-used version of the troff software is groff (GNU troff). Note that the groff software includes utilities named both "groff" and "troff" (as well as "nroff"), which have different functions.

Contents

Macro packages

The troff format is usually not used directly; instead, troff files make use of one of the many available macro packages. Macro packages for the groff version of troff may be installed at /usr/share/groff/*/*.tmac.

troff and related utilities usually accept a -m option, to use a macro package. Some macro packages are deliberately given a name that begins with the letter "m", while their internal name has the "m" stripped off. For example, the -man option will read a macro package known as "man", but really named "an" (the macros would be in a file named "an.tmac"). Apparently, the theory is that -man looks better than the more logical -mman (though the packages often have aliases, so -mman might work as well).

A troff file's filename extension may suggest what macro package to use. Supposedly there is a way to indicate this in the contents of the file, but for some reason this feature is not always used.

Examples

The nroff utility can help to display troff files on a terminal. For example:

 $ nroff -ms example.ms | less -R

Software

Sample files

See also

  • man page (troff format with the "man" macro package)

Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox