4 Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
6 Copyright (C) 2000 - 2004, 2006 - 2009
7 Free Software Foundation, Inc.
8 written by Bernd Warken <bwarken@mayn.de> and Werner Lemberg
11 Permission is granted to copy, distribute and/or modify this document
12 under the terms of the GNU Free Documentation License, Version 1.1 or
13 any later version published by the Free Software Foundation; with the
14 Invariant Sections being this .ig-section and AUTHOR, with no
15 Front-Cover Texts, and with no Back-Cover Texts.
17 You should have received a copy of the Free Documentation License
18 as part of the file COPYING; also located in the main directory of the
19 source package of this program.
21 .ds Ellipsis \&.\|.\|.\&\"
23 .TH @U_ROFF@-TMAC @MAN5EXT@ "@MDATE@" "@T_ROFF@ v@VERSION@"
25 @L_ROFF@-tmac \- macro files in the roff typesetting system
33 .BR @L_ROFF@ (@MAN7EXT@)
34 type-setting system provides a set of macro packages suitable for
35 special kinds of documents.
37 Each macro package stores its macros and definitions in a file called
40 The name is deduced from
46 The tmac files are normal roff source documents, except that they
47 usually contain only definitions and setup commands, but no text.
49 All tmac files are kept in a single or a small number of directories,
56 .SH "@T_ROFF@ MACRO PACKAGES"
60 provides most classical macro packages, some more full packages, and
61 some secondary packages for special purposes.
63 Note that it is not possible to use multiple primary macro packages at the
64 same time; saying e.g.\&
68 \fIsh#\fP @L_ROFF@ \-m man \-m ms foo
76 \fIsh#\fP @L_ROFF@ \-m man foo \-m ms bar
81 Exception to this is the use of man pages written with either the
86 See below the description of the
97 This is the classical macro package for UNIX manual pages
98 (man\~pages); it is quite handy and easy to use; see
99 .BR @L_ROFF@-man (@MAN7EXT@).
106 An alternative macro package for man\~pages mainly used in BSD
107 systems; it provides many new features, but it is not the standard for
109 .BR @L_ROFF@-mdoc (@MAN7EXT@).
116 Use this file in case you don't know whether the
120 package should be used.
121 Multiple man pages (in either format) can be handled.
128 The packages in this section provide a complete set of macros for
129 writing documents of any kind, up to whole books.
131 They are similar in functionality; it is a matter of taste which one
140 .BR @L_ROFF@-me (@MAN7EXT@).
148 .BR @L_ROFF@-mm (@MAN7EXT@).
156 .BR @L_ROFF@-ms (@MAN7EXT@).
160 .SS "Language-specific Packages"
165 This file adds support for Czech localization, including the main macro
166 packages (me, mm, and ms).
171 sets the input encoding to latin-2.
178 German localization support, including the main macro packages (me, mom, mm,
183 selects hyphenation patterns for traditional orthography, and
185 does the same for the new orthography (`Recht\%schreib\%reform').
187 It should be used as the last macro package on the command line.
192 This file adds support for French localization, including the main macro
193 packages (me, mom, mm, and ms).
200 \fIsh#\fP @L_ROFF@ \-ms \-mfr foo.ms > foo.ps
207 sets the input encoding to latin-9 to get proper support of the `oe'
213 Swedish localization support, including the me, mom, and ms macro packages.
215 Note that Swedish for the mm macros is handled separately; see
216 .BR @L_ROFF@-mmse (@MAN7EXT@).
218 It should be used as the last macro package on the command line.
222 .SS "Input Encodings"
234 Various input encodings supported directly by @T_ROFF@.
236 Normally, this macro is loaded at the very beginning of a document or
237 specified as the first macro argument on the command line.
240 loads latin1 by default at start-up.
242 Note that these macro packages don't work on EBCDIC hosts.
247 Encoding support for EBCDIC.
249 On those platforms it is loaded automatically at start-up.
251 Due to different character ranges used in
253 it doesn't work on architectures which are based on ASCII.
257 Note that it can happen that some input encoding characters are not
258 available for a particular output device.
264 @L_ROFF@ \-Tlatin1 \-mlatin9 ...
268 fails if you use the Euro character in the input.
270 Usually, this limitation is present only for devices which have a
271 limited set of output glyphs
274 for other devices it is usually sufficient to install proper
275 fonts which contain the necessary glyphs.
279 .SS "Special Packages"
282 The macro packages in this section are not intended for stand-alone
283 usage, but can be used to add special functionality to any other
284 macro package or to plain @L_ROFF@.
289 Provide some macros for addition, multiplication, and division of 62bit
290 integers (allowing safe multiplication of 31bit integers, for example).
295 Switch to the EC and TC font families.
298 .BR \%@L_D_DVI@ (@MAN1EXT@)
299 \[en] this man page also gives more details of how to use it.
304 This macro file is already loaded at start-up by
306 so it isn't necessary to call it explicitly.
308 It provides an interface to set the paper size on the command line with
309 the option \f[B]\%\-dpaper=\f[]\f[I]size\f[].
313 are the same as the predefined
315 values in the DESC file (only lowercase; see
316 .BR @L_ROFF@-font (@MAN5EXT@)
322 (ell) character denotes landscape orientation.
330 Most output drivers need additional command line switches
334 to override the default paper length and orientation as set in the driver
337 For example, use the following for PS output on A4 paper in landscape
343 \fIsh#\fP @L_ROFF@ \-Tps \-dpaper=a4l \-P\-pa4 \-P\-l \-ms foo.ms > foo.ps
349 This file provides proper definitions for the macros
354 .BR @L_P_PIC@ (@MAN1EXT@)
357 They center each picture.
359 Use it only if your macro package doesn't provide proper definitions
360 for those two macros (actually, most of them already do).
365 A single macro is provided in this file,
367 to include a PostScript graphic in a document.
369 The following output devices support inclusion of PS images:
375 for all other devices the image is replaced with a hollow rectangle
378 This macro file is already loaded at start-up by
380 so it isn't necessary to call it explicitly.
390 |\|\fB\-I\fP\ \fIn\fP] \
391 \fI\|file\fP [\fIwidth\fP [,\fIheight\fP]]
396 is the name of the PostScript file;
400 give the desired width and height of the image.
406 argument is specified, the image's natural width (as given in
407 the file's bounding box) or the current line length is used
408 as the width, whatever is smaller.
414 arguments may have scaling indicators attached;
415 the default scaling indicator is\~\c
418 This macro scales the graphic uniformly
419 in the x and y\~directions so that it is no more than
428 centers the graphic horizontally, which is the default.
434 options cause the graphic to be left-aligned and right-aligned,
439 option causes the graphic to be indented by\~\c
441 (default scaling indicator is\~\c
447 within a diversion it is recommended to extend it with
448 the following code, assuring that the diversion's width completely
449 covers the image's width.
456 \&\[rs]h'(\[rs]\[rs]n[ps-offset]u + \[rs]\[rs]n[ps-deswid]u)'
466 A single macro is provided in this file,
468 for formatting permuted index entries as produces by the GNU
472 In case you need a different formatting, copy the macro into
473 your document and adapt it to your needs.
478 Use this for tracing macro calls.
480 It is only useful for debugging.
483 .BR @L_ROFF@-trace (@MAN7EXT@) .
488 Overrides the definition of standard troff characters and some @T_ROFF@
489 characters for TTY devices.
491 The optical appearance is intentionally inferior compared to that of
492 normal TTY formatting to allow processing with critical equipment.
497 Additions of elements known from the HTML format, as used in the
498 internet (World Wide Web) pages; this includes URL links and mail
500 .BR @L_ROFF@-www (@MAN7EXT@).
507 Classical roff systems were designed before the conventions of the
510 call evolved, and used a naming scheme for macro packages that looks
511 odd to modern eyes. Macro packages were always included with the option
513 when this option was directly followed by its argument without an
514 intervening space, this looked like a long option preceded by a single
515 minus \[em] a sensation in the computer stone age.
516 To make this invocation form work, classical troff
517 macro packages used names that started with the letter `m',
518 which was omitted in the naming of the macro file.
522 For example, the macro package for the man pages was called
526 So it could be activated by the argument
536 For similar reasons, macro packages that did not start with an `m'
538 added in the documentation and in speech; for example, the package
543 in the documentation, although a more suitable name would be
545 For, when omitting the space between the option and its argument, the
546 command line option for activating this package reads
551 To cope with all situations, actual versions of
552 .BR @L_ROFF@ (@MAN1EXT@)
553 are smart about both naming schemes by providing two macro files
554 for the inflicted macro packages; one with a leading `m'
555 the other one without it.
557 Newer packages are more specific; for example, the
559 macro package may be specified only as one of the two methods:
563 \fIsh#\fP @L_ROFF@\ \-m\ www
564 \fIsh#\fP @L_ROFF@\ \-mwww
569 Obviously, variants like
571 would not make much sense.
575 A second strange feature of classical troff was to name macro files
576 in the form \f[B]tmac.\f[]\f[I]name\f[].
577 In modern operating systems, the type of a file is specified as a
578 postfix, the file name extension.
580 Again, @T_ROFF@ copes with this situation by searching both
590 The easiest way to find out which macro packages are available on a
591 system is to check the man\~page
592 .BR @L_ROFF@ (@MAN1EXT@),
593 or the contents of the
599 Most macro packages are described in\~man pages called
600 .BR @L_ROFF@_\f[I]name\f[] (@MAN7EXT@),
602 for the classical packages.
609 There are several ways to use a macro package in a document.
611 The classical way is to specify the option
614 at run-time; this makes the contents of the macro package
618 In @T_ROFF@, the file
620 is searched within the tmac path; if not found,
622 is searched for instead.
626 Alternatively, it is also possible to include a macro file by adding
630 into the document; the argument must be the full file name of an
631 existing file, possibly with the directory where it is kept.
633 In @T_ROFF@ this was improved by the similar request
636 which added searching in the tmac path, just like option
642 Note that in order to resolve the
646 requests, the roff preprocessor
647 .BR @L_P_SOELIM@ (@MAN1EXT@)
648 must be called if the files to be included need preprocessing.
650 This can be done either directly by a pipeline on the command line or
655 calls @L_P_SOELIM@ automatically.
659 For example, suppose a macro file is stored as
662 .I @MACRODIR@/macros.tmac
665 and is used in some document called
670 At run-time, the formatter call for this is
674 \fIsh#\fP @L_ROFF@ \-m macros docu.roff
679 To include the macro file directly in the document either
691 \&.so @MACRODIR@/macros.tmac
696 In both cases, the formatter should be called with option
702 \fIsh#\fP groff \-s docu.roff
706 If you want to write your own @T_ROFF@ macro file, call it
708 and put it in some directory of the tmac path, see section
710 Then documents can include it with the
712 request or the option
721 There is a convention that is supported by many modern roff
726 described in the following.
729 If the first line in a document is a comment, the first word (after the
730 comment characters and a blank) constitutes the
733 That means that the letters of this word are interpreted as
734 abbreviations for those preprocessor commands that should be run
735 when formatting the document.
737 Mostly, only the letters corresponding to the options for the
738 preprocessors are recognized,
756 .BR @L_ROFF@-history (@MAN7EXT@)).
760 Besides being a good reminder for the user, some formatters (like the
762 program) are even able to automatically start the preprocessors
763 specified in the preprocessor word, but do not bet on this.
769 program handles some preprocessors automatically, such that in
770 man\~pages only the following characters should be used:
780 .BR @L_ROFF@ (@MAN7EXT@)
781 document is a text file that is enriched by predefined formatting
782 constructs, such as requests, escape sequences, strings, numeric
783 registers, and macros from a macro package.
785 These elements are described in
786 .BR @L_ROFF@ (@MAN7EXT@).
790 To give a document a personal style, it is most useful to extend the
791 existing elements by defining some macros for repeating tasks; the best
792 place for this is near the beginning of the document or in a separate
797 Macros without arguments are just like strings.
799 But the full power of macros reveals when arguments are passed with a
802 Within the macro definition, the arguments are available as the escape
807 .BR \[rs]$[ \*[Ellipsis] ] ,
811 the name under which the macro was called is in
813 and the number of arguments is in register
816 .BR @L_ROFF@ (@MAN7EXT@).
823 The phase when @T_ROFF@ reads a macro is called
829 This is comparable to the C\~preprocessing phase during the development
830 of a program written in the C\~language.
834 In this phase all backslashes are interpreted; that means that all
835 escape sequences in the macro body are interpreted and replaced by
838 For constant expressions, this is wanted, but strings and registers
839 that might change between calls of the macro must be protected from
842 This is most easily done by doubling the backslash that introduces the
845 This doubling is most important for the positional parameters.
847 For example, to print information on the arguments that were passed to
848 the macro to the terminal, define a macro named `.print_args',
853 .ds @1 \[rs]f[I]\[rs]\[rs]$0\[rs]f[]\"
856 \&.ds midpart was called with
858 \&.\ \ tm\ \*[@1]\ \[rs]*[midpart]\ \[rs]\[rs]n[.$]\ \*[@2]
859 \&.\ \ tm\ \[rs]\[rs]$*
867 When calling this macro by
871 \&.print_args arg1 arg2
875 the following text is printed to the terminal:
879 \&\f[CI]print_args\f[] was called with the following 2 arguments:
885 Let's analyze each backslash in the macro definition.
887 As the positional parameters and the number of arguments change
888 with each call of the macro their leading backslash must be doubled,
892 .RI \[rs]\[rs] [.$] .
893 The same applies to the macro name because it could be called with an
901 is a constant string, it does not change, so no doubling for
902 .RI \[rs] *[midpart] .
905 escape sequences are predefined elements for setting the font
908 Of course, this behavior does not change, so no doubling with
918 Writing macros is easy when the escaping mechanism is temporarily
921 This is done by enclosing the macro definition(s) into a pair of
927 Then the body in the macro definition is just like a normal part of
928 the document \[em] text enhanced by calls of requests, macros,
929 strings, registers, etc.
931 For example, the code above can be written in a simpler way by
935 .ds @1 \[rs]f[I]\[rs]$0\[rs]f[]\"
939 \&.ds midpart was called with
941 \&.\ \ tm\ \*[@1]\ \[rs]*[midpart]\ \[rs]n[.$]\ \*[@2]
951 Unfortunately, draft mode cannot be used universally.
953 Although it is good enough for defining normal macros, draft mode
954 fails with advanced applications, such as indirectly defined
955 strings, registers, etc.
957 An optimal way is to define and test all macros in draft mode and then
958 do the backslash doubling as a final step; do not forget to remove the
964 .SS "Tips for Macro Definitions"
968 Start every line with a dot, for example, by using the request
970 for text lines, or write your own macro that handles also text lines
977 \&.\ \ if (\[rs]\[rs]n[.$] == 0)\ \[rs]
979 \&.\ \ nop\ \[rs])\[rs]\[rs]$*\[rs])
985 Write a comment macro that works both for copy-in and draft mode; for
986 as escaping is off in draft mode, trouble might occur when normal
989 For example, the following macro just ignores its arguments, so it
990 acts like a comment line:
997 \&.c\ This\ is\ like\ a\ comment\ line.
1002 In long macro definitions, make ample use of comment lines or
1003 almost-empty lines (this is, lines which have a leading dot
1004 and nothing else) for a better structuring.
1007 To increase readability, use the indentation facility for requests
1008 and macro calls (arbitrary whitespace after the leading dot).
1015 Diversions can be used to implement quite advanced programming
1018 They are comparable to pointers to large data structures in the
1019 C\~programming language, but their usage is quite different.
1023 In their simplest form, diversions are multi-line strings, but
1024 they get their power when diversions are used dynamically within macros.
1026 The (formatted) information stored in a diversion can be retrieved by
1027 calling the diversion just like a macro.
1031 Most of the problems arising with diversions can be avoided if you remain
1032 aware of the fact that diversions always store complete lines.
1034 If diversions are used when the line buffer has not been flushed,
1035 strange results are produced; not knowing this, many people get
1036 desperate about diversions.
1038 To ensure that a diversion works, line breaks should be added at the
1041 To be on the secure side, enclose everything that has to do with
1042 diversions into a pair of line breaks; for example, by explicitly using
1046 This rule should be applied to diversion definition, both inside and
1047 outside, and to all calls of diversions.
1049 This is a bit of overkill, but it works nicely.
1053 [If you really need diversions which should ignore the current partial
1054 line, use environments to save the current partial line and/\:or use the
1060 The most powerful feature using diversions is to start a diversion
1061 within a macro definition and end it within another macro.
1063 Then everything between each call of this macro pair is stored within
1064 the diversion and can be manipulated from within the macros.
1071 All macro names must be named
1073 to fully use the tmac mechanism.
1076 as with classical packages is possible as well, but deprecated.
1080 The macro files are kept in the
1081 .IR "tmac directories" ;
1082 a colon separated list of these constitutes the
1087 The search sequence for macro files is (in that order):
1090 the directories specified with the
1095 the directories given in the
1096 .B $@U_ROFF@_TMAC_PATH
1097 environment variable
1100 the current directory (only if in unsafe mode, which is enabled by the
1102 command line switch)
1108 a platform-specific directory, being
1116 in this installation
1119 a site-specific (platform-independent) directory, being
1127 in this installation
1130 the main tmac directory, being
1138 in this installation
1146 .B $@U_ROFF@_TMAC_PATH
1147 A colon separated list of additional tmac directories in which to search
1150 See the previous section for a detailed description.
1157 Copyright (c) 2014 - 2017 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
1159 Copyright (C) 2000 - 2004, 2006 - 2009
1160 Free Software Foundation, Inc.
1163 This document is distributed under the terms of the FDL (GNU Free
1164 Documentation License) version 1.1 or later.
1166 You should have received a copy of the FDL on your system, it is also
1167 available on-line at the
1168 .UR http://\:www.gnu.org/\:copyleft/\:fdl.html
1173 This document was written by
1182 .BR @L_ROFF@ (@MAN1EXT@)
1183 an overview of the @T_ROFF@ system.
1187 .BR @L_ROFF@-man (@MAN7EXT@),
1189 .BR @L_ROFF@-mdoc (@MAN7EXT@),
1191 .BR @L_ROFF@-me (@MAN7EXT@),
1193 .BR @L_ROFF@-mm (@MAN7EXT@),
1195 .BR @L_ROFF@-ms (@MAN7EXT@),
1197 .BR @L_ROFF@-trace (@MAN7EXT@),
1199 .BR @L_ROFF@-www (@MAN7EXT@).
1200 the @T_ROFF@ tmac macro packages.
1204 .BR @L_ROFF@ (@MAN7EXT@)
1205 the @T_ROFF@ language.
1209 The Filesystem Hierarchy Standard is available at the
1210 .UR http://\:www.pathname.com/\:fhs/