5 This file is part of groff, the GNU roff type-setting system.
7 Copyright (C) 2000 Free Software Foundation, Inc.
8 written by Bernd Warken <bwarken@mayn.de>
10 Last update: 17 May 2000
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 AUTHOR, with no
16 Front-Cover Texts, and with no Back-Cover Texts.
18 A copy of the Free Documentation License is included as a file called
19 FDL in the main directory of the groff source package.
22 .\" --------------------------------------------------------------------
24 .\" --------------------------------------------------------------------
33 .\" text lines in macro definitions or bracketed sections \{...\}
42 . ds @tmp@ \fB\\$1\fP\fI\\$2\fP
44 . text \\*[@tmp@]\fR\\$*\fP
50 . ds @tmp@ `\f(CB\\$1\fP'
57 . ds @tmp@ \f(CB\\$1\fP
63 .als shellcommand option
66 . ds @tmp@ \f(CI\\$1\fP
73 . ds @tmp@ \f(CB\\$1\fP
79 .\" --------------------------------------------------------------------
81 .\" --------------------------------------------------------------------
82 .TH GROFF_TMAC @MAN5EXT@ "@MDATE@" "Groff Version @VERSION@"
84 groff_tmac \- macro files in the roff typesetting system
85 .\" --------------------------------------------------------------------
87 .\" --------------------------------------------------------------------
90 type-setting system provides a set of macro packages suitable for
91 special kinds of documents. Each macro package stores its macros and
92 definitions in a file called the package's
94 The name is deduced from
98 The tmac files are normal roff source documents, except that they
99 usually contain only definitions and setup commands, but no text. All
100 tmac files are kept in a single or a small number of directories, the
103 .\" --------------------------------------------------------------------
105 .\" --------------------------------------------------------------------
106 In classical roff systems, there was a funny naming scheme.
107 If the name of a macro package started with
109 this letter was omitted, e.g., the macro package for the man pages
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 content of the
155 For example, a file called
157 determines a macro package named
162 most macro packages are described in man pages called
163 .BR groff_<name> (@MAN7EXT@),
166 for the classical packages.
167 .\" --------------------------------------------------------------------
169 .\" --------------------------------------------------------------------
170 There are several ways to use a macro package in documents. At
171 run-time, the groff option
174 makes the definitions in the macro file
176 available as described in the section
179 It is also possible to include the macro file into the document by using
186 the full filename of the macro file must be specified \(em including the
187 directory where it is kept.
188 If the macro file is stored in one of the tmac directories it is more
191 instead because it additionally searches the tmac path for the filename.
193 Note that in order to resolve the
197 requests the roff preprocessor
199 must be called. This can be done either directly by a pipeline on the
200 command line or by using the
203 .shellcommand groff .
205 You can also supply the letter
207 in the preprocessor word as described in section
210 For example, suppose a macro file is stored as
211 .I /usr/share/groff/tmac/tmac.macros
212 and is used in some document called
215 At run-time, the formatter call for this is
219 .shellcommand "groff\ \-m"
225 To include the macro file directly in the document either
234 \&\.so /usr/share/groff/tmac/tmac.macros
238 In both cases, the formatter is called with
245 .\" --------------------------------------------------------------------
247 .\" --------------------------------------------------------------------
249 There is a convention that is supported by many modern roff
252 described in the following.
254 If the first line in a document is a comment, the first word (after the
255 comment characters and a blank) constitutes the
258 That means that the letters of this word are interpreted as
259 abbreviations for those preprocessor commands that should be run
260 when formatting the document. Mostly, only the letters corresponding to
261 the options for the preprocessors are recognized,
270 .BR roff (@MAN7EXT@)).
272 Besides being a good reminder for the user, some formatters (like the
274 program) are even able to automatically start the preprocessors
275 specified in the preprocessor word, but do not bet on this.
276 .\" --------------------------------------------------------------------
277 .SH "WRITING A MACRO FILE"
278 .\" --------------------------------------------------------------------
279 Writing a groff macro file is easy. Design a set of macros, strings,
280 registers, etc. Store them in a single file. Documents that use the
281 macros include this macro file with the
283 request as described in the
287 To use the tmac functionality, call the macro file
289 and put it in some directory of the tmac path, cf. section
291 Then documents can include it with the
294 .shellcommand "groff\ \-m"
295 option as described in the
299 If your macros might be of general usage contact the groff maintainers
300 to have them included in the groff
304 Some general guidelines might be helpful in writing macros.
306 Double all functional backslashes,
311 All printable backslashes must be written as
319 Make ample use of the non-printable character
321 in text parts, esp. before
323 and at the beginning of a line, but not before a delayed command.
327 in temporary variable names.
329 Test your macros for text and graphical devices, e.g.,
333 .\" --------------------------------------------------------------------
335 .\" --------------------------------------------------------------------
336 All macro names that want to use the tmac mechanism must be named
337 according to the form
340 The macro files are kept in the
343 all of which constitue the
346 In accordance with the Filesystem Hierarchy Standard (FHS), the standard
347 tmac directory location for groff is
348 .IR /usr/share/groff/tmac ,
349 a local installation will use
350 .IR /usr/local/share/groff/tmac .
351 Older systems used a subdirectory of
353 Independently of the default tmac path, the tmac path actually used by a
354 document can always be set by a shell environment variable, cf. section
356 .\" --------------------------------------------------------------------
358 .\" --------------------------------------------------------------------
361 A colon separated list of tmac directories in which to search for macro
365 If unset a default path is used as is outlined in the
368 .\" --------------------------------------------------------------------
370 .\" --------------------------------------------------------------------
371 The groff documentation is in evolution at the moment. It is possible
372 that small inconsistencies between different documents exist
374 .\" --------------------------------------------------------------------
376 .\" --------------------------------------------------------------------
377 This document is part of groff, the GNU roff distribution. It was
378 written by Bernd Warken <bwarken@mayn.de>.
380 It is distributed under the terms of the FDL (GNU Free Documentation
381 License) version 1.1 or later. You should have received a copy of the
382 FDL on your system, it is also available on-line under
385 .IR <http://www.gnu.org/copyleft/fdl.html> .
387 .\" --------------------------------------------------------------------
389 .\" --------------------------------------------------------------------
390 The authoritative source of information for all details of the groff
395 For a groff overview, see
399 in the groff source package.
401 The groff tmac macro packages are
402 .BR groff_man (@MAN7EXT@),
403 .BR groff_markup (@MAN7EXT@),
404 .BR groff_mdoc (@MAN7EXT@),
405 .BR groff_mdoc.samples (@MAN7EXT@),
406 .BR groff_me (@MAN7EXT@),
407 .BR groff_mm (@MAN7EXT@),
408 .BR groff_mmroff (@MAN7EXT@),
409 .BR groff_ms (@MAN7EXT@),
410 .BR groff_msafer (@MAN7EXT@).
412 The groff language is described in
413 .BR groff (@MAN7EXT@)
414 and the formatters in
415 .BR groff (@MAN1EXT@),
416 .BR troff (@MAN1EXT@).
418 The Filesystem Hierarchy Standard (FHS) is available at
419 .BR http://www.pathname.com/fhs/ .