4 This file is part of groff, the GNU roff type-setting system.
6 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
7 written by Bernd Warken <bwarken@mayn.de>
9 Permission is granted to copy, distribute and/or modify this document
10 under the terms of the GNU Free Documentation License, Version 1.1 or
11 any later version published by the Free Software Foundation; with the
12 Invariant Sections being this .ig-section and AUTHOR, with no
13 Front-Cover Texts, and with no Back-Cover Texts.
15 A copy of the Free Documentation License is included as a file called
16 FDL in the main directory of the groff source package.
19 .\" --------------------------------------------------------------------
21 .\" --------------------------------------------------------------------
30 .\" text lines in macro definitions or bracketed sections \{...\}
39 . ds @tmp@ \fB\\$1\fP\fI\\$2\fP
41 . text \\*[@tmp@]\fR\\$*\fP
47 . ds @tmp@ `\f(CB\\$1\fP'
54 . ds @tmp@ \f(CB\\$1\fP
60 .als shellcommand option
63 . ds @tmp@ \f(CI\\$1\fP
70 . ds @tmp@ \f(CB\\$1\fP
76 .\" --------------------------------------------------------------------
78 .\" --------------------------------------------------------------------
79 .TH GROFF_TMAC @MAN5EXT@ "@MDATE@" "Groff Version @VERSION@"
81 groff_tmac \- macro files in the roff typesetting system
82 .\" --------------------------------------------------------------------
84 .\" --------------------------------------------------------------------
87 type-setting system provides a set of macro packages suitable for
88 special kinds of documents. Each macro package stores its macros and
89 definitions in a file called the package's
91 The name is deduced from
95 The tmac files are normal roff source documents, except that they
96 usually contain only definitions and setup commands, but no text. All
97 tmac files are kept in a single or a small number of directories, the
100 .\" --------------------------------------------------------------------
102 .\" --------------------------------------------------------------------
103 In classical roff systems, there was a funny naming scheme.
104 If the name of a macro package started with
106 this letter was omitted, e.g., the macro package for the man pages
112 (note that in recent versions of groff this file is called
116 By a similar reasoning, macro packages that did not start with an
118 were often referred to by adding an
120 e.g., the package corresponding to
124 because the command-line for activating it reads
127 .BIR "troff\ \-m" doc .
131 .BR groff (@MAN1EXT@)
132 provide both naming schemes for the inflicted macro packages, with and
139 macro package may be specified as
142 .BIR "groff\ \-m\ " man ,
144 .BIR "groff\ \-m" an ,
146 .BIR "groff\ \-m" man , or
148 .BIR "groff\ \-m " an .
151 The easiest way to find out which macro packages are available on a
152 system is to check the contents of the
155 For example, a file called
159 determines a macro package named
164 most macro packages are described in man pages called
165 .BR groff_<name> (@MAN7EXT@),
168 for the classical packages.
169 .\" --------------------------------------------------------------------
171 .\" --------------------------------------------------------------------
172 There are several ways to use a macro package in documents. At
173 run-time, the groff option
176 makes the definitions in the macro file
178 available as described in the section
180 If this file isn't found,
184 It is also possible to include the macro file into the document by using
191 the full filename of the macro file must be specified \(em including the
192 directory where it is kept.
193 If the macro file is stored in one of the tmac directories it is more
196 instead because it searches the tmac path for the filename.
197 Additionally, if the file name to be included has the form
203 instead and vice versa.
205 Note that in order to resolve the
209 requests the roff preprocessor
211 must be called if the files to be included needs preprocessing.
212 This can be done either directly by a pipeline on the command line or by
216 .shellcommand groff .
218 You can also supply the letter
220 in the preprocessor word as described in section
223 For example, suppose a macro file is stored as
224 .I @MACRODIR@/macros.tmac
225 and is used in some document called
228 At run-time, the formatter call for this is
232 .shellcommand "groff\ \-m"
238 To include the macro file directly in the document either
247 \&\.so @MACRODIR@/macros.tmac
251 In both cases, the formatter is called with
258 .\" --------------------------------------------------------------------
260 .\" --------------------------------------------------------------------
262 There is a convention that is supported by many modern roff
265 described in the following.
267 If the first line in a document is a comment, the first word (after the
268 comment characters and a blank) constitutes the
271 That means that the letters of this word are interpreted as
272 abbreviations for those preprocessor commands that should be run
273 when formatting the document. Mostly, only the letters corresponding to
274 the options for the preprocessors are recognized,
283 .BR roff (@MAN7EXT@)).
285 Besides being a good reminder for the user, some formatters (like the
287 program) are even able to automatically start the preprocessors
288 specified in the preprocessor word, but do not bet on this.
289 .\" --------------------------------------------------------------------
290 .SH "WRITING A MACRO FILE"
291 .\" --------------------------------------------------------------------
292 Writing a groff macro file is easy. Design a set of macros, strings,
293 registers, etc. Store them in a single file. Documents that use the
294 macros include this macro file with the
296 request as described in the
300 To use the tmac functionality, call the macro file
304 ) and put it in some directory of the tmac path, cf. section
306 Then documents can include it with the
309 .shellcommand "groff\ \-m"
310 option as described in the
314 If your macros might be of general usage contact the groff maintainers
315 to have them included in the groff
319 Some general guidelines might be helpful in writing macros.
321 Double all functional backslashes,
326 All printable backslashes must be written as
334 Make ample use of the non-printable character
336 in text parts, esp. before
338 and at the beginning of a line, but not before a delayed command.
342 in temporary variable names.
344 Test your macros for text and graphical devices, e.g.,
348 .\" --------------------------------------------------------------------
350 .\" --------------------------------------------------------------------
351 All macro names must be named
355 to use the tmac mechanism.
357 The macro files are kept in the
360 all of which constitute the
364 The elements of the search path for macro files are (in that order):
366 the directories specified with troff's resp. groff's
370 the directories given in the
374 the current directory (only if in unsafe mode using the
380 a site-specific (platform-independent) directory, a platform-specific
381 directory, and the main tmac directory:
388 .\" --------------------------------------------------------------------
390 .\" --------------------------------------------------------------------
393 A colon separated list of additional tmac directories in which to search
395 See the previous section for a detailed description.
396 .\" --------------------------------------------------------------------
398 .\" --------------------------------------------------------------------
399 The groff documentation is in evolution at the moment. It is possible
400 that small inconsistencies between different documents exist
402 .\" --------------------------------------------------------------------
404 .\" --------------------------------------------------------------------
405 This document is part of groff, the GNU roff distribution. It was
406 written by Bernd Warken <bwarken@mayn.de>.
408 It is distributed under the terms of the FDL (GNU Free Documentation
409 License) version 1.1 or later. You should have received a copy of the
410 FDL on your system, it is also available on-line under
413 .IR <http://www.gnu.org/copyleft/fdl.html> .
415 .\" --------------------------------------------------------------------
417 .\" --------------------------------------------------------------------
418 The authoritative source of information for all details of the groff
423 For a groff overview, see
427 in the groff source package.
429 The groff tmac macro packages are
430 .BR groff_man (@MAN7EXT@),
431 .BR groff_www (@MAN7EXT@),
432 .BR groff_mdoc (@MAN7EXT@),
433 .BR groff_me (@MAN7EXT@),
434 .BR groff_mm (@MAN7EXT@),
435 .BR groff_mmroff (@MAN7EXT@),
437 .BR groff_ms (@MAN7EXT@).
439 The groff language is described in
440 .BR groff (@MAN7EXT@)
441 and the formatters in
442 .BR groff (@MAN1EXT@),
443 .BR troff (@MAN1EXT@).
445 The Filesystem Hierarchy Standard (FHS) is available at
446 .BR http://www.pathname.com/fhs/ .