Section: File Formats (5)
Updated: 21 August 2002
Index Return to Main Contents


groff_tmac - macro files in the roff typesetting system  


The roff(7) type-setting system provides a set of macro packages suitable for special kinds of documents. Each macro package stores its macros and definitions in a file called the package's tmac file. The name is deduced from `TroffMACros'. The tmac files are normal roff source documents, except that they usually contain only definitions and setup commands, but no text. All tmac files are kept in a single or a small number of directories, the tmac directories.  


groff provides all classical macro packages, some more full packages, and some secondary packages for special purposes.  


This is the classical macro package for UNIX manual pages (man~pages); it is quite handy and easy to use; see groff_man(7).
An alternative macro package for man~pages mainly used in BSD systems; it provides many new features, but it is not the standard for man~pages; see groff_mdoc(7).

Full Packages

The packages in this section provide a complete set of macros for writing documents of any kind, up to whole books. They are similar in functionality; it is a matter of taste which one to use.
The classical me macro package; see groff_me(7).
The semi-classical mm macro package; see groff_mm(7).
The new mom macro package, only available in groff. As this is not based on other packages, it can be freely designed. So it is expected to become quite a nice, modern macro package. See groff_mom(7).
The classical ms macro package; see groff_ms(7).

Special Packages

The macro packages in this section are not intended for stand-alone usage, but can be used to add special functionality to any other macro package or to plain groff.
Overrides the definition of standard troff characters and some groff characters for tty devices. The optical appearance is intentionally inferior compared to that of normal tty formatting to allow processing with critical equipment.
Additions of elements known from the html format, as being used in the internet (World Wide Web) pages; this includes URL links and mail addresses; see groff_www(7).


In classical roff systems, there was a funny naming scheme for macro packages, due to a simplistic design in option parsing. Macro packages were always included by option when this option was directly followed by its argument without an intervening space, this looked like a long option preceded by a single minus [em] a sensation in the computer stone age. To make this optically working for macro package names, all classical macro packages choose a name that started with the letter which was omitted in the naming of the macro file. For example, the macro package for the man pages was called man, while its macro file So it could be activated by the argument an to option or for short. For similar reasons, macro packages that did not start with an had a leading added in the documentation and in talking; for example, the package corresponding to tmac.doc was called mdoc in the documentation, although a more suitable name would be doc. For, when omitting the space between the option and its argument, the command line option for activating this package reads To cope with all situations, actual versions of groff(1) are smart about both naming schemes by providing two macro files for the inflicted macro packages; one with a leading the other one without it. So in groff, the man macro package may be specified as on of the following four methods:

ell_cmd groff~-m~man


ell_cmd groff~-man


ell_cmd groff~-mman


ell_cmd groff~-m~an

Recent packages that do not start with do not use an additional in the documentation. For example, the www macro package may be specified only as one of the two methods:

ell_cmd groff~-m~www


ell_cmd groff~-mwww

Obviously, variants like -mmwww would not make much sense. A second strange feature of classical troff was to name macro files according to In modern operating systems, the type of a file is specified as postfix, the file name extension. Again, groff copes with this situation by searching both anything.tmac and tmac.anything if only anything is specified. The easiest way to find out which macro packages are available on a system is to check the man~page groff(1), or the contents of the tmac directories. In groff, most macro packages are described in~man pages called groff_I]name](7), with a leading for the classical packages.  


There are several ways to use a macro package in a document. The classical way is to specify the troff/groff option at run-time; this makes the contents of the macro package name available. In groff, the file name.tmac is searched within the tmac path; if not found, will be searched for instead. Alternatively, it is also possible to include a macro file by adding the request filename into the document; the argument must be the full file name of an existing file, possibly with the directory where it is kept. In groff, this was improved by the similar request package, which added searching in the tmac path, just like option does. Note that in order to resolve the and requests, the roff preprocessor soelim(1) must be called if the files to be included need preprocessing. This can be done either directly by a pipeline on the command line or by using the troff/groff option man calls soelim automatically. For example, suppose a macro file is stored as /usr/share/groff/ and is used in some document called docu.roff. At run-time, the formatter call for this is

ell_cmd groff~-m~ macrofile~document.roff

To include the macro file directly in the document either