4 @c Please convert this manual with `texi2dvi -e groff.texinfo' due to
5 @c problems in texinfo regarding expansion of user-defined macros.
7 @c You need texinfo 4.8 or newer to format this document!
10 @c %**start of header (This is for running Texinfo on a region.)
11 @setfilename groff.info
12 @settitle The GNU Troff Manual
13 @setchapternewpage odd
14 @footnotestyle separate
15 @c %**end of header (This is for running Texinfo on a region.)
18 @documentencoding ISO-8859-1
27 This manual documents GNU @code{troff} version 1.22.3.
29 Copyright @copyright{} 1994-2014 Free Software Foundation, Inc.
32 Permission is granted to copy, distribute and/or modify this document
33 under the terms of the GNU Free Documentation License, Version 1.3 or
34 any later version published by the Free Software Foundation; with no
35 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
36 and with the Back-Cover Texts as in (a) below. A copy of the license is
37 included in the section entitled ``GNU Free Documentation License.''
39 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
40 modify this GNU manual. Buying copies from the FSF supports it in
41 developing GNU and promoting software freedom.''
46 @c We use the following indices:
52 @c kindex: commands in font files
53 @c pindex: programs and files
54 @c tindex: environment variables
59 @c tindex and cindex are merged.
69 @c To avoid uppercasing in @deffn while converting to info, we define
70 @c our special @Var{}.
77 @c To assure correct HTML translation, some ugly hacks are necessary.
78 @c While processing a @def... request, the HTML translator looks at the
79 @c next line to decide whether to start indentation, and if the line
80 @c starts with @def... (e.g. @deffnx), indentation is started. We must
81 @c therefore ensure that a @def... is seen, during macro expansion.
83 @c The following macros have to be used:
102 @c The definition block must end with
106 @c The above is valid for texinfo 4.0f and above.
108 @c By default, only the first item generates an index entry. To
109 @c override this, use a variant with a trailing `x' (like
113 @c a dummy macro to assure the `@def...'
120 @c definition of requests
122 @macro Defreq{name, arg}
123 @deffn Request @t{.\name\} \arg\
128 @macro DefreqList{name, arg}
129 @deffn Request @t{.\name\} \arg\
135 @macro DefreqItem{name, arg}
136 @deffnx Request @t{.\name\} \arg\
141 @macro DefreqItemx{name, arg}
142 @deffnx Request @t{.\name\} \arg\
148 @macro DefreqListEnd{name, arg}
149 @deffnx Request @t{.\name\} \arg\
153 @macro DefreqListEndx{name, arg}
154 @deffnx Request @t{.\name\} \arg\
164 @c definition of escapes
166 @macro Defesc{name, delimI, arg, delimII}
167 @deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
172 @macro DefescList{name, delimI, arg, delimII}
173 @deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
179 @macro DefescItem{name, delimI, arg, delimII}
180 @deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
185 @macro DefescItemx{name, delimI, arg, delimII}
186 @deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
192 @macro DefescListEnd{name, delimI, arg, delimII}
193 @deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
197 @macro DefescListEndx{name, delimI, arg, delimII}
198 @deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
208 @c definition of registers
211 @deffn Register @t{\\n[\name\]}
216 @macro DefregList{name}
217 @deffn Register @t{\\n[\name\]}
223 @macro DefregItem{name}
224 @deffnx Register @t{\\n[\name\]}
229 @macro DefregItemx{name}
230 @deffnx Register @t{\\n[\name\]}
236 @macro DefregListEnd{name}
237 @deffnx Register @t{\\n[\name\]}
241 @macro DefregListEndx{name}
242 @deffnx Register @t{\\n[\name\]}
252 @c definition of registers specific to macro packages, preprocessors, etc.
254 @macro Defmpreg{name, package}
255 @deffn Register @t{\\n[\name\]}
256 @vindex \name\ @r{[}\package\@r{]}
260 @macro DefmpregList{name, package}
261 @deffn Register @t{\\n[\name\]}
263 @vindex \name\ @r{[}\package\@r{]}
267 @macro DefmpregItem{name, package}
268 @deffnx Register @t{\\n[\name\]}
273 @macro DefmpregItemx{name, package}
274 @deffnx Register @t{\\n[\name\]}
276 @vindex \name\ @r{[}\package\@r{]}
280 @macro DefmpregListEnd{name, package}
281 @deffnx Register @t{\\n[\name\]}
285 @macro DefmpregListEndx{name, package}
286 @deffnx Register @t{\\n[\name\]}
287 @vindex \name\ @r{[}\package\@r{]}
296 @c definition of macros
298 @macro Defmac{name, arg, package}
299 @defmac @t{.\name\} \arg\
300 @maindex \name\ @r{[}\package\@r{]}
304 @macro DefmacList{name, arg, package}
305 @defmac @t{.\name\} \arg\
307 @maindex \name\ @r{[}\package\@r{]}
311 @macro DefmacItem{name, arg, package}
312 @defmacx @t{.\name\} \arg\
317 @macro DefmacItemx{name, arg, package}
318 @defmacx @t{.\name\} \arg\
320 @maindex \name\ @r{[}\package\@r{]}
324 @macro DefmacListEnd{name, arg, package}
325 @defmacx @t{.\name\} \arg\
329 @macro DefmacListEndx{name, arg, package}
330 @defmacx @t{.\name\} \arg\
331 @maindex \name\ @r{[}\package\@r{]}
340 @c definition of strings
342 @macro Defstr{name, package}
343 @deffn String @t{\\*[\name\]}
344 @stindex \name\ @r{[}\package\@r{]}
348 @macro DefstrList{name, package}
349 @deffn String @t{\\*[\name\]}
351 @stindex \name\ @r{[}\package\@r{]}
355 @macro DefstrItem{name, package}
356 @deffnx String @t{\\*[\name\]}
361 @macro DefstrItemx{name, package}
362 @deffnx String @t{\\*[\name\]}
364 @stindex \name\ @r{[}\package\@r{]}
368 @macro DefstrListEnd{name, package}
369 @deffnx String @t{\\*[\name\]}
373 @macro DefstrListEndx{name, package}
374 @deffnx String @t{\\*[\name\]}
375 @stindex \name\ @r{[}\package\@r{]}
384 @c our example macros
396 @macro CartoucheExample
401 @macro endCartoucheExample
410 \gdef\Langlemacro{\angleleft}
411 \gdef\Ranglemacro{\angleright}
415 @set Langlemacro @Langlemacro
416 @set Ranglemacro @Ranglemacro
425 @value{Langlemacro}@r{\text\}@value{Ranglemacro}
431 @c Since expansion of macros has changed between texinfo 4.x and 5.x,
432 @c we can't define a macro but have to use @value directly.
447 @c Special care is required with parentheses, brackets, and braces:
449 @c . Real parentheses in @deffn produce an error while compiling with
451 @c . Real brackets use the wrong font in @deffn, overriding @t{}.
453 @c . @{ and @} fail with info if used in a macro.
455 @c Since macros aren't expanded in @deffn during -E, the following
456 @c definitions are for non-TeX only.
458 @c This is true for texinfo 4.0 and above.
461 @set Lparenmacro @lparen
462 @set Rparenmacro @rparen
463 @set Lbrackmacro @lbrack
464 @set Rbrackmacro @rbrack
498 @c This suppresses the word `Appendix' in the appendix headers.
501 \gdef\gobblefirst#1#2{#2}
502 \gdef\putwordAppendix{\gobblefirst}
506 @c We map some latin-1 characters to corresponding texinfo macros.
507 @c Newer versions of texinfo.tex have similar code included already.
510 \global\catcode`^^e4\active % ä
512 \global\catcode`^^c4\active % Ä
514 \global\catcode`^^e9\active % é
516 \global\catcode`^^c9\active % É
518 \global\catcode`^^f6\active % ö
520 \global\catcode`^^d6\active % Ö
522 \global\catcode`^^fc\active % ü
524 \global\catcode`^^dc\active % Ü
526 \global\catcode`^^e6\active % æ
528 \global\catcode`^^c6\active % Æ
530 \global\catcode`^^df\active % ß
535 @c Note: We say `Roman numerals' but `roman font'.
538 @dircategory Typesetting
540 * Groff: (groff). The GNU troff document formatting system.
546 @subtitle The GNU implementation of @code{troff}
547 @subtitle Edition 1.22.3
548 @subtitle Autumn 2014
549 @author by Trent A.@tie{}Fisher
550 @author and Werner Lemberg (@email{bug-groff@@gnu.org})
553 @vskip 0pt plus 1filll
560 @node Top, Introduction, (dir), (dir)
567 * Tutorial for Macro Users::
574 * Copying This Manual::
582 * Font File Keyword Index::
583 * Program and File Index::
593 @c =====================================================================
594 @c =====================================================================
596 @node Introduction, Invoking groff, Top, Top
597 @chapter Introduction
600 GNU @code{troff} (or @code{groff}) is a system for typesetting
601 documents. @code{troff} is very flexible and has been used extensively
602 for some thirty years. It is well entrenched in the @acronym{UNIX}
608 * groff Capabilities::
609 * Macro Package Intro::
610 * Preprocessor Intro::
611 * Output device intro::
616 @c =====================================================================
618 @node What Is groff?, History, Introduction, Introduction
619 @section What Is @code{groff}?
620 @cindex what is @code{groff}?
621 @cindex @code{groff} -- what is it?
623 @code{groff} belongs to an older generation of document preparation
624 systems, which operate more like compilers than the more recent
625 interactive @acronym{WYSIWYG}@footnote{What You See Is What You Get}
626 systems. @code{groff} and its contemporary counterpart, @TeX{}, both
627 work using a @dfn{batch} paradigm: The input (or @dfn{source}) files are
628 normal text files with embedded formatting commands. These files can
629 then be processed by @code{groff} to produce a typeset document on a
632 @code{groff} should not be confused with a @dfn{word processor}, an
633 integrated system of editor and text formatter. Also, many word
634 processors follow the @acronym{WYSIWYG} paradigm discussed earlier.
636 Although @acronym{WYSIWYG} systems may be easier to use, they have a
637 number of disadvantages compared to @code{troff}:
641 They must be used on a graphics display to work on a document.
644 Most of the @acronym{WYSIWYG} systems are either non-free or are not
648 @code{troff} is firmly entrenched in all @acronym{UNIX} systems.
651 It is difficult to have a wide range of capabilities within the confines
652 of a GUI/window system.
655 It is more difficult to make global changes to a document.
659 ``GUIs normally make it simple to accomplish simple actions and
660 impossible to accomplish complex actions.'' --Doug Gwyn (22/Jun/91 in
661 @code{comp.unix.wizards})
665 @c =====================================================================
667 @node History, groff Capabilities, What Is groff?, Introduction
671 @cindex @code{RUNOFF}, the program
672 @cindex @code{rf}, the program
673 @code{troff} can trace its origins back to a formatting program called
674 @code{RUNOFF}, written by Jerry Saltzer, which ran on the @acronym{CTSS}
675 (@emph{Compatible Time Sharing System}, a project of MIT, the
676 Massachusetts Institute of Technology) in the
677 mid-sixties.@footnote{Jerome H.@: Saltzer, a grad student then, later a
678 Professor of Electrical Engineering, now retired. Saltzer's PhD thesis
679 was the first application for @code{RUNOFF} and is available from the
680 MIT Libraries.} The name came from the use of the phrase ``run off a
681 document'', meaning to print it out.
683 @c Tom Van Vleck <thvv@multicians.org> writes about the following:
685 @c I am not sure about this.. I think the BCPL runoff was the port to
686 @c the 635 architecture, and that the order of events is
688 @c 2. BCPL runoff on Multics
689 @c 3. BCPL runoff on 635
692 Bob Morris ported it to the 635 architecture and called the program
693 @code{roff} (an abbreviation of @code{runoff}). It was rewritten as
694 @code{rf} for the @w{PDP-7} (before having @acronym{UNIX}), and at the
695 same time (1969), Doug McIllroy rewrote an extended and simplified
696 version of @code{roff} in the @acronym{BCPL} programming language.
698 @cindex @code{roff}, the program
699 In 1971, the UNIX developers wanted to get a @w{PDP-11}, and to justify
700 the cost, proposed the development of a document formatting system for
701 the @acronym{AT&T} patents division. This first formatting program was
702 a reimplementation of McIllroy's @code{roff}, written by J.@tie{}F.@:
705 @cindex @code{nroff}, the program
706 When they needed a more flexible language, a new version of @code{roff}
707 called @code{nroff} (``Newer @code{roff}'') was written. It had a much
708 more complicated syntax, but provided the basis for all future versions.
709 When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a
710 version of @code{nroff} that would drive it. It was dubbed
711 @code{troff}, for ``typesetter @code{roff}'', although many people have
712 speculated that it actually means ``Times @code{roff}'' because of the
713 use of the Times font family in @code{troff} by default. As such, the
714 name @code{troff} is pronounced `@w{t-roff}' rather than `trough'.
716 With @code{troff} came @code{nroff} (they were actually the same program
717 except for some @samp{#ifdef}s), which was for producing output for line
718 printers and character terminals. It understood everything @code{troff}
719 did, and ignored the commands that were not applicable (e.g.@: font
722 Since there are several things that cannot be done easily in
723 @code{troff}, work on several preprocessors began. These programs would
724 transform certain parts of a document into @code{troff}, which made a
725 very natural use of pipes in @acronym{UNIX}.
727 The @code{eqn} preprocessor allowed mathematical formulæ to be specified
728 in a much simpler and more intuitive manner. @code{tbl} is a
729 preprocessor for formatting tables. The @code{refer} preprocessor (and
730 the similar program, @code{bib}) processes citations in a document
731 according to a bibliographic database.
733 Unfortunately, Ossanna's @code{troff} was written in @w{PDP-11} assembly
734 language and produced output specifically for the CAT phototypesetter.
735 He rewrote it in C, although it was now 7000@tie{}lines of uncommented
736 code and still dependent on the CAT@. As the CAT became less common, and
737 was no longer supported by the manufacturer, the need to make it support
738 other devices became a priority. However, before this could be done,
739 Ossanna died by a severe heart attack in a hospital while recovering
743 @cindex @code{ditroff}, the program
744 So, Brian Kernighan took on the task of rewriting @code{troff}. The
745 newly rewritten version produced device independent code that was very
746 easy for postprocessors to read and translate to the appropriate printer
747 codes. Also, this new version of @code{troff} (called @code{ditroff}
748 for ``device independent @code{troff}'') had several extensions, which
749 included drawing functions.
751 Due to the additional abilities of the new version of @code{troff},
752 several new preprocessors appeared. The @code{pic} preprocessor
753 provides a wide range of drawing functions. Likewise the @code{ideal}
754 preprocessor did the same, although via a much different paradigm. The
755 @code{grap} preprocessor took specifications for graphs, but, unlike
756 other preprocessors, produced @code{pic} code.
758 James Clark began work on a GNU implementation of @code{ditroff} in
759 early@tie{}1989. The first version, @code{groff}@tie{}0.3.1, was
760 released June@tie{}1990. @code{groff} included:
764 A replacement for @code{ditroff} with many extensions.
767 The @code{soelim}, @code{pic}, @code{tbl}, and @code{eqn} preprocessors.
770 Postprocessors for character devices, @sc{PostScript}, @TeX{} DVI, and
771 X@tie{}Windows. GNU @code{troff} also eliminated the need for a
772 separate @code{nroff} program with a postprocessor that would produce
773 @acronym{ASCII} output.
776 A version of the @file{me} macros and an implementation of the
780 Also, a front-end was included that could construct the, sometimes
781 painfully long, pipelines required for all the post- and preprocessors.
783 Development of GNU @code{troff} progressed rapidly, and saw the
784 additions of a replacement for @code{refer}, an implementation of the
785 @file{ms} and @file{mm} macros, and a program to deduce how to format a
786 document (@code{grog}).
788 It was declared a stable (i.e.@: non-beta) package with the release of
789 version@tie{}1.04 around November@tie{}1991.
791 Beginning in@tie{}1999, @code{groff} has new maintainers (the package
792 was an orphan for a few years). As a result, new features and programs
793 like @code{grn}, a preprocessor for gremlin images, and an output device
794 to produce @acronym{HTML} and @acronym{XHTML} have been added.
797 @c =====================================================================
799 @node groff Capabilities, Macro Package Intro, History, Introduction
800 @section @code{groff} Capabilities
801 @cindex @code{groff} capabilities
802 @cindex capabilities of @code{groff}
804 So what exactly is @code{groff} capable of doing? @code{groff} provides
805 a wide range of low-level text formatting operations. Using these, it
806 is possible to perform a wide range of formatting tasks, such as
807 footnotes, table of contents, multiple columns, etc. Here's a list of
808 the most important operations supported by @code{groff}:
812 text filling, adjusting, and centering
821 font and glyph size control
824 vertical spacing (e.g.@: double-spacing)
827 line length and indenting
830 macros, strings, diversions, and traps
836 tabs, leaders, and fields
839 input and output conventions and character translation
842 overstrike, bracket, line drawing, and zero-width functions
845 local horizontal and vertical motions and the width function
851 output line numbering
854 conditional acceptance of input
857 environment switching
860 insertions from the standard input
863 input/output file switching
866 output and error messages
870 @c =====================================================================
872 @node Macro Package Intro, Preprocessor Intro, groff Capabilities, Introduction
873 @section Macro Packages
874 @cindex macro packages
876 Since @code{groff} provides such low-level facilities, it can be quite
877 difficult to use by itself. However, @code{groff} provides a
878 @dfn{macro} facility to specify how certain routine operations
879 (e.g.@tie{}starting paragraphs, printing headers and footers, etc.)@:
880 should be done. These macros can be collected together into a
881 @dfn{macro package}. There are a number of macro packages available;
882 the most common (and the ones described in this manual) are @file{man},
883 @file{mdoc}, @file{me}, @file{ms}, and @file{mm}.
886 @c =====================================================================
888 @node Preprocessor Intro, Output device intro, Macro Package Intro, Introduction
889 @section Preprocessors
890 @cindex preprocessors
892 Although @code{groff} provides most functions needed to format a
893 document, some operations would be unwieldy (e.g.@: to draw pictures).
894 Therefore, programs called @dfn{preprocessors} were written that
895 understand their own language and produce the necessary @code{groff}
896 operations. These preprocessors are able to differentiate their own
897 input from the rest of the document via markers.
899 To use a preprocessor, @acronym{UNIX} pipes are used to feed the output
900 from the preprocessor into @code{groff}. Any number of preprocessors
901 may be used on a given document; in this case, the preprocessors are
902 linked together into one pipeline. However, with @code{groff}, the user
903 does not need to construct the pipe, but only tell @code{groff} what
904 preprocessors to use.
906 @code{groff} currently has preprocessors for producing tables
907 (@code{tbl}), typesetting equations (@code{eqn}), drawing pictures
908 (@code{pic} and @code{grn}), processing bibliographies
909 (@code{refer}), and drawing chemical structures (@code{chem}). An
910 associated program that is useful when dealing with preprocessors is
913 A free implementation of @code{grap}, a preprocessor for drawing graphs,
914 can be obtained as an extra package; @code{groff} can use @code{grap}
917 Unique to @code{groff} is the @code{preconv} preprocessor that enables
918 @code{groff} to handle documents in various input encodings.
920 There are other preprocessors in existence, but, unfortunately, no free
921 implementations are available. Among them is a preprocessor for drawing
922 mathematical pictures (@code{ideal}).
925 @c =====================================================================
927 @node Output device intro, Credits, Preprocessor Intro, Introduction
928 @section Output Devices
929 @cindex postprocessors
930 @cindex output devices
931 @cindex devices for output
933 @code{groff} actually produces device independent code that may be fed
934 into a postprocessor to produce output for a particular device.
935 Currently, @code{groff} has postprocessors for @sc{PostScript} devices,
936 character terminals, X@tie{}Windows (for previewing), @TeX{} DVI format,
937 HP LaserJet@tie{}4 and Canon LBP printers (which use @acronym{CAPSL}),
938 @acronym{HTML}, @acronym{XHTML}, and PDF.
941 @c =====================================================================
943 @node Credits, , Output device intro, Introduction
947 Large portions of this manual were taken from existing documents, most
948 notably, the manual pages for the @code{groff} package by James Clark,
949 and Eric Allman's papers on the @file{me} macro package.
951 The section on the @file{man} macro package is partly based on
952 Susan@tie{}G.@: Kleinmann's @file{groff_man} manual page written for the
953 Debian GNU/Linux system.
955 Larry Kollar contributed the section in the @file{ms} macro package.
959 @c =====================================================================
960 @c =====================================================================
962 @node Invoking groff, Tutorial for Macro Users, Introduction, Top
963 @chapter Invoking @code{groff}
964 @cindex invoking @code{groff}
965 @cindex @code{groff} invocation
967 This section focuses on how to invoke the @code{groff} front end. This
968 front end takes care of the details of constructing the pipeline among
969 the preprocessors, @code{gtroff} and the postprocessor.
971 It has become a tradition that GNU programs get the prefix @samp{g} to
972 distinguish it from its original counterparts provided by the host (see
973 @ref{Environment}, for more details). Thus, for example, @code{geqn} is
974 GNU @code{eqn}. On operating systems like GNU/Linux or the Hurd, which
975 don't contain proprietary versions of @code{troff}, and on
976 MS-DOS/MS-Windows, where @code{troff} and associated programs are not
977 available at all, this prefix is omitted since GNU @code{troff} is the
978 only used incarnation of @code{troff}. Exception: @samp{groff} is never
979 replaced by @samp{roff}.
981 In this document, we consequently say @samp{gtroff} when talking about
982 the GNU @code{troff} program. All other implementations of @code{troff}
983 are called @acronym{AT&T} @code{troff}, which is the common origin of all
984 @code{troff} derivates (with more or less compatible changes).
985 Similarly, we say @samp{gpic}, @samp{geqn}, etc.
990 * Macro Directories::
993 * Invocation Examples::
997 @c =====================================================================
999 @node Groff Options, Environment, Invoking groff, Invoking groff
1014 @code{groff} normally runs the @code{gtroff} program and a
1015 postprocessor appropriate for the selected device. The default device
1016 is @samp{ps} (but it can be changed when @code{groff} is configured and
1017 built). It can optionally preprocess with any of @code{gpic},
1018 @code{geqn}, @code{gtbl}, @code{ggrn}, @code{grap}, @code{gchem},
1019 @code{grefer}, @code{gsoelim}, or @code{preconv}.
1021 This section only documents options to the @code{groff} front end. Many
1022 of the arguments to @code{groff} are passed on to @code{gtroff},
1023 therefore those are also included. Arguments to pre- or postprocessors
1024 can be found in @ref{Invoking gpic}, @ref{Invoking geqn}, @ref{Invoking
1025 gtbl}, @ref{Invoking ggrn}, @ref{Invoking grefer}, @ref{Invoking gchem},
1026 @ref{Invoking gsoelim}, @ref{Invoking preconv}, @ref{Invoking grotty},
1027 @ref{Invoking grops}, @ref{Invoking gropdf}, @ref{Invoking grohtml},
1028 @ref{Invoking grodvi}, @ref{Invoking grolj4}, @ref{Invoking grolbp}, and
1029 @ref{Invoking gxditview}.
1031 The command line format for @code{groff} is:
1034 groff [ -abceghijklpstvzCEGNRSUVXZ ] [ -d@var{cs} ] [ -D@var{arg} ]
1035 [ -f@var{fam} ] [ -F@var{dir} ] [ -I@var{dir} ] [ -K@var{arg} ]
1036 [ -L@var{arg} ] [ -m@var{name} ] [ -M@var{dir} ] [ -n@var{num} ]
1037 [ -o@var{list} ] [ -P@var{arg} ] [ -r@var{cn} ] [ -T@var{dev} ]
1038 [ -w@var{name} ] [ -W@var{name} ] [ @var{files}@dots{} ]
1041 The command line format for @code{gtroff} is as follows.
1044 gtroff [ -abcivzCERU ] [ -d@var{cs} ] [ -f@var{fam} ] [ -F@var{dir} ]
1045 [ -m@var{name} ] [ -M@var{dir} ] [ -n@var{num} ] [ -o@var{list} ]
1046 [ -r@var{cn} ] [ -T@var{name} ] [ -w@var{name} ] [ -W@var{name} ]
1047 [ @var{files}@dots{} ]
1051 Obviously, many of the options to @code{groff} are actually passed on to
1054 Options without an argument can be grouped behind a
1055 single@tie{}@option{-}. A filename of@tie{}@file{-} denotes the
1056 standard input. It is possible to have whitespace between an option and
1059 The @code{grog} command can be used to guess the correct @code{groff}
1060 command to format a file.
1062 Here's the description of the command-line options:
1064 @cindex command-line options
1067 @cindex @acronym{ASCII} approximation output register (@code{.A})
1068 Generate an @acronym{ASCII} approximation of the typeset output. The
1069 read-only register @code{.A} is then set to@tie{}1. @xref{Built-in
1070 Registers}. A typical example is
1073 groff -a -man -Tdvi troff.man | less
1077 which shows how lines are broken for the DVI device. Note that this
1078 option is rather useless today since graphic output devices are
1079 available virtually everywhere.
1082 Print a backtrace with each warning or error message. This backtrace
1083 should help track down the cause of the error. The line numbers given
1084 in the backtrace may not always be correct: @code{gtroff} can get
1085 confused by @code{as} or @code{am} requests while counting line numbers.
1088 Suppress color output.
1091 Enable compatibility mode. @xref{Implementation Differences}, for the
1092 list of incompatibilities between @code{groff} and @acronym{AT&T}
1095 @item -d@var{c}@var{s}
1096 @itemx -d@var{name}=@var{s}
1097 Define @var{c} or @var{name} to be a string@tie{}@var{s}.
1098 @var{c}@tie{}must be a one-letter name; @var{name} can be of arbitrary
1099 length. All string assignments happen before loading any macro file
1100 (including the start-up file).
1103 Set default input encoding used by @code{preconv} to @var{arg}. Implies
1107 Preprocess with @code{geqn}.
1110 Inhibit all error messages.
1113 Use @var{fam} as the default font family. @xref{Font Families}.
1116 Search @file{@var{dir}} for subdirectories @file{dev@var{name}}
1117 (@var{name} is the name of the device), for the @file{DESC} file, and
1118 for font files before looking in the standard directories (@pxref{Font
1119 Directories}). This option is passed to all pre- and postprocessors
1120 using the @env{GROFF_FONT_PATH} environment variable.
1123 Preprocess with @code{ggrn}.
1126 Preprocess with @code{grap}. Implies @option{-p}.
1129 Print a help message.
1132 Read the standard input after all the named input files have been
1136 This option may be used to specify a directory to search for files.
1137 It is passed to the following programs:
1141 @code{gsoelim} (see @ref{gsoelim} for more details);
1142 it also implies @code{groff}'s @option{-s} option.
1145 @code{gtroff}; it is used to search files named in the @code{psbb} and
1149 @code{grops}; it is used to search files named in the
1150 @w{@code{\X'ps: import}} and @w{@code{\X'ps: file}} escapes.
1153 The current directory is always searched first. This option may be
1154 specified more than once; the directories are searched in the order
1155 specified. No directory search is performed for files specified using
1159 Preprocess with @code{gchem}. Implies @option{-p}.
1162 Preprocess with @code{preconv}. This is run before any other
1163 preprocessor. Please refer to @code{preconv}'s manual page for its
1164 behaviour if no @option{-K} (or @option{-D}) option is specified.
1167 Set input encoding used by preconv to @var{arg}. Implies @option{-k}.
1170 Send the output to a spooler for printing. The command used for this is
1171 specified by the @code{print} command in the device description file
1172 (see @ref{Font Files}, for more info). If not present, @option{-l} is
1176 Pass @var{arg} to the spooler. Each argument should be passed with a
1177 separate @option{-L} option. Note that @code{groff} does not prepend a
1178 @samp{-} to @var{arg} before passing it to the postprocessor. If the
1179 @code{print} keyword in the device description file is missing,
1180 @option{-L} is ignored.
1183 Read in the file @file{@var{name}.tmac}. Normally @code{groff} searches
1184 for this in its macro directories. If it isn't found, it tries
1185 @file{tmac.@var{name}} (searching in the same directories).
1188 Search directory @file{@var{dir}} for macro files before the standard
1189 directories (@pxref{Macro Directories}).
1192 Number the first page @var{num}.
1195 Don't allow newlines with @code{eqn} delimiters. This is the same as
1196 the @option{-N} option in @code{geqn}.
1199 @cindex print current page register (@code{.P})
1200 Output only pages in @var{list}, which is a comma-separated list of page
1201 ranges; @samp{@var{n}} means print page@tie{}@var{n},
1202 @samp{@var{m}-@var{n}} means print every page between @var{m}
1203 and@tie{}@var{n}, @samp{-@var{n}} means print every page up
1204 to@tie{}@var{n}, @samp{@var{n}-} means print every page beginning
1205 with@tie{}@var{n}. @code{gtroff} exits after printing the last page in
1206 the list. All the ranges are inclusive on both ends.
1208 Within @code{gtroff}, this information can be extracted with the
1209 @samp{.P} register. @xref{Built-in Registers}.
1211 If your document restarts page numbering at the beginning of each
1212 chapter, then @code{gtroff} prints the specified page range for each
1216 Preprocess with @code{gpic}.
1219 Pass @var{arg} to the postprocessor. Each argument should be passed
1220 with a separate @option{-P} option. Note that @code{groff} does not
1221 prepend @samp{-} to @var{arg} before passing it to the postprocessor.
1223 @item -r@var{c}@var{n}
1224 @itemx -r@var{name}=@var{n}
1225 Set number register@tie{}@var{c} or @var{name} to the
1226 value@tie{}@var{n}. @var{c}@tie{}must be a one-letter name; @var{name}
1227 can be of arbitrary length. @var{n}@tie{}can be any @code{gtroff}
1228 numeric expression. All register assignments happen before loading any
1229 macro file (including the start-up file).
1232 Preprocess with @code{grefer}. No mechanism is provided for passing
1233 arguments to @code{grefer} because most @code{grefer} options have
1234 equivalent commands that can be included in the file. @xref{grefer},
1239 Note that @code{gtroff} also accepts a @option{-R} option, which is not
1240 accessible via @code{groff}. This option prevents the loading of the
1241 @file{troffrc} and @file{troffrc-end} files.
1244 Preprocess with @code{gsoelim}.
1247 @cindex @code{open} request, and safer mode
1248 @cindex @code{opena} request, and safer mode
1249 @cindex @code{pso} request, and safer mode
1250 @cindex @code{sy} request, and safer mode
1251 @cindex @code{pi} request, and safer mode
1254 Safer mode. Pass the @option{-S} option to @code{gpic} and disable the
1255 @code{open}, @code{opena}, @code{pso}, @code{sy}, and @code{pi}
1256 requests. For security reasons, this is enabled by default.
1259 Preprocess with @code{gtbl}.
1262 Prepare output for device @var{dev}. The default device is @samp{ps},
1263 unless changed when @code{groff} was configured and built. The
1264 following are the output devices currently available:
1268 For @sc{PostScript} printers and previewers.
1271 For PDF viewers or printers.
1274 For @TeX{} DVI format.
1277 For a 75@dmn{dpi} X11 previewer.
1280 For a 75@dmn{dpi} X11 previewer with a 12@dmn{pt} base font in the
1284 For a 100@dmn{dpi} X11 previewer.
1287 For a 100@dmn{dpi} X11 previewer with a 12@dmn{pt} base font in the
1291 @cindex encoding, output, @acronym{ASCII}
1292 @cindex @acronym{ASCII}, output encoding
1293 @cindex output encoding, @acronym{ASCII}
1294 For typewriter-like devices using the (7-bit) @acronym{ASCII}
1298 @cindex encoding, output, @w{latin-1} (ISO @w{8859-1})
1299 @cindex @w{latin-1} (ISO @w{8859-1}), output encoding
1300 @cindex ISO @w{8859-1} (@w{latin-1}), output encoding
1301 @cindex output encoding, @w{latin-1} (ISO @w{8859-1})
1302 For typewriter-like devices that support the @w{Latin-1}
1303 (ISO@tie{}@w{8859-1}) character set.
1306 @cindex encoding, output, @w{utf-8}
1307 @cindex @w{utf-8}, output encoding
1308 @cindex output encoding, @w{utf-8}
1309 For typewriter-like devices that use the Unicode (ISO@tie{}10646)
1310 character set with @w{UTF-8} encoding.
1313 @cindex encoding, output, @acronym{EBCDIC}
1314 @cindex @acronym{EBCDIC}, output encoding
1315 @cindex output encoding, @acronym{EBCDIC}
1316 @cindex encoding, output, cp1047
1317 @cindex cp1047, output encoding
1318 @cindex output encoding, cp1047
1319 @cindex IBM cp1047 output encoding
1320 For typewriter-like devices that use the @acronym{EBCDIC} encoding IBM
1324 For HP LaserJet4-compatible (or other PCL5-compatible) printers.
1327 For Canon @acronym{CAPSL} printers (@w{LBP-4} and @w{LBP-8} series laser
1331 @pindex post-grohtml
1332 @cindex @code{grohtml}, the program
1335 To produce @acronym{HTML} and @acronym{XHTML} output, respectively.
1336 Note that this driver consists of two parts, a preprocessor
1337 (@code{pre-grohtml}) and a postprocessor (@code{post-grohtml}).
1340 @cindex output device name string register (@code{.T})
1341 @cindex output device usage number register (@code{.T})
1342 The predefined @code{gtroff} string register @code{.T} contains the
1343 current output device; the read-only number register @code{.T} is set
1344 to@tie{}1 if this option is used (which is always true if @code{groff}
1345 is used to call @code{gtroff}). @xref{Built-in Registers}.
1347 The postprocessor to be used for a device is specified by the
1348 @code{postpro} command in the device description file. (@xref{Font
1349 Files}, for more info.) This can be overridden with the @option{-X}
1353 @cindex mode, unsafe
1355 Unsafe mode. This enables the @code{open}, @code{opena}, @code{pso},
1356 @code{sy}, and @code{pi} requests.
1359 Enable warning @var{name}. Available warnings are described in
1360 @ref{Debugging}. Multiple @option{-w} options are allowed.
1363 Inhibit warning @var{name}. Multiple @option{-W} options are allowed.
1366 Make programs run by @code{groff} print out their version number.
1369 Print the pipeline on @code{stdout} instead of executing it. If
1370 specified more than once, print the pipeline on @code{stderr} and
1374 Preview with @code{gxditview} instead of using the usual postprocessor.
1375 This is unlikely to produce good results except with @option{-Tps}.
1377 Note that this is not the same as using @option{-TX75} or
1378 @option{-TX100} to view a document with @code{gxditview}: The former
1379 uses the metrics of the specified device, whereas the latter uses
1380 X-specific fonts and metrics.
1383 Suppress output from @code{gtroff}. Only error messages are printed.
1386 Do not postprocess the output of @code{gtroff}. Normally @code{groff}
1387 automatically runs the appropriate postprocessor.
1391 @c =====================================================================
1393 @node Environment, Macro Directories, Groff Options, Invoking groff
1394 @section Environment
1395 @cindex environment variables
1396 @cindex variables in environment
1398 There are also several environment variables (of the operating system,
1399 not within @code{gtroff}) that can modify the behavior of @code{groff}.
1402 @item GROFF_BIN_PATH
1403 @tindex GROFF_BIN_PATH@r{, environment variable}
1404 This search path, followed by @code{PATH}, is used for commands executed
1407 @item GROFF_COMMAND_PREFIX
1408 @tindex GROFF_COMMAND_PREFIX@r{, environment variable}
1409 @cindex command prefix
1410 @cindex prefix, for commands
1411 If this is set to@tie{}@var{X}, then @code{groff} runs
1412 @code{@var{X}troff} instead of @code{gtroff}. This also applies to
1413 @code{tbl}, @code{pic}, @code{eqn}, @code{grn}, @code{chem},
1414 @code{refer}, and @code{soelim}. It does not apply to @code{grops},
1415 @code{grodvi}, @code{grotty}, @code{pre-grohtml}, @code{post-grohtml},
1416 @code{preconv}, @code{grolj4}, @code{gropdf}, and @code{gxditview}.
1418 The default command prefix is determined during the installation
1419 process. If a non-GNU troff system is found, prefix @samp{g} is used,
1422 @item GROFF_ENCODING
1423 @tindex GROFF_ENCODING@r{, environment variable}
1424 The value of this environment value is passed to the @code{preconv}
1425 preprocessor to select the encoding of input files. Setting this option
1426 implies @code{groff}'s command line option @option{-k} (this is,
1427 @code{groff} actually always calls @code{preconv}). If set without a
1428 value, @code{groff} calls @code{preconv} without arguments. An explicit
1429 @option{-K} command line option overrides the value of
1430 @env{GROFF_ENCODING}. See the manual page of @code{preconv} for details.
1432 @item GROFF_FONT_PATH
1433 @tindex GROFF_FONT_PATH@r{, environment variable}
1434 A colon-separated list of directories in which to search for the
1435 @code{dev}@var{name} directory (before the default directories are
1436 tried). @xref{Font Directories}.
1438 @item GROFF_TMAC_PATH
1439 @tindex GROFF_TMAC_PATH@r{, environment variable}
1440 A colon-separated list of directories in which to search for macro files
1441 (before the default directories are tried). @xref{Macro Directories}.
1444 @tindex GROFF_TMPDIR@r{, environment variable}
1445 @tindex TMPDIR@r{, environment variable}
1446 The directory in which @code{groff} creates temporary files. If this is
1447 not set and @env{TMPDIR} is set, temporary files are created in that
1448 directory. Otherwise temporary files are created in a system-dependent
1449 default directory (on Unix and GNU/Linux systems, this is usually
1450 @file{/tmp}). @code{grops}, @code{grefer}, @code{pre-grohtml}, and
1451 @code{post-grohtml} can create temporary files in this directory.
1453 @item GROFF_TYPESETTER
1454 @tindex GROFF_TYPESETTER@r{, environment variable}
1455 The default output device.
1458 Note that MS-DOS and MS-Windows ports of @code{groff} use semi-colons,
1459 rather than colons, to separate the directories in the lists described
1463 @c =====================================================================
1465 @node Macro Directories, Font Directories, Environment, Invoking groff
1466 @section Macro Directories
1467 @cindex macro directories
1468 @cindex directories for macros
1469 @cindex searching macros
1470 @cindex macros, searching
1472 All macro file names must be named @code{@var{name}.tmac} or
1473 @code{tmac.@var{name}} to make the @option{-m@var{name}} command line
1474 option work. The @code{mso} request doesn't have this restriction; any
1475 file name can be used, and @code{gtroff} won't try to append or prepend
1476 the @samp{tmac} string.
1478 @cindex tmac, directory
1479 @cindex directory, for tmac files
1481 @cindex path, for tmac files
1482 @cindex searching macro files
1483 @cindex macro files, searching
1484 @cindex files, macro, searching
1485 Macro files are kept in the @dfn{tmac directories}, all of which
1486 constitute the @dfn{tmac path}. The elements of the search path for
1487 macro files are (in that order):
1491 The directories specified with @code{gtroff}'s or @code{groff}'s
1492 @option{-M} command line option.
1495 @tindex GROFF_TMAC_PATH@r{, environment variable}
1496 The directories given in the @env{GROFF_TMAC_PATH} environment variable.
1502 @cindex mode, unsafe
1503 @cindex current directory
1504 @cindex directory, current
1505 The current directory (only if in unsafe mode using the @option{-U}
1506 command line switch).
1509 @cindex home directory
1510 @cindex directory, home
1514 @cindex site-specific directory
1515 @cindex directory, site-specific
1516 @cindex platform-specific directory
1517 @cindex directory, platform-specific
1518 A platform-dependent directory, a site-specific (platform-independent)
1519 directory, and the main tmac directory; the default locations are
1522 /usr/local/lib/groff/site-tmac
1523 /usr/local/share/groff/site-tmac
1524 /usr/local/share/groff/1.22.3/tmac
1528 assuming that the version of @code{groff} is 1.22.3, and the
1529 installation prefix was @file{/usr/local}. It is possible to fine-tune
1530 those directories during the installation process.
1534 @c =====================================================================
1536 @node Font Directories, Paper Size, Macro Directories, Invoking groff
1537 @section Font Directories
1538 @cindex font directories
1539 @cindex directories for fonts
1540 @cindex searching fonts
1541 @cindex fonts, searching
1543 Basically, there is no restriction how font files for @code{groff} are
1544 named and how long font names are; however, to make the font family
1545 mechanism work (@pxref{Font Families}), fonts within a family should
1546 start with the family name, followed by the shape. For example, the
1547 Times family uses @samp{T} for the family name and @samp{R}, @samp{B},
1548 @samp{I}, and @samp{BI} to indicate the shapes `roman', `bold',
1549 `italic', and `bold italic', respectively. Thus the final font names
1550 are @samp{TR}, @samp{TB}, @samp{TI}, and @samp{TBI}.
1553 @cindex path, for font files
1554 All font files are kept in the @dfn{font directories}, which constitute
1555 the @dfn{font path}. The file search functions always append the
1556 directory @code{dev}@var{name}, where @var{name} is the name of the
1557 output device. Assuming, say, DVI output, and @file{/foo/bar} as a font
1558 directory, the font files for @code{grodvi} must be in
1559 @file{/foo/bar/devdvi}.
1561 The elements of the search path for font files are (in that order):
1565 The directories specified with @code{gtroff}'s or @code{groff}'s
1566 @option{-F} command line option. All device drivers and some
1567 preprocessors also have this option.
1570 @tindex GROFF_FONT_PATH@r{, environment variable}
1571 The directories given in the @env{GROFF_FONT_PATH} environment variable.
1574 @cindex site-specific directory
1575 @cindex directory, site-specific
1576 A site-specific directory and the main font directory; the default
1580 /usr/local/share/groff/site-font
1581 /usr/local/share/groff/1.22.3/font
1585 assuming that the version of @code{groff} is 1.22.3, and the
1586 installation prefix was @file{/usr/local}. It is possible to fine-tune
1587 those directories during the installation process.
1591 @c =====================================================================
1593 @node Paper Size, Invocation Examples, Font Directories, Invoking groff
1597 @cindex landscape page orientation
1598 @cindex orientation, landscape
1599 @cindex page orientation, landscape
1601 In groff, the page size for @code{gtroff} and for output devices are
1602 handled separately. @xref{Page Layout}, for vertical manipulation of
1603 the page size. @xref{Line Layout}, for horizontal changes.
1605 A default paper size can be set in the device's @file{DESC} file. Most
1606 output devices also have a command line option @option{-p} to override
1607 the default paper size and option @option{-l} to use landscape
1608 orientation. @xref{DESC File Format}, for a description of the
1609 @code{papersize} keyword, which takes the same argument as @option{-p}.
1611 @pindex papersize.tmac
1613 A convenient shorthand to set a particular paper size for @code{gtroff}
1614 is command line option @option{-dpaper=@var{size}}. This defines string
1615 @code{paper}, which is processed in file @file{papersize.tmac} (loaded in
1616 the start-up file @file{troffrc} by default). Possible values for
1617 @var{size} are the same as the predefined values for the
1618 @code{papersize} keyword (but only in lowercase) except
1619 @code{a7}-@code{d7}. An appended @samp{l} (ell) character denotes
1620 landscape orientation.
1622 For example, use the following for PS output on A4 paper in landscape
1626 groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
1629 Note that it is up to the particular macro package to respect default
1630 page dimensions set in this way (most do).
1633 @c =====================================================================
1635 @node Invocation Examples, , Paper Size, Invoking groff
1636 @section Invocation Examples
1637 @cindex invocation examples
1638 @cindex examples of invocation
1640 This section lists several common uses of @code{groff} and the
1641 corresponding command lines.
1648 This command processes @file{file} without a macro package or a
1649 preprocessor. The output device is the default, @samp{ps}, and the
1650 output is sent to @code{stdout}.
1653 groff -t -mandoc -Tascii file | less
1657 This is basically what a call to the @code{man} program does.
1658 @code{gtroff} processes the manual page @file{file} with the
1659 @file{mandoc} macro file (which in turn either calls the @file{man} or
1660 the @file{mdoc} macro package), using the @code{tbl} preprocessor and
1661 the @acronym{ASCII} output device. Finally, the @code{less} pager
1662 displays the result.
1669 Preview @file{file} with @code{gxditview}, using the @file{me} macro
1670 package. Since no @option{-T} option is specified, use the default
1671 device (@samp{ps}). Note that you can either say @w{@samp{-m me}} or
1672 @w{@samp{-me}}; the latter is an anachronism from the early days of
1673 @acronym{UNIX}.@footnote{The same is true for the other main macro
1674 packages that come with @code{groff}: @file{man}, @file{mdoc},
1675 @file{ms}, @file{mm}, and @file{mandoc}. This won't work in general;
1676 for example, to load @file{trace.tmac}, either @samp{-mtrace} or
1677 @w{@samp{-m trace}} must be used.}
1680 groff -man -rD1 -z file
1684 Check @file{file} with the @file{man} macro package, forcing
1685 double-sided printing -- don't produce any output.
1691 @c ---------------------------------------------------------------------
1693 @node grog, , Invocation Examples, Invocation Examples
1694 @subsection @code{grog}
1697 @code{grog} reads files, guesses which of the @code{groff} preprocessors
1698 and/or macro packages are required for formatting them, and prints the
1699 @code{groff} command including those options on the standard output. It
1700 generates one or more of the options @option{-e}, @option{-man},
1701 @option{-me}, @option{-mm}, @option{-mom}, @option{-ms}, @option{-mdoc},
1702 @option{-mdoc-old}, @option{-p}, @option{-R}, @option{-g}, @option{-G},
1703 @option{-s}, and @option{-t}.
1705 A special file name@tie{}@file{-} refers to the standard input.
1706 Specifying no files also means to read the standard input. Any
1707 specified options are included in the printed command. No space is
1708 allowed between options and their arguments. The only options
1709 recognized are @option{-C} (which is also passed on) to enable
1710 compatibility mode, and @option{-v} to print the version number and
1720 guesses the appropriate command to print @file{paper.ms} and then prints
1721 it to the command line after adding the @option{-Tdvi} option. For
1722 direct execution, enclose the call to @code{grog} in backquotes at the
1723 @acronym{UNIX} shell prompt:
1726 `grog -Tdvi paper.ms` > paper.dvi
1730 As seen in the example, it is still necessary to redirect the output to
1731 something meaningful (i.e.@: either a file or a pager program like
1736 @c =====================================================================
1737 @c =====================================================================
1739 @node Tutorial for Macro Users, Macro Packages, Invoking groff, Top
1740 @chapter Tutorial for Macro Users
1741 @cindex tutorial for macro users
1742 @cindex macros, tutorial for users
1743 @cindex user's tutorial for macros
1744 @cindex user's macro tutorial
1746 Most users tend to use a macro package to format their papers. This
1747 means that the whole breadth of @code{groff} is not necessary for most
1748 people. This chapter covers the material needed to efficiently use a
1757 @c =====================================================================
1759 @node Basics, Common Features, Tutorial for Macro Users, Tutorial for Macro Users
1761 @cindex basics of macros
1762 @cindex macro basics
1764 This section covers some of the basic concepts necessary to understand
1765 how to use a macro package.@footnote{This section is derived from
1766 @cite{Writing Papers with nroff using -me} by Eric P.@tie{}Allman.}
1767 References are made throughout to more detailed information, if desired.
1769 @code{gtroff} reads an input file prepared by the user and outputs a
1770 formatted document suitable for publication or framing. The input
1771 consists of text, or words to be printed, and embedded commands
1772 (@dfn{requests} and @dfn{escapes}), which tell @code{gtroff} how to
1773 format the output. For more detail on this, see @ref{Embedded
1776 The word @dfn{argument} is used in this chapter to mean a word or number
1777 that appears on the same line as a request, and which modifies the
1778 meaning of that request. For example, the request
1785 spaces one line, but
1792 spaces four lines. The number@tie{}4 is an argument to the @code{sp}
1793 request, which says to space four lines instead of one. Arguments are
1794 separated from the request and from each other by spaces (@emph{no}
1795 tabs). More details on this can be found in @ref{Request and Macro
1798 The primary function of @code{gtroff} is to collect words from input
1799 lines, fill output lines with those words, justify the right-hand margin
1800 by inserting extra spaces in the line, and output the result. For
1808 Four score and seven
1813 is read, packed onto output lines, and justified to produce:
1816 Now is the time for all good men to come to the aid of their party.
1817 Four score and seven years ago, etc.
1822 Sometimes a new output line should be started even though the current
1823 line is not yet full; for example, at the end of a paragraph. To do
1824 this it is possible to cause a @dfn{break}, which starts a new output
1825 line. Some requests cause a break automatically, as normally do blank
1826 input lines and input lines beginning with a space.
1828 Not all input lines are text to be formatted. Some input lines are
1829 requests that describe how to format the text. Requests always have a
1830 period (@samp{.}) or an apostrophe (@samp{'}) as the first character of
1833 The text formatter also does more complex things, such as automatically
1834 numbering pages, skipping over page boundaries, putting footnotes in the
1835 correct place, and so forth.
1837 Here are a few hints for preparing text for input to @code{gtroff}.
1841 First, keep the input lines short. Short input lines are easier to
1842 edit, and @code{gtroff} packs words onto longer lines anyhow.
1845 In keeping with this, it is helpful to begin a new line after every
1846 comma or phrase, since common corrections are to add or delete sentences
1850 End each sentence with two spaces -- or better, start each sentence on a
1851 new line. @code{gtroff} recognizes characters that usually end a
1852 sentence, and inserts sentence space accordingly.
1855 Do not hyphenate words at the end of lines -- @code{gtroff} is smart
1856 enough to hyphenate words as needed, but is not smart enough to take
1857 hyphens out and join a word back together. Also, words such as
1858 ``mother-in-law'' should not be broken over a line, since then a space
1859 can occur where not wanted, such as ``@w{mother- in}-law''.
1862 @cindex double-spacing (@code{ls})
1864 @code{gtroff} double-spaces output text automatically if you use the
1865 request @w{@samp{.ls 2}}. Reactivate single-spaced mode by typing
1866 @w{@samp{.ls 1}}.@footnote{If you need finer granularity of the vertical
1867 space, use the @code{pvs} request (@pxref{Changing Type Sizes}).}
1869 A number of requests allow to change the way the output looks, sometimes
1870 called the @dfn{layout} of the output page. Most of these requests
1871 adjust the placing of @dfn{whitespace} (blank lines or spaces).
1873 @cindex new page (@code{bp})
1874 The @code{bp} request starts a new page, causing a line break.
1876 @cindex blank line (@code{sp})
1877 @cindex empty line (@code{sp})
1878 @cindex line, empty (@code{sp})
1879 The request @w{@samp{.sp @var{N}}} leaves @var{N}@tie{}lines of blank
1880 space. @var{N}@tie{}can be omitted (meaning skip a single line) or can
1881 be of the form @var{N}i (for @var{N}@tie{}inches) or @var{N}c (for
1882 @var{N}@tie{}centimeters). For example, the input:
1886 My thoughts on the subject
1891 leaves one and a half inches of space, followed by the line ``My
1892 thoughts on the subject'', followed by a single blank line (more
1893 measurement units are available, see @ref{Measurements}).
1895 @cindex centering lines (@code{ce})
1896 @cindex lines, centering (@code{ce})
1897 Text lines can be centered by using the @code{ce} request. The line
1898 after @code{ce} is centered (horizontally) on the page. To center more
1899 than one line, use @w{@samp{.ce @var{N}}} (where @var{N} is the number
1900 of lines to center), followed by the @var{N}@tie{}lines. To center many
1901 lines without counting them, type:
1910 The @w{@samp{.ce 0}} request tells @code{groff} to center zero more
1911 lines, in other words, stop centering.
1913 @cindex line break (@code{br})
1914 @cindex break (@code{br})
1915 All of these requests cause a break; that is, they always start a new
1916 line. To start a new line without performing any other action, use
1920 @c =====================================================================
1922 @node Common Features, , Basics, Tutorial for Macro Users
1923 @section Common Features
1924 @cindex common features
1925 @cindex features, common
1927 @code{gtroff} provides very low-level operations for formatting a
1928 document. There are many common routine operations that are done in
1929 all documents. These common operations are written into @dfn{macros}
1930 and collected into a @dfn{macro package}.
1932 All macro packages provide certain common capabilities that fall into
1933 the following categories.
1937 * Sections and Chapters::
1938 * Headers and Footers::
1939 * Page Layout Adjustment::
1941 * Footnotes and Annotations::
1942 * Table of Contents::
1945 * Multiple Columns::
1946 * Font and Size Changes::
1947 * Predefined Strings::
1948 * Preprocessor Support::
1949 * Configuration and Customization::
1952 @c ---------------------------------------------------------------------
1954 @node Paragraphs, Sections and Chapters, Common Features, Common Features
1955 @subsection Paragraphs
1958 One of the most common and most used capability is starting a paragraph.
1959 There are a number of different types of paragraphs, any of which can be
1960 initiated with macros supplied by the macro package. Normally,
1961 paragraphs start with a blank line and the first line indented, like the
1962 text in this manual. There are also block style paragraphs, which omit
1966 Some men look at constitutions with sanctimonious
1967 reverence, and deem them like the ark of the covenant, too
1968 sacred to be touched.
1972 And there are also indented paragraphs, which begin with a tag or label
1973 at the margin and the remaining text indented.
1976 one This is the first paragraph. Notice how the first
1977 line of the resulting paragraph lines up with the
1978 other lines in the paragraph.
1983 This paragraph had a long label. The first
1984 character of text on the first line does not line up
1985 with the text on second and subsequent lines,
1986 although they line up with each other.
1989 A variation of this is a bulleted list.
1992 . Bulleted lists start with a bullet. It is possible
1993 to use other glyphs instead of the bullet. In nroff
1994 mode using the ASCII character set for output, a dot
1995 is used instead of a real bullet.
1998 @c ---------------------------------------------------------------------
2000 @node Sections and Chapters, Headers and Footers, Paragraphs, Common Features
2001 @subsection Sections and Chapters
2003 Most macro packages supply some form of section headers. The simplest
2004 kind is simply the heading on a line by itself in bold type. Others
2005 supply automatically numbered section heading or different heading
2006 styles at different levels. Some, more sophisticated, macro packages
2007 supply macros for starting chapters and appendices.
2009 @c ---------------------------------------------------------------------
2011 @node Headers and Footers, Page Layout Adjustment, Sections and Chapters, Common Features
2012 @subsection Headers and Footers
2014 Every macro package gives some way to manipulate the @dfn{headers} and
2015 @dfn{footers} (also called @dfn{titles}) on each page. This is text put
2016 at the top and bottom of each page, respectively, which contain data
2017 like the current page number, the current chapter title, and so on. Its
2018 appearance is not affected by the running text. Some packages allow for
2019 different ones on the even and odd pages (for material printed in a book
2022 The titles are called @dfn{three-part titles}, that is, there is a
2023 left-justified part, a centered part, and a right-justified part. An
2024 automatically generated page number may be put in any of these fields
2025 with the @samp{%} character (see @ref{Page Layout}, for more details).
2027 @c ---------------------------------------------------------------------
2029 @node Page Layout Adjustment, Displays, Headers and Footers, Common Features
2030 @subsection Page Layout
2032 Most macro packages let the user specify top and bottom margins and
2033 other details about the appearance of the printed pages.
2035 @c ---------------------------------------------------------------------
2037 @node Displays, Footnotes and Annotations, Page Layout Adjustment, Common Features
2038 @subsection Displays
2041 @dfn{Displays} are sections of text to be set off from the body of the
2042 paper. Major quotes, tables, and figures are types of displays, as are
2043 all the examples used in this document.
2045 @cindex quotes, major
2046 @cindex major quotes
2047 @dfn{Major quotes} are quotes that are several lines long, and hence
2048 are set in from the rest of the text without quote marks around them.
2051 A @dfn{list} is an indented, single-spaced, unfilled display. Lists
2052 should be used when the material to be printed should not be filled and
2053 justified like normal text, such as columns of figures or the examples
2057 A @dfn{keep} is a display of lines that are kept on a single page if
2058 possible. An example for a keep might be a diagram. Keeps differ from
2059 lists in that lists may be broken over a page boundary whereas keeps are
2062 @cindex keep, floating
2063 @cindex floating keep
2064 @dfn{Floating keeps} move relative to the text. Hence, they are good
2065 for things that are referred to by name, such as ``See figure@tie{}3''.
2066 A floating keep appears at the bottom of the current page if it fits;
2067 otherwise, it appears at the top of the next page. Meanwhile, the
2068 surrounding text `flows' around the keep, thus leaving no blank areas.
2070 @c ---------------------------------------------------------------------
2072 @node Footnotes and Annotations, Table of Contents, Displays, Common Features
2073 @subsection Footnotes and Annotations
2077 There are a number of requests to save text for later printing.
2079 @dfn{Footnotes} are printed at the bottom of the current page.
2081 @cindex delayed text
2082 @dfn{Delayed text} is very similar to a footnote except that it is
2083 printed when called for explicitly. This allows a list of references to
2084 appear (for example) at the end of each chapter, as is the convention in
2087 Most macro packages that supply this functionality also supply a means
2088 of automatically numbering either type of annotation.
2090 @c ---------------------------------------------------------------------
2092 @node Table of Contents, Indices, Footnotes and Annotations, Common Features
2093 @subsection Table of Contents
2094 @cindex table of contents
2095 @cindex contents, table of
2097 @dfn{Tables of contents} are a type of delayed text having a tag
2098 (usually the page number) attached to each entry after a row of dots.
2099 The table accumulates throughout the paper until printed, usually after
2100 the paper has ended. Many macro packages provide the ability to have
2101 several tables of contents (e.g.@: a standard table of contents, a list
2104 @c ---------------------------------------------------------------------
2106 @node Indices, Paper Formats, Table of Contents, Common Features
2108 @cindex index, in macro package
2110 While some macro packages use the term @dfn{index}, none actually
2111 provide that functionality. The facilities they call indices are
2112 actually more appropriate for tables of contents.
2115 To produce a real index in a document, external tools like the
2116 @code{makeindex} program are necessary.
2118 @c ---------------------------------------------------------------------
2120 @node Paper Formats, Multiple Columns, Indices, Common Features
2121 @subsection Paper Formats
2122 @cindex paper formats
2124 Some macro packages provide stock formats for various kinds of
2125 documents. Many of them provide a common format for the title and
2126 opening pages of a technical paper. The @file{mm} macros in particular
2127 provide formats for letters and memoranda.
2129 @c ---------------------------------------------------------------------
2131 @node Multiple Columns, Font and Size Changes, Paper Formats, Common Features
2132 @subsection Multiple Columns
2134 Some macro packages (but not @file{man}) provide the ability to have two
2135 or more columns on a page.
2137 @c ---------------------------------------------------------------------
2139 @node Font and Size Changes, Predefined Strings, Multiple Columns, Common Features
2140 @subsection Font and Size Changes
2142 The built-in font and size functions are not always intuitive, so all
2143 macro packages provide macros to make these operations simpler.
2145 @c ---------------------------------------------------------------------
2147 @node Predefined Strings, Preprocessor Support, Font and Size Changes, Common Features
2148 @subsection Predefined Strings
2150 Most macro packages provide various predefined strings for a variety of
2151 uses; examples are sub- and superscripts, printable dates, quotes and
2152 various special characters.
2154 @c ---------------------------------------------------------------------
2156 @node Preprocessor Support, Configuration and Customization, Predefined Strings, Common Features
2157 @subsection Preprocessor Support
2159 All macro packages provide support for various preprocessors and may
2160 extend their functionality.
2162 For example, all macro packages mark tables (which are processed with
2163 @code{gtbl}) by placing them between @code{TS} and @code{TE} macros.
2164 The @file{ms} macro package has an option, @samp{.TS@tie{}H}, that
2165 prints a caption at the top of a new page (when the table is too long to
2166 fit on a single page).
2168 @c ---------------------------------------------------------------------
2170 @node Configuration and Customization, , Preprocessor Support, Common Features
2171 @subsection Configuration and Customization
2173 Some macro packages provide means of customizing many of the details of
2174 how the package behaves. This ranges from setting the default type size
2175 to changing the appearance of section headers.
2179 @c =====================================================================
2180 @c =====================================================================
2182 @node Macro Packages, gtroff Reference, Tutorial for Macro Users, Top
2183 @chapter Macro Packages
2184 @cindex macro packages
2185 @cindex packages, macros
2187 This chapter documents the main macro packages that come with
2190 Different main macro packages can't be used at the same time; for
2194 groff -m man foo.man -m ms bar.doc
2198 doesn't work. Note that option arguments are processed before
2199 non-option arguments; the above (failing) sample is thus reordered to
2202 groff -m man -m ms foo.man bar.doc
2215 @c =====================================================================
2217 @node man, mdoc, Macro Packages, Macro Packages
2219 @cindex manual pages
2223 @pindex man-old.tmac
2225 This is the most popular and probably the most important macro package
2226 of @code{groff}. It is easy to use, and a vast majority of manual pages
2233 * Miscellaneous man macros::
2234 * Predefined man strings::
2235 * Preprocessors in man pages::
2236 * Optional man extensions::
2239 @c ---------------------------------------------------------------------
2241 @node Man options, Man usage, man, man
2244 The command line format for using the @file{man} macros with
2248 groff -m man [ -rLL=@var{length} ] [ -rLT=@var{length} ] [ -rFT=@var{dist} ]
2249 [ -rcR=1 ] [ -rC1 ] [ -rD1 ] [-rHY=@var{flags} ]
2250 [ -rP@var{nnn} ] [ -rS@var{xx} ] [ -rX@var{nnn} ]
2251 [ -rIN=@var{length} ] [ -rSN=@var{length} ] [ @var{files}@dots{} ]
2255 It is possible to use @samp{-man} instead of @w{@samp{-m man}}.
2259 This option (the default if a TTY output device is used) creates a
2260 single, very long page instead of multiple pages. Use @code{-rcR=0} to
2264 If more than one manual page is given on the command line, number the
2265 pages continuously, rather than starting each at@tie{}1.
2268 Double-sided printing. Footers for even and odd pages are formatted
2271 @item -rFT=@var{dist}
2272 Set the position of the footer text to @var{dist}. If positive, the
2273 distance is measured relative to the top of the page, otherwise it is
2274 relative to the bottom. The default is @minus{}0.5@dmn{i}.
2276 @item -rHY=@var{flags}
2277 Set hyphenation flags. Possible values are 1@tie{}to hyphenate without
2278 restrictions, 2@tie{}to not hyphenate the last word on a page, 4@tie{}to
2279 not hyphenate the last two characters of a word, and 8@tie{}to not
2280 hyphenate the first two characters of a word. These values are
2281 additive; the default is@tie{}14.
2283 @item -rIN=@var{length}
2284 Set the body text indentation to @var{length}. If not specified, the
2285 indentation defaults to 7@dmn{n} (7@tie{}characters) in nroff mode and
2286 7.2@dmn{n} otherwise. For nroff, this value should always be an integer
2287 multiple of unit @samp{n} to get consistent indentation.
2289 @item -rLL=@var{length}
2290 Set line length to @var{length}. If not specified, the line length is
2291 set to respect any value set by a prior @samp{ll} request (which
2292 @emph{must} be in effect when the @samp{TH} macro is invoked), if this
2293 differs from the built-in default for the formatter; otherwise it
2294 defaults to 78@dmn{n} in nroff mode (this is 78 characters per line) and
2295 6.5@dmn{i} in troff mode.@footnote{Note that the use of a @samp{.ll
2296 @var{length}} request to initialize the line length, prior to use of the
2297 @samp{TH} macro, is supported for backward compatibility with some
2298 versions of the @code{man} program. @emph{Always} use the
2299 @option{-rLL=@var{length}} option, or an equivalent @samp{.nr LL
2300 @var{length}} request, in preference to such a @samp{.ll @var{length}}
2301 request. In particular, note that in nroff mode, the request @samp{.ll
2302 65n}, (with any @var{length} expression that evaluates equal to
2303 65@dmn{n}, i.e., the formatter's default line length in nroff mode),
2304 does @emph{not} set the line length to 65@dmn{n} (it is adjusted to the
2305 @code{man} macro package's default setting of 78@dmn{n}), whereas the
2306 use of the @option{-rLL=65n} option, or the @samp{.nr LL 65n} request
2307 @emph{does} establish a line length of 65@dmn{n}.}
2309 @item -rLT=@var{length}
2310 Set title length to @var{length}. If not specified, the title length
2311 defaults to the line length.
2314 Page numbering starts with @var{nnn} rather than with@tie{}1.
2317 Use @var{xx} (which can be 10, 11, or@tie{}12@dmn{pt}) as the base
2318 document font size instead of the default value of@tie{}10@dmn{pt}.
2320 @item -rSN=@var{length}
2321 Set the indentation for sub-subheadings to @var{length}. If not
2322 specified, the indentation defaults to 3@dmn{n}.
2325 After page @var{nnn}, number pages as @var{nnn}a, @var{nnn}b,
2326 @var{nnn}c, etc. For example, the option @option{-rX2} produces the
2327 following page numbers: 1, 2, 2a, 2b, 2c, etc.
2330 @c ---------------------------------------------------------------------
2332 @node Man usage, Man font macros, Man options, man
2334 @cindex @code{man} macros
2335 @cindex macros for manual pages [@code{man}]
2338 This section describes the available macros for manual pages. For
2339 further customization, put additional macros and requests into the file
2340 @file{man.local}, which is loaded immediately after the @file{man}
2343 @Defmac {TH, title section [@Var{extra1} [@Var{extra2} [@Var{extra3}]]], man}
2344 Set the title of the man page to @var{title} and the section to
2345 @var{section}, which must have a value between 1 and@tie{}8. The value
2346 of @var{section} may also have a string appended, e.g.@: @samp{.pm}, to
2347 indicate a specific subsection of the man pages.
2349 Both @var{title} and @var{section} are positioned at the left and right
2350 in the header line (with @var{section} in parentheses immediately
2351 appended to @var{title}. @var{extra1} is positioned in the middle of
2352 the footer line. @var{extra2} is positioned at the left in the footer
2353 line (or at the left on even pages and at the right on odd pages if
2354 double-sided printing is active). @var{extra3} is centered in the
2357 For @acronym{HTML} and @acronym{XHTML} output, headers and footers are
2358 completely suppressed.
2360 Additionally, this macro starts a new page; the new line number
2361 is@tie{}1 again (except if the @option{-rC1} option is given on the
2362 command line) -- this feature is intended only for formatting multiple
2363 man pages; a single man page should contain exactly one @code{TH} macro
2364 at the beginning of the file.
2367 @Defmac {SH, [@Var{heading}], man}
2368 Set up an unnumbered section heading sticking out to the left. Prints
2369 out all the text following @code{SH} up to the end of the line (or the
2370 text in the next line if there is no argument to @code{SH}) in bold face
2371 (or the font specified by the string @code{HF}), one size larger than
2372 the base document size. Additionally, the left margin and the
2373 indentation for the following text is reset to its default value.
2376 @Defmac {SS, [@Var{heading}], man}
2377 Set up an unnumbered (sub)section heading. Prints out all the text
2378 following @code{SS} up to the end of the line (or the text in the next
2379 line if there is no argument to @code{SS}) in bold face (or the font
2380 specified by the string @code{HF}), at the same size as the base
2381 document size. Additionally, the left margin and the indentation for
2382 the following text is reset to its default value.
2385 @Defmac {TP, [@Var{nnn}], man}
2386 Set up an indented paragraph with label. The indentation is set to
2387 @var{nnn} if that argument is supplied (the default unit is @samp{n} if
2388 omitted), otherwise it is set to the previous indentation value
2389 specified with @code{TP}, @code{IP}, or @code{HP} (or to the default
2390 value if none of them have been used yet).
2392 The first line of text following this macro is interpreted as a string
2393 to be printed flush-left, as it is appropriate for a label. It is not
2394 interpreted as part of a paragraph, so there is no attempt to fill the
2395 first line with text from the following input lines. Nevertheless, if
2396 the label is not as wide as the indentation the paragraph starts at the
2397 same line (but indented), continuing on the following lines. If the
2398 label is wider than the indentation the descriptive part of the
2399 paragraph begins on the line following the label, entirely indented.
2400 Note that neither font shape nor font size of the label is set to a
2401 default value; on the other hand, the rest of the text has default font
2405 @DefmacList {LP, , man}
2406 @DefmacItemx {PP, , man}
2407 @DefmacListEndx {P, , man}
2408 These macros are mutual aliases. Any of them causes a line break at the
2409 current position, followed by a vertical space downwards by the amount
2410 specified by the @code{PD} macro. The font size and shape are reset to
2411 the default value (10@dmn{pt} roman if no @option{-rS} option is given
2412 on the command line). Finally, the current left margin and the
2413 indentation is restored.
2416 @Defmac {IP, [@Var{designator} [@Var{nnn}]], man}
2417 Set up an indented paragraph, using @var{designator} as a tag to mark
2418 its beginning. The indentation is set to @var{nnn} if that argument is
2419 supplied (default unit is @samp{n}), otherwise it is set to the previous
2420 indentation value specified with @code{TP}, @code{IP}, or @code{HP} (or
2421 the default value if none of them have been used yet). Font size and
2422 face of the paragraph (but not the designator) are reset to their
2425 To start an indented paragraph with a particular indentation but without
2426 a designator, use @samp{""} (two double quotes) as the first argument of
2429 For example, to start a paragraph with bullets as the designator and
2430 4@tie{}en indentation, write
2437 @Defmac {HP, [@Var{nnn}], man}
2438 @cindex hanging indentation [@code{man}]
2439 @cindex @code{man} macros, hanging indentation
2440 Set up a paragraph with hanging left indentation. The indentation is
2441 set to @var{nnn} if that argument is supplied (default unit is
2442 @samp{n}), otherwise it is set to the previous indentation value
2443 specified with @code{TP}, @code{IP}, or @code{HP} (or the default value
2444 if non of them have been used yet). Font size and face are reset to
2445 their default values.
2448 @Defmac {RS, [@Var{nnn}], man}
2449 @cindex left margin, how to move [@code{man}]
2450 @cindex @code{man} macros, moving left margin
2451 Move the left margin to the right by the value @var{nnn} if specified
2452 (default unit is @samp{n}); otherwise it is set to the previous
2453 indentation value specified with @code{TP}, @code{IP}, or @code{HP} (or
2454 to the default value if none of them have been used yet). The
2455 indentation value is then set to the default.
2457 Calls to the @code{RS} macro can be nested.
2460 @Defmac {RE, [@Var{nnn}], man}
2461 Move the left margin back to level @var{nnn}, restoring the previous
2462 left margin. If no argument is given, it moves one level back. The
2463 first level (i.e., no call to @code{RS} yet) has number@tie{}1, and each
2464 call to @code{RS} increases the level by@tie{}1.
2467 @cindex line breaks, with vertical space [@code{man}]
2468 @cindex @code{man} macros, line breaks with vertical space
2469 To summarize, the following macros cause a line break with the insertion
2470 of vertical space (which amount can be changed with the @code{PD}
2471 macro): @code{SH}, @code{SS}, @code{TP}, @code{LP} (@code{PP},
2472 @code{P}), @code{IP}, and @code{HP}.
2474 @cindex line breaks, without vertical space [@code{man}]
2475 @cindex @code{man} macros, line breaks without vertical space
2476 The macros @code{RS} and @code{RE} also cause a break but do not insert
2479 @cindex default indentation, resetting [@code{man}]
2480 @cindex indentaion, resetting to default [@code{man}]
2481 @cindex @code{man} macros, resetting default indentation
2482 Finally, the macros @code{SH}, @code{SS}, @code{LP} (@code{PP},
2483 @code{P}), and @code{RS} reset the indentation to its default value.
2485 @c ---------------------------------------------------------------------
2487 @node Man font macros, Miscellaneous man macros, Man usage, man
2488 @subsection Macros to set fonts
2489 @cindex font selection [@code{man}]
2490 @cindex @code{man} macros, how to set fonts
2492 The standard font is roman; the default text size is 10@tie{}point. If
2493 command line option @option{-rS=@var{n}} is given, use @var{n}@dmn{pt}
2494 as the default text size.
2496 @Defmac {SM, [@Var{text}], man}
2497 Set the text on the same line or the text on the next line in a font
2498 that is one point size smaller than the default font.
2501 @Defmac {SB, [@Var{text}], man}
2502 @cindex bold face [@code{man}]
2503 @cindex @code{man} macros, bold face
2504 Set the text on the same line or the text on the next line in bold face
2505 font, one point size smaller than the default font.
2508 @Defmac {BI, text, man}
2509 Set its arguments alternately in bold face and italic, without a space
2510 between the arguments. Thus,
2513 .BI this "word and" that
2517 produces ``thisword andthat'' with ``this'' and ``that'' in bold face,
2518 and ``word and'' in italics.
2521 @Defmac {IB, text, man}
2522 Set its arguments alternately in italic and bold face, without a space
2523 between the arguments.
2526 @Defmac {RI, text, man}
2527 Set its arguments alternately in roman and italic, without a space
2528 between the arguments.
2531 @Defmac {IR, text, man}
2532 Set its arguments alternately in italic and roman, without a space
2533 between the arguments.
2536 @Defmac {BR, text, man}
2537 Set its arguments alternately in bold face and roman, without a space
2538 between the arguments.
2541 @Defmac {RB, text, man}
2542 Set its arguments alternately in roman and bold face, without a space
2543 between the arguments.
2546 @Defmac {B, [@Var{text}], man}
2547 Set @var{text} in bold face. If no text is present on the line where
2548 the macro is called, then the text of the next line appears in bold
2552 @Defmac {I, [@Var{text}], man}
2553 @cindex italic fonts [@code{man}]
2554 @cindex @code{man} macros, italic fonts
2555 Set @var{text} in italic. If no text is present on the line where the
2556 macro is called, then the text of the next line appears in italic.
2559 @c ---------------------------------------------------------------------
2561 @node Miscellaneous man macros, Predefined man strings, Man font macros, man
2562 @subsection Miscellaneous macros
2565 @cindex @code{man} macros, default indentation
2566 @cindex default indentation [@code{man}]
2567 The default indentation is 7.2@dmn{n} in troff mode and 7@dmn{n} in
2568 nroff mode except for @code{grohtml}, which ignores indentation.
2571 @cindex tab stops [@code{man}]
2572 @cindex @code{man} macros, tab stops
2573 Set tabs every 0.5@tie{}inches. Since this macro is always executed
2574 during a call to the @code{TH} macro, it makes sense to call it only if
2575 the tab positions have been changed.
2578 @Defmac {PD, [@Var{nnn}], man}
2579 @cindex empty space before a paragraph [@code{man}]
2580 @cindex @code{man} macros, empty space before a paragraph
2581 Adjust the empty space before a new paragraph (or section). The
2582 optional argument gives the amount of space (default unit is @samp{v});
2583 without parameter, the value is reset to its default value (1@tie{}line
2584 in nroff mode, 0.4@dmn{v}@tie{}otherwise).
2586 This affects the macros @code{SH}, @code{SS}, @code{TP}, @code{LP} (as
2587 well as @code{PP} and @code{P}), @code{IP}, and @code{HP}.
2590 The following two macros are included for BSD compatibility.
2592 @Defmac {AT, [@Var{system} [@Var{release}]], man}
2593 @cindex @code{man}macros, BSD compatibility
2594 Alter the footer for use with @acronym{AT&T} manpages. This command
2595 exists only for compatibility; don't use it. The first argument
2596 @var{system} can be:
2600 7th Edition (the default)
2609 An optional second argument @var{release} to @code{AT} specifies the
2610 release number (such as ``System V Release 3'').
2613 @Defmac {UC, [@Var{version}], man}
2614 @cindex @code{man}macros, BSD compatibility
2615 Alters the footer for use with BSD manpages. This command exists only
2616 for compatibility; don't use it. The argument can be:
2620 3rd Berkeley Distribution (the default)
2623 4th Berkeley Distribution
2626 4.2 Berkeley Distribution
2629 4.3 Berkeley Distribution
2632 4.4 Berkeley Distribution
2636 @c ---------------------------------------------------------------------
2638 @node Predefined man strings, Preprocessors in man pages, Miscellaneous man macros, man
2639 @subsection Predefined strings
2641 The following strings are defined:
2644 Switch back to the default font size.
2648 The typeface used for headings.
2649 The default is @samp{B}.
2653 The `registered' sign.
2657 The `trademark' sign.
2660 @DefstrList {lq, man}
2661 @DefstrListEndx {rq, man}
2662 @cindex @code{lq} glyph, and @code{lq} string [@code{man}]
2663 @cindex @code{rq} glyph, and @code{rq} string [@code{man}]
2664 Left and right quote. This is equal to @code{\(lq} and @code{\(rq},
2668 @c ---------------------------------------------------------------------
2670 @node Preprocessors in man pages, Optional man extensions, Predefined man strings, man
2671 @subsection Preprocessors in @file{man} pages
2673 @cindex preprocessor, calling convention
2674 @cindex calling convention of preprocessors
2675 If a preprocessor like @code{gtbl} or @code{geqn} is needed, it has
2676 become common usage to make the first line of the man page look like
2683 @pindex geqn@r{, invocation in manual pages}
2684 @pindex grefer@r{, invocation in manual pages}
2685 @pindex gtbl@r{, invocation in manual pages}
2686 @pindex man@r{, invocation of preprocessors}
2688 Note the single space character after the double quote. @var{word}
2689 consists of letters for the needed preprocessors: @samp{e} for
2690 @code{geqn}, @samp{r} for @code{grefer}, @samp{t} for @code{gtbl}.
2691 Modern implementations of the @code{man} program read this first line
2692 and automatically call the right preprocessor(s).
2694 @c ---------------------------------------------------------------------
2696 @node Optional man extensions, , Preprocessors in man pages, man
2697 @subsection Optional @file{man} extensions
2700 Use the file @file{man.local} for local extensions to the @code{man}
2701 macros or for style changes.
2703 @unnumberedsubsubsec Custom headers and footers
2704 @cindex @code{man} macros, custom headers and footers
2706 In groff versions 1.18.2 and later, you can specify custom headers and
2707 footers by redefining the following macros in @file{man.local}.
2710 Control the content of the headers. Normally, the header prints the
2711 command name and section number on either side, and the optional fifth
2712 argument to @code{TH} in the center.
2716 Control the content of the footers. Normally, the footer prints the
2717 page number and the third and fourth arguments to @code{TH}.
2719 Use the @code{FT} number register to specify the footer position. The
2720 default is @minus{}0.5@dmn{i}.
2723 @unnumberedsubsubsec Ultrix-specific man macros
2724 @cindex Ultrix-specific @code{man} macros
2725 @cindex @code{man} macros, Ultrix-specific
2728 The @code{groff} source distribution includes a file named
2729 @file{man.ultrix}, containing macros compatible with the Ultrix variant
2730 of @code{man}. Copy this file into @file{man.local} (or use the
2731 @code{mso} request to load it) to enable the following macros.
2733 @Defmac {CT, @Var{key}, man}
2734 Print @samp{<CTRL/@var{key}>}.
2738 Print subsequent text using the constant width (Courier) typeface.
2742 Begin a non-filled display.
2746 End a non-filled display started with @code{Ds}.
2749 @Defmac {EX, [@Var{indent}], man}
2750 Begin a non-filled display using the constant width (Courier) typeface.
2751 Use the optional @var{indent} argument to indent the display.
2755 End a non-filled display started with @code{EX}.
2758 @Defmac {G, [@Var{text}], man}
2759 Set @var{text} in Helvetica. If no text is present on the line where
2760 the macro is called, then the text of the next line appears in
2764 @Defmac {GL, [@Var{text}], man}
2765 Set @var{text} in Helvetica Oblique. If no text is present on the line
2766 where the macro is called, then the text of the next line appears in
2770 @Defmac {HB, [@Var{text}], man}
2771 Set @var{text} in Helvetica Bold. If no text is present on the line
2772 where the macro is called, then all text up to the next @code{HB}
2773 appears in Helvetica Bold.
2776 @Defmac {TB, [@Var{text}], man}
2777 Identical to @code{HB}.
2780 @Defmac {MS, @Var{title} @Var{sect} [@Var{punct}], man}
2781 Set a manpage reference in Ultrix format. The @var{title} is in Courier
2782 instead of italic. Optional punctuation follows the section number
2783 without an intervening space.
2786 @Defmac {NT, [@code{C}] [@Var{title}], man}
2787 Begin a note. Print the optional @Var{title}, or the word ``Note'',
2788 centered on the page. Text following the macro makes up the body of the
2789 note, and is indented on both sides. If the first argument is @code{C},
2790 the body of the note is printed centered (the second argument replaces
2791 the word ``Note'' if specified).
2795 End a note begun with @code{NT}.
2798 @Defmac {PN, @Var{path} [@Var{punct}], man}
2799 Set the path name in constant width (Courier), followed by optional
2803 @Defmac {Pn, [@Var{punct}] @Var{path} [@Var{punct}], man}
2804 If called with two arguments, identical to @code{PN}. If called with
2805 three arguments, set the second argument in constant width (Courier),
2806 bracketed by the first and third arguments in the current font.
2810 Switch to roman font and turn off any underlining in effect.
2814 Print the string @samp{<RETURN>}.
2817 @Defmac {VS, [@code{4}], man}
2818 Start printing a change bar in the margin if the number@tie{}@code{4} is
2819 specified. Otherwise, this macro does nothing.
2823 End printing the change bar begun by @code{VS}.
2826 @unnumberedsubsubsec Simple example
2828 The following example @file{man.local} file alters the @code{SH} macro
2829 to add some extra vertical space before printing the heading. Headings
2830 are printed in Helvetica Bold.
2833 .\" Make the heading fonts Helvetica
2836 .\" Put more whitespace in front of headings.
2839 . if t .sp (u;\\n[PD]*2)
2845 @c =====================================================================
2847 @node mdoc, ms, man, Macro Packages
2848 @section @file{mdoc}
2849 @cindex @code{mdoc} macros
2851 @c XXX documentation
2852 @c XXX this is a placeholder until we get stuff knocked into shape
2853 See the @cite{groff_mdoc(7)} man page (type @command{man groff_mdoc}
2854 at the command line).
2857 @c =====================================================================
2859 @node ms, me, mdoc, Macro Packages
2861 @cindex @code{ms} macros
2863 The @file{-ms} macros are suitable for reports, letters, books, user
2864 manuals, and so forth. The package provides macros for cover pages,
2865 section headings, paragraphs, lists, footnotes, pagination, and a table
2870 * General ms Structure::
2871 * ms Document Control Registers::
2872 * ms Cover Page Macros::
2875 * Differences from AT&T ms::
2876 * Naming Conventions::
2879 @c ---------------------------------------------------------------------
2881 @node ms Intro, General ms Structure, ms, ms
2882 @subsection Introduction to @file{ms}
2884 The original @file{-ms} macros were included with @acronym{AT&T}
2885 @code{troff} as well as the @file{man} macros. While the @file{man}
2886 package is intended for brief documents that can be read on-line as well
2887 as printed, the @file{ms} macros are suitable for longer documents that
2888 are meant to be printed rather than read on-line.
2890 The @file{ms} macro package included with @code{groff} is a complete,
2891 bottom-up re-implementation. Several macros (specific to @acronym{AT&T}
2892 or Berkeley) are not included, while several new commands are.
2893 @xref{Differences from AT&T ms}, for more information.
2895 @c ---------------------------------------------------------------------
2897 @node General ms Structure, ms Document Control Registers, ms Intro, ms
2898 @subsection General structure of an @file{ms} document
2899 @cindex @code{ms} macros, general structure
2901 The @file{ms} macro package expects a certain amount of structure, but
2902 not as much as packages such as @file{man} or @file{mdoc}.
2904 The simplest documents can begin with a paragraph macro (such as
2905 @code{LP} or @code{PP}), and consist of text separated by paragraph
2906 macros or even blank lines. Longer documents have a structure as
2911 If you invoke the @code{RP} (report) macro on the first line of the
2912 document, @code{groff} prints the cover page information on its own
2913 page; otherwise it prints the information on the first page with your
2914 document text immediately following. Other document formats found in
2915 @acronym{AT&T} @code{troff} are specific to @acronym{AT&T} or Berkeley,
2916 and are not supported in @code{groff}.
2918 @item Format and layout
2919 By setting number registers, you can change your document's type (font
2920 and size), margins, spacing, headers and footers, and footnotes.
2921 @xref{ms Document Control Registers}, for more details.
2924 A cover page consists of a title, the author's name and institution, an
2925 abstract, and the date.@footnote{Actually, only the title is required.}
2926 @xref{ms Cover Page Macros}, for more details.
2929 Following the cover page is your document. You can use the @file{ms}
2930 macros to write reports, letters, books, and so forth. The package is
2931 designed for structured documents, consisting of paragraphs interspersed
2932 with headings and augmented by lists, footnotes, tables, and other
2933 common constructs. @xref{ms Body Text}, for more details.
2935 @item Table of contents
2936 Longer documents usually include a table of contents, which you can
2937 invoke by placing the @code{TC} macro at the end of your document. The
2938 @file{ms} macros have minimal indexing facilities, consisting of the
2939 @code{IX} macro, which prints an entry on standard error. Printing the
2940 table of contents at the end is necessary since @code{groff} is a
2941 single-pass text formatter, thus it cannot determine the page number of
2942 each section until that section has actually been set and printed.
2943 Since @file{ms} output is intended for hardcopy, you can manually
2944 relocate the pages containing the table of contents between the cover
2945 page and the body text after printing.
2948 @c ---------------------------------------------------------------------
2950 @node ms Document Control Registers, ms Cover Page Macros, General ms Structure, ms
2951 @subsection Document control registers
2952 @cindex @code{ms} macros, document control registers
2954 The following is a list of document control number registers. For the
2955 sake of consistency, set registers related to margins at the beginning
2956 of your document, or just after the @code{RP} macro. You can set other
2957 registers later in your document, but you should keep them together at
2958 the beginning to make them easy to find and edit as necessary.
2960 @unnumberedsubsubsec Margin Settings
2963 Defines the page offset (i.e., the left margin). There is no explicit
2964 right margin setting; the combination of the @code{PO} and @code{LL}
2965 registers implicitly define the right margin width.
2967 Effective: next page.
2969 Default value: 1@dmn{i}.
2973 Defines the line length (i.e., the width of the body text).
2975 Effective: next paragraph.
2981 Defines the title length (i.e., the header and footer width). This
2982 is usually the same as @code{LL}, but not necessarily.
2984 Effective: next paragraph.
2990 Defines the header margin height at the top of the page.
2992 Effective: next page.
2998 Defines the footer margin height at the bottom of the page.
3000 Effective: next page.
3005 @unnumberedsubsubsec Text Settings
3008 Defines the point size of the body text. If the value is larger than or
3009 equal to 1000, divide it by 1000 to get a fractional point size. For
3010 example, @samp{.nr PS 10250} sets the document's point size to
3013 Effective: next paragraph.
3019 Defines the space between lines (line height plus leading). If the
3020 value is larger than or equal to 1000, divide it by 1000 to get a
3021 fractional point size. Due to backwards compatibility, @code{VS} must
3022 be smaller than 40000 (this is 40.0@dmn{p}).
3024 Effective: next paragraph.
3029 @Defmpreg {PSINCR, ms}
3030 Defines an increment in point size, which is applied to section headings
3031 at nesting levels below the value specified in @code{GROWPS}. The value
3032 of @code{PSINCR} should be specified in points, with the @dmn{p} scaling
3033 factor, and may include a fractional component; for example,
3034 @w{@samp{.nr PSINCR 1.5p}} sets a point size increment of 1.5@dmn{p}.
3036 Effective: next section heading.
3041 @Defmpreg {GROWPS, ms}
3042 Defines the heading level below which the point size increment set by
3043 @code{PSINCR} becomes effective. Section headings at and above the
3044 level specified by @code{GROWPS} are printed at the point size set by
3045 @code{PS}; for each level below the value of @code{GROWPS}, the point
3046 size is increased in steps equal to the value of @code{PSINCR}. Setting
3047 @code{GROWPS} to any value less than@tie{}2 disables the incremental
3048 heading size feature.
3050 Effective: next section heading.
3056 Defines the hyphenation level. @code{HY} sets safely the value of the
3057 low-level @code{hy} register. Setting the value of @code{HY} to@tie{}0
3058 is equivalent to using the @code{nh} request.
3060 Effective: next paragraph.
3066 Defines the font family used to typeset the document.
3068 Effective: next paragraph.
3070 Default: as defined in the output device.
3073 @unnumberedsubsubsec Paragraph Settings
3076 Defines the initial indentation of a (@code{PP} macro) paragraph.
3078 Effective: next paragraph.
3084 Defines the space between paragraphs.
3086 Effective: next paragraph.
3088 Default: 0.3@dmn{v}.
3092 Defines the indentation on both sides of a quoted (@code{QP} macro)
3095 Effective: next paragraph.
3100 @Defmpreg {PORPHANS, ms}
3101 Defines the minimum number of initial lines of any paragraph that
3102 should be kept together, to avoid orphan lines at the bottom of a page.
3103 If a new paragraph is started close to the bottom of a page, and there
3104 is insufficient space to accommodate @code{PORPHANS} lines before an
3105 automatic page break, then the page break is forced, before the start of
3108 Effective: next paragraph.
3113 @Defmpreg {HORPHANS, ms}
3114 Defines the minimum number of lines of the following paragraph that
3115 should be kept together with any section heading introduced by the
3116 @code{NH} or @code{SH} macros. If a section heading is placed close to
3117 the bottom of a page, and there is insufficient space to accommodate
3118 both the heading and at least @code{HORPHANS} lines of the following
3119 paragraph, before an automatic page break, then the page break is forced
3122 Effective: next paragraph.
3127 @unnumberedsubsubsec Footnote Settings
3130 Defines the length of a footnote.
3132 Effective: next footnote.
3134 Default: @math{@code{@\n[LL]} * 5 / 6}.
3138 Defines the footnote indentation.
3140 Effective: next footnote.
3146 The footnote format:
3149 Print the footnote number as a superscript; indent the footnote
3153 Print the number followed by a period (like 1.@:) and indent the
3157 Like 1, without an indentation.
3160 Like 1, but print the footnote number as a hanging paragraph.
3163 Effective: next footnote.
3169 Defines the footnote point size. If the value is larger than or equal
3170 to 1000, divide it by 1000 to get a fractional point size.
3172 Effective: next footnote.
3174 Default: @math{@code{@\n[PS]} - 2}.
3178 Defines the footnote vertical spacing. If the value is larger than or
3179 equal to 1000, divide it by 1000 to get a fractional point size.
3181 Effective: next footnote.
3183 Default: @math{@code{@\n[FPS]} + 2}.
3187 Defines the footnote paragraph spacing.
3189 Effective: next footnote.
3191 Default: @math{@code{@\n[PD]} / 2}.
3194 @unnumberedsubsubsec Miscellaneous Number Registers
3196 @Defmpreg {MINGW, ms}
3197 Defines the minimum width between columns in a multi-column document.
3199 Effective: next page.
3205 Sets the vertical spacing before and after a display, a @code{tbl} table, an
3206 @code{eqn} equation, or a @code{pic} image.
3208 Effective: next paragraph.
3210 Default: 0.5@dmn{v}.
3213 @c ---------------------------------------------------------------------
3215 @node ms Cover Page Macros, ms Body Text, ms Document Control Registers, ms
3216 @subsection Cover page macros
3217 @cindex @code{ms} macros, cover page
3218 @cindex cover page macros, [@code{ms}]
3220 Use the following macros to create a cover page for your document in the
3223 @Defmac {RP, [@code{no}], ms}
3224 Specifies the report format for your document. The report format
3225 creates a separate cover page. The default action (no @code{RP} macro)
3226 is to print a subset of the cover page on page@tie{}1 of your document.
3228 If you use the word @code{no} as an optional argument, @code{groff}
3229 prints a title page but does not repeat any of the title page
3230 information (title, author, abstract, etc.@:) on page@tie{}1 of the
3235 (P-one) Prints the header on page@tie{}1. The default is to suppress
3239 @Defmac {DA, [@dots{}], ms}
3240 (optional) Prints the current date, or the arguments to the macro if
3241 any, on the title page (if specified) and in the footers. This is the
3242 default for @code{nroff}.
3245 @Defmac {ND, [@dots{}], ms}
3246 (optional) Prints the current date, or the arguments to the macro if
3247 any, on the title page (if specified) but not in the footers. This is
3248 the default for @code{troff}.
3252 Specifies the document title. @code{groff} collects text following the
3253 @code{TL} macro into the title, until reaching the author name or
3258 Specifies the author's name, which appears on the line (or lines)
3259 immediately following. You can specify multiple authors as follows:
3265 University of West Bumblefuzz
3269 Monolithic Corporation
3276 Specifies the author's institution. You can specify multiple
3277 institutions in the same way that you specify multiple authors.
3280 @Defmac {AB, [@code{no}], ms}
3281 Begins the abstract. The default is to print the word
3282 @acronym{ABSTRACT}, centered and in italics, above the text of the
3283 abstract. The word @code{no} as an optional argument suppresses this
3291 The following is example mark-up for a title page.
3292 @cindex title page, example markup
3293 @cindex example markup, title page
3298 The Inevitability of Code Bloat
3299 in Commercial and Free Software
3303 University of West Bumblefuzz
3305 This report examines the long-term growth
3306 of the code bases in two large, popular software
3307 packages; the free Emacs and the commercial
3309 While differences appear in the type or order
3310 of features added, due to the different
3311 methodologies used, the results are the same
3314 The free software approach is shown to be
3315 superior in that while free software can
3316 become as bloated as commercial offerings,
3317 free software tends to have fewer serious
3318 bugs and the added features are in line with
3322 ... the rest of the paper follows ...
3323 @endCartoucheExample
3325 @c ---------------------------------------------------------------------
3327 @node ms Body Text, ms Page Layout, ms Cover Page Macros, ms
3328 @subsection Body text
3329 @cindex @code{ms} macros, body text
3331 This section describes macros used to mark up the body of your document.
3332 Examples include paragraphs, sections, and other groups.
3335 * Paragraphs in ms::
3337 * Highlighting in ms::
3339 * Indentation values in ms::
3341 * ms Displays and Keeps::
3343 * Example multi-page table::
3347 @c ---------------------------------------------------------------------
3349 @node Paragraphs in ms, Headings in ms, ms Body Text, ms Body Text
3350 @subsubsection Paragraphs
3351 @cindex @code{ms} macros, paragraph handling
3353 The following paragraph types are available.
3356 Sets a paragraph with an initial indentation.
3360 Sets a paragraph without an initial indentation.
3364 Sets a paragraph that is indented at both left and right margins. The
3365 effect is identical to the @acronym{HTML} @code{<BLOCKQUOTE>} element.
3366 The next paragraph or heading returns margins to normal.
3370 Sets a paragraph whose lines are indented, except for the first line.
3371 This is a Berkeley extension.
3374 The following markup uses all four paragraph macros.
3378 Cases used in the study
3380 The following software and versions were
3381 considered for this report.
3383 For commercial software, we chose
3384 .B "Microsoft Word for Windows" ,
3385 starting with version 1.0 through the
3386 current version (Word 2000).
3388 For free software, we chose
3390 from its first appearance as a standalone
3391 editor through the current version (v20).
3392 See [Bloggs 2002] for details.
3394 Franklin's Law applied to software:
3395 software expands to outgrow both
3396 RAM and disk space over time.
3401 .I "Everyone's a Critic" ,
3402 Underground Press, March 2002.
3403 A definitive work that answers all questions
3404 and criticisms about the quality and usability of
3406 @endCartoucheExample
3408 The @code{PORPHANS} register (@pxref{ms Document Control Registers})
3409 operates in conjunction with each of these macros, to inhibit the
3410 printing of orphan lines at the bottom of any page.
3412 @c ---------------------------------------------------------------------
3414 @node Headings in ms, Highlighting in ms, Paragraphs in ms, ms Body Text
3415 @subsubsection Headings
3416 @cindex @code{ms} macros, headings
3418 Use headings to create a hierarchical structure for your document. The
3419 @file{ms} macros print headings in @strong{bold}, using the same font
3420 family and point size as the body text.
3422 The following describes the heading macros:
3424 @DefmacList {NH, @Var{curr-level}, ms}
3425 @DefmacListEnd {NH, @t{S} @Var{level0} @dots{}, ms}
3426 Numbered heading. The argument is either a numeric argument to indicate
3427 the level of the heading, or the letter@tie{}@code{S} followed by
3428 numeric arguments to set the heading level explicitly.
3430 If you specify heading levels out of sequence, such as invoking
3431 @samp{.NH 3} after @samp{.NH 1}, @code{groff} prints a warning on
3435 @DefstrList {SN, ms}
3436 @DefstrItemx {SN-DOT, ms}
3437 @DefstrListEndx {SN-NO-DOT, ms}
3438 After invocation of @code{NH}, the assigned section number is made
3439 available in the strings @code{SN-DOT} (as it appears in a printed
3440 section heading with default formatting, followed by a terminating
3441 period), and @code{SN-NO-DOT} (with the terminating period omitted).
3442 The string @code{SN} is also defined, as an alias for @code{SN-DOT}; if
3443 preferred, you may redefine it as an alias for @code{SN-NO-DOT}, by
3444 including the initialization
3450 at any time @strong{before} you would like the change to take effect.
3453 @Defstr {SN-STYLE, ms}
3454 You may control the style used to print section numbers, within numbered
3455 section headings, by defining an appropriate alias for the string
3456 @code{SN-STYLE}. The default style, in which the printed section number
3457 is followed by a terminating period, is obtained by defining the alias
3460 .als SN-STYLE SN-DOT
3464 If you prefer to omit the terminating period, from section numbers
3465 appearing in numbered section headings, you may define the alias
3468 .als SN-STYLE SN-NO-DOT
3472 Any such change in section numbering style becomes effective from the
3473 next use of @code{.NH}, following redefinition of the alias for
3477 @Defmac {SH, [@Var{match-level}], ms}
3478 Unnumbered subheading.
3480 The optional @var{match-level} argument is a GNU extension. It is a
3481 number indicating the level of the heading, in a manner analogous to the
3482 @var{curr-level} argument to @code{.NH}. Its purpose is to match the
3483 point size, at which the heading is printed, to the size of a numbered
3484 heading at the same level, when the @code{GROWPS} and @code{PSINCR}
3485 heading size adjustment mechanism is in effect. @xref{ms Document
3489 The @code{HORPHANS} register (@pxref{ms Document Control Registers})
3490 operates in conjunction with the @code{NH} and @code{SH} macros, to
3491 inhibit the printing of orphaned section headings at the bottom of any
3494 @c ---------------------------------------------------------------------
3496 @node Highlighting in ms, Lists in ms, Headings in ms, ms Body Text
3497 @subsubsection Highlighting
3498 @cindex @code{ms} macros, highlighting
3500 The @file{ms} macros provide a variety of methods to highlight or
3503 @Defmac {B, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3504 Sets its first argument in @strong{bold type}. If you specify a second
3505 argument, @code{groff} prints it in the previous font after the bold
3506 text, with no intervening space (this allows you to set punctuation
3507 after the highlighted text without highlighting the punctuation).
3508 Similarly, it prints the third argument (if any) in the previous font
3509 @strong{before} the first argument. For example,
3515 prints (@strong{foo}).
3517 If you give this macro no arguments, @code{groff} prints all text
3518 following in bold until the next highlighting, paragraph, or heading
3522 @Defmac {R, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3523 Sets its first argument in roman (or regular) type. It operates
3524 similarly to the @code{B}@tie{}macro otherwise.
3527 @Defmac {I, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3528 Sets its first argument in @emph{italic type}. It operates similarly
3529 to the @code{B}@tie{}macro otherwise.
3532 @Defmac {CW, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3533 Sets its first argument in a @code{constant width face}. It operates
3534 similarly to the @code{B}@tie{}macro otherwise.
3537 @Defmac {BI, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3538 Sets its first argument in bold italic type. It operates similarly to
3539 the @code{B}@tie{}macro otherwise.
3542 @Defmac {BX, [@Var{txt}], ms}
3543 Prints its argument and draws a box around it. If you want to box a
3544 string that contains spaces, use a digit-width space (@code{\0}).
3547 @Defmac {UL, [@Var{txt} [@Var{post}]], ms}
3548 Prints its first argument with an underline. If you specify a second
3549 argument, @code{groff} prints it in the previous font after the
3550 underlined text, with no intervening space.
3554 Prints all text following in larger type (two points larger than the
3555 current point size) until the next font size, highlighting, paragraph,
3556 or heading macro. You can specify this macro multiple times to
3557 enlarge the point size as needed.
3561 Prints all text following in smaller type (two points smaller than the
3562 current point size) until the next type size, highlighting, paragraph,
3563 or heading macro. You can specify this macro multiple times to reduce
3564 the point size as needed.
3568 Prints all text following in the normal point size (that is, the value
3569 of the @code{PS} register).
3572 @DefstrList {@Lbrace{}, ms}
3573 @DefstrListEndx {@Rbrace{}, ms}
3574 Text enclosed with @code{\*@{} and @code{\*@}} is printed as a
3578 @c ---------------------------------------------------------------------
3580 @node Lists in ms, Indentation values in ms, Highlighting in ms, ms Body Text
3581 @subsubsection Lists
3582 @cindex @code{ms} macros, lists
3584 The @code{IP} macro handles duties for all lists.
3586 @Defmac {IP, [@Var{marker} [@Var{width}]], ms}
3587 The @var{marker} is usually a bullet glyph (@code{\[bu]}) for unordered
3588 lists, a number (or auto-incrementing number register) for numbered
3589 lists, or a word or phrase for indented (glossary-style) lists.
3591 The @var{width} specifies the indentation for the body of each list
3592 item; its default unit is @samp{n}. Once specified, the indentation
3593 remains the same for all list items in the document until specified
3596 The @code{PORPHANS} register (@pxref{ms Document Control Registers})
3597 operates in conjunction with the @code{IP} macro, to inhibit the
3598 printing of orphaned list markers at the bottom of any page.
3601 The following is an example of a bulleted list.
3602 @cindex example markup, bulleted list [@code{ms}]
3603 @cindex bulleted list, example markup [@code{ms}]
3627 The following is an example of a numbered list.
3628 @cindex example markup, numbered list [@code{ms}]
3629 @cindex numbered list, example markup [@code{ms}]
3654 Note the use of the auto-incrementing number register in this example.
3656 The following is an example of a glossary-style list.
3657 @cindex example markup, glossary-style list [@code{ms}]
3658 @cindex glossary-style list, example markup [@code{ms}]
3661 A glossary-style list:
3663 Two or more attorneys.
3665 Firearms, preferably
3675 A glossary-style list:
3678 Two or more attorneys.
3680 guns Firearms, preferably large-caliber.
3683 Gotta pay for those lawyers and guns!
3686 In the last example, the @code{IP} macro places the definition on the
3687 same line as the term if it has enough space; otherwise, it breaks to
3688 the next line and starts the definition below the term. This may or may
3689 not be the effect you want, especially if some of the definitions break
3690 and some do not. The following examples show two possible ways to force
3693 The first workaround uses the @code{br} request to force a break after
3694 printing the term or label.
3697 A glossary-style list:
3699 Two or more attorneys.
3702 Firearms, preferably large-caliber.
3704 Gotta pay for those lawyers and guns!
3705 @endCartoucheExample
3707 The second workaround uses the @code{\p} escape to force the break.
3708 Note the space following the escape; this is important. If you omit the
3709 space, @code{groff} prints the first word on the same line as the term
3710 or label (if it fits) @strong{then} breaks the line.
3713 A glossary-style list:
3715 Two or more attorneys.
3717 \p Firearms, preferably large-caliber.
3719 Gotta pay for those lawyers and guns!
3720 @endCartoucheExample
3722 To set nested lists, use the @code{RS} and @code{RE} macros.
3723 @xref{Indentation values in ms}, for more information.
3724 @cindex @code{ms} macros, nested lists
3725 @cindex nested lists [@code{ms}]
3742 @endCartoucheExample
3758 @c ---------------------------------------------------------------------
3760 @node Indentation values in ms, Tabstops in ms, Lists in ms, ms Body Text
3761 @subsubsection Indentation values
3763 In many situations, you may need to indentation a section of text while
3764 still wrapping and filling. @xref{Lists in ms}, for an example of
3767 @DefmacList {RS, , ms}
3768 @DefmacListEndx {RE, , ms}
3769 These macros begin and end an indented section. The @code{PI} register
3770 controls the amount of indentation, allowing the indented text to line
3771 up under hanging and indented paragraphs.
3774 @xref{ms Displays and Keeps}, for macros to indentation and turn off
3777 @c ---------------------------------------------------------------------
3779 @node Tabstops in ms, ms Displays and Keeps, Indentation values in ms, ms Body Text
3780 @subsubsection Tab Stops
3782 Use the @code{ta} request to define tab stops as needed. @xref{Tabs and
3786 Use this macro to reset the tab stops to the default for @file{ms}
3787 (every 5n). You can redefine the @code{TA} macro to create a different
3788 set of default tab stops.
3791 @c ---------------------------------------------------------------------
3793 @node ms Displays and Keeps, ms Insertions, Tabstops in ms, ms Body Text
3794 @subsubsection Displays and keeps
3795 @cindex @code{ms} macros, displays
3796 @cindex @code{ms} macros, keeps
3797 @cindex keeps [@code{ms}]
3798 @cindex displays [@code{ms}]
3800 Use displays to show text-based examples or figures (such as code
3803 Displays turn off filling, so lines of code are displayed as-is without
3804 inserting @code{br} requests in between each line. Displays can be
3805 @dfn{kept} on a single page, or allowed to break across pages.
3807 @DefmacList {DS, @t{L}, ms}
3808 @DefmacItemx {LD, , ms}
3809 @DefmacListEndx {DE, , ms}
3810 Left-justified display. The @samp{.DS L} call generates a page break,
3811 if necessary, to keep the entire display on one page. The @code{LD}
3812 macro allows the display to break across pages. The @code{DE} macro
3816 @DefmacList {DS, @t{I}, ms}
3817 @DefmacItemx {ID, , ms}
3818 @DefmacListEndx {DE, , ms}
3819 Indents the display as defined by the @code{DI} register. The @samp{.DS
3820 I} call generates a page break, if necessary, to keep the entire display
3821 on one page. The @code{ID} macro allows the display to break across
3822 pages. The @code{DE} macro ends the display.
3825 @DefmacList {DS, @t{B}, ms}
3826 @DefmacItemx {BD, , ms}
3827 @DefmacListEndx {DE, , ms}
3828 Sets a block-centered display: the entire display is left-justified, but
3829 indented so that the longest line in the display is centered on the
3830 page. The @samp{.DS B} call generates a page break, if necessary, to
3831 keep the entire display on one page. The @code{BD} macro allows the
3832 display to break across pages. The @code{DE} macro ends the display.
3835 @DefmacList {DS, @t{C}, ms}
3836 @DefmacItemx {CD, , ms}
3837 @DefmacListEndx {DE, , ms}
3838 Sets a centered display: each line in the display is centered. The
3839 @samp{.DS C} call generates a page break, if necessary, to keep the
3840 entire display on one page. The @code{CD} macro allows the display to
3841 break across pages. The @code{DE} macro ends the display.
3844 @DefmacList {DS, @t{R}, ms}
3845 @DefmacItemx {RD, , ms}
3846 @DefmacListEndx {DE, , ms}
3847 Right-justifies each line in the display. The @samp{.DS R} call
3848 generates a page break, if necessary, to keep the entire display on one
3849 page. The @code{RD} macro allows the display to break across pages.
3850 The @code{DE} macro ends the display.
3853 @DefmacList {Ds, , ms}
3854 @DefmacListEndx {De, , ms}
3855 These two macros were formerly provided as aliases for @code{DS} and
3856 @code{DE}, respectively. They have been removed, and should no longer
3857 be used. The original implementations of @code{DS} and @code{DE} are
3858 retained, and should be used instead. X11 documents that actually use
3859 @code{Ds} and @code{De} always load a specific macro file from the X11
3860 distribution (@file{macros.t}) that provides proper definitions for the
3864 On occasion, you may want to @dfn{keep} other text together on a page.
3865 For example, you may want to keep two paragraphs together, or a
3866 paragraph that refers to a table (or list, or other item) immediately
3867 following. The @file{ms} macros provide the @code{KS} and @code{KE}
3868 macros for this purpose.
3870 @DefmacList {KS, , ms}
3871 @DefmacListEndx {KE, , ms}
3872 The @code{KS} macro begins a block of text to be kept on a single page,
3873 and the @code{KE} macro ends the block.
3876 @DefmacList {KF, , ms}
3877 @DefmacListEndx {KE, , ms}
3878 Specifies a @dfn{floating keep}; if the keep cannot fit on the current
3879 page, @code{groff} holds the contents of the keep and allows text
3880 following the keep (in the source file) to fill in the remainder of the
3881 current page. When the page breaks, whether by an explicit @code{bp}
3882 request or by reaching the end of the page, @code{groff} prints the
3883 floating keep at the top of the new page. This is useful for printing
3884 large graphics or tables that do not need to appear exactly where
3888 You can also use the @code{ne} request to force a page break if there is
3889 not enough vertical space remaining on the page.
3891 Use the following macros to draw a box around a section of text (such as
3894 @DefmacList {B1, , ms}
3895 @DefmacListEndx {B2, , ms}
3896 Marks the beginning and ending of text that is to have a box drawn
3897 around it. The @code{B1} macro begins the box; the @code{B2} macro ends
3898 it. Text in the box is automatically placed in a diversion (keep).
3901 @c ---------------------------------------------------------------------
3903 @node ms Insertions, Example multi-page table, ms Displays and Keeps, ms Body Text
3904 @subsubsection Tables, figures, equations, and references
3905 @cindex @code{ms} macros, tables
3906 @cindex @code{ms} macros, figures
3907 @cindex @code{ms} macros, equations
3908 @cindex @code{ms} macros, references
3909 @cindex tables [@code{ms}]
3910 @cindex figures [@code{ms}]
3911 @cindex equations [@code{ms}]
3912 @cindex references [@code{ms}]
3914 The @file{ms} macros support the standard @code{groff} preprocessors:
3915 @code{tbl}, @code{pic}, @code{eqn}, and @code{refer}.
3920 You mark text meant for preprocessors by enclosing it in pairs of tags
3923 @DefmacList {TS, [@code{H}], ms}
3924 @DefmacListEndx {TE, , ms}
3925 Denotes a table, to be processed by the @code{tbl} preprocessor. The
3926 optional argument@tie{}@code{H} to @code{TS} instructs @code{groff} to
3927 create a running header with the information up to the @code{TH} macro.
3928 @code{groff} prints the header at the beginning of the table; if the
3929 table runs onto another page, @code{groff} prints the header on the next
3933 @DefmacList {PS, , ms}
3934 @DefmacListEndx {PE, , ms}
3935 Denotes a graphic, to be processed by the @code{pic} preprocessor. You
3936 can create a @code{pic} file by hand, using the @acronym{AT&T}
3937 @code{pic} manual available on the Web as a reference, or by using a
3938 graphics program such as @code{xfig}.
3941 @DefmacList {EQ, [@Var{align}], ms}
3942 @DefmacListEndx {EN, , ms}
3943 Denotes an equation, to be processed by the @code{eqn} preprocessor.
3944 The optional @var{align} argument can be @code{C}, @code{L},
3945 or@tie{}@code{I} to center (the default), left-justify, or indent the
3949 @DefmacList {[, , ms}
3950 @DefmacListEndx {], , ms}
3951 Denotes a reference, to be processed by the @code{refer} preprocessor.
3952 The GNU @cite{refer(1)} man page provides a comprehensive reference to
3953 the preprocessor and the format of the bibliographic database.
3957 * Example multi-page table::
3960 @c ---------------------------------------------------------------------
3962 @node Example multi-page table, ms Footnotes, ms Insertions, ms Body Text
3963 @subsubsection An example multi-page table
3964 @cindex example markup, multi-page table [@code{ms}]
3965 @cindex multi-page table, example markup [@code{ms}]
3967 The following is an example of how to set up a table that may print
3968 across two or more pages.
3974 Text ...of heading...
3979 ... the rest of the table follows...
3982 @endCartoucheExample
3984 @c ---------------------------------------------------------------------
3986 @node ms Footnotes, , Example multi-page table, ms Body Text
3987 @subsubsection Footnotes
3988 @cindex @code{ms} macros, footnotes
3989 @cindex footnotes [@code{ms}]
3991 The @file{ms} macro package has a flexible footnote system. You can
3992 specify either numbered footnotes or symbolic footnotes (that is, using
3993 a marker such as a dagger symbol).
3996 Specifies the location of a numbered footnote marker in the text.
3999 @DefmacList {FS, , ms}
4000 @DefmacListEndx {FE, , ms}
4001 Specifies the text of the footnote. The default action is to create a
4002 numbered footnote; you can create a symbolic footnote by specifying a
4003 @dfn{mark} glyph (such as @code{\[dg]} for the dagger glyph) in the body
4004 text and as an argument to the @code{FS} macro, followed by the text of
4005 the footnote and the @code{FE} macro.
4008 You can control how @code{groff} prints footnote numbers by changing the
4009 value of the @code{FF} register. @xref{ms Document Control Registers}.
4011 @cindex footnotes, and keeps [@code{ms}]
4012 @cindex keeps, and footnotes [@code{ms}]
4013 @cindex footnotes, and displays [@code{ms}]
4014 @cindex displays, and footnotes [@code{ms}]
4015 Footnotes can be safely used within keeps and displays, but you should
4016 avoid using numbered footnotes within floating keeps. You can set a
4017 second @code{\**} marker between a @code{\**} and its corresponding
4018 @code{.FS} entry; as long as each @code{FS} macro occurs @emph{after}
4019 the corresponding @code{\**} and the occurrences of @code{.FS} are in
4020 the same order as the corresponding occurrences of @code{\**}.
4022 @c ---------------------------------------------------------------------
4024 @node ms Page Layout, Differences from AT&T ms, ms Body Text, ms
4025 @subsection Page layout
4026 @cindex @code{ms} macros, page layout
4027 @cindex page layout [@code{ms}]
4029 The default output from the @file{ms} macros provides a minimalist page
4030 layout: it prints a single column, with the page number centered at the
4031 top of each page. It prints no footers.
4033 You can change the layout by setting the proper number registers and
4037 * ms Headers and Footers::
4039 * ms Multiple Columns::
4041 * ms Strings and Special Characters::
4044 @c ---------------------------------------------------------------------
4046 @node ms Headers and Footers, ms Margins, ms Page Layout, ms Page Layout
4047 @subsubsection Headers and footers
4048 @cindex @code{ms} macros, headers
4049 @cindex @code{ms} macros, footers
4050 @cindex headers [@code{ms}]
4051 @cindex footers [@code{ms}]
4053 For documents that do not distinguish between odd and even pages, set
4054 the following strings:
4056 @DefstrList {LH, ms}
4057 @DefstrItemx {CH, ms}
4058 @DefstrListEndx {RH, ms}
4059 Sets the left, center, and right headers.
4062 @DefstrList {LF, ms}
4063 @DefstrItemx {CF, ms}
4064 @DefstrListEndx {RF, ms}
4065 Sets the left, center, and right footers.
4068 For documents that need different information printed in the even and
4069 odd pages, use the following macros:
4071 @DefmacList {OH, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4072 @DefmacItemx {EH, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4073 @DefmacItemx {OF, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4074 @DefmacListEndx {EF, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4075 The @code{OH} and @code{EH} macros define headers for the odd and even
4076 pages; the @code{OF} and @code{EF} macros define footers for the odd and
4077 even pages. This is more flexible than defining the individual strings.
4079 You can replace the quote (@code{'}) marks with any character not
4080 appearing in the header or footer text.
4083 To specify custom header and footer processing, redefine the following
4086 @DefmacList {PT,, ms}
4087 @DefmacItemx {HD,, ms}
4088 @DefmacListEndx {BT,, ms}
4089 The @code{PT} macro defines a custom header; the @code{BT} macro defines
4090 a custom footer. These macros must handle odd/even/first page
4091 differences if necessary.
4093 The @code{HD} macro defines additional header processing to take place
4094 after executing the @code{PT} macro.
4097 @c ---------------------------------------------------------------------
4099 @node ms Margins, ms Multiple Columns, ms Headers and Footers, ms Page Layout
4100 @subsubsection Margins
4101 @cindex @code{ms} macros, margins
4103 You control margins using a set of number registers. @xref{ms Document
4104 Control Registers}, for details.
4106 @c ---------------------------------------------------------------------
4108 @node ms Multiple Columns, ms TOC, ms Margins, ms Page Layout
4109 @subsubsection Multiple columns
4110 @cindex @code{ms} macros, multiple columns
4111 @cindex multiple columns [@code{ms}]
4113 The @file{ms} macros can set text in as many columns as do reasonably
4114 fit on the page. The following macros are available; all of them force
4115 a page break if a multi-column mode is already set. However, if the
4116 current mode is single-column, starting a multi-column mode does
4117 @emph{not} force a page break.
4127 @Defmac {MC, [@Var{width} [@Var{gutter}]], ms}
4128 Multi-column mode. If you specify no arguments, it is equivalent to the
4129 @code{2C} macro. Otherwise, @var{width} is the width of each column and
4130 @var{gutter} is the space between columns. The @code{MINGW} number
4131 register controls the default gutter width.
4134 @c ---------------------------------------------------------------------
4136 @node ms TOC, ms Strings and Special Characters, ms Multiple Columns, ms Page Layout
4137 @subsubsection Creating a table of contents
4138 @cindex @code{ms} macros, creating table of contents
4139 @cindex table of contents, creating [@code{ms}]
4141 The facilities in the @file{ms} macro package for creating a table of
4142 contents are semi-automated at best. Assuming that you want the table
4143 of contents to consist of the document's headings, you need to repeat
4144 those headings wrapped in @code{XS} and @code{XE} macros.
4146 @DefmacList {XS, [@Var{page}], ms}
4147 @DefmacItemx {XA, [@Var{page}], ms}
4148 @DefmacListEndx {XE, , ms}
4149 These macros define a table of contents or an individual entry in the
4150 table of contents, depending on their use. The macros are very simple;
4151 they cannot indent a heading based on its level. The easiest way to
4152 work around this is to add tabs to the table of contents string. The
4153 following is an example:
4171 @endCartoucheExample
4173 You can manually create a table of contents by beginning with the
4174 @code{XS} macro for the first entry, specifying the page number for that
4175 entry as the argument to @code{XS}. Add subsequent entries using the
4176 @code{XA} macro, specifying the page number for that entry as the
4177 argument to @code{XA}. The following is an example:
4183 A Brief History of the Universe
4185 Details of Galactic Formation
4188 @endCartoucheExample
4191 @Defmac {TC, [@code{no}], ms}
4192 Prints the table of contents on a new page, setting the page number
4193 to@tie{}@strong{i} (Roman lowercase numeral one). You should usually
4194 place this macro at the end of the file, since @code{groff} is a
4195 single-pass formatter and can only print what has been collected up to
4196 the point that the @code{TC} macro appears.
4198 The optional argument @code{no} suppresses printing the title specified
4199 by the string register @code{TOC}.
4202 @Defmac {PX, [@code{no}], ms}
4203 Prints the table of contents on a new page, using the current page
4204 numbering sequence. Use this macro to print a manually-generated table
4205 of contents at the beginning of your document.
4207 The optional argument @code{no} suppresses printing the title specified
4208 by the string register @code{TOC}.
4211 The @cite{Groff and Friends HOWTO} includes a @code{sed} script that
4212 automatically inserts @code{XS} and @code{XE} macro entries after each
4213 heading in a document.
4215 Altering the @code{NH} macro to automatically build the table of
4216 contents is perhaps initially more difficult, but would save a great
4217 deal of time in the long run if you use @file{ms} regularly.
4219 @c ---------------------------------------------------------------------
4221 @node ms Strings and Special Characters, , ms TOC, ms Page Layout
4222 @subsubsection Strings and Special Characters
4223 @cindex @code{ms} macros, strings
4224 @cindex @code{ms} macros, special characters
4225 @cindex @code{ms} macros, accent marks
4226 @cindex accent marks [@code{ms}]
4227 @cindex special characters [@code{ms}]
4228 @cindex strings [@code{ms}]
4230 The @file{ms} macros provide the following predefined strings. You can
4231 change the string definitions to help in creating documents in languages
4234 @Defstr {REFERENCES, ms}
4235 Contains the string printed at the beginning of the references
4236 (bibliography) page. The default is @samp{References}.
4239 @Defstr {ABSTRACT, ms}
4240 Contains the string printed at the beginning of the abstract. The
4241 default is @samp{ABSTRACT}.
4245 Contains the string printed at the beginning of the table of contents.
4248 @DefstrList {MONTH1, ms}
4249 @DefstrItemx {MONTH2, ms}
4250 @DefstrItemx {MONTH3, ms}
4251 @DefstrItemx {MONTH4, ms}
4252 @DefstrItemx {MONTH5, ms}
4253 @DefstrItemx {MONTH6, ms}
4254 @DefstrItemx {MONTH7, ms}
4255 @DefstrItemx {MONTH8, ms}
4256 @DefstrItemx {MONTH9, ms}
4257 @DefstrItemx {MONTH10, ms}
4258 @DefstrItemx {MONTH11, ms}
4259 @DefstrListEndx {MONTH12, ms}
4260 Prints the full name of the month in dates. The default is
4261 @samp{January}, @samp{February}, etc.
4264 The following special characters are available@footnote{For an
4265 explanation what special characters are see @ref{Special Characters}.}:
4272 @DefstrListEndx {U, ms}
4273 Prints typographer's quotes in troff, and plain quotes in nroff.
4274 @code{\*Q} is the left quote and @code{\*U} is the right quote.
4277 Improved accent marks are available in the @file{ms} macros.
4280 Specify this macro at the beginning of your document to enable extended
4281 accent marks and special characters. This is a Berkeley extension.
4283 To use the accent marks, place them @strong{after} the character being
4286 Note that groff's native support for accents is superior to the
4287 following definitions.
4290 The following accent marks are available after invoking the @code{AM}
4313 @deffn String @t{\*[:]}
4315 @stindex : @r{[}ms@r{]}
4318 @stindex \*[@r{<colon>}] @r{[}ms@r{]}
4339 The following are standalone characters available after invoking the
4343 Upside-down question mark.
4347 Upside-down exclamation point.
4379 Lowercase æ ligature.
4383 Uppercase Æ ligature.
4386 @c ---------------------------------------------------------------------
4388 @node Differences from AT&T ms, Naming Conventions, ms Page Layout, ms
4389 @subsection Differences from @acronym{AT&T} @file{ms}
4390 @cindex @code{ms} macros, differences from @acronym{AT&T}
4391 @cindex @acronym{AT&T} @code{troff}, @code{ms} macro package differences
4393 This section lists the (minor) differences between the @code{groff -ms}
4394 macros and @acronym{AT&T} @code{troff -ms} macros.
4398 The internals of @code{groff -ms} differ from the internals of
4399 @acronym{AT&T} @code{troff -ms}. Documents that depend upon
4400 implementation details of @acronym{AT&T} @code{troff -ms} may not format
4401 properly with @code{groff -ms}.
4404 The general error-handling policy of @code{groff -ms} is to detect and
4405 report errors, rather than silently to ignore them.
4408 @code{groff -ms} does not work in compatibility mode (this is, with the
4409 @option{-C} option).
4412 There is no special support for typewriter-like devices.
4415 @code{groff -ms} does not provide cut marks.
4418 Multiple line spacing is not supported. Use a larger vertical spacing
4422 Some @acronym{UNIX} @code{ms} documentation says that the @code{CW} and
4423 @code{GW} number registers can be used to control the column width and
4424 gutter width, respectively. These number registers are not used in
4428 Macros that cause a reset (paragraphs, headings, etc.@:) may change the
4429 indentation. Macros that change the indentation do not increment or
4430 decrement the indentation, but rather set it absolutely. This can cause
4431 problems for documents that define additional macros of their own. The
4432 solution is to use not the @code{in} request but instead the @code{RS}
4433 and @code{RE} macros.
4436 To make @code{groff -ms} use the default page offset (which also
4437 specifies the left margin), the @code{PO} register must stay undefined
4438 until the first @file{-ms} macro is evaluated. This implies that
4439 @code{PO} should not be used early in the document, unless it is changed
4440 also: Remember that accessing an undefined register automatically
4445 This number register is set to@tie{}1 by the @code{groff -ms} macros,
4446 but it is not used by the @code{AT&T} @code{troff -ms} macros.
4447 Documents that need to determine whether they are being formatted with
4448 @code{AT&T} @code{troff -ms} or @code{groff -ms} should use this number
4452 Emulations of a few ancient Bell Labs macros can be re-enabled by
4453 calling the otherwise undocumented @code{SC} section-header macro.
4454 Calling @code{SC} enables @code{UC} for marking up a product or
4455 application name, and the pair @code{P1}/@code{P2} for surrounding code
4458 These are not enabled by default because (a)@tie{}they were not
4459 documented, in the original @code{ms} manual, and (b)@tie{}the @code{P1}
4460 and @code{UC} macros collide with different macros with the same names
4461 in the Berkeley version of @code{ms}.
4463 These @code{groff} emulations are sufficient to give back the 1976
4464 Kernighan@tie{}& Cherry paper @cite{Typsetting Mathematics -- User's
4465 Guide} its section headings, and restore some text that had gone missing
4466 as arguments of undefined macros. No warranty express or implied is
4467 given as to how well the typographic details these produce match the
4468 original Bell Labs macros.
4471 * Missing ms Macros::
4472 * Additional ms Macros::
4475 @c ---------------------------------------------------------------------
4477 @node Missing ms Macros, Additional ms Macros, Differences from AT&T ms, Differences from AT&T ms
4478 @subsubsection @code{troff} macros not appearing in @code{groff}
4480 Macros missing from @code{groff -ms} are cover page macros specific to
4481 Bell Labs and Berkeley. The macros known to be missing are:
4485 Technical memorandum; a cover sheet style
4488 Internal memorandum; a cover sheet style
4491 Memo for record; a cover sheet style
4494 Memo for file; a cover sheet style
4497 Engineer's notes; a cover sheet style
4500 Computing Science Tech Report; a cover sheet style
4506 Cover sheet information
4512 @c ---------------------------------------------------------------------
4514 @node Additional ms Macros, , Missing ms Macros, Differences from AT&T ms
4515 @subsubsection @code{groff} macros not appearing in @acronym{AT&T} @code{troff}
4517 The @code{groff -ms} macros have a few minor extensions compared to the
4518 @acronym{AT&T} @code{troff -ms} macros.
4521 Improved accent marks. @xref{ms Strings and Special Characters}, for
4525 @Defmac {DS, @t{I}, ms}
4526 Indented display. The default behavior of @acronym{AT&T} @code{troff
4527 -ms} was to indent; the @code{groff} default prints displays flush left
4532 Print text in @code{constant width} (Courier) font.
4536 Indexing term (printed on standard error). You can write a script to
4537 capture and process an index generated in this manner.
4540 The following additional number registers
4541 appear in @code{groff -ms}:
4543 @Defmpreg {MINGW, ms}
4544 Specifies a minimum space between columns (for multi-column output);
4545 this takes the place of the @code{GW} register that was documented but
4546 apparently not implemented in @acronym{AT&T} @code{troff}.
4549 Several new string registers are available as well. You can change
4550 these to handle (for example) the local language. @xref{ms Strings and
4551 Special Characters}, for details.
4553 @c ---------------------------------------------------------------------
4555 @node Naming Conventions, , Differences from AT&T ms, ms
4556 @subsection Naming Conventions
4557 @cindex @code{ms} macros, naming conventions
4558 @cindex naming conventions, @code{ms} macros
4560 The following conventions are used for names of macros, strings and
4561 number registers. External names available to documents that use the
4562 @code{groff -ms} macros contain only uppercase letters and digits.
4564 Internally the macros are divided into modules; naming conventions are
4569 Names used only within one module are of the form
4570 @var{module}@code{*}@var{name}.
4573 Names used outside the module in which they are defined are of the form
4574 @var{module}@code{@@}@var{name}.
4577 Names associated with a particular environment are of the form
4578 @var{environment}@code{:}@var{name}; these are used only within the
4582 @var{name} does not have a module prefix.
4585 Constructed names used to implement arrays are of the form
4586 @var{array}@code{!}@var{index}.
4589 Thus the groff ms macros reserve the following names:
4593 Names containing the characters @code{*}, @code{@@}, and@tie{}@code{:}.
4596 Names containing only uppercase letters and digits.
4600 @c =====================================================================
4602 @node me, mm, ms, Macro Packages
4604 @cindex @code{me} macro package
4606 @c XXX documentation
4607 @c XXX this is a placeholder until we get stuff knocked into shape
4608 See the @file{meintro.me} and @file{meref.me} documents in groff's
4609 @file{doc} directory.
4612 @c =====================================================================
4614 @node mm, mom, me, Macro Packages
4616 @cindex @code{mm} macro package
4618 @c XXX documentation
4619 @c XXX this is a placeholder until we get stuff knocked into shape
4620 See the @cite{groff_mm(7)} man page (type @command{man groff_mm} at the
4624 @c =====================================================================
4626 @node mom, , mm, Macro Packages
4628 @cindex @code{mom} macro package
4630 @c XXX documentation
4631 @c XXX this is a placeholder until we get stuff knocked into shape
4632 See the @cite{groff_mom(7)} man page (type @command{man groff_mom} at
4633 the command line), which gives a short overview and a link to its
4634 extensive documentation in HTML format.
4638 @c =====================================================================
4639 @c =====================================================================
4641 @node gtroff Reference, Preprocessors, Macro Packages, Top
4642 @chapter @code{gtroff} Reference
4643 @cindex reference, @code{gtroff}
4644 @cindex @code{gtroff}, reference
4646 This chapter covers @strong{all} of the facilities of @code{gtroff}.
4647 Users of macro packages may skip it if not interested in details.
4655 * Embedded Commands::
4657 * Manipulating Filling and Adjusting::
4658 * Manipulating Hyphenation::
4659 * Manipulating Spacing::
4661 * Character Translations::
4662 * Troff and Nroff Mode::
4667 * Fonts and Symbols::
4670 * Conditionals and Loops::
4673 * Drawing Requests::
4677 * Suppressing output::
4680 * Postprocessor Access::
4682 * Gtroff Internals::
4684 * Implementation Differences::
4688 @c =====================================================================
4690 @node Text, Measurements, gtroff Reference, gtroff Reference
4692 @cindex text, @code{gtroff} processing
4694 @code{gtroff} input files contain text with control commands
4695 interspersed throughout. But, even without control codes, @code{gtroff}
4696 still does several things with the input text:
4700 filling and adjusting
4703 adding additional space after sentences
4709 inserting implicit line breaks
4713 * Filling and Adjusting::
4717 * Implicit Line Breaks::
4718 * Input Conventions::
4722 @c ---------------------------------------------------------------------
4724 @node Filling and Adjusting, Hyphenation, Text, Text
4725 @subsection Filling and Adjusting
4729 When @code{gtroff} reads text, it collects words from the input and fits
4730 as many of them together on one output line as it can. This is known as
4733 @cindex leading spaces
4734 @cindex spaces, leading and trailing
4735 @cindex extra spaces
4736 @cindex trailing spaces
4737 Once @code{gtroff} has a @dfn{filled} line, it tries to @dfn{adjust} it.
4738 This means it widens the spacing between words until the text reaches
4739 the right margin (in the default adjustment mode). Extra spaces between
4740 words are preserved, but spaces at the end of lines are ignored. Spaces
4741 at the front of a line cause a @dfn{break} (breaks are explained in
4742 @ref{Implicit Line Breaks}).
4744 @xref{Manipulating Filling and Adjusting}.
4746 @c ---------------------------------------------------------------------
4748 @node Hyphenation, Sentences, Filling and Adjusting, Text
4749 @subsection Hyphenation
4752 Since the odds are not great for finding a set of words, for every
4753 output line, which fit nicely on a line without inserting excessive
4754 amounts of space between words, @code{gtroff} hyphenates words so that
4755 it can justify lines without inserting too much space between words. It
4756 uses an internal hyphenation algorithm (a simplified version of the
4757 algorithm used within @TeX{}) to indicate which words can be hyphenated
4758 and how to do so. When a word is hyphenated, the first part of the word
4759 is added to the current filled line being output (with an attached
4760 hyphen), and the other portion is added to the next line to be filled.
4762 @xref{Manipulating Hyphenation}.
4764 @c ---------------------------------------------------------------------
4766 @node Sentences, Tab Stops, Hyphenation, Text
4767 @subsection Sentences
4770 Although it is often debated, some typesetting rules say there should be
4771 different amounts of space after various punctuation marks. For
4772 example, the @cite{Chicago typsetting manual} says that a period at the
4773 end of a sentence should have twice as much space following it as would
4774 a comma or a period as part of an abbreviation.
4776 @c XXX exact citation of Chicago manual
4778 @cindex sentence space
4779 @cindex space between sentences
4780 @cindex french-spacing
4781 @code{gtroff} does this by flagging certain characters (normally
4782 @samp{!}, @samp{?}, and @samp{.}) as @dfn{end-of-sentence} characters.
4783 When @code{gtroff} encounters one of these characters at the end of a
4784 line, it appends a normal space followed by a @dfn{sentence space} in
4785 the formatted output. (This justifies one of the conventions mentioned
4786 in @ref{Input Conventions}.)
4788 @cindex transparent characters
4789 @cindex character, transparent
4790 @cindex @code{dg} glyph, at end of sentence
4791 @cindex @code{rq} glyph, at end of sentence
4792 @cindex @code{cq} glyph, at end of sentence
4793 @cindex @code{"}, at end of sentence
4794 @cindex @code{'}, at end of sentence
4795 @cindex @code{)}, at end of sentence
4796 @cindex @code{]}, at end of sentence
4797 @cindex @code{*}, at end of sentence
4798 In addition, the following characters and symbols are treated
4799 transparently while handling end-of-sentence characters: @samp{"},
4800 @samp{'}, @samp{)}, @samp{]}, @samp{*}, @code{\[dg]}, @code{\[rq]}, and
4803 See the @code{cflags} request in @ref{Using Symbols}, for more details.
4805 @cindex @code{\&}, at end of sentence
4806 To prevent the insertion of extra space after an end-of-sentence
4807 character (at the end of a line), append @code{\&}.
4809 @c ---------------------------------------------------------------------
4811 @node Tab Stops, Implicit Line Breaks, Sentences, Text
4812 @subsection Tab Stops
4814 @cindex stops, tabulator
4815 @cindex tab character
4816 @cindex character, tabulator
4818 @cindex @acronym{EBCDIC} encoding
4819 @cindex encoding, @acronym{EBCDIC}
4820 @code{gtroff} translates @dfn{tabulator characters}, also called
4821 @dfn{tabs} (normally code point @acronym{ASCII} @code{0x09} or
4822 @acronym{EBCDIC} @code{0x05}), in the input into movements to the next
4823 tabulator stop. These tab stops are initially located every half inch
4824 across the page. Using this, simple tables can be made easily.
4825 However, it can often be deceptive as the appearance (and width) of the
4826 text on a terminal and the results from @code{gtroff} can vary greatly.
4828 Also, a possible sticking point is that lines beginning with tab
4829 characters are still filled, again producing unexpected results. For
4830 example, the following input
4832 @multitable {12345678} {12345678} {12345678} {12345678}
4834 @tab 1 @tab 2 @tab 3
4842 @multitable {12345678} {12345678} {12345678} {12345678} {12345678} {12345678} {12345678}
4844 @tab 1 @tab 2 @tab 3 @tab @tab 4 @tab 5
4847 @xref{Tabs and Fields}.
4849 @c ---------------------------------------------------------------------
4851 @node Implicit Line Breaks, Input Conventions, Tab Stops, Text
4852 @subsection Implicit Line Breaks
4853 @cindex implicit line breaks
4854 @cindex implicit breaks of lines
4855 @cindex line, implicit breaks
4856 @cindex break, implicit
4859 An important concept in @code{gtroff} is the @dfn{break}. When a break
4860 occurs, @code{gtroff} outputs the partially filled line (unjustified),
4861 and resumes collecting and filling text on the next output line.
4866 @cindex blank line macro (@code{blm})
4867 There are several ways to cause a break in @code{gtroff}. A blank line
4868 not only causes a break, but it also outputs a one-line vertical space
4869 (effectively a blank line). Note that this behaviour can be modified
4870 with the blank line macro request @code{blm}. @xref{Blank Line Traps}.
4874 @cindex leading spaces macro (@code{lsm})
4875 A line that begins with a space causes a break and the space is output
4876 at the beginning of the next line. Note that this space isn't adjusted,
4877 even in fill mode; however, the behaviour can be modified with the
4878 leading spaces macro request @code{lsm}. @xref{Leading Spaces Traps}.
4880 The end of file also causes a break -- otherwise the last line of the
4881 document may vanish!
4883 Certain requests also cause breaks, implicitly or explicitly. This is
4884 discussed in @ref{Manipulating Filling and Adjusting}.
4886 @c ---------------------------------------------------------------------
4888 @node Input Conventions, Input Encodings, Implicit Line Breaks, Text
4889 @subsection Input Conventions
4890 @cindex input conventions
4891 @cindex conventions for input
4893 Since @code{gtroff} does filling automatically, it is traditional in
4894 @code{groff} not to try and type things in as nicely formatted
4895 paragraphs. These are some conventions commonly used when typing
4900 Break lines after punctuation, particularly at the end of a sentence and
4901 in other logical places. Keep separate phrases on lines by themselves,
4902 as entire phrases are often added or deleted when editing.
4905 Try to keep lines less than 40-60@tie{}characters, to allow space for
4906 inserting more text.
4909 Do not try to do any formatting in a @acronym{WYSIWYG} manner (i.e.,
4910 don't try using spaces to get proper indentation).
4913 @c ---------------------------------------------------------------------
4915 @node Input Encodings, , Input Conventions, Text
4916 @subsection Input Encodings
4918 Currently, the following input encodings are available.
4922 @cindex encoding, input, @acronym{EBCDIC}
4923 @cindex @acronym{EBCDIC}, input encoding
4924 @cindex input encoding, @acronym{EBCDIC}
4925 @cindex encoding, input, cp1047
4926 @cindex cp1047, input encoding
4927 @cindex input encoding, cp1047
4928 @cindex IBM cp1047 input encoding
4930 This input encoding works only on @acronym{EBCDIC} platforms (and vice
4931 versa, the other input encodings don't work with @acronym{EBCDIC}); the
4932 file @file{cp1047.tmac} is by default loaded at start-up.
4935 @cindex encoding, input, @w{latin-1} (ISO @w{8859-1})
4936 @cindex @w{latin-1} (ISO @w{8859-1}), input encoding
4937 @cindex ISO @w{8859-1} (@w{latin-1}), input encoding
4938 @cindex input encoding, @w{latin-1} (ISO @w{8859-1})
4940 This is the default input encoding on non-@acronym{EBCDIC} platforms;
4941 the file @file{latin1.tmac} is loaded at start-up.
4944 @cindex encoding, input, @w{latin-2} (ISO @w{8859-2})
4945 @cindex @w{latin-2} (ISO @w{8859-2}), input encoding
4946 @cindex ISO @w{8859-2} (@w{latin-2}), input encoding
4947 @cindex input encoding, @w{latin-2} (ISO @w{8859-2})
4949 To use this encoding, either say @w{@samp{.mso latin2.tmac}} at the very
4950 beginning of your document or use @samp{-mlatin2} as a command line
4951 argument for @code{groff}.
4954 @cindex encoding, input, @w{latin-5} (ISO @w{8859-9})
4955 @cindex @w{latin-2} (ISO @w{8859-9}), input encoding
4956 @cindex ISO @w{8859-9} (@w{latin-2}), input encoding
4957 @cindex input encoding, @w{latin-2} (ISO @w{8859-9})
4959 For Turkish. Either say @w{@samp{.mso latin9.tmac}} at the very
4960 beginning of your document or use @samp{-mlatin9} as a command line
4961 argument for @code{groff}.
4963 @item latin-9 (latin-0)
4964 @cindex encoding, input, @w{latin-9} (@w{latin-0}, ISO @w{8859-15})
4965 @cindex @w{latin-9} (@w{latin-0}, ISO @w{8859-15}), input encoding
4966 @cindex ISO @w{8859-15} (@w{latin-9}, @w{latin-0}), input encoding
4967 @cindex input encoding, @w{latin-9} (@w{latin-9}, ISO @w{8859-15})
4969 This encoding is intended (at least in Europe) to replace @w{latin-1}
4970 encoding. The main difference to @w{latin-1} is that @w{latin-9}
4971 contains the Euro character. To use this encoding, either say
4972 @w{@samp{.mso latin9.tmac}} at the very beginning of your document or
4973 use @samp{-mlatin9} as a command line argument for @code{groff}.
4976 Note that it can happen that some input encoding characters are not
4977 available for a particular output device. For example, saying
4980 groff -Tlatin1 -mlatin9 ...
4984 fails if you use the Euro character in the input. Usually, this
4985 limitation is present only for devices that have a limited set of
4986 output glyphs (e.g.@: @option{-Tascii} and @option{-Tlatin1}); for other
4987 devices it is usually sufficient to install proper fonts that contain
4988 the necessary glyphs.
4990 @pindex freeeuro.pfa
4992 Due to the importance of the Euro glyph in Europe, the groff package now
4993 comes with a @sc{PostScript} font called @file{freeeuro.pfa}, which
4994 provides various glyph shapes for the Euro. In other words,
4995 @w{latin-9} encoding is supported for the @option{-Tps} device out of
4996 the box (@w{latin-2} isn't).
4998 By its very nature, @option{-Tutf8} supports all input encodings;
4999 @option{-Tdvi} has support for both @w{latin-2} and @w{latin-9} if the
5000 command line @option{-mec} is used also to load the file @file{ec.tmac}
5001 (which flips to the EC fonts).
5004 @c =====================================================================
5006 @node Measurements, Expressions, Text, gtroff Reference
5007 @section Measurements
5008 @cindex measurements
5009 @cindex scaling indicator
5010 @cindex indicator, scaling
5012 @cindex units of measurement
5013 @cindex basic unit (@code{u})
5014 @cindex machine unit (@code{u})
5015 @cindex measurement unit
5016 @cindex @code{u} unit
5017 @cindex unit, @code{u}
5018 @code{gtroff} (like many other programs) requires numeric parameters to
5019 specify various measurements. Most numeric parameters@footnote{those
5020 that specify vertical or horizontal motion or a type size} may have a
5021 @dfn{measurement unit} attached. These units are specified as a single
5022 character that immediately follows the number or expression. Each of
5023 these units are understood, by @code{gtroff}, to be a multiple of its
5024 @dfn{basic unit}. So, whenever a different measurement unit is
5025 specified @code{gtroff} converts this into its @dfn{basic units}. This
5026 basic unit, represented by a @samp{u}, is a device dependent measurement,
5027 which is quite small, ranging from 1/75@dmn{th} to 1/72000@dmn{th} of an
5028 inch. The values may be given as fractional numbers; however,
5029 fractional basic units are always rounded to integers.
5031 Some of the measurement units are completely independent of any of the
5032 current settings (e.g.@: type size) of @code{gtroff}.
5036 @cindex inch unit (@code{i})
5037 @cindex @code{i} unit
5038 @cindex unit, @code{i}
5039 Inches. An antiquated measurement unit still in use in certain
5040 backwards countries with incredibly low-cost computer equipment. One
5041 inch is equal to@tie{}2.54@dmn{cm}.
5044 @cindex centimeter unit (@code{c})
5045 @cindex @code{c} unit
5046 @cindex unit, @code{c}
5047 Centimeters. One centimeter is equal to@tie{}0.3937@dmn{in}.
5050 @cindex point unit (@code{p})
5051 @cindex @code{p} unit
5052 @cindex unit, @code{p}
5053 Points. This is a typesetter's measurement used for measure type size.
5054 It is 72@tie{}points to an inch.
5057 @cindex pica unit (@code{P})
5058 @cindex @code{P} unit
5059 @cindex unit, @code{P}
5060 Pica. Another typesetting measurement. 6@tie{}Picas to an inch (and
5061 12@tie{}points to a pica).
5065 @cindex @code{s} unit
5066 @cindex unit, @code{s}
5067 @cindex @code{z} unit
5068 @cindex unit, @code{z}
5069 @xref{Fractional Type Sizes}, for a discussion of these units.
5072 @cindex @code{f} unit
5073 @cindex unit, @code{f}
5074 Fractions. Value is 65536.
5075 @xref{Colors}, for usage.
5078 The other measurements understood by @code{gtroff} depend on settings
5079 currently in effect in @code{gtroff}. These are very useful for
5080 specifying measurements that should look proper with any size of text.
5084 @cindex em unit (@code{m})
5085 @cindex @code{m} unit
5086 @cindex unit, @code{m}
5087 Ems. This unit is equal to the current font size in points. So called
5088 because it is @emph{approximately} the width of the letter@tie{}@samp{m}
5089 in the current font.
5092 @cindex en unit (@code{n})
5093 @cindex @code{n} unit
5094 @cindex unit, @code{n}
5095 Ens. In @code{groff}, this is half of an em.
5098 @cindex vertical space unit (@code{v})
5099 @cindex space, vertical, unit (@code{v})
5100 @cindex @code{v} unit
5101 @cindex unit, @code{v}
5102 Vertical space. This is equivalent to the current line spacing.
5103 @xref{Sizes}, for more information about this.
5106 @cindex @code{M} unit
5107 @cindex unit, @code{M}
5115 @c ---------------------------------------------------------------------
5117 @node Default Units, , Measurements, Measurements
5118 @subsection Default Units
5119 @cindex default units
5120 @cindex units, default
5122 Many requests take a default unit. While this can be helpful at times,
5123 it can cause strange errors in some expressions. For example, the line
5124 length request expects em units. Here are several attempts to get a
5125 line length of 3.5@tie{}inches and their results:
5131 (7 / 2)u @result{} 0i
5133 7i/2u @result{} 3.5i
5137 Everything is converted to basic units first. In the above example it
5138 is assumed that 1@dmn{i} equals@tie{}240@dmn{u}, and 1@dmn{m}
5139 equals@tie{}10@dmn{p} (thus 1@dmn{m} equals@tie{}33@dmn{u}). The value
5140 7@dmn{i}/2 is first handled as 7@dmn{i}/2@dmn{m}, then converted to
5141 1680@dmn{u}/66@dmn{u}, which is 25@dmn{u}, and this is approximately
5142 0.1@dmn{i}. As can be seen, a scaling indicator after a closing
5143 parenthesis is simply ignored.
5145 @cindex measurements, specifying safely
5146 Thus, the safest way to specify measurements is to always attach a
5147 scaling indicator. If you want to multiply or divide by a certain
5148 scalar value, use @samp{u} as the unit for that value.
5151 @c =====================================================================
5153 @node Expressions, Identifiers, Measurements, gtroff Reference
5154 @section Expressions
5157 @code{gtroff} has most arithmetic operators common to other languages:
5161 @cindex arithmetic operators
5162 @cindex operators, arithmetic
5168 Arithmetic: @samp{+} (addition), @samp{-} (subtraction), @samp{/}
5169 (division), @samp{*} (multiplication), @samp{%} (modulo).
5171 @code{gtroff} only provides integer arithmetic. The internal type used
5172 for computing results is @samp{int}, which is usually a 32@dmn{bit}
5176 @cindex comparison operators
5177 @cindex operators, comparison
5184 Comparison: @samp{<} (less than), @samp{>} (greater than), @samp{<=}
5185 (less than or equal), @samp{>=} (greater than or equal), @samp{=}
5186 (equal), @samp{==} (the same as @samp{=}).
5189 @cindex logical operators
5190 @cindex operators, logical
5196 @opindex @r{<colon>}
5198 Logical: @samp{&} (logical and), @samp{:} (logical or).
5201 @cindex unary operators
5202 @cindex operators, unary
5206 @cindex @code{if} request, and the @samp{!} operator
5207 @cindex @code{while} request, and the @samp{!} operator
5208 Unary operators: @samp{-} (negating, i.e.@: changing the sign), @samp{+}
5209 (just for completeness; does nothing in expressions), @samp{!} (logical
5210 not; this works only within @code{if} and @code{while}
5211 requests).@footnote{Note that, for example, @samp{!(-1)} evaluates to
5212 `true' because @code{gtroff} treats both negative numbers and zero as
5213 `false'.} See below for the use of unary operators in motion requests.
5215 @cindex logical not, limitation in expression
5216 @cindex expression, limitation of logical not in
5217 The logical not operator,
5219 works only within @code{if} and @code{while} requests.
5220 Furthermore, it may appear
5221 only at the beginning of an expression,
5222 and negates the entire expression.
5223 Attempting to insert the @samp{!} operator
5224 within the expression results in a
5225 @samp{numeric expression expected} warning. This
5226 maintains compatibility
5227 with old versions of @code{troff}.
5234 .\" This does not work as expected
5235 .if (\n[X])&(!\n[Y]) .nop X only
5237 .\" Use this construct instead
5238 .if (\n[X]=1)&(\n[Y]=0) .nop X only
5242 @cindex extremum operators (@code{>?}, @code{<?})
5243 @cindex operators, extremum (@code{>?}, @code{<?})
5246 Extrema: @samp{>?} (maximum), @samp{<?} (minimum).
5253 .nr z (\n[x] >? \n[y])
5257 The register@tie{}@code{z} now contains@tie{}5.
5260 @cindex scaling operator
5261 @cindex operator, scaling
5262 Scaling: @code{(@var{c};@var{e})}. Evaluate@tie{}@var{e}
5263 using@tie{}@var{c} as the default scaling indicator. If @var{c} is
5264 missing, ignore scaling indicators in the evaluation of@tie{}@var{e}.
5268 @cindex order of evaluation in expressions
5269 @cindex expression, order of evaluation
5272 Parentheses may be used as in any other language. However, in
5273 @code{gtroff} they are necessary to ensure order of evaluation.
5274 @code{gtroff} has no operator precedence; expressions are evaluated left
5275 to right. This means that @code{gtroff} evaluates @samp{3+5*4} as if it
5276 were parenthesized like @samp{(3+5)*4}, not as @samp{3+(5*4)}, as might
5279 @cindex @code{+}, and page motion
5280 @cindex @code{-}, and page motion
5281 @cindex motion operators
5282 @cindex operators, motion
5283 For many requests that cause a motion on the page, the unary operators
5284 @samp{+} and @samp{-} work differently if leading an expression. They
5285 then indicate a motion relative to the current position (down or up,
5288 @cindex @code{|}, and page motion
5289 @cindex absolute position operator (@code{|})
5290 @cindex position, absolute, operator (@code{|})
5291 Similarly, a leading @samp{|} operator indicates an absolute position.
5292 For vertical movements, it specifies the distance from the top of the
5293 page; for horizontal movements, it gives the distance from the beginning
5294 of the @emph{input} line.
5296 @cindex @code{bp} request, using @code{+} and@tie{}@code{-}
5297 @cindex @code{in} request, using @code{+} and@tie{}@code{-}
5298 @cindex @code{ll} request, using @code{+} and@tie{}@code{-}
5299 @cindex @code{lt} request, using @code{+} and@tie{}@code{-}
5300 @cindex @code{nm} request, using @code{+} and@tie{}@code{-}
5301 @cindex @code{nr} request, using @code{+} and@tie{}@code{-}
5302 @cindex @code{pl} request, using @code{+} and@tie{}@code{-}
5303 @cindex @code{pn} request, using @code{+} and@tie{}@code{-}
5304 @cindex @code{po} request, using @code{+} and@tie{}@code{-}
5305 @cindex @code{ps} request, using @code{+} and@tie{}@code{-}
5306 @cindex @code{pvs} request, using @code{+} and@tie{}@code{-}
5307 @cindex @code{rt} request, using @code{+} and@tie{}@code{-}
5308 @cindex @code{ti} request, using @code{+} and@tie{}@code{-}
5309 @cindex @code{\H}, using @code{+} and@tie{}@code{-}
5310 @cindex @code{\R}, using @code{+} and@tie{}@code{-}
5311 @cindex @code{\s}, using @code{+} and@tie{}@code{-}
5312 @samp{+} and @samp{-} are also treated differently by the following
5313 requests and escapes: @code{bp}, @code{in}, @code{ll}, @code{lt},
5314 @code{nm}, @code{nr}, @code{pl}, @code{pn}, @code{po}, @code{ps},
5315 @code{pvs}, @code{rt}, @code{ti}, @code{\H}, @code{\R}, and @code{\s}.
5316 Here, leading plus and minus signs indicate increments and decrements.
5318 @xref{Setting Registers}, for some examples.
5320 @Defesc {\\B, ', anything, '}
5321 @cindex numeric expression, valid
5322 @cindex valid numeric expression
5323 Return@tie{}1 if @var{anything} is a valid numeric expression; or@tie{}0
5324 if @var{anything} is empty or not a valid numeric expression.
5327 @cindex space characters, in expressions
5328 @cindex expressions, and space characters
5329 Due to the way arguments are parsed, spaces are not allowed in
5330 expressions, unless the entire expression is surrounded by parentheses.
5332 @xref{Request and Macro Arguments}, and @ref{Conditionals and Loops}.
5335 @c =====================================================================
5337 @node Identifiers, Embedded Commands, Expressions, gtroff Reference
5338 @section Identifiers
5341 Like any other language, @code{gtroff} has rules for properly formed
5342 @dfn{identifiers}. In @code{gtroff}, an identifier can be made up of
5343 almost any printable character, with the exception of the following
5348 @cindex whitespace characters
5349 @cindex newline character
5350 @cindex character, whitespace
5351 Whitespace characters (spaces, tabs, and newlines).
5354 @cindex character, backspace
5355 @cindex backspace character
5356 @cindex @acronym{EBCDIC} encoding of backspace
5357 Backspace (@acronym{ASCII}@tie{}@code{0x08} or
5358 @acronym{EBCDIC}@tie{}@code{0x16}) and character code @code{0x01}.
5361 @cindex invalid input characters
5362 @cindex input characters, invalid
5363 @cindex characters, invalid input
5365 The following input characters are invalid and are ignored if
5366 @code{groff} runs on a machine based on @acronym{ASCII}, causing a
5367 warning message of type @samp{input} (see @ref{Debugging}, for more
5368 details): @code{0x00}, @code{0x0B}, @code{0x0D}-@code{0x1F},
5369 @code{0x80}-@code{0x9F}.
5371 And here are the invalid input characters if @code{groff} runs on an
5372 @acronym{EBCDIC} host: @code{0x00}, @code{0x08}, @code{0x09},
5373 @code{0x0B}, @code{0x0D}-@code{0x14}, @code{0x17}-@code{0x1F},
5374 @code{0x30}-@code{0x3F}.
5376 Currently, some of these reserved codepoints are used internally, thus
5377 making it non-trivial to extend @code{gtroff} to cover Unicode or other
5378 character sets and encodings that use characters of these ranges.
5380 Note that invalid characters are removed before parsing; an identifier
5381 @code{foo}, followed by an invalid character, followed by @code{bar} is
5382 treated as @code{foobar}.
5385 For example, any of the following is valid.
5395 @cindex @code{]}, as part of an identifier
5397 Note that identifiers longer than two characters with a closing bracket
5398 (@samp{]}) in its name can't be accessed with escape sequences that
5399 expect an identifier as a parameter. For example, @samp{\[foo]]}
5400 accesses the glyph @samp{foo}, followed by @samp{]}, whereas
5401 @samp{\C'foo]'} really asks for glyph @samp{foo]}.
5403 @cindex @code{refer}, and macro names starting with @code{[} or @code{]}
5404 @cindex @code{[}, macro names starting with, and @code{refer}
5405 @cindex @code{]}, macro names starting with, and @code{refer}
5406 @cindex macro names, starting with @code{[} or @code{]}, and @code{refer}
5407 To avoid problems with the @code{refer} preprocessor, macro names should
5408 not start with @samp{[} or @samp{]}. Due to backwards compatibility,
5409 everything after @samp{.[} and @samp{.]} is handled as a special
5410 argument to @code{refer}. For example, @samp{.[foo} makes @code{refer}
5411 to start a reference, using @samp{foo} as a parameter.
5413 @Defesc {\\A, ', ident, '}
5414 Test whether an identifier @var{ident} is valid in @code{gtroff}. It
5415 expands to the character@tie{}1 or@tie{}0 according to whether its
5416 argument (usually delimited by quotes) is or is not acceptable as the
5417 name of a string, macro, diversion, number register, environment, or
5418 font. It returns@tie{}0 if no argument is given. This is useful for
5419 looking up user input in some sort of associative table.
5427 @xref{Escapes}, for details on parameter delimiting characters.
5429 Identifiers in @code{gtroff} can be any length, but, in some contexts,
5430 @code{gtroff} needs to be told where identifiers end and text begins
5431 (and in different ways depending on their length):
5437 @cindex @code{(}, starting a two-character identifier
5439 Two characters. Must be prefixed with @samp{(} in some situations.
5441 @cindex @code{[}, starting an identifier
5442 @cindex @code{]}, ending an identifier
5444 Arbitrary length (@code{gtroff} only). Must be bracketed with @samp{[}
5445 and@tie{}@samp{]} in some situations. Any length identifier can be put
5449 @cindex undefined identifiers
5450 @cindex identifiers, undefined
5451 Unlike many other programming languages, undefined identifiers are
5452 silently ignored or expanded to nothing. When @code{gtroff} finds an
5453 undefined identifier, it emits a warning, doing the following:
5457 If the identifier is a string, macro, or diversion, @code{gtroff}
5458 defines it as empty.
5461 If the identifier is a number register, @code{gtroff} defines it with a
5465 @xref{Warnings}., @ref{Interpolating Registers}, and @ref{Strings}.
5467 Note that macros, strings, and diversions share the same name space.
5484 As can be seen in the previous example, @code{gtroff} reuses the
5485 identifier @samp{xxx}, changing it from a macro to a diversion. No
5486 warning is emitted! The contents of the first macro definition is lost.
5488 @xref{Interpolating Registers}, and @ref{Strings}.
5491 @c =====================================================================
5493 @node Embedded Commands, Registers, Identifiers, gtroff Reference
5494 @section Embedded Commands
5495 @cindex embedded commands
5496 @cindex commands, embedded
5498 Most documents need more functionality beyond filling, adjusting and
5499 implicit line breaking. In order to gain further functionality,
5500 @code{gtroff} allows commands to be embedded into the text, in two ways.
5502 The first is a @dfn{request} that takes up an entire line, and does
5503 some large-scale operation (e.g.@: break lines, start new pages).
5505 The other is an @dfn{escape} that can be usually embedded anywhere in
5506 the text; most requests can accept it even as an argument. Escapes
5507 generally do more minor operations like sub- and superscripts, print a
5516 @c ---------------------------------------------------------------------
5518 @node Requests, Macros, Embedded Commands, Embedded Commands
5519 @subsection Requests
5522 @cindex control character (@code{.})
5523 @cindex character, control (@code{.})
5524 @cindex no-break control character (@code{'})
5525 @cindex character, no-break control (@code{'})
5526 @cindex control character, no-break (@code{'})
5527 A request line begins with a control character, which is either a single
5528 quote (@samp{'}, the @dfn{no-break control character}) or a period
5529 (@samp{.}, the normal @dfn{control character}). These can be changed;
5530 see @ref{Character Translations}, for details. After this there may be
5531 optional tabs or spaces followed by an identifier, which is the name of
5532 the request. This may be followed by any number of space-separated
5533 arguments (@emph{no} tabs here).
5535 @cindex structuring source code of documents or macro packages
5536 @cindex documents, structuring the source code
5537 @cindex macro packages, structuring the source code
5538 Since a control character followed by whitespace only is ignored, it is
5539 common practice to use this feature for structuring the source code of
5540 documents or macro packages.
5554 @cindex blank line macro (@code{blm})
5555 Another possibility is to use the blank line macro request @code{blm} by
5556 assigning an empty macro to it.
5561 .blm do-nothing \" activate blank line macro
5572 .blm \" deactivate blank line macro
5575 @xref{Blank Line Traps}.
5577 @cindex zero width space character (@code{\&})
5578 @cindex character, zero width space (@code{\&})
5579 @cindex space character, zero width (@code{\&})
5580 @cindex @code{\&}, escaping control characters
5581 To begin a line with a control character without it being interpreted,
5582 precede it with @code{\&}. This represents a zero width space, which
5583 means it does not affect the output.
5585 In most cases the period is used as a control character. Several
5586 requests cause a break implicitly; using the single quote control
5587 character prevents this.
5590 A read-only number register, which is set to@tie{}1 if a macro is called
5591 with the normal control character (as defined with the @code{cc}
5592 request), and set to@tie{}0 otherwise.
5594 @cindex modifying requests
5595 @cindex requests, modifying
5596 This allows to reliably modify requests.
5602 . ie \\n[.br] .bp*orig
5608 Using this register outside of a macro makes no sense (it always returns
5609 zero in such cases).
5611 If a macro is called as a string (this is, using @code{\*}), the value
5612 of the @code{.br} register is inherited from the calling macro.
5616 * Request and Macro Arguments::
5619 @node Request and Macro Arguments, , Requests, Requests
5620 @subsubsection Request and Macro Arguments
5621 @cindex request arguments
5622 @cindex macro arguments
5623 @cindex arguments to requests and macros
5625 @cindex tabs, and macro arguments
5626 @cindex macro arguments, and tabs
5627 @cindex arguments to macros, and tabs
5628 Arguments to requests and macros are processed much like the shell:
5629 The line is split into arguments according to
5630 spaces.@footnote{Plan@tie{}9's @code{troff} implementation also allows
5631 tabs for argument separation -- @code{gtroff} intentionally doesn't
5634 @cindex spaces, in a macro argument
5635 An argument to a macro that is intended to contain spaces can either be
5636 enclosed in double quotes, or have the spaces @dfn{escaped} with
5637 backslashes. This is @emph{not} true for requests.
5639 Here are a few examples for a hypothetical macro @code{uh}:
5642 .uh The Mouse Problem
5643 .uh "The Mouse Problem"
5644 .uh The\ Mouse\ Problem
5647 @cindex @code{\~}, difference to @code{\@key{SP}}
5648 @cindex @code{\@key{SP}}, difference to @code{\~}
5650 The first line is the @code{uh} macro being called with 3 arguments,
5651 @samp{The}, @samp{Mouse}, and @samp{Problem}. The latter two have the
5652 same effect of calling the @code{uh} macro with one argument, @samp{The
5653 Mouse Problem}.@footnote{The last solution, i.e., using escaped spaces,
5654 is ``classical'' in the sense that it can be found in most @code{troff}
5655 documents. Nevertheless, it is not optimal in all situations, since
5656 @w{@samp{\ }} inserts a fixed-width, non-breaking space character that
5657 can't stretch. @code{gtroff} provides a different command @code{\~} to
5658 insert a stretchable, non-breaking space.}
5660 @cindex @code{"}, in a macro argument
5661 @cindex double quote, in a macro argument
5662 A double quote that isn't preceded by a space doesn't start a macro
5663 argument. If not closing a string, it is printed literally.
5668 .xxx a" "b c" "de"fg"
5672 has the arguments @samp{a"}, @w{@samp{b c}}, @samp{de}, and @samp{fg"}.
5673 Don't rely on this obscure behaviour!
5675 There are two possibilities to get a double quote reliably.
5679 Enclose the whole argument with double quotes and use two consecutive
5680 double quotes to represent a single one. This traditional solution has
5681 the disadvantage that double quotes don't survive argument expansion
5682 again if called in compatibility mode (using the @option{-C} option of
5687 . tm xx: `\\$1' `\\$2' `\\$3'
5689 . yy "\\$1" "\\$2" "\\$3"
5692 . tm yy: `\\$1' `\\$2' `\\$3'
5694 .xx A "test with ""quotes""" .
5695 @result{} xx: `A' `test with "quotes"' `.'
5696 @result{} yy: `A' `test with ' `quotes""'
5700 If not in compatibility mode, you get the expected result
5703 xx: `A' `test with "quotes"' `.'
5704 yy: `A' `test with "quotes"' `.'
5708 since @code{gtroff} preserves the input level.
5711 Use the double quote glyph @code{\(dq}. This works with and without
5712 compatibility mode enabled since @code{gtroff} doesn't convert
5713 @code{\(dq} back to a double quote input character.
5715 Note that this method won't work with @acronym{UNIX} @code{troff} in
5716 general since the glyph `dq' isn't defined normally.
5719 @cindex @code{ds} request, and double quotes
5720 Double quotes in the @code{ds} request are handled differently.
5721 @xref{Strings}, for more details.
5723 @c ---------------------------------------------------------------------
5725 @node Macros, Escapes, Requests, Embedded Commands
5729 @code{gtroff} has a @dfn{macro} facility for defining a series of lines
5730 that can be invoked by name. They are called in the same manner as
5731 requests -- arguments also may be passed basically in the same manner.
5733 @xref{Writing Macros}, and @ref{Request and Macro Arguments}.
5735 @c ---------------------------------------------------------------------
5737 @node Escapes, , Macros, Embedded Commands
5741 Escapes may occur anywhere in the input to @code{gtroff}. They usually
5742 begin with a backslash and are followed by a single character, which
5743 indicates the function to be performed. The escape character can be
5744 changed; see @ref{Character Translations}.
5746 Escape sequences that require an identifier as a parameter accept three
5747 possible syntax forms.
5751 The next single character is the identifier.
5753 @cindex @code{(}, starting a two-character identifier
5755 If this single character is an opening parenthesis, take the following
5756 two characters as the identifier. Note that there is no closing
5757 parenthesis after the identifier.
5759 @cindex @code{[}, starting an identifier
5760 @cindex @code{]}, ending an identifier
5762 If this single character is an opening bracket, take all characters
5763 until a closing bracket as the identifier.
5775 @cindex @code{'}, delimiting arguments
5776 @cindex argument delimiting characters
5777 @cindex characters, argument delimiting
5778 @cindex delimiting characters for arguments
5779 Other escapes may require several arguments and/or some special format.
5780 In such cases the argument is traditionally enclosed in single quotes
5781 (and quotes are always used in this manual for the definitions of escape
5782 sequences). The enclosed text is then processed according to what that
5783 escape expects. Example:
5789 @cindex @code{\o}, possible quote characters
5790 @cindex @code{\b}, possible quote characters
5791 @cindex @code{\X}, possible quote characters
5792 Note that the quote character can be replaced with any other character
5793 that does not occur in the argument (even a newline or a space
5794 character) in the following escapes: @code{\o}, @code{\b}, and
5795 @code{\X}. This makes e.g.
5804 @result{} A café in Paris
5808 possible, but it is better not to use this feature to avoid confusion.
5810 @cindex @code{\%}, used as delimiter
5811 @cindex @code{\@key{SP}}, used as delimiter
5812 @cindex @code{\|}, used as delimiter
5813 @cindex @code{\^}, used as delimiter
5814 @cindex @code{\@{}, used as delimiter
5815 @cindex @code{\@}}, used as delimiter
5816 @cindex @code{\'}, used as delimiter
5817 @cindex @code{\`}, used as delimiter
5818 @cindex @code{\-}, used as delimiter
5819 @cindex @code{\_}, used as delimiter
5820 @cindex @code{\!}, used as delimiter
5821 @cindex @code{\?}, used as delimiter
5822 @cindex @code{\)}, used as delimiter
5823 @cindex @code{\/}, used as delimiter
5824 @cindex @code{\,}, used as delimiter
5825 @cindex @code{\&}, used as delimiter
5827 @cindex @code{\:}, used as delimiter
5830 @cindex @code{\@r{<colon>}}, used as delimiter
5832 @cindex @code{\~}, used as delimiter
5833 @cindex @code{\0}, used as delimiter
5834 @cindex @code{\a}, used as delimiter
5835 @cindex @code{\c}, used as delimiter
5836 @cindex @code{\d}, used as delimiter
5837 @cindex @code{\e}, used as delimiter
5838 @cindex @code{\E}, used as delimiter
5839 @cindex @code{\p}, used as delimiter
5840 @cindex @code{\r}, used as delimiter
5841 @cindex @code{\t}, used as delimiter
5842 @cindex @code{\u}, used as delimiter
5843 The following escapes sequences (which are handled similarly to
5844 characters since they don't take a parameter) are also allowed as
5845 delimiters: @code{\%}, @w{@samp{\ }}, @code{\|}, @code{\^}, @code{\@{},
5846 @code{\@}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
5847 @code{\?}, @code{\)}, @code{\/}, @code{\,}, @code{\&}, @code{\:},
5848 @code{\~}, @code{\0}, @code{\a}, @code{\c}, @code{\d}, @code{\e},
5849 @code{\E}, @code{\p}, @code{\r}, @code{\t}, and @code{\u}. Again, don't
5850 use these if possible.
5852 @cindex @code{\A}, allowed delimiters
5853 @cindex @code{\B}, allowed delimiters
5854 @cindex @code{\Z}, allowed delimiters
5855 @cindex @code{\C}, allowed delimiters
5856 @cindex @code{\w}, allowed delimiters
5857 No newline characters as delimiters are allowed in the following
5858 escapes: @code{\A}, @code{\B}, @code{\Z}, @code{\C}, and @code{\w}.
5860 @cindex @code{\D}, allowed delimiters
5861 @cindex @code{\h}, allowed delimiters
5862 @cindex @code{\H}, allowed delimiters
5863 @cindex @code{\l}, allowed delimiters
5864 @cindex @code{\L}, allowed delimiters
5865 @cindex @code{\N}, allowed delimiters
5866 @cindex @code{\R}, allowed delimiters
5867 @cindex @code{\s}, allowed delimiters
5868 @cindex @code{\S}, allowed delimiters
5869 @cindex @code{\v}, allowed delimiters
5870 @cindex @code{\x}, allowed delimiters
5871 Finally, the escapes @code{\D}, @code{\h}, @code{\H}, @code{\l},
5872 @code{\L}, @code{\N}, @code{\R}, @code{\s}, @code{\S}, @code{\v}, and
5873 @code{\x} can't use the following characters as delimiters:
5877 @cindex numbers, and delimiters
5878 @cindex digits, and delimiters
5879 The digits @code{0}-@code{9}.
5882 @cindex operators, as delimiters
5883 @cindex @code{+}, as delimiter
5884 @cindex @code{-}, as delimiter
5885 @cindex @code{/}, as delimiter
5886 @cindex @code{*}, as delimiter
5887 @cindex @code{%}, as delimiter
5888 @cindex @code{<}, as delimiter
5889 @cindex @code{>}, as delimiter
5890 @cindex @code{=}, as delimiter
5891 @cindex @code{&}, as delimiter
5893 @cindex @code{:}, as delimiter
5896 @cindex <colon>, as delimiter
5898 @cindex @code{(}, as delimiter
5899 @cindex @code{)}, as delimiter
5900 @cindex @code{.}, as delimiter
5901 The (single-character) operators @samp{+-/*%<>=&:().}.
5904 @cindex space character
5905 @cindex character, space
5906 @cindex tab character
5907 @cindex character, tab
5908 @cindex newline character
5909 @cindex character, newline
5910 The space, tab, and newline characters.
5913 @cindex @code{\%}, used as delimiter
5915 @cindex @code{\:}, used as delimiter
5918 @cindex @code{\@r{<colon>}}, used as delimiter
5920 @cindex @code{\@{}, used as delimiter
5921 @cindex @code{\@}}, used as delimiter
5922 @cindex @code{\'}, used as delimiter
5923 @cindex @code{\`}, used as delimiter
5924 @cindex @code{\-}, used as delimiter
5925 @cindex @code{\_}, used as delimiter
5926 @cindex @code{\!}, used as delimiter
5927 @cindex @code{\/}, used as delimiter
5928 @cindex @code{\c}, used as delimiter
5929 @cindex @code{\e}, used as delimiter
5930 @cindex @code{\p}, used as delimiter
5931 All escape sequences except @code{\%}, @code{\:}, @code{\@{},
5932 @code{\@}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
5933 @code{\/}, @code{\c}, @code{\e}, and @code{\p}.
5936 @cindex printing backslash (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
5937 @cindex backslash, printing (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
5938 To have a backslash (actually, the current escape character) appear in
5939 the output several escapes are defined: @code{\\}, @code{\e} or
5940 @code{\E}. These are very similar, and only differ with respect to
5941 being used in macros or diversions. @xref{Character Translations}, for
5942 an exact description of those escapes.
5944 @xref{Implementation Differences}, @ref{Copy-in Mode}, and
5945 @ref{Diversions}, @ref{Identifiers}, for more information.
5951 @node Comments, , Escapes, Escapes
5952 @subsubsection Comments
5955 Probably one of the most@footnote{Unfortunately, this is a lie. But
5956 hopefully future @code{gtroff} hackers will believe it @code{:-)}}
5957 common forms of escapes is the comment.
5960 Start a comment. Everything to the end of the input line is ignored.
5962 This may sound simple, but it can be tricky to keep the comments from
5963 interfering with the appearance of the final output.
5965 @cindex @code{ds}, @code{ds1} requests, and comments
5966 @cindex @code{as}, @code{as1} requests, and comments
5967 If the escape is to the right of some text or a request, that portion of
5968 the line is ignored, but the space leading up to it is noticed by
5969 @code{gtroff}. This only affects the @code{ds} and @code{as} request
5972 @cindex tabs, before comments
5973 @cindex comments, lining up with tabs
5974 One possibly irritating idiosyncracy is that tabs must not be used to
5975 line up comments. Tabs are not treated as whitespace between the
5976 request and macro arguments.
5978 @cindex undefined request
5979 @cindex request, undefined
5980 A comment on a line by itself is treated as a blank line, because after
5981 eliminating the comment, that is all that remains:
5998 To avoid this, it is common to start the line with @code{.\"}, which
5999 causes the line to be treated as an undefined request and thus ignored
6002 @cindex @code{'}, as a comment
6003 Another commenting scheme seen sometimes is three consecutive single
6004 quotes (@code{'''}) at the beginning of a line. This works, but
6005 @code{gtroff} gives a warning about an undefined macro (namely
6006 @code{''}), which is harmless, but irritating.
6010 To avoid all this, @code{gtroff} has a new comment mechanism using the
6011 @code{\#} escape. This escape works the same as @code{\"} except that
6012 the newline is also ignored:
6031 @Defreq {ig, [@Var{end}]}
6032 Ignore all input until @code{gtroff} encounters the macro named
6033 @code{.}@var{end} on a line by itself (or @code{..} if @var{end} is not
6034 specified). This is useful for commenting out large blocks of text:
6039 This is part of a large block
6040 of text that has been
6041 temporarily(?) commented out.
6043 We can restore it simply by removing
6044 the .ig request and the ".." at the
6047 More text text text...
6054 text text text@dots{} More text text text@dots{}
6058 Note that the commented-out block of text does not cause a break.
6060 @cindex @code{ig} request, and copy-in mode
6061 @cindex copy-in mode, and @code{ig} request
6062 @cindex mode, copy-in, and @code{ig} request
6063 @cindex @code{ig} request, and auto-increment
6064 @cindex auto-increment, and @code{ig} request
6065 The input is read in copy-mode; auto-incremented registers @emph{are}
6066 affected (@pxref{Auto-increment}).
6070 @c =====================================================================
6072 @node Registers, Manipulating Filling and Adjusting, Embedded Commands, gtroff Reference
6076 Numeric variables in @code{gtroff} are called @dfn{registers}. There
6077 are a number of built-in registers, supplying anything from the date to
6078 details of formatting parameters.
6080 @xref{Identifiers}, for details on register identifiers.
6083 * Setting Registers::
6084 * Interpolating Registers::
6086 * Assigning Formats::
6087 * Built-in Registers::
6090 @c ---------------------------------------------------------------------
6092 @node Setting Registers, Interpolating Registers, Registers, Registers
6093 @subsection Setting Registers
6094 @cindex setting registers (@code{nr}, @code{\R})
6095 @cindex registers, setting (@code{nr}, @code{\R})
6097 Define or set registers using the @code{nr} request or the @code{\R}
6100 Although the following requests and escapes can be used to create
6101 registers, simply using an undefined register will cause it to be
6104 @DefreqList {nr, ident value}
6105 @DefescListEndx {\\R, ', ident value, '}
6106 Set number register @var{ident} to @var{value}. If @var{ident} doesn't
6107 exist, @code{gtroff} creates it.
6109 The argument to @code{\R} usually has to be enclosed in quotes.
6110 @xref{Escapes}, for details on parameter delimiting characters.
6112 The @code{\R} escape doesn't produce an input token in @code{gtroff};
6113 in other words, it vanishes completely after @code{gtroff} has
6116 For example, the following two lines are equivalent:
6119 .nr a (((17 + (3 * 4))) % 4)
6120 \R'a (((17 + (3 * 4))) % 4)'
6124 Note that the complete transparency of @code{\R} can cause surprising
6125 effects if you use number registers like @code{.k}, which get evaluated
6126 at the time they are accessed.
6131 aaa bbb ccc ddd eee fff ggg hhh\R':k \n[.k]'
6133 @result{} :k == 126950
6137 aaa bbb ccc ddd eee fff ggg hhh\h'0'\R':k \n[.k]'
6139 @result{} :k == 15000
6142 If you process this with the @sc{PostScript} device (@code{-Tps}),
6143 there will be a line break eventually after @code{ggg} in both input
6144 lines. However, after processing the space after @code{ggg}, the
6145 partially collected line is not overfull yet, so @code{troff}
6146 continues to collect input until it sees the space (or in this case,
6147 the newline) after @code{hhh}. At this point, the line is longer
6148 than the line length, and the line gets broken.
6150 In the first input line, since the @code{\R} escape leaves no traces,
6151 the check for the overfull line hasn't been done yet at the point where
6152 @code{\R} gets handled, and you get a value for the @code{.k} number
6153 register that is even greater than the current line length.
6155 In the second input line, the insertion of @code{\h'0'} to emit an
6156 invisible zero-width space forces @code{troff} to check the line length,
6157 which in turn causes the start of a new output line. Now @code{.k}
6158 returns the expected value.
6161 Both @code{nr} and @code{\R} have two additional special forms to
6162 increment or decrement a register.
6164 @DefreqList {nr, ident @t{+}@Var{value}}
6165 @DefreqItem {nr, ident @t{-}@Var{value}}
6166 @DefescItemx {\\R, ', ident @t{+}value, '}
6167 @DefescListEnd {\\R, ', ident @t{-}value, '}
6168 Increment (decrement) register @var{ident} by @var{value}.
6177 @cindex negating register values
6178 To assign the negated value of a register to another register, some care
6179 must be taken to get the desired result:
6193 The surrounding parentheses prevent the interpretation of the minus sign
6194 as a decrementing operator. An alternative is to start the assignment
6210 @cindex removing number register (@code{rr})
6211 @cindex number register, removing (@code{rr})
6212 @cindex register, removing (@code{rr})
6213 Remove number register @var{ident}. If @var{ident} doesn't exist, the
6217 @Defreq {rnn, ident1 ident2}
6218 @cindex renaming number register (@code{rnn})
6219 @cindex number register, renaming (@code{rnn})
6220 @cindex register, renaming (@code{rnn})
6221 Rename number register @var{ident1} to @var{ident2}. If either
6222 @var{ident1} or @var{ident2} doesn't exist, the request is ignored.
6225 @Defreq {aln, ident1 ident2}
6226 @cindex alias, number register, creating (@code{aln})
6227 @cindex creating alias, for number register (@code{aln})
6228 @cindex number register, creating alias (@code{aln})
6229 @cindex register, creating alias (@code{aln})
6230 Create an alias @var{ident1} for a number register @var{ident2}. The
6231 new name and the old name are exactly equivalent. If @var{ident1} is
6232 undefined, a warning of type @samp{reg} is generated, and the request is
6233 ignored. @xref{Debugging}, for information about warnings.
6236 @c ---------------------------------------------------------------------
6238 @node Interpolating Registers, Auto-increment, Setting Registers, Registers
6239 @subsection Interpolating Registers
6240 @cindex interpolating registers (@code{\n})
6241 @cindex registers, interpolating (@code{\n})
6243 Numeric registers can be accessed via the @code{\n} escape.
6245 @DefescList {\\n, , i, }
6246 @DefescItem {\\n, @Lparen{}, id, }
6247 @DefescListEnd {\\n, @Lbrack{}, ident, @Rbrack{}}
6248 @cindex nested assignments
6249 @cindex assignments, nested
6250 @cindex indirect assignments
6251 @cindex assignments, indirect
6252 Interpolate number register with name @var{ident} (one-character
6253 name@tie{}@var{i}, two-character name @var{id}). This means that the
6254 value of the register is expanded in-place while @code{gtroff} is
6255 parsing the input line. Nested assignments (also called indirect
6256 assignments) are possible.
6277 @c ---------------------------------------------------------------------
6279 @node Auto-increment, Assigning Formats, Interpolating Registers, Registers
6280 @subsection Auto-increment
6281 @cindex auto-increment
6282 @cindex increment, automatic
6284 Number registers can also be auto-incremented and auto-decremented. The
6285 increment or decrement value can be specified with a third argument to
6286 the @code{nr} request or @code{\R} escape.
6288 @Defreq {nr, ident value incr}
6289 @cindex @code{\R}, difference to @code{nr}
6290 Set number register @var{ident} to @var{value}; the increment for
6291 auto-incrementing is set to @var{incr}. Note that the @code{\R} escape
6292 doesn't support this notation.
6295 To activate auto-incrementing, the escape @code{\n} has a special syntax
6298 @DefescList {\\n, +, i, }
6299 @DefescItem {\\n, -, i, }
6300 @DefescItem {\\n, @Lparen{}+, id, }
6301 @DefescItem {\\n, @Lparen{}-, id, }
6302 @DefescItem {\\n, +@Lparen{}, id, }
6303 @DefescItem {\\n, -@Lparen{}, id, }
6304 @DefescItem {\\n, @Lbrack{}+, ident, @Rbrack{}}
6305 @DefescItem {\\n, @Lbrack{}-, ident, @Rbrack{}}
6306 @DefescItem {\\n, +@Lbrack{}, ident, @Rbrack{}}
6307 @DefescListEnd {\\n, -@Lbrack{}, ident, @Rbrack{}}
6308 Before interpolating, increment or decrement @var{ident} (one-character
6309 name@tie{}@var{i}, two-character name @var{id}) by the auto-increment
6310 value as specified with the @code{nr} request (or the @code{\R} escape).
6311 If no auto-increment value has been specified, these syntax forms are
6312 identical to @code{\n}.
6321 \n+a, \n+a, \n+a, \n+a, \n+a
6323 \n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
6325 \n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
6333 -5, -10, -15, -20, -25
6337 @cindex increment value without changing the register
6338 @cindex value, incrementing without changing the register
6339 To change the increment value without changing the value of a register
6340 (@var{a} in the example), the following can be used:
6346 @c ---------------------------------------------------------------------
6348 @node Assigning Formats, Built-in Registers, Auto-increment, Registers
6349 @subsection Assigning Formats
6350 @cindex assigning formats (@code{af})
6351 @cindex formats, assigning (@code{af})
6353 When a register is used, it is always textually replaced (or
6354 interpolated) with a representation of that number. This output format
6355 can be changed to a variety of formats (numbers, Roman numerals, etc.).
6356 This is done using the @code{af} request.
6358 @Defreq {af, ident format}
6359 Change the output format of a number register. The first argument
6360 @var{ident} is the name of the number register to be changed, and the
6361 second argument @var{format} is the output format. The following output
6362 formats are available:
6366 Decimal arabic numbers. This is the default format: 0, 1, 2,
6370 Decimal numbers with as many digits as specified. So, @samp{00} would
6371 result in printing numbers as 01, 02, 03,@tie{}@enddots{}
6373 In fact, any digit instead of zero does work; @code{gtroff} only counts
6374 how many digits are specified. As a consequence, @code{af}'s default
6375 format @samp{1} could be specified as @samp{0} also (and exactly this is
6376 returned by the @code{\g} escape, see below).
6379 @cindex Roman numerals
6380 @cindex numerals, Roman
6381 Upper-case Roman numerals: 0, I, II, III, IV,@tie{}@enddots{}
6384 Lower-case Roman numerals: 0, i, ii, iii, iv,@tie{}@enddots{}
6387 Upper-case letters: 0, A, B, C, @dots{},@tie{}Z, AA, AB,@tie{}@enddots{}
6390 Lower-case letters: 0, a, b, c, @dots{},@tie{}z, aa, ab,@tie{}@enddots{}
6393 Omitting the number register format causes a warning of type
6394 @samp{missing}. @xref{Debugging}, for more details. Specifying a
6395 nonexistent format causes an error.
6397 The following example produces @samp{10, X, j, 010}:
6401 .af a 1 \" the default format
6411 @cindex Roman numerals, maximum and minimum
6412 @cindex maximum values of Roman numerals
6413 @cindex minimum values of Roman numerals
6414 The largest number representable for the @samp{i} and @samp{I} formats
6415 is 39999 (or @minus{}39999); @acronym{UNIX} @code{troff} uses @samp{z}
6416 and @samp{w} to represent 10000 and 5000 in Roman numerals, and so does
6417 @code{gtroff}. Currently, the correct glyphs of Roman numeral five
6418 thousand and Roman numeral ten thousand (Unicode code points
6419 @code{U+2182} and @code{U+2181}, respectively) are not available.
6421 If @var{ident} doesn't exist, it is created.
6423 @cindex read-only register, changing format
6424 @cindex changing format, and read-only registers
6425 Changing the output format of a read-only register causes an error. It
6426 is necessary to first copy the register's value to a writeable register,
6427 then apply the @code{af} request to this other register.
6430 @DefescList {\\g, , i, }
6431 @DefescItem {\\g, @Lparen{}, id, }
6432 @DefescListEnd {\\g, @Lbrack{}, ident, @Rbrack{}}
6433 @cindex format of register (@code{\g})
6434 @cindex register, format (@code{\g})
6435 Return the current format of the specified register @var{ident}
6436 (one-character name@tie{}@var{i}, two-character name @var{id}). For
6437 example, @samp{\ga} after the previous example would produce the string
6438 @samp{000}. If the register hasn't been defined yet, nothing is
6442 @c ---------------------------------------------------------------------
6444 @node Built-in Registers, , Assigning Formats, Registers
6445 @subsection Built-in Registers
6446 @cindex built-in registers
6447 @cindex registers, built-in
6449 The following lists some built-in registers that are not described
6450 elsewhere in this manual. Any register that begins with a @samp{.} is
6451 read-only. A complete listing of all built-in registers can be found in
6452 @ref{Register Index}.
6456 @cindex current input file name register (@code{.F})
6457 @cindex input file name, current, register (@code{.F})
6459 This string-valued register returns the current input file name.
6462 @cindex horizontal resolution register (@code{.H})
6463 @cindex resolution, horizontal, register (@code{.H})
6465 Horizontal resolution in basic units.
6468 @cindex number of registers register (@code{.R})
6469 @cindex registers, number of, register (@code{.R})
6471 The number of number registers available. This is always 10000 in
6472 GNU@tie{}@code{troff}; it exists for backward compatibility.
6478 @cindex mode, unsafe
6480 If @code{gtroff} is called with the @option{-U} command line option to
6481 activate unsafe mode, the number register @code{.U} is set to@tie{}1,
6482 and to zero otherwise. @xref{Groff Options}.
6485 @cindex vertical resolution register (@code{.V})
6486 @cindex resolution, vertical, register (@code{.V})
6488 Vertical resolution in basic units.
6491 @cindex seconds, current time (@code{seconds})
6492 @cindex time, current, seconds (@code{seconds})
6493 @cindex current time, seconds (@code{seconds})
6495 The number of seconds after the minute, normally in the range@tie{}0
6496 to@tie{}59, but can be up to@tie{}61 to allow for leap seconds.
6497 Initialized at start-up of @code{gtroff}.
6500 @cindex minutes, current time (@code{minutes})
6501 @cindex time, current, minutes (@code{minutes})
6502 @cindex current time, minutes (@code{minutes})
6504 The number of minutes after the hour, in the range@tie{}0 to@tie{}59.
6505 Initialized at start-up of @code{gtroff}.
6508 @cindex hours, current time (@code{hours})
6509 @cindex time, current, hours (@code{hours})
6510 @cindex current time, hours (@code{hours})
6512 The number of hours past midnight, in the range@tie{}0 to@tie{}23.
6513 Initialized at start-up of @code{gtroff}.
6516 @cindex day of the week register (@code{dw})
6517 @cindex date, day of the week register (@code{dw})
6519 Day of the week (1-7).
6522 @cindex day of the month register (@code{dy})
6523 @cindex date, day of the month register (@code{dy})
6525 Day of the month (1-31).
6528 @cindex month of the year register (@code{mo})
6529 @cindex date, month of the year register (@code{mo})
6531 Current month (1-12).
6534 @cindex date, year register (@code{year}, @code{yr})
6535 @cindex year, current, register (@code{year}, @code{yr})
6541 The current year minus@tie{}1900. Unfortunately, the documentation of
6542 @acronym{UNIX} Version@tie{}7's @code{troff} had a year@tie{}2000 bug:
6543 It incorrectly claimed that @code{yr} contains the last two digits of
6544 the year. That claim has never been true of either @acronym{AT&T}
6545 @code{troff} or GNU @code{troff}. Old @code{troff} input that looks
6549 '\" The following line stopped working after 1999
6550 This document was formatted in 19\n(yr.
6554 can be corrected as follows:
6557 This document was formatted in \n[year].
6561 or, to be portable to older @code{troff} versions, as follows:
6565 This document was formatted in \n(y4.
6572 @cindex input line number register (@code{.c}, @code{c.})
6573 @cindex line number, input, register (@code{.c}, @code{c.})
6574 The current @emph{input} line number. Register @samp{.c} is read-only,
6575 whereas @samp{c.} (a @code{gtroff} extension) is writable also,
6576 affecting both @samp{.c} and @samp{c.}.
6580 @cindex output line number register (@code{ln})
6581 @cindex line number, output, register (@code{ln})
6582 The current @emph{output} line number after a call to the @code{nm}
6583 request to activate line numbering.
6585 @xref{Miscellaneous}, for more information about line numbering.
6589 @cindex major version number register (@code{.x})
6590 @cindex version number, major, register (@code{.x})
6591 The major version number. For example, if the version number is 1.03
6592 then @code{.x} contains@tie{}@samp{1}.
6596 @cindex minor version number register (@code{.y})
6597 @cindex version number, minor, register (@code{.y})
6598 The minor version number. For example, if the version number is 1.03
6599 then @code{.y} contains@tie{}@samp{03}.
6603 @cindex revision number register (@code{.Y})
6604 The revision number of @code{groff}.
6608 @cindex process ID of @code{gtroff} register (@code{$$})
6609 @cindex @code{gtroff}, process ID register (@code{$$})
6610 The process ID of @code{gtroff}.
6614 @cindex @code{gtroff}, identification register (@code{.g})
6615 @cindex GNU-specific register (@code{.g})
6616 Always@tie{}1. Macros should use this to determine whether they are
6617 running under GNU @code{troff}.
6621 @cindex @acronym{ASCII} approximation output register (@code{.A})
6622 If the command line option @option{-a} is used to produce an
6623 @acronym{ASCII} approximation of the output, this is set to@tie{}1, zero
6624 otherwise. @xref{Groff Options}.
6628 This read-only register is set to the suppression nesting level (see
6629 escapes @code{\O}). @xref{Suppressing output}.
6633 This register is set to@tie{}1 (and to@tie{}0 otherwise) if the current
6634 page is actually being printed, i.e., if the @option{-o} option is being
6635 used to only print selected pages. @xref{Groff Options}, for more
6640 If @code{gtroff} is called with the @option{-T} command line option, the
6641 number register @code{.T} is set to@tie{}1, and zero otherwise.
6642 @xref{Groff Options}.
6646 @cindex output device name string register (@code{.T})
6647 A single read-write string register that contains the current output
6648 device (for example, @samp{latin1} or @samp{ps}). This is the only
6649 string register defined by @code{gtroff}.
6653 @c =====================================================================
6655 @node Manipulating Filling and Adjusting, Manipulating Hyphenation, Registers, gtroff Reference
6656 @section Manipulating Filling and Adjusting
6657 @cindex manipulating filling and adjusting
6658 @cindex filling and adjusting, manipulating
6659 @cindex adjusting and filling, manipulating
6660 @cindex justifying text
6661 @cindex text, justifying
6665 @cindex @code{bp} request, causing implicit linebreak
6666 @cindex @code{ce} request, causing implicit linebreak
6667 @cindex @code{cf} request, causing implicit linebreak
6668 @cindex @code{fi} request, causing implicit linebreak
6669 @cindex @code{fl} request, causing implicit linebreak
6670 @cindex @code{in} request, causing implicit linebreak
6671 @cindex @code{nf} request, causing implicit linebreak
6672 @cindex @code{rj} request, causing implicit linebreak
6673 @cindex @code{sp} request, causing implicit linebreak
6674 @cindex @code{ti} request, causing implicit linebreak
6675 @cindex @code{trf} request, causing implicit linebreak
6676 Various ways of causing @dfn{breaks} were given in @ref{Implicit Line
6677 Breaks}. The @code{br} request likewise causes a break. Several other
6678 requests also cause breaks, but implicitly. These are @code{bp},
6679 @code{ce}, @code{cf}, @code{fi}, @code{fl}, @code{in}, @code{nf},
6680 @code{rj}, @code{sp}, @code{ti}, and @code{trf}.
6683 Break the current line, i.e., the input collected so far is emitted
6686 If the no-break control character is used, @code{gtroff} suppresses the
6697 Initially, @code{gtroff} fills and adjusts text to both margins.
6698 Filling can be disabled via the @code{nf} request and re-enabled with
6699 the @code{fi} request.
6702 @DefregListEndx {.u}
6703 @cindex fill mode (@code{fi})
6704 @cindex mode, fill (@code{fi})
6705 Activate fill mode (which is the default). This request implicitly
6706 enables adjusting; it also inserts a break in the text currently being
6707 filled. The read-only number register @code{.u} is set to@tie{}1.
6709 The fill mode status is associated with the current environment
6710 (@pxref{Environments}).
6712 See @ref{Line Control}, for interaction with the @code{\c} escape.
6716 @cindex no-fill mode (@code{nf})
6717 @cindex mode, no-fill (@code{nf})
6718 Activate no-fill mode. Input lines are output as-is, retaining line
6719 breaks and ignoring the current line length. This command implicitly
6720 disables adjusting; it also causes a break. The number register
6721 @code{.u} is set to@tie{}0.
6723 The fill mode status is associated with the current environment
6724 (@pxref{Environments}).
6726 See @ref{Line Control}, for interaction with the @code{\c} escape.
6729 @DefreqList {ad, [@Var{mode}]}
6730 @DefregListEndx {.j}
6733 Activation and deactivation of adjusting is done implicitly with calls
6734 to the @code{fi} or @code{nf} requests.
6736 @var{mode} can have one of the following values:
6740 @cindex ragged-right
6741 Adjust text to the left margin. This produces what is traditionally
6742 called ragged-right text.
6746 Adjust text to the right margin, producing ragged-left text.
6749 @cindex centered text
6750 @cindex @code{ce} request, difference to @samp{.ad@tie{}c}
6751 Center filled text. This is different to the @code{ce} request, which
6752 only centers text without filling.
6756 Justify to both margins. This is the default used by @code{gtroff}.
6759 Finally, @var{mode} can be the numeric argument returned by the
6762 Using @code{ad} without argument is the same as saying
6763 @w{@code{.ad \[.j]}}. In particular, @code{gtroff} adjusts lines
6764 in the same way it did before adjusting was deactivated (with a call
6765 to @code{na}, say). For example, this input code
6786 .AD \" back to centering
6788 .AD \n[ad] \" back to right justifying
6793 produces the following output:
6804 @cindex adjustment mode register (@code{.j})
6805 As just demonstrated, the current adjustment mode is available in the
6806 read-only number register @code{.j}; it can be stored and
6807 subsequently used to set adjustment.
6809 The adjustment mode status is associated with the current environment
6810 (@pxref{Environments}).
6814 Disable adjusting. This request won't change the current adjustment
6815 mode: A subsequent call to @code{ad} uses the previous adjustment
6818 The adjustment mode status is associated with the current environment
6819 (@pxref{Environments}).
6823 @DefescListEndx {\\p, , , }
6824 Adjust the current line and cause a break.
6826 In most cases this produces very ugly results since @code{gtroff}
6827 doesn't have a sophisticated paragraph building algorithm (as @TeX{}
6828 have, for example); instead, @code{gtroff} fills and adjusts a paragraph
6832 This is an uninteresting sentence.
6833 This is an uninteresting sentence.\p
6834 This is an uninteresting sentence.
6841 This is an uninteresting sentence. This is an
6842 uninteresting sentence.
6843 This is an uninteresting sentence.
6847 @DefreqList {ss, word_space_size [@Var{sentence_space_size}]}
6849 @DefregListEndx {.sss}
6850 @cindex word space size register (@code{.ss})
6851 @cindex size of word space register (@code{.ss})
6852 @cindex space between words register (@code{.ss})
6853 @cindex sentence space size register (@code{.sss})
6854 @cindex size of sentence space register (@code{.sss})
6855 @cindex space between sentences register (@code{.sss})
6856 Change the size of a space between words. It takes its units as one
6857 twelfth of the space width parameter for the current font. Initially
6858 both the @var{word_space_size} and @var{sentence_space_size}
6859 are@tie{}12. In fill mode, the values specify the minimum distance.
6863 If two arguments are given to the @code{ss} request, the second argument
6864 sets the sentence space size. If the second argument is not given,
6865 sentence space size is set to @var{word_space_size}. The sentence space
6866 size is used in two circumstances: If the end of a sentence occurs at
6867 the end of a line in fill mode, then both an inter-word space and a
6868 sentence space are added; if two spaces follow the end of a sentence in
6869 the middle of a line, then the second space is a sentence space. If a
6870 second argument is never given to the @code{ss} request, the behaviour
6871 of @acronym{UNIX} @code{troff} is the same as that exhibited by GNU
6872 @code{troff}. In GNU @code{troff}, as in @acronym{UNIX} @code{troff}, a
6873 sentence should always be followed by either a newline or two spaces.
6875 The read-only number registers @code{.ss} and @code{.sss} hold the
6876 values of the parameters set by the first and second arguments of the
6879 The word space and sentence space values are associated with the current
6880 environment (@pxref{Environments}).
6882 Contrary to @acronym{AT&T} @code{troff}, this request is @emph{not}
6883 ignored if a TTY output device is used; the given values are then
6884 rounded down to a multiple of@tie{}12 (@pxref{Implementation
6887 The request is ignored if there is no parameter.
6889 @cindex discardable horizontal space
6890 @cindex space, discardable, horizontal
6891 @cindex horizontal discardable space
6892 Another useful application of the @code{ss} request is to insert
6893 discardable horizontal space, i.e., space that is discarded at a line
6894 break. For example, paragraph-style footnotes could be separated this
6899 1.\ This is the first footnote.\c
6903 2.\ This is the second footnote.
6910 1. This is the first footnote. 2. This
6911 is the second footnote.
6915 Note that the @code{\h} escape produces unbreakable space.
6918 @DefreqList {ce, [@Var{nnn}]}
6919 @DefregListEndx {.ce}
6920 @cindex centering lines (@code{ce})
6921 @cindex lines, centering (@code{ce})
6922 Center text. While the @w{@samp{.ad c}} request also centers text, it
6923 fills the text as well. @code{ce} does not fill the text it affects.
6924 This request causes a break. The number of lines still to be centered
6925 is associated with the current environment (@pxref{Environments}).
6927 The following example demonstrates the differences. Here the input:
6932 This is a small text fragment that shows the differences
6933 between the `.ce' and the `.ad c' request.
6937 This is a small text fragment that shows the differences
6938 between the `.ce' and the `.ad c' request.
6942 And here the result:
6945 This is a small text fragment that
6946 shows the differences
6947 between the `.ce' and the `.ad c' request.
6949 This is a small text fragment that
6950 shows the differences between the `.ce'
6951 and the `.ad c' request.
6954 With no arguments, @code{ce} centers the next line of text. @var{nnn}
6955 specifies the number of lines to be centered. If the argument is zero
6956 or negative, centering is disabled.
6958 The basic length for centering text is the line length (as set with the
6959 @code{ll} request) minus the indentation (as set with the @code{in}
6960 request). Temporary indentation is ignored.
6962 As can be seen in the previous example, it is a common idiom to turn on
6963 centering for a large number of lines, and to turn off centering after
6964 text to be centered. This is useful for any request that takes a
6965 number of lines as an argument.
6967 The @code{.ce} read-only number register contains the number of lines
6968 remaining to be centered, as set by the @code{ce} request.
6971 @DefreqList {rj, [@Var{nnn}]}
6972 @DefregListEndx {.rj}
6973 @cindex justifying text (@code{rj})
6974 @cindex text, justifying (@code{rj})
6975 @cindex right-justifying (@code{rj})
6976 Justify unfilled text to the right margin. Arguments are identical to
6977 the @code{ce} request. The @code{.rj} read-only number register is the
6978 number of lines to be right-justified as set by the @code{rj} request.
6979 This request causes a break. The number of lines still to be
6980 right-justified is associated with the current environment
6981 (@pxref{Environments}).
6985 @c =====================================================================
6987 @node Manipulating Hyphenation, Manipulating Spacing, Manipulating Filling and Adjusting, gtroff Reference
6988 @section Manipulating Hyphenation
6989 @cindex manipulating hyphenation
6990 @cindex hyphenation, manipulating
6992 Here a description of requests that influence hyphenation.
6994 @DefreqList {hy, [@Var{mode}]}
6995 @DefregListEndx {.hy}
6996 Enable hyphenation. The request has an optional numeric argument,
6997 @var{mode}, to restrict hyphenation if necessary:
7001 The default argument if @var{mode} is omitted. Hyphenate without
7002 restrictions. This is also the start-up value of @code{gtroff}.
7005 Do not hyphenate the last word on a page or column.
7008 Do not hyphenate the last two characters of a word.
7011 Do not hyphenate the first two characters of a word.
7014 Values in the previous table are additive. For example, the
7015 value@tie{}12 causes @code{gtroff} to neither hyphenate the last two nor
7016 the first two characters of a word.
7018 @cindex hyphenation restrictions register (@code{.hy})
7019 The current hyphenation restrictions can be found in the read-only
7020 number register @samp{.hy}.
7022 The hyphenation mode is associated with the current environment
7023 (@pxref{Environments}).
7027 Disable hyphenation (i.e., set the hyphenation mode to zero). Note that
7028 the hyphenation mode of the last call to @code{hy} is not remembered.
7030 The hyphenation mode is associated with the current environment
7031 (@pxref{Environments}).
7034 @DefreqList {hlm, [@Var{nnn}]}
7036 @DefregListEndx {.hlc}
7037 @cindex explicit hyphen (@code{\%})
7038 @cindex hyphen, explicit (@code{\%})
7039 @cindex consecutive hyphenated lines (@code{hlm})
7040 @cindex lines, consecutive hyphenated (@code{hlm})
7041 @cindex hyphenated lines, consecutive (@code{hlm})
7042 Set the maximum number of consecutive hyphenated lines to @var{nnn}. If
7043 this number is negative, there is no maximum. The default value
7044 is@tie{}@minus{}1 if @var{nnn} is omitted. This value is associated
7045 with the current environment (@pxref{Environments}). Only lines output
7046 from a given environment count towards the maximum associated with that
7047 environment. Hyphens resulting from @code{\%} are counted; explicit
7050 The current setting of @code{hlm} is available in the @code{.hlm}
7051 read-only number register. Also the number of immediately preceding
7052 consecutive hyphenated lines are available in the read-only number
7053 register @samp{.hlc}.
7056 @Defreq {hw, word1 word2 @dots{}}
7057 Define how @var{word1}, @var{word2}, etc.@: are to be hyphenated. The
7058 words must be given with hyphens at the hyphenation points. For
7066 Besides the space character, any character whose hyphenation code value
7067 is zero can be used to separate the arguments of @code{hw} (see the
7068 documentation for the @code{hcode} request below for more information).
7069 In addition, this request can be used more than once.
7071 Hyphenation exceptions specified with the @code{hw} request are
7072 associated with the current hyphenation language; it causes an error if
7073 there is no current hyphenation language.
7075 This request is ignored if there is no parameter.
7077 In old versions of @code{troff} there was a limited amount of space to
7078 store such information; fortunately, with @code{gtroff}, this is no
7079 longer a restriction.
7082 @DefescList {\\%, , , }
7083 @deffnx Escape @t{\:}
7088 @esindex \@r{<colon>}
7090 @cindex hyphenation character (@code{\%})
7091 @cindex character, hyphenation (@code{\%})
7092 @cindex disabling hyphenation (@code{\%})
7093 @cindex hyphenation, disabling (@code{\%})
7094 To tell @code{gtroff} how to hyphenate words on the fly, use the
7095 @code{\%} escape, also known as the @dfn{hyphenation character}.
7096 Preceding a word with this character prevents it from being
7097 hyphenated; putting it inside a word indicates to @code{gtroff} that
7098 the word may be hyphenated at that point. Note that this mechanism
7099 only affects that one occurrence of the word; to change the
7100 hyphenation of a word for the entire document, use the @code{hw}
7103 The @code{\:} escape inserts a zero-width break point (that is, the word
7104 breaks but without adding a hyphen).
7107 ... check the /var/log/\:httpd/\:access_log file ...
7110 @cindex @code{\X}, followed by @code{\%}
7111 @cindex @code{\Y}, followed by @code{\%}
7112 @cindex @code{\%}, following @code{\X} or @code{\Y}
7113 Note that @code{\X} and @code{\Y} start a word, that is, the @code{\%}
7114 escape in (say) @w{@samp{\X'...'\%foobar}} and
7115 @w{@samp{\Y'...'\%foobar}} no longer prevents hyphenation but inserts a
7116 hyphenation point at the beginning of @samp{foobar}; most likely this
7117 isn't what you want to do.
7120 @Defreq {hc, [@Var{char}]}
7121 Change the hyphenation character to @var{char}. This character then
7122 works the same as the @code{\%} escape, and thus, no longer appears in
7123 the output. Without an argument, @code{hc} resets the hyphenation
7124 character to be @code{\%} (the default) only.
7126 The hyphenation character is associated with the current environment
7127 (@pxref{Environments}).
7130 @DefreqList {hpf, pattern_file}
7131 @DefreqItemx {hpfa, pattern_file}
7132 @DefreqListEndx {hpfcode, a b [c d @dots{}]}
7133 @cindex hyphenation patterns (@code{hpf})
7134 @cindex patterns for hyphenation (@code{hpf})
7135 Read in a file of hyphenation patterns. This file is searched for in
7136 the same way as @file{@var{name}.tmac} (or @file{tmac.@var{name}}) is
7137 searched for if the @option{-m@var{name}} option is specified.
7139 It should have the same format as (simple) @TeX{} patterns files. More
7140 specifically, the following scanning rules are implemented.
7144 A percent sign starts a comment (up to the end of the line) even if
7145 preceded by a backslash.
7148 No support for `digraphs' like @code{\$}.
7151 @code{^^@var{xx}} (@var{x} is 0-9 or a-f) and @code{^^@var{x}}
7152 (character code of @var{x} in the range 0-127) are recognized; other use
7153 of @code{^} causes an error.
7159 @code{hpf} checks for the expression @code{\patterns@{@dots{}@}}
7160 (possibly with whitespace before and after the braces). Everything
7161 between the braces is taken as hyphenation patterns. Consequently,
7162 @code{@{} and @code{@}} are not allowed in patterns.
7165 Similarly, @code{\hyphenation@{@dots{}@}} gives a list of hyphenation
7169 @code{\endinput} is recognized also.
7172 For backwards compatibility, if @code{\patterns} is missing, the whole
7173 file is treated as a list of hyphenation patterns (only recognizing the
7174 @code{%} character as the start of a comment).
7177 If no @code{hpf} request is specified (either in the document or in a
7178 macro package), @code{gtroff} won't hyphenate at all.
7180 The @code{hpfa} request appends a file of patterns to the current list.
7182 The @code{hpfcode} request defines mapping values for character codes in
7183 hyphenation patterns. @code{hpf} or @code{hpfa} then apply the mapping
7184 (after reading the patterns) before replacing or appending them to the
7185 current list of patterns. Its arguments are pairs of character codes --
7186 integers from 0 to@tie{}255. The request maps character
7187 code@tie{}@var{a} to code@tie{}@var{b}, code@tie{}@var{c} to
7188 code@tie{}@var{d}, and so on. You can use character codes that would
7189 be invalid otherwise. By default, everything maps to itself except
7190 letters `A' to `Z', which map to `a' to `z'.
7197 The set of hyphenation patterns is associated with the current language
7198 set by the @code{hla} request. The @code{hpf} request is usually
7199 invoked by the @file{troffrc} or @file{troffrc-end} file; by default,
7200 @file{troffrc} loads hyphenation patterns and exceptions for American
7201 English (in files @file{hyphen.us} and @file{hyphenex.us}).
7203 A second call to @code{hpf} (for the same language) replaces the
7204 hyphenation patterns with the new ones.
7206 Invoking @code{hpf} causes an error if there is no current hyphenation
7210 @Defreq {hcode, c1 code1 [c2 code2 @dots{}]}
7211 @cindex hyphenation code (@code{hcode})
7212 @cindex code, hyphenation (@code{hcode})
7213 Set the hyphenation code of character @var{c1} to @var{code1}, that of
7214 @var{c2} to @var{code2}, etc. A hyphenation code must be a single input
7215 character (not a special character) other than a digit or a space.
7217 To make hyphenation work, hyphenation codes must be set up. At
7218 start-up, groff only assigns hyphenation codes to the letters
7219 @samp{a}-@samp{z} (mapped to themselves) and to the letters
7220 @samp{A}-@samp{Z} (mapped to @samp{a}-@samp{z}); all other hyphenation
7221 codes are set to zero. Normally, hyphenation patterns contain only
7222 lowercase letters, which should be applied regardless of case. In
7223 other words, the words `FOO' and `Foo' should be hyphenated exactly the
7224 same way as the word `foo' is hyphenated, and this is what @code{hcode}
7225 is good for. Words that contain other letters won't be hyphenated
7226 properly if the corresponding hyphenation patterns actually do contain
7227 them. For example, the following @code{hcode} requests are necessary to
7228 assign hyphenation codes to the letters @samp{ÄäÖöÜüß} (this is needed
7238 Without those assignments, groff treats German words like
7239 @w{`Kindergärten'} (the plural form of `kindergarten') as two substrings
7240 @w{`kinderg'} and @w{`rten'} because the hyphenation code of the
7241 umlaut@tie{}a is zero by default. There is a German hyphenation pattern
7242 that covers @w{`kinder'}, so groff finds the hyphenation `kin-der'.
7243 The other two hyphenation points (`kin-der-gär-ten') are missed.
7245 This request is ignored if it has no parameter.
7248 @DefreqList {hym, [@Var{length}]}
7249 @DefregListEndx {.hym}
7250 @cindex hyphenation margin (@code{hym})
7251 @cindex margin for hyphenation (@code{hym})
7252 @cindex @code{ad} request, and hyphenation margin
7253 Set the (right) hyphenation margin to @var{length}. If the current
7254 adjustment mode is not @samp{b} or @samp{n}, the line is not hyphenated
7255 if it is shorter than @var{length}. Without an argument, the
7256 hyphenation margin is reset to its default value, which is@tie{}0. The
7257 default scaling indicator for this request is @samp{m}. The hyphenation
7258 margin is associated with the current environment
7259 (@pxref{Environments}).
7261 A negative argument resets the hyphenation margin to zero, emitting a
7262 warning of type @samp{range}.
7264 @cindex hyphenation margin register (@code{.hym})
7265 The current hyphenation margin is available in the @code{.hym} read-only
7269 @DefreqList {hys, [@Var{hyphenation_space}]}
7270 @DefregListEndx {.hys}
7271 @cindex hyphenation space (@code{hys})
7272 @cindex @code{ad} request, and hyphenation space
7273 Set the hyphenation space to @var{hyphenation_space}. If the current
7274 adjustment mode is @samp{b} or @samp{n}, don't hyphenate the line if it
7275 can be justified by adding no more than @var{hyphenation_space} extra
7276 space to each word space. Without argument, the hyphenation space is
7277 set to its default value, which is@tie{}0. The default scaling
7278 indicator for this request is @samp{m}. The hyphenation space is
7279 associated with the current environment (@pxref{Environments}).
7281 A negative argument resets the hyphenation space to zero, emitting a
7282 warning of type @samp{range}.
7284 @cindex hyphenation space register (@code{.hys})
7285 The current hyphenation space is available in the @code{.hys} read-only
7289 @Defreq {shc, [@Var{glyph}]}
7290 @cindex soft hyphen character, setting (@code{shc})
7291 @cindex character, soft hyphen, setting (@code{shc})
7292 @cindex glyph, soft hyphen (@code{hy})
7293 @cindex soft hyphen glyph (@code{hy})
7294 @cindex @code{char} request, and soft hyphen character
7295 @cindex @code{tr} request, and soft hyphen character
7296 Set the @dfn{soft hyphen character} to @var{glyph}.@footnote{@dfn{Soft
7297 hyphen character} is a misnomer since it is an output glyph.} If the
7298 argument is omitted, the soft hyphen character is set to the default
7299 glyph @code{\(hy} (this is the start-up value of @code{gtroff} also).
7300 The soft hyphen character is the glyph that is inserted when a word is
7301 hyphenated at a line break. If the soft hyphen character does not exist
7302 in the font of the character immediately preceding a potential break
7303 point, then the line is not broken at that point. Neither definitions
7304 (specified with the @code{char} request) nor translations (specified
7305 with the @code{tr} request) are considered when finding the soft hyphen
7309 @DefreqList {hla, language}
7310 @DefregListEndx {.hla}
7311 @cindex @code{hpf} request, and hyphenation language
7312 @cindex @code{hw} request, and hyphenation language
7315 Set the current hyphenation language to the string @var{language}.
7316 Hyphenation exceptions specified with the @code{hw} request and
7317 hyphenation patterns specified with the @code{hpf} and @code{hpfa}
7318 requests are both associated with the current hyphenation language. The
7319 @code{hla} request is usually invoked by the @file{troffrc} or the
7320 @file{troffrc-end} files; @file{troffrc} sets the default language to
7323 @cindex hyphenation language register (@code{.hla})
7324 The current hyphenation language is available as a string in the
7325 read-only number register @samp{.hla}.
7328 .ds curr_language \n[.hla]
7335 @c =====================================================================
7337 @node Manipulating Spacing, Tabs and Fields, Manipulating Hyphenation, gtroff Reference
7338 @section Manipulating Spacing
7339 @cindex manipulating spacing
7340 @cindex spacing, manipulating
7342 @Defreq {sp, [@Var{distance}]}
7343 Space downwards @var{distance}. With no argument it advances
7344 1@tie{}line. A negative argument causes @code{gtroff} to move up the
7345 page the specified distance. If the argument is preceded by a @samp{|}
7346 then @code{gtroff} moves that distance from the top of the page. This
7347 request causes a line break, and that adds the current line spacing to
7348 the space you have just specified. The default scaling indicator is
7351 For convenience you may wish to use the following macros to set the
7352 height of the next line at a given distance from the top or the bottom
7361 . sp |\\n[.p]u-\\$1-\\n[.v]u
7366 A call to @samp{.y-from-bot-up 10c} means that the bottom of the next
7367 line will be at 10@dmn{cm} from the paper edge at the bottom.
7369 If a vertical trap is sprung during execution of @code{sp}, the amount
7370 of vertical space after the trap is discarded. For example, this
7398 @cindex @code{sp} request, and traps
7399 @cindex discarded space in traps
7400 @cindex space, discarded, in traps
7401 @cindex traps, and discarded space
7402 The amount of discarded space is available in the number register
7405 To protect @code{sp} against vertical traps, use the @code{vpt} request:
7414 @DefreqList {ls, [@Var{nnn}]}
7415 @DefregListEndx {.L}
7416 @cindex double-spacing (@code{ls})
7417 Output @w{@var{nnn}@minus{}1} blank lines after each line of text. With
7418 no argument, @code{gtroff} uses the previous value before the last
7422 .ls 2 \" This causes double-spaced output
7423 .ls 3 \" This causes triple-spaced output
7424 .ls \" Again double-spaced
7427 The line spacing is associated with the current environment
7428 (@pxref{Environments}).
7430 @cindex line spacing register (@code{.L})
7431 The read-only number register @code{.L} contains the current line
7435 @xref{Changing Type Sizes}, for the requests @code{vs} and @code{pvs} as
7436 alternatives to @code{ls}.
7438 @DefescList {\\x, ', spacing, '}
7439 @DefregListEndx {.a}
7440 Sometimes, extra vertical spacing is only needed occasionally, e.g.@: to
7441 allow space for a tall construct (like an equation). The @code{\x}
7442 escape does this. The escape is given a numerical argument, usually
7443 enclosed in quotes (like @samp{\x'3p'}); the default scaling indicator
7444 is @samp{v}. If this number is positive extra vertical space is
7445 inserted below the current line. A negative number adds space above.
7446 If this escape is used multiple times on the same line, the maximum of
7449 @xref{Escapes}, for details on parameter delimiting characters.
7451 @cindex extra post-vertical line space register (@code{.a})
7452 The @code{.a} read-only number register contains the most recent
7453 (nonnegative) extra vertical line space.
7455 Using @code{\x} can be necessary in combination with the @code{\b}
7456 escape, as the following example shows.
7459 This is a test with the \[rs]b escape.
7461 This is a test with the \[rs]b escape.
7463 This is a test with \b'xyz'\x'-1m'\x'1m'.
7465 This is a test with the \[rs]b escape.
7467 This is a test with the \[rs]b escape.
7474 This is a test with the \b escape.
7475 This is a test with the \b escape.
7477 This is a test with y.
7479 This is a test with the \b escape.
7480 This is a test with the \b escape.
7486 @DefregListEndx {.ns}
7487 @cindex @code{sp} request, and no-space mode
7488 @cindex no-space mode (@code{ns})
7489 @cindex mode, no-space (@code{ns})
7490 @cindex blank lines, disabling
7491 @cindex lines, blank, disabling
7492 Enable @dfn{no-space mode}. In this mode, spacing (either via @code{sp}
7493 or via blank lines) is disabled. The @code{bp} request to advance to
7494 the next page is also disabled, except if it is accompanied by a page
7495 number (see @ref{Page Control}, for more information). This mode ends
7496 when actual text is output or the @code{rs} request is encountered, which
7497 ends no-space mode. The read-only number register @code{.ns} is set
7498 to@tie{}1 as long as no-space mode is active.
7500 This request is useful for macros that conditionally insert vertical
7501 space before the text starts (for example, a paragraph macro could
7502 insert some space except when it is the first paragraph after a section
7507 @c =====================================================================
7509 @node Tabs and Fields, Character Translations, Manipulating Spacing, gtroff Reference
7510 @section Tabs and Fields
7511 @cindex tabs, and fields
7512 @cindex fields, and tabs
7514 @cindex @acronym{EBCDIC} encoding of a tab
7515 A tab character (@acronym{ASCII} char@tie{}9, @acronym{EBCDIC}
7516 char@tie{}5) causes a horizontal movement to the next tab stop (much
7517 like it did on a typewriter).
7520 @cindex tab character, non-interpreted (@code{\t})
7521 @cindex character, tab, non-interpreted (@code{\t})
7522 @cindex @code{\t}, and copy-in mode
7523 @cindex copy-in mode, and @code{\t}
7524 @cindex mode, copy-in, and @code{\t}
7525 This escape is a non-interpreted tab character. In copy mode
7526 (@pxref{Copy-in Mode}), @code{\t} is the same as a real tab character.
7529 @DefreqList {ta, [@Var{n1} @Var{n2} @dots{} @Var{nn} @t{T} @Var{r1} @Var{r2} @dots{} @Var{rn}]}
7530 @DefregListEndx {.tabs}
7531 Change tab stop positions. This request takes a series of tab
7532 specifiers as arguments (optionally divided into two groups with the
7533 letter @samp{T}) that indicate where each tab stop is to be (overriding
7534 any previous settings).
7536 Tab stops can be specified absolutely, i.e., as the distance from the
7537 left margin. For example, the following sets 6@tie{}tab stops every one
7541 .ta 1i 2i 3i 4i 5i 6i
7544 Tab stops can also be specified using a leading @samp{+}, which means
7545 that the specified tab stop is set relative to the previous tab stop.
7546 For example, the following is equivalent to the previous example.
7549 .ta 1i +1i +1i +1i +1i +1i
7552 @code{gtroff} supports an extended syntax to specify repeat values after
7553 the @samp{T} mark (these values are always taken as relative) -- this is
7554 the usual way to specify tabs set at equal intervals. The following is,
7555 yet again, the same as the previous examples. It does even more since
7556 it defines an infinite number of tab stops separated by one inch.
7562 Now we are ready to interpret the full syntax given at the beginning:
7563 Set tabs at positions @var{n1}, @var{n2}, @dots{}, @var{nn} and then set
7564 tabs at @var{nn}+@var{r1}, @var{nn}+@var{r2}, @dots{}, @var{nn}+@var{rn}
7565 and then at @var{nn}+@var{rn}+@var{r1}, @var{nn}+@var{rn}+@var{r2},
7566 @dots{}, @var{nn}+@var{rn}+@var{rn}, and so on.
7568 Example: @samp{4c +6c T 3c 5c 2c} is equivalent to @samp{4c 10c 13c 18c
7569 20c 23c 28c 30c @dots{}}.
7571 The material in each tab column (i.e., the column between two tab stops)
7572 may be justified to the right or left or centered in the column. This
7573 is specified by appending @samp{R}, @samp{L}, or @samp{C} to the tab
7574 specifier. The default justification is @samp{L}. Example:
7584 The default unit of the @code{ta} request is @samp{m}.
7587 A tab stop is converted into a non-breakable horizontal movement that
7588 can be neither stretched nor squeezed. For example,
7597 creates a single line, which is a bit longer than 10@tie{}inches (a
7598 string is used to show exactly where the tab characters are). Now
7599 consider the following:
7608 @code{gtroff} first converts the tab stops of the line into unbreakable
7609 horizontal movements, then splits the line after the second @samp{b}
7610 (assuming a sufficiently short line length). Usually, this isn't what
7614 Superfluous tabs (i.e., tab characters that do not correspond to a tab
7615 stop) are ignored except the first one, which delimits the characters
7616 belonging to the last tab stop for right-justifying or centering.
7617 Consider the following example
7621 .ds ZZ foo\tbar\tfoobar
7622 .ds ZZZ foo\tbar\tfoo\tbar
7633 which produces the following output:
7642 The first line right-justifies the second `foo' relative to the tab
7643 stop. The second line right-justifies `foobar'. The third line finally
7644 right-justifies only `foo' because of the additional tab character, which
7645 marks the end of the string belonging to the last defined tab stop.
7648 Tab stops are associated with the current environment
7649 (@pxref{Environments}).
7652 Calling @code{ta} without an argument removes all tab stops.
7655 @cindex tab stops, for TTY output devices
7656 The start-up value of @code{gtroff} is @w{@samp{T 0.8i}}.
7659 @cindex tab settings register (@code{.tabs})
7660 The read-only number register @code{.tabs} contains a string
7661 representation of the current tab settings suitable for use as an
7662 argument to the @code{ta} request.
7665 .ds tab-string \n[.tabs]
7670 @cindex @code{.S} register, Plan@tie{}9 alias for @code{.tabs}
7671 @cindex @code{.tabs} register, Plan@tie{}9 alias (@code{.S})
7672 The @code{troff} version of the Plan@tie{}9 operating system uses
7673 register @code{.S} for the same purpose.
7676 @Defreq {tc, [@Var{fill-glyph}]}
7677 @cindex tab repetition character (@code{tc})
7678 @cindex character, tab repetition (@code{tc})
7679 @cindex glyph, tab repetition (@code{tc})
7680 Normally @code{gtroff} fills the space to the next tab stop with
7681 whitespace. This can be changed with the @code{tc} request. With no
7682 argument @code{gtroff} reverts to using whitespace, which is the
7683 default. The value of this @dfn{tab repetition character} is associated
7684 with the current environment (@pxref{Environments}).@footnote{@dfn{Tab
7685 repetition character} is a misnomer since it is an output glyph.}
7688 @DefreqList {linetabs, n}
7689 @DefregListEndx {.linetabs}
7690 @cindex tab, line-tabs mode
7691 @cindex line-tabs mode
7692 @cindex mode, line-tabs
7693 If @var{n} is missing or not zero, enable @dfn{line-tabs} mode, or
7694 disable it otherwise (the default). In line-tabs mode, @code{gtroff}
7695 computes tab distances relative to the (current) output line instead of
7698 For example, the following code:
7711 in normal mode, results in the output
7718 in line-tabs mode, the same code outputs
7724 Line-tabs mode is associated with the current environment. The
7725 read-only register @code{.linetabs} is set to@tie{}1 if in line-tabs
7726 mode, and 0 in normal mode.
7734 @c ---------------------------------------------------------------------
7736 @node Leaders, Fields, Tabs and Fields, Tabs and Fields
7740 Sometimes it may may be desirable to use the @code{tc} request to fill a
7741 particular tab stop with a given glyph (for example dots in a table of
7742 contents), but also normal tab stops on the rest of the line. For this
7743 @code{gtroff} provides an alternate tab mechanism, called @dfn{leaders},
7744 which does just that.
7746 @cindex leader character
7747 A leader character (character code@tie{}1) behaves similarly to a tab
7748 character: It moves to the next tab stop. The only difference is that
7749 for this movement, the fill glyph defaults to a period character and not
7753 @cindex leader character, non-interpreted (@code{\a})
7754 @cindex character, leader, non-interpreted (@code{\a})
7755 @cindex @code{\a}, and copy-in mode
7756 @cindex copy-in mode, and @code{\a}
7757 @cindex mode, copy-in, and @code{\a}
7758 This escape is a non-interpreted leader character. In copy mode
7759 (@pxref{Copy-in Mode}), @code{\a} is the same as a real leader
7763 @Defreq {lc, [@Var{fill-glyph}]}
7764 @cindex leader repetition character (@code{lc})
7765 @cindex character, leader repetition (@code{lc})
7766 @cindex glyph, leader repetition (@code{lc})
7767 Declare the @dfn{leader repetition character}.@footnote{@dfn{Leader
7768 repetition character} is a misnomer since it is an output glyph.}
7769 Without an argument, leaders act the same as tabs (i.e., using
7770 whitespace for filling). @code{gtroff}'s start-up value is a dot
7771 (@samp{.}). The value of the leader repetition character is associated
7772 with the current environment (@pxref{Environments}).
7775 @cindex table of contents
7776 @cindex contents, table of
7777 For a table of contents, to name an example, tab stops may be defined so
7778 that the section number is one tab stop, the title is the second with
7779 the remaining space being filled with a line of dots, and then the page
7780 number slightly separated from the dots.
7783 .ds entry 1.1\tFoo\a\t12
7793 1.1 Foo.......................................... 12
7796 @c ---------------------------------------------------------------------
7798 @node Fields, , Leaders, Tabs and Fields
7802 @cindex field delimiting character (@code{fc})
7803 @cindex delimiting character, for fields (@code{fc})
7804 @cindex character, field delimiting (@code{fc})
7805 @cindex field padding character (@code{fc})
7806 @cindex padding character, for fields (@code{fc})
7807 @cindex character, field padding (@code{fc})
7808 @dfn{Fields} are a more general way of laying out tabular data. A field
7809 is defined as the data between a pair of @dfn{delimiting characters}.
7810 It contains substrings that are separated by @dfn{padding characters}.
7811 The width of a field is the distance on the @emph{input} line from the
7812 position where the field starts to the next tab stop. A padding
7813 character inserts stretchable space similar to @TeX{}'s @code{\hss}
7814 command (thus it can even be negative) to make the sum of all substring
7815 lengths plus the stretchable space equal to the field width. If more
7816 than one padding character is inserted, the available space is evenly
7817 distributed among them.
7819 @Defreq {fc, [@Var{delim-char} [@Var{padding-char}]]}
7820 Define a delimiting and a padding character for fields. If the latter
7821 is missing, the padding character defaults to a space character. If
7822 there is no argument at all, the field mechanism is disabled (which is
7823 the default). Note that contrary to e.g.@: the tab repetition
7824 character, delimiting and padding characters are @emph{not} associated
7825 to the current environment (@pxref{Environments}).
7838 and here the result:
7847 @c =====================================================================
7849 @node Character Translations, Troff and Nroff Mode, Tabs and Fields, gtroff Reference
7850 @section Character Translations
7851 @cindex character translations
7852 @cindex translations of characters
7854 @cindex control character, changing (@code{cc})
7855 @cindex character, control, changing (@code{cc})
7856 @cindex no-break control character, changing (@code{c2})
7857 @cindex character, no-break control, changing (@code{c2})
7858 @cindex control character, no-break, changing (@code{c2})
7859 The control character (@samp{.}) and the no-break control character
7860 (@samp{'}) can be changed with the @code{cc} and @code{c2} requests,
7863 @Defreq {cc, [@Var{c}]}
7864 Set the control character to@tie{}@var{c}. With no argument the default
7865 control character @samp{.} is restored. The value of the control
7866 character is associated with the current environment
7867 (@pxref{Environments}).
7870 @Defreq {c2, [@Var{c}]}
7871 Set the no-break control character to@tie{}@var{c}. With no argument
7872 the default control character @samp{'} is restored. The value of the
7873 no-break control character is associated with the current environment
7874 (@pxref{Environments}).
7880 @cindex disabling @code{\} (@code{eo})
7881 @cindex @code{\}, disabling (@code{eo})
7882 Disable the escape mechanism completely. After executing this request,
7883 the backslash character @samp{\} no longer starts an escape sequence.
7885 This request can be very helpful in writing macros since it is not
7886 necessary then to double the escape character. Here an example:
7889 .\" This is a simplified version of the
7890 .\" .BR request from the man macro package
7894 . while (\n[.$] >= 2) \@{\
7895 . as result \fB\$1\fR\$2
7898 . if \n[.$] .as result \fB\$1
7906 @Defreq {ec, [@Var{c}]}
7907 @cindex escape character, changing (@code{ec})
7908 @cindex character, escape, changing (@code{ec})
7909 Set the escape character to@tie{}@var{c}. With no argument the default
7910 escape character @samp{\} is restored. It can be also used to re-enable
7911 the escape mechanism after an @code{eo} request.
7913 Note that changing the escape character globally likely breaks macro
7914 packages since @code{gtroff} has no mechanism to `intern' macros, i.e.,
7915 to convert a macro definition into an internal form that is independent
7916 of its representation (@TeX{} has this mechanism). If a macro is
7917 called, it is executed literally.
7921 @DefreqListEndx {ecr, }
7922 The @code{ecs} request saves the current escape character in an internal
7923 register. Use this request in combination with the @code{ec} request to
7924 temporarily change the escape character.
7926 The @code{ecr} request restores the escape character saved with
7927 @code{ecs}. Without a previous call to @code{ecs}, this request sets
7928 the escape character to @code{\}.
7931 @DefescList {\\\\, , , }
7932 @DefescItemx {\\e, , , }
7933 @DefescListEndx {\\E, , , }
7934 Print the current escape character (which is the backslash character
7935 @samp{\} by default).
7937 @code{\\} is a `delayed' backslash; more precisely, it is the default
7938 escape character followed by a backslash, which no longer has special
7939 meaning due to the leading escape character. It is @emph{not} an escape
7940 sequence in the usual sense! In any unknown escape sequence
7941 @code{\@var{X}} the escape character is ignored and @var{X} is printed.
7942 But if @var{X} is equal to the current escape character, no warning is
7945 @cindex @code{\E}, and copy-in mode
7946 @cindex copy-in mode, and @code{\E}
7947 @cindex mode, copy-in, and @code{\E}
7948 As a consequence, only at top-level or in a diversion a backslash glyph
7949 is printed; in copy-in mode, it expands to a single backslash, which then
7950 combines with the following character to an escape sequence.
7952 The @code{\E} escape differs from @code{\e} by printing an escape
7953 character that is not interpreted in copy mode. Use this to define
7954 strings with escapes that work when used in copy mode (for example, as a
7955 macro argument). The following example defines strings to begin and end
7959 .ds @{ \v'-.3m'\s'\En[.s]*60/100'
7963 Another example to demonstrate the differences between the various
7964 escape sequences, using a strange escape character, @samp{-}.
7976 The result is surprising for most users, expecting @samp{1} since
7977 @samp{foo} is a valid identifier. What has happened? As mentioned
7978 above, the leading escape character makes the following character
7979 ordinary. Written with the default escape character the sequence
7980 @samp{--} becomes @samp{\-} -- this is the minus sign.
7982 If the escape character followed by itself is a valid escape sequence,
7983 only @code{\E} yields the expected result:
7996 Similar to @code{\\}, the sequence @code{\.} isn't a real escape
7997 sequence. As before, a warning message is suppressed if the escape
7998 character is followed by a dot, and the dot itself is printed.
8015 The first backslash is consumed while the macro is read, and the second
8016 is swallowed while executing macro @code{foo}.
8019 A @dfn{translation} is a mapping of an input character to an output
8020 glyph. The mapping occurs at output time, i.e., the input character
8021 gets assigned the metric information of the mapped output character
8022 right before input tokens are converted to nodes (@pxref{Gtroff
8023 Internals}, for more on this process).
8025 @DefreqList {tr, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
8026 @DefreqListEndx {trin, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
8027 Translate character @var{a} to glyph@tie{}@var{b}, character @var{c} to
8028 glyph@tie{}@var{d}, etc. If there is an odd number of arguments, the
8029 last one is translated to an unstretchable space (@w{@samp{\ }}).
8031 The @code{trin} request is identical to @code{tr}, but when you unformat
8032 a diversion with @code{asciify} it ignores the translation.
8033 @xref{Diversions}, for details about the @code{asciify} request.
8039 @cindex @code{\(}, and translations
8040 @cindex @code{\[}, and translations
8041 @cindex @code{\'}, and translations
8042 @cindex @code{\`}, and translations
8043 @cindex @code{\-}, and translations
8044 @cindex @code{\_}, and translations
8045 @cindex @code{\C}, and translations
8046 @cindex @code{\N}, and translations
8047 @cindex @code{char} request, and translations
8048 @cindex special characters
8049 @cindex character, special
8050 @cindex numbered glyph (@code{\N})
8051 @cindex glyph, numbered (@code{\N})
8052 Special characters (@code{\(@var{xx}}, @code{\[@var{xxx}]},
8053 @code{\C'@var{xxx}'}, @code{\'}, @code{\`}, @code{\-}, @code{\_}),
8054 glyphs defined with the @code{char} request, and numbered glyphs
8055 (@code{\N'@var{xxx}'}) can be translated also.
8058 @cindex @code{\e}, and translations
8059 The @code{\e} escape can be translated also.
8062 @cindex @code{\%}, and translations
8063 @cindex @code{\~}, and translations
8064 Characters can be mapped onto the @code{\%} and @code{\~} escapes (but
8065 @code{\%} and @code{\~} can't be mapped onto another glyph).
8068 @cindex backspace character, and translations
8069 @cindex character, backspace, and translations
8070 @cindex leader character, and translations
8071 @cindex character, leader, and translations
8072 @cindex newline character, and translations
8073 @cindex character, newline, and translations
8074 @cindex tab character, and translations
8075 @cindex character, tab, and translations
8076 @cindex @code{\a}, and translations
8077 @cindex @code{\t}, and translations
8078 The following characters can't be translated: space (with one exception,
8079 see below), backspace, newline, leader (and @code{\a}), tab (and
8083 @cindex @code{shc} request, and translations
8084 Translations are not considered for finding the soft hyphen character
8085 set with the @code{shc} request.
8088 @cindex @code{\&}, and translations
8089 The pair @samp{@var{c}\&} (this is an arbitrary character@tie{}@var{c}
8090 followed by the zero width space character) maps this character to
8100 It is even possible to map the space character to nothing:
8109 As shown in the example, the space character can't be the first
8110 character/glyph pair as an argument of @code{tr}. Additionally, it is
8111 not possible to map the space character to any other glyph; requests
8112 like @w{@samp{.tr aa x}} undo @w{@samp{.tr aa \&}} instead.
8114 If justification is active, lines are justified in spite of the `empty'
8115 space character (but there is no minimal distance, i.e.@: the space
8116 character, between words).
8119 After an output glyph has been constructed (this happens at the moment
8120 immediately before the glyph is appended to an output glyph list, either
8121 by direct output, in a macro, diversion, or string), it is no longer
8122 affected by @code{tr}.
8125 Translating character to glyphs where one of them or both are undefined
8126 is possible also; @code{tr} does not check whether the entities in its
8129 @xref{Gtroff Internals}.
8132 @code{troff} no longer has a hard-coded dependency on @w{Latin-1}; all
8133 @code{char@var{XXX}} entities have been removed from the font
8134 description files. This has a notable consequence that shows up in
8135 warnings like @code{can't find character with input code @var{XXX}} if
8136 the @code{tr} request isn't handled properly.
8138 Consider the following translation:
8145 This maps input character @code{é} onto glyph @code{É}, which is
8146 identical to glyph @code{char201}. But this glyph intentionally doesn't
8147 exist! Instead, @code{\[char201]} is treated as an input character
8148 entity and is by default mapped onto @code{\['E]}, and @code{gtroff}
8149 doesn't handle translations of translations.
8151 The right way to write the above translation is
8158 In other words, the first argument of @code{tr} should be an input
8159 character or entity, and the second one a glyph entity.
8162 Without an argument, the @code{tr} request is ignored.
8166 @Defreq {trnt, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
8167 @cindex @code{\!}, and @code{trnt}
8168 @code{trnt} is the same as the @code{tr} request except that the
8169 translations do not apply to text that is transparently throughput into
8170 a diversion with @code{\!}. @xref{Diversions}, for more information.
8183 prints @samp{b} to the standard error stream; if @code{trnt} is used
8184 instead of @code{tr} it prints @samp{a}.
8188 @c =====================================================================
8190 @node Troff and Nroff Mode, Line Layout, Character Translations, gtroff Reference
8191 @section Troff and Nroff Mode
8197 Originally, @code{nroff} and @code{troff} were two separate programs,
8198 the former for TTY output, the latter for everything else. With GNU
8199 @code{troff}, both programs are merged into one executable, sending its
8200 output to a device driver (@code{grotty} for TTY devices, @code{grops}
8201 for @sc{PostScript}, etc.)@: which interprets the intermediate output of
8202 @code{gtroff}. For @acronym{UNIX} @code{troff} it makes sense to talk
8203 about @dfn{Nroff mode} and @dfn{Troff mode} since the differences are
8204 hardcoded. For GNU @code{troff}, this distinction is not appropriate
8205 because @code{gtroff} simply takes the information given in the font
8206 files for a particular device without handling requests specially if a
8207 TTY output device is used.
8209 Usually, a macro package can be used with all output devices.
8210 Nevertheless, it is sometimes necessary to make a distinction between
8211 TTY and non-TTY devices: @code{gtroff} provides two built-in conditions
8212 @samp{n} and @samp{t} for the @code{if}, @code{ie}, and @code{while}
8213 requests to decide whether @code{gtroff} shall behave like @code{nroff}
8214 or like @code{troff}.
8219 Make the @samp{t} built-in condition true (and the @samp{n} built-in
8220 condition false) for @code{if}, @code{ie}, and @code{while} conditional
8221 requests. This is the default if @code{gtroff} (@emph{not}
8222 @code{groff}) is started with the @option{-R} switch to avoid loading of
8223 the start-up files @file{troffrc} and @file{troffrc-end}. Without
8224 @option{-R}, @code{gtroff} stays in troff mode if the output device is
8225 not a TTY (e.g.@: `ps').
8230 Make the @samp{n} built-in condition true (and the @samp{t} built-in
8231 condition false) for @code{if}, @code{ie}, and @code{while} conditional
8232 requests. This is the default if @code{gtroff} uses a TTY output
8233 device; the code for switching to nroff mode is in the file
8234 @file{tty.tmac}, which is loaded by the start-up file @code{troffrc}.
8237 @xref{Conditionals and Loops}, for more details on built-in conditions.
8240 @c =====================================================================
8242 @node Line Layout, Line Control, Troff and Nroff Mode, gtroff Reference
8243 @section Line Layout
8245 @cindex layout, line
8247 @cindex dimensions, line
8248 @cindex line dimensions
8249 The following drawing shows the dimensions that @code{gtroff} uses for
8250 placing a line of output onto the page. They are labeled with the
8251 request that manipulates each dimension.
8255 |<-----------ll------------>|
8256 +----+----+----------------------+----+
8258 +----+----+----------------------+----+
8260 |<--------paper width---------------->|
8264 These dimensions are:
8268 @cindex left margin (@code{po})
8269 @cindex margin, left (@code{po})
8270 @cindex page offset (@code{po})
8271 @cindex offset, page (@code{po})
8272 @dfn{Page offset} -- this is the leftmost position of text on the final
8273 output, defining the @dfn{left margin}.
8276 @cindex indentation (@code{in})
8277 @cindex line indentation (@code{in})
8278 @dfn{Indentation} -- this is the distance from the left margin where
8282 @cindex line length (@code{ll})
8283 @cindex length of line (@code{ll})
8284 @dfn{Line length} -- this is the distance from the left margin to right
8288 A simple demonstration:
8292 This is text without indentation.
8293 The line length has been set to 3\~inch.
8296 Now the left and right margins are both increased.
8299 Calling .in and .ll without parameters restore
8300 the previous values.
8306 This is text without indenta-
8307 tion. The line length has
8312 Calling .in and .ll without
8313 parameters restore the previ-
8317 @DefreqList {po, [@Var{offset}]}
8318 @DefreqItem {po, @t{+}@Var{offset}}
8319 @DefreqItem {po, @t{-}@Var{offset}}
8320 @DefregListEndx {.o}
8322 Set horizontal page offset to @var{offset} (or increment or decrement
8323 the current value by @var{offset}). Note that this request does not
8324 cause a break, so changing the page offset in the middle of text being
8325 filled may not yield the expected result. The initial value is
8326 1@dmn{i}. For TTY output devices, it is set to 0 in the startup file
8327 @file{troffrc}; the default scaling indicator is @samp{m} (and not
8328 @samp{v} as incorrectly documented in the original @acronym{UNIX} troff
8331 The current page offset can be found in the read-only number register
8334 If @code{po} is called without an argument, the page offset is reset to
8335 the previous value before the last call to @code{po}.
8350 @DefreqList {in, [@Var{indent}]}
8351 @DefreqItem {in, @t{+}@Var{indent}}
8352 @DefreqItem {in, @t{-}@Var{indent}}
8353 @DefregListEndx {.i}
8354 Set indentation to @var{indent} (or increment or decrement the current
8355 value by @var{indent}). This request causes a break. Initially, there
8358 If @code{in} is called without an argument, the indentation is reset to
8359 the previous value before the last call to @code{in}. The default
8360 scaling indicator is @samp{m}.
8362 The indentation is associated with the current environment
8363 (@pxref{Environments}).
8365 If a negative indentation value is specified (which is not allowed),
8366 @code{gtroff} emits a warning of type @samp{range} and sets the
8367 indentation to zero.
8369 The effect of @code{in} is delayed until a partially collected line (if
8370 it exists) is output. A temporary indentation value is reset to zero
8373 The current indentation (as set by @code{in}) can be found in the
8374 read-only number register @samp{.i}.
8377 @DefreqList {ti, offset}
8378 @DefreqItem {ti, @t{+}@Var{offset}}
8379 @DefreqItem {ti, @t{-}@Var{offset}}
8380 @DefregListEndx {.in}
8381 Temporarily indent the next output line by @var{offset}. If an
8382 increment or decrement value is specified, adjust the temporary
8383 indentation relative to the value set by the @code{in} request.
8385 This request causes a break; its value is associated with the current
8386 environment (@pxref{Environments}). The default scaling indicator is
8387 @samp{m}. A call of @code{ti} without an argument is ignored.
8389 If the total indentation value is negative (which is not allowed),
8390 @code{gtroff} emits a warning of type @samp{range} and sets the
8391 temporary indentation to zero. `Total indentation' is either
8392 @var{offset} if specified as an absolute value, or the temporary plus
8393 normal indentation, if @var{offset} is given as a relative value.
8395 The effect of @code{ti} is delayed until a partially collected line (if
8396 it exists) is output.
8398 The read-only number register @code{.in} is the indentation that applies
8399 to the current output line.
8401 The difference between @code{.i} and @code{.in} is that the latter takes
8402 into account whether a partially collected line still uses the old
8403 indentation value or a temporary indentation value is active.
8406 @DefreqList {ll, [@Var{length}]}
8407 @DefreqItem {ll, @t{+}@Var{length}}
8408 @DefreqItem {ll, @t{-}@Var{length}}
8410 @DefregListEndx {.ll}
8411 Set the line length to @var{length} (or increment or decrement the
8412 current value by @var{length}). Initially, the line length is set to
8413 6.5@dmn{i}. The effect of @code{ll} is delayed until a partially
8414 collected line (if it exists) is output. The default scaling indicator
8417 If @code{ll} is called without an argument, the line length is reset to
8418 the previous value before the last call to @code{ll}. If a negative
8419 line length is specified (which is not allowed), @code{gtroff} emits a
8420 warning of type @samp{range} and sets the line length to zero.
8422 The line length is associated with the current environment
8423 (@pxref{Environments}).
8425 @cindex line length register (@code{.l})
8426 The current line length (as set by @code{ll}) can be found in the
8427 read-only number register @samp{.l}. The read-only number register
8428 @code{.ll} is the line length that applies to the current output line.
8430 Similar to @code{.i} and @code{.in}, the difference between @code{.l}
8431 and @code{.ll} is that the latter takes into account whether a partially
8432 collected line still uses the old line length value.
8436 @c =====================================================================
8438 @node Line Control, Page Layout, Line Layout, gtroff Reference
8439 @section Line Control
8440 @cindex line control
8441 @cindex control, line
8443 It is important to understand how @code{gtroff} handles input and output
8446 Many escapes use positioning relative to the input line. For example,
8450 This is a \h'|1.2i'test.
8465 The main usage of this feature is to define macros that act exactly at
8466 the place where called.
8469 .\" A simple macro to underline a word
8471 . nop \\$1\l'|0\[ul]'
8476 In the above example, @samp{|0} specifies a negative distance from the
8477 current position (at the end of the just emitted argument @code{\$1})
8478 back to the beginning of the input line. Thus, the @samp{\l} escape
8479 draws a line from right to left.
8481 @cindex input line continuation (@code{\})
8482 @cindex line, input, continuation (@code{\})
8483 @cindex continuation, input line (@code{\})
8484 @cindex output line, continuation (@code{\c})
8485 @cindex line, output, continuation (@code{\c})
8486 @cindex continuation, output line (@code{\c})
8487 @cindex interrupted line
8488 @cindex line, interrupted
8489 @code{gtroff} makes a difference between input and output line
8490 continuation; the latter is also called @dfn{interrupting} a line.
8492 @DefescList {\\@key{RET}, , ,}
8493 @DefescItemx {\\c, , ,}
8494 @DefregListEndx {.int}
8495 Continue a line. @code{\@key{RET}} (this is a backslash at the end of a
8496 line immediately followed by a newline) works on the input level,
8497 suppressing the effects of the following newline in the input.
8502 @result{} This is a .test
8505 The @samp{|} operator is also affected.
8507 @cindex @code{\R}, after @code{\c}
8508 @code{\c} works on the output level. Anything after this escape on the
8509 same line is ignored except @code{\R}, which works as usual. Anything
8510 before @code{\c} on the same line is appended to the current partial
8511 output line. The next non-command line after an interrupted line counts
8512 as a new input line.
8514 The visual results depend on whether no-fill mode is active.
8518 @cindex @code{\c}, and no-fill mode
8519 @cindex no-fill mode, and @code{\c}
8520 @cindex mode, no-fill, and @code{\c}
8521 If no-fill mode is active (using the @code{nf} request), the next input
8522 text line after @code{\c} is handled as a continuation of the same input
8529 @result{} This is a test.
8533 @cindex @code{\c}, and fill mode
8534 @cindex fill mode, and @code{\c}
8535 @cindex mode, fill, and @code{\c}
8536 If fill mode is active (using the @code{fi} request), a word interrupted
8537 with @code{\c} is continued with the text on the next input text line,
8538 without an intervening space.
8543 @result{} This is a test.
8547 Note that an intervening control line that causes a break is stronger
8548 than @code{\c}, flushing out the current partial line in the usual way.
8550 @cindex interrupted line register (@code{.int})
8551 The @code{.int} register contains a positive value if the last output
8552 line was interrupted with @code{\c}; this is associated with the current
8553 environment (@pxref{Environments}).
8557 @c =====================================================================
8559 @node Page Layout, Page Control, Line Control, gtroff Reference
8560 @section Page Layout
8562 @cindex layout, page
8564 @code{gtroff} provides some very primitive operations for controlling
8567 @DefreqList {pl, [@Var{length}]}
8568 @DefreqItem {pl, @t{+}@Var{length}}
8569 @DefreqItem {pl, @t{-}@Var{length}}
8570 @DefregListEndx {.p}
8571 @cindex page length (@code{pl})
8572 @cindex length of page (@code{pl})
8573 Set the @dfn{page length} to @var{length} (or increment or decrement the
8574 current value by @var{length}). This is the length of the physical
8575 output page. The default scaling indicator is @samp{v}.
8577 @cindex page length register (@code{.p})
8578 The current setting can be found in the read-only number register
8583 @cindex bottom margin
8584 @cindex margin, bottom
8585 Note that this only specifies the size of the page, not the top and
8586 bottom margins. Those are not set by @code{gtroff} directly.
8587 @xref{Traps}, for further information on how to do this.
8589 Negative @code{pl} values are possible also, but not very useful: No
8590 trap is sprung, and each line is output on a single page (thus
8591 suppressing all vertical spacing).
8593 If no argument or an invalid argument is given, @code{pl} sets the page
8594 length to 11@dmn{i}.
8600 @code{gtroff} provides several operations that help in setting up top
8601 and bottom titles (or headers and footers).
8603 @Defreq {tl, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}}
8604 @cindex title line (@code{tl})
8605 @cindex three-part title (@code{tl})
8606 @cindex page number character (@code{%})
8607 Print a @dfn{title line}. It consists of three parts: a left justified
8608 portion, a centered portion, and a right justified portion. The
8609 argument separator @samp{'} can be replaced with any character not
8610 occurring in the title line. The @samp{%} character is replaced with
8611 the current page number. This character can be changed with the
8612 @code{pc} request (see below).
8614 Without argument, @code{tl} is ignored.
8620 The line length set by the @code{ll} request is not honoured by
8621 @code{tl}; use the @code{lt} request (described below) instead, to
8622 control line length for text set by @code{tl}.
8625 A title line is not restricted to the top or bottom of a page.
8628 @code{tl} prints the title line immediately, ignoring a partially filled
8629 line (which stays untouched).
8632 It is not an error to omit closing delimiters. For example,
8633 @w{@samp{.tl /foo}} is equivalent to @w{@samp{.tl /foo///}}: It prints a
8634 title line with the left justified word @samp{foo}; the centered and
8635 right justfied parts are empty.
8638 @code{tl} accepts the same parameter delimiting characters as the
8639 @code{\A} escape; see @ref{Escapes}.
8643 @DefreqList {lt, [@Var{length}]}
8644 @DefreqItem {lt, @t{+}@Var{length}}
8645 @DefreqItem {lt, @t{-}@Var{length}}
8646 @DefregListEndx {.lt}
8647 @cindex length of title line (@code{lt})
8648 @cindex title line, length (@code{lt})
8649 @cindex title line length register (@code{.lt})
8650 The title line is printed using its own line length, which is specified
8651 (or incremented or decremented) with the @code{lt} request. Initially,
8652 the title line length is set to 6.5@dmn{i}. If a negative line length
8653 is specified (which is not allowed), @code{gtroff} emits a warning of
8654 type @samp{range} and sets the title line length to zero. The default
8655 scaling indicator is @samp{m}. If @code{lt} is called without an
8656 argument, the title length is reset to the previous value before the
8657 last call to @code{lt}.
8659 The current setting of this is available in the @code{.lt} read-only
8660 number register; it is associated with the current environment
8661 (@pxref{Environments}).
8664 @DefreqList {pn, page}
8665 @DefreqItem {pn, @t{+}@Var{page}}
8666 @DefreqItem {pn, @t{-}@Var{page}}
8667 @DefregListEndx {.pn}
8668 @cindex page number (@code{pn})
8669 @cindex number, page (@code{pn})
8670 Change (increase or decrease) the page number of the @emph{next} page.
8671 The only argument is the page number; the request is ignored without a
8674 The read-only number register @code{.pn} contains the number of the next
8675 page: either the value set by a @code{pn} request, or the number of the
8676 current page plus@tie{}1.
8679 @Defreq {pc, [@Var{char}]}
8680 @cindex changing the page number character (@code{pc})
8681 @cindex page number character, changing (@code{pc})
8683 Change the page number character (used by the @code{tl} request) to a
8684 different character. With no argument, this mechanism is disabled.
8685 Note that this doesn't affect the number register@tie{}@code{%}.
8691 @c =====================================================================
8693 @node Page Control, Fonts and Symbols, Page Layout, gtroff Reference
8694 @section Page Control
8695 @cindex page control
8696 @cindex control, page
8698 @DefreqList {bp, [@Var{page}]}
8699 @DefreqItem {bp, @t{+}@Var{page}}
8700 @DefreqItem {bp, @t{-}@Var{page}}
8702 @cindex new page (@code{bp})
8703 @cindex page, new (@code{bp})
8704 Stop processing the current page and move to the next page. This
8705 request causes a break. It can also take an argument to set (increase,
8706 decrease) the page number of the next page (which actually becomes the
8707 current page after @code{bp} has finished). The difference between
8708 @code{bp} and @code{pn} is that @code{pn} does not cause a break or
8709 actually eject a page. @xref{Page Layout}.
8712 .de newpage \" define macro
8714 'sp .5i \" vertical space
8715 .tl 'left top'center top'right top' \" title
8716 'sp .3i \" vertical space
8720 @cindex @code{bp} request, and top-level diversion
8721 @cindex top-level diversion, and @code{bp}
8722 @cindex diversion, top-level, and @code{bp}
8723 @code{bp} has no effect if not called within the top-level diversion
8724 (@pxref{Diversions}).
8726 @cindex page number register (@code{%})
8727 @cindex current page number (@code{%})
8728 The read-write register@tie{}@code{%} holds the current page number.
8730 The number register @code{.pe} is set to@tie{}1 while @code{bp} is
8731 active. @xref{Page Location Traps}.
8734 @Defreq {ne, [@Var{space}]}
8735 @cindex orphan lines, preventing with @code{ne}
8736 @cindex conditional page break (@code{ne})
8737 @cindex page break, conditional (@code{ne})
8738 It is often necessary to force a certain amount of space before a new
8739 page occurs. This is most useful to make sure that there is not a
8740 single @dfn{orphan} line left at the bottom of a page. The @code{ne}
8741 request ensures that there is a certain distance, specified by the first
8742 argument, before the next page is triggered (see @ref{Traps}, for
8743 further information). The default scaling indicator for @code{ne} is
8744 @samp{v}; the default value of @var{space} is@tie{}1@dmn{v} if no
8747 For example, to make sure that no fewer than 2@tie{}lines get orphaned,
8748 do the following before each paragraph:
8755 @code{ne} then automatically causes a page break if there is space for
8759 @DefreqList {sv, [@Var{space}]}
8760 @DefreqListEndx {os, }
8761 @cindex @code{ne} request, comparison with @code{sv}
8762 @code{sv} is similar to the @code{ne} request; it reserves the specified
8763 amount of vertical space. If the desired amount of space exists before
8764 the next trap (or the bottom page boundary if no trap is set), the space
8765 is output immediately (ignoring a partially filled line, which stays
8766 untouched). If there is not enough space, it is stored for later output
8767 via the @code{os} request. The default value is@tie{}1@dmn{v} if no
8768 argument is given; the default scaling indicator is @samp{v}.
8770 @cindex @code{sv} request, and no-space mode
8771 @cindex @code{os} request, and no-space mode
8772 Both @code{sv} and @code{os} ignore no-space mode. While the @code{sv}
8773 request allows negative values for @var{space}, @code{os} ignores them.
8777 @cindex current vertical position (@code{nl})
8778 @cindex vertical position, current (@code{nl})
8779 @cindex position, vertical, current (@code{nl})
8780 This register contains the current vertical position. If the vertical
8781 position is zero and the top of page transition hasn't happened yet,
8782 @code{nl} is set to negative value. @code{gtroff} itself does this at
8783 the very beginning of a document before anything has been printed, but
8784 the main usage is to plant a header trap on a page if this page has
8787 Consider the following:
8819 Without resetting @code{nl} to a negative value, the just planted trap
8820 would be active beginning with the @emph{next} page, not the current
8823 @xref{Diversions}, for a comparison with the @code{.h} and @code{.d}
8828 @c =====================================================================
8830 @node Fonts and Symbols, Sizes, Page Control, gtroff Reference
8831 @section Fonts and Symbols
8834 @code{gtroff} can switch fonts at any point in the text.
8836 The basic set of fonts is @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
8837 These are Times Roman, Italic, Bold, and Bold Italic. For non-TTY
8838 devices, there is also at least one symbol font that contains various
8839 special symbols (Greek, mathematics).
8846 * Character Classes::
8848 * Artificial Fonts::
8849 * Ligatures and Kerning::
8852 @c ---------------------------------------------------------------------
8854 @node Changing Fonts, Font Families, Fonts and Symbols, Fonts and Symbols
8855 @subsection Changing Fonts
8858 @DefreqList {ft, [@Var{font}]}
8859 @DefescItemx {\\f, , f, }
8860 @DefescItem {\\f, @Lparen{}, fn, }
8861 @DefescItem {\\f, @Lbrack{}, font, @Rbrack{}}
8862 @DefregListEndx {.sty}
8863 @cindex changing fonts (@code{ft}, @code{\f})
8864 @cindex fonts, changing (@code{ft}, @code{\f})
8865 @cindex @code{sty} request, and changing fonts
8866 @cindex @code{fam} request, and changing fonts
8867 @cindex @code{\F}, and changing fonts
8871 The @code{ft} request and the @code{\f} escape change the current font
8872 to @var{font} (one-character name@tie{}@var{f}, two-character name
8875 If @var{font} is a style name (as set with the @code{sty} request or
8876 with the @code{styles} command in the @file{DESC} file), use it within
8877 the current font family (as set with the @code{fam} request, @code{\F}
8878 escape, or with the @code{family} command in the @file{DESC} file).
8880 It is not possible to switch to a font with the name @samp{DESC}
8881 (whereas this name could be used as a style name; however, this is not
8884 @cindex previous font (@code{ft}, @code{\f[]}, @code{\fP})
8885 @cindex font, previous (@code{ft}, @code{\f[]}, @code{\fP})
8886 With no argument or using @samp{P} as an argument, @code{.ft} switches
8887 to the previous font. Use @code{\f[]} to do this with the escape. The
8888 old syntax forms @code{\fP} or @code{\f[P]} are also supported.
8890 Fonts are generally specified as upper-case strings, which are usually
8891 1@tie{}to 4 characters representing an abbreviation or acronym of the
8892 font name. This is no limitation, just a convention.
8894 The example below produces two identical lines.
8903 eggs, bacon, \fBspam\fP and sausage.
8906 Note that @code{\f} doesn't produce an input token in @code{gtroff}. As
8907 a consequence, it can be used in requests like @code{mc} (which expects
8908 a single character as an argument) to change the font on the fly:
8914 The current style name is available in the read-only number register
8915 @samp{.sty} (this is a string-valued register); if the current font
8916 isn't a style, the empty string is returned. It is associated with the
8917 current environment.
8919 @xref{Font Positions}, for an alternative syntax.
8922 @Defreq {ftr, f [@Var{g}]}
8923 @cindex font translation (@code{ftr})
8924 @cindex @code{ft} request, and font translations
8925 @cindex @code{ul} request, and font translations
8926 @cindex @code{bd} request, and font translations
8927 @cindex @code{\f}, and font translations
8928 @cindex @code{cs} request, and font translations
8929 @cindex @code{tkf} request, and font translations
8930 @cindex @code{special} request, and font translations
8931 @cindex @code{fspecial} request, and font translations
8932 @cindex @code{fp} request, and font translations
8933 @cindex @code{sty} request, and font translations
8934 @cindex @code{if} request, and font translations
8935 @cindex @code{ie} request, and font translations
8936 @cindex @code{while} request, and font translations
8937 Translate font@tie{}@var{f} to font@tie{}@var{g}. Whenever a font
8938 named@tie{}@var{f} is referred to in a @code{\f} escape sequence, in the
8939 @code{F} and @code{S} conditional operators, or in the @code{ft},
8940 @code{ul}, @code{bd}, @code{cs}, @code{tkf}, @code{special},
8941 @code{fspecial}, @code{fp}, or @code{sty} requests, font@tie{}@var{g} is
8942 used. If @var{g} is missing or equal to@tie{}@var{f} the translation is
8945 Note that it is not possible to chain font translations. Example:
8951 @result{} warning: can't find font `XXX'
8955 @DefreqList {fzoom, f [@Var{zoom}]}
8956 @DefregListEndx {.zoom}
8957 @cindex magnification of a font (@code{fzoom})
8958 @cindex font, magnification (@code{fzoom})
8959 @cindex zoom factor of a font (@code{fzoom})
8960 @cindex factor, zoom, of a font (@code{fzoom})
8961 @cindex font, zoom factor (@code{fzoom})
8962 @cindex optical size of a font
8963 @cindex font, optical size
8964 @cindex size, optical, of a font
8965 Set magnification of font@tie{}@var{f} to factor @var{zoom}, which must
8966 be a non-negative integer multiple of 1/1000th. This request is useful
8967 to adjust the optical size of a font in relation to the others. In the
8968 example below, font @code{CR} is magnified by 10% (the zoom factor is
8975 Palatino and \f[CR]Courier\f[]
8978 A missing or zero value of @var{zoom} is the same as a value of 1000,
8979 which means no magnification. @var{f}@tie{}must be a real font name,
8982 Note that the magnification of a font is completely transparent to
8983 troff; a change of the zoom factor doesn't cause any effect except that
8984 the dimensions of glyphs, (word) spaces, kerns, etc., of the affected
8985 font are adjusted accordingly.
8987 The zoom factor of the current font is available in the read-only number
8988 register @samp{.zoom}, in multiples of 1/1000th. It returns zero if
8989 there is no magnification.
8992 @c ---------------------------------------------------------------------
8994 @node Font Families, Font Positions, Changing Fonts, Fonts and Symbols
8995 @subsection Font Families
8996 @cindex font families
8997 @cindex families, font
8999 @cindex styles, font
9001 Due to the variety of fonts available, @code{gtroff} has added the
9002 concept of @dfn{font families} and @dfn{font styles}. The fonts are
9003 specified as the concatenation of the font family and style. Specifying
9004 a font without the family part causes @code{gtroff} to use that style of
9007 @cindex PostScript fonts
9008 @cindex fonts, PostScript
9009 Currently, fonts for the devices @option{-Tps}, @option{-Tpdf},
9010 @option{-Tdvi}, @option{-Tlj4}, @option{-Tlbp}, and the X11 fonts are
9011 set up to this mechanism. By default, @code{gtroff} uses the Times
9012 family with the four styles @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
9014 This way, it is possible to use the basic four fonts and to select a
9015 different font family on the command line (@pxref{Groff Options}).
9017 @DefreqList {fam, [@Var{family}]}
9019 @DefescItemx {\\F, , f, }
9020 @DefescItem {\\F, @Lparen{}, fm, }
9021 @DefescItem {\\F, @Lbrack{}, family, @Rbrack{}}
9022 @DefregListEndx {.fn}
9023 @cindex changing font family (@code{fam}, @code{\F})
9024 @cindex font family, changing (@code{fam}, @code{\F})
9025 Switch font family to @var{family} (one-character name@tie{}@var{f},
9026 two-character name @var{fm}). If no argument is given, switch back to
9027 the previous font family. Use @code{\F[]} to do this with the escape.
9028 Note that @code{\FP} doesn't work; it selects font family @samp{P}
9031 The value at start-up is @samp{T}. The current font family is available
9032 in the read-only number register @samp{.fam} (this is a string-valued
9033 register); it is associated with the current environment.
9037 .fam H \" helvetica family
9038 spam, \" used font is family H + style R = HR
9039 .ft B \" family H + style B = font HB
9041 .fam T \" times family
9042 spam, \" used font is family T + style B = TB
9043 .ft AR \" font AR (not a style)
9045 .ft R \" family T + style R = font TR
9049 Note that @code{\F} doesn't produce an input token in @code{gtroff}. As
9050 a consequence, it can be used in requests like @code{mc} (which expects
9051 a single character as an argument) to change the font family on the fly:
9057 The @samp{.fn} register contains the current @dfn{real font name} of the
9058 current font. This is a string-valued register. If the current font is
9059 a style, the value of @code{\n[.fn]} is the proper concatenation of
9060 family and style name.
9063 @Defreq {sty, n style}
9064 @cindex changing font style (@code{sty})
9065 @cindex font style, changing (@code{sty})
9066 @cindex @code{cs} request, and font styles
9067 @cindex @code{bd} request, and font styles
9068 @cindex @code{tkf} request, and font styles
9069 @cindex @code{uf} request, and font styles
9070 @cindex @code{fspecial} request, and font styles
9071 Associate @var{style} with font position@tie{}@var{n}. A font position
9072 can be associated either with a font or with a style. The current font
9073 is the index of a font position and so is also either a font or a style.
9074 If it is a style, the font that is actually used is the font which name
9075 is the concatenation of the name of the current family and the name of
9076 the current style. For example, if the current font is@tie{}1 and font
9077 position@tie{}1 is associated with style @samp{R} and the current font
9078 family is @samp{T}, then font @samp{TR} is used. If the current font is
9079 not a style, then the current family is ignored. If the requests
9080 @code{cs}, @code{bd}, @code{tkf}, @code{uf}, or @code{fspecial} are
9081 applied to a style, they are instead applied to the member of the
9082 current family corresponding to that style.
9084 @var{n}@tie{}must be a non-negative integer value.
9088 The default family can be set with the @option{-f} option (@pxref{Groff
9089 Options}). The @code{styles} command in the @file{DESC} file controls
9090 which font positions (if any) are initially associated with styles
9091 rather than fonts. For example, the default setting for @sc{PostScript}
9108 @code{fam} and @code{\F} always check whether the current font position
9109 is valid; this can give surprising results if the current font position
9110 is associated with a style.
9112 In the following example, we want to access the @sc{PostScript} font
9113 @code{FooBar} from the font family @code{Foo}:
9118 @result{} warning: can't find font `FooR'
9122 The default font position at start-up is@tie{}1; for the @sc{PostScript}
9123 device, this is associated with style @samp{R}, so @code{gtroff} tries
9124 to open @code{FooR}.
9126 A solution to this problem is to use a dummy font like the following:
9129 .fp 0 dummy TR \" set up dummy font at position 0
9130 .sty \n[.fp] Bar \" register style `Bar'
9131 .ft 0 \" switch to font at position 0
9132 .fam Foo \" activate family `Foo'
9133 .ft Bar \" switch to font `FooBar'
9136 @xref{Font Positions}.
9139 @c ---------------------------------------------------------------------
9141 @node Font Positions, Using Symbols, Font Families, Fonts and Symbols
9142 @subsection Font Positions
9143 @cindex font positions
9144 @cindex positions, font
9146 For the sake of old phototypesetters and compatibility with old versions
9147 of @code{troff}, @code{gtroff} has the concept of font @dfn{positions},
9148 on which various fonts are mounted.
9150 @DefreqList {fp, pos font [@Var{external-name}]}
9152 @DefregListEndx {.fp}
9153 @cindex mounting font (@code{fp})
9154 @cindex font, mounting (@code{fp})
9155 Mount font @var{font} at position @var{pos} (which must be a
9156 non-negative integer). This numeric position can then be referred to
9157 with font changing commands. When @code{gtroff} starts it is using font
9158 position@tie{}1 (which must exist; position@tie{}0 is unused usually at
9161 @cindex font position register (@code{.f})
9162 The current font in use, as a font position, is available in the
9163 read-only number register @samp{.f}. This can be useful to remember the
9164 current font for later recall. It is associated with the current
9165 environment (@pxref{Environments}).
9168 .nr save-font \n[.f]
9170 ... text text text ...
9174 @cindex next free font position register (@code{.fp})
9175 The number of the next free font position is available in the read-only
9176 number register @samp{.fp}. This is useful when mounting a new font,
9180 .fp \n[.fp] NEATOFONT
9183 @pindex DESC@r{, and font mounting}
9184 Fonts not listed in the @file{DESC} file are automatically mounted on
9185 the next available font position when they are referenced. If a font is
9186 to be mounted explicitly with the @code{fp} request on an unused font
9187 position, it should be mounted on the first unused font position, which
9188 can be found in the @code{.fp} register. Although @code{gtroff} does
9189 not enforce this strictly, it is not allowed to mount a font at a
9190 position whose number is much greater (approx.@: 1000 positions) than
9191 that of any currently used position.
9193 The @code{fp} request has an optional third argument. This argument
9194 gives the external name of the font, which is used for finding the font
9195 description file. The second argument gives the internal name of the
9196 font, which is used to refer to the font in @code{gtroff} after it has
9197 been mounted. If there is no third argument then the internal name is
9198 used as the external name. This feature makes it possible to use fonts
9199 with long names in compatibility mode.
9202 Both the @code{ft} request and the @code{\f} escape have alternative
9203 syntax forms to access font positions.
9205 @DefreqList {ft, nnn}
9206 @DefescItemx {\\f, , n, }
9207 @DefescItem {\\f, @Lparen{}, nn, }
9208 @DefescListEnd {\\f, @Lbrack{}, nnn, @Rbrack{}}
9209 @cindex changing font position (@code{\f})
9210 @cindex font position, changing (@code{\f})
9211 @cindex @code{sty} request, and font positions
9212 @cindex @code{fam} request, and font positions
9213 @cindex @code{\F}, and font positions
9217 Change the current font position to @var{nnn} (one-digit
9218 position@tie{}@var{n}, two-digit position @var{nn}), which must be a
9219 non-negative integer.
9221 If @var{nnn} is associated with a style (as set with the @code{sty}
9222 request or with the @code{styles} command in the @file{DESC} file), use
9223 it within the current font family (as set with the @code{fam} request,
9224 the @code{\F} escape, or with the @code{family} command in the
9231 .ft \" switch back to font 1
9235 this is font 1 again
9238 @xref{Changing Fonts}, for the standard syntax form.
9241 @c ---------------------------------------------------------------------
9243 @node Using Symbols, Character Classes, Font Positions, Fonts and Symbols
9244 @subsection Using Symbols
9245 @cindex using symbols
9246 @cindex symbols, using
9251 A @dfn{glyph} is a graphical representation of a @dfn{character}. While
9252 a character is an abstract entity containing semantic information, a
9253 glyph is something that can be actually seen on screen or paper. It is
9254 possible that a character has multiple glyph representation forms (for
9255 example, the character `A' can be either written in a roman or an italic
9256 font, yielding two different glyphs); sometimes more than one character
9257 maps to a single glyph (this is a @dfn{ligature} -- the most common is
9261 @cindex special fonts
9264 @cindex @code{special} request, and glyph search order
9265 @cindex @code{fspecial} request, and glyph search order
9266 A @dfn{symbol} is simply a named glyph. Within @code{gtroff}, all glyph
9267 names of a particular font are defined in its font file. If the user
9268 requests a glyph not available in this font, @code{gtroff} looks up an
9269 ordered list of @dfn{special fonts}. By default, the @sc{PostScript}
9270 output device supports the two special fonts @samp{SS} (slanted symbols)
9271 and @samp{S} (symbols) (the former is looked up before the latter).
9272 Other output devices use different names for special fonts. Fonts
9273 mounted with the @code{fonts} keyword in the @file{DESC} file are
9274 globally available. To install additional special fonts locally (i.e.@:
9275 for a particular font), use the @code{fspecial} request.
9277 Here the exact rules how @code{gtroff} searches a given symbol:
9281 If the symbol has been defined with the @code{char} request, use it.
9282 This hides a symbol with the same name in the current font.
9285 Check the current font.
9288 If the symbol has been defined with the @code{fchar} request, use it.
9291 Check whether the current font has a font-specific list of special
9292 fonts; test all fonts in the order of appearance in the last
9293 @code{fspecial} call if appropriate.
9296 If the symbol has been defined with the @code{fschar} request for the
9297 current font, use it.
9300 Check all fonts in the order of appearance in the last @code{special}
9304 If the symbol has been defined with the @code{schar} request, use it.
9307 As a last resort, consult all fonts loaded up to now for special fonts
9308 and check them, starting with the lowest font number. Note that this
9309 can sometimes lead to surprising results since the @code{fonts} line in
9310 the @file{DESC} file often contains empty positions, which are filled
9311 later on. For example, consider the following:
9318 This mounts font @code{foo} at font position@tie{}3. We assume that
9319 @code{FOO} is a special font, containing glyph @code{foo}, and that no
9320 font has been loaded yet. The line
9327 makes font @code{BAZ} special only if font @code{BAR} is active. We
9328 further assume that @code{BAZ} is really a special font, i.e., the font
9329 description file contains the @code{special} keyword, and that it also
9330 contains glyph @code{foo} with a special shape fitting to font
9331 @code{BAR}. After executing @code{fspecial}, font @code{BAR} is loaded
9332 at font position@tie{}1, and @code{BAZ} at position@tie{}2.
9334 We now switch to a new font @code{XXX}, trying to access glyph
9335 @code{foo} that is assumed to be missing. There are neither
9336 font-specific special fonts for @code{XXX} nor any other fonts made
9337 special with the @code{special} request, so @code{gtroff} starts the
9338 search for special fonts in the list of already mounted fonts, with
9339 increasing font positions. Consequently, it finds @code{BAZ} before
9340 @code{FOO} even for @code{XXX}, which is not the intended behaviour.
9343 @xref{Font Files}, and @ref{Special Fonts}, for more details.
9345 @cindex list of available glyphs (@cite{groff_char(7)} man page)
9346 @cindex available glyphs, list (@cite{groff_char(7)} man page)
9347 @cindex glyphs, available, list (@cite{groff_char(7)} man page)
9348 The list of available symbols is device dependent; see the
9349 @cite{groff_char(7)} man page for a complete list of all glyphs. For
9353 man -Tdvi groff_char > groff_char.dvi
9357 for a list using the default DVI fonts (not all versions of the
9358 @code{man} program support the @option{-T} option). If you want to use
9359 an additional macro package to change the used fonts, @code{groff} must
9363 groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
9366 @cindex composite glyph names
9367 @cindex glyph names, composite
9368 @cindex groff glyph list (GGL)
9369 @cindex GGL (groff glyph list)
9370 @cindex adobe glyph list (AGL)
9371 @cindex AGL (adobe glyph list)
9372 Glyph names not listed in groff_char(7) are derived algorithmically,
9373 using a simplified version of the Adobe Glyph List (AGL) algorithm, which
9375 @uref{http://partners.adobe.com@//public@//developer@//opentype@//index_glyph.html}.
9376 The (frozen) set of glyph names that can't be derived algorithmically
9377 is called @dfn{groff glyph list (GGL)}.
9381 A glyph for Unicode character U+@var{XXXX}[@var{X}[@var{X}]], which is
9382 not a composite character is named
9383 @code{u@var{XXXX}@r{[}@var{X}@r{[}@var{X}@r{]]}}. @var{X} must be an
9384 uppercase hexadecimal digit. Examples: @code{u1234}, @code{u008E},
9385 @code{u12DB8}. The largest Unicode value is 0x10FFFF. There must be at
9386 least four @code{X} digits; if necessary, add leading zeroes (after the
9387 @samp{u}). No zero padding is allowed for character codes greater than
9388 0xFFFF. Surrogates (i.e., Unicode values greater than 0xFFFF
9389 represented with character codes from the surrogate area U+D800-U+DFFF)
9390 are not allowed too.
9393 A glyph representing more than a single input character is named
9396 @samp{u} @var{component1} @samp{_} @var{component2} @samp{_} @var{component3} @dots{}
9400 Example: @code{u0045_0302_0301}.
9402 For simplicity, all Unicode characters that are composites must be
9403 decomposed maximally (this is normalization form@tie{}D in the Unicode
9404 standard); for example, @code{u00CA_0301} is not a valid glyph name
9405 since U+00CA (@sc{latin capital letter e with circumflex}) can be
9406 further decomposed into U+0045 (@sc{latin capital letter e}) and U+0302
9407 (@sc{combining circumflex accent}). @code{u0045_0302_0301} is thus the
9408 glyph name for U+1EBE, @sc{latin capital letter e with circumflex and
9412 groff maintains a table to decompose all algorithmically derived glyph
9413 names that are composites itself. For example, @code{u0100} (@sc{latin
9414 letter a with macron}) is automatically decomposed into
9415 @code{u0041_0304}. Additionally, a glyph name of the GGL is preferred
9416 to an algorithmically derived glyph name; groff also automatically does
9417 the mapping. Example: The glyph @code{u0045_0302} is mapped to
9421 glyph names of the GGL can't be used in composite glyph names; for
9422 example, @code{^E_u0301} is invalid.
9425 @DefescList {\\, @Lparen{}, nm, }
9426 @DefescItem {\\, @Lbrack{}, name, @Rbrack{}}
9427 @DefescListEnd {\\, @Lbrack{}, component1 component2 @dots{}, @Rbrack{}}
9428 Insert a symbol @var{name} (two-character name @var{nm}) or a composite
9429 glyph with component glyphs @var{component1}, @var{component2},
9430 @enddots{} There is no special syntax for one-character names -- the
9431 natural form @samp{\@var{n}} would collide with escapes.@footnote{Note
9432 that a one-character symbol is not the same as an input character, i.e.,
9433 the character @code{a} is not the same as @code{\[a]}. By default,
9434 @code{groff} defines only a single one-character symbol, @code{\[-]}; it
9435 is usually accessed as @code{\-}. On the other hand, @code{gtroff} has
9436 the special feature that @code{\[char@var{XXX}]} is the same as the
9437 input character with character code @var{XXX}. For example,
9438 @code{\[char97]} is identical to the letter @code{a} if @acronym{ASCII}
9439 encoding is active.}
9441 If @var{name} is undefined, a warning of type @samp{char} is generated,
9442 and the escape is ignored. @xref{Debugging}, for information about
9445 groff resolves @code{\[...]} with more than a single component as
9450 Any component that is found in the GGL is converted to the
9451 @code{u@var{XXXX}} form.
9454 Any component @code{u@var{XXXX}} that is found in the list of
9455 decomposable glyphs is decomposed.
9458 The resulting elements are then concatenated with @samp{_} in between,
9459 dropping the leading @samp{u} in all elements but the first.
9462 No check for the existence of any component (similar to @code{tr}
9469 @samp{A} maps to @code{u0041}, @samp{ho} maps to @code{u02DB}, thus the
9470 final glyph name would be @code{u0041_02DB}. Note this is not the
9471 expected result: The ogonek glyph @samp{ho} is a spacing ogonek, but for
9472 a proper composite a non-spacing ogonek (U+0328) is necessary. Looking
9473 into the file @file{composite.tmac} one can find @w{@samp{.composite ho
9474 u0328}}, which changes the mapping of @samp{ho} while a composite glyph
9475 name is constructed, causing the final glyph name to be
9482 @samp{^E} maps to @code{u0045_0302}, thus the final glyph name is
9483 @code{u0045_0302_0301} in all forms (assuming proper calls of the
9484 @code{composite} request).
9487 It is not possible to define glyphs with names like @w{@samp{A ho}}
9488 within a groff font file. This is not really a limitation; instead, you
9489 have to define @code{u0041_0328}.
9492 @Defesc {\\C, ', xxx, '}
9493 @cindex named character (@code{\C})
9494 @cindex character, named (@code{\C})
9495 Typeset the glyph named @var{xxx}.@footnote{@code{\C} is actually a
9496 misnomer since it accesses an output glyph.} Normally it is more
9497 convenient to use @code{\[@var{xxx}]}, but @code{\C} has the advantage
9498 that it is compatible with newer versions of @acronym{AT&T} @code{troff}
9499 and is available in compatibility mode.
9502 @Defreq {composite, from to}
9503 @pindex composite.tmac
9504 Map glyph name @var{from} to glyph name @var{to} if it is used in
9505 @code{\[...]} with more than one component. See above for examples.
9507 This mapping is based on glyph names only; no check for the existence of
9508 either glyph is done.
9510 A set of default mappings for many accents can be found in the file
9511 @file{composite.tmac}, which is loaded at start-up.
9514 @Defesc {\\N, ', n, '}
9515 @cindex numbered glyph (@code{\N})
9516 @cindex glyph, numbered (@code{\N})
9517 @cindex @code{char} request, used with @code{\N}
9519 Typeset the glyph with code@tie{}@var{n} in the current font
9520 (@code{n}@tie{}is @strong{not} the input character code). The number
9521 @var{n}@tie{}can be any non-negative decimal integer. Most devices only
9522 have glyphs with codes between 0 and@tie{}255; the Unicode output device
9523 uses codes in the range 0--65535. If the current font does not contain
9524 a glyph with that code, special fonts are @emph{not} searched. The
9525 @code{\N} escape sequence can be conveniently used in conjunction with
9526 the @code{char} request:
9529 .char \[phone] \f[ZD]\N'37'
9534 @cindex unnamed glyphs
9535 @cindex glyphs, unnamed
9536 The code of each glyph is given in the fourth column in the font
9537 description file after the @code{charset} command. It is possible to
9538 include unnamed glyphs in the font description file by using a name of
9539 @samp{---}; the @code{\N} escape sequence is the only way to use these.
9541 No kerning is applied to glyphs accessed with @code{\N}.
9544 Some escape sequences directly map onto special glyphs.
9547 This is a backslash followed by the apostrophe character,
9548 @acronym{ASCII} character @code{0x27} (@acronym{EBCDIC} character
9549 @code{0x7D}). The same as @code{\[aa]}, the acute accent.
9553 This is a backslash followed by @acronym{ASCII} character @code{0x60}
9554 (@acronym{EBCDIC} character @code{0x79} usually). The same as
9555 @code{\[ga]}, the grave accent.
9559 This is the same as @code{\[-]}, the minus sign in the current font.
9563 This is the same as @code{\[ul]}, the underline character.
9566 @Defreq {cflags, n c1 c2 @dots{}}
9567 @cindex glyph properties (@code{cflags})
9568 @cindex character properties (@code{cflags})
9569 @cindex properties of glyphs (@code{cflags})
9570 @cindex properties of characters (@code{cflags})
9571 Input characters and symbols have certain properties associated with
9572 it.@footnote{Note that the output glyphs themselves don't have such
9573 properties. For @code{gtroff}, a glyph is a numbered box with a given
9574 width, depth, and height, nothing else. All manipulations with the
9575 @code{cflags} request work on the input level.} These properties can be
9576 modified with the @code{cflags} request. The first argument is the sum
9577 of the desired flags and the remaining arguments are the characters or
9578 symbols to have those properties. It is possible to omit the spaces
9579 between the characters or symbols. Instead of single characters or
9580 symbols you can also use character classes (see @ref{Character Classes}
9585 @cindex end-of-sentence characters
9586 @cindex characters, end-of-sentence
9587 The character ends sentences (initially characters @samp{.?!} have this
9591 @cindex hyphenating characters
9592 @cindex characters, hyphenation
9593 Lines can be broken before the character (initially no characters have
9594 this property). This only works if both the characters before and after
9595 have non-zero hyphenation codes (as set with the @code{hcode} request).
9596 Use value@tie{}64 to override this behaviour.
9599 @cindex @code{hy} glyph, and @code{cflags}
9600 @cindex @code{em} glyph, and @code{cflags}
9601 Lines can be broken after the character (initially the character
9602 @samp{-} and the symbols @samp{\[hy]} and @samp{\[em]} have this
9603 property). This only works if both the characters before and after have
9604 non-zero hyphenation codes (as set with the @code{hcode} request). Use
9605 value@tie{}64 to override this behaviour.
9608 @cindex overlapping characters
9609 @cindex characters, overlapping
9610 @cindex @code{ul} glyph, and @code{cflags}
9611 @cindex @code{rn} glyph, and @code{cflags}
9612 @cindex @code{ru} glyph, and @code{cflags}
9613 @cindex @code{radicalex} glyph, and @code{cflags}
9614 @cindex @code{sqrtex} glyph, and @code{cflags}
9615 The character overlaps horizontally if used as a horizontal line
9616 building element. Initially the symbols @samp{\[ul]}, @samp{\[rn]},
9617 @samp{\[ru]}, @samp{\[radicalex]}, and @samp{\[sqrtex]} have this
9621 @cindex @code{br} glyph, and @code{cflags}
9622 The character overlaps vertically if used as vertical line building
9623 element. Initially symbol @samp{\[br]} has this property.
9626 @cindex transparent characters
9627 @cindex character, transparent
9628 @cindex @code{"}, at end of sentence
9629 @cindex @code{'}, at end of sentence
9630 @cindex @code{)}, at end of sentence
9631 @cindex @code{]}, at end of sentence
9632 @cindex @code{*}, at end of sentence
9633 @cindex @code{dg} glyph, at end of sentence
9634 @cindex @code{rq} glyph, at end of sentence
9635 @cindex @code{cq} glyph, at end of sentence
9636 An end-of-sentence character followed by any number of characters with
9637 this property is treated as the end of a sentence if followed by a
9638 newline or two spaces; in other words the character is @dfn{transparent}
9639 for the purposes of end-of-sentence recognition -- this is the same as
9640 having a zero space factor in @TeX{} (initially characters @samp{"')]*}
9641 and the symbols @samp{\[dg]}, @samp{\[rq]}, and @samp{\[cq]} have this
9645 Ignore hyphenation code values of the surrounding characters. Use this
9646 in combination with values 2 and@tie{}4 (initially no characters have
9647 this property). For example, if you need an automatic break point after
9648 the hyphen in number ranges like `3000-5000', insert
9655 into your document. Note, however, that this can lead to bad layout if
9656 done without thinking; in most situations, a better solution instead of
9657 changing the @code{cflags} value is to insert @code{\:} right after the
9658 hyphen at the places that really need a break point.
9661 Prohibit a line break before the character, but allow a line break after
9662 the character. This works only in combination with flags 256 and 512
9663 (see below) and has no effect otherwise.
9666 Prohibit a line break after the character, but allow a line break before
9667 the character. This works only in combination with flags 128 and 512
9668 (see below) and has no effect otherwise.
9671 Allow line break before or after the character. This works only in
9672 combination with flags 128 and 256 and has no effect otherwise.
9674 Contrary to flag values 2 and@tie{}4, the flags 128, 256, and 512 work
9675 pairwise. If, for example, the left character has value 512, and the
9676 right character 128, no line break gets inserted. If we use
9677 value@tie{}6 instead for the left character, a line break after the
9678 character can't be suppressed since the right neighbour character
9679 doesn't get examined.
9683 @DefreqList {char, g [@Var{string}]}
9684 @DefreqItemx {fchar, g [@Var{string}]}
9685 @DefreqItemx {fschar, f g [@Var{string}]}
9686 @DefreqListEndx {schar, g [@Var{string}]}
9687 @cindex defining character (@code{char})
9688 @cindex defining fallback character (@code{fchar}, @code{fschar}, @code{schar})
9689 @cindex character, defining (@code{char})
9690 @cindex character, defining fallback (@code{fchar}, @code{fschar}, @code{schar})
9691 @cindex fallback character, defining (@code{fchar}, @code{fschar}, @code{schar})
9692 @cindex creating new characters (@code{char})
9693 @cindex defining symbol (@code{char})
9694 @cindex symbol, defining (@code{char})
9695 @cindex defining glyph (@code{char})
9696 @cindex glyph, defining (@code{char})
9697 @cindex escape character, while defining glyph
9698 @cindex character, escape, while defining glyph
9699 @cindex @code{tr} request, and glyph definitions
9700 @cindex @code{cp} request, and glyph definitions
9701 @cindex @code{rc} request, and glyph definitions
9702 @cindex @code{lc} request, and glyph definitions
9703 @cindex @code{\l}, and glyph definitions
9704 @cindex @code{\L}, and glyph definitions
9705 @cindex @code{\&}, and glyph definitions
9706 @cindex @code{\e}, and glyph definitions
9707 @cindex @code{hcode} request, and glyph definitions
9708 Define a new glyph@tie{}@var{g} to be @var{string} (which can be
9709 empty).@footnote{@code{char} is a misnomer since an output glyph is
9710 defined.} Every time glyph@tie{}@var{g} needs to be printed,
9711 @var{string} is processed in a temporary environment and the result is
9712 wrapped up into a single object. Compatibility mode is turned off and
9713 the escape character is set to @samp{\} while @var{string} is being
9714 processed. Any emboldening, constant spacing or track kerning is
9715 applied to this object rather than to individual characters in
9718 A glyph defined by these requests can be used just like a normal glyph
9719 provided by the output device. In particular, other characters can be
9720 translated to it with the @code{tr} or @code{trin} requests; it can be
9721 made the leader character by the @code{lc} request; repeated patterns
9722 can be drawn with the glyph using the @code{\l} and @code{\L} escape
9723 sequences; words containing the glyph can be hyphenated correctly if the
9724 @code{hcode} request is used to give the glyph's symbol a hyphenation
9727 There is a special anti-recursion feature: Use of @code{g} within the
9728 glyph's definition is handled like normal characters and symbols not
9729 defined with @code{char}.
9731 Note that the @code{tr} and @code{trin} requests take precedence if
9732 @code{char} accesses the same symbol.
9746 The @code{fchar} request defines a fallback glyph: @code{gtroff} only
9747 checks for glyphs defined with @code{fchar} if it cannot find the glyph
9748 in the current font. @code{gtroff} carries out this test before
9749 checking special fonts.
9751 @code{fschar} defines a fallback glyph for font@tie{}@var{f}:
9752 @code{gtroff} checks for glyphs defined with @code{fschar} after the
9753 list of fonts declared as font-specific special fonts with the
9754 @code{fspecial} request, but before the list of fonts declared as global
9755 special fonts with the @code{special} request.
9757 Finally, the @code{schar} request defines a global fallback glyph:
9758 @code{gtroff} checks for glyphs defined with @code{schar} after the list
9759 of fonts declared as global special fonts with the @code{special}
9760 request, but before the already mounted special fonts.
9762 @xref{Using Symbols}, for a detailed description of the glyph searching
9763 mechanism in @code{gtroff}.
9766 @DefreqList {rchar, c1 c2 @dots{}}
9767 @DefreqListEndx {rfschar, f c1 c2 @dots{}}
9768 @cindex removing glyph definition (@code{rchar}, @code{rfschar})
9769 @cindex glyph, removing definition (@code{rchar}, @code{rfschar})
9770 @cindex fallback glyph, removing definition (@code{rchar}, @code{rfschar})
9771 Remove the definitions of glyphs @var{c1}, @var{c2},@tie{}@enddots{}
9772 This undoes the effect of a @code{char}, @code{fchar}, or @code{schar}
9775 It is possible to omit the whitespace between arguments.
9777 The request @code{rfschar} removes glyph definitions defined with
9778 @code{fschar} for glyph@tie{}f.
9781 @xref{Special Characters}.
9783 @c ---------------------------------------------------------------------
9785 @node Character Classes, Special Fonts, Using Symbols, Fonts and Symbols
9786 @subsection Character Classes
9787 @cindex character classes
9788 @cindex classes, character
9790 Classes are particularly useful for East Asian languages such as
9791 Chinese, Japanese, and Korean, where the number of needed characters is
9792 much larger than in European languages, and where large sets of
9793 characters share the same properties.
9795 @Defreq {class, n c1 c2 @dots{}}
9796 @cindex character class (@code{class})
9797 @cindex defining character class (@code{class})
9798 @cindex class of characters (@code{class})
9799 In @code{groff}, a @dfn{character class} (or simply ``class'') is a set
9800 of characters, grouped by some user aspect. The @code{class} request
9801 defines such classes so that other requests can refer to all characters
9802 belonging to this set with a single class name. Currently, only the
9803 @code{cflags} request can handle character classes.
9805 A @code{class} request takes a class name followed by a list of
9806 entities. In its simplest form, the entities are characters or symbols:
9809 .class [prepunct] , : ; > @}
9812 Since class and glyph names share the same namespace, it is recommended
9813 to start and end the class name with @code{[} and @code{]},
9814 respectively, to avoid collisions with normal @code{groff} symbols (and
9815 symbols defined by the user). In particular, the presence of @code{]}
9816 in the symbol name intentionally prevents the usage of @code{\[...]},
9817 thus you must use the @code{\C} escape to access a class with such a
9820 @cindex GGL (groff glyph list)
9821 @cindex groff glyph list (GGL)
9822 You can also use a special character range notation, consisting of a
9823 start character or symbol, followed by @samp{-}, and an end character or
9824 symbol. Internally, @code{gtroff} converts these two symbol names to
9825 Unicode values (according to the groff glyph gist), which then give the
9826 start and end value of the range. If that fails, the class definition
9829 Finally, classes can be nested, too.
9831 Here is a more complex example:
9834 .class [prepunctx] \C'[prepunct]' \[u2013]-\[u2016]
9837 The class @samp{prepunctx} now contains the contents of the class
9838 @code{prepunct} as defined above (the set @samp{, : ; > @}}), and
9839 characters in the range between @code{U+2013} and @code{U+2016}.
9841 If you want to add @samp{-} to a class, it must be the first character
9842 value in the argument list, otherwise it gets misinterpreted as a range.
9844 Note that it is not possible to use class names within range
9847 Typical use of the @code{class} request is to control line-breaking and
9848 hyphenation rules as defined by the @code{cflags} request. For example,
9849 to inhibit line breaks before the characters belonging to the
9850 @code{prepunctx} class, you can write:
9853 .cflags 2 \C'[prepunctx]'
9856 See the @code{cflags} request in @ref{Using Symbols}, for more details.
9859 @c ---------------------------------------------------------------------
9861 @node Special Fonts, Artificial Fonts, Character Classes, Fonts and Symbols
9862 @subsection Special Fonts
9863 @cindex special fonts
9864 @cindex fonts, special
9866 Special fonts are those that @code{gtroff} searches when it cannot find
9867 the requested glyph in the current font. The Symbol font is usually a
9870 @code{gtroff} provides the following two requests to add more special
9871 fonts. @xref{Using Symbols}, for a detailed description of the glyph
9872 searching mechanism in @code{gtroff}.
9874 Usually, only non-TTY devices have special fonts.
9876 @DefreqList {special, [@Var{s1} @Var{s2} @dots{}]}
9877 @DefreqListEndx {fspecial, f [@Var{s1} @Var{s2} @dots{}]}
9880 Use the @code{special} request to define special fonts. Initially, this
9883 Use the @code{fspecial} request to designate special fonts only when
9884 font@tie{}@var{f} is active. Initially, this list is empty.
9886 Previous calls to @code{special} or @code{fspecial} are overwritten;
9887 without arguments, the particular list of special fonts is set to empty.
9888 Special fonts are searched in the order they appear as arguments.
9890 All fonts that appear in a call to @code{special} or @code{fspecial}
9893 @xref{Using Symbols}, for the exact search order of glyphs.
9896 @c ---------------------------------------------------------------------
9898 @node Artificial Fonts, Ligatures and Kerning, Special Fonts, Fonts and Symbols
9899 @subsection Artificial Fonts
9900 @cindex artificial fonts
9901 @cindex fonts, artificial
9903 There are a number of requests and escapes for artificially creating
9904 fonts. These are largely vestiges of the days when output devices did
9905 not have a wide variety of fonts, and when @code{nroff} and @code{troff}
9906 were separate programs. Most of them are no longer necessary in GNU
9907 @code{troff}. Nevertheless, they are supported.
9909 @DefescList {\\H, ', height, '}
9910 @DefescItem {\\H, ', @t{+}height, '}
9911 @DefescItem {\\H, ', @t{-}height, '}
9912 @DefregListEndx {.height}
9913 @cindex changing the font height (@code{\H})
9914 @cindex font height, changing (@code{\H})
9915 @cindex height, font, changing (@code{\H})
9916 Change (increment, decrement) the height of the current font, but not
9917 the width. If @var{height} is zero, restore the original height.
9918 Default scaling indicator is @samp{z}.
9920 The read-only number register @code{.height} contains the font height as
9923 Currently, only the @option{-Tps} and @option{-Tpdf} devices support
9926 Note that @code{\H} doesn't produce an input token in @code{gtroff}. As
9927 a consequence, it can be used in requests like @code{mc} (which expects
9928 a single character as an argument) to change the font on the fly:
9934 In compatibility mode, @code{gtroff} behaves differently: If an
9935 increment or decrement is used, it is always taken relative to the
9936 current point size and not relative to the previously selected font
9941 \H'+5'test \H'+5'test
9945 prints the word @samp{test} twice with the same font height (five points
9946 larger than the current font size).
9949 @DefescList {\\S, ', slant, '}
9950 @DefregListEndx {.slant}
9951 @cindex changing the font slant (@code{\S})
9952 @cindex font slant, changing (@code{\S})
9953 @cindex slant, font, changing (@code{\S})
9954 Slant the current font by @var{slant} degrees. Positive values slant to
9955 the right. Only integer values are possible.
9957 The read-only number register @code{.slant} contains the font slant as
9960 Currently, only the @option{-Tps} and @option{-Tpdf} devices support
9963 Note that @code{\S} doesn't produce an input token in @code{gtroff}. As
9964 a consequence, it can be used in requests like @code{mc} (which expects
9965 a single character as an argument) to change the font on the fly:
9971 This request is incorrectly documented in the original @acronym{UNIX}
9972 troff manual; the slant is always set to an absolute value.
9975 @Defreq {ul, [@Var{lines}]}
9976 @cindex underlining (@code{ul})
9977 The @code{ul} request normally underlines subsequent lines if a TTY
9978 output device is used. Otherwise, the lines are printed in italics
9979 (only the term `underlined' is used in the following). The single
9980 argument is the number of input lines to be underlined; with no
9981 argument, the next line is underlined. If @var{lines} is zero or
9982 negative, stop the effects of @code{ul} (if it was active). Requests
9983 and empty lines do not count for computing the number of underlined
9984 input lines, even if they produce some output like @code{tl}. Lines
9985 inserted by macros (e.g.@: invoked by a trap) do count.
9987 At the beginning of @code{ul}, the current font is stored and the
9988 underline font is activated. Within the span of a @code{ul} request, it
9989 is possible to change fonts, but after the last line affected by
9990 @code{ul} the saved font is restored.
9992 This number of lines still to be underlined is associated with the
9993 current environment (@pxref{Environments}). The underline font can be
9994 changed with the @code{uf} request.
9996 @c XXX @xref should be changed to grotty
9998 @c @xref{Troff and Nroff Mode}, for a discussion how underlining is
9999 @c implemented in for TTY output devices, and which problems can arise.
10001 The @code{ul} request does not underline spaces.
10004 @Defreq {cu, [@Var{lines}]}
10005 @cindex continuous underlining (@code{cu})
10006 @cindex underlining, continuous (@code{cu})
10007 The @code{cu} request is similar to @code{ul} but underlines spaces as
10008 well (if a TTY output device is used).
10012 @cindex underline font (@code{uf})
10013 @cindex font for underlining (@code{uf})
10014 Set the underline font (globally) used by @code{ul} and @code{cu}. By
10015 default, this is the font at position@tie{}2. @var{font} can be either
10016 a non-negative font position or the name of a font.
10019 @DefreqList {bd, font [@Var{offset}]}
10020 @DefreqItem {bd, font1 font2 [@Var{offset}]}
10021 @DefregListEndx {.b}
10022 @cindex imitating bold face (@code{bd})
10023 @cindex bold face, imitating (@code{bd})
10024 Artificially create a bold font by printing each glyph twice, slightly
10027 Two syntax forms are available.
10031 Imitate a bold font unconditionally. The first argument specifies the
10032 font to embolden, and the second is the number of basic units, minus
10033 one, by which the two glyphs are offset. If the second argument is
10034 missing, emboldening is turned off.
10036 @var{font} can be either a non-negative font position or the name of a
10039 @var{offset} is available in the @code{.b} read-only register if a
10040 special font is active; in the @code{bd} request, its default unit is
10043 @cindex @code{fspecial} request, and imitating bold
10045 @cindex embolding of special fonts
10046 @cindex special fonts, emboldening
10048 Imitate a bold form conditionally. Embolden @var{font1} by @var{offset}
10049 only if font @var{font2} is the current font. This command can be
10050 issued repeatedly to set up different emboldening values for different
10051 current fonts. If the second argument is missing, emboldening is turned
10052 off for this particular current font.
10054 This affects special fonts only (either set up with the @code{special}
10055 command in font files or with the @code{fspecial} request).
10059 @Defreq {cs, font [@Var{width} [@Var{em-size}]]}
10060 @cindex constant glyph space mode (@code{cs})
10061 @cindex mode for constant glyph space (@code{cs})
10062 @cindex glyph, constant space
10063 @cindex @code{ps} request, and constant glyph space mode
10064 Switch to and from @dfn{constant glyph space mode}. If activated, the
10065 width of every glyph is @math{@var{width}/36} ems. The em size is given
10066 absolutely by @var{em-size}; if this argument is missing, the em value
10067 is taken from the current font size (as set with the @code{ps} request)
10068 when the font is effectively in use. Without second and third argument,
10069 constant glyph space mode is deactivated.
10071 Default scaling indicator for @var{em-size} is @samp{z}; @var{width} is
10075 @c ---------------------------------------------------------------------
10077 @node Ligatures and Kerning, , Artificial Fonts, Fonts and Symbols
10078 @subsection Ligatures and Kerning
10079 @cindex ligatures and kerning
10080 @cindex kerning and ligatures
10082 Ligatures are groups of characters that are run together, i.e, producing
10083 a single glyph. For example, the letters `f' and `i' can form a
10084 ligature `fi' as in the word `file'. This produces a cleaner look
10085 (albeit subtle) to the printed output. Usually, ligatures are not
10086 available in fonts for TTY output devices.
10088 Most @sc{PostScript} fonts support the fi and fl ligatures. The C/A/T
10089 typesetter that was the target of @acronym{AT&T} @code{troff} also
10090 supported `ff', `ffi', and `ffl' ligatures. Advanced typesetters or
10091 `expert' fonts may include ligatures for `ft' and `ct', although GNU
10092 @code{troff} does not support these (yet).
10094 Only the current font is checked for ligatures and kerns; neither
10095 special fonts nor entities defined with the @code{char} request (and its
10096 siblings) are taken into account.
10098 @DefreqList {lg, [@Var{flag}]}
10099 @DefregListEndx {.lg}
10100 @cindex activating ligatures (@code{lg})
10101 @cindex ligatures, activating (@code{lg})
10102 @cindex ligatures enabled register (@code{.lg})
10103 Switch the ligature mechanism on or off; if the parameter is non-zero or
10104 missing, ligatures are enabled, otherwise disabled. Default is on. The
10105 current ligature mode can be found in the read-only number register
10106 @code{.lg} (set to 1 or@tie{}2 if ligatures are enabled,
10109 Setting the ligature mode to@tie{}2 enables the two-character ligatures
10110 (fi, fl, and ff) and disables the three-character ligatures (ffi and
10114 @dfn{Pairwise kerning} is another subtle typesetting mechanism that
10115 modifies the distance between a glyph pair to improve readability. In
10116 most cases (but not always) the distance is decreased.
10118 For example, compare the combination of the letters `V' and `A'. With
10119 kerning, `VA' is printed. Without kerning it appears as `V@w{}A'.
10121 Typewriter-like fonts and fonts for terminals where all glyphs have the
10122 same width don't use kerning.
10124 @DefreqList {kern, [@Var{flag}]}
10125 @DefregListEndx {.kern}
10126 @cindex activating kerning (@code{kern})
10127 @cindex kerning, activating (@code{kern})
10128 @cindex kerning enabled register (@code{.kern})
10129 Switch kerning on or off. If the parameter is non-zero or missing,
10130 enable pairwise kerning, otherwise disable it. The read-only number
10131 register @code{.kern} is set to@tie{}1 if pairwise kerning is enabled,
10134 @cindex zero width space character (@code{\&})
10135 @cindex character, zero width space (@code{\&})
10136 @cindex space character, zero width (@code{\&})
10137 If the font description file contains pairwise kerning information,
10138 glyphs from that font are kerned. Kerning between two glyphs can be
10139 inhibited by placing @code{\&} between them: @samp{V\&A}.
10141 @xref{Font File Format}.
10144 @cindex track kerning
10145 @cindex kerning, track
10146 @dfn{Track kerning} expands or reduces the space between glyphs. This
10147 can be handy, for example, if you need to squeeze a long word onto a
10148 single line or spread some text to fill a narrow column. It must be
10149 used with great care since it is usually considered bad typography if
10150 the reader notices the effect.
10152 @Defreq {tkf, f s1 n1 s2 n2}
10153 @cindex activating track kerning (@code{tkf})
10154 @cindex track kerning, activating (@code{tkf})
10155 Enable track kerning for font@tie{}@var{f}. If the current font
10156 is@tie{}@var{f} the width of every glyph is increased by an amount
10157 between @var{n1} and @var{n2} (@var{n1}, @var{n2} can be negative); if
10158 the current point size is less than or equal to @var{s1} the width is
10159 increased by @var{n1}; if it is greater than or equal to @var{s2} the
10160 width is increased by @var{n2}; if the point size is greater than or
10161 equal to @var{s1} and less than or equal to @var{s2} the increase in
10162 width is a linear function of the point size.
10164 The default scaling indicator is @samp{z} for @var{s1} and @var{s2},
10165 @samp{p} for @var{n1} and @var{n2}.
10167 Note that the track kerning amount is added even to the rightmost glyph
10168 in a line; for large values it is thus recommended to increase the line
10169 length by the same amount to compensate it.
10172 Sometimes, when typesetting letters of different fonts, more or less
10173 space at such boundaries are needed. There are two escapes to help with
10176 @Defesc {\\/, , , }
10177 @cindex italic correction (@code{\/})
10178 @cindex correction, italic (@code{\/})
10179 @cindex correction between italic and roman glyph (@code{\/}, @code{\,})
10180 @cindex roman glyph, correction after italic glyph (@code{\/})
10181 @cindex italic glyph, correction before roman glyph (@code{\/})
10182 @cindex glyph, italic correction (@code{\/})
10183 Increase the width of the preceding glyph so that the spacing between
10184 that glyph and the following glyph is correct if the following glyph is
10185 a roman glyph. For example, if an italic@tie{}@code{f} is immediately
10186 followed by a roman right parenthesis, then in many fonts the top right
10187 portion of the@tie{}@code{f} overlaps the top left of the right
10188 parenthesis. Use this escape sequence whenever an italic glyph is
10189 immediately followed by a roman glyph without any intervening space.
10190 This small amount of space is also called @dfn{italic correction}.
10193 @c can't use @Example...@endExample here
10197 @result{} {@it f}@r{)}
10199 @result{} @i{f}@r{)}
10205 @Defesc {\\\,, , , }
10206 @cindex left italic correction (@code{\,})
10207 @cindex correction, left italic (@code{\,})
10208 @cindex glyph, left italic correction (@code{\,})
10209 @cindex roman glyph, correction before italic glyph (@code{\,})
10210 @cindex italic glyph, correction after roman glyph (@code{\,})
10211 Modify the spacing of the following glyph so that the spacing between
10212 that glyph and the preceding glyph is correct if the preceding glyph is
10213 a roman glyph. Use this escape sequence whenever a roman glyph is
10214 immediately followed by an italic glyph without any intervening space.
10215 In analogy to above, this space could be called @dfn{left italic
10216 correction}, but this term isn't used widely.
10219 @c can't use @Example...@endExample here
10223 @result{} @r{q}@i{f}
10225 @result{} @r{q}@math{@ptexcomma}@i{f}
10231 @Defesc {\\&, , , }
10232 Insert a zero-width character, which is invisible. Its intended use is
10233 to stop interaction of a character with its surrounding.
10237 It prevents the insertion of extra space after an end-of-sentence
10243 @result{} Test. Test.
10246 @result{} Test. Test.
10250 It prevents interpretation of a control character at the beginning of an
10255 @result{} warning: `Test' not defined
10261 It prevents kerning between two glyphs.
10264 @c can't use @Example...@endExample here
10270 @result{} @r{V@w{}A}
10276 It is needed to map an arbitrary character to nothing in the @code{tr}
10277 request (@pxref{Character Translations}).
10281 @Defesc {\\), , , }
10282 This escape is similar to @code{\&} except that it behaves like a
10283 character declared with the @code{cflags} request to be transparent for
10284 the purposes of an end-of-sentence character.
10286 Its main usage is in macro definitions to protect against arguments
10287 starting with a control character.
10299 @result{}This is a test.' This is a test.
10303 @result{}This is a test.' This is a test.
10308 @c =====================================================================
10310 @node Sizes, Strings, Fonts and Symbols, gtroff Reference
10316 @cindex size of type
10317 @cindex vertical spacing
10318 @cindex spacing, vertical
10319 @code{gtroff} uses two dimensions with each line of text, type size and
10320 vertical spacing. The @dfn{type size} is approximately the height of
10321 the tallest glyph.@footnote{This is usually the parenthesis. Note that
10322 in most cases the real dimensions of the glyphs in a font are @emph{not}
10323 related to its type size! For example, the standard @sc{PostScript}
10324 font families `Times Roman', `Helvetica', and `Courier' can't be used
10325 together at 10@dmn{pt}; to get acceptable output, the size of
10326 `Helvetica' has to be reduced by one point, and the size of `Courier'
10327 must be increased by one point.} @dfn{Vertical spacing} is the amount
10328 of space @code{gtroff} allows for a line of text; normally, this is
10329 about 20%@tie{}larger than the current type size. Ratios smaller than
10330 this can result in hard-to-read text; larger than this, it spreads the
10331 text out more vertically (useful for term papers). By default,
10332 @code{gtroff} uses 10@tie{}point type on 12@tie{}point spacing.
10335 The difference between type size and vertical spacing is known, by
10336 typesetters, as @dfn{leading} (this is pronounced `ledding').
10339 * Changing Type Sizes::
10340 * Fractional Type Sizes::
10343 @c ---------------------------------------------------------------------
10345 @node Changing Type Sizes, Fractional Type Sizes, Sizes, Sizes
10346 @subsection Changing Type Sizes
10348 @DefreqList {ps, [@Var{size}]}
10349 @DefreqItem {ps, @t{+}@Var{size}}
10350 @DefreqItem {ps, @t{-}@Var{size}}
10351 @DefescItemx {\\s, , size, }
10352 @DefregListEndx {.s}
10353 @cindex changing type sizes (@code{ps}, @code{\s})
10354 @cindex type sizes, changing (@code{ps}, @code{\s})
10355 @cindex point sizes, changing (@code{ps}, @code{\s})
10356 Use the @code{ps} request or the @code{\s} escape to change (increase,
10357 decrease) the type size (in points). Specify @var{size} as either an
10358 absolute point size, or as a relative change from the current size. The
10359 size@tie{}0 (for both @code{.ps} and @code{\s}), or no argument (for
10360 @code{.ps} only), goes back to the previous size.
10362 Default scaling indicator of @code{size} is @samp{z}. If @code{size} is
10363 negative, it is set to 1@dmn{u}.
10365 @cindex type size registers (@code{.s}, @code{.ps})
10366 @cindex point size registers (@code{.s}, @code{.ps})
10367 The read-only number register @code{.s} returns the point size in points
10368 as a decimal fraction. This is a string. To get the point size in
10369 scaled points, use the @code{.ps} register instead.
10371 @code{.s} is associated with the current environment
10372 (@pxref{Environments}).
10379 wink, wink, \s+2nudge, nudge,\s+8 say no more!
10383 The @code{\s} escape may be called in a variety of ways. Much like
10384 other escapes there must be a way to determine where the argument ends
10385 and the text begins. Any of the following forms are valid:
10389 Set the point size to @var{n}@tie{}points. @var{n}@tie{}must be either
10390 0 or in the range 4 to@tie{}39.
10394 Increase or decrease the point size by @var{n}@tie{}points.
10395 @var{n}@tie{}must be exactly one digit.
10398 Set the point size to @var{nn}@tie{}points. @var{nn} must be exactly
10402 @itemx \s-(@var{nn}
10403 @itemx \s(+@var{nn}
10404 @itemx \s(-@var{nn}
10405 Increase or decrease the point size by @var{nn}@tie{}points. @var{nn}
10406 must be exactly two digits.
10409 Note that @code{\s} doesn't produce an input token in @code{gtroff}. As
10410 a consequence, it can be used in requests like @code{mc} (which expects
10411 a single character as an argument) to change the font on the fly:
10417 @xref{Fractional Type Sizes}, for yet another syntactical form of using
10418 the @code{\s} escape.
10421 @Defreq {sizes, s1 s2 @dots{} sn [0]}
10422 Some devices may only have certain permissible sizes, in which case
10423 @code{gtroff} rounds to the nearest permissible size. The @file{DESC}
10424 file specifies which sizes are permissible for the device.
10426 Use the @code{sizes} request to change the permissible sizes for the
10427 current output device. Arguments are in scaled points; the
10428 @code{sizescale} line in the @file{DESC} file for the output device
10429 provides the scaling factor. For example, if the scaling factor is
10430 1000, then the value 12000 is 12@tie{}points.
10432 Each argument can be a single point size (such as @samp{12000}), or a
10433 range of sizes (such as @samp{4000-72000}). You can optionally end the
10437 @DefreqList {vs, [@Var{space}]}
10438 @DefreqItem {vs, @t{+}@Var{space}}
10439 @DefreqItem {vs, @t{-}@Var{space}}
10440 @DefregListEndx {.v}
10441 @cindex changing vertical line spacing (@code{vs})
10442 @cindex vertical line spacing, changing (@code{vs})
10443 @cindex vertical line spacing register (@code{.v})
10444 Change (increase, decrease) the vertical spacing by @var{space}. The
10445 default scaling indicator is @samp{p}.
10447 If @code{vs} is called without an argument, the vertical spacing is
10448 reset to the previous value before the last call to @code{vs}.
10450 @cindex @code{.V} register, and @code{vs}
10451 @code{gtroff} creates a warning of type @samp{range} if @var{space} is
10452 negative; the vertical spacing is then set to smallest positive value,
10453 the vertical resolution (as given in the @code{.V} register).
10455 Note that @w{@samp{.vs 0}} isn't saved in a diversion since it doesn't
10456 result in a vertical motion. You explicitly have to repeat this command
10457 before inserting the diversion.
10459 The read-only number register @code{.v} contains the current vertical
10460 spacing; it is associated with the current environment
10461 (@pxref{Environments}).
10464 @cindex vertical line spacing, effective value
10465 The effective vertical line spacing consists of four components.
10466 Breaking a line causes the following actions (in the given order).
10470 @cindex extra pre-vertical line space (@code{\x})
10471 @cindex line space, extra pre-vertical (@code{\x})
10472 Move the current point vertically by the @dfn{extra pre-vertical line
10473 space}. This is the minimum value of all @code{\x} escapes with a
10474 negative argument in the current output line.
10477 Move the current point vertically by the vertical line spacing as set
10478 with the @code{vs} request.
10481 Output the current line.
10484 @cindex extra post-vertical line space (@code{\x})
10485 @cindex line space, extra post-vertical (@code{\x})
10486 Move the current point vertically by the @dfn{extra post-vertical line
10487 space}. This is the maximum value of all @code{\x} escapes with a
10488 positive argument in the line that has just been output.
10491 @cindex post-vertical line spacing
10492 @cindex line spacing, post-vertical (@code{pvs})
10493 Move the current point vertically by the @dfn{post-vertical line
10494 spacing} as set with the @code{pvs} request.
10497 @cindex double-spacing (@code{vs}, @code{pvs})
10498 It is usually better to use @code{vs} or @code{pvs} instead of @code{ls}
10499 to produce double-spaced documents: @code{vs} and @code{pvs} have a
10500 finer granularity for the inserted vertical space compared to @code{ls};
10501 furthermore, certain preprocessors assume single-spacing.
10503 @xref{Manipulating Spacing}, for more details on the @code{\x} escape
10504 and the @code{ls} request.
10506 @DefreqList {pvs, [@Var{space}]}
10507 @DefreqItem {pvs, @t{+}@Var{space}}
10508 @DefreqItem {pvs, @t{-}@Var{space}}
10509 @DefregListEndx {.pvs}
10510 @cindex @code{ls} request, alternative to (@code{pvs})
10511 @cindex post-vertical line spacing, changing (@code{pvs})
10512 @cindex post-vertical line spacing register (@code{.pvs})
10513 Change (increase, decrease) the post-vertical spacing by @var{space}.
10514 The default scaling indicator is @samp{p}.
10516 If @code{pvs} is called without an argument, the post-vertical spacing
10517 is reset to the previous value before the last call to @code{pvs}.
10519 @code{gtroff} creates a warning of type @samp{range} if @var{space} is
10520 zero or negative; the vertical spacing is then set to zero.
10522 The read-only number register @code{.pvs} contains the current
10523 post-vertical spacing; it is associated with the current environment
10524 (@pxref{Environments}).
10527 @c ---------------------------------------------------------------------
10529 @node Fractional Type Sizes, , Changing Type Sizes, Sizes
10530 @subsection Fractional Type Sizes
10531 @cindex fractional type sizes
10532 @cindex fractional point sizes
10533 @cindex type sizes, fractional
10534 @cindex point sizes, fractional
10535 @cindex sizes, fractional
10537 @cindex @code{s} unit
10538 @cindex unit, @code{s}
10539 @cindex @code{z} unit
10540 @cindex unit, @code{z}
10541 @cindex @code{ps} request, with fractional type sizes
10542 @cindex @code{cs} request, with fractional type sizes
10543 @cindex @code{tkf} request, with fractional type sizes
10544 @cindex @code{\H}, with fractional type sizes
10545 @cindex @code{\s}, with fractional type sizes
10546 A @dfn{scaled point} is equal to @math{1/@var{sizescale}} points, where
10547 @var{sizescale} is specified in the @file{DESC} file (1@tie{}by
10548 default). There is a new scale indicator @samp{z}, which has the effect
10549 of multiplying by @var{sizescale}. Requests and escape sequences in
10550 @code{gtroff} interpret arguments that represent a point size as being
10551 in units of scaled points, but they evaluate each such argument using a
10552 default scale indicator of @samp{z}. Arguments treated in this way are
10553 the argument to the @code{ps} request, the third argument to the
10554 @code{cs} request, the second and fourth arguments to the @code{tkf}
10555 request, the argument to the @code{\H} escape sequence, and those
10556 variants of the @code{\s} escape sequence that take a numeric expression
10557 as their argument (see below).
10559 For example, suppose @var{sizescale} is@tie{}1000; then a scaled point
10560 is equivalent to a millipoint; the request @w{@samp{.ps 10.25}} is
10561 equivalent to @w{@samp{.ps 10.25z}} and thus sets the point size to
10562 10250@tie{}scaled points, which is equal to 10.25@tie{}points.
10564 @code{gtroff} disallows the use of the @samp{z} scale indicator in
10565 instances where it would make no sense, such as a numeric expression
10566 whose default scale indicator was neither @samp{u} nor @samp{z}.
10567 Similarly it would make no sense to use a scaling indicator other than
10568 @samp{z} or @samp{u} in a numeric expression whose default scale
10569 indicator was @samp{z}, and so @code{gtroff} disallows this as well.
10571 There is also new scale indicator @samp{s}, which multiplies by the
10572 number of units in a scaled point. So, for example, @samp{\n[.ps]s} is
10573 equal to @samp{1m}. Be sure not to confuse the @samp{s} and @samp{z}
10577 A read-only number register returning the point size in scaled points.
10579 @code{.ps} is associated with the current environment
10580 (@pxref{Environments}).
10584 @DefregListEndx {.sr}
10585 @cindex last-requested point size registers (@code{.psr}, @code{.sr})
10586 @cindex point size registers, last-requested (@code{.psr}, @code{.sr})
10587 @cindex @code{.ps} register, in comparison with @code{.psr}
10588 @cindex @code{.s} register, in comparison with @code{.sr}
10589 The last-requested point size in scaled points is contained in the
10590 @code{.psr} read-only number register. The last requested point size in
10591 points as a decimal fraction can be found in @code{.sr}. This is a
10592 string-valued read-only number register.
10594 Note that the requested point sizes are device-independent, whereas the
10595 values returned by the @code{.ps} and @code{.s} registers are not. For
10596 example, if a point size of 11@dmn{pt} is requested, and a @code{sizes}
10597 request (or a @code{sizescale} line in a @file{DESC} file) specifies
10598 10.95@dmn{pt} instead, this value is actually used.
10600 Both registers are associated with the current environment
10601 (@pxref{Environments}).
10604 The @code{\s} escape has the following syntax for working with
10605 fractional type sizes:
10610 Set the point size to @var{n}@tie{}scaled points; @var{n}@tie{}is a
10611 numeric expression with a default scale indicator of @samp{z}.
10614 @itemx \s[-@var{n}]
10615 @itemx \s+[@var{n}]
10616 @itemx \s-[@var{n}]
10617 @itemx \s'+@var{n}'
10618 @itemx \s'-@var{n}'
10619 @itemx \s+'@var{n}'
10620 @itemx \s-'@var{n}'
10621 Increase or or decrease the point size by @var{n}@tie{}scaled points;
10622 @var{n}@tie{}is a numeric expression (which may start with a minus sign)
10623 with a default scale indicator of @samp{z}.
10629 @c =====================================================================
10631 @node Strings, Conditionals and Loops, Sizes, gtroff Reference
10635 @code{gtroff} has string variables, which are entirely for user
10636 convenience (i.e.@: there are no built-in strings exept @code{.T}, but
10637 even this is a read-write string variable).
10639 Although the following requests can be used to create strings,
10640 simply using an undefined string will cause it to be defined as empty.
10641 @xref{Identifiers}.
10643 @DefreqList {ds, name [@Var{string}]}
10644 @DefreqItemx {ds1, name [@Var{string}]}
10645 @DefescItemx {\\*, , n, }
10646 @DefescItem {\\*, @Lparen{}, nm, }
10647 @DefescListEnd {\\*, @Lbrack{}, name arg1 arg2 @dots{}, @Rbrack{}}
10648 @cindex string interpolation (@code{\*})
10649 @cindex string expansion (@code{\*})
10650 @cindex interpolation of strings (@code{\*})
10651 @cindex expansion of strings (@code{\*})
10652 @cindex string arguments
10653 @cindex arguments, of strings
10654 Define and access a string variable @var{name} (one-character
10655 name@tie{}@var{n}, two-character name @var{nm}). If @var{name} already
10656 exists, @code{ds} overwrites the previous definition. Only the syntax
10657 form using brackets can take arguments that are handled identically to
10658 macro arguments; the single exception is that a closing bracket as an
10659 argument must be enclosed in double quotes. @xref{Request and Macro
10660 Arguments}, and @ref{Parameters}.
10665 .ds foo a \\$1 test
10667 This is \*[foo nice].
10668 @result{} This is a nice test.
10671 The @code{\*} escape @dfn{interpolates} (expands in-place) a
10672 previously-defined string variable. To be more precise, the stored
10673 string is pushed onto the input stack, which is then parsed by
10674 @code{gtroff}. Similar to number registers, it is possible to nest
10675 strings, i.e., string variables can be called within string variables.
10677 If the string named by the @code{\*} escape does not exist, it is
10678 defined as empty, and a warning of type @samp{mac} is emitted (see
10679 @ref{Debugging}, for more details).
10681 @cindex comments, with @code{ds}
10682 @cindex @code{ds} request, and comments
10683 @strong{Caution:} Unlike other requests, the second argument to the
10684 @code{ds} request takes up the entire line including trailing spaces.
10685 This means that comments on a line with such a request can introduce
10686 unwanted space into a string.
10689 .ds UX \s-1UNIX\s0\u\s-3tm\s0\d \" UNIX trademark
10693 Instead the comment should be put on another line or have the comment
10694 escape adjacent with the end of the string.
10697 .ds UX \s-1UNIX\s0\u\s-3tm\s0\d\" UNIX trademark
10700 @cindex trailing quotes
10701 @cindex quotes, trailing
10702 @cindex leading spaces with @code{ds}
10703 @cindex spaces with @code{ds}
10704 @cindex @code{ds} request, and leading spaces
10705 To produce leading space the string can be started with a double quote.
10706 No trailing quote is needed; in fact, any trailing quote is included in
10710 .ds sign " Yours in a white wine sauce,
10713 @cindex multi-line strings
10714 @cindex strings, multi-line
10715 @cindex newline character, in strings, escaping
10716 @cindex escaping newline characters, in strings
10717 Strings are not limited to a single line of text. A string can span
10718 several lines by escaping the newlines with a backslash. The resulting
10719 string is stored @emph{without} the newlines.
10722 .ds foo lots and lots \
10723 of text are on these \
10727 It is not possible to have real newlines in a string. To put a single
10728 double quote character into a string, use two consecutive double quote
10731 The @code{ds1} request turns off compatibility mode while interpreting a
10732 string. To be more precise, a @dfn{compatibility save} input token is
10733 inserted at the beginning of the string, and a @dfn{compatibility
10734 restore} input token at the end.
10738 .ds aa The value of xxx is \\n[xxx].
10739 .ds1 bb The value of xxx ix \\n[xxx].
10744 @result{} warning: number register `[' not defined
10745 @result{} The value of xxx is 0xxx].
10747 @result{} The value of xxx ix 12345.
10750 @cindex name space, common, of macros, diversions, and strings
10751 @cindex common name space of macros, diversions, and strings
10752 @cindex macros, shared name space with strings and diversions
10753 @cindex strings, shared name space with macros and diversions
10754 @cindex diversions, shared name space with macros and strings
10755 Strings, macros, and diversions (and boxes) share the same name space.
10756 Internally, even the same mechanism is used to store them. This has
10757 some interesting consequences. For example, it is possible to call a
10758 macro with string syntax and vice versa.
10765 @result{} This is a funny test.
10767 .ds yyy a funny test
10770 @result{} This is a funny test.
10773 In particular, interpolating a string does not hide existing macro
10774 arguments. Thus in a macro, a more efficient way of doing
10788 Note that the latter calling syntax doesn't change the value of
10789 @code{\$0}, which is then inherited from the calling macro.
10791 Diversions and boxes can be also called with string syntax.
10793 Another consequence is that you can copy one-line diversions or boxes to
10801 .ds yyy This is \*[xxx]\c
10803 @result{} @r{This is a }@i{test}.
10807 As the previous example shows, it is possible to store formatted output
10808 in strings. The @code{\c} escape prevents the insertion of an
10809 additional blank line in the output.
10811 Copying diversions longer than a single output line produces unexpected
10821 .ds yyy This is \*[xxx]\c
10823 @result{} test This is a funny.
10826 Usually, it is not predictable whether a diversion contains one or more
10827 output lines, so this mechanism should be avoided. With @acronym{UNIX}
10828 @code{troff}, this was the only solution to strip off a final newline
10829 from a diversion. Another disadvantage is that the spaces in the copied
10830 string are already formatted, making them unstretchable. This can cause
10833 @cindex stripping final newline in diversions
10834 @cindex diversion, stripping final newline
10835 @cindex final newline, stripping in diversions
10836 @cindex newline, final, stripping in diversions
10837 @cindex horizontal space, unformatting
10838 @cindex space, horizontal, unformatting
10839 @cindex unformatting horizontal space
10840 A clean solution to this problem is available in GNU @code{troff}, using
10841 the requests @code{chop} to remove the final newline of a diversion, and
10842 @code{unformat} to make the horizontal spaces stretchable again.
10854 @result{} This is a funny test.
10857 @xref{Gtroff Internals}, for more information.
10860 @DefreqList {as, name [@Var{string}]}
10861 @DefreqListEndx {as1, name [@Var{string}]}
10862 @cindex appending to a string (@code{as})
10863 @cindex string, appending (@code{as})
10864 The @code{as} request is similar to @code{ds} but appends @var{string}
10865 to the string stored as @var{name} instead of redefining it. If
10866 @var{name} doesn't exist yet, it is created.
10869 .as sign " with shallots, onions and garlic,
10872 The @code{as1} request is similar to @code{as}, but compatibility mode
10873 is switched off while the appended string is interpreted. To be more
10874 precise, a @dfn{compatibility save} input token is inserted at the
10875 beginning of the appended string, and a @dfn{compatibility restore}
10876 input token at the end.
10879 Rudimentary string manipulation routines are given with the next two
10882 @Defreq {substring, str n1 [@Var{n2}]}
10883 @cindex substring (@code{substring})
10884 Replace the string named @var{str} with the substring defined by the
10885 indices @var{n1} and @var{n2}. The first character in the string has
10886 index@tie{}0. If @var{n2} is omitted, it is implicitly set to the
10887 largest valid value (the string length minus one). If the index value
10888 @var{n1} or @var{n2} is negative, it is counted from the end of the
10889 string, going backwards: The last character has index@tie{}@minus{}1,
10890 the character before the last character has index@tie{}@minus{}2, etc.
10894 .substring xxx 1 -4
10903 @Defreq {length, reg str}
10904 @cindex length of a string (@code{length})
10905 @cindex string, length of (@code{length})
10906 @cindex @code{length} request, and copy-in mode
10907 @cindex copy-in mode, and @code{length} request
10908 @cindex mode, copy-in, and @code{length} request
10909 Compute the number of characters of @var{str} and return it in the
10910 number register @var{reg}. If @var{reg} doesn't exist, it is created.
10911 @code{str} is read in copy mode.
10914 .ds xxx abcd\h'3i'efgh
10915 .length yyy \*[xxx]
10921 @Defreq {rn, xx yy}
10922 @cindex renaming request (@code{rn})
10923 @cindex request, renaming (@code{rn})
10924 @cindex renaming macro (@code{rn})
10925 @cindex macro, renaming (@code{rn})
10926 @cindex renaming string (@code{rn})
10927 @cindex string, renaming (@code{rn})
10928 @cindex renaming diversion (@code{rn})
10929 @cindex diversion, renaming (@code{rn})
10930 Rename the request, macro, diversion, or string @var{xx} to @var{yy}.
10934 @cindex removing request (@code{rm})
10935 @cindex request, removing (@code{rm})
10936 @cindex removing macro (@code{rm})
10937 @cindex macro, removing (@code{rm})
10938 @cindex removing string (@code{rm})
10939 @cindex string, removing (@code{rm})
10940 @cindex removing diversion (@code{rm})
10941 @cindex diversion, removing (@code{rm})
10942 Remove the request, macro, diversion, or string @var{xx}. @code{gtroff}
10943 treats subsequent invocations as if the object had never been defined.
10947 @Defreq {als, new old}
10948 @cindex alias, string, creating (@code{als})
10949 @cindex alias, macro, creating (@code{als})
10950 @cindex alias, diversion, creating (@code{als})
10951 @cindex creating alias, for string (@code{als})
10952 @cindex creating alias, for macro (@code{als})
10953 @cindex creating alias, for diversion (@code{als})
10954 @cindex string, creating alias (@code{als})
10955 @cindex macro, creating alias (@code{als})
10956 @cindex diversion, creating alias (@code{als})
10957 Create an alias named @var{new} for the request, string, macro, or
10958 diversion object named @var{old}. The new name and the old name are
10959 exactly equivalent (it is similar to a hard rather than a soft link). If
10960 @var{old} is undefined, @code{gtroff} generates a warning of type
10961 @samp{mac} and ignores the request.
10963 To understand how the @code{als} request works it is probably best to
10964 think of two different pools: one pool for objects (macros, strings,
10965 etc.), and another one for names. As soon as an object is defined,
10966 @code{gtroff} adds it to the object pool, adds its name to the name
10967 pool, and creates a link between them. When @code{als} creates an
10968 alias, it adds a new name to the name pool that gets linked to the same
10969 object as the old name.
10971 Now consider this example.
10984 @result{} input stack limit exceeded
10988 The definition of macro @code{bar} replaces the old object this name is
10989 linked to. However, the alias to @code{foo} is still active! In
10990 other words, @code{foo} is still linked to the same object as
10991 @code{bar}, and the result of calling @code{bar} is an infinite,
10992 recursive loop that finally leads to an error.
10994 @cindex alias, string, removing (@code{rm})
10995 @cindex alias, macro, removing (@code{rm})
10996 @cindex alias, diversion, removing (@code{rm})
10997 @cindex removing alias, for string (@code{rm})
10998 @cindex removing alias, for macro (@code{rm})
10999 @cindex removing alias, for diversion (@code{rm})
11000 @cindex string, removing alias (@code{rm})
11001 @cindex macro, removing alias (@code{rm})
11002 @cindex diversion, removing alias (@code{rm})
11003 To undo an alias, simply call @code{rm} on the aliased name. The object
11004 itself is not destroyed until there are no more aliases.
11008 Remove (chop) the last character from the macro, string, or diversion
11009 named @var{xx}. This is useful for removing the newline from the end of
11010 diversions that are to be interpolated as strings. This command can be
11011 used repeatedly; see @ref{Gtroff Internals}, for details on nodes
11012 inserted additionally by @code{gtroff}.
11015 @xref{Identifiers}, and @ref{Comments}.
11018 @c =====================================================================
11020 @node Conditionals and Loops, Writing Macros, Strings, gtroff Reference
11021 @section Conditionals and Loops
11022 @cindex conditionals and loops
11023 @cindex loops and conditionals
11026 * Operators in Conditionals::
11031 @c ---------------------------------------------------------------------
11033 @node Operators in Conditionals, if-else, Conditionals and Loops, Conditionals and Loops
11034 @subsection Operators in Conditionals
11036 @cindex @code{if} request, operators to use with
11037 @cindex @code{ie} request, operators to use with
11038 @cindex @code{while} request, operators to use with
11039 In @code{if}, @code{ie}, and @code{while} requests, in addition to ordinary
11040 @ref{Expressions}, there are several more operators available:
11045 True if the current page is even or odd numbered (respectively).
11048 @cindex conditional output for terminal (TTY)
11049 @cindex TTY, conditional output for
11050 @cindex terminal, conditional output for
11051 True if the document is being processed in nroff mode (i.e., the
11052 @code{.nroff} command has been issued). @xref{Troff and Nroff Mode}.
11055 True if the document is being processed in troff mode (i.e., the
11056 @code{.troff} command has been issued). @xref{Troff and Nroff Mode}.
11059 Always false. This condition is for compatibility with other
11060 @code{troff} versions only (identifying a @code{-Tversatec} device).
11062 @item '@var{xxx}'@var{yyy}'
11063 True if the output produced by @var{xxx} is equal to the output produced
11064 by @var{yyy}. Other characters can be used in place of the single
11065 quotes; the same set of delimiters as for the @code{\D} escape is used
11066 (@pxref{Escapes}). @code{gtroff} formats @var{xxx} and @var{yyy} in
11067 separate environments; after the comparison the resulting data is
11079 The resulting motions, glyph sizes, and fonts have to
11080 match,@footnote{The created output nodes must be identical.
11081 @xref{Gtroff Internals}.} and not the individual motion, size, and font
11082 requests. In the previous example, @samp{|} and @samp{\fR|\fP} both
11083 result in a roman @samp{|} glyph with the same point size and at the
11084 same location on the page, so the strings are equal. If
11085 @samp{.ft@tie{}I} had been added before the @samp{.ie}, the result would
11086 be ``false'' because (the first) @samp{|} produces an italic @samp{|}
11087 rather than a roman one.
11089 @cindex string comparison
11090 @cindex comparison of strings
11091 To compare strings without processing, surround the data with @code{\?}.
11094 .ie "\?|\?"\?\fR|\fP\?" \
11101 @cindex @code{\?}, and copy-in mode
11102 @cindex copy-in mode, and @code{\?}
11103 @cindex mode, copy-in, and @code{\?}
11105 Since data protected with @code{\?} is read in copy-in mode it is even
11106 possible to use incomplete input without causing an error.
11111 .ie '\?\*a\?'\?\*b\?' \
11119 True if there is a number register named @var{xxx}.
11122 True if there is a string, macro, diversion, or request named @var{xxx}.
11125 True if there is a color named @var{xxx}.
11128 True if there is a glyph @var{g} available@footnote{The name of this
11129 conditional operator is a misnomer since it tests names of output
11130 glyphs.}; @var{g} is either an @acronym{ASCII} character or a special
11131 character (@code{\N'@var{xxx}'}, @code{\(@var{gg}} or
11132 @code{\[@var{ggg}]}); the condition is also true if @var{g} has been
11133 defined by the @code{char} request.
11136 True if a font named @var{font} exists. @var{font} is handled as if it
11137 was opened with the @code{ft} request (this is, font translation and
11138 styles are applied), without actually mounting it.
11140 This test doesn't load the complete font but only its header to verify
11143 @item S @var{style}
11144 True if style @var{style} has been registered. Font translation is
11148 Note that these operators can't be combined with other operators like
11149 @samp{:} or @samp{&}; only a leading @samp{!} (without whitespace
11150 between the exclamation mark and the operator) can be used to negate the
11162 A whitespace after @samp{!} always evaluates to zero (this bizarre
11163 behaviour is due to compatibility with @acronym{UNIX} @code{troff}).
11171 @result{} r xxx true
11174 It is possible to omit the whitespace before the argument to the
11175 @samp{r}, @samp{d}, and @samp{c} operators.
11177 @xref{Expressions}.
11179 @c ---------------------------------------------------------------------
11181 @node if-else, while, Operators in Conditionals, Conditionals and Loops
11182 @subsection if-else
11185 @code{gtroff} has if-then-else constructs like other languages, although
11186 the formatting can be painful.
11188 @Defreq {if, expr anything}
11190 Evaluate the expression @var{expr}, and executes @var{anything} (the
11191 remainder of the line) if @var{expr} evaluates to a value greater than
11192 zero (true). @var{anything} is interpreted as though it was on a line
11193 by itself (except that leading spaces are swallowed).
11194 @xref{Operators in Conditionals}, for more info.
11199 .if ((\n[xxx] == 1) & (\n[yyy] == 2)) true
11204 @Defreq {nop, anything}
11205 Executes @var{anything}. This is similar to @code{.if@tie{}1}.
11208 @DefreqList {ie, expr anything}
11209 @DefreqListEndx {el, anything}
11210 Use the @code{ie} and @code{el} requests to write an if-then-else. The
11211 first request is the `if' part and the latter is the `else' part.
11214 .ie n .ls 2 \" double-spacing in nroff
11215 .el .ls 1 \" single-spacing in troff
11219 @c there is a bug in makeinfo <= 4.1a: you can't have `@{' as an argument
11222 @c and in 4.2 you still can't use @{ in macros.
11224 @c @DefescList {\@{, , , }
11225 @c @DefescListEnd {\@}, , , }
11226 @deffn Escape @t{\@{}
11227 @deffnx Escape @t{\@}}
11230 @cindex begin of conditional block (@code{\@{})
11231 @cindex end of conditional block (@code{\@}})
11232 @cindex conditional block, begin (@code{\@{})
11233 @cindex conditional block, end (@code{\@}})
11234 @cindex block, conditional, begin (@code{\@{})
11235 @cindex block, condititional, end (@code{\@}})
11236 In many cases, an if (or if-else) construct needs to execute more than
11237 one request. This can be done using the escapes @code{\@{} (which must
11238 start the first line) and @code{\@}} (which must end the last line).
11253 @xref{Expressions}.
11255 @c ---------------------------------------------------------------------
11257 @node while, , if-else, Conditionals and Loops
11261 @code{gtroff} provides a looping construct using the @code{while}
11262 request, which is used much like the @code{if} (and related) requests.
11264 @Defreq {while, expr anything}
11265 Evaluate the expression @var{expr}, and repeatedly execute
11266 @var{anything} (the remainder of the line) until @var{expr} evaluates
11271 .while (\na < 9) \@{\
11275 @result{} 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
11280 @cindex @code{de} request, and @code{while}
11283 The body of a @code{while} request is treated like the body of a
11284 @code{de} request: @code{gtroff} temporarily stores it in a macro that
11285 is deleted after the loop has been exited. It can considerably slow
11286 down a macro if the body of the @code{while} request (within the macro)
11287 is large. Each time the macro is executed, the @code{while} body is
11288 parsed and stored again as a temporary macro.
11293 . while (\\n[num] > 0) \@{\
11294 . \" many lines of code
11300 @cindex recursive macros
11301 @cindex macros, recursive
11303 The traditional and ofter better solution (@acronym{UNIX} @code{troff}
11304 doesn't have the @code{while} request) is to use a recursive macro
11305 instead that is parsed only once during its definition.
11309 . if (\\n[num] > 0) \@{\
11310 . \" many lines of code
11323 Note that the number of available recursion levels is set to@tie{}1000
11324 (this is a compile-time constant value of @code{gtroff}).
11327 The closing brace of a @code{while} body must end a line.
11332 . while (\n[a] < 10) \@{\
11335 @result{} unbalanced \@{ \@}
11341 @cindex @code{while} request, confusing with @code{br}
11342 @cindex @code{break} request, in a @code{while} loop
11343 @cindex @code{continue} request, in a @code{while} loop
11344 Break out of a @code{while} loop. Be sure not to confuse this with the
11345 @code{br} request (causing a line break).
11348 @Defreq {continue, }
11349 Finish the current iteration of a @code{while} loop, immediately
11350 restarting the next iteration.
11353 @xref{Expressions}.
11356 @c =====================================================================
11358 @node Writing Macros, Page Motions, Conditionals and Loops, gtroff Reference
11359 @section Writing Macros
11360 @cindex writing macros
11361 @cindex macros, writing
11363 A @dfn{macro} is a collection of text and embedded commands that can be
11364 invoked multiple times. Use macros to define common operations.
11365 @xref{Strings}, for a (limited) alternative syntax to call macros.
11367 Although the following requests can be used to create macros,
11368 simply using an undefined macro will cause it to be defined as empty.
11369 @xref{Identifiers}.
11371 @DefreqList {de, name [@Var{end}]}
11372 @DefreqItemx {de1, name [@Var{end}]}
11373 @DefreqItemx {dei, name [@Var{end}]}
11374 @DefreqListEndx {dei1, name [@Var{end}]}
11375 Define a new macro named @var{name}. @code{gtroff} copies subsequent
11376 lines (starting with the next one) into an internal buffer until it
11377 encounters the line @samp{..} (two dots). If the optional second
11378 argument to @code{de} is present it is used as the macro closure
11379 request instead of @samp{..}.
11381 There can be whitespace after the first dot in the line containing the
11382 ending token (either @samp{.} or macro @samp{@var{end}}). Don't insert
11383 a tab character immediately after the @samp{..}, otherwise it isn't
11384 recognized as the end-of-macro symbol.@footnote{While it is possible to
11385 define and call a macro @samp{.} with
11392 .. \" This calls macro `.'!
11396 you can't use this as the end-of-macro macro: during a macro definition,
11397 @samp{..} is never handled as a call to @samp{.}, even if you say
11398 @samp{.de foo .} explicitly.}
11400 Here a small example macro called @samp{P} that causes a break and
11401 inserts some vertical space. It could be used to separate paragraphs.
11410 The following example defines a macro within another. Remember that
11411 expansion must be protected twice; once for reading the macro and once
11415 \# a dummy macro to avoid a warning
11421 . nop \f[B]Hallo \\\\$1!\f[]
11427 @result{} @b{Hallo Joe!}
11431 Since @code{\f} has no expansion, it isn't necessary to protect its
11432 backslash. Had we defined another macro within @code{bar} that takes a
11433 parameter, eight backslashes would be necessary before @samp{$1}.
11435 The @code{de1} request turns off compatibility mode while executing the
11436 macro. On entry, the current compatibility mode is saved and restored
11443 The value of xxx is \\n[xxx].
11446 The value of xxx ix \\n[xxx].
11452 @result{} warning: number register `[' not defined
11453 @result{} The value of xxx is 0xxx].
11455 @result{} The value of xxx ix 12345.
11458 The @code{dei} request defines a macro indirectly. That is, it expands
11459 strings whose names are @var{name} or @var{end} before performing the
11477 The @code{dei1} request is similar to @code{dei} but with compatibility
11478 mode switched off during execution of the defined macro.
11480 If compatibility mode is on, @code{de} (and @code{dei}) behave similar
11481 to @code{de1} (and @code{dei1}): A `compatibility save' token is
11482 inserted at the beginning, and a `compatibility restore' token at the
11483 end, with compatibility mode switched on during execution. @xref{Gtroff
11484 Internals}, for more information on switching compatibility mode on and
11485 off in a single document.
11488 Using @file{trace.tmac}, you can trace calls to @code{de} and
11491 Note that macro identifiers are shared with identifiers for strings and
11494 @xref{als,,the description of the @code{als} request}, for possible
11495 pitfalls if redefining a macro that has been aliased.
11498 @DefreqList {am, name [@Var{end}]}
11499 @DefreqItemx {am1, name [@Var{end}]}
11500 @DefreqItemx {ami, name [@Var{end}]}
11501 @DefreqListEndx {ami1, name [@Var{end}]}
11502 @cindex appending to a macro (@code{am})
11503 @cindex macro, appending (@code{am})
11504 Works similarly to @code{de} except it appends onto the macro named
11505 @var{name}. So, to make the previously defined @samp{P} macro actually
11506 do indented instead of block paragraphs, add the necessary code to the
11507 existing macro like this:
11515 The @code{am1} request turns off compatibility mode while executing the
11516 appended macro piece. To be more precise, a @dfn{compatibility save}
11517 input token is inserted at the beginning of the appended code, and a
11518 @dfn{compatibility restore} input token at the end.
11520 The @code{ami} request appends indirectly, meaning that @code{gtroff}
11521 expands strings whose names are @var{name} or @var{end} before
11522 performing the append.
11524 The @code{ami1} request is similar to @code{ami} but compatibility mode
11525 is switched off during execution of the defined macro.
11528 Using @file{trace.tmac}, you can trace calls to @code{am} and
11532 @xref{Strings}, for the @code{als} and @code{rn} request to create an
11533 alias and rename a macro, respectively.
11535 The @code{de}, @code{am}, @code{di}, @code{da}, @code{ds}, and @code{as}
11536 requests (together with its variants) only create a new object if the
11537 name of the macro, diversion or string diversion is currently undefined
11538 or if it is defined to be a request; normally they modify the value of
11539 an existing object.
11541 @Defreq {return, [@Var{anything}]}
11542 Exit a macro, immediately returning to the caller.
11544 If called with an argument, exit twice, namely the current macro and the
11545 macro one level higher. This is used to define a wrapper macro for
11546 @code{return} in @file{trace.tmac}.
11554 @c ---------------------------------------------------------------------
11556 @node Copy-in Mode, Parameters, Writing Macros, Writing Macros
11557 @subsection Copy-in Mode
11559 @cindex copy-in mode
11561 @cindex mode, copy-in
11563 @cindex @code{\n}, when reading text for a macro
11564 @cindex @code{\$}, when reading text for a macro
11565 @cindex @code{\*}, when reading text for a macro
11566 @cindex @code{\\}, when reading text for a macro
11567 @cindex \@key{RET}, when reading text for a macro
11568 When @code{gtroff} reads in the text for a macro, string, or diversion,
11569 it copies the text (including request lines, but excluding escapes) into
11570 an internal buffer. Escapes are converted into an internal form, except
11571 for @code{\n}, @code{\$}, @code{\*}, @code{\\} and @code{\@key{RET}},
11572 which are evaluated and inserted into the text where the escape was
11573 located. This is known as @dfn{copy-in} mode or @dfn{copy} mode.
11575 What this means is that you can specify when these escapes are to be
11576 evaluated (either at copy-in time or at the time of use) by insulating
11577 the escapes with an extra backslash. Compare this to the @code{\def}
11578 and @code{\edef} commands in @TeX{}.
11580 The following example prints the numbers 20 and@tie{}10:
11592 @c ---------------------------------------------------------------------
11594 @node Parameters, , Copy-in Mode, Writing Macros
11595 @subsection Parameters
11598 The arguments to a macro or string can be examined using a variety of
11602 @cindex number of arguments register (@code{.$})
11603 The number of arguments passed to a macro or string. This is a
11604 read-only number register.
11606 Note that the @code{shift} request can change its value.
11609 Any individual argument can be retrieved with one of the following
11612 @DefescList {\\$, , n, }
11613 @DefescItem {\\$, @Lparen{}, nn, }
11614 @DefescListEnd {\\$, @Lbrack{}, nnn, @Rbrack{}}
11615 @cindex copy-in mode, and macro arguments
11616 @cindex mode, copy-in, and macro arguments
11617 @cindex macro, arguments (@code{\$})
11618 @cindex arguments, macro (@code{\$})
11619 Retrieve the @var{n}@dmn{th}, @var{nn}@dmn{th} or @var{nnn}@dmn{th}
11620 argument. As usual, the first form only accepts a single number (larger
11621 than zero), the second a two-digit number (larger or equal to@tie{}10),
11622 and the third any positive integer value (larger than zero). Macros and
11623 strings can have an unlimited number of arguments. Note that due to
11624 copy-in mode, use two backslashes on these in actual use to prevent
11625 interpolation until the macro is actually invoked.
11628 @Defreq {shift, [@Var{n}]}
11629 Shift the arguments 1@tie{}position, or as many positions as specified
11630 by its argument. After executing this request, argument@tie{}@var{i}
11631 becomes argument @math{@var{i}-@var{n}}; arguments 1 to@tie{}@var{n} are
11632 no longer available. Shifting by negative amounts is currently
11635 The register @code{.$} is adjusted accordingly.
11638 @DefescList {\\$*, , , }
11639 @DefescListEndx {\\$@@, , , }
11640 In some cases it is convenient to use all of the arguments at once (for
11641 example, to pass the arguments along to another macro). The @code{\$*}
11642 escape concatenates all the arguments separated by spaces. A similar
11643 escape is @code{\$@@}, which concatenates all the arguments with each
11644 surrounded by double quotes, and separated by spaces. If not in
11645 compatibility mode, the input level of double quotes is preserved (see
11646 @ref{Request and Macro Arguments}).
11649 @Defesc {\\$^, , , }
11650 Handle the parameters of a macro as if they were an argument to the
11651 @code{ds} or similar requests.
11661 .foo " This is a "test"
11662 @result{} $1=` This is a '
11663 @result{} $2=`test"'
11664 @result{} $*=` This is a test"'
11665 @result{} $@@=`" This is a " "test""'
11666 @result{} $^=`" This is a "test"'
11669 This escape is useful mainly for macro packages like @file{trace.tmac},
11670 which redefines some requests and macros for debugging purposes.
11673 @Defesc {\\$0, , , }
11674 @cindex macro name register (@code{\$0})
11675 @cindex @code{als} request, and @code{\$0}
11676 The name used to invoke the current macro. The @code{als} request can
11677 make a macro have more than one name.
11679 If a macro is called as a string (within another macro), the value of
11680 @code{\$0} isn't changed.
11716 @xref{Request and Macro Arguments}.
11719 @c =====================================================================
11721 @node Page Motions, Drawing Requests, Writing Macros, gtroff Reference
11722 @section Page Motions
11723 @cindex page motions
11724 @cindex motions, page
11726 @xref{Manipulating Spacing}, for a discussion of the main request for
11727 vertical motion, @code{sp}.
11729 @DefreqList {mk, [@Var{reg}]}
11730 @DefreqListEndx {rt, [@Var{dist}]}
11731 @cindex marking vertical page location (@code{mk})
11732 @cindex page location, vertical, marking (@code{mk})
11733 @cindex location, vertical, page, marking (@code{mk})
11734 @cindex vertical page location, marking (@code{mk})
11735 @cindex returning to marked vertical page location (@code{rt})
11736 @cindex page location, vertical, returning to marked (@code{rt})
11737 @cindex location, vertical, page, returning to marked (@code{rt})
11738 @cindex vertical page location, returning to marked (@code{rt})
11739 The request @code{mk} can be used to mark a location on a page, for
11740 movement to later. This request takes a register name as an argument in
11741 which to store the current page location. With no argument it stores
11742 the location in an internal register. The results of this can be used
11743 later by the @code{rt} or the @code{sp} request (or the @code{\v}
11746 The @code{rt} request returns @emph{upwards} to the location marked with
11747 the last @code{mk} request. If used with an argument, return to a
11748 position which distance from the top of the page is @var{dist} (no
11749 previous call to @code{mk} is necessary in this case). Default scaling
11750 indicator is @samp{v}.
11752 Here a primitive solution for a two-column macro.
11755 .nr column-length 1.5i
11757 .nr bottom-margin 1m
11764 . ll \\n[column-length]u
11765 . wh -\\n[bottom-margin]u 2c-trap
11772 . ie \\n[right-side] \@{\
11774 . po -(\\n[column-length]u + \\n[column-gap]u)
11776 . wh -\\n[bottom-margin]u
11779 . \" switch to right side
11781 . po +(\\n[column-length]u + \\n[column-gap]u)
11790 This is a small test that shows how the
11791 rt request works in combination with mk.
11794 Starting here, text is typeset in two columns.
11795 Note that this implementation isn't robust
11796 and thus not suited for a real two-column
11803 This is a small test that shows how the
11804 rt request works in combination with mk.
11806 Starting here, isn't robust
11807 text is typeset and thus not
11808 in two columns. suited for a
11809 Note that this real two-column
11810 implementation macro.
11814 The following escapes give fine control of movements about the page.
11816 @Defesc {\\v, ', e, '}
11817 @cindex vertical motion (@code{\v})
11818 @cindex motion, vertical (@code{\v})
11819 Move vertically, usually from the current location on the page (if no
11820 absolute position operator @samp{|} is used). The argument@tie{}@var{e}
11821 specifies the distance to move; positive is downwards and negative
11822 upwards. The default scaling indicator for this escape is @samp{v}.
11823 Beware, however, that @code{gtroff} continues text processing at the
11824 point where the motion ends, so you should always balance motions to
11825 avoid interference with text processing.
11827 @code{\v} doesn't trigger a trap. This can be quite useful; for
11828 example, consider a page bottom trap macro that prints a marker in the
11829 margin to indicate continuation of a footnote or something similar.
11832 There are some special-case escapes for vertical motion.
11834 @Defesc {\\r, , , }
11835 Move upwards@tie{}1@dmn{v}.
11838 @Defesc {\\u, , , }
11839 Move upwards@tie{}.5@dmn{v}.
11842 @Defesc {\\d, , , }
11843 Move down@tie{}.5@dmn{v}.
11846 @Defesc {\\h, ', e, '}
11847 @cindex inserting horizontal space (@code{\h})
11848 @cindex horizontal space (@code{\h})
11849 @cindex space, horizontal (@code{\h})
11850 @cindex horizontal motion (@code{\h})
11851 @cindex motion, horizontal (@code{\h})
11852 Move horizontally, usually from the current location (if no absolute
11853 position operator @samp{|} is used). The expression@tie{}@var{e}
11854 indicates how far to move: positive is rightwards and negative
11855 leftwards. The default scaling indicator for this escape is @samp{m}.
11857 This horizontal space is not discarded at the end of a line. To insert
11858 discardable space of a certain length use the @code{ss} request.
11861 There are a number of special-case escapes for horizontal motion.
11863 @Defesc {\\@key{SP}, , , }
11864 @cindex space, unbreakable
11865 @cindex unbreakable space
11866 An unbreakable and unpaddable (i.e.@: not expanded during filling)
11867 space. (Note: This is a backslash followed by a space.)
11870 @Defesc {\\~, , , }
11871 An unbreakable space that stretches like a normal inter-word space when
11872 a line is adjusted.
11875 @Defesc {\\|, , , }
11876 A 1/6@dmn{th} em space. Ignored for TTY output devices (rounded to
11879 However, if there is a glyph defined in the current font file with name
11880 @code{\|} (note the leading backslash), the width of this glyph is used
11881 instead (even for TTYs).
11884 @Defesc {\\^, , , }
11885 A 1/12@dmn{th} em space. Ignored for TTY output devices (rounded to
11888 However, if there is a glyph defined in the current font file with name
11889 @code{\^} (note the leading backslash), the width of this glyph is used
11890 instead (even for TTYs).
11893 @Defesc {\\0, , , }
11894 @cindex space, width of a digit (@code{\0})
11895 @cindex digit width space (@code{\0})
11896 A space the size of a digit.
11899 The following string sets the @TeX{} logo:
11902 .ds TeX T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
11905 @DefescList {\\w, ', text, '}
11912 @DefregListEndx {skw}
11913 @cindex width escape (@code{\w})
11914 Return the width of the specified @var{text} in basic units. This
11915 allows horizontal movement based on the width of some arbitrary text
11916 (e.g.@: given as an argument to a macro).
11919 The length of the string `abc' is \w'abc'u.
11920 @result{} The length of the string `abc' is 72u.
11923 Font changes may occur in @var{text}, which don't affect current
11926 After use, @code{\w} sets several registers:
11931 The highest and lowest point of the baseline, respectively, in
11936 Like the @code{st} and @code{sb} registers, but takes account of the
11937 heights and depths of glyphs. In other words, this gives the highest
11938 and lowest point of @var{text}. Values below the baseline are negative.
11941 Defines the kinds of glyphs occurring in @var{text}:
11945 only short glyphs, no descenders or tall glyphs.
11948 at least one descender.
11951 at least one tall glyph.
11954 at least one each of a descender and a tall glyph.
11958 The amount of horizontal space (possibly negative) that should be added
11959 to the last glyph before a subscript.
11962 How far to right of the center of the last glyph in the @code{\w}
11963 argument, the center of an accent from a roman font should be placed
11968 @DefescList {\\k, , p, }
11969 @DefescItem {\\k, @Lparen{}, ps, }
11970 @DefescListEnd {\\k, @Lbrack{}, position, @Rbrack{}}
11971 @cindex saving horizontal input line position (@code{\k})
11972 @cindex horizontal input line position, saving (@code{\k})
11973 @cindex input line position, horizontal, saving (@code{\k})
11974 @cindex position, horizontal input line, saving (@code{\k})
11975 @cindex line, input, horizontal position, saving (@code{\k})
11976 Store the current horizontal position in the @emph{input} line in number
11977 register with name @var{position} (one-character name@tie{}@var{p},
11978 two-character name @var{ps}). Use this, for example, to return to the
11979 beginning of a string for highlighting or other decoration.
11983 @cindex horizontal input line position register (@code{hp})
11984 @cindex input line, horizontal position, register (@code{hp})
11985 @cindex position, horizontal, in input line, register (@code{hp})
11986 @cindex line, input, horizontal position, register (@code{hp})
11987 The current horizontal position at the input line.
11991 @cindex horizontal output line position register (@code{.k})
11992 @cindex output line, horizontal position, register (@code{.k})
11993 @cindex position, horizontal, in output line, register (@code{.k})
11994 @cindex line, output, horizontal position, register (@code{.k})
11995 A read-only number register containing the current horizontal output
11996 position (relative to the current indentation).
11999 @Defesc {\\o, ', abc, '}
12000 @cindex overstriking glyphs (@code{\o})
12001 @cindex glyphs, overstriking (@code{\o})
12002 Overstrike glyphs @var{a}, @var{b}, @var{c}, @dots{}; the glyphs are
12003 centered, and the resulting spacing is the largest width of the affected
12007 @Defesc {\\z, , g, }
12008 @cindex zero-width printing (@code{\z}, @code{\Z})
12009 @cindex printing, zero-width (@code{\z}, @code{\Z})
12010 Print glyph @var{g} with zero width, i.e., without spacing. Use this to
12011 overstrike glyphs left-aligned.
12014 @Defesc {\\Z, ', anything, '}
12015 @cindex zero-width printing (@code{\z}, @code{\Z})
12016 @cindex printing, zero-width (@code{\z}, @code{\Z})
12017 Print @var{anything}, then restore the horizontal and vertical position.
12018 The argument may not contain tabs or leaders.
12020 The following is an example of a strike-through macro:
12025 \Z@@\v'-.25m'\l'\\n[ww]u'@@\\$1
12030 an actual emergency!
12035 @c =====================================================================
12037 @node Drawing Requests, Traps, Page Motions, gtroff Reference
12038 @section Drawing Requests
12039 @cindex drawing requests
12040 @cindex requests for drawing
12042 @code{gtroff} provides a number of ways to draw lines and other figures
12043 on the page. Used in combination with the page motion commands (see
12044 @ref{Page Motions}, for more info), a wide variety of figures can be
12045 drawn. However, for complex drawings these operations can be quite
12046 cumbersome, and it may be wise to use graphic preprocessors like
12047 @code{gpic} or @code{ggrn}. @xref{gpic}, and @ref{ggrn}, for more
12050 All drawing is done via escapes.
12052 @DefescList {\\l, ', l, '}
12053 @DefescListEnd {\\l, ', lg, '}
12054 @cindex drawing horizontal lines (@code{\l})
12055 @cindex horizontal line, drawing (@code{\l})
12056 @cindex line, horizontal, drawing (@code{\l})
12057 Draw a line horizontally. @var{l} is the length of the line to be
12058 drawn. If it is positive, start the line at the current location and
12059 draw to the right; its end point is the new current location. Negative
12060 values are handled differently: The line starts at the current location
12061 and draws to the left, but the current location doesn't move.
12063 @var{l} can also be specified absolutely (i.e.@: with a leading
12064 @samp{|}), which draws back to the beginning of the input line. Default
12065 scaling indicator is @samp{m}.
12067 @cindex underscore glyph (@code{\[ru]})
12068 @cindex glyph, underscore (@code{\[ru]})
12069 @cindex line drawing glyph
12070 @cindex glyph, for line drawing
12071 The optional second parameter@tie{}@var{g} is a glyph to draw the line
12072 with. If this second argument is not specified, @code{gtroff} uses the
12073 underscore glyph, @code{\[ru]}.
12075 @cindex zero width space character (@code{\&})
12076 @cindex character, zero width space (@code{\&})
12077 @cindex space character, zero width (@code{\&})
12078 To separate the two arguments (to prevent @code{gtroff} from
12079 interpreting a drawing glyph as a scaling indicator if the glyph is
12080 represented by a single character) use @code{\&}.
12082 Here a small useful example:
12086 \[br]\\$*\[br]\l'|0\[rn]'\l'|0\[ul]'
12091 Note that this works by outputting a box rule (a vertical line), then
12092 the text given as an argument and then another box rule. Finally, the
12093 line drawing escapes both draw from the current location to the
12094 beginning of the @emph{input} line -- this works because the line length
12095 is negative, not moving the current point.
12098 @DefescList {\\L, ', l, '}
12099 @DefescListEnd {\\L, ', lg, '}
12100 @cindex drawing vertical lines (@code{\L})
12101 @cindex vertical line drawing (@code{\L})
12102 @cindex line, vertical, drawing (@code{\L})
12103 @cindex line drawing glyph
12104 @cindex glyph for line drawing
12105 @cindex box rule glyph (@code{\[br]})
12106 @cindex glyph, box rule (@code{\[br]})
12107 Draw vertical lines. Its parameters are similar to the @code{\l}
12108 escape, except that the default scaling indicator is @samp{v}. The
12109 movement is downwards for positive values, and upwards for negative
12110 values. The default glyph is the box rule glyph, @code{\[br]}. As with
12111 the vertical motion escapes, text processing blindly continues where the
12115 This is a \L'3v'test.
12119 Here the result, produced with @code{grotty}.
12129 @Defesc {\\D, ', command arg @dots{}, '}
12130 The @code{\D} escape provides a variety of drawing functions. Note that
12131 on character devices, only vertical and horizontal lines are supported
12132 within @code{grotty}; other devices may only support a subset of the
12133 available drawing functions.
12135 The default scaling indicator for all subcommands of @code{\D} is
12136 @samp{m} for horizontal distances and @samp{v} for vertical ones.
12137 Exceptions are @w{@code{\D'f @dots{}'}} and @w{@code{\D't @dots{}'}},
12138 which use @code{u} as the default, and @w{@code{\D'F@var{x} @dots{}'}},
12139 which arguments are treated similar to the @code{defcolor} request.
12142 @item \D'l @var{dx} @var{dy}'
12143 @cindex line, drawing (@w{@code{\D'l @dots{}'}})
12144 @cindex drawing a line (@w{@code{\D'l @dots{}'}})
12145 Draw a line from the current location to the relative point specified by
12146 (@var{dx},@var{dy}), where positive values mean down and right,
12147 respectively. The end point of the line is the new current location.
12149 The following example is a macro for creating a box around a text
12150 string; for simplicity, the box margin is taken as a fixed value,
12157 \h'-.2m'\v'(.2m - \\n[rsb]u)'\
12158 \D'l 0 -(\\n[rst]u - \\n[rsb]u + .4m)'\
12159 \D'l (\\n[@@wd]u + .4m) 0'\
12160 \D'l 0 (\\n[rst]u - \\n[rsb]u + .4m)'\
12161 \D'l -(\\n[@@wd]u + .4m) 0'\
12162 \h'.2m'\v'-(.2m - \\n[rsb]u)'\
12169 First, the width of the string is stored in register @code{@@wd}. Then,
12170 four lines are drawn to form a box, properly offset by the box margin.
12171 The registers @code{rst} and @code{rsb} are set by the @code{\w} escape,
12172 containing the largest height and depth of the whole string.
12174 @item \D'c @var{d}'
12175 @cindex circle, drawing (@w{@code{\D'c @dots{}'}})
12176 @cindex drawing a circle (@w{@code{\D'c @dots{}'}})
12177 Draw a circle with a diameter of@tie{}@var{d} with the leftmost point at
12178 the current position. After drawing, the current location is positioned
12179 at the rightmost point of the circle.
12181 @item \D'C @var{d}'
12182 @cindex circle, solid, drawing (@w{@code{\D'C @dots{}'}})
12183 @cindex drawing a solid circle (@w{@code{\D'C @dots{}'}})
12184 @cindex solid circle, drawing (@w{@code{\D'C @dots{}'}})
12185 Draw a solid circle with the same parameters and behaviour as an
12186 outlined circle. No outline is drawn.
12188 @item \D'e @var{x} @var{y}'
12189 @cindex drawing an ellipse (@w{@code{\D'e @dots{}'}})
12190 @cindex ellipse, drawing (@w{@code{\D'e @dots{}'}})
12191 Draw an ellipse with a horizontal diameter of @var{x} and a vertical
12192 diameter of @var{y} with the leftmost point at the current position.
12193 After drawing, the current location is positioned at the rightmost point
12196 @item \D'E @var{x} @var{y}'
12197 @cindex ellipse, solid, drawing (@w{@code{\D'E @dots{}'}})
12198 @cindex drawing a solid ellipse (@w{@code{\D'E @dots{}'}})
12199 @cindex solid ellipse, drawing (@w{@code{\D'E @dots{}'}})
12200 Draw a solid ellipse with the same parameters and behaviour as an
12201 outlined ellipse. No outline is drawn.
12203 @item \D'a @var{dx1} @var{dy1} @var{dx2} @var{dy2}'
12204 @cindex arc, drawing (@w{@code{\D'a @dots{}'}})
12205 @cindex drawing an arc (@w{@code{\D'a @dots{}'}})
12206 Draw an arc clockwise from the current location through the two
12207 specified relative locations (@var{dx1},@var{dy1}) and
12208 (@var{dx2},@var{dy2}). The coordinates of the first point are relative
12209 to the current position, and the coordinates of the second point are
12210 relative to the first point. After drawing, the current position is
12211 moved to the final point of the arc.
12213 @item \D'~ @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
12214 @cindex drawing a spline (@w{@code{\D'~ @dots{}'}})
12215 @cindex spline, drawing (@w{@code{\D'~ @dots{}'}})
12216 Draw a spline from the current location to the relative point
12217 (@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}), and so on. The
12218 current position is moved to the terminal point of the drawn curve.
12220 @item \D'f @var{n}'
12221 @cindex gray shading (@w{@code{\D'f @dots{}'}})
12222 @cindex shading filled objects (@w{@code{\D'f @dots{}'}})
12223 Set the shade of gray to be used for filling solid objects
12224 to@tie{}@var{n}; @var{n}@tie{}must be an integer between 0
12225 and@tie{}1000, where 0 corresponds solid white and 1000 to solid black,
12226 and values in between correspond to intermediate shades of gray. This
12227 applies only to solid circles, solid ellipses, and solid polygons. By
12228 default, a level of 1000 is used.
12230 Despite of being silly, the current point is moved horizontally to the
12231 right by@tie{}@var{n}.
12233 @cindex @w{@code{\D'f @dots{}'}} and horizontal resolution
12234 Don't use this command! It has the serious drawback that it is always
12235 rounded to the next integer multiple of the horizontal resolution (the
12236 value of the @code{hor} keyword in the @file{DESC} file). Use @code{\M}
12237 (@pxref{Colors}) or @w{@code{\D'Fg @dots{}'}} instead.
12239 @item \D'p @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
12240 @cindex drawing a polygon (@w{@code{\D'p @dots{}'}})
12241 @cindex polygon, drawing (@w{@code{\D'p @dots{}'}})
12242 Draw a polygon from the current location to the relative position
12243 (@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}) and so on. When
12244 the specified data points are exhausted, a line is drawn back to the
12245 starting point. The current position is changed by adding the sum of
12246 all arguments with odd index to the actual horizontal position and the
12247 even ones to the vertical position.
12249 @item \D'P @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
12250 @cindex polygon, solid, drawing (@w{@code{\D'P @dots{}'}})
12251 @cindex drawing a solid polygon (@w{@code{\D'P @dots{}'}})
12252 @cindex solid polygon, drawing (@w{@code{\D'P @dots{}'}})
12253 Draw a solid polygon with the same parameters and behaviour as an
12254 outlined polygon. No outline is drawn.
12256 Here a better variant of the box macro to fill the box with some color.
12257 Note that the box must be drawn before the text since colors in
12258 @code{gtroff} are not transparent; the filled polygon would hide the
12265 \h'-.2m'\v'(.2m - \\n[rsb]u)'\
12267 \D'P 0 -(\\n[rst]u - \\n[rsb]u + .4m) \
12268 (\\n[@@wd]u + .4m) 0 \
12269 0 (\\n[rst]u - \\n[rsb]u + .4m) \
12270 -(\\n[@@wd]u + .4m) 0'\
12271 \h'.2m'\v'-(.2m - \\n[rsb]u)'\
12278 If you want a filled polygon that has exactly the same size as an
12279 unfilled one, you must draw both an unfilled and a filled polygon. A
12280 filled polygon is always smaller than an unfilled one because the latter
12281 uses straight lines with a given line thickness to connect the polygon's
12282 corners, while the former simply fills the area defined by the
12287 \# increase line thickness
12289 \# draw unfilled polygon
12290 \Z'\D'p 3 3 -6 0''\
12291 \# draw filled polygon
12295 @item \D't @var{n}'
12296 @cindex line thickness (@w{@code{\D't @dots{}'}})
12297 @cindex thickness of lines (@w{@code{\D't @dots{}'}})
12298 Set the current line thickness to @var{n}@tie{}machine units. A value
12299 of zero selects the smallest available line thickness. A negative value
12300 makes the line thickness proportional to the current point size (this is
12301 the default behaviour of @acronym{AT&T} @code{troff}).
12303 Despite of being silly, the current point is moved horizontally to the
12304 right by@tie{}@var{n}.
12306 @item \D'F@var{scheme} @var{color_components}'
12307 @cindex unnamed fill colors (@code{\D'F@dots{}'})
12308 @cindex fill colors, unnamed (@code{\D'F@dots{}'})
12309 @cindex colors, fill, unnamed (@code{\D'F@dots{}'})
12310 Change current fill color. @var{scheme} is a single letter denoting the
12311 color scheme: @samp{r} (rgb), @samp{c} (cmy), @samp{k} (cmyk), @samp{g}
12312 (gray), or @samp{d} (default color). The color components use exactly
12313 the same syntax as in the @code{defcolor} request (@pxref{Colors}); the
12314 command @code{\D'Fd'} doesn't take an argument.
12316 @emph{No} position changing!
12321 \D'Fg .3' \" same gray as \D'f 700'
12322 \D'Fr #0000ff' \" blue
12327 @xref{Graphics Commands}.
12329 @Defesc {\\b, ', string, '}
12330 @cindex pile, glyph (@code{\b})
12331 @cindex glyph pile (@code{\b})
12332 @cindex stacking glyphs (@code{\b})
12333 @dfn{Pile} a sequence of glyphs vertically, and center it vertically on
12334 the current line. Use it to build large brackets and braces.
12336 Here an example how to create a large opening brace:
12339 \b'\[lt]\[bv]\[lk]\[bv]\[lb]'
12342 @cindex @code{\b}, limitations
12343 @cindex limitations of @code{\b} escape
12344 The first glyph is on the top, the last glyph in @var{string} is at the
12345 bottom. Note that @code{gtroff} separates the glyphs vertically by
12346 1@dmn{m}, and the whole object is centered 0.5@dmn{m} above the current
12347 baseline; the largest glyph width is used as the width for the whole
12348 object. This rather unflexible positioning algorithm doesn't work with
12349 @option{-Tdvi} since the bracket pieces vary in height for this device.
12350 Instead, use the @code{eqn} preprocessor.
12352 @xref{Manipulating Spacing}, how to adjust the vertical spacing with the
12357 @c =====================================================================
12359 @node Traps, Diversions, Drawing Requests, gtroff Reference
12363 @dfn{Traps} are locations that, when reached, call a specified macro.
12364 These traps can occur at a given location on the page, at a given
12365 location in the current diversion, at a blank line, after a certain
12366 number of input lines, or at the end of input.
12368 @cindex planting a trap
12369 @cindex trap, planting
12370 Setting a trap is also called @dfn{planting}.
12371 @cindex trap, springing
12372 @cindex springing a trap
12373 It is also said that a trap is @dfn{sprung} if the associated macro is
12377 * Page Location Traps::
12378 * Diversion Traps::
12379 * Input Line Traps::
12380 * Blank Line Traps::
12381 * Leading Spaces Traps::
12382 * End-of-input Traps::
12385 @c ---------------------------------------------------------------------
12387 @node Page Location Traps, Diversion Traps, Traps, Traps
12388 @subsection Page Location Traps
12389 @cindex page location traps
12390 @cindex traps, page location
12392 @dfn{Page location traps} perform an action when @code{gtroff} reaches
12393 or passes a certain vertical location on the page. Page location traps
12394 have a variety of purposes, including:
12398 setting headers and footers
12401 setting body text in multiple columns
12407 @DefreqList {vpt, flag}
12408 @DefregListEndx {.vpt}
12409 @cindex enabling vertical position traps (@code{vpt})
12410 @cindex vertical position traps, enabling (@code{vpt})
12411 @cindex vertical position trap enable register (@code{.vpt})
12412 Enable vertical position traps if @var{flag} is non-zero, or disables
12413 them otherwise. Vertical position traps are traps set by the @code{wh}
12414 or @code{dt} requests. Traps set by the @code{it} request are not
12415 vertical position traps. The parameter that controls whether vertical
12416 position traps are enabled is global. Initially vertical position traps
12417 are enabled. The current setting of this is available in the
12418 @code{.vpt} read-only number register.
12420 Note that a page can't be ejected if @code{vpt} is set to zero.
12423 @Defreq {wh, dist [@Var{macro}]}
12424 Set a page location trap. Non-negative values for @var{dist} set the
12425 trap relative to the top of the page; negative values set the trap
12426 relative to the bottom of the page. Default scaling indicator is
12427 @samp{v}; values of @var{dist} are always rounded to be multiples of the
12428 vertical resolution (as given in register @code{.V}).
12430 @var{macro} is the name of the macro to execute when the trap is sprung.
12431 If @var{macro} is missing, remove the first trap (if any) at @var{dist}.
12433 @cindex page headers
12434 @cindex page footers
12437 The following is a simple example of how many macro packages set headers
12441 .de hd \" Page header
12447 .de fo \" Page footer
12453 .wh 0 hd \" trap at top of the page
12454 .wh -1i fo \" trap one inch from bottom
12457 A trap at or below the bottom of the page is ignored; it can be made
12458 active by either moving it up or increasing the page length so that the
12459 trap is on the page.
12461 Negative trap values always use the @emph{current} page length; they are
12462 not converted to an absolute vertical position:
12474 It is possible to have more than one trap at the same location; to do
12475 so, the traps must be defined at different locations, then moved
12476 together with the @code{ch} request; otherwise the second trap would
12477 replace the first one. Earlier defined traps hide later defined traps
12478 if moved to the same position (the many empty lines caused by the
12479 @code{bp} request are omitted in the following example):
12512 @cindex distance to next trap register (@code{.t})
12513 @cindex trap, distance, register (@code{.t})
12514 A read-only number register holding the distance to the next trap.
12516 If there are no traps between the current position and the bottom of the
12517 page, it contains the distance to the page bottom. In a diversion, the
12518 distance to the page bottom is infinite (the returned value is the
12519 biggest integer that can be represented in @code{groff}) if there are
12520 no diversion traps.
12523 @Defreq {ch, macro [@Var{dist}]}
12524 @cindex changing trap location (@code{ch})
12525 @cindex trap, changing location (@code{ch})
12526 Change the location of a trap. The first argument is the name of the
12527 macro to be invoked at the trap, and the second argument is the new
12528 location for the trap (note that the parameters are specified in
12529 opposite order as in the @code{wh} request). This is useful for
12530 building up footnotes in a diversion to allow more space at the bottom
12531 of the page for them.
12533 Default scaling indicator for @var{dist} is @samp{v}. If @var{dist} is
12534 missing, the trap is removed.
12540 ... (simplified) footnote example ...
12546 The read-only number register @code{.ne} contains the amount of space
12547 that was needed in the last @code{ne} request that caused a trap to be
12548 sprung. Useful in conjunction with the @code{.trunc} register.
12549 @xref{Page Control}, for more information.
12551 Since the @code{.ne} register is only set by traps it doesn't make much
12552 sense to use it outside of trap macros.
12556 @cindex @code{ne} request, and the @code{.trunc} register
12557 @cindex truncated vertical space register (@code{.trunc})
12558 A read-only register containing the amount of vertical space truncated
12559 by the most recently sprung vertical position trap, or, if the trap was
12560 sprung by an @code{ne} request, minus the amount of vertical motion
12561 produced by the @code{ne} request. In other words, at the point a trap
12562 is sprung, it represents the difference of what the vertical position
12563 would have been but for the trap, and what the vertical position
12566 Since the @code{.trunc} register is only set by traps it doesn't make
12567 much sense to use it outside of trap macros.
12571 @cindex @code{bp} request, and traps (@code{.pe})
12572 @cindex traps, sprung by @code{bp} request (@code{.pe})
12573 @cindex page ejecting register (@code{.pe})
12574 A read-only register that is set to@tie{}1 while a page is ejected with
12575 the @code{bp} request (or by the end of input).
12577 Outside of traps this register is always zero. In the following
12578 example, only the second call to@tie{}@code{x} is caused by @code{bp}.
12599 @cindex diversions, and traps
12600 @cindex traps, and diversions
12601 An important fact to consider while designing macros is that diversions
12602 and traps do not interact normally. For example, if a trap invokes a
12603 header macro (while outputting a diversion) that tries to change the
12604 font on the current page, the effect is not visible before the diversion
12605 has completely been printed (except for input protected with @code{\!}
12606 or @code{\?}) since the data in the diversion is already formatted. In
12607 most cases, this is not the expected behaviour.
12609 @c ---------------------------------------------------------------------
12611 @node Diversion Traps, Input Line Traps, Page Location Traps, Traps
12612 @subsection Diversion Traps
12613 @cindex diversion traps
12614 @cindex traps, diversion
12616 @Defreq {dt, [@Var{dist} @Var{macro}]}
12617 @cindex @code{.t} register, and diversions
12618 @cindex setting diversion trap (@code{dt})
12619 @cindex diversion trap, setting (@code{dt})
12620 @cindex trap, diversion, setting (@code{dt})
12621 Set a trap @emph{within} a diversion. @var{dist} is the location of the
12622 trap (identical to the @code{wh} request; default scaling indicator is
12623 @samp{v}) and @var{macro} is the name of the macro to be invoked. If
12624 called without arguments, the diversion trap is removed.
12626 Note that there exists only a single diversion trap.
12628 The number register @code{.t} still works within diversions.
12629 @xref{Diversions}, for more information.
12632 @c ---------------------------------------------------------------------
12634 @node Input Line Traps, Blank Line Traps, Diversion Traps, Traps
12635 @subsection Input Line Traps
12636 @cindex input line traps
12637 @cindex traps, input line
12639 @DefreqList {it, n macro}
12640 @DefreqListEndx {itc, n macro}
12641 @cindex setting input line trap (@code{it})
12642 @cindex input line trap, setting (@code{it})
12643 @cindex trap, input line, setting (@code{it})
12644 Set an input line trap. @var{n}@tie{}is the number of lines of input
12645 that may be read before springing the trap, @var{macro} is the macro to
12646 be invoked. Request lines are not counted as input lines.
12648 For example, one possible use is to have a macro that prints the next
12649 @var{n}@tie{}lines in a bold font.
12662 @cindex input line traps and interrupted lines (@code{itc})
12663 @cindex interrupted lines and input line traps (@code{itc})
12664 @cindex traps, input line, and interrupted lines (@code{itc})
12665 @cindex lines, interrupted, and input line traps (@code{itc})
12666 The @code{itc} request is identical except that an interrupted text line
12667 (ending with @code{\c}) is not counted as a separate line.
12669 Both requests are associated with the current environment
12670 (@pxref{Environments}); switching to another environment disables the
12671 current input trap, and going back reactivates it, restoring the number
12672 of already processed lines.
12675 @c ---------------------------------------------------------------------
12677 @node Blank Line Traps, Leading Spaces Traps, Input Line Traps, Traps
12678 @subsection Blank Line Traps
12679 @cindex blank line traps
12680 @cindex traps, blank line
12682 @Defreq {blm, macro}
12683 @cindex blank line macro (@code{blm})
12684 Set a blank line trap. @code{gtroff} executes @var{macro} when it
12685 encounters a blank line in the input file.
12688 @c ---------------------------------------------------------------------
12690 @node Leading Spaces Traps, End-of-input Traps, Blank Line Traps, Traps
12691 @subsection Leading Spaces Traps
12692 @cindex leading spaces traps
12693 @cindex traps, leading spaces
12695 @DefreqList {lsm, macro}
12697 @DefregListEndx {lss}
12698 @cindex leading spaces macro (@code{lsm})
12699 Set a leading spaces trap. @code{gtroff} executes @var{macro} when it
12700 encounters leading spaces in an input line; the implicit line break
12701 that normally happens in this case is suppressed. A line consisting
12702 of spaces only, however, is treated as an empty line, possibly subject
12703 to an empty line macro set with the @code{blm} request.
12705 Leading spaces are removed from the input line before calling the
12706 leading spaces macro. The number of removed spaces is stored in
12707 register @code{lsn}; the horizontal space that would be emitted if
12708 there was no leading space macro is stored in register @code{lss}.
12709 Note that @code{lsn} and @code{lss} are available even if no leading
12710 space macro has been set.
12712 The first thing a leading space macro sees is a token. However, some
12713 escapes like @code{\f} or @code{\m} are handled on the fly (see
12714 @ref{Gtroff Internals}, for a complete list) without creating a token
12715 at all. Consider that a line starts with two spaces followed by
12716 @code{\fIfoo}. While skipping the spaces @code{\fI} is handled too so
12717 that groff's current font is properly set to @samp{I}, but the leading
12718 space macro only sees @code{foo}, without the preceding @code{\fI}.
12719 If the macro should see the font escape you have to `protect' it with
12720 something that creates a token, for example with @code{\&\fIfoo}.
12723 @c ---------------------------------------------------------------------
12725 @node End-of-input Traps, , Leading Spaces Traps, Traps
12726 @subsection End-of-input Traps
12727 @cindex end-of-input traps
12728 @cindex traps, end-of-input
12730 @Defreq {em, macro}
12731 @cindex setting end-of-input trap (@code{em})
12732 @cindex end-of-input trap, setting (@code{em})
12733 @cindex trap, end-of-input, setting (@code{em})
12734 @cindex end-of-input macro (@code{em})
12735 @cindex macro, end-of-input (@code{em})
12736 Set a trap at the end of input. @var{macro} is executed after the last
12737 line of the input file has been processed.
12739 For example, if the document had to have a section at the bottom of the
12740 last page for someone to approve it, the @code{em} request could be
12747 . sp (\\n[.t]u - 3v)
12759 The @code{\c} in the above example needs explanation. For historical
12760 reasons (and for compatibility with @acronym{AT&T} @code{troff}), the
12761 end macro exits as soon as it causes a page break and no remaining
12762 data is in the partially collected line.
12764 Let us assume that there is no @code{\c} in the above @code{approval}
12765 macro, and that the page is full and has been ended with, say, a
12766 @code{br} request. The @code{ne} request now causes the start of a new
12767 page, which in turn makes @code{troff} exit immediately for the reasons
12768 just described. In most situations this is not intended.
12770 To always force processing the whole end macro independently of this
12771 behaviour it is thus advisable to insert something that starts an
12772 empty partially filled line (@code{\c}) whenever there is a chance that
12773 a page break can happen. In the above example, the call of the
12774 @code{ne} request assures that the remaining code stays on the same
12775 page, so we have to insert @code{\c} only once.
12777 The next example shows how to append three lines, then starting a new
12778 page unconditionally. Since @w{@samp{.ne 1}} doesn't give the desired
12779 effect -- there is always one line available or we are already at the
12780 beginning of the next page -- we temporarily increase the page length
12781 by one line so that we can use @w{@samp{.ne 2}}.
12805 Note that this specific feature affects only the first potential page
12806 break caused by the end macro; further page breaks emitted by the end
12807 macro are handled normally.
12809 Another possible use of the @code{em} request is to make @code{gtroff}
12810 emit a single large page instead of multiple pages. For example, one
12811 may want to produce a long plain-text file for reading on-screen. The
12812 idea is to set the page length at the beginning of the document to a
12813 very large value to hold all the text, and automatically adjust it to
12814 the exact height of the document after the text has been output.
12817 .de adjust-page-length
12819 . pl \\n[nl]u \" \n[nl] holds the current page length
12822 .de single-page-mode
12824 . em adjust-page-length
12827 .\" activate the above code
12831 Since only one end-of-input trap does exist and other macro packages
12832 may already use it, care must be taken not to break the mechanism. A
12833 simple solution would be to append the above macro to the macro
12834 package's end-of-input macro using the @code{.am} request.
12838 @c =====================================================================
12840 @node Diversions, Environments, Traps, gtroff Reference
12841 @section Diversions
12844 In @code{gtroff} it is possible to @dfn{divert} text into a named
12845 storage area. Due to the similarity to defining macros it is sometimes
12846 said to be stored in a macro. This is used for saving text for output
12847 at a later time, which is useful for keeping blocks of text on the same
12848 page, footnotes, tables of contents, and indices.
12850 @cindex top-level diversion
12851 @cindex diversion, top-level
12852 For orthogonality it is said that @code{gtroff} is in the @dfn{top-level
12853 diversion} if no diversion is active (i.e., the data is diverted to the
12856 Although the following requests can be used to create diversions,
12857 simply using an undefined diversion will cause it to be defined as empty.
12858 @xref{Identifiers}.
12860 @DefreqList {di, macro}
12861 @DefreqListEndx {da, macro}
12862 @cindex beginning diversion (@code{di})
12863 @cindex diversion, beginning (@code{di})
12864 @cindex ending diversion (@code{di})
12865 @cindex diversion, ending (@code{di})
12866 @cindex appending to a diversion (@code{da})
12867 @cindex diversion, appending (@code{da})
12868 Begin a diversion. Like the @code{de} request, it takes an argument of
12869 a macro name to divert subsequent text into. The @code{da} macro
12870 appends to an existing diversion.
12872 @code{di} or @code{da} without an argument ends the diversion.
12874 The current partially-filled line is included into the diversion. See
12875 the @code{box} request below for an example. Note that switching to
12876 another (empty) environment (with the @code{ev} request) avoids the
12877 inclusion of the current partially-filled line.
12880 @DefreqList {box, macro}
12881 @DefreqListEndx {boxa, macro}
12882 Begin (or append to) a diversion like the @code{di} and @code{da}
12883 requests. The difference is that @code{box} and @code{boxa} do not
12884 include a partially-filled line in the diversion.
12896 @result{} Before the box. After the box.
12898 @result{} In the box.
12905 Before the diversion.
12910 After the diversion.
12912 @result{} After the diversion.
12914 @result{} Before the diversion. In the diversion.
12917 @code{box} or @code{boxa} without an argument ends the diversion.
12921 @DefregListEndx {.d}
12922 @cindex @code{nl} register, and @code{.d}
12923 @cindex nested diversions
12924 @cindex diversion, nested
12925 @cindex diversion name register (@code{.z})
12926 @cindex vertical position in diversion register (@code{.d})
12927 @cindex position, vertical, in diversion, register (@code{.d})
12928 @cindex diversion, vertical position in, register (@code{.d})
12929 Diversions may be nested. The read-only number register @code{.z}
12930 contains the name of the current diversion (this is a string-valued
12931 register). The read-only number register @code{.d} contains the current
12932 vertical place in the diversion. If not in a diversion it is the same
12933 as register @code{nl}.
12937 @cindex high-water mark register (@code{.h})
12938 @cindex mark, high-water, register (@code{.h})
12939 @cindex position of lowest text line (@code{.h})
12940 @cindex text line, position of lowest (@code{.h})
12941 The @dfn{high-water mark} on the current page. It corresponds to the
12942 text baseline of the lowest line on the page. This is a read-only
12946 .tm .h==\n[.h], nl==\n[nl]
12947 @result{} .h==0, nl==-1
12951 .tm .h==\n[.h], nl==\n[nl]
12952 @result{} .h==40, nl==120
12955 @cindex @code{.h} register, difference to @code{nl}
12956 @cindex @code{nl} register, difference to @code{.h}
12958 As can be seen in the previous example, empty lines are not considered
12959 in the return value of the @code{.h} register.
12963 @DefregListEndx {dl}
12964 @cindex @code{dn} register, and @code{da} (@code{boxa})
12965 @cindex @code{dl} register, and @code{da} (@code{boxa})
12966 @cindex @code{da} request, and @code{dn} (@code{dl})
12967 @cindex @code{boxa} request, and @code{dn} (@code{dl})
12968 After completing a diversion, the read-write number registers @code{dn}
12969 and @code{dl} contain the vertical and horizontal size of the diversion.
12970 Note that only the just processed lines are counted: For the computation
12971 of @code{dn} and @code{dl}, the requests @code{da} and @code{boxa} are
12972 handled as if @code{di} and @code{box} had been used -- lines that have
12973 been already stored in a macro are not taken into account.
12976 .\" Center text both horizontally & vertically
12978 .\" Enclose macro definitions in .eo and .ec
12979 .\" to avoid the doubling of the backslash
12981 .\" macro .(c starts centering mode
12992 .\" macro .)c terminates centering mode
12997 . nr @@s (((\n[.t]u - \n[dn]u) / 2u) - 1v)
13009 .\" End of macro definitions, restore escape mechanism
13014 @DefescList {\\!, , , }
13015 @DefescListEndx {\\?, , anything, \\?}
13016 @cindex transparent output (@code{\!}, @code{\?})
13017 @cindex output, transparent (@code{\!}, @code{\?})
13018 Prevent requests, macros, and escapes from being interpreted when read
13019 into a diversion. Both escapes take the given text and
13020 @dfn{transparently} embed it into the diversion. This is useful for
13021 macros that shouldn't be invoked until the diverted text is actually
13024 The @code{\!} escape transparently embeds text up to and including the
13025 end of the line. The @code{\?} escape transparently embeds text until
13026 the next occurrence of the @code{\?} escape. Example:
13032 @cindex @code{\?}, and copy-in mode
13033 @cindex copy-in mode, and @code{\?}
13034 @cindex mode, copy-in, and @code{\?}
13035 @cindex @code{\!}, and copy-in mode
13036 @cindex copy-in mode, and @code{\!}
13037 @cindex mode, copy-in, and @code{\!}
13039 @var{anything} may not contain newlines; use @code{\!} to embed
13040 newlines in a diversion. The escape sequence @code{\?} is also
13041 recognized in copy mode and turned into a single internal code; it is
13042 this code that terminates @var{anything}. Thus the following example
13049 \?\\?\\\\?\\\\\\\\nx\\\\?\\?\?
13063 Both escapes read the data in copy mode.
13065 @cindex @code{\!}, in top-level diversion
13066 @cindex top-level diversion, and @code{\!}
13067 @cindex diversion, top-level, and @code{\!}
13068 If @code{\!} is used in the top-level diversion, its argument is
13069 directly embedded into the @code{gtroff} intermediate output. This can
13070 be used for example to control a postprocessor that processes the data
13071 before it is sent to the device driver.
13073 @cindex @code{\?}, in top-level diversion
13074 @cindex top-level diversion, and @code{\?}
13075 @cindex diversion, top-level, and @code{\?}
13076 The @code{\?} escape used in the top-level diversion produces no output
13077 at all; its argument is simply ignored.
13080 @cindex @code{\!}, and @code{output} request
13081 @cindex @code{output} request, and @code{\!}
13082 @cindex @code{output} request, and copy-in mode
13083 @cindex copy-in mode, and @code{output} request
13084 @cindex mode, copy-in, and @code{output} request
13085 @Defreq {output, string}
13086 Emit @var{string} directly to the @code{gtroff} intermediate output
13087 (subject to copy mode interpretation); this is similar to @code{\!} used
13088 at the top level. An initial double quote in @var{string} is stripped
13089 off to allow initial blanks.
13091 This request can't be used before the first page has started -- if you
13092 get an error, simply insert @code{.br} before the @code{output} request.
13094 Without argument, @code{output} is ignored.
13096 Use with caution! It is normally only needed for mark-up used by a
13097 postprocessor that does something with the output before sending it to
13098 the output device, filtering out @var{string} again.
13101 @Defreq {asciify, div}
13102 @cindex unformatting diversions (@code{asciify})
13103 @cindex diversion, unformatting (@code{asciify})
13104 @cindex @code{trin} request, and @code{asciify}
13105 @dfn{Unformat} the diversion specified by @var{div} in such a way that
13106 @acronym{ASCII} characters, characters translated with the @code{trin}
13107 request, space characters, and some escape sequences that were formatted
13108 and diverted are treated like ordinary input characters when the
13109 diversion is reread. It can be also used for gross hacks; for example,
13110 the following sets register@tie{}@code{n} to@tie{}1.
13123 Note that @code{asciify} cannot return all items in a diversion back
13124 to their source equivalent, nodes such as @code{\N[...]} will still
13125 remain as nodes, so the result cannot be guaranteed to be a pure string.
13127 @xref{Copy-in Mode}.
13130 @Defreq {unformat, div}
13131 Like @code{asciify}, unformat the specified diversion. However,
13132 @code{unformat} only unformats spaces and tabs between words.
13133 Unformatted tabs are treated as input tokens, and spaces are stretchable
13136 The vertical size of lines is not preserved; glyph information (font,
13137 font size, space width, etc.)@: is retained.
13141 @c =====================================================================
13143 @node Environments, Suppressing output, Diversions, gtroff Reference
13144 @section Environments
13145 @cindex environments
13147 It happens frequently that some text should be printed in a certain
13148 format regardless of what may be in effect at the time, for example, in
13149 a trap invoked macro to print headers and footers. To solve this
13150 @code{gtroff} processes text in @dfn{environments}. An environment
13151 contains most of the parameters that control text processing. It is
13152 possible to switch amongst these environments; by default @code{gtroff}
13153 processes text in environment@tie{}0. The following is the information
13154 kept in an environment.
13158 font parameters (size, family, style, glyph height and slant, space and
13159 sentence space size)
13162 page parameters (line length, title length, vertical spacing, line
13163 spacing, indentation, line numbering, centering, right-justifying,
13164 underlining, hyphenation data)
13167 fill and adjust mode
13170 tab stops, tab and leader characters, escape character, no-break and
13171 hyphen indicators, margin character data
13174 partially collected lines
13180 drawing and fill colours
13183 These environments may be given arbitrary names (see @ref{Identifiers},
13184 for more info). Old versions of @code{troff} only had environments
13185 named @samp{0}, @samp{1}, and @samp{2}.
13187 @DefreqList {ev, [@Var{env}]}
13188 @DefregListEndx {.ev}
13189 @cindex switching environments (@code{ev})
13190 @cindex environment, switching (@code{ev})
13191 @cindex environment number/name register (@code{.ev})
13192 Switch to another environment. The argument @var{env} is the name of
13193 the environment to switch to. With no argument, @code{gtroff} switches
13194 back to the previous environment. There is no limit on the number of
13195 named environments; they are created the first time that they are
13196 referenced. The @code{.ev} read-only register contains the name or
13197 number of the current environment. This is a string-valued register.
13199 Note that a call to @code{ev} (with argument) pushes the previously
13200 active environment onto a stack. If, say, environments @samp{foo},
13201 @samp{bar}, and @samp{zap} are called (in that order), the first
13202 @code{ev} request without parameter switches back to environment
13203 @samp{bar} (which is popped off the stack), and a second call switches
13204 back to environment @samp{foo}.
13206 Here is an example:
13219 \(dg Note the large, friendly letters.
13225 @cindex copying environment (@code{evc})
13226 @cindex environment, copying (@code{evc})
13227 Copy the environment @var{env} into the current environment.
13229 The following environment data is not copied:
13233 Partially filled lines.
13236 The status whether the previous line was interrupted.
13239 The number of lines still to center, or to right-justify, or to
13240 underline (with or without underlined spaces); they are set to zero.
13243 The status whether a temporary indentation is active.
13246 Input traps and its associated data.
13249 Line numbering mode is disabled; it can be reactivated with @w{@samp{.nm
13253 The number of consecutive hyphenated lines (set to zero).
13258 @DefregItemx {.cht}
13259 @DefregItemx {.cdp}
13260 @DefregListEndx {.csk}
13261 @cindex environment, dimensions of last glyph (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
13262 @cindex width, of last glyph (@code{.w})
13263 @cindex height, of last glyph (@code{.cht})
13264 @cindex depth, of last glyph (@code{.cdp})
13265 @cindex skew, of last glyph (@code{.csk})
13266 @cindex last glyph, dimensions (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
13267 @cindex glyph, last, dimensions (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
13268 The @code{\n[.w]} register contains the width of the last glyph added to
13269 the current environment.
13271 The @code{\n[.cht]} register contains the height of the last glyph added
13272 to the current environment.
13274 The @code{\n[.cdp]} register contains the depth of the last glyph added
13275 to the current environment. It is positive for glyphs extending below
13278 The @code{\n[.csk]} register contains the @dfn{skew} (how far to the
13279 right of the glyph's center that @code{gtroff} should place an accent)
13280 of the last glyph added to the current environment.
13284 @cindex environment, previous line length (@code{.n})
13285 @cindex line length, previous (@code{.n})
13286 @cindex length of previous line (@code{.n})
13287 @cindex previous line length (@code{.n})
13288 The @code{\n[.n]} register contains the length of the previous output
13289 line in the current environment.
13293 @c =====================================================================
13295 @node Suppressing output, Colors, Environments, gtroff Reference
13296 @section Suppressing output
13298 @Defesc {\\O, , num, }
13299 @cindex suppressing output (@code{\O})
13300 @cindex output, suppressing (@code{\O})
13301 Disable or enable output depending on the value of @var{num}:
13305 Disable any glyphs from being emitted to the device driver, provided
13306 that the escape occurs at the outer level (see @code{\O[3]} and
13307 @code{\O[4]}). Motion is not suppressed so effectively @code{\O[0]}
13308 means @emph{pen up}.
13311 Enable output of glyphs, provided that the escape occurs at the outer
13319 @code{\O0} and @code{\O1} also reset the four registers @samp{opminx},
13320 @samp{opminy}, @samp{opmaxx}, and @samp{opmaxy} to @minus{}1.
13321 @xref{Register Index}. These four registers mark the top left and
13322 bottom right hand corners of a box that encompasses all written glyphs.
13324 For example the input text:
13327 Hello \O[0]world \O[1]this is a test.
13331 produces the following output:
13334 Hello this is a test.
13339 Provided that the escape occurs at the outer level, enable output of
13340 glyphs and also write out to @code{stderr} the page number and four
13341 registers encompassing the glyphs previously written since the last call
13345 Begin a nesting level. At start-up, @code{gtroff} is at outer level.
13346 The current level is contained within the read-only register @code{.O}.
13347 @xref{Built-in Registers}.
13350 End a nesting level. The current level is contained within the
13351 read-only register @code{.O}. @xref{Built-in Registers}.
13353 @item \O[5@var{P}@var{filename}]
13354 This escape is @code{grohtml} specific. Provided that this escape
13355 occurs at the outer nesting level write the @code{filename} to
13356 @code{stderr}. The position of the image, @var{P}, must be specified
13357 and must be one of @code{l}, @code{r}, @code{c}, or@tie{}@code{i} (left,
13358 right, centered, inline). @var{filename} is associated with the
13359 production of the next inline image.
13364 @c =====================================================================
13366 @node Colors, I/O, Suppressing output, gtroff Reference
13370 @DefreqList {color, [@Var{n}]}
13371 @DefregListEndx {.color}
13372 If @var{n} is missing or non-zero, activate colors (this is the
13373 default); otherwise, turn it off.
13375 The read-only number register @code{.color} is@tie{}1 if colors are
13376 active, 0@tie{}otherwise.
13378 Internally, @code{color} sets a global flag; it does not produce a
13379 token. Similar to the @code{cp} request, you should use it at the
13380 beginning of your document to control color output.
13382 Colors can be also turned off with the @option{-c} command line option.
13385 @Defreq {defcolor, ident scheme color_components}
13386 Define color with name @var{ident}. @var{scheme} can be one of the
13387 following values: @code{rgb} (three components), @code{cmy} (three
13388 components), @code{cmyk} (four components), and @code{gray} or
13389 @code{grey} (one component).
13391 @cindex default color
13392 @cindex color, default
13393 Color components can be given either as a hexadecimal string or as
13394 positive decimal integers in the range 0--65535. A hexadecimal string
13395 contains all color components concatenated. It must start with either
13396 @code{#} or @code{##}; the former specifies hex values in the range
13397 0--255 (which are internally multiplied by@tie{}257), the latter in the
13398 range 0--65535. Examples: @code{#FFC0CB} (pink), @code{##ffff0000ffff}
13399 (magenta). The default color name @c{default} can't be redefined; its
13400 value is device-specific (usually black). It is possible that the
13401 default color for @code{\m} and @code{\M} is not identical.
13403 @cindex @code{f} unit, and colors
13404 @cindex unit, @code{f}, and colors
13405 A new scaling indicator@tie{}@code{f} has been introduced, which
13406 multiplies its value by 65536; this makes it convenient to specify color
13407 components as fractions in the range 0 to@tie{}1 (1f equals 65536u).
13411 .defcolor darkgreen rgb 0.1f 0.5f 0.2f
13414 Note that @code{f} is the default scaling indicator for the
13415 @code{defcolor} request, thus the above statement is equivalent to
13418 .defcolor darkgreen rgb 0.1 0.5 0.2
13422 @DefreqList {gcolor, [@Var{color}]}
13423 @DefescItemx {\\m, , c, }
13424 @DefescItem {\\m, @Lparen{}, co, }
13425 @DefescItem {\\m, @Lbrack{}, color, @Rbrack{}}
13426 @DefregListEndx {.m}
13427 Set (glyph) drawing color. The following examples show how to turn the
13428 next four words red.
13434 and these words are in black.
13438 \m[red]these are in red\m[] and these words are in black.
13441 The escape @code{\m[]} returns to the previous color, as does a call to
13442 @code{gcolor} without an argument.
13444 @cindex drawing color name register (@code{.m})
13445 @cindex name, drawing color, register (@code{.m})
13446 @cindex color name, drawing, register (@code{.m})
13447 The name of the current drawing color is available in the read-only,
13448 string-valued number register @samp{.m}.
13450 The drawing color is associated with the current environment
13451 (@pxref{Environments}).
13453 Note that @code{\m} doesn't produce an input token in @code{gtroff}. As
13454 a consequence, it can be used in requests like @code{mc} (which expects
13455 a single character as an argument) to change the color on the fly:
13462 @DefreqList {fcolor, [@Var{color}]}
13463 @DefescItemx {\\M, , c, }
13464 @DefescItem {\\M, @Lparen{}, co, }
13465 @DefescItem {\\M, @Lbrack{}, color, @Rbrack{}}
13466 @DefregListEndx {.M}
13467 Set fill (background) color for filled objects drawn with the
13468 @code{\D'@dots{}'} commands.
13470 A red ellipse can be created with the following code:
13473 \M[red]\h'0.5i'\D'E 2i 1i'\M[]
13476 The escape @code{\M[]} returns to the previous fill color, as does a
13477 call to @code{fcolor} without an argument.
13479 @cindex background color name register (@code{.M})
13480 @cindex name, background color, register (@code{.M})
13481 @cindex color name, background, register (@code{.M})
13482 @cindex fill color name register (@code{.M})
13483 @cindex name, fill color, register (@code{.M})
13484 @cindex color name, fill, register (@code{.M})
13485 The name of the current fill (background) color is available in the
13486 read-only, string-valued number register @samp{.M}.
13488 The fill color is associated with the current environment
13489 (@pxref{Environments}).
13491 Note that @code{\M} doesn't produce an input token in @code{gtroff}.
13495 @c =====================================================================
13497 @node I/O, Postprocessor Access, Colors, gtroff Reference
13500 @cindex input and output requests
13501 @cindex requests for input and output
13502 @cindex output and input requests
13504 @code{gtroff} has several requests for including files:
13507 @cindex including a file (@code{so})
13508 @cindex file, inclusion (@code{so})
13509 Read in the specified @var{file} and includes it in place of the
13510 @code{so} request. This is quite useful for large documents, e.g.@:
13511 keeping each chapter in a separate file. @xref{gsoelim}, for more
13514 Since @code{gtroff} replaces the @code{so} request with the contents of
13515 @code{file}, it makes a difference whether the data is terminated with a
13516 newline or not: Assuming that file @file{xxx} contains the word
13517 @samp{foo} without a final newline, this
13526 yields @samp{This is foobar}.
13528 The search path for @var{file} can be controlled with the @option{-I}
13529 command line option.
13532 @Defreq {pso, command}
13533 Read the standard output from the specified @var{command} and includes
13534 it in place of the @code{pso} request.
13537 @cindex mode, safer
13538 @cindex unsafe mode
13539 @cindex mode, unsafe
13540 This request causes an error if used in safer mode (which is the
13541 default). Use @code{groff}'s or @code{troff}'s @option{-U} option to
13542 activate unsafe mode.
13544 The comment regarding a final newline for the @code{so} request is valid
13545 for @code{pso} also.
13548 @Defreq {mso, file}
13549 Identical to the @code{so} request except that @code{gtroff} searches
13550 for the specified @var{file} in the same directories as macro files for
13551 the the @option{-m} command line option. If the file name to be
13552 included has the form @file{@var{name}.tmac} and it isn't found,
13553 @code{mso} tries to include @file{tmac.@var{name}} and vice versa.
13554 If the file does not exist, a warning of type @samp{file} is emitted.
13555 @xref{Debugging}, for information about warnings.
13558 @DefreqList {trf, file}
13559 @DefreqListEndx {cf, file}
13560 @cindex transparent output (@code{cf}, @code{trf})
13561 @cindex output, transparent (@code{cf}, @code{trf})
13562 @cindex @code{cf} request, and copy-in mode
13563 @cindex copy-in mode, and @code{cf} request
13564 @cindex mode, copy-in, and @code{cf} request
13565 @cindex @code{trf} request, and copy-in mode
13566 @cindex copy-in mode, and @code{trf} request
13567 @cindex mode, copy-in, and @code{trf} request
13568 Transparently output the contents of @var{file}. Each line is output as
13569 if it were preceded by @code{\!}; however, the lines are @emph{not}
13570 subject to copy mode interpretation. If the file does not end with a
13571 newline, then a newline is added (@code{trf} only). For example, to
13572 define a macro@tie{}@code{x} containing the contents of
13573 file@tie{}@file{f}, use
13584 The calls to @code{ev} prevent that the current partial input line
13585 becomes part of the diversion.
13587 Both @code{trf} and @code{cf}, when used in a diversion, embeds an
13588 object in the diversion which, when reread, causes the contents of
13589 @var{file} to be transparently copied through to the output. In
13590 @acronym{UNIX} @code{troff}, the contents of @var{file} is immediately
13591 copied through to the output regardless of whether there is a current
13592 diversion; this behaviour is so anomalous that it must be considered a
13595 @cindex @code{trf} request, and invalid characters
13596 @cindex characters, invalid for @code{trf} request
13597 @cindex invalid characters for @code{trf} request
13599 While @code{cf} copies the contents of @var{file} completely
13600 unprocessed, @code{trf} disallows characters such as NUL that are not
13601 valid @code{gtroff} input characters (@pxref{Identifiers}).
13603 For @code{cf}, within a diversion, `completely unprocessed' means that
13604 each line of a file to be inserted is handled as if it were preceded by
13607 Both requests cause a line break.
13610 @Defreq {nx, [@Var{file}]}
13611 @cindex processing next file (@code{nx})
13612 @cindex file, processing next (@code{nx})
13613 @cindex next file, processing (@code{nx})
13614 Force @code{gtroff} to continue processing of the file specified as an
13615 argument. If no argument is given, immediately jump to the end of file.
13618 @Defreq {rd, [@Var{prompt} [@Var{arg1} @Var{arg2} @dots{}]]}
13619 @cindex reading from standard input (@code{rd})
13620 @cindex standard input, reading from (@code{rd})
13621 @cindex input, standard, reading from (@code{rd})
13622 Read from standard input, and include what is read as though it were
13623 part of the input file. Text is read until a blank line is encountered.
13625 If standard input is a TTY input device (keyboard), write @var{prompt}
13626 to standard error, followed by a colon (or send BEL for a beep if no
13627 argument is given).
13629 Arguments after @var{prompt} are available for the input. For example,
13636 with the input @w{@samp{This is \$2.}} prints
13643 @cindex form letters
13644 @cindex letters, form
13645 Using the @code{nx} and @code{rd} requests, it is easy to set up form
13646 letters. The form letter template is constructed like this, putting the
13647 following lines into a file called @file{repeat.let}:
13663 @cindex @code{ex} request, used with @code{nx} and @code{rd}
13665 When this is run, a file containing the following lines should be
13666 redirected in. Note that requests included in this file are executed as
13667 though they were part of the form letter. The last block of input is
13668 the @code{ex} request, which tells @code{groff} to stop processing. If
13669 this was not there, @code{groff} would not know when to stop.
13673 708 NW 19th Av., #202
13680 San Diego, CA 92103
13688 Pipe the output of @code{gtroff} to the shell command(s) specified by
13689 @var{pipe}. This request must occur before @code{gtroff} has a chance
13693 @cindex mode, safer
13694 @cindex unsafe mode
13695 @cindex mode, unsafe
13696 @code{pi} causes an error if used in safer mode (which is the default).
13697 Use @code{groff}'s or @code{troff}'s @option{-U} option to activate
13700 Multiple calls to @code{pi} are allowed, acting as a chain. For
13709 is the same as @w{@samp{.pi foo | bar}}.
13711 @cindex @code{groff}, and @code{pi} request
13712 @cindex @code{pi} request, and @code{groff}
13713 Note that the intermediate output format of @code{gtroff} is piped to
13714 the specified commands. Consequently, calling @code{groff} without the
13715 @option{-Z} option normally causes a fatal error.
13718 @DefreqList {sy, cmds}
13719 @DefregListEndx {systat}
13720 Execute the shell command(s) specified by @var{cmds}. The output is not
13721 saved anyplace, so it is up to the user to do so.
13724 @cindex mode, safer
13725 @cindex unsafe mode
13726 @cindex mode, unsafe
13727 This request causes an error if used in safer mode (which is the
13728 default). Use @code{groff}'s or @code{troff}'s @option{-U} option to
13729 activate unsafe mode.
13731 For example, the following code fragment introduces the current time
13734 @cindex time, current
13735 @cindex current time
13738 .sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\
13739 (localtime(time))[2,1,0]' > /tmp/x\n[$$]
13741 .sy rm /tmp/x\n[$$]
13746 Note that this works by having the @code{perl} script (run by @code{sy})
13747 print out the @code{nr} requests that set the number registers
13748 @code{H}, @code{M}, and @code{S}, and then reads those commands in with
13749 the @code{so} request.
13751 For most practical purposes, the number registers @code{seconds},
13752 @code{minutes}, and @code{hours}, which are initialized at start-up of
13753 @code{gtroff}, should be sufficient. Use the @code{af} request to get a
13760 \n[hours]:\n[minutes]:\n[seconds]
13763 @cindex @code{system()} return value register (@code{systat})
13764 The @code{systat} read-write number register contains the return value
13765 of the @code{system()} function executed by the last @code{sy} request.
13768 @DefreqList {open, stream file}
13769 @DefreqListEndx {opena, stream file}
13770 @cindex opening file (@code{open})
13771 @cindex file, opening (@code{open})
13772 @cindex appending to a file (@code{opena})
13773 @cindex file, appending to (@code{opena})
13774 Open the specified @var{file} for writing and associates the specified
13775 @var{stream} with it.
13777 The @code{opena} request is like @code{open}, but if the file exists,
13778 append to it instead of truncating it.
13781 @cindex mode, safer
13782 @cindex unsafe mode
13783 @cindex mode, unsafe
13784 Both @code{open} and @code{opena} cause an error if used in safer mode
13785 (which is the default). Use @code{groff}'s or @code{troff}'s
13786 @option{-U} option to activate unsafe mode.
13789 @DefreqList {write, stream data}
13790 @DefreqListEndx {writec, stream data}
13791 @cindex copy-in mode, and @code{write} request
13792 @cindex @code{write} request, and copy-in mode
13793 @cindex mode, copy-in, and @code{write} request
13794 @cindex copy-in mode, and @code{writec} request
13795 @cindex @code{writec} request, and copy-in mode
13796 @cindex mode, copy-in, and @code{writec} request
13797 @cindex writing to file (@code{write}, @code{writec})
13798 @cindex file, writing to (@code{write}, @code{writec})
13799 Write to the file associated with the specified @var{stream}. The
13800 stream must previously have been the subject of an open request. The
13801 remainder of the line is interpreted as the @code{ds} request reads its
13802 second argument: A leading @samp{"} is stripped, and it is read in
13805 The @code{writec} request is like @code{write}, but only @code{write}
13806 appends a newline to the data.
13809 @Defreq {writem, stream xx}
13810 @cindex @code{asciify} request, and @code{writem}
13811 Write the contents of the macro or string @var{xx} to the file
13812 associated with the specified @var{stream}.
13814 @cindex @code{writem} request, and copy-in mode
13815 @cindex copy-in mode, and @code{writem} request
13816 @cindex mode, copy-in, and @code{writem} request
13817 @var{xx} is read in copy mode, i.e., already formatted elements are
13818 ignored. Consequently, diversions must be unformatted with the
13819 @code{asciify} request before calling @code{writem}. Usually, this
13820 means a loss of information.
13823 @Defreq {close, stream}
13824 @cindex closing file (@code{close})
13825 @cindex file, closing (@code{close})
13826 Close the specified @var{stream}; the stream is no longer an acceptable
13827 argument to the @code{write} request.
13829 Here a simple macro to write an index entry.
13835 . write idx \\n[%] \\$*
13844 @DefescList {\\V, , e, }
13845 @DefescItem {\\V, @Lparen{}, ev, }
13846 @DefescListEnd {\\V, @Lbrack{}, env, @Rbrack{}}
13847 @cindex @code{\V}, and copy-in mode
13848 @cindex copy-in mode, and @code{\V}
13849 @cindex mode, copy-in, and @code{\V}
13850 Interpolate the contents of the specified environment variable @var{env}
13851 (one-character name@tie{}@var{e}, two-character name @var{ev}) as
13852 returned by the function @code{getenv}. @code{\V} is interpreted in
13857 @c =====================================================================
13859 @node Postprocessor Access, Miscellaneous, I/O, gtroff Reference
13860 @section Postprocessor Access
13861 @cindex postprocessor access
13862 @cindex access of postprocessor
13864 There are two escapes that give information directly to the
13865 postprocessor. This is particularly useful for embedding
13866 @sc{PostScript} into the final document.
13868 @DefreqList {device, xxx}
13869 @DefescListEndx {\\X, ', xxx, '}
13870 Embeds its argument into the @code{gtroff} output preceded with
13873 @cindex @code{\&}, in @code{\X}
13874 @cindex @code{\)}, in @code{\X}
13875 @cindex @code{\%}, in @code{\X}
13877 @cindex @code{\:}, in @code{\X}
13880 @cindex @code{\@r{<colon>}}, in @code{\X}
13882 The escapes @code{\&}, @code{\)}, @code{\%}, and @code{\:} are ignored
13883 within @code{\X}, @w{@samp{\ }} and @code{\~} are converted to single
13884 space characters. All other escapes (except @code{\\}, which produces a
13885 backslash) cause an error.
13887 @cindex @code{device} request, and copy-in mode
13888 @cindex copy-in mode, and @code{device} request
13889 @cindex mode, copy-in, and @code{device} request
13890 Contrary to @code{\X}, the @code{device} request simply processes its
13891 argument in copy mode (@pxref{Copy-in Mode}).
13893 @kindex use_charnames_in_special
13894 @pindex DESC@r{, and @code{use_charnames_in_special}}
13895 @cindex @code{\X}, and special characters
13896 If the @samp{use_charnames_in_special} keyword is set in the @file{DESC}
13897 file, special characters no longer cause an error; they are simply
13898 output verbatim. Additionally, the backslash is represented as
13901 @samp{use_charnames_in_special} is currently used by @code{grohtml}
13905 @DefreqList {devicem, xx}
13906 @DefescItemx {\\Y, , n, }
13907 @DefescItem {\\Y, @Lparen{}, nm, }
13908 @DefescListEnd {\\Y, @Lbrack{}, name, @Rbrack{}}
13909 This is approximately equivalent to @samp{\X'\*[@var{name}]'}
13910 (one-character name@tie{}@var{n}, two-character name @var{nm}).
13911 However, the contents of the string or macro @var{name} are not
13912 interpreted; also it is permitted for @var{name} to have been defined as
13913 a macro and thus contain newlines (it is not permitted for the argument
13914 to @code{\X} to contain newlines). The inclusion of newlines requires
13915 an extension to the @acronym{UNIX} @code{troff} output format, and
13916 confuses drivers that do not know about this extension (@pxref{Device
13917 Control Commands}).
13920 @xref{Output Devices}.
13923 @c =====================================================================
13925 @node Miscellaneous, Gtroff Internals, Postprocessor Access, gtroff Reference
13926 @section Miscellaneous
13928 This section documents parts of @code{gtroff} that cannot (yet) be
13929 categorized elsewhere in this manual.
13931 @Defreq {nm, [@Var{start} [@Var{inc} [@Var{space} [@Var{indent}]]]]}
13932 @cindex printing line numbers (@code{nm})
13933 @cindex line numbers, printing (@code{nm})
13934 @cindex numbers, line, printing (@code{nm})
13935 Print line numbers. @var{start} is the line number of the @emph{next}
13936 output line. @var{inc} indicates which line numbers are printed. For
13937 example, the value@tie{}5 means to emit only line numbers that are
13938 multiples of@tie{}5; this defaults to@tie{}1. @var{space} is the space
13939 to be left between the number and the text; this defaults to one digit
13940 space. The fourth argument is the indentation of the line numbers,
13941 defaulting to zero. Both @var{space} and @var{indent} are given as
13942 multiples of digit spaces; they can be negative also. Without any
13943 arguments, line numbers are turned off.
13945 @code{gtroff} reserves three digit spaces for the line number (which is
13946 printed right-justified) plus the amount given by @var{indent}; the
13947 output lines are concatenated to the line numbers, separated by
13948 @var{space}, and @emph{without} reducing the line length. Depending on
13949 the value of the horizontal page offset (as set with the @code{po}
13950 request), line numbers that are longer than the reserved space stick
13951 out to the left, or the whole line is moved to the right.
13953 Parameters corresponding to missing arguments are not changed; any
13954 non-digit argument (to be more precise, any argument starting with a
13955 character valid as a delimiter for identifiers) is also treated as
13958 If line numbering has been disabled with a call to @code{nm} without an
13959 argument, it can be reactivated with @samp{.nm +0}, using the previously
13960 active line numbering parameters.
13962 The parameters of @code{nm} are associated with the current environment
13963 (@pxref{Environments}). The current output line number is available in
13964 the number register @code{ln}.
13969 This test shows how line numbering works with groff.
13971 This test shows how line numbering works with groff.
13975 This test shows how line numbering works with groff.
13977 This test shows how line numbering works with groff.
13981 And here the result:
13984 This test shows how
13985 line numbering works
13986 999 with groff. This
13987 1000 test shows how line
13988 1001 numbering works with
13990 This test shows how
13993 This test shows how
13994 1005 line numbering
13999 @Defreq {nn, [@Var{skip}]}
14000 Temporarily turn off line numbering. The argument is the number of
14001 lines not to be numbered; this defaults to@tie{}1.
14004 @Defreq {mc, glyph [@Var{dist}]}
14005 @cindex margin glyph (@code{mc})
14006 @cindex glyph, for margins (@code{mc})
14007 Print a @dfn{margin character} to the right of the
14008 text.@footnote{@dfn{Margin character} is a misnomer since it is an
14009 output glyph.} The first argument is the glyph to be printed. The
14010 second argument is the distance away from the right margin. If missing,
14011 the previously set value is used; default is 10@dmn{pt}). For text
14012 lines that are too long (that is, longer than the text length plus
14013 @var{dist}), the margin character is directly appended to the lines.
14015 With no arguments the margin character is turned off. If this occurs
14016 before a break, no margin character is printed.
14018 For compatibility with @acronym{AT&T} @code{troff}, a call to @code{mc}
14019 to set the margin character can't be undone immediately; at least one
14020 line gets a margin character. Thus
14039 @cindex @code{tl} request, and @code{mc}
14040 For empty lines and lines produced by the @code{tl} request no margin
14041 character is emitted.
14043 The margin character is associated with the current environment
14044 (@pxref{Environments}).
14048 This is quite useful for indicating text that has changed, and, in fact,
14049 there are programs available for doing this (they are called
14050 @code{nrchbar} and @code{changebar} and can be found in any
14051 @samp{comp.sources.unix} archive).
14056 This paragraph is highlighted with a margin
14059 Note that vertical space isn't marked.
14063 But we can fake it with `\&'.
14069 This paragraph is highlighted |
14070 with a margin character. |
14072 Note that vertical space isn't |
14075 But we can fake it with `\&'. |
14079 @DefreqList {psbb, filename}
14083 @DefregListEndx {ury}
14084 @cindex PostScript, bounding box
14085 @cindex bounding box
14086 Retrieve the bounding box of the @sc{PostScript} image found in
14087 @var{filename}. The file must conform to Adobe's @dfn{Document
14088 Structuring Conventions} (DSC); the command searches for a
14089 @code{%%BoundingBox} comment and extracts the bounding box values into
14090 the number registers @code{llx}, @code{lly}, @code{urx}, and @code{ury}.
14091 If an error occurs (for example, @code{psbb} cannot find the
14092 @code{%%BoundingBox} comment), it sets the four number registers to
14095 The search path for @var{filename} can be controlled with the
14096 @option{-I} command line option.
14100 @c =====================================================================
14102 @node Gtroff Internals, Debugging, Miscellaneous, gtroff Reference
14103 @section @code{gtroff} Internals
14105 @cindex input token
14106 @cindex token, input
14107 @cindex output node
14108 @cindex node, output
14109 @code{gtroff} processes input in three steps. One or more input
14110 characters are converted to an @dfn{input token}.@footnote{Except the
14111 escapes @code{\f}, @code{\F}, @code{\H}, @code{\m}, @code{\M},
14112 @code{\R}, @code{\s}, and @code{\S}, which are processed immediately if
14113 not in copy-in mode.} Then, one or more input tokens are converted to
14114 an @dfn{output node}. Finally, output nodes are converted to the
14115 intermediate output language understood by all output devices.
14117 Actually, before step one happens, @code{gtroff} converts certain escape
14118 sequences into reserved input characters (not accessible by the user);
14119 such reserved characters are used for other internal processing also --
14120 this is the very reason why not all characters are valid input.
14121 @xref{Identifiers}, for more on this topic.
14123 For example, the input string @samp{fi\[:u]} is converted into a
14124 character token @samp{f}, a character token @samp{i}, and a special
14125 token @samp{:u} (representing u@tie{}umlaut). Later on, the character
14126 tokens @samp{f} and @samp{i} are merged to a single output node
14127 representing the ligature glyph @samp{fi} (provided the current font has
14128 a glyph for this ligature); the same happens with @samp{:u}. All output
14129 glyph nodes are `processed', which means that they are invariably
14130 associated with a given font, font size, advance width, etc. During the
14131 formatting process, @code{gtroff} itself adds various nodes to control
14134 Macros, diversions, and strings collect elements in two chained lists: a
14135 list of input tokens that have been passed unprocessed, and a list of
14136 output nodes. Consider the following the diversion.
14148 It contains these elements.
14150 @multitable {@i{vertical size node}} {token list} {element number}
14151 @item node list @tab token list @tab element number
14153 @item @i{line start node} @tab --- @tab 1
14154 @item @i{glyph node @code{a}} @tab --- @tab 2
14155 @item @i{word space node} @tab --- @tab 3
14156 @item --- @tab @code{b} @tab 4
14157 @item --- @tab @code{\n} @tab 5
14158 @item @i{glyph node @code{c}} @tab --- @tab 6
14159 @item @i{vertical size node} @tab --- @tab 7
14160 @item @i{vertical size node} @tab --- @tab 8
14161 @item --- @tab @code{\n} @tab 9
14164 @cindex @code{\v}, internal representation
14166 Elements 1, 7, and@tie{}8 are inserted by @code{gtroff}; the latter two
14167 (which are always present) specify the vertical extent of the last line,
14168 possibly modified by @code{\x}. The @code{br} request finishes the
14169 current partial line, inserting a newline input token, which is
14170 subsequently converted to a space when the diversion is reread. Note
14171 that the word space node has a fixed width that isn't stretchable
14172 anymore. To convert horizontal space nodes back to input tokens, use
14173 the @code{unformat} request.
14175 Macros only contain elements in the token list (and the node list is
14176 empty); diversions and strings can contain elements in both lists.
14178 Note that the @code{chop} request simply reduces the number of elements
14179 in a macro, string, or diversion by one. Exceptions are
14180 @dfn{compatibility save} and @dfn{compatibility ignore} input tokens,
14181 which are ignored. The @code{substring} request also ignores those
14184 Some requests like @code{tr} or @code{cflags} work on glyph identifiers
14185 only; this means that the associated glyph can be changed without
14186 destroying this association. This can be very helpful for substituting
14187 glyphs. In the following example, we assume that glyph @samp{foo} isn't
14188 available by default, so we provide a substitution using the
14189 @code{fchar} request and map it to input character @samp{x}.
14197 Now let us assume that we install an additional special font @samp{bar}
14198 that has glyph @samp{foo}.
14206 Since glyphs defined with @code{fchar} are searched before glyphs in
14207 special fonts, we must call @code{rchar} to remove the definition of the
14208 fallback glyph. Anyway, the translation is still active; @samp{x} now
14209 maps to the real glyph @samp{foo}.
14211 @cindex compatibility mode, and parameters
14212 @cindex mode, compatibility, and parameters
14213 @cindex arguments, and compatibility mode
14214 @cindex parameters, and compatibility mode
14215 @cindex macro arguments, and compatibility mode
14216 @cindex request arguments, and compatibility mode
14217 Macro and request arguments preserve the compatibility mode:
14220 .cp 1 \" switch to compatibility mode
14224 .cp 0 \" switch compatibility mode off
14230 Since compatibility mode is on while @code{de} is called, the macro
14231 @code{xx} activates compatibility mode while executing. Argument
14232 @code{$1} can still be handled properly because it inherits the
14233 compatibility mode status which was active at the point where @code{xx}
14236 After expansion of the parameters, the compatibility save and restore
14237 tokens are removed.
14240 @c =====================================================================
14242 @node Debugging, Implementation Differences, Gtroff Internals, gtroff Reference
14246 @code{gtroff} is not easy to debug, but there are some useful features
14247 and strategies for debugging.
14249 @Defreq {lf, line [@Var{filename}]}
14251 @cindex multi-file documents
14252 @cindex documents, multi-file
14253 @cindex setting input line number (@code{lf})
14254 @cindex input line number, setting (@code{lf})
14255 @cindex number, input line, setting (@code{lf})
14256 Change the line number and optionally the file name @code{gtroff} shall
14257 use for error and warning messages. @var{line} is the input line number
14258 of the @emph{next} line.
14260 Without argument, the request is ignored.
14262 This is a debugging aid for documents that are split into many files,
14263 then put together with @code{soelim} and other preprocessors. Usually,
14264 it isn't invoked manually.
14266 Note that other @code{troff} implementations (including the original
14267 @acronym{AT&T} version) handle @code{lf} differently. For them,
14268 @var{line} changes the line number of the @emph{current} line.
14271 @DefreqList {tm, string}
14272 @DefreqItemx {tm1, string}
14273 @DefreqListEndx {tmc, string}
14274 @cindex printing to stderr (@code{tm}, @code{tm1}, @code{tmc})
14275 @cindex stderr, printing to (@code{tm}, @code{tm1}, @code{tmc})
14276 Send @var{string} to the standard error output; this is very useful for
14277 printing debugging messages among other things.
14279 @cindex @code{tm} request, and copy-in mode
14280 @cindex copy-in mode, and @code{tm} request
14281 @cindex mode, copy-in, and @code{tm} request
14282 @cindex @code{tm1} request, and copy-in mode
14283 @cindex copy-in mode, and @code{tm1} request
14284 @cindex mode, copy-in, and @code{tm1} request
14285 @cindex @code{tmc} request, and copy-in mode
14286 @cindex copy-in mode, and @code{tmc} request
14287 @cindex mode, copy-in, and @code{tmc} request
14288 @var{string} is read in copy mode.
14290 The @code{tm} request ignores leading spaces of @var{string}; @code{tm1}
14291 handles its argument similar to the @code{ds} request: a leading double
14292 quote in @var{string} is stripped to allow initial blanks.
14294 The @code{tmc} request is similar to @code{tm1} but does not append a
14295 newline (as is done in @code{tm} and @code{tm1}).
14298 @Defreq {ab, [@Var{string}]}
14299 @cindex aborting (@code{ab})
14300 Similar to the @code{tm} request, except that it causes @code{gtroff} to
14301 stop processing. With no argument it prints @samp{User Abort.} to
14306 @cindex @code{ex} request, use in debugging
14307 @cindex exiting (@code{ex})
14308 The @code{ex} request also causes @code{gtroff} to stop processing; see
14312 When doing something involved it is useful to leave the debugging
14313 statements in the code and have them turned on by a command line flag.
14316 .if \n(DB .tm debugging output
14320 To activate these statements say
14326 If it is known in advance that there are many errors and no useful
14327 output, @code{gtroff} can be forced to suppress formatted output with
14328 the @option{-z} flag.
14331 @cindex dumping environments (@code{pev})
14332 @cindex environments, dumping (@code{pev})
14333 Print the contents of the current environment and all the currently
14334 defined environments (both named and numbered) on @code{stderr}.
14338 @cindex dumping symbol table (@code{pm})
14339 @cindex symbol table, dumping (@code{pm})
14340 Print the entire symbol table on @code{stderr}. Names of all defined
14341 macros, strings, and diversions are print together with their size in
14342 bytes. Since @code{gtroff} sometimes adds nodes by itself, the returned
14343 size can be larger than expected.
14345 This request differs from @acronym{UNIX} @code{troff}: @code{gtroff}
14346 reports the sizes of diversions, ignores an additional argument to print
14347 only the total of the sizes, and the size isn't returned in blocks of
14352 @cindex dumping number registers (@code{pnr})
14353 @cindex number registers, dumping (@code{pnr})
14354 Print the names and contents of all currently defined number registers
14359 @cindex dumping traps (@code{ptr})
14360 @cindex traps, dumping (@code{ptr})
14361 Print the names and positions of all traps (not including input line
14362 traps and diversion traps) on @code{stderr}. Empty slots in the page
14363 trap list are printed as well, because they can affect the priority of
14364 subsequently planted traps.
14368 @cindex flush output (@code{fl})
14369 @cindex output, flush (@code{fl})
14370 @cindex interactive use of @code{gtroff}
14371 @cindex @code{gtroff}, interactive use
14372 Instruct @code{gtroff} to flush its output immediately. The intent is
14373 for interactive use, but this behaviour is currently not implemented in
14374 @code{gtroff}. Contrary to @acronym{UNIX} @code{troff}, TTY output is
14375 sent to a device driver also (@code{grotty}), making it non-trivial to
14376 communicate interactively.
14378 This request causes a line break.
14381 @Defreq {backtrace, }
14382 @cindex backtrace of input stack (@code{backtrace})
14383 @cindex input stack, backtrace (@code{backtrace})
14384 Print a backtrace of the input stack to the standard error stream.
14386 Consider the following in file @file{test}:
14400 On execution, @code{gtroff} prints the following:
14403 test:2: backtrace: macro `xxx'
14404 test:5: backtrace: macro `yyy'
14405 test:8: backtrace: file `test'
14408 The option @option{-b} of @code{gtroff} internally calls a variant of
14409 this request on each error and warning.
14413 @cindex input stack, setting limit
14414 Use the @code{slimit} number register to set the maximum number of
14415 objects on the input stack. If @code{slimit} is less than or equal
14416 to@tie{}0, there is no limit set. With no limit, a buggy recursive
14417 macro can exhaust virtual memory.
14419 The default value is 1000; this is a compile-time constant.
14422 @Defreq {warnscale, si}
14423 Set the scaling indicator used in warnings to @var{si}. Valid values
14424 for @var{si} are @samp{u}, @samp{i}, @samp{c}, @samp{p}, and @samp{P}.
14425 At startup, it is set to @samp{i}.
14428 @Defreq {spreadwarn, [@Var{limit}]}
14429 Make @code{gtroff} emit a warning if the additional space inserted for
14430 each space between words in an output line is larger or equal to
14431 @var{limit}. A negative value is changed to zero; no argument toggles
14432 the warning on and off without changing @var{limit}. The default
14433 scaling indicator is @samp{m}. At startup, @code{spreadwarn} is
14434 deactivated, and @var{limit} is set to 3@dmn{m}.
14443 causes a warning if @code{gtroff} must add 0.2@dmn{m} or more for each
14444 interword space in a line.
14446 This request is active only if text is justified to both margins (using
14451 @code{gtroff} has command line options for printing out more warnings
14452 (@option{-w}) and for printing backtraces (@option{-b}) when a warning
14453 or an error occurs. The most verbose level of warnings is @option{-ww}.
14455 @DefreqList {warn, [@Var{flags}]}
14456 @DefregListEndx {.warn}
14457 @cindex level of warnings (@code{warn})
14458 @cindex warnings, level (@code{warn})
14459 Control the level of warnings checked for. The @var{flags} are the sum
14460 of the numbers associated with each warning that is to be enabled; all
14461 other warnings are disabled. The number associated with each warning is
14462 listed below. For example, @w{@code{.warn 0}} disables all warnings,
14463 and @w{@code{.warn 1}} disables all warnings except that about missing
14464 glyphs. If no argument is given, all warnings are enabled.
14466 The read-only number register @code{.warn} contains the current warning
14474 @c ---------------------------------------------------------------------
14476 @node Warnings, , Debugging, Debugging
14477 @subsection Warnings
14480 The warnings that can be given to @code{gtroff} are divided into the
14481 following categories. The name associated with each warning is used by
14482 the @option{-w} and @option{-W} options; the number is used by the
14483 @code{warn} request and by the @code{.warn} register.
14488 Non-existent glyphs.@footnote{@code{char} is a misnomer since it reports
14489 missing glyphs -- there aren't missing input characters, only invalid
14490 ones.} This is enabled by default.
14494 Invalid numeric expressions. This is enabled by default.
14495 @xref{Expressions}.
14501 In fill mode, lines that could not be broken so that their length was
14502 less than the line length. This is enabled by default.
14506 Missing or mismatched closing delimiters.
14510 @cindex @code{ie} request, and warnings
14511 @cindex @code{el} request, and warnings
14512 Use of the @code{el} request with no matching @code{ie} request.
14517 Meaningless scaling indicators.
14521 Out of range arguments.
14525 Dubious syntax in numeric expressions.
14529 @cindex @code{di} request, and warnings
14530 @cindex @code{da} request, and warnings
14531 Use of @code{di} or @code{da} without an argument when there is no
14536 @cindex @code{de}, @code{de1}, @code{dei} requests, and warnings
14537 @cindex @code{am}, @code{am1}, @code{ami} requests, and warnings
14538 @cindex @code{ds}, @code{ds1} requests, and warnings
14539 @cindex @code{as}, @code{as1} requests, and warnings
14540 @cindex @code{di} request, and warnings
14541 @cindex @code{da} request, and warnings
14542 @cindex @code{box}, @code{boxa} requests, and warnings
14543 @cindex @code{\*}, and warnings
14544 Use of undefined strings, macros and diversions. When an undefined
14545 string, macro, or diversion is used, that string is automatically
14546 defined as empty. So, in most cases, at most one warning is given for
14551 @cindex @code{nr} request, and warnings
14552 @cindex @code{\R}, and warnings
14553 @cindex @code{\n}, and warnings
14554 Use of undefined number registers. When an undefined number register is
14555 used, that register is automatically defined to have a value of@tie{}0.
14556 So, in most cases, at most one warning is given for use of a particular
14561 @cindex @code{\t}, and warnings
14562 Use of a tab character where a number was expected.
14566 @cindex @code{\@}}, and warnings
14567 Use of @code{\@}} where a number was expected.
14571 Requests that are missing non-optional arguments.
14575 Invalid input characters.
14579 Unrecognized escape sequences. When an unrecognized escape sequence
14580 @code{\@var{X}} is encountered, the escape character is ignored, and
14581 @var{X} is printed.
14585 @cindex compatibility mode
14586 Missing space between a request or macro and its argument. This warning
14587 is given when an undefined name longer than two characters is
14588 encountered, and the first two characters of the name make a defined
14589 name. The request or macro is not invoked. When this warning is given,
14590 no macro is automatically defined. This is enabled by default. This
14591 warning never occurs in compatibility mode.
14595 Non-existent fonts. This is enabled by default.
14599 Invalid escapes in text ignored with the @code{ig} request. These are
14600 conditions that are errors when they do not occur in ignored text.
14604 Color related warnings.
14608 Missing files. The @code{mso} request gives this warning when the
14609 requested macro file does not exist. This is enabled by default.
14612 All warnings except @samp{di}, @samp{mac} and @samp{reg}. It is
14613 intended that this covers all warnings that are useful with traditional
14621 @c =====================================================================
14623 @node Implementation Differences, , Debugging, gtroff Reference
14624 @section Implementation Differences
14625 @cindex implementation differences
14626 @cindex differences in implementation
14627 @cindex incompatibilities with @acronym{AT&T} @code{troff}
14628 @cindex compatibility mode
14629 @cindex mode, compatibility
14631 GNU @code{troff} has a number of features that cause incompatibilities
14632 with documents written with old versions of @code{troff}.
14635 @cindex names, long
14636 Long names cause some incompatibilities. @acronym{UNIX} @code{troff}
14643 @cindex @code{\*}, incompatibilities with @acronym{AT&T} @code{troff}
14644 @cindex @code{\n}, incompatibilities with @acronym{AT&T} @code{troff}
14646 as defining a string @samp{ab} with contents @samp{cd}. Normally, GNU
14647 @code{troff} interprets this as a call of a macro named @code{dsabcd}.
14648 Also @acronym{UNIX} @code{troff} interprets @code{\*[} or @code{\n[} as
14649 references to a string or number register called @samp{[}. In GNU
14650 @code{troff}, however, this is normally interpreted as the start of a
14651 long name. In compatibility mode GNU @code{troff} interprets long names
14652 in the traditional way (which means that they are not recognized as
14655 @DefreqList {cp, [@Var{n}]}
14656 @DefreqItemx {do, cmd}
14657 @DefregListEndx {.C}
14658 If @var{n} is missing or non-zero, turn on compatibility mode;
14659 otherwise, turn it off.
14661 The read-only number register @code{.C} is@tie{}1 if compatibility mode
14662 is on, 0@tie{}otherwise.
14664 Compatibility mode can be also turned on with the @option{-C} command
14667 The @code{do} request turns off compatibility mode while executing its
14668 arguments as a @code{gtroff} command. However, it does not turn off
14669 compatibility mode while processing the macro itself. To do that, use
14670 the @code{de1} request (or manipulate the @code{.C} register manually).
14671 @xref{Writing Macros}.
14678 executes the @code{fam} request when compatibility mode is enabled.
14680 @code{gtroff} restores the previous compatibility setting before
14681 interpreting any files sourced by the @var{cmd}.
14684 @cindex input level in delimited arguments
14685 @cindex delimited arguments, incompatibilities with @acronym{AT&T} @code{troff}
14686 Two other features are controlled by @option{-C}. If not in
14687 compatibility mode, GNU @code{troff} preserves the input level in
14688 delimited arguments:
14696 In compatibility mode, the string @samp{72def'} is returned; without
14697 @option{-C} the resulting string is @samp{168} (assuming a TTY output
14700 @cindex @code{\f}, incompatibilities with @acronym{AT&T} @code{troff}
14701 @cindex @code{\H}, incompatibilities with @acronym{AT&T} @code{troff}
14702 @cindex @code{\s}, incompatibilities with @acronym{AT&T} @code{troff}
14703 @cindex @code{\S}, incompatibilities with @acronym{AT&T} @code{troff}
14704 Finally, the escapes @code{\f}, @code{\H}, @code{\m}, @code{\M},
14705 @code{\R}, @code{\s}, and @code{\S} are transparent for recognizing the
14706 beginning of a line only in compatibility mode (this is a rather obscure
14707 feature). For example, the code
14717 prints @samp{Hallo!} in bold face if in compatibility mode, and
14718 @samp{.xx} in bold face otherwise.
14720 @cindex @code{\A}, incompatibilities with @acronym{AT&T} @code{troff}
14721 @cindex @code{\|}, incompatibilities with @acronym{AT&T} @code{troff}
14722 @cindex @code{\^}, incompatibilities with @acronym{AT&T} @code{troff}
14723 @cindex @code{\&}, incompatibilities with @acronym{AT&T} @code{troff}
14724 @cindex @code{\@{}, incompatibilities with @acronym{AT&T} @code{troff}
14725 @cindex @code{\@}}, incompatibilities with @acronym{AT&T} @code{troff}
14726 @cindex @code{\@key{SP}}, incompatibilities with @acronym{AT&T} @code{troff}
14727 @cindex @code{\'}, incompatibilities with @acronym{AT&T} @code{troff}
14728 @cindex @code{\`}, incompatibilities with @acronym{AT&T} @code{troff}
14729 @cindex @code{\-}, incompatibilities with @acronym{AT&T} @code{troff}
14730 @cindex @code{\_}, incompatibilities with @acronym{AT&T} @code{troff}
14731 @cindex @code{\!}, incompatibilities with @acronym{AT&T} @code{troff}
14732 @cindex @code{\%}, incompatibilities with @acronym{AT&T} @code{troff}
14733 @cindex @code{\c}, incompatibilities with @acronym{AT&T} @code{troff}
14734 GNU @code{troff} does not allow the use of the escape sequences
14735 @code{\|}, @code{\^}, @code{\&}, @code{\@{}, @code{\@}},
14736 @code{\@key{SP}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
14737 @code{\%}, and @code{\c} in names of strings, macros, diversions, number
14738 registers, fonts or environments; @acronym{UNIX} @code{troff} does. The
14739 @code{\A} escape sequence (@pxref{Identifiers}) may be helpful in
14740 avoiding use of these escape sequences in names.
14742 @cindex fractional point sizes
14743 @cindex fractional type sizes
14744 @cindex point sizes, fractional
14745 @cindex type sizes, fractional
14746 @cindex sizes, fractional
14747 @cindex @code{ps} request, incompatibilities with @acronym{AT&T} @code{troff}
14748 Fractional point sizes cause one noteworthy incompatibility. In
14749 @acronym{UNIX} @code{troff} the @code{ps} request ignores scale
14750 indicators and thus
14757 sets the point size to 10@tie{}points, whereas in GNU @code{troff} it
14758 sets the point size to 10@tie{}scaled points. @xref{Fractional Type
14759 Sizes}, for more information.
14761 @cindex @code{bd} request, incompatibilities with @acronym{AT&T} @code{troff}
14762 @cindex @code{cs} request, incompatibilities with @acronym{AT&T} @code{troff}
14763 @cindex @code{tr} request, incompatibilities with @acronym{AT&T} @code{troff}
14764 @cindex @code{fp} request, incompatibilities with @acronym{AT&T} @code{troff}
14765 @cindex input characters and output glyphs, compatibility with @acronym{AT&T} @code{troff}
14766 @cindex output glyphs, and input characters,compatibility with @acronym{AT&T} @code{troff}
14767 @cindex characters, input, and output glyphs, compatibility with @acronym{AT&T} @code{troff}
14768 @cindex glyphs, output, and input characters, compatibility with @acronym{AT&T} @code{troff}
14769 In GNU @code{troff} there is a fundamental difference between
14770 (unformatted) input characters and (formatted) output glyphs.
14771 Everything that affects how a glyph is output is stored with the glyph
14772 node; once a glyph node has been constructed it is unaffected by any
14773 subsequent requests that are executed, including @code{bd}, @code{cs},
14774 @code{tkf}, @code{tr}, or @code{fp} requests. Normally glyphs are
14775 constructed from input characters at the moment immediately before the
14776 glyph is added to the current output line. Macros, diversions and
14777 strings are all, in fact, the same type of object; they contain lists of
14778 input characters and glyph nodes in any combination. A glyph node does
14779 not behave like an input character for the purposes of macro processing;
14780 it does not inherit any of the special properties that the input
14781 character from which it was constructed might have had. For example,
14791 @cindex printing backslash (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
14792 @cindex backslash, printing (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
14793 @cindex @code{\e}, incompatibilities with @acronym{AT&T} @code{troff}
14794 @cindex @code{\!}, incompatibilities with @acronym{AT&T} @code{troff}
14795 @cindex @code{\?}, incompatibilities with @acronym{AT&T} @code{troff}
14796 @cindex transparent output, incompatibilities with @acronym{AT&T} @code{troff}
14797 @cindex output, transparent, incompatibilities with @acronym{AT&T} @code{troff}
14799 prints @samp{\\} in GNU @code{troff}; each pair of input backslashes is
14800 turned into one output backslash and the resulting output backslashes
14801 are not interpreted as escape characters when they are reread.
14802 @acronym{UNIX} @code{troff} would interpret them as escape characters
14803 when they were reread and would end up printing one @samp{\}. The
14804 correct way to obtain a printable backslash is to use the @code{\e}
14805 escape sequence: This always prints a single instance of the current
14806 escape character, regardless of whether or not it is used in a
14807 diversion; it also works in both GNU @code{troff} and @acronym{UNIX}
14808 @code{troff}.@footnote{To be completely independent of the current
14809 escape character, use @code{\(rs}, which represents a reverse solidus
14810 (backslash) glyph.} To store, for some reason, an escape sequence in a
14811 diversion that is interpreted when the diversion is reread, either use
14812 the traditional @code{\!} transparent output facility, or, if this is
14813 unsuitable, the new @code{\?} escape sequence.
14815 @xref{Diversions}, and @ref{Gtroff Internals}, for more information.
14819 @c =====================================================================
14820 @c =====================================================================
14822 @node Preprocessors, Output Devices, gtroff Reference, Top
14823 @chapter Preprocessors
14824 @cindex preprocessors
14826 This chapter describes all preprocessors that come with @code{groff} or
14827 which are freely available.
14842 @c =====================================================================
14844 @node geqn, gtbl, Preprocessors, Preprocessors
14845 @section @code{geqn}
14846 @cindex @code{eqn}, the program
14847 @cindex @code{geqn}, the program
14855 @c ---------------------------------------------------------------------
14857 @node Invoking geqn, , geqn, geqn
14858 @subsection Invoking @code{geqn}
14859 @cindex invoking @code{geqn}
14860 @cindex @code{geqn}, invoking
14865 @c =====================================================================
14867 @node gtbl, gpic, geqn, Preprocessors
14868 @section @code{gtbl}
14869 @cindex @code{tbl}, the program
14870 @cindex @code{gtbl}, the program
14878 @c ---------------------------------------------------------------------
14880 @node Invoking gtbl, , gtbl, gtbl
14881 @subsection Invoking @code{gtbl}
14882 @cindex invoking @code{gtbl}
14883 @cindex @code{gtbl}, invoking
14888 @c =====================================================================
14890 @node gpic, ggrn, gtbl, Preprocessors
14891 @section @code{gpic}
14892 @cindex @code{pic}, the program
14893 @cindex @code{gpic}, the program
14901 @c ---------------------------------------------------------------------
14903 @node Invoking gpic, , gpic, gpic
14904 @subsection Invoking @code{gpic}
14905 @cindex invoking @code{gpic}
14906 @cindex @code{gpic}, invoking
14911 @c =====================================================================
14913 @node ggrn, grap, gpic, Preprocessors
14914 @section @code{ggrn}
14915 @cindex @code{grn}, the program
14916 @cindex @code{ggrn}, the program
14924 @c ---------------------------------------------------------------------
14926 @node Invoking ggrn, , ggrn, ggrn
14927 @subsection Invoking @code{ggrn}
14928 @cindex invoking @code{ggrn}
14929 @cindex @code{ggrn}, invoking
14934 @c =====================================================================
14936 @node grap, gchem, ggrn, Preprocessors
14937 @section @code{grap}
14938 @cindex @code{grap}, the program
14940 A free implementation of @code{grap}, written by Ted Faber,
14941 is available as an extra package from the following address:
14944 @uref{http://www.lunabase.org/~faber/Vault/software/grap/}
14948 @c =====================================================================
14950 @node gchem, grefer, grap, Preprocessors
14951 @section @code{gchem}
14952 @cindex @code{chem}, the program
14953 @cindex @code{gchem}, the program
14961 @c ---------------------------------------------------------------------
14963 @node Invoking gchem, , gchem, gchem
14964 @subsection Invoking @code{gchem}
14965 @cindex invoking @code{gchem}
14966 @cindex @code{gchem}, invoking
14971 @c =====================================================================
14973 @node grefer, gsoelim, gchem, Preprocessors
14974 @section @code{grefer}
14975 @cindex @code{refer}, the program
14976 @cindex @code{grefer}, the program
14981 * Invoking grefer::
14984 @c ---------------------------------------------------------------------
14986 @node Invoking grefer, , grefer, grefer
14987 @subsection Invoking @code{grefer}
14988 @cindex invoking @code{grefer}
14989 @cindex @code{grefer}, invoking
14994 @c =====================================================================
14996 @node gsoelim, preconv, grefer, Preprocessors
14997 @section @code{gsoelim}
14998 @cindex @code{soelim}, the program
14999 @cindex @code{gsoelim}, the program
15004 * Invoking gsoelim::
15007 @c ---------------------------------------------------------------------
15009 @node Invoking gsoelim, , gsoelim, gsoelim
15010 @subsection Invoking @code{gsoelim}
15011 @cindex invoking @code{gsoelim}
15012 @cindex @code{gsoelim}, invoking
15017 @c =====================================================================
15019 @node preconv, , gsoelim, Preprocessors
15020 @section @code{preconv}
15021 @cindex @code{preconv}, the program
15026 * Invoking preconv::
15029 @c ---------------------------------------------------------------------
15031 @node Invoking preconv, , preconv, preconv
15032 @subsection Invoking @code{preconv}
15033 @cindex invoking @code{preconv}
15034 @cindex @code{preconv}, invoking
15039 @c =====================================================================
15040 @c =====================================================================
15042 @node Output Devices, File formats, Preprocessors, Top
15043 @chapter Output Devices
15044 @cindex output devices
15045 @cindex devices for output
15050 * Special Characters::
15062 @c =====================================================================
15064 @node Special Characters, grotty, Output Devices, Output Devices
15065 @section Special Characters
15066 @cindex special characters
15067 @cindex characters, special
15074 @c =====================================================================
15076 @node grotty, grops, Special Characters, Output Devices
15077 @section @code{grotty}
15078 @cindex @code{grotty}, the program
15080 The postprocessor @code{grotty} translates the output from GNU
15081 @code{troff} into a form suitable for typewriter-like devices. It is
15082 fully documented on its manual page, @cite{grotty(1)}.
15085 * Invoking grotty::
15088 @c ---------------------------------------------------------------------
15090 @node Invoking grotty, , grotty, grotty
15091 @subsection Invoking @code{grotty}
15092 @cindex invoking @code{grotty}
15093 @cindex @code{grotty}, invoking
15095 The postprocessor @command{grotty} accepts the following command-line
15100 Do not overstrike bold glyphs. Ignored if @option{-c} isn't used.
15103 Do not underline bold-italic glyphs. Ignored if @option{-c} isn't
15107 Use overprint and disable colours for printing on legacy Teletype
15108 printers (see below).
15111 Do not render lines (this is, ignore all @code{\D} escapes).
15114 Use form feed control characters in the output.
15117 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15118 search path for the font and device description files, given the
15119 target device @var{name}.
15122 Use horizontal tabs for sequences of 8 space characters.
15125 Request italic glyphs from the terminal. Ignored if @option{-c} is
15132 Highlight italic glyphs. Ignored if @option{-c} is active.
15135 Do not underline italic glyphs. Ignored if @option{-c} isn't used.
15138 Do not overstrike bold-italic glyphs. Ignored if @option{-c} isn't
15142 Print the version number.
15147 @cindex ISO 6249 SGR
15148 @cindex terminal control sequences
15149 @cindex control sequences, for terminals
15150 The @option{-c} mode for TTY output devices means that underlining is
15151 done by emitting sequences of @samp{_} and @samp{^H} (the backspace
15152 character) before the actual character. Literally, this is printing
15153 an underline character, then moving the caret back one character
15154 position, and printing the actual character at the same position as
15155 the underline character (similar to a typewriter). Usually, a modern
15156 terminal can't interpret this (and the original Teletype machines for
15157 which this sequence was appropriate are no longer in use). You need
15158 a pager program like @code{less} that translates this into
15159 ISO@tie{}6429 SGR sequences to control terminals.
15162 @c =====================================================================
15164 @node grops, gropdf, grotty, Output Devices
15165 @section @code{grops}
15166 @cindex @code{grops}, the program
15168 The postprocessor @command{grops} translates the output from GNU
15169 @command{troff} into a form suitable for Adobe @sc{PostScript}
15170 devices. It is fully documented on its manual page, @cite{grops(1)}.
15175 * Embedding PostScript::
15178 @c ---------------------------------------------------------------------
15180 @node Invoking grops, Embedding PostScript, grops, grops
15181 @subsection Invoking @code{grops}
15182 @cindex invoking @code{grops}
15183 @cindex @code{grops}, invoking
15185 The postprocessor @code{grops} accepts the following command-line
15189 @item -b@var{flags}
15190 Use backward compatibility settings given by @var{flags} as
15191 documented in the @cite{grops(1)} manual page. Overrides the command
15192 @option{broken} in the @file{DESC} file.
15195 Print @var{n} copies of each page.
15198 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15199 search path for the font, prologue and device description files,
15200 given the target device @var{name}, usually @strong{ps}.
15203 Tell the printer to guess the page length. Useful for printing
15204 vertically centered pages when the paper dimensions are determined at
15207 @item -I@var{path} @dots{}
15208 Consider the directory @file{@var{path}} for searching included files
15209 specified with relative paths. The current directory is searched as
15213 Use landscape orientation.
15218 @item -p@var{papersize}
15219 Set the page dimensions. Overrides the commands @option{papersize},
15220 @option{paperlength}, and @option{paperwidth} in the @file{DESC}
15221 file. See the @cite{groff_font(5)} manual page for details.
15223 @item -P@var{prologue}
15224 Use the @var{prologue} in the font path as the prologue instead of
15225 the default @file{prologue}. Overrides the environment variable
15226 @env{GROPS_PROLOGUE}.
15229 Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15230 default value @var{n} = 40.
15233 Print the version number.
15236 @c ---------------------------------------------------------------------
15238 @node Embedding PostScript, , Invoking grops, grops
15239 @subsection Embedding @sc{PostScript}
15240 @cindex embedding PostScript
15241 @cindex PostScript, embedding
15243 The escape sequence
15245 @code{\X'ps: import @var{file} @var{llx} @var{lly} @var{urx} @var{ury}
15246 @var{width} [@var{height}]'}
15249 places a rectangle of the specified @var{width} containing the
15250 @sc{PostScript} drawing from file @var{file} bound by the box from
15251 @var{llx} @var{lly} to @var{urx} @var{ury} (in @sc{PostScript}
15252 coordinates) at the insertion point. If @var{height} is not
15253 specified, the embedded drawing is scaled proportionally.
15255 @xref{Miscellaneous}, for the @code{psbb} request, which automatically
15256 generates the bounding box.
15258 This escape sequence is used internally by the macro @code{PSPIC}
15259 (see the @cite{groff_tmac(5)} manual page).
15262 @c =====================================================================
15264 @node gropdf, grodvi, grops, Output Devices
15265 @section @code{gropdf}
15266 @cindex @code{gropdf}, the program
15268 The postprocessor @command{gropdf} translates the output from GNU
15269 @command{troff} into a form suitable for Adobe PDF devices. It is fully
15270 documented on its manual page, @cite{gropdf(1)}.
15273 * Invoking gropdf::
15277 @c ---------------------------------------------------------------------
15279 @node Invoking gropdf, Embedding PDF, gropdf, gropdf
15280 @subsection Invoking @code{gropdf}
15281 @cindex invoking @code{gropdf}
15282 @cindex @code{gropdf}, invoking
15284 The postprocessor @code{gropdf} accepts the following command-line
15289 Produce uncompressed PDFs that include debugging comments.
15292 This forces @code{gropdf} to embed all used fonts in the PDF,
15293 even if they are one of the 14 base Adobe fonts.
15296 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15297 search path for the font, prologue and device description files,
15298 given the target device @var{name}, usually @strong{pdf}.
15300 @item -y@var{foundry}
15301 This forces the use of a different font foundry.
15304 Use landscape orientation.
15306 @item -p@var{papersize}
15307 Set the page dimensions. Overrides the commands @option{papersize},
15308 @option{paperlength}, and @option{paperwidth} in the @file{DESC}
15309 file. See the @cite{groff_font(5)} manual page for details.
15312 Print the version number.
15315 Append a comment line to end of PDF showing statistics, i.e. number of
15316 pages in document. Ghostscript's @cite{ps2pdf(1)} complains about this
15317 line if it is included, but works anyway.
15319 @item -u@var{filename}
15320 @code{gropdf} normally includes a ToUnicode CMap with any font created
15321 using @file{text.enc} as the encoding file, this makes it easier to
15322 search for words that contain ligatures. You can include your own CMap
15323 by specifying a @var{filename} or have no CMap at all by omitting the
15327 @c ---------------------------------------------------------------------
15329 @node Embedding PDF, , Invoking gropdf, gropdf
15330 @subsection Embedding PDF
15331 @cindex embedding PDF
15332 @cindex PDF, embedding
15334 The escape sequence
15336 @code{\X'pdf: pdfpic @var{file} @var{alignment} @var{width} [@var{height}]
15337 [@var{linelength}]'}
15340 places a rectangle of the specified @var{width} containing the PDF
15341 drawing from file @var{file} of desired @var{width} and @var{height} (if
15342 @var{height} is missing or zero then it is scaled proportionally). If
15343 @var{alignment} is @code{-L} the drawing is left aligned. If it is
15344 @code{-C} or @code{-R} a @var{linelength} greater than the width of the
15345 drawing is required as well. If @var{width} is specified as zero then
15346 the width is scaled in proportion to the height.
15349 @c =====================================================================
15351 @node grodvi, grolj4, gropdf, Output Devices
15352 @section @code{grodvi}
15353 @cindex @code{grodvi}, the program
15355 The postprocessor @command{grodvi} translates the output from GNU
15356 @command{troff} into the @strong{DVI} output format compatible with
15357 the @strong{@TeX{}} document preparation system. It is fully
15358 documented on its manual page, @cite{grodvi(1)}.
15361 * Invoking grodvi::
15364 @c ---------------------------------------------------------------------
15366 @node Invoking grodvi, , grodvi, grodvi
15367 @subsection Invoking @code{grodvi}
15368 @cindex invoking @code{grodvi}
15369 @cindex @code{grodvi}, invoking
15371 The postprocessor @code{grodvi} accepts the following command-line
15376 Do not use @strong{tpic} specials to implement drawing commands.
15379 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15380 search path for the font and device description files, given the
15381 target device @var{name}, usually @strong{dvi}.
15384 Use landscape orientation.
15386 @item -p@var{papersize}
15387 Set the page dimensions. Overrides the commands @option{papersize},
15388 @option{paperlength}, and @option{paperwidth} in the @file{DESC}
15389 file. See @cite{groff_font(5)} manual page for details.
15392 Print the version number.
15395 Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15396 default value @var{n} = 40.
15400 @c =====================================================================
15402 @node grolj4, grolbp, grodvi, Output Devices
15403 @section @code{grolj4}
15404 @cindex @code{grolj4}, the program
15406 The postprocessor @command{grolj4} translates the output from GNU
15407 @command{troff} into the @strong{PCL5} output format suitable for
15408 printing on a @strong{HP LaserJet@tie{}4} printer. It is fully
15409 documented on its manual page, @cite{grolj4(1)}.
15412 * Invoking grolj4::
15415 @c ---------------------------------------------------------------------
15417 @node Invoking grolj4, , grolj4, grolj4
15418 @subsection Invoking @code{grolj4}
15419 @cindex invoking @code{grolj4}
15420 @cindex @code{grolj4}, invoking
15422 The postprocessor @code{grolj4} accepts the following command-line
15427 Print @var{n} copies of each page.
15430 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15431 search path for the font and device description files, given the
15432 target device @var{name}, usually @strong{lj4}.
15435 Use landscape orientation.
15438 Set the page dimensions. Valid values for @var{size} are:
15439 @code{letter}, @code{legal}, @code{executive}, @code{a4},
15440 @code{com10}, @code{monarch}, @code{c5}, @code{b5}, @code{d1}.
15443 Print the version number.
15446 Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15447 default value @var{n} = 40.
15450 The special drawing command @code{\D'R @var{dh} @var{dv}'} draws a
15451 horizontal rectangle from the current position to the position at
15452 offset (@var{dh},@var{dv}).
15455 @c =====================================================================
15457 @node grolbp, grohtml, grolj4, Output Devices
15458 @section @code{grolbp}
15459 @cindex @code{grolbp}, the program
15461 The postprocessor @command{grolbp} translates the output from GNU
15462 @command{troff} into the @strong{LBP} output format suitable for
15463 printing on @strong{Canon CAPSL} printers. It is fully documented on
15464 its manual page, @cite{grolbp(1)}.
15467 * Invoking grolbp::
15470 @c ---------------------------------------------------------------------
15472 @node Invoking grolbp, , grolbp, grolbp
15473 @subsection Invoking @code{grolbp}
15474 @cindex invoking @code{grolbp}
15475 @cindex @code{grolbp}, invoking
15477 The postprocessor @code{grolbp} accepts the following command-line
15482 Print @var{n} copies of each page.
15485 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15486 search path for the font, prologue and device description files,
15487 given the target device @var{name}, usually @strong{lbp}.
15490 Use landscape orientation.
15492 @item -o@var{orientation}
15493 Use the @var{orientation} specified: @code{portrait} or
15496 @item -p@var{papersize}
15497 Set the page dimensions. See @cite{groff_font(5)} manual page for
15501 Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15502 default value @var{n} = 40.
15505 Print the version number.
15508 Print command-line help.
15512 @c =====================================================================
15514 @node grohtml, gxditview, grolbp, Output Devices
15515 @section @code{grohtml}
15516 @cindex @code{grohtml}, the program
15518 The @code{grohtml} front end (which consists of a preprocessor,
15519 @code{pre-grohtml}, and a device driver, @code{post-grohtml}) translates
15520 the output of GNU @code{troff} to @acronym{HTML}. Users should always
15521 invoke @code{grohtml} via the @code{groff} command with a @code{\-Thtml}
15522 option. If no files are given, @code{grohtml} will read the standard
15523 input. A filename of @code{-} will also cause @code{grohtml} to read
15524 the standard input. @acronym{HTML} output is written to the standard
15525 output. When @code{grohtml} is run by @code{groff}, options can be
15526 passed to @code{grohtml} using @code{groff}'s @option{-P} option.
15528 @code{grohtml} invokes @code{groff} twice. In the first pass, pictures,
15529 equations, and tables are rendered using the @code{ps} device, and in
15530 the second pass @acronym{HTML} output is generated by the @code{html}
15533 @code{grohtml} always writes output in @code{UTF-8} encoding and has
15534 built-in entities for all non-composite unicode characters. In spite of
15535 this, @code{groff} may issue warnings about unknown special characters
15536 if they can't be found during the first pass. Such warnings can be
15537 safely ignored unless the special characters appear inside a table or
15538 equation, in which case glyphs for these characters must be defined for
15539 the @code{ps} device as well.
15541 This output device is fully documented on its manual page,
15545 * Invoking grohtml::
15546 * grohtml specific registers and strings::
15549 @c ---------------------------------------------------------------------
15551 @node Invoking grohtml, grohtml specific registers and strings, grohtml, grohtml
15552 @subsection Invoking @code{grohtml}
15553 @cindex invoking @code{grohtml}
15554 @cindex @code{grohtml}, invoking
15556 The postprocessor @code{grohtml} accepts the following command-line
15561 Use this number of @var{bits} (= 1, 2 or 4) for text antialiasing.
15562 Default: @var{bits} = 4.
15565 Do not use text antialiasing.
15568 Use white background.
15571 Store rendered images in the directory @file{@var{dir}}.
15574 Put the directory @file{@var{dir}/dev@var{name}} in front of the
15575 search path for the font, prologue and device description files,
15576 given the target device @var{name}, usually @strong{html}.
15579 Use this number of @var{bits} (= 1, 2 or 4) for antialiasing of
15580 drawings. Default: @var{bits} = 4.
15583 Do not use antialiasing for drawings.
15586 Use the @code{B} element for section headings.
15588 @item -i@var{resolution}
15589 Use the @var{resolution} for rendered images. Default:
15590 @var{resolution} = 100@dmn{dpi}.
15593 Set the images' @var{stem name}. Default: @var{stem} =
15594 @file{grohtml-@var{XXX}} (@var{XXX} is the process ID).
15597 Place each section in a separate file called
15598 @file{@var{stem}-@var{n}.html} (where @var{n} is a generated section
15602 Do not generate the table of contents.
15605 Generate simple fragment identifiers.
15607 @item -o@var{offset}
15608 Use vertical paddding @var{offset} for images.
15611 Display the page rendering progress to @code{stderr}.
15614 Do not use horizontal rules to separate headers and footers.
15617 Set the base font size, to be modified using the elements @code{BIG}
15620 @item -S@var{level}
15621 Generate separate files for sections at level @var{level}.
15624 Print the version number.
15627 Generate a validator button at the bottom.
15630 Generate a signature of groff after the validator button, if any.
15634 @c ---------------------------------------------------------------------
15636 @node grohtml specific registers and strings, , Invoking grohtml, grohtml
15637 @subsection @code{grohtml} specific registers and strings
15638 @cindex registers specific to @code{grohtml}
15639 @cindex strings specific to @code{grohtml}
15640 @cindex @code{grohtml}, registers and strings
15642 @DefmpregList {ps4html, grohtml}
15643 @DefstrListEndx {www-image-template, grohtml}
15644 The registers @code{ps4html} and @code{www-image-template} are defined
15645 by the @code{pre-grohtml} preprocessor. @code{pre-grohtml} reads in the
15646 @code{troff} input, marks up the inline equations and passes the result
15650 troff -Tps -rps4html=1 -dwww-image-template=@var{template}
15668 The @sc{PostScript} device is used to create all the image files (for
15669 @option{-Thtml}; if @option{-Txhtml} is used, all equations are passed
15670 to @code{geqn} to produce @acronym{MathML}, and the register
15671 @code{ps4html} enables the macro sets to ignore floating keeps, footers,
15674 The register @code{www-image-template} is set to the user specified
15675 template name or the default name.
15679 @c =====================================================================
15681 @node gxditview, , grohtml, Output Devices
15682 @section @code{gxditview}
15683 @cindex @code{gxditview}, the program
15688 * Invoking gxditview::
15691 @c ---------------------------------------------------------------------
15693 @node Invoking gxditview, , gxditview, gxditview
15694 @subsection Invoking @code{gxditview}
15695 @cindex invoking @code{gxditview}
15696 @cindex @code{gxditview}, invoking
15703 @c =====================================================================
15704 @c =====================================================================
15706 @node File formats, Installation, Output Devices, Top
15707 @chapter File formats
15708 @cindex file formats
15709 @cindex formats, file
15711 All files read and written by @code{gtroff} are text files. The
15712 following two sections describe their format.
15720 @c =====================================================================
15722 @node gtroff Output, Font Files, File formats, File formats
15723 @section @code{gtroff} Output
15724 @cindex @code{gtroff}, output
15725 @cindex output, @code{gtroff}
15727 This section describes the intermediate output format of GNU
15728 @code{troff}. This output is produced by a run of @code{gtroff} before
15729 it is fed into a device postprocessor program.
15731 As @code{groff} is a wrapper program around @code{gtroff} that
15732 automatically calls a postprocessor, this output does not show up
15733 normally. This is why it is called @dfn{intermediate}. @code{groff}
15734 provides the option @option{-Z} to inhibit postprocessing, such that the
15735 produced intermediate output is sent to standard output just like
15736 calling @code{gtroff} manually.
15738 @cindex troff output
15739 @cindex output, troff
15740 @cindex intermediate output
15741 @cindex output, intermediate
15742 Here, the term @dfn{troff output} describes what is output by
15743 @code{gtroff}, while @dfn{intermediate output} refers to the language
15744 that is accepted by the parser that prepares this output for the
15745 postprocessors. This parser is smarter on whitespace and implements
15746 obsolete elements for compatibility, otherwise both formats are the
15747 same.@footnote{The parser and postprocessor for intermediate output can
15748 be found in the file@*
15749 @file{@var{groff-source-dir}/src/libs/libdriver/input.cpp}.}
15751 The main purpose of the intermediate output concept is to facilitate the
15752 development of postprocessors by providing a common programming
15753 interface for all devices. It has a language of its own that is
15754 completely different from the @code{gtroff} language. While the
15755 @code{gtroff} language is a high-level programming language for text
15756 processing, the intermediate output language is a kind of low-level
15757 assembler language by specifying all positions on the page for writing
15760 The intermediate output produced by @code{gtroff} is fairly readable,
15761 while output from @acronym{AT&T} @code{troff} is rather hard to
15762 understand because of strange habits that are still supported, but not
15763 used any longer by @code{gtroff}.
15766 * Language Concepts::
15767 * Command Reference::
15768 * Intermediate Output Examples::
15769 * Output Language Compatibility::
15772 @c ---------------------------------------------------------------------
15774 @node Language Concepts, Command Reference, gtroff Output, gtroff Output
15775 @subsection Language Concepts
15777 During the run of @code{gtroff}, the input data is cracked down to the
15778 information on what has to be printed at what position on the intended
15779 device. So the language of the intermediate output format can be quite
15780 small. Its only elements are commands with and without arguments. In
15781 this section, the term @dfn{command} always refers to the intermediate
15782 output language, and never to the @code{gtroff} language used for
15783 document formatting. There are commands for positioning and text
15784 writing, for drawing, and for device controlling.
15792 @node Separation, Argument Units, Language Concepts, Language Concepts
15793 @subsubsection Separation
15795 @acronym{AT&T} @code{troff} output has strange requirements on
15796 whitespace. The @code{gtroff} output parser, however, is smart about
15797 whitespace by making it maximally optional. The whitespace characters,
15798 i.e., the tab, space, and newline characters, always have a syntactical
15799 meaning. They are never printable because spacing within the output is
15800 always done by positioning commands.
15802 Any sequence of space or tab characters is treated as a single
15803 @dfn{syntactical space}. It separates commands and arguments, but is
15804 only required when there would occur a clashing between the command code
15805 and the arguments without the space. Most often, this happens when
15806 variable-length command names, arguments, argument lists, or command
15807 clusters meet. Commands and arguments with a known, fixed length need
15808 not be separated by syntactical space.
15810 A line break is a syntactical element, too. Every command argument can
15811 be followed by whitespace, a comment, or a newline character. Thus a
15812 @dfn{syntactical line break} is defined to consist of optional
15813 syntactical space that is optionally followed by a comment, and a
15816 The normal commands, those for positioning and text, consist of a single
15817 letter taking a fixed number of arguments. For historical reasons, the
15818 parser allows to stack such commands on the same line, but fortunately,
15819 in @code{gtroff}'s intermediate output, every command with at least one
15820 argument is followed by a line break, thus providing excellent
15823 The other commands -- those for drawing and device controlling -- have a
15824 more complicated structure; some recognize long command names, and some
15825 take a variable number of arguments. So all @samp{D} and @samp{x}
15826 commands were designed to request a syntactical line break after their
15827 last argument. Only one command, @w{@samp{x X}}, has an argument that
15828 can stretch over several lines; all other commands must have all of
15829 their arguments on the same line as the command, i.e., the arguments may
15830 not be split by a line break.
15832 Empty lines (these are lines containing only space and/or a comment),
15833 can occur everywhere. They are just ignored.
15835 @node Argument Units, Document Parts, Separation, Language Concepts
15836 @subsubsection Argument Units
15838 Some commands take integer arguments that are assumed to represent
15839 values in a measurement unit, but the letter for the corresponding scale
15840 indicator is not written with the output command arguments. Most
15841 commands assume the scale indicator @samp{u}, the basic unit of the
15842 device, some use @samp{z}, the scaled point unit of the device, while
15843 others, such as the color commands, expect plain integers.
15845 Note that single characters can have the eighth bit set, as can the
15846 names of fonts and special characters. The names of characters and
15847 fonts can be of arbitrary length. A character that is to be printed is
15848 always in the current font.
15850 A string argument is always terminated by the next whitespace character
15851 (space, tab, or newline); an embedded @samp{#} character is regarded as
15852 part of the argument, not as the beginning of a comment command. An
15853 integer argument is already terminated by the next non-digit character,
15854 which then is regarded as the first character of the next argument or
15857 @node Document Parts, , Argument Units, Language Concepts
15858 @subsubsection Document Parts
15860 A correct intermediate output document consists of two parts, the
15861 @dfn{prologue} and the @dfn{body}.
15863 The task of the prologue is to set the general device parameters using
15864 three exactly specified commands. @code{gtroff}'s prologue is
15865 guaranteed to consist of the following three lines (in that order):
15869 x res @var{n} @var{h} @var{v}
15874 with the arguments set as outlined in @ref{Device Control Commands}.
15875 Note that the parser for the intermediate output format is able to
15876 swallow additional whitespace and comments as well even in the prologue.
15878 The body is the main section for processing the document data.
15879 Syntactically, it is a sequence of any commands different from the ones
15880 used in the prologue. Processing is terminated as soon as the first
15881 @w{@samp{x stop}} command is encountered; the last line of any
15882 @code{gtroff} intermediate output always contains such a command.
15884 Semantically, the body is page oriented. A new page is started by a
15885 @samp{p} command. Positioning, writing, and drawing commands are always
15886 done within the current page, so they cannot occur before the first
15887 @samp{p} command. Absolute positioning (by the @samp{H} and @samp{V}
15888 commands) is done relative to the current page; all other positioning is
15889 done relative to the current location within this page.
15891 @c ---------------------------------------------------------------------
15893 @node Command Reference, Intermediate Output Examples, Language Concepts, gtroff Output
15894 @subsection Command Reference
15896 This section describes all intermediate output commands, both from
15897 @acronym{AT&T} @code{troff} as well as the @code{gtroff} extensions.
15900 * Comment Command::
15901 * Simple Commands::
15902 * Graphics Commands::
15903 * Device Control Commands::
15904 * Obsolete Command::
15907 @node Comment Command, Simple Commands, Command Reference, Command Reference
15908 @subsubsection Comment Command
15911 @item #@var{anything}@angles{end of line}
15912 A comment. Ignore any characters from the @samp{#} character up to the
15913 next newline character.
15915 This command is the only possibility for commenting in the intermediate
15916 output. Each comment can be preceded by arbitrary syntactical space;
15917 every command can be terminated by a comment.
15920 @node Simple Commands, Graphics Commands, Comment Command, Command Reference
15921 @subsubsection Simple Commands
15923 The commands in this subsection have a command code consisting of a
15924 single character, taking a fixed number of arguments. Most of them are
15925 commands for positioning and text writing. These commands are smart
15926 about whitespace. Optionally, syntactical space can be inserted before,
15927 after, and between the command letter and its arguments. All of these
15928 commands are stackable, i.e., they can be preceded by other simple
15929 commands or followed by arbitrary other commands on the same line. A
15930 separating syntactical space is only necessary when two integer
15931 arguments would clash or if the preceding argument ends with a string
15936 .if (\n[@USE_ENV_STACK] == 1) \{\
15938 Open a new environment by copying the actual device configuration data
15939 to the environment stack.
15941 The current environment is setup by the device specification and
15942 manipulated by the setting commands.
15946 Close the actual environment (opened by a preceding
15948 and restore the previous environment from the environment
15949 stack as the actual device configuration data.
15951 \} \" endif @USE_ENV_STACK
15954 @item C @var{xxx}@angles{whitespace}
15955 Print a special character named @var{xxx}. The trailing syntactical
15956 space or line break is necessary to allow glyph names of arbitrary
15957 length. The glyph is printed at the current print position; the glyph's
15958 size is read from the font file. The print position is not changed.
15961 Print glyph@tie{}@var{g} at the current print
15962 position;@footnote{@samp{c} is actually a misnomer since it outputs a
15963 glyph.} the glyph's size is read from the font file. The print position
15967 Set font to font number@tie{}@var{n} (a non-negative integer).
15970 Move right to the absolute vertical position@tie{}@var{n} (a
15971 non-negative integer in basic units @samp{u} relative to left edge of
15975 Move @var{n} (a non-negative integer) basic units @samp{u} horizontally
15976 to the right. The original @acronym{UNIX} troff manual allows negative
15977 values for @var{n} also, but @code{gtroff} doesn't use this.
15979 @item m @var{color-scheme} @r{[}@var{component} @dots{}@r{]}
15980 Set the color for text (glyphs), line drawing, and the outline of
15981 graphic objects using different color schemes; the analoguous command
15982 for the filling color of graphic objects is @samp{DF}. The color
15983 components are specified as integer arguments between 0 and 65536. The
15984 number of color components and their meaning vary for the different
15985 color schemes. These commands are generated by @code{gtroff}'s escape
15986 sequence @code{\m}. No position changing. These commands are a
15987 @code{gtroff} extension.
15990 @item mc @var{cyan} @var{magenta} @var{yellow}
15991 Set color using the CMY color scheme, having the 3@tie{}color components
15992 @var{cyan}, @var{magenta}, and @var{yellow}.
15995 Set color to the default color value (black in most cases). No
15996 component arguments.
15998 @item mg @var{gray}
15999 Set color to the shade of gray given by the argument, an integer between
16000 0 (black) and 65536 (white).
16002 @item mk @var{cyan} @var{magenta} @var{yellow} @var{black}
16003 Set color using the CMYK color scheme, having the 4@tie{}color
16004 components @var{cyan}, @var{magenta}, @var{yellow}, and @var{black}.
16006 @item mr @var{red} @var{green} @var{blue}
16007 Set color using the RGB color scheme, having the 3@tie{}color components
16008 @var{red}, @var{green}, and @var{blue}.
16012 Print glyph with index@tie{}@var{n} (a non-negative integer) of the
16013 current font. This command is a @code{gtroff} extension.
16015 @item n @var{b} @var{a}
16016 Inform the device about a line break, but no positioning is done by this
16017 command. In @acronym{AT&T} @code{troff}, the integer arguments @var{b}
16018 and@tie{}@var{a} informed about the space before and after the current
16019 line to make the intermediate output more human readable without
16020 performing any action. In @code{groff}, they are just ignored, but they
16021 must be provided for compatibility reasons.
16024 Begin a new page in the outprint. The page number is set
16025 to@tie{}@var{n}. This page is completely independent of pages formerly
16026 processed even if those have the same page number. The vertical
16027 position on the outprint is automatically set to@tie{}0. All
16028 positioning, writing, and drawing is always done relative to a page, so
16029 a @samp{p} command must be issued before any of these commands.
16032 Set point size to @var{n}@tie{}scaled points (this is unit @samp{z}).
16033 @acronym{AT&T} @code{troff} used the unit points (@samp{p}) instead.
16034 @xref{Output Language Compatibility}.
16036 @item t @var{xxx}@angles{whitespace}
16037 @itemx t @var{xxx} @var{dummy-arg}@angles{whitespace}
16038 Print a word, i.e., a sequence of characters @var{xxx} representing
16039 output glyphs which names are single characters, terminated by a space
16040 character or a line break; an optional second integer argument is
16041 ignored (this allows the formatter to generate an even number of
16042 arguments). The first glyph should be printed at the current position,
16043 the current horizontal position should then be increased by the width of
16044 the first glyph, and so on for each glyph. The widths of the glyphs are
16045 read from the font file, scaled for the current point size, and rounded
16046 to a multiple of the horizontal resolution. Special characters cannot
16047 be printed using this command (use the @samp{C} command for special
16048 characters). This command is a @code{gtroff} extension; it is only used
16049 for devices whose @file{DESC} file contains the @code{tcommand} keyword
16050 (@pxref{DESC File Format}).
16052 @item u @var{n} @var{xxx}@angles{whitespace}
16053 Print word with track kerning. This is the same as the @samp{t} command
16054 except that after printing each glyph, the current horizontal position
16055 is increased by the sum of the width of that glyph and@tie{}@var{n} (an
16056 integer in basic units @samp{u}). This command is a @code{gtroff}
16057 extension; it is only used for devices whose @file{DESC} file contains
16058 the @code{tcommand} keyword (@pxref{DESC File Format}).
16061 Move down to the absolute vertical position@tie{}@var{n} (a non-negative
16062 integer in basic units @samp{u}) relative to upper edge of current page.
16065 Move @var{n}@tie{}basic units @samp{u} down (@var{n} is a non-negative
16066 integer). The original @acronym{UNIX} troff manual allows negative
16067 values for @var{n} also, but @code{gtroff} doesn't use this.
16070 Informs about a paddable white space to increase readability. The
16071 spacing itself must be performed explicitly by a move command.
16074 @node Graphics Commands, Device Control Commands, Simple Commands, Command Reference
16075 @subsubsection Graphics Commands
16077 Each graphics or drawing command in the intermediate output starts with
16078 the letter @samp{D}, followed by one or two characters that specify a
16079 subcommand; this is followed by a fixed or variable number of integer
16080 arguments that are separated by a single space character. A @samp{D}
16081 command may not be followed by another command on the same line (apart
16082 from a comment), so each @samp{D} command is terminated by a syntactical
16085 @code{gtroff} output follows the classical spacing rules (no space
16086 between command and subcommand, all arguments are preceded by a single
16087 space character), but the parser allows optional space between the
16088 command letters and makes the space before the first argument optional.
16089 As usual, each space can be any sequence of tab and space characters.
16091 Some graphics commands can take a variable number of arguments. In this
16092 case, they are integers representing a size measured in basic units
16093 @samp{u}. The arguments called @var{h1}, @var{h2}, @dots{}, @var{hn}
16094 stand for horizontal distances where positive means right, negative
16095 left. The arguments called @var{v1}, @var{v2}, @dots{}, @var{vn} stand
16096 for vertical distances where positive means down, negative up. All
16097 these distances are offsets relative to the current location.
16099 Each graphics command directly corresponds to a similar @code{gtroff}
16100 @code{\D} escape sequence. @xref{Drawing Requests}.
16102 Unknown @samp{D} commands are assumed to be device-specific. Its
16103 arguments are parsed as strings; the whole information is then sent to
16106 In the following command reference, the syntax element @angles{line
16107 break} means a syntactical line break as defined above.
16110 @item D~ @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
16111 Draw B-spline from current position to offset (@var{h1},@var{v1}), then
16112 to offset (@var{h2},@var{v2}), if given, etc.@: up to
16113 (@var{hn},@var{vn}). This command takes a variable number of argument
16114 pairs; the current position is moved to the terminal point of the drawn
16117 @item Da @var{h1} @var{v1} @var{h2} @var{v2}@angles{line break}
16118 Draw arc from current position to
16119 (@var{h1},@var{v1})@math{+}(@var{h2},@var{v2}) with center at
16120 (@var{h1},@var{v1}); then move the current position to the final point
16123 @item DC @var{d}@angles{line break}
16124 @itemx DC @var{d} @var{dummy-arg}@angles{line break}
16125 Draw a solid circle using the current fill color with
16126 diameter@tie{}@var{d} (integer in basic units @samp{u}) with leftmost
16127 point at the current position; then move the current position to the
16128 rightmost point of the circle. An optional second integer argument is
16129 ignored (this allows the formatter to generate an even number of
16130 arguments). This command is a @code{gtroff} extension.
16132 @item Dc @var{d}@angles{line break}
16133 Draw circle line with diameter@tie{}@var{d} (integer in basic units
16134 @samp{u}) with leftmost point at the current position; then move the
16135 current position to the rightmost point of the circle.
16137 @item DE @var{h} @var{v}@angles{line break}
16138 Draw a solid ellipse in the current fill color with a horizontal
16139 diameter of@tie{}@var{h} and a vertical diameter of@tie{}@var{v} (both
16140 integers in basic units @samp{u}) with the leftmost point at the current
16141 position; then move to the rightmost point of the ellipse. This command
16142 is a @code{gtroff} extension.
16144 @item De @var{h} @var{v}@angles{line break}
16145 Draw an outlined ellipse with a horizontal diameter of@tie{}@var{h} and
16146 a vertical diameter of@tie{}@var{v} (both integers in basic units
16147 @samp{u}) with the leftmost point at current position; then move to the
16148 rightmost point of the ellipse.
16150 @item DF @var{color-scheme} @r{[}@var{component} @dots{}@r{]}@angles{line break}
16151 Set fill color for solid drawing objects using different color schemes;
16152 the analoguous command for setting the color of text, line graphics, and
16153 the outline of graphic objects is @samp{m}. The color components are
16154 specified as integer arguments between 0 and 65536. The number of color
16155 components and their meaning vary for the different color schemes.
16156 These commands are generated by @code{gtroff}'s escape sequences
16157 @w{@code{\D'F @dots{}'}} and @code{\M} (with no other corresponding
16158 graphics commands). No position changing. This command is a
16159 @code{gtroff} extension.
16162 @item DFc @var{cyan} @var{magenta} @var{yellow}@angles{line break}
16163 Set fill color for solid drawing objects using the CMY color scheme,
16164 having the 3@tie{}color components @var{cyan}, @var{magenta}, and
16167 @item DFd@angles{line break}
16168 Set fill color for solid drawing objects to the default fill color value
16169 (black in most cases). No component arguments.
16171 @item DFg @var{gray}@angles{line break}
16172 Set fill color for solid drawing objects to the shade of gray given by
16173 the argument, an integer between 0 (black) and 65536 (white).
16175 @item DFk @var{cyan} @var{magenta} @var{yellow} @var{black}@angles{line break}
16176 Set fill color for solid drawing objects using the CMYK color scheme,
16177 having the 4@tie{}color components @var{cyan}, @var{magenta},
16178 @var{yellow}, and @var{black}.
16180 @item DFr @var{red} @var{green} @var{blue}@angles{line break}
16181 Set fill color for solid drawing objects using the RGB color scheme,
16182 having the 3@tie{}color components @var{red}, @var{green}, and
16186 @item Df @var{n}@angles{line break}
16187 The argument@tie{}@var{n} must be an integer in the range @math{-32767}
16191 @item @math{0 @value{LE} @var{n} @value{LE} 1000}
16192 Set the color for filling solid drawing objects to a shade of gray,
16193 where 0 corresponds to solid white, 1000 (the default) to solid black,
16194 and values in between to intermediate shades of gray; this is obsoleted
16195 by command @samp{DFg}.
16197 @item @math{@var{n} < 0} or @math{@var{n} > 1000}
16198 Set the filling color to the color that is currently being used for the
16199 text and the outline, see command @samp{m}. For example, the command
16208 sets all colors to blue.
16212 No position changing. This command is a @code{gtroff} extension.
16214 @item Dl @var{h} @var{v}@angles{line break}
16215 Draw line from current position to offset (@var{h},@var{v}) (integers in
16216 basic units @samp{u}); then set current position to the end of the drawn
16219 @item Dp @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
16220 Draw a polygon line from current position to offset (@var{h1},@var{v1}),
16221 from there to offset (@var{h2},@var{v2}), etc.@: up to offset
16222 (@var{hn},@var{vn}), and from there back to the starting position. For
16223 historical reasons, the position is changed by adding the sum of all
16224 arguments with odd index to the actual horizontal position and the even
16225 ones to the vertical position. Although this doesn't make sense it is
16226 kept for compatibility.
16228 As the polygon is closed, the end of drawing is the starting point, so
16229 the position doesn't change.
16231 This command is a @code{gtroff} extension.
16233 @item Dp @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
16234 Draw a solid polygon in the current fill color rather than an outlined
16235 polygon, using the same arguments and positioning as the corresponding
16238 No position changing.
16240 This command is a @code{gtroff} extension.
16242 @item Dt @var{n}@angles{line break}
16243 Set the current line thickness to@tie{}@var{n} (an integer in basic
16244 units @samp{u}) if @math{@var{n}>0}; if @math{@var{n}=0} select the
16245 smallest available line thickness; if @math{@var{n}<0} set the line
16246 thickness proportional to the point size (this is the default before the
16247 first @samp{Dt} command was specified). For historical reasons, the
16248 horizontal position is changed by adding the argument to the actual
16249 horizontal position, while the vertical position is not changed.
16250 Although this doesn't make sense it is kept for compatibility.
16252 No position changing.
16254 This command is a @code{gtroff} extension.
16257 @node Device Control Commands, Obsolete Command, Graphics Commands, Command Reference
16258 @subsubsection Device Control Commands
16260 Each device control command starts with the letter @samp{x}, followed by
16261 a space character (optional or arbitrary space or tab in @code{gtroff})
16262 and a subcommand letter or word; each argument (if any) must be preceded
16263 by a syntactical space. All @samp{x} commands are terminated by a
16264 syntactical line break; no device control command can be followed by
16265 another command on the same line (except a comment).
16267 The subcommand is basically a single letter, but to increase
16268 readability, it can be written as a word, i.e., an arbitrary sequence of
16269 characters terminated by the next tab, space, or newline character. All
16270 characters of the subcommand word but the first are simply ignored. For
16271 example, @code{gtroff} outputs the initialization command @w{@samp{x i}}
16272 as @w{@samp{x init}} and the resolution command @w{@samp{x r}} as
16275 In the following, the syntax element @angles{line break} means a
16276 syntactical line break (@pxref{Separation}).
16279 @item xF @var{name}@angles{line break}
16280 The @samp{F} stands for @var{Filename}.
16282 Use @var{name} as the intended name for the current file in error
16283 reports. This is useful for remembering the original file name when
16284 @code{gtroff} uses an internal piping mechanism. The input file is not
16285 changed by this command. This command is a @code{gtroff} extension.
16287 @item xf @var{n} @var{s}@angles{line break}
16288 The @samp{f} stands for @var{font}.
16290 Mount font position@tie{}@var{n} (a non-negative integer) with font
16291 named@tie{}@var{s} (a text word). @xref{Font Positions}.
16293 @item xH @var{n}@angles{line break}
16294 The @samp{H} stands for @var{Height}.
16296 Set glyph height to@tie{}@var{n} (a positive integer in scaled points
16297 @samp{z}). @acronym{AT&T} @code{troff} uses the unit points (@samp{p})
16298 instead. @xref{Output Language Compatibility}.
16300 @item xi@angles{line break}
16301 The @samp{i} stands for @var{init}.
16303 Initialize device. This is the third command of the prologue.
16305 @item xp@angles{line break}
16306 The @samp{p} stands for @var{pause}.
16308 Parsed but ignored. The original @acronym{UNIX} troff manual writes
16311 pause device, can be restarted
16314 @item xr @var{n} @var{h} @var{v}@angles{line break}
16315 The @samp{r} stands for @var{resolution}.
16317 Resolution is@tie{}@var{n}, while @var{h} is the minimal horizontal
16318 motion, and @var{v} the minimal vertical motion possible with this
16319 device; all arguments are positive integers in basic units @samp{u} per
16320 inch. This is the second command of the prologue.
16322 @item xS @var{n}@angles{line break}
16323 The @samp{S} stands for @var{Slant}.
16325 Set slant to@tie{}@var{n} (an integer in basic units @samp{u}).
16327 @item xs@angles{line break}
16328 The @samp{s} stands for @var{stop}.
16330 Terminates the processing of the current file; issued as the last
16331 command of any intermediate troff output.
16333 @item xt@angles{line break}
16334 The @samp{t} stands for @var{trailer}.
16336 Generate trailer information, if any. In @var{gtroff}, this is actually
16339 @item xT @var{xxx}@angles{line break}
16340 The @samp{T} stands for @var{Typesetter}.
16342 Set name of device to word @var{xxx}, a sequence of characters ended by
16343 the next white space character. The possible device names coincide with
16344 those from the @code{groff} @option{-T} option. This is the first
16345 command of the prologue.
16347 @item xu @var{n}@angles{line break}
16348 The @samp{u} stands for @var{underline}.
16350 Configure underlining of spaces. If @var{n} is@tie{}1, start
16351 underlining of spaces; if @var{n} is@tie{}0, stop underlining of spaces.
16352 This is needed for the @code{cu} request in nroff mode and is ignored
16353 otherwise. This command is a @code{gtroff} extension.
16355 @item xX @var{anything}@angles{line break}
16356 The @samp{x} stands for @var{X-escape}.
16358 Send string @var{anything} uninterpreted to the device. If the line
16359 following this command starts with a @samp{+} character this line is
16360 interpreted as a continuation line in the following sense. The @samp{+}
16361 is ignored, but a newline character is sent instead to the device, the
16362 rest of the line is sent uninterpreted. The same applies to all
16363 following lines until the first character of a line is not a @samp{+}
16364 character. This command is generated by the @code{gtroff} escape
16365 sequence @code{\X}. The line-continuing feature is a @code{gtroff}
16369 @node Obsolete Command, , Device Control Commands, Command Reference
16370 @subsubsection Obsolete Command
16371 In @acronym{AT&T} @code{troff} output, the writing of a single glyph is
16372 mostly done by a very strange command that combines a horizontal move
16373 and a single character giving the glyph name. It doesn't have a command
16374 code, but is represented by a 3-character argument consisting of exactly
16375 2@tie{}digits and a character.
16378 @item @var{dd}@var{g}
16379 Move right @var{dd} (exactly two decimal digits) basic units @samp{u},
16380 then print glyph@tie{}@var{g} (represented as a single character).
16382 In @code{gtroff}, arbitrary syntactical space around and within this
16383 command is allowed to be added. Only when a preceding command on the
16384 same line ends with an argument of variable length a separating space is
16385 obligatory. In @acronym{AT&T} @code{troff}, large clusters of these and
16386 other commands are used, mostly without spaces; this made such output
16390 For modern high-resolution devices, this command does not make sense
16391 because the width of the glyphs can become much larger than two decimal
16392 digits. In @code{gtroff}, this is only used for the devices @code{X75},
16393 @code{X75-12}, @code{X100}, and @code{X100-12}. For other devices, the
16394 commands @samp{t} and @samp{u} provide a better functionality.
16396 @c ---------------------------------------------------------------------
16398 @node Intermediate Output Examples, Output Language Compatibility, Command Reference, gtroff Output
16399 @subsection Intermediate Output Examples
16401 This section presents the intermediate output generated from the same
16402 input for three different devices. The input is the sentence @samp{hell
16403 world} fed into @code{gtroff} on the command line.
16406 @item High-resolution device @code{ps}
16408 This is the standard output of @code{gtroff} if no @option{-T} option is
16413 shell> echo "hell world" | groff -Z -T ps
16439 This output can be fed into @code{grops} to get its representation as a
16440 @sc{PostScript} file.
16442 @item Low-resolution device @code{latin1}
16444 This is similar to the high-resolution device except that the
16445 positioning is done at a minor scale. Some comments (lines starting
16446 with @samp{#}) were added for clarification; they were not generated by
16451 shell> echo "hell world" | groff -Z -T latin1
16464 # initial positioning on the page
16467 # write text `hell'
16469 # inform about space, and issue a horizontal jump
16471 # write text `world'
16473 # announce line break, but do nothing because ...
16476 # ... the end of the document has been reached
16484 This output can be fed into @code{grotty} to get a formatted text
16487 @item @acronym{AT&T} @code{troff} output
16488 Since a computer monitor has a very low resolution compared to modern
16489 printers the intermediate output for the X@tie{}Window devices can use
16490 the jump-and-write command with its 2-digit displacements.
16494 shell> echo "hell world" | groff -Z -T X100
16506 # write text with jump-and-write commands
16507 ch07e07l03lw06w11o07r05l03dh7
16517 This output can be fed into @code{xditview} or @code{gxditview} for
16518 displaying in@tie{}X.
16520 Due to the obsolete jump-and-write command, the text clusters in the
16521 @acronym{AT&T} @code{troff} output are almost unreadable.
16524 @c ---------------------------------------------------------------------
16526 @node Output Language Compatibility, , Intermediate Output Examples, gtroff Output
16527 @subsection Output Language Compatibility
16529 The intermediate output language of @acronym{AT&T} @code{troff} was
16530 first documented in the @acronym{UNIX} troff manual, with later
16531 additions documented in @cite{A Typesetter-indenpendent TROFF}, written
16532 by Brian Kernighan.
16534 The @code{gtroff} intermediate output format is compatible with this
16535 specification except for the following features.
16539 The classical quasi device independence is not yet implemented.
16542 The old hardware was very different from what we use today. So the
16543 @code{groff} devices are also fundamentally different from the ones
16544 in @acronym{AT&T} @code{troff}. For example, the @acronym{AT&T}
16545 @sc{PostScript} device is called @code{post} and has a resolution of
16546 only 720 units per inch, suitable for printers 20 years ago, while
16547 @code{groff}'s @code{ps} device has a resolution of 72000 units per
16548 inch. Maybe, by implementing some rescaling mechanism similar to the
16549 classical quasi device independence, @code{groff} could emulate
16550 @acronym{AT&T}'s @code{post} device.
16553 The B-spline command @samp{D~} is correctly handled by the intermediate
16554 output parser, but the drawing routines aren't implemented in some of
16555 the postprocessor programs.
16558 The argument of the commands @samp{s} and @w{@samp{x H}} has the
16559 implicit unit scaled point @samp{z} in @code{gtroff}, while
16560 @acronym{AT&T} @code{troff} has point (@samp{p}). This isn't an
16561 incompatibility but a compatible extension, for both units coincide for
16562 all devices without a @code{sizescale} parameter in the @file{DESC}
16563 file, including all postprocessors from @acronym{AT&T} and
16564 @code{groff}'s text devices. The few @code{groff} devices with a
16565 @code{sizescale} parameter either do not exist for @acronym{AT&T}
16566 @code{troff}, have a different name, or seem to have a different
16567 resolution. So conflicts are very unlikely.
16570 The position changing after the commands @samp{Dp}, @samp{DP}, and
16571 @samp{Dt} is illogical, but as old versions of @code{gtroff} used this
16572 feature it is kept for compatibility reasons.
16575 Temporarily, there existed some confusion on the positioning after the
16576 @samp{D} commands that are groff extensions. This has been clarified by
16577 establishing the classical rule for all @code{groff} drawing commands:
16581 The position after a graphic object has been drawn is at its end; for
16582 circles and ellipses, the `end' is at the right side.
16585 From this, the positionings specified for the drawing commands above
16586 follow quite naturally.
16593 @c =====================================================================
16595 @node Font Files, , gtroff Output, File formats
16596 @section Font Files
16598 @cindex files, font
16600 The @code{gtroff} font format is roughly a superset of the
16601 @code{ditroff} font format (as used in later versions of @acronym{AT&T}
16602 @code{troff} and its descendants). Unlike the @code{ditroff} font
16603 format, there is no associated binary format; all files are text
16604 files.@footnote{Plan@tie{}9 @code{troff} has also abandoned the binary
16605 format.} The font files for device @var{name} are stored in a directory
16606 @file{dev@var{name}}. There are two types of file: a device description
16607 file called @file{DESC} and for each font@tie{}@var{f} a font file
16608 called@tie{}@file{@var{f}}.
16611 * DESC File Format::
16612 * Font File Format::
16615 @c ---------------------------------------------------------------------
16617 @node DESC File Format, Font File Format, Font Files, Font Files
16618 @subsection @file{DESC} File Format
16619 @cindex @file{DESC} file, format
16620 @cindex font description file, format
16621 @cindex format of font description file
16622 @pindex DESC@r{ file format}
16624 The @file{DESC} file can contain the following types of line. Except
16625 for the @code{charset} keyword, which must comes last (if at all), the
16626 order of the lines is not important. Later entries in the file,
16627 however, override previous values.
16632 This line and everything following in the file are ignored. It is
16633 allowed for the sake of backwards compatibility.
16635 @item family @var{fam}
16637 The default font family is @var{fam}.
16639 @item fonts @var{n} @var{F1} @var{F2} @var{F3} @dots{} @var{Fn}
16641 Fonts @var{F1} @dots{} @var{Fn} are mounted in the font positions
16642 @var{m}+1, @dots{}, @var{m}+@var{n} where @var{m} is the number of
16643 styles. This command may extend over more than one line. A font name
16644 of@tie{}0 means no font is mounted on the corresponding font position.
16648 @cindex horizontal resolution
16649 @cindex resolution, horizontal
16650 The horizontal resolution is @var{n}@tie{}machine units. All horizontal
16651 quantities are rounded to be multiples of this value.
16653 @item image_generator @var{string}
16654 @kindex image_generator
16655 @cindex PostScript, PNG image generation
16656 @cindex PNG image generation from PostScript
16657 Needed for @code{grohtml} only. It specifies the program to generate
16658 PNG images from @sc{PostScript} input. Under GNU/Linux this is
16659 usually @code{gs} but under other systems (notably cygwin) it might
16660 be set to another name.
16662 @item paperlength @var{n}
16663 @kindex paperlength
16664 The physical vertical dimension of the output medium in machine units.
16665 This isn't used by @code{troff} itself but by output devices.
16666 Deprecated. Use @code{papersize} instead.
16668 @item papersize @var{string} @dots{}
16670 Select a paper size. Valid values for @var{string} are the ISO paper
16671 types @code{A0}-@code{A7}, @code{B0}-@code{B7}, @code{C0}-@code{C7},
16672 @code{D0}-@code{D7}, @code{DL}, and the US paper types @code{letter},
16673 @code{legal}, @code{tabloid}, @code{ledger}, @code{statement},
16674 @code{executive}, @code{com10}, and @code{monarch}. Case is not
16675 significant for @var{string} if it holds predefined paper types.
16676 Alternatively, @var{string} can be a file name (e.g.@:
16677 @file{/etc/papersize}); if the file can be opened, @code{groff} reads
16678 the first line and tests for the above paper sizes. Finally,
16679 @var{string} can be a custom paper size in the format
16680 @code{@var{length},@var{width}} (no spaces before and after the comma).
16681 Both @var{length} and @var{width} must have a unit appended; valid
16682 values are @samp{i} for inches, @samp{C} for centimeters, @samp{p} for
16683 points, and @samp{P} for picas. Example: @code{12c,235p}. An argument
16684 that starts with a digit is always treated as a custom paper format.
16685 @code{papersize} sets both the vertical and horizontal dimension of the
16688 More than one argument can be specified; @code{groff} scans from left to
16689 right and uses the first valid paper specification.
16691 @item paperwidth @var{n}
16693 The physical horizontal dimension of the output medium in machine units.
16694 This isn't used by @code{troff} itself but by output devices.
16695 Deprecated. Use @code{papersize} instead.
16697 @item pass_filenames
16698 @kindex pass_filenames
16699 Tell @code{gtroff} to emit the name of the source file currently being
16700 processed. This is achieved by the intermediate output command
16701 @samp{F}. Currently, this is only used by the @code{grohtml} output
16704 @item postpro @var{program}
16706 Call @var{program} as a postprocessor. For example, the line
16713 in the file @file{devdvi/DESC} makes @code{groff} call @code{grodvi} if
16714 option @option{-Tdvi} is given (and @option{-Z} isn't used).
16716 @item prepro @var{program}
16718 Call @var{program} as a preprocessor. Currently, this keyword is used
16719 by @code{groff} with option @option{-Thtml} or @option{-Txhtml} only.
16721 @item print @var{program}
16723 Use @var{program} as a spooler program for printing. If omitted, the
16724 @option{-l} and @option{-L} options of @code{groff} are ignored.
16728 @cindex device resolution
16729 @cindex resolution, device
16730 There are @var{n}@tie{}machine units per inch.
16732 @item sizes @var{s1} @var{s2} @dots{} @var{sn} 0
16734 This means that the device has fonts at @var{s1}, @var{s2}, @dots{}
16735 @var{sn} scaled points. The list of sizes must be terminated by@tie{}0
16736 (this is digit zero). Each @var{si} can also be a range of sizes
16737 @var{m}-@var{n}. The list can extend over more than one line.
16739 @item sizescale @var{n}
16741 The scale factor for point sizes. By default this has a value
16742 of@tie{}1. One scaled point is equal to one point/@var{n}. The
16743 arguments to the @code{unitwidth} and @code{sizes} commands are given in
16744 scaled points. @xref{Fractional Type Sizes}, for more information.
16746 @item styles @var{S1} @var{S2} @dots{} @var{Sm}
16748 The first @var{m}@tie{}font positions are associated with styles
16749 @var{S1} @dots{} @var{Sm}.
16753 This means that the postprocessor can handle the @samp{t} and @samp{u}
16754 intermediate output commands.
16758 Indicate that the output device supports the complete Unicode
16759 repertoire. Useful only for devices that produce @emph{character
16760 entities} instead of glyphs.
16762 If @code{unicode} is present, no @code{charset} section is required in
16763 the font description files since the Unicode handling built into
16764 @code{groff} is used. However, if there are entries in a @code{charset}
16765 section, they either override the default mappings for those particular
16766 characters or add new mappings (normally for composite characters).
16768 This is used for @option{-Tutf8}, @option{-Thtml}, and @option{-Txhtml}.
16770 @item unitwidth @var{n}
16772 Quantities in the font files are given in machine units for fonts whose
16773 point size is @var{n}@tie{}scaled points.
16775 @item unscaled_charwidths
16776 @kindex unscaled_charwidths
16777 Make the font handling module always return unscaled character widths.
16778 Needed for the @code{grohtml} device.
16780 @item use_charnames_in_special
16781 @kindex use_charnames_in_special
16782 This command indicates that @code{gtroff} should encode special
16783 characters inside special commands. Currently, this is only used by the
16784 @code{grohtml} output device. @xref{Postprocessor Access}.
16788 @cindex vertical resolution
16789 @cindex resolution, vertical
16790 The vertical resolution is @var{n}@tie{}machine units. All vertical
16791 quantities are rounded to be multiples of this value.
16794 The @code{res}, @code{unitwidth}, @code{fonts}, and @code{sizes} lines
16795 are mandatory. Other commands are ignored by @code{gtroff} but may be
16796 used by postprocessors to store arbitrary information about the device
16797 in the @file{DESC} file.
16801 @kindex biggestfont
16802 Here a list of obsolete keywords that are recognized by @code{groff}
16803 but completely ignored: @code{spare1}, @code{spare2},
16804 @code{biggestfont}.
16806 @c ---------------------------------------------------------------------
16808 @node Font File Format, , DESC File Format, Font Files
16809 @subsection Font File Format
16810 @cindex font file, format
16811 @cindex font description file, format
16812 @cindex format of font files
16813 @cindex format of font description files
16815 A @dfn{font file}, also (and probably better) called a @dfn{font
16816 description file}, has two sections. The first section is a sequence of
16817 lines each containing a sequence of blank delimited words; the first
16818 word in the line is a key, and subsequent words give a value for that
16824 The name of the font is@tie{}@var{f}.
16826 @item spacewidth @var{n}
16828 The normal width of a space is@tie{}@var{n}.
16830 @item slant @var{n}
16832 The glyphs of the font have a slant of @var{n}@tie{}degrees. (Positive
16835 @item ligatures @var{lig1} @var{lig2} @dots{} @var{lign} [0]
16837 Glyphs @var{lig1}, @var{lig2}, @dots{}, @var{lign} are ligatures;
16838 possible ligatures are @samp{ff}, @samp{fi}, @samp{fl}, @samp{ffi} and
16839 @samp{ffl}. For backwards compatibility, the list of ligatures may be
16840 terminated with a@tie{}0. The list of ligatures may not extend over
16841 more than one line.
16844 @cindex special fonts
16846 The font is @dfn{special}; this means that when a glyph is requested
16847 that is not present in the current font, it is searched for in any
16848 special fonts that are mounted.
16851 Other commands are ignored by @code{gtroff} but may be used by
16852 postprocessors to store arbitrary information about the font in the font
16855 @cindex comments in font files
16856 @cindex font files, comments
16858 The first section can contain comments, which start with the @samp{#}
16859 character and extend to the end of a line.
16861 The second section contains one or two subsections. It must contain a
16862 @code{charset} subsection and it may also contain a @code{kernpairs}
16863 subsection. These subsections can appear in any order. Each subsection
16864 starts with a word on a line by itself.
16867 The word @code{charset} starts the character set
16868 subsection.@footnote{This keyword is misnamed since it starts a list of
16869 ordered glyphs, not characters.} The @code{charset} line is followed by
16870 a sequence of lines. Each line gives information for one glyph. A line
16871 comprises a number of fields separated by blanks or tabs. The format is
16874 @var{name} @var{metrics} @var{type} @var{code} [@var{entity-name}]
16875 [@code{--} @var{comment}]
16878 @cindex 8-bit input
16879 @cindex input, 8-bit
16880 @cindex accessing unnamed glyphs with @code{\N}
16881 @cindex unnamed glyphs, accessing with @code{\N}
16882 @cindex characters, unnamed, accessing with @code{\N}
16883 @cindex glyphs, unnamed, accessing with @code{\N}
16886 @var{name} identifies the glyph name@footnote{The distinction between
16887 input, characters, and output, glyphs, is not clearly separated in the
16888 terminology of @code{groff}; for example, the @code{char} request should
16889 be called @code{glyph} since it defines an output entity.}: If
16890 @var{name} is a single character@tie{}@var{c} then it corresponds to the
16891 @code{gtroff} input character@tie{}@var{c}; if it is of the form
16892 @samp{\@var{c}} where @var{c} is a single character, then it corresponds
16893 to the special character @code{\[@var{c}]}; otherwise it corresponds to
16894 the special character @samp{\[@var{name}]}. If it is exactly two
16895 characters @var{xx} it can be entered as @samp{\(@var{xx}}. Note that
16896 single-letter special characters can't be accessed as @samp{\@var{c}};
16897 the only exception is @samp{\-}, which is identical to @code{\[-]}.
16899 @code{gtroff} supports 8-bit input characters; however some utilities
16900 have difficulties with eight-bit characters. For this reason, there is
16901 a convention that the entity name @samp{char@var{n}} is equivalent to
16902 the single input character whose code is@tie{}@var{n}. For example,
16903 @samp{char163} would be equivalent to the character with code@tie{}163,
16904 which is the pounds sterling sign in the ISO@tie{}@w{Latin-1} character
16905 set. You shouldn't use @samp{char@var{n}} entities in font description
16906 files since they are related to input, not output. Otherwise, you get
16907 hard-coded connections between input and output encoding, which prevents
16908 use of different (input) character sets.
16910 The name @samp{---} is special and indicates that the glyph is unnamed;
16911 such glyphs can only be used by means of the @code{\N} escape sequence
16914 The @var{type} field gives the glyph type:
16918 the glyph has a descender, for example, @samp{p};
16921 the glyph has an ascender, for example, @samp{b};
16924 the glyph has both an ascender and a descender, for example, @samp{(}.
16927 The @var{code} field gives the code that the postprocessor uses to
16928 print the glyph. The glyph can also be input to @code{gtroff} using
16929 this code by means of the @code{\N} escape sequence. @var{code} can be
16930 any integer. If it starts with @samp{0} it is interpreted as octal; if
16931 it starts with @samp{0x} or @samp{0X} it is interpreted as hexadecimal.
16932 Note, however, that the @code{\N} escape sequence only accepts a decimal
16935 The @var{entity-name} field gives an @acronym{ASCII} string identifying
16936 the glyph that the postprocessor uses to print the @code{gtroff} glyph
16937 @var{name}. This field is optional and has been introduced so that the
16938 @code{grohtml} device driver can encode its character set. For example,
16939 the glyph @samp{\[Po]} is represented as @samp{£} in
16940 @acronym{HTML} 4.0.
16942 Anything on the line after the @var{entity-name} field resp.@: after
16943 @samp{--} is ignored.
16945 The @var{metrics} field has the form:
16949 @var{width}[@code{,}@var{height}[@code{,}@var{depth}[@code{,}@var{italic-correction}
16950 [@code{,}@var{left-italic-correction}[@code{,}@var{subscript-correction}]]]]]
16955 There must not be any spaces between these subfields (it has been split
16956 here into two lines for better legibility only). Missing subfields are
16957 assumed to be@tie{}0. The subfields are all decimal integers. Since
16958 there is no associated binary format, these values are not required to
16959 fit into a variable of type @samp{char} as they are in @code{ditroff}.
16960 The @var{width} subfield gives the width of the glyph. The @var{height}
16961 subfield gives the height of the glyph (upwards is positive); if a glyph
16962 does not extend above the baseline, it should be given a zero height,
16963 rather than a negative height. The @var{depth} subfield gives the depth
16964 of the glyph, that is, the distance from the baseline to the lowest
16965 point below the baseline to which the glyph extends (downwards is
16966 positive); if a glyph does not extend below the baseline, it should be
16967 given a zero depth, rather than a negative depth. The
16968 @var{italic-correction} subfield gives the amount of space that should
16969 be added after the glyph when it is immediately to be followed by a
16970 glyph from a roman font. The @var{left-italic-correction} subfield
16971 gives the amount of space that should be added before the glyph when it
16972 is immediately to be preceded by a glyph from a roman font. The
16973 @var{subscript-correction} gives the amount of space that should be
16974 added after a glyph before adding a subscript. This should be less than
16975 the italic correction.
16977 A line in the @code{charset} section can also have the format
16984 This indicates that @var{name} is just another name for the glyph
16985 mentioned in the preceding line.
16988 The word @code{kernpairs} starts the kernpairs section. This contains a
16989 sequence of lines of the form:
16992 @var{c1} @var{c2} @var{n}
16996 This means that when glyph @var{c1} appears next to glyph @var{c2} the
16997 space between them should be increased by@tie{}@var{n}. Most entries in
16998 the kernpairs section have a negative value for@tie{}@var{n}.
17002 @c =====================================================================
17003 @c =====================================================================
17005 @node Installation, Copying This Manual, File formats, Top
17006 @chapter Installation
17007 @cindex installation
17013 @c =====================================================================
17014 @c =====================================================================
17016 @node Copying This Manual, Request Index, Installation, Top
17017 @appendix Copying This Manual
17023 @c =====================================================================
17024 @c =====================================================================
17026 @node Request Index, Escape Index, Copying This Manual, Top
17027 @appendix Request Index
17029 Requests appear without the leading control character (normally either
17030 @samp{.} or @samp{'}).
17036 @c =====================================================================
17037 @c =====================================================================
17039 @node Escape Index, Operator Index, Request Index, Top
17040 @appendix Escape Index
17042 Any escape sequence @code{\@var{X}} with @var{X} not in the list below
17043 emits a warning, printing glyph @var{X}.
17049 @c =====================================================================
17050 @c =====================================================================
17052 @node Operator Index, Register Index, Escape Index, Top
17053 @appendix Operator Index
17059 @c =====================================================================
17060 @c =====================================================================
17062 @node Register Index, Macro Index, Operator Index, Top
17063 @appendix Register Index
17065 The macro package or program a specific register belongs to is appended in
17068 A register name@tie{}@code{x} consisting of exactly one character can be
17069 accessed as @samp{\nx}. A register name @code{xx} consisting of exactly
17070 two characters can be accessed as @samp{\n(xx}. Register names
17071 @code{xxx} of any length can be accessed as @samp{\n[xxx]}.
17077 @c =====================================================================
17078 @c =====================================================================
17080 @node Macro Index, String Index, Register Index, Top
17081 @appendix Macro Index
17083 The macro package a specific macro belongs to is appended in brackets.
17084 They appear without the leading control character (normally @samp{.}).
17090 @c =====================================================================
17091 @c =====================================================================
17093 @node String Index, Glyph Name Index, Macro Index, Top
17094 @appendix String Index
17096 The macro package or program a specific string belongs to is appended in
17099 A string name@tie{}@code{x} consisting of exactly one character can be
17100 accessed as @samp{\*x}. A string name @code{xx} consisting of exactly
17101 two characters can be accessed as @samp{\*(xx}. String names @code{xxx}
17102 of any length can be accessed as @samp{\*[xxx]}.
17109 @c =====================================================================
17110 @c =====================================================================
17112 @node Glyph Name Index, Font File Keyword Index, String Index, Top
17113 @appendix Glyph Name Index
17115 A glyph name @code{xx} consisting of exactly two characters can be
17116 accessed as @samp{\(xx}. Glyph names @code{xxx} of any length can be
17117 accessed as @samp{\[xxx]}.
17123 @c =====================================================================
17124 @c =====================================================================
17126 @node Font File Keyword Index, Program and File Index, Glyph Name Index, Top
17127 @appendix Font File Keyword Index
17133 @c =====================================================================
17134 @c =====================================================================
17136 @node Program and File Index, Concept Index, Font File Keyword Index, Top
17137 @appendix Program and File Index
17143 @c =====================================================================
17144 @c =====================================================================
17146 @node Concept Index, , Program and File Index, Top
17147 @appendix Concept Index
17154 @c Local Variables: