1 \input texinfo @c -*-texinfo-*-
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.6 or newer to format this document!
10 @c %**start of header (This is for running Texinfo on a region.)
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.19.2.
29 Copyright @copyright{} 1994-2000, 2001, 2002, 2003, 2004, 2005
30 Free Software Foundation, Inc.
33 Permission is granted to copy, distribute and/or modify this document
34 under the terms of the GNU Free Documentation License, Version 1.1 or
35 any later version published by the Free Software Foundation; with no
36 Invariant Sections, with the Front-Cover texts being `A GNU Manual,''
37 and with the Back-Cover Texts as in (a) below. A copy of the
38 license is included in the section entitled `GNU Free Documentation
41 (a) The FSF's Back-Cover Text is: `You have freedom to copy and modify
42 this GNU Manual, like GNU software. Copies published by the Free
43 Software Foundation raise funds for GNU development.''
48 @c We use the following indices:
54 @c kindex: commands in font files
55 @c pindex: programs and files
56 @c tindex: environment variables
61 @c tindex and cindex are merged.
71 @c To avoid uppercasing in @deffn while converting to info, we define
72 @c our special @Var{}.
79 @c To assure correct HTML translation, some ugly hacks are necessary.
80 @c While processing a @def... request, the HTML translator looks at the
81 @c next line to decide whether it should start indentation or not. If
82 @c it is something starting with @def... (e.g. @deffnx), it doesn't.
83 @c So we must assure during macro expansion that a @def... is seen.
85 @c The following macros have to be used:
104 @c The definition block must end with
108 @c The above is valid for texinfo 4.0f and above.
111 @c a dummy macro to assure the `@def...'
118 @c definition of requests
120 @macro Defreq{name, arg}
121 @deffn Request @t{.\name\} \arg\
126 @macro DefreqList{name, arg}
127 @deffn Request @t{.\name\} \arg\
133 @macro DefreqItem{name, arg}
134 @deffnx Request @t{.\name\} \arg\
140 @macro DefreqListEnd{name, arg}
141 @deffnx Request @t{.\name\} \arg\
151 @c definition of escapes
153 @macro Defesc{name, delimI, arg, delimII}
154 @deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
159 @macro DefescList{name, delimI, arg, delimII}
160 @deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
166 @macro DefescItem{name, delimI, arg, delimII}
167 @deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
173 @macro DefescListEnd{name, delimI, arg, delimII}
174 @deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
184 @c definition of registers
187 @deffn Register @t{\\n[\name\]}
192 @macro DefregList{name}
193 @deffn Register @t{\\n[\name\]}
199 @macro DefregItem{name}
200 @deffnx Register @t{\\n[\name\]}
206 @macro DefregListEnd{name}
207 @deffnx Register @t{\\n[\name\]}
217 @c definition of registers specific to macro packages, preprocessors, etc.
219 @macro Defmpreg{name, package}
220 @deffn Register @t{\\n[\name\]}
221 @vindex \name\ @r{[}\package\@r{]}
225 @macro DefmpregList{name, package}
226 @deffn Register @t{\\n[\name\]}
228 @vindex \name\ @r{[}\package\@r{]}
232 @macro DefmpregItem{name, package}
233 @deffnx Register @t{\\n[\name\]}
235 @vindex \name\ @r{[}\package\@r{]}
239 @macro DefmpregListEnd{name, package}
240 @deffnx Register @t{\\n[\name\]}
241 @vindex \name\ @r{[}\package\@r{]}
250 @c definition of macros
252 @macro Defmac{name, arg, package}
253 @defmac @t{.\name\} \arg\
254 @maindex \name\ @r{[}\package\@r{]}
258 @macro DefmacList{name, arg, package}
259 @defmac @t{.\name\} \arg\
261 @maindex \name\ @r{[}\package\@r{]}
265 @macro DefmacItem{name, arg, package}
266 @defmacx @t{.\name\} \arg\
268 @maindex \name\ @r{[}\package\@r{]}
272 @macro DefmacListEnd{name, arg, package}
273 @defmacx @t{.\name\} \arg\
274 @maindex \name\ @r{[}\package\@r{]}
283 @c definition of strings
285 @macro Defstr{name, package}
286 @deffn String @t{\\*[\name\]}
287 @stindex \name\ @r{[}\package\@r{]}
291 @macro DefstrList{name, package}
292 @deffn String @t{\\*[\name\]}
294 @stindex \name\ @r{[}\package\@r{]}
298 @macro DefstrItem{name, package}
299 @deffnx String @t{\\*[\name\]}
301 @stindex \name\ @r{[}\package\@r{]}
305 @macro DefstrListEnd{name, package}
306 @deffnx String @t{\\*[\name\]}
307 @stindex \name\ @r{[}\package\@r{]}
332 \gdef\Langlemacro{\angleleft}
333 \gdef\Ranglemacro{\angleright}
337 @set Langlemacro @Langlemacro
338 @set Ranglemacro @Ranglemacro
347 @value{Langlemacro}@r{\text\}@value{Ranglemacro}
353 @c A value defined with @set is embedded into three group levels if
354 @c called with @value, so we need seven \aftergroup to put \le outside
355 @c of the groups -- this is necessary to get proper mathematical spacing.
358 \gdef\LEmacro{\aftergroup\aftergroup\aftergroup\aftergroup
359 \aftergroup\aftergroup\aftergroup\le}
363 @set LEmacro @LEmacro
375 @c We need special parentheses, brackets, and braces:
377 @c . Real parentheses in @deffn produce an error while compiling with
379 @c . Real brackets use the wrong font in @deffn, overriding @t{}.
381 @c . @{ and @} fail with info if used in a macro.
383 @c Since macros aren't expanded in @deffn during -E, the following
384 @c definitions are for non-TeX only.
386 @c This is true for texinfo 4.0 and above.
389 @set Lparenmacro @lparen
390 @set Rparenmacro @rparen
391 @set Lbrackmacro @lbrack
392 @set Rbrackmacro @rbrack
426 @c This suppresses the word `Appendix' in the appendix headers.
429 \gdef\gobblefirst#1#2{#2}
430 \gdef\putwordAppendix{\gobblefirst}
434 @c We map some latin-1 characters to corresponding texinfo macros.
437 \global\catcode`^^e4\active % ä
439 \global\catcode`^^c4\active % Ä
441 \global\catcode`^^e9\active % é
443 \global\catcode`^^c9\active % É
445 \global\catcode`^^f6\active % ö
447 \global\catcode`^^d6\active % Ö
449 \global\catcode`^^fc\active % ü
451 \global\catcode`^^dc\active % Ü
453 \global\catcode`^^e6\active % æ
455 \global\catcode`^^c6\active % Æ
457 \global\catcode`^^df\active % ß
462 @c Note: We say `Roman numerals' but `roman font'.
465 @dircategory Typesetting
467 * Groff: (groff). The GNU troff document formatting system.
473 @subtitle The GNU implementation of @code{troff}
474 @subtitle Edition 1.19.2
475 @subtitle Summer 2005
476 @author by Trent A.@tie{}Fisher
477 @author and Werner Lemberg (@email{bug-groff@@gnu.org})
480 @vskip 0pt plus 1filll
488 @node Top, Introduction, (dir), (dir)
498 * Tutorial for Macro Users::
505 * Copying This Manual::
513 * Font File Keyword Index::
514 * Program and File Index::
518 @node Top, Introduction, (dir), (dir)
527 * Tutorial for Macro Users::
534 * Copying This Manual::
542 * Font File Keyword Index::
543 * Program and File Index::
549 @c =====================================================================
550 @c =====================================================================
552 @node Introduction, Invoking groff, Top, Top
553 @chapter Introduction
556 GNU @code{troff} (or @code{groff}) is a system for typesetting
557 documents. @code{troff} is very flexible and has been in existence (and
558 use) for about 3@tie{}decades. It is quite widespread and firmly
559 entrenched in the @acronym{UNIX} community.
564 * groff Capabilities::
565 * Macro Package Intro::
566 * Preprocessor Intro::
567 * Output device intro::
572 @c =====================================================================
574 @node What Is groff?, History, Introduction, Introduction
575 @section What Is @code{groff}?
576 @cindex what is @code{groff}?
577 @cindex @code{groff} -- what is it?
579 @code{groff} belongs to an older generation of document preparation
580 systems, which operate more like compilers than the more recent
581 interactive @acronym{WYSIWYG}@footnote{What You See Is What You Get}
582 systems. @code{groff} and its contemporary counterpart, @TeX{}, both
583 work using a @dfn{batch} paradigm: The input (or @dfn{source}) files are
584 normal text files with embedded formatting commands. These files can
585 then be processed by @code{groff} to produce a typeset document on a
588 Likewise, @code{groff} should not be confused with a @dfn{word
589 processor}, since that term connotes an integrated system that includes
590 an editor and a text formatter. Also, many word processors follow the
591 @acronym{WYSIWYG} paradigm discussed earlier.
593 Although @acronym{WYSIWYG} systems may be easier to use, they have a
594 number of disadvantages compared to @code{troff}:
598 They must be used on a graphics display to work on a document.
601 Most of the @acronym{WYSIWYG} systems are either non-free or are not
605 @code{troff} is firmly entrenched in all @acronym{UNIX} systems.
608 It is difficult to have a wide range of capabilities available within
609 the confines of a GUI/window system.
612 It is more difficult to make global changes to a document.
616 ``GUIs normally make it simple to accomplish simple actions and
617 impossible to accomplish complex actions.'' --Doug Gwyn (22/Jun/91 in
618 @code{comp.unix.wizards})
622 @c =====================================================================
624 @node History, groff Capabilities, What Is groff?, Introduction
628 @cindex @code{runoff}, the program
629 @cindex @code{rf}, the program
630 @code{troff} can trace its origins back to a formatting program called
631 @code{runoff}, written by J.@tie{}E.@tie{}Saltzer, which ran on MIT's CTSS
632 operating system in the mid-sixties. This name came from the common
633 phrase of the time ``I'll run off a document.'' Bob Morris ported it to
634 the 635 architecture and called the program @code{roff} (an abbreviation
635 of @code{runoff}). It was rewritten as @code{rf} for the @w{PDP-7}
636 (before having @acronym{UNIX}), and at the same time (1969), Doug
637 McIllroy rewrote an extended and simplified version of @code{roff} in
638 the @acronym{BCPL} programming language.
640 @cindex @code{roff}, the program
641 The first version of @acronym{UNIX} was developed on a @w{PDP-7} which
642 was sitting around Bell Labs. In 1971 the developers wanted to get a
643 @w{PDP-11} for further work on the operating system. In order to
644 justify the cost for this system, they proposed that they would
645 implement a document formatting system for the @acronym{AT&T} patents
646 division. This first formatting program was a reimplementation of
647 McIllroy's @code{roff}, written by J.@tie{}F.@tie{}Ossanna.
649 @cindex @code{nroff}, the program
650 When they needed a more flexible language, a new version of @code{roff}
651 called @code{nroff} (``Newer @code{roff}'') was written. It had a much
652 more complicated syntax, but provided the basis for all future versions.
653 When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a
654 version of @code{nroff} that would drive it. It was dubbed
655 @code{troff}, for ``typesetter @code{roff}'', although many people have
656 speculated that it actually means ``Times @code{roff}'' because of the
657 use of the Times font family in @code{troff} by default. As such, the
658 name @code{troff} is pronounced `@w{t-roff}' rather than `trough'.
660 With @code{troff} came @code{nroff} (they were actually the same program
661 except for some @samp{#ifdef}s), which was for producing output for line
662 printers and character terminals. It understood everything @code{troff}
663 did, and ignored the commands which were not applicable (e.g.@: font
666 Since there are several things which cannot be done easily in
667 @code{troff}, work on several preprocessors began. These programs would
668 transform certain parts of a document into @code{troff}, which made a
669 very natural use of pipes in @acronym{UNIX}.
671 The @code{eqn} preprocessor allowed mathematical formulæ to be
672 specified in a much simpler and more intuitive manner. @code{tbl} is a
673 preprocessor for formatting tables. The @code{refer} preprocessor (and
674 the similar program, @code{bib}) processes citations in a document
675 according to a bibliographic database.
677 Unfortunately, Ossanna's @code{troff} was written in @w{PDP-11} assembly
678 language and produced output specifically for the CAT phototypesetter.
679 He rewrote it in C, although it was now 7000@tie{}lines of uncommented
680 code and still dependent on the CAT. As the CAT became less common, and
681 was no longer supported by the manufacturer, the need to make it support
682 other devices became a priority. However, before this could be done,
683 Ossanna was killed in a car accident.
686 @cindex @code{ditroff}, the program
687 So, Brian Kernighan took on the task of rewriting @code{troff}. The
688 newly rewritten version produced device independent code which was
689 very easy for postprocessors to read and translate to the appropriate
690 printer codes. Also, this new version of @code{troff} (called
691 @code{ditroff} for ``device independent @code{troff}'') had several
692 extensions, which included drawing functions.
694 Due to the additional abilities of the new version of @code{troff},
695 several new preprocessors appeared. The @code{pic} preprocessor
696 provides a wide range of drawing functions. Likewise the @code{ideal}
697 preprocessor did the same, although via a much different paradigm. The
698 @code{grap} preprocessor took specifications for graphs, but, unlike
699 other preprocessors, produced @code{pic} code.
701 James Clark began work on a GNU implementation of @code{ditroff} in
702 early@tie{}1989. The first version, @code{groff}@tie{}0.3.1, was released
703 June@tie{}1990. @code{groff} included:
707 A replacement for @code{ditroff} with many extensions.
710 The @code{soelim}, @code{pic}, @code{tbl}, and @code{eqn} preprocessors.
713 Postprocessors for character devices, @sc{PostScript}, @TeX{} DVI, and
714 X@tie{}Windows. GNU @code{troff} also eliminated the need for a
715 separate @code{nroff} program with a postprocessor which would produce
716 @acronym{ASCII} output.
719 A version of the @file{me} macros and an implementation of the
723 Also, a front-end was included which could construct the, sometimes
724 painfully long, pipelines required for all the post- and preprocessors.
726 Development of GNU @code{troff} progressed rapidly, and saw the
727 additions of a replacement for @code{refer}, an implementation of the
728 @file{ms} and @file{mm} macros, and a program to deduce how to format a
729 document (@code{grog}).
731 It was declared a stable (i.e.@: non-beta) package with the release of
732 version@tie{}1.04 around November@tie{}1991.
734 Beginning in@tie{}1999, @code{groff} has new maintainers (the package was
735 an orphan for a few years). As a result, new features and programs like
736 @code{grn}, a preprocessor for gremlin images, and an output device to
737 produce @acronym{HTML} output have been added.
740 @c =====================================================================
742 @node groff Capabilities, Macro Package Intro, History, Introduction
743 @section @code{groff} Capabilities
744 @cindex @code{groff} capabilities
745 @cindex capabilities of @code{groff}
747 So what exactly is @code{groff} capable of doing? @code{groff} provides
748 a wide range of low-level text formatting operations. Using these, it
749 is possible to perform a wide range of formatting tasks, such as
750 footnotes, table of contents, multiple columns, etc. Here's a list of
751 the most important operations supported by @code{groff}:
755 text filling, adjusting, and centering
764 font and glyph size control
767 vertical spacing (e.g.@: double-spacing)
770 line length and indenting
773 macros, strings, diversions, and traps
779 tabs, leaders, and fields
782 input and output conventions and character translation
785 overstrike, bracket, line drawing, and zero-width functions
788 local horizontal and vertical motions and the width function
794 output line numbering
797 conditional acceptance of input
800 environment switching
803 insertions from the standard input
806 input/output file switching
809 output and error messages
813 @c =====================================================================
815 @node Macro Package Intro, Preprocessor Intro, groff Capabilities, Introduction
816 @section Macro Packages
817 @cindex macro packages
819 Since @code{groff} provides such low-level facilities, it can be quite
820 difficult to use by itself. However, @code{groff} provides a
821 @dfn{macro} facility to specify how certain routine operations
822 (e.g.@tie{}starting paragraphs, printing headers and footers, etc.)@:
823 should be done. These macros can be collected together into a @dfn{macro
824 package}. There are a number of macro packages available; the most
825 common (and the ones described in this manual) are @file{man},
826 @file{mdoc}, @file{me}, @file{ms}, and @file{mm}.
829 @c =====================================================================
831 @node Preprocessor Intro, Output device intro, Macro Package Intro, Introduction
832 @section Preprocessors
833 @cindex preprocessors
835 Although @code{groff} provides most functions needed to format a
836 document, some operations would be unwieldy (e.g.@: to draw pictures).
837 Therefore, programs called @dfn{preprocessors} were written which
838 understand their own language and produce the necessary @code{groff}
839 operations. These preprocessors are able to differentiate their own
840 input from the rest of the document via markers.
842 To use a preprocessor, @acronym{UNIX} pipes are used to feed the output
843 from the preprocessor into @code{groff}. Any number of preprocessors
844 may be used on a given document; in this case, the preprocessors are
845 linked together into one pipeline. However, with @code{groff}, the user
846 does not need to construct the pipe, but only tell @code{groff} what
847 preprocessors to use.
849 @code{groff} currently has preprocessors for producing tables
850 (@code{tbl}), typesetting equations (@code{eqn}), drawing pictures
851 (@code{pic} and @code{grn}), and for processing bibliographies
852 (@code{refer}). An associated program which is useful when dealing with
853 preprocessors is @code{soelim}.
855 A free implementation of @code{grap}, a preprocessor for drawing graphs,
856 can be obtained as an extra package; @code{groff} can use @code{grap}
859 There are other preprocessors in existence, but, unfortunately, no free
860 implementations are available. Among them are preprocessors for drawing
861 mathematical pictures (@code{ideal}) and chemical structures
865 @c =====================================================================
867 @node Output device intro, Credits, Preprocessor Intro, Introduction
868 @section Output Devices
869 @cindex postprocessors
870 @cindex output devices
871 @cindex devices for output
873 @code{groff} actually produces device independent code which may be
874 fed into a postprocessor to produce output for a particular device.
875 Currently, @code{groff} has postprocessors for @sc{PostScript}
876 devices, character terminals, X@tie{}Windows (for previewing), @TeX{}
877 DVI format, HP LaserJet@tie{}4 and Canon LBP printers (which use
878 @acronym{CAPSL}), and @acronym{HTML}.
881 @c =====================================================================
883 @node Credits, , Output device intro, Introduction
887 Large portions of this manual were taken from existing documents, most
888 notably, the manual pages for the @code{groff} package by James Clark,
889 and Eric Allman's papers on the @file{me} macro package.
891 The section on the @file{man} macro package is partly based on
892 Susan@tie{}G.@: Kleinmann's @file{groff_man} manual page written for the
893 Debian GNU/Linux system.
895 Larry Kollar contributed the section in the @file{ms} macro package.
899 @c =====================================================================
900 @c =====================================================================
902 @node Invoking groff, Tutorial for Macro Users, Introduction, Top
903 @chapter Invoking @code{groff}
904 @cindex invoking @code{groff}
905 @cindex @code{groff} invocation
907 This section focuses on how to invoke the @code{groff} front end. This
908 front end takes care of the details of constructing the pipeline among
909 the preprocessors, @code{gtroff} and the postprocessor.
911 It has become a tradition that GNU programs get the prefix @samp{g} to
912 distinguish it from its original counterparts provided by the host (see
913 @ref{Environment}, for more details). Thus, for example, @code{geqn} is
914 GNU @code{eqn}. On operating systems like GNU/Linux or the Hurd, which
915 don't contain proprietary versions of @code{troff}, and on
916 MS-DOS/MS-Windows, where @code{troff} and associated programs are not
917 available at all, this prefix is omitted since GNU @code{troff} is the
918 only used incarnation of @code{troff}. Exception: @samp{groff} is never
919 replaced by @samp{roff}.
921 In this document, we consequently say @samp{gtroff} when talking about
922 the GNU @code{troff} program. All other implementations of @code{troff}
923 are called @acronym{AT&T} @code{troff} which is the common origin of
924 all @code{troff} derivates (with more or less compatible changes).
925 Similarly, we say @samp{gpic}, @samp{geqn}, etc.
930 * Macro Directories::
933 * Invocation Examples::
937 @c =====================================================================
939 @node Groff Options, Environment, Invoking groff, Invoking groff
952 @code{groff} normally runs the @code{gtroff} program and a postprocessor
953 appropriate for the selected device. The default device is @samp{ps}
954 (but it can be changed when @code{groff} is configured and built). It
955 can optionally preprocess with any of @code{gpic}, @code{geqn},
956 @code{gtbl}, @code{ggrn}, @code{grap}, @code{grefer}, or @code{gsoelim}.
958 This section only documents options to the @code{groff} front end. Many
959 of the arguments to @code{groff} are passed on to @code{gtroff},
960 therefore those are also included. Arguments to pre- or postprocessors
961 can be found in @ref{Invoking gpic}, @ref{Invoking geqn}, @ref{Invoking
962 gtbl}, @ref{Invoking ggrn}, @ref{Invoking grefer}, @ref{Invoking
963 gsoelim}, @ref{Invoking grotty}, @ref{Invoking grops}, @ref{Invoking
964 grohtml}, @ref{Invoking grodvi}, @ref{Invoking grolj4}, @ref{Invoking
965 grolbp}, and @ref{Invoking gxditview}.
967 The command line format for @code{groff} is:
970 groff [ -abceghilpstvzCEGNRSUVXZ ] [ -F@var{dir} ] [ -m@var{name} ]
971 [ -T@var{def} ] [ -f@var{fam} ] [ -w@var{name} ] [ -W@var{name} ]
972 [ -M@var{dir} ] [ -d@var{cs} ] [ -r@var{cn} ] [ -n@var{num} ]
973 [ -o@var{list} ] [ -P@var{arg} ] [ -L@var{arg} ] [ -I@var{dir} ]
974 [ @var{files}@dots{} ]
977 The command line format for @code{gtroff} is as follows.
980 gtroff [ -abcivzCERU ] [ -w@var{name} ] [ -W@var{name} ] [ -d@var{cs} ]
981 [ -f@var{fam} ] [ -m@var{name} ] [ -n@var{num} ]
982 [ -o@var{list} ] [ -r@var{cn} ] [ -T@var{name} ]
983 [ -F@var{dir} ] [ -M@var{dir} ] [ @var{files}@dots{} ]
987 Obviously, many of the options to @code{groff} are actually passed on to
990 Options without an argument can be grouped behind a single@tie{}@option{-}.
991 A filename of@tie{}@file{-} denotes the standard input. It is possible to
992 have whitespace between an option and its parameter.
994 The @code{grog} command can be used to guess the correct @code{groff}
995 command to format a file.
997 Here's the description of the command-line options:
999 @cindex command-line options
1002 Print a help message.
1005 Preprocess with @code{geqn}.
1008 Preprocess with @code{gtbl}.
1011 Preprocess with @code{ggrn}.
1014 Preprocess with @code{grap}.
1017 Preprocess with @code{gpic}.
1020 Preprocess with @code{gsoelim}.
1023 Suppress color output.
1026 Preprocess with @code{grefer}. No mechanism is provided for passing
1027 arguments to @code{grefer} because most @code{grefer} options have
1028 equivalent commands which can be included in the file. @xref{grefer},
1033 Note that @code{gtroff} also accepts a @option{-R} option, which is not
1034 accessible via @code{groff}. This option prevents the loading of the
1035 @file{troffrc} and @file{troffrc-end} files.
1038 Make programs run by @code{groff} print out their version number.
1041 Print the pipeline on @code{stdout} instead of executing it. If specified
1042 more than once, print the pipeline on @code{stderr} and execute it.
1045 Suppress output from @code{gtroff}. Only error messages are printed.
1048 Do not postprocess the output of @code{gtroff}. Normally @code{groff}
1049 automatically runs the appropriate postprocessor.
1052 Pass @var{arg} to the postprocessor. Each argument should be passed
1053 with a separate @option{-P} option. Note that @code{groff} does not
1054 prepend @samp{-} to @var{arg} before passing it to the postprocessor.
1057 Send the output to a spooler for printing. The command used for this is
1058 specified by the @code{print} command in the device description file
1059 (see @ref{Font Files}, for more info). If not present, @option{-l} is
1063 Pass @var{arg} to the spooler. Each argument should be passed with a
1064 separate @option{-L} option. Note that @code{groff} does not prepend
1065 a @samp{-} to @var{arg} before passing it to the postprocessor.
1066 If the @code{print} keyword in the device description file is missing,
1067 @option{-L} is ignored.
1070 Prepare output for device @var{dev}. The default device is @samp{ps},
1071 unless changed when @code{groff} was configured and built. The
1072 following are the output devices currently available:
1076 For @sc{PostScript} printers and previewers.
1079 For @TeX{} DVI format.
1082 For a 75@dmn{dpi} X11 previewer.
1085 For a 75@dmn{dpi} X11 previewer with a 12@dmn{pt} base font in the
1089 For a 100@dmn{dpi} X11 previewer.
1092 For a 100@dmn{dpi} X11 previewer with a 12@dmn{pt} base font in the
1096 @cindex encoding, output, @acronym{ASCII}
1097 @cindex @acronym{ASCII}, output encoding
1098 @cindex output encoding, @acronym{ASCII}
1099 For typewriter-like devices using the (7-bit) @acronym{ASCII}
1103 @cindex encoding, output, @w{latin-1} (ISO @w{8859-1})
1104 @cindex @w{latin-1} (ISO @w{8859-1}), output encoding
1105 @cindex ISO @w{8859-1} (@w{latin-1}), output encoding
1106 @cindex output encoding, @w{latin-1} (ISO @w{8859-1})
1107 For typewriter-like devices that support the @w{Latin-1}
1108 (ISO@tie{}@w{8859-1}) character set.
1111 @cindex encoding, output, @w{utf-8}
1112 @cindex @w{utf-8}, output encoding
1113 @cindex output encoding, @w{utf-8}
1114 For typewriter-like devices which use the Unicode (ISO@tie{}10646)
1115 character set with @w{UTF-8} encoding.
1118 @cindex encoding, output, @acronym{EBCDIC}
1119 @cindex @acronym{EBCDIC}, output encoding
1120 @cindex output encoding, @acronym{EBCDIC}
1121 @cindex encoding, output, cp1047
1122 @cindex cp1047, output encoding
1123 @cindex output encoding, cp1047
1124 @cindex IBM cp1047 output encoding
1125 For typewriter-like devices which use the @acronym{EBCDIC} encoding IBM
1129 For HP LaserJet4-compatible (or other PCL5-compatible) printers.
1132 For Canon @acronym{CAPSL} printers (@w{LBP-4} and @w{LBP-8} series laser
1136 @pindex post-grohtml
1137 @cindex @code{grohtml}, the program
1139 To produce @acronym{HTML} output. Note that the @acronym{HTML} driver
1140 consists of two parts, a preprocessor (@code{pre-grohtml}) and a
1141 postprocessor (@code{post-grohtml}).
1144 @cindex output device name string register (@code{.T})
1145 @cindex output device usage number register (@code{.T})
1146 The predefined @code{gtroff} string register @code{.T} contains the
1147 current output device; the read-only number register @code{.T} is set
1148 to@tie{}1 if this option is used (which is always true if @code{groff} is
1149 used to call @code{gtroff}). @xref{Built-in Registers}.
1151 The postprocessor to be used for a device is specified by the
1152 @code{postpro} command in the device description file. (@xref{Font
1153 Files}, for more info.) This can be overridden with the @option{-X}
1157 Preview with @code{gxditview} instead of using the usual postprocessor.
1158 This is unlikely to produce good results except with @option{-Tps}.
1160 Note that this is not the same as using @option{-TX75} or
1161 @option{-TX100} to view a document with @code{gxditview}: The former
1162 uses the metrics of the specified device, whereas the latter uses
1163 X-specific fonts and metrics.
1166 Don't allow newlines with @code{eqn} delimiters. This is the same as
1167 the @option{-N} option in @code{geqn}.
1170 @cindex @code{open} request, and safer mode
1171 @cindex @code{opena} request, and safer mode
1172 @cindex @code{pso} request, and safer mode
1173 @cindex @code{sy} request, and safer mode
1174 @cindex @code{pi} request, and safer mode
1177 Safer mode. Pass the @option{-S} option to @code{gpic} and disable the
1178 @code{open}, @code{opena}, @code{pso}, @code{sy}, and @code{pi}
1179 requests. For security reasons, this is enabled by default.
1182 @cindex mode, unsafe
1184 Unsafe mode. This enables the @code{open}, @code{opena}, @code{pso},
1185 @code{sy}, and @code{pi} requests.
1188 @cindex @acronym{ASCII} approximation output register (@code{.A})
1189 Generate an @acronym{ASCII} approximation of the typeset output. The
1190 read-only register @code{.A} is then set to@tie{}1. @xref{Built-in
1191 Registers}. A typical example is
1194 groff -a -man -Tdvi troff.man | less
1198 which shows how lines are broken for the DVI device. Note that this
1199 option is rather useless today since graphic output devices are
1200 available virtually everywhere.
1203 Print a backtrace with each warning or error message. This backtrace
1204 should help track down the cause of the error. The line numbers given
1205 in the backtrace may not always be correct: @code{gtroff} can get
1206 confused by @code{as} or @code{am} requests while counting line numbers.
1209 Read the standard input after all the named input files have been
1213 Enable warning @var{name}. Available warnings are described in
1214 @ref{Debugging}. Multiple @option{-w} options are allowed.
1217 Inhibit warning @var{name}. Multiple @option{-W} options are allowed.
1220 Inhibit all error messages.
1223 Enable compatibility mode. @xref{Implementation Differences}, for the
1224 list of incompatibilities between @code{groff} and @acronym{AT&T}
1227 @item -d@var{c}@var{s}
1228 @itemx -d@var{name}=@var{s}
1229 Define @var{c} or @var{name} to be a string@tie{}@var{s}. @var{c}@tie{}must
1230 be a one-letter name; @var{name} can be of arbitrary length. All string
1231 assignments happen before loading any macro file (including the start-up
1235 Use @var{fam} as the default font family. @xref{Font Families}.
1238 Read in the file @file{@var{name}.tmac}. Normally @code{groff} searches
1239 for this in its macro directories. If it isn't found, it tries
1240 @file{tmac.@var{name}} (searching in the same directories).
1243 Number the first page @var{num}.
1246 @cindex print current page register (@code{.P})
1247 Output only pages in @var{list}, which is a comma-separated list of page
1248 ranges; @samp{@var{n}} means print page@tie{}@var{n}, @samp{@var{m}-@var{n}}
1249 means print every page between @var{m} and@tie{}@var{n}, @samp{-@var{n}}
1250 means print every page up to@tie{}@var{n}, @samp{@var{n}-} means print every
1251 page beginning with@tie{}@var{n}. @code{gtroff} exits after printing the
1252 last page in the list. All the ranges are inclusive on both ends.
1254 Within @code{gtroff}, this information can be extracted with the
1255 @samp{.P} register. @xref{Built-in Registers}.
1257 If your document restarts page numbering at the beginning of each
1258 chapter, then @code{gtroff} prints the specified page range for each
1261 @item -r@var{c}@var{n}
1262 @itemx -r@var{name}=@var{n}
1263 Set number register@tie{}@var{c} or @var{name} to the value@tie{}@var{n}.
1264 @var{c}@tie{}must be a one-letter name; @var{name} can be of arbitrary
1265 length. @var{n}@tie{}can be any @code{gtroff} numeric expression. All
1266 register assignments happen before loading any macro file (including
1270 Search @file{@var{dir}} for subdirectories @file{dev@var{name}}
1271 (@var{name} is the name of the device), for the @file{DESC} file, and
1272 for font files before looking in the standard directories (@pxref{Font
1273 Directories}). This option is passed to all pre- and postprocessors
1274 using the @env{GROFF_FONT_PATH} environment variable.
1277 Search directory @file{@var{dir}} for macro files before the standard
1278 directories (@pxref{Macro Directories}).
1281 This option may be used to specify a directory to search for files.
1282 It is passed to the following programs:
1286 @code{gsoelim} (see @ref{gsoelim} for more details);
1287 it also implies @code{groff}'s @option{-s} option.
1290 @code{gtroff}; it is used to search files named in the @code{psbb} and
1294 @code{grops}; it is used to search files named in the
1295 @w{@code{\X'ps: import}} and @w{@code{\X'ps: file}} escapes.
1298 The current directory is always searched first. This option may be specified
1299 more than once; the directories will be searched in the order specified. No
1300 directory search is performed for files specified using an absolute path.
1304 @c =====================================================================
1306 @node Environment, Macro Directories, Groff Options, Invoking groff
1307 @section Environment
1308 @cindex environment variables
1309 @cindex variables in environment
1311 There are also several environment variables (of the operating system,
1312 not within @code{gtroff}) which can modify the behavior of @code{groff}.
1315 @item GROFF_COMMAND_PREFIX
1316 @tindex GROFF_COMMAND_PREFIX@r{, environment variable}
1317 @cindex command prefix
1318 @cindex prefix, for commands
1319 If this is set to@tie{}@var{X}, then @code{groff} runs @code{@var{X}troff}
1320 instead of @code{gtroff}. This also applies to @code{tbl}, @code{pic},
1321 @code{eqn}, @code{grn}, @code{refer}, and @code{soelim}. It does not
1322 apply to @code{grops}, @code{grodvi}, @code{grotty}, @code{pre-grohtml},
1323 @code{post-grohtml}, @code{grolj4}, and @code{gxditview}.
1325 The default command prefix is determined during the installation process.
1326 If a non-GNU troff system is found, prefix @samp{g} is used, none
1329 @item GROFF_TMAC_PATH
1330 @tindex GROFF_TMAC_PATH@r{, environment variable}
1331 A colon-separated list of directories in which to search for macro files
1332 (before the default directories are tried). @xref{Macro Directories}.
1334 @item GROFF_TYPESETTER
1335 @tindex GROFF_TYPESETTER@r{, environment variable}
1336 The default output device.
1338 @item GROFF_FONT_PATH
1339 @tindex GROFF_FONT_PATH@r{, environment variable}
1340 A colon-separated list of directories in which to search for the
1341 @code{dev}@var{name} directory (before the default directories are
1342 tried). @xref{Font Directories}.
1344 @item GROFF_BIN_PATH
1345 @tindex GROFF_BIN_PATH@r{, environment variable}
1346 This search path, followed by @code{PATH}, is used for commands executed
1350 @tindex GROFF_TMPDIR@r{, environment variable}
1351 @tindex TMPDIR@r{, environment variable}
1352 The directory in which @code{groff} creates temporary files. If this is
1353 not set and @env{TMPDIR} is set, temporary files are created in that
1354 directory. Otherwise temporary files are created in a system-dependent
1355 default directory (on Unix and GNU/Linux systems, this is usually
1356 @file{/tmp}). @code{grops}, @code{grefer}, @code{pre-grohtml}, and
1357 @code{post-grohtml} can create temporary files in this directory.
1360 Note that MS-DOS and MS-Windows ports of @code{groff} use semi-colons,
1361 rather than colons, to separate the directories in the lists described
1365 @c =====================================================================
1367 @node Macro Directories, Font Directories, Environment, Invoking groff
1368 @section Macro Directories
1369 @cindex macro directories
1370 @cindex directories for macros
1371 @cindex searching macros
1372 @cindex macros, searching
1374 All macro file names must be named @code{@var{name}.tmac} or
1375 @code{tmac.@var{name}} to make the @option{-m@var{name}} command line
1376 option work. The @code{mso} request doesn't have this restriction; any
1377 file name can be used, and @code{gtroff} won't try to append or prepend
1378 the @samp{tmac} string.
1380 @cindex tmac, directory
1381 @cindex directory, for tmac files
1383 @cindex path, for tmac files
1384 @cindex searching macro files
1385 @cindex macro files, searching
1386 @cindex files, macro, searching
1387 Macro files are kept in the @dfn{tmac directories}, all of which
1388 constitute the @dfn{tmac path}. The elements of the search path for
1389 macro files are (in that order):
1393 The directories specified with @code{gtroff}'s or @code{groff}'s
1394 @option{-M} command line option.
1397 @tindex GROFF_TMAC_PATH@r{, environment variable}
1398 The directories given in the @env{GROFF_TMAC_PATH} environment
1405 @cindex mode, unsafe
1406 @cindex current directory
1407 @cindex directory, current
1408 The current directory (only if in unsafe mode using the @option{-U}
1409 command line switch).
1412 @cindex home directory
1413 @cindex directory, home
1417 @cindex site-specific directory
1418 @cindex directory, site-specific
1419 @cindex platform-specific directory
1420 @cindex directory, platform-specific
1421 A platform-dependent directory, a site-specific (platform-independent)
1422 directory, and the main tmac directory; the default locations are
1425 /usr/local/lib/groff/site-tmac
1426 /usr/local/share/groff/site-tmac
1427 /usr/local/share/groff/1.18.2/tmac
1431 assuming that the version of @code{groff} is 1.18.2, and the installation
1432 prefix was @file{/usr/local}. It is possible to fine-tune those
1433 directories during the installation process.
1437 @c =====================================================================
1439 @node Font Directories, Paper Size, Macro Directories, Invoking groff
1440 @section Font Directories
1441 @cindex font directories
1442 @cindex directories for fonts
1443 @cindex searching fonts
1444 @cindex fonts, searching
1446 Basically, there is no restriction how font files for @code{groff} are
1447 named and how long font names are; however, to make the font family
1448 mechanism work (@pxref{Font Families}), fonts within a family should
1449 start with the family name, followed by the shape. For example, the
1450 Times family uses @samp{T} for the family name and @samp{R}, @samp{B},
1451 @samp{I}, and @samp{BI} to indicate the shapes `roman', `bold',
1452 `italic', and `bold italic', respectively. Thus the final font names
1453 are @samp{TR}, @samp{TB}, @samp{TI}, and @samp{TBI}.
1456 @cindex path, for font files
1457 All font files are kept in the @dfn{font directories} which constitute
1458 the @dfn{font path}. The file search functions will always append the
1459 directory @code{dev}@var{name}, where @var{name} is the name of the
1460 output device. Assuming, say, DVI output, and @file{/foo/bar} as a
1461 font directory, the font files for @code{grodvi} must be in
1462 @file{/foo/bar/devdvi}.
1464 The elements of the search path for font files are (in that order):
1468 The directories specified with @code{gtroff}'s or @code{groff}'s
1469 @option{-F} command line option. All device drivers and some
1470 preprocessors also have this option.
1473 @tindex GROFF_FONT_PATH@r{, environment variable}
1474 The directories given in the @env{GROFF_FONT_PATH} environment
1478 @cindex site-specific directory
1479 @cindex directory, site-specific
1480 A site-specific directory and the main font directory; the default
1484 /usr/local/share/groff/site-font
1485 /usr/local/share/groff/1.18.2/font
1489 assuming that the version of @code{groff} is 1.18.2, and the installation
1490 prefix was @file{/usr/local}. It is possible to fine-tune those
1491 directories during the installation process.
1495 @c =====================================================================
1497 @node Paper Size, Invocation Examples, Font Directories, Invoking groff
1501 @cindex landscape page orientation
1502 @cindex orientation, landscape
1503 @cindex page orientation, landscape
1505 In groff, the page size for @code{gtroff} and for output devices are
1506 handled separately. @xref{Page Layout}, for vertical manipulation of
1507 the page size. @xref{Line Layout}, for horizontal changes.
1509 A default paper size can be set in the device's @file{DESC} file. Most
1510 output devices also have a command line option @option{-p} to override
1511 the default paper size and option @option{-l} to use landscape
1512 orientation. @xref{DESC File Format}, for a description of the
1513 @code{papersize} keyword which takes the same argument as @option{-p}.
1515 @pindex papersize.tmac
1517 A convenient shorthand to set a particular paper size for @code{gtroff}
1518 is command line option @option{-dpaper=@var{size}}. This defines string
1519 @code{paper} which is processed in file @file{papersize.tmac} (loaded in
1520 the start-up file @file{troffrc} by default). Possible values for
1521 @var{size} are the same as the predefined values for the
1522 @code{papersize} keyword (but only in lowercase) except
1523 @code{a7}-@code{d7}. An appended @samp{l} (ell) character denotes
1524 landscape orientation.
1526 For example, use the following for PS output on A4 paper in landscape
1530 groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
1533 Note that it is up to the particular macro package to respect default
1534 page dimensions set in this way (most do).
1537 @c =====================================================================
1539 @node Invocation Examples, , Paper Size, Invoking groff
1540 @section Invocation Examples
1541 @cindex invocation examples
1542 @cindex examples of invocation
1544 This section lists several common uses of @code{groff} and the
1545 corresponding command lines.
1552 This command processes @file{file} without a macro package or a
1553 preprocessor. The output device is the default, @samp{ps}, and the
1554 output is sent to @code{stdout}.
1557 groff -t -mandoc -Tascii file | less
1561 This is basically what a call to the @code{man} program does.
1562 @code{gtroff} processes the manual page @file{file} with the
1563 @file{mandoc} macro file (which in turn either calls the @file{man} or
1564 the @file{mdoc} macro package), using the @code{tbl} preprocessor and
1565 the @acronym{ASCII} output device. Finally, the @code{less} pager
1566 displays the result.
1573 Preview @file{file} with @code{gxditview}, using the @file{me} macro
1574 package. Since no @option{-T} option is specified, use the default
1575 device (@samp{ps}). Note that you can either say @w{@samp{-m me}} or
1576 @w{@samp{-me}}; the latter is an anachronism from the early days of
1577 @acronym{UNIX}.@footnote{The same is true for the other main macro
1578 packages that come with @code{groff}: @file{man}, @file{mdoc},
1579 @file{ms}, @file{mm}, and @file{mandoc}. This won't work in general;
1580 for example, to load @file{trace.tmac}, either @samp{-mtrace} or
1581 @w{@samp{-m trace}} must be used.}
1584 groff -man -rD1 -z file
1588 Check @file{file} with the @file{man} macro package, forcing
1589 double-sided printing -- don't produce any output.
1595 @c ---------------------------------------------------------------------
1597 @node grog, , Invocation Examples, Invocation Examples
1598 @subsection @code{grog}
1601 @code{grog} reads files, guesses which of the @code{groff} preprocessors
1602 and/or macro packages are required for formatting them, and prints the
1603 @code{groff} command including those options on the standard output. It
1604 generates one or more of the options @option{-e}, @option{-man},
1605 @option{-me}, @option{-mm}, @option{-mom}, @option{-ms}, @option{-mdoc},
1606 @option{-mdoc-old}, @option{-p}, @option{-R}, @option{-g}, @option{-G},
1607 @option{-s}, and @option{-t}.
1609 A special file name@tie{}@file{-} refers to the standard input. Specifying
1610 no files also means to read the standard input. Any specified options
1611 are included in the printed command. No space is allowed between
1612 options and their arguments. The only options recognized are
1613 @option{-C} (which is also passed on) to enable compatibility mode, and
1614 @option{-v} to print the version number and exit.
1623 guesses the appropriate command to print @file{paper.ms} and then prints
1624 it to the command line after adding the @option{-Tdvi} option. For
1625 direct execution, enclose the call to @code{grog} in backquotes at the
1626 @acronym{UNIX} shell prompt:
1629 `grog -Tdvi paper.ms` > paper.dvi
1633 As seen in the example, it is still necessary to redirect the output to
1634 something meaningful (i.e.@: either a file or a pager program like
1639 @c =====================================================================
1640 @c =====================================================================
1642 @node Tutorial for Macro Users, Macro Packages, Invoking groff, Top
1643 @chapter Tutorial for Macro Users
1644 @cindex tutorial for macro users
1645 @cindex macros, tutorial for users
1646 @cindex user's tutorial for macros
1647 @cindex user's macro tutorial
1649 Most users tend to use a macro package to format their papers. This
1650 means that the whole breadth of @code{groff} is not necessary for most
1651 people. This chapter covers the material needed to efficiently use a
1660 @c =====================================================================
1662 @node Basics, Common Features, Tutorial for Macro Users, Tutorial for Macro Users
1664 @cindex basics of macros
1665 @cindex macro basics
1667 This section covers some of the basic concepts necessary to understand
1668 how to use a macro package.@footnote{This section is derived from
1669 @cite{Writing Papers with nroff using -me} by Eric P.@tie{}Allman.}
1670 References are made throughout to more detailed information, if desired.
1672 @code{gtroff} reads an input file prepared by the user and outputs a
1673 formatted document suitable for publication or framing. The input
1674 consists of text, or words to be printed, and embedded commands
1675 (@dfn{requests} and @dfn{escapes}), which tell @code{gtroff} how to
1676 format the output. For more detail on this, see @ref{Embedded
1679 The word @dfn{argument} is used in this chapter to mean a word or number
1680 which appears on the same line as a request, and which modifies the
1681 meaning of that request. For example, the request
1688 spaces one line, but
1695 spaces four lines. The number@tie{}4 is an argument to the @code{sp}
1696 request which says to space four lines instead of one. Arguments are
1697 separated from the request and from each other by spaces (@emph{no}
1698 tabs). More details on this can be found in @ref{Request and Macro
1701 The primary function of @code{gtroff} is to collect words from input
1702 lines, fill output lines with those words, justify the right-hand margin
1703 by inserting extra spaces in the line, and output the result. For
1711 Four score and seven
1716 is read, packed onto output lines, and justified to produce:
1719 Now is the time for all good men to come to the aid of their party.
1720 Four score and seven years ago, etc.
1725 Sometimes a new output line should be started even though the current
1726 line is not yet full; for example, at the end of a paragraph. To do
1727 this it is possible to cause a @dfn{break}, which starts a new output
1728 line. Some requests cause a break automatically, as normally do blank
1729 input lines and input lines beginning with a space.
1731 Not all input lines are text to be formatted. Some input lines are
1732 requests which describe how to format the text. Requests always have a
1733 period (@samp{.}) or an apostrophe (@samp{'}) as the first character of
1736 The text formatter also does more complex things, such as automatically
1737 numbering pages, skipping over page boundaries, putting footnotes in the
1738 correct place, and so forth.
1740 Here are a few hints for preparing text for input to @code{gtroff}.
1744 First, keep the input lines short. Short input lines are easier to
1745 edit, and @code{gtroff} packs words onto longer lines anyhow.
1748 In keeping with this, it is helpful to begin a new line after every
1749 comma or phrase, since common corrections are to add or delete sentences
1753 End each sentence with two spaces -- or better, start each sentence on a
1754 new line. @code{gtroff} recognizes characters that usually end a
1755 sentence, and inserts sentence space accordingly.
1758 Do not hyphenate words at the end of lines -- @code{gtroff} is smart
1759 enough to hyphenate words as needed, but is not smart enough to take
1760 hyphens out and join a word back together. Also, words such as
1761 ``mother-in-law'' should not be broken over a line, since then a space
1762 can occur where not wanted, such as ``@w{mother- in}-law''.
1765 @cindex double-spacing (@code{ls})
1767 @code{gtroff} double-spaces output text automatically if you use the
1768 request @w{@samp{.ls 2}}. Reactivate single-spaced mode by typing
1769 @w{@samp{.ls 1}}.@footnote{If you need finer granularity of the
1770 vertical space, use the @code{pvs} request (@pxref{Changing Type
1773 A number of requests allow to change the way the output looks,
1774 sometimes called the @dfn{layout} of the output page. Most of these
1775 requests adjust the placing of @dfn{whitespace} (blank lines or
1778 @cindex new page (@code{bp})
1779 The @code{bp} request starts a new page, causing a line break.
1781 @cindex blank line (@code{sp})
1782 @cindex empty line (@code{sp})
1783 @cindex line, empty (@code{sp})
1784 The request @w{@samp{.sp @var{N}}} leaves @var{N}@tie{}lines of blank
1785 space. @var{N}@tie{}can be omitted (meaning skip a single line) or can
1786 be of the form @var{N}i (for @var{N}@tie{}inches) or @var{N}c (for
1787 @var{N}@tie{}centimeters). For example, the input:
1791 My thoughts on the subject
1796 leaves one and a half inches of space, followed by the line ``My
1797 thoughts on the subject'', followed by a single blank line (more
1798 measurement units are available, see @ref{Measurements}).
1800 @cindex centering lines (@code{ce})
1801 @cindex lines, centering (@code{ce})
1802 Text lines can be centered by using the @code{ce} request. The line
1803 after @code{ce} is centered (horizontally) on the page. To center more
1804 than one line, use @w{@samp{.ce @var{N}}} (where @var{N} is the number
1805 of lines to center), followed by the @var{N}@tie{}lines. To center many
1806 lines without counting them, type:
1815 The @w{@samp{.ce 0}} request tells @code{groff} to center zero more
1816 lines, in other words, stop centering.
1818 @cindex line break (@code{br})
1819 @cindex break (@code{br})
1820 All of these requests cause a break; that is, they always start a new
1821 line. To start a new line without performing any other action, use
1825 @c =====================================================================
1827 @node Common Features, , Basics, Tutorial for Macro Users
1828 @section Common Features
1829 @cindex common features
1830 @cindex features, common
1832 @code{gtroff} provides very low-level operations for formatting a
1833 document. There are many common routine operations which are done in
1834 all documents. These common operations are written into @dfn{macros}
1835 and collected into a @dfn{macro package}.
1837 All macro packages provide certain common capabilities which fall into
1838 the following categories.
1842 * Sections and Chapters::
1843 * Headers and Footers::
1844 * Page Layout Adjustment::
1846 * Footnotes and Annotations::
1847 * Table of Contents::
1850 * Multiple Columns::
1851 * Font and Size Changes::
1852 * Predefined Strings::
1853 * Preprocessor Support::
1854 * Configuration and Customization::
1857 @c ---------------------------------------------------------------------
1859 @node Paragraphs, Sections and Chapters, Common Features, Common Features
1860 @subsection Paragraphs
1863 One of the most common and most used capability is starting a
1864 paragraph. There are a number of different types of paragraphs, any
1865 of which can be initiated with macros supplied by the macro package.
1866 Normally, paragraphs start with a blank line and the first line
1867 indented, like the text in this manual. There are also block style
1868 paragraphs, which omit the indentation:
1871 Some men look at constitutions with sanctimonious
1872 reverence, and deem them like the ark of the covenant, too
1873 sacred to be touched.
1877 And there are also indented paragraphs which begin with a tag or label
1878 at the margin and the remaining text indented.
1881 one This is the first paragraph. Notice how the first
1882 line of the resulting paragraph lines up with the
1883 other lines in the paragraph.
1887 This paragraph had a long label. The first
1888 character of text on the first line does not line up
1889 with the text on second and subsequent lines,
1890 although they line up with each other.
1893 A variation of this is a bulleted list.
1896 . Bulleted lists start with a bullet. It is possible
1897 to use other glyphs instead of the bullet. In nroff
1898 mode using the ASCII character set for output, a dot
1899 is used instead of a real bullet.
1902 @c ---------------------------------------------------------------------
1904 @node Sections and Chapters, Headers and Footers, Paragraphs, Common Features
1905 @subsection Sections and Chapters
1907 Most macro packages supply some form of section headers. The simplest
1908 kind is simply the heading on a line by itself in bold type. Others
1909 supply automatically numbered section heading or different heading
1910 styles at different levels. Some, more sophisticated, macro packages
1911 supply macros for starting chapters and appendices.
1913 @c ---------------------------------------------------------------------
1915 @node Headers and Footers, Page Layout Adjustment, Sections and Chapters, Common Features
1916 @subsection Headers and Footers
1918 Every macro package gives some way to manipulate the @dfn{headers} and
1919 @dfn{footers} (also called @dfn{titles}) on each page. This is text
1920 put at the top and bottom of each page, respectively, which contain
1921 data like the current page number, the current chapter title, and so
1922 on. Its appearance is not affected by the running text. Some packages
1923 allow for different ones on the even and odd pages (for material printed
1926 The titles are called @dfn{three-part titles}, that is, there is a
1927 left-justified part, a centered part, and a right-justified part. An
1928 automatically generated page number may be put in any of these fields
1929 with the @samp{%} character (see @ref{Page Layout}, for more details).
1931 @c ---------------------------------------------------------------------
1933 @node Page Layout Adjustment, Displays, Headers and Footers, Common Features
1934 @subsection Page Layout
1936 Most macro packages let the user specify top and bottom margins and
1937 other details about the appearance of the printed pages.
1939 @c ---------------------------------------------------------------------
1941 @node Displays, Footnotes and Annotations, Page Layout Adjustment, Common Features
1942 @subsection Displays
1945 @dfn{Displays} are sections of text to be set off from the body of
1946 the paper. Major quotes, tables, and figures are types of displays, as
1947 are all the examples used in this document.
1949 @cindex quotes, major
1950 @cindex major quotes
1951 @dfn{Major quotes} are quotes which are several lines long, and hence
1952 are set in from the rest of the text without quote marks around them.
1955 A @dfn{list} is an indented, single-spaced, unfilled display. Lists
1956 should be used when the material to be printed should not be filled and
1957 justified like normal text, such as columns of figures or the examples
1961 A @dfn{keep} is a display of lines which are kept on a single page if
1962 possible. An example for a keep might be a diagram. Keeps differ from
1963 lists in that lists may be broken over a page boundary whereas keeps are
1966 @cindex keep, floating
1967 @cindex floating keep
1968 @dfn{Floating keeps} move relative to the text. Hence, they are good for
1969 things which are referred to by name, such as ``See figure@tie{}3''. A
1970 floating keep appears at the bottom of the current page if it fits;
1971 otherwise, it appears at the top of the next page. Meanwhile, the
1972 surrounding text `flows' around the keep, thus leaving no blank areas.
1974 @c ---------------------------------------------------------------------
1976 @node Footnotes and Annotations, Table of Contents, Displays, Common Features
1977 @subsection Footnotes and Annotations
1981 There are a number of requests to save text for later printing.
1983 @dfn{Footnotes} are printed at the bottom of the current page.
1985 @cindex delayed text
1986 @dfn{Delayed text} is very similar to a footnote except that it is
1987 printed when called for explicitly. This allows a list of references to
1988 appear (for example) at the end of each chapter, as is the convention in
1991 Most macro packages which supply this functionality also supply a means
1992 of automatically numbering either type of annotation.
1994 @c ---------------------------------------------------------------------
1996 @node Table of Contents, Indices, Footnotes and Annotations, Common Features
1997 @subsection Table of Contents
1998 @cindex table of contents
1999 @cindex contents, table of
2001 @dfn{Tables of contents} are a type of delayed text having a tag
2002 (usually the page number) attached to each entry after a row of dots.
2003 The table accumulates throughout the paper until printed, usually after
2004 the paper has ended. Many macro packages provide the ability to have
2005 several tables of contents (e.g.@: a standard table of contents, a list
2008 @c ---------------------------------------------------------------------
2010 @node Indices, Paper Formats, Table of Contents, Common Features
2012 @cindex index, in macro package
2014 While some macro packages use the term @dfn{index}, none actually
2015 provide that functionality. The facilities they call indices are
2016 actually more appropriate for tables of contents.
2019 To produce a real index in a document, external tools like the
2020 @code{makeindex} program are necessary.
2022 @c ---------------------------------------------------------------------
2024 @node Paper Formats, Multiple Columns, Indices, Common Features
2025 @subsection Paper Formats
2026 @cindex paper formats
2028 Some macro packages provide stock formats for various kinds of
2029 documents. Many of them provide a common format for the title and
2030 opening pages of a technical paper. The @file{mm} macros in particular
2031 provide formats for letters and memoranda.
2033 @c ---------------------------------------------------------------------
2035 @node Multiple Columns, Font and Size Changes, Paper Formats, Common Features
2036 @subsection Multiple Columns
2038 Some macro packages (but not @file{man}) provide the ability to have two
2039 or more columns on a page.
2041 @c ---------------------------------------------------------------------
2043 @node Font and Size Changes, Predefined Strings, Multiple Columns, Common Features
2044 @subsection Font and Size Changes
2046 The built-in font and size functions are not always intuitive, so all
2047 macro packages provide macros to make these operations simpler.
2049 @c ---------------------------------------------------------------------
2051 @node Predefined Strings, Preprocessor Support, Font and Size Changes, Common Features
2052 @subsection Predefined Strings
2054 Most macro packages provide various predefined strings for a variety of
2055 uses; examples are sub- and superscripts, printable dates, quotes and
2056 various special characters.
2058 @c ---------------------------------------------------------------------
2060 @node Preprocessor Support, Configuration and Customization, Predefined Strings, Common Features
2061 @subsection Preprocessor Support
2063 All macro packages provide support for various preprocessors and may
2064 extend their functionality.
2066 For example, all macro packages mark tables (which are processed with
2067 @code{gtbl}) by placing them between @code{TS} and @code{TE} macros.
2068 The @file{ms} macro package has an option, @samp{.TS@tie{}H}, that prints
2069 a caption at the top of a new page (when the table is too long to fit on
2072 @c ---------------------------------------------------------------------
2074 @node Configuration and Customization, , Preprocessor Support, Common Features
2075 @subsection Configuration and Customization
2077 Some macro packages provide means of customizing many of the details of
2078 how the package behaves. This ranges from setting the default type size
2079 to changing the appearance of section headers.
2083 @c =====================================================================
2084 @c =====================================================================
2086 @node Macro Packages, gtroff Reference, Tutorial for Macro Users, Top
2087 @chapter Macro Packages
2088 @cindex macro packages
2089 @cindex packages, macros
2091 This chapter documents the main macro packages that come with
2094 Different main macro packages can't be used at the same time; for example
2097 groff -m man foo.man -m ms bar.doc
2101 doesn't work. Note that option arguments are processed before non-option
2102 arguments; the above (failing) sample is thus reordered to
2105 groff -m man -m ms foo.man bar.doc
2117 @c =====================================================================
2119 @node man, mdoc, Macro Packages, Macro Packages
2121 @cindex manual pages
2125 @pindex man-old.tmac
2127 This is the most popular and probably the most important macro package
2128 of @code{groff}. It is easy to use, and a vast majority of manual pages
2135 * Miscellaneous man macros::
2136 * Predefined man strings::
2137 * Preprocessors in man pages::
2138 * Optional man extensions::
2141 @c ---------------------------------------------------------------------
2143 @node Man options, Man usage, man, man
2146 The command line format for using the @file{man} macros with
2150 groff -m man [ -rLL=@var{length} ] [ -rLT=@var{length} ] [ -rFT=@var{dist} ]
2151 [ -rcR=1 ] [ -rC1 ] [ -rD1 ] [-rHY=@var{flags} ]
2152 [ -rP@var{nnn} ] [ -rS@var{xx} ] [ -rX@var{nnn} ]
2153 [ -rIN=@var{length} ] [ -rSN=@var{length} ] [ @var{files}@dots{} ]
2157 It is possible to use @samp{-man} instead of @w{@samp{-m man}}.
2161 This option (the default if a TTY output device is used) creates a
2162 single, very long page instead of multiple pages. Use @code{-rcR=0}
2166 If more than one manual page is given on the command line, number the
2167 pages continuously, rather than starting each at@tie{}1.
2170 Double-sided printing. Footers for even and odd pages are formatted
2173 @item -rFT=@var{dist}
2174 Set the position of the footer text to @var{dist}. If positive, the
2175 distance is measured relative to the top of the page, otherwise it is
2176 relative to the bottom. The default is @minus{}0.5@dmn{i}.
2178 @item -rHY=@var{flags}
2179 Set hyphenation flags. Possible values are 1@tie{}to hyphenate without
2180 restrictions, 2@tie{} to not hyphenate the last word on a page,
2181 4@tie{}to not hyphenate the last two characters of a word, and
2182 8@tie{}to not hyphenate the first two characters of a word. These
2183 values are additive; the default is@tie{}14.
2185 @item -rIN=@var{length}
2186 Set the body text indentation to @var{length}.
2187 If not specified, the indentation defaults to 7@dmn{n}
2188 (7@tie{}characters) in nroff mode and 7.2@dmn{n} otherwise.
2189 For nroff, this value should always be an integer multiple of unit @samp{n}
2190 to get consistent indentation.
2192 @item -rLL=@var{length}
2193 Set line length to @var{length}. If not specified, the line length
2194 is set to respect any value set by a prior @samp{ll} request (which
2195 @emph{must} be in effect when the @samp{TH} macro is invoked), if
2196 this differs from the built-in default for the formatter; otherwise it
2197 defaults to 78@dmn{n} in nroff mode (this is 78 characters per
2198 line) and 6.5@dmn{i} in troff mode.@footnote{Note that the use of
2199 a @samp{.ll @var{length}} request to initialize the line length, prior
2200 to use of the @samp{TH} macro, is supported for backward compatibility
2201 with some versions of the @code{man} program. @emph{Always} use the
2202 @option{-rLL=@var{length}} option, or an equivalent @samp{.nr LL @var{length}}
2203 request, in preference to such a @samp{.ll @var{length}} request.
2204 In particular, note that in nroff mode, the request @samp{.ll 65n},
2205 (with any @var{length} expression which evaluates equal to 65@dmn{n},
2206 i.e., the formatter's default line length in nroff mode), will @emph{not}
2207 set the line length to 65@dmn{n} (it will be adjusted to the @code{man}
2208 macro package's default setting of 78@dmn{n}), whereas the use of the
2209 @option{-rLL=65n} option, or the @samp{.nr LL 65n}
2210 request @emph{will} establish a line length of 65@dmn{n}.}
2212 @item -rLT=@var{length}
2213 Set title length to @var{length}. If not specified, the title length
2214 defaults to the line length.
2217 Page numbering starts with @var{nnn} rather than with@tie{}1.
2220 Use @var{xx} (which can be 10, 11, or@tie{}12@dmn{pt}) as the base
2221 document font size instead of the default value of@tie{}10@dmn{pt}.
2223 @item -rSN=@var{length}
2224 Set the indentation for sub-subheadings to @var{length}.
2225 If not specified, the indentation defaults to 3@dmn{n}.
2228 After page @var{nnn}, number pages as @var{nnn}a, @var{nnn}b,
2229 @var{nnn}c, etc. For example, the option @option{-rX2} produces the
2230 following page numbers: 1, 2, 2a, 2b, 2c, etc.
2233 @c ---------------------------------------------------------------------
2235 @node Man usage, Man font macros, Man options, man
2237 @cindex @code{man} macros
2238 @cindex macros for manual pages [@code{man}]
2241 This section describes the available macros for manual pages. For
2242 further customization, put additional macros and requests into the file
2243 @file{man.local} which is loaded immediately after the @file{man}
2246 @Defmac {TH, title section [@Var{extra1} [@Var{extra2} [@Var{extra3}]]], man}
2247 Set the title of the man page to @var{title} and the section to
2248 @var{section}, which must have a value between 1 and@tie{}8. The value
2249 of @var{section} may also have a string appended, e.g.@: @samp{.pm},
2250 to indicate a specific subsection of the man pages.
2252 Both @var{title} and @var{section} are positioned at the left and right
2253 in the header line (with @var{section} in parentheses immediately
2254 appended to @var{title}. @var{extra1} is positioned in the middle of
2255 the footer line. @var{extra2} is positioned at the left in the footer
2256 line (or at the left on even pages and at the right on odd pages if
2257 double-sided printing is active). @var{extra3} is centered in the
2260 For @acronym{HTML} output, headers and footers are completely suppressed.
2262 Additionally, this macro starts a new page; the new line number is@tie{}1
2263 again (except if the @option{-rC1} option is given on the command line)
2264 -- this feature is intended only for formatting multiple man pages; a
2265 single man page should contain exactly one @code{TH} macro at the
2266 beginning of the file.
2269 @Defmac {SH, [@Var{heading}], man}
2270 Set up an unnumbered section heading sticking out to the left. Prints
2271 out all the text following @code{SH} up to the end of the line (or the
2272 text in the next line if there is no argument to @code{SH}) in bold
2273 face (or the font specified by the string @code{HF}), one size larger than
2274 the base document size. Additionally, the left margin and the indentation
2275 for the following text is reset to its default value.
2278 @Defmac {SS, [@Var{heading}], man}
2279 Set up an unnumbered (sub)section heading. Prints out all the text
2280 following @code{SS} up to the end of the line (or the text in the next
2281 line if there is no argument to @code{SS}) in bold face (or the font
2282 specified by the string @code{HF}), at the same size as the base document
2283 size. Additionally, the left margin and the indentation for the
2284 following text is reset to its default value.
2287 @Defmac {TP, [@Var{nnn}], man}
2288 Set up an indented paragraph with label. The indentation is set to
2289 @var{nnn} if that argument is supplied (the default unit is @samp{n}
2290 if omitted), otherwise it is set to the previous indentation value
2291 specified with @code{TP}, @code{IP}, or @code{HP} (or to the default
2292 value if none of them have been used yet).
2294 The first line of text following this macro is interpreted as a string
2295 to be printed flush-left, as it is appropriate for a label. It is not
2296 interpreted as part of a paragraph, so there is no attempt to fill the
2297 first line with text from the following input lines. Nevertheless, if
2298 the label is not as wide as the indentation the paragraph starts
2299 at the same line (but indented), continuing on the following lines.
2300 If the label is wider than the indentation the descriptive part
2301 of the paragraph begins on the line following the label, entirely
2302 indented. Note that neither font shape nor font size of the label is
2303 set to a default value; on the other hand, the rest of the text has
2304 default font settings.
2307 @DefmacList {LP, , man}
2308 @DefmacItem {PP, , man}
2309 @DefmacListEnd {P, , man}
2310 These macros are mutual aliases. Any of them causes a line break at
2311 the current position, followed by a vertical space downwards by the
2312 amount specified by the @code{PD} macro. The font size and shape are
2313 reset to the default value (10@dmn{pt} roman if no @option{-rS} option
2314 is given on the command line). Finally, the current left margin and the
2315 indentation is restored.
2318 @Defmac {IP, [@Var{designator} [@Var{nnn}]], man}
2319 Set up an indented paragraph, using @var{designator} as a tag to mark
2320 its beginning. The indentation is set to @var{nnn} if that argument
2321 is supplied (default unit is @samp{n}), otherwise it is set to the
2322 previous indentation value specified with @code{TP}, @code{IP}, or
2323 @code{HP} (or the default value if none of them have been used yet).
2324 Font size and face of the paragraph (but not the designator) are reset
2325 to their default values.
2327 To start an indented paragraph with a particular indentation but without
2328 a designator, use @samp{""} (two double quotes) as the first argument of
2331 For example, to start a paragraph with bullets as the designator and
2332 4@tie{}en indentation, write
2339 @Defmac {HP, [@Var{nnn}], man}
2340 @cindex hanging indentation [@code{man}]
2341 @cindex @code{man} macros, hanging indentation
2342 Set up a paragraph with hanging left indentation. The indentation is
2343 set to @var{nnn} if that argument is supplied (default unit is
2344 @samp{n}), otherwise it is set to the previous indentation value
2345 specified with @code{TP}, @code{IP}, or @code{HP} (or the default
2346 value if non of them have been used yet). Font size and face are reset
2347 to their default values.
2350 @Defmac {RS, [@Var{nnn}], man}
2351 @cindex left margin, how to move [@code{man}]
2352 @cindex @code{man} macros, moving left margin
2353 Move the left margin to the right by the value @var{nnn} if specified
2354 (default unit is @samp{n}); otherwise it is set to the previous
2355 indentation value specified with @code{TP}, @code{IP}, or @code{HP}
2356 (or to the default value if none of them have been used yet). The
2357 indentation value is then set to the default.
2359 Calls to the @code{RS} macro can be nested.
2362 @Defmac {RE, [@Var{nnn}], man}
2363 Move the left margin back to level @var{nnn}, restoring the previous left
2364 margin. If no argument is given, it moves one level back. The first
2365 level (i.e., no call to @code{RS} yet) has number@tie{}1, and each call
2366 to @code{RS} increases the level by@tie{}1.
2369 @cindex line breaks, with vertical space [@code{man}]
2370 @cindex @code{man} macros, line breaks with vertical space
2371 To summarize, the following macros cause a line break with the insertion
2372 of vertical space (which amount can be changed with the @code{PD}
2373 macro): @code{SH}, @code{SS}, @code{TP}, @code{LP} (@code{PP},
2374 @code{P}), @code{IP}, and @code{HP}.
2376 @cindex line breaks, without vertical space [@code{man}]
2377 @cindex @code{man} macros, line breaks without vertical space
2378 The macros @code{RS} and @code{RE} also cause a break but do not insert
2381 @cindex default indentation, resetting [@code{man}]
2382 @cindex indentaion, resetting to default [@code{man}]
2383 @cindex @code{man} macros, resetting default indentation
2384 Finally, the macros @code{SH}, @code{SS}, @code{LP} (@code{PP}, @code{P}),
2385 and @code{RS} reset the indentation to its default value.
2387 @c ---------------------------------------------------------------------
2389 @node Man font macros, Miscellaneous man macros, Man usage, man
2390 @subsection Macros to set fonts
2391 @cindex font selection [@code{man}]
2392 @cindex @code{man} macros, how to set fonts
2394 The standard font is roman; the default text size is 10@tie{}point.
2395 If command line option @option{-rS=@var{n}} is given, use
2396 @var{n}@dmn{pt} as the default text size.
2398 @Defmac {SM, [@Var{text}], man}
2399 Set the text on the same line or the text on the next line in a font
2400 that is one point size smaller than the default font.
2403 @Defmac {SB, [@Var{text}], man}
2404 @cindex bold face [@code{man}]
2405 @cindex @code{man} macros, bold face
2406 Set the text on the same line or the text on the next line in bold face
2407 font, one point size smaller than the default font.
2410 @Defmac {BI, text, man}
2411 Set its arguments alternately in bold face and italic, without a space
2412 between the arguments. Thus,
2415 .BI this "word and" that
2419 produces ``thisword andthat'' with ``this'' and ``that'' in bold face,
2420 and ``word and'' in italics.
2423 @Defmac {IB, text, man}
2424 Set its arguments alternately in italic and bold face, without a space
2425 between the arguments.
2428 @Defmac {RI, text, man}
2429 Set its arguments alternately in roman and italic, without a space between
2433 @Defmac {IR, text, man}
2434 Set its arguments alternately in italic and roman, without a space between
2438 @Defmac {BR, text, man}
2439 Set its arguments alternately in bold face and roman, without a space
2440 between the arguments.
2443 @Defmac {RB, text, man}
2444 Set its arguments alternately in roman and bold face, without a space
2445 between the arguments.
2448 @Defmac {B, [@Var{text}], man}
2449 Set @var{text} in bold face. If no text is present on the line where
2450 the macro is called, then the text of the next line appears in bold
2454 @Defmac {I, [@Var{text}], man}
2455 @cindex italic fonts [@code{man}]
2456 @cindex @code{man} macros, italic fonts
2457 Set @var{text} in italic. If no text is present on the line where the
2458 macro is called, then the text of the next line appears in italic.
2461 @c ---------------------------------------------------------------------
2463 @node Miscellaneous man macros, Predefined man strings, Man font macros, man
2464 @subsection Miscellaneous macros
2467 @cindex @code{man} macros, default indentation
2468 @cindex default indentation [@code{man}]
2469 The default indentation is 7.2@dmn{n} in troff mode and 7@dmn{n} in
2470 nroff mode except for @code{grohtml} which ignores indentation.
2473 @cindex tab stops [@code{man}]
2474 @cindex @code{man} macros, tab stops
2475 Set tabs every 0.5@tie{}inches. Since this macro is always executed
2476 during a call to the @code{TH} macro, it makes sense to call it only if
2477 the tab positions have been changed.
2480 @Defmac {PD, [@Var{nnn}], man}
2481 @cindex empty space before a paragraph [@code{man}]
2482 @cindex @code{man} macros, empty space before a paragraph
2483 Adjust the empty space before a new paragraph (or section). The
2484 optional argument gives the amount of space (default unit is
2485 @samp{v}); without parameter, the value is reset to its default value
2486 (1@tie{}line in nroff mode, 0.4@dmn{v}@tie{}otherwise).
2488 This affects the macros @code{SH}, @code{SS}, @code{TP}, @code{LP} (as
2489 well as @code{PP} and @code{P}), @code{IP}, and @code{HP}.
2492 The following two macros are included for
2495 @Defmac {AT, [@Var{system} [@Var{release}]], man}
2496 @cindex @code{man}macros, BSD compatibility
2497 Alter the footer for use with @acronym{AT&T} manpages.
2498 This command exists only for compatibility; don't use it.
2499 The first argument @var{system} can be:
2503 7th Edition (the default)
2512 An optional second argument @var{release} to @code{AT} specifies the
2513 release number (such as ``System V Release 3'').
2516 @Defmac {UC, [@Var{version}], man}
2517 @cindex @code{man}macros, BSD compatibility
2518 Alters the footer for use with @acronym{BSD} manpages.
2519 This command exists only for compatibility; don't use it.
2520 The argument can be:
2524 3rd Berkeley Distribution (the default)
2527 4th Berkeley Distribution
2530 4.2 Berkeley Distribution
2533 4.3 Berkeley Distribution
2536 4.4 Berkeley Distribution
2540 @c ---------------------------------------------------------------------
2542 @node Predefined man strings, Preprocessors in man pages, Miscellaneous man macros, man
2543 @subsection Predefined strings
2545 The following strings are defined:
2548 Switch back to the default font size.
2552 The typeface used for headings.
2553 The default is @samp{B}.
2557 The `registered' sign.
2561 The `trademark' sign.
2564 @DefstrList {lq, man}
2565 @DefstrListEnd {rq, man}
2566 @cindex @code{lq} glyph, and @code{lq} string [@code{man}]
2567 @cindex @code{rq} glyph, and @code{rq} string [@code{man}]
2568 Left and right quote. This is equal to @code{\(lq} and @code{\(rq},
2572 @c ---------------------------------------------------------------------
2574 @node Preprocessors in man pages, Optional man extensions, Predefined man strings, man
2575 @subsection Preprocessors in @file{man} pages
2577 @cindex preprocessor, calling convention
2578 @cindex calling convention of preprocessors
2579 If a preprocessor like @code{gtbl} or @code{geqn} is needed, it has
2580 become common usage to make the first line of the man page look like
2587 @pindex geqn@r{, invocation in manual pages}
2588 @pindex grefer@r{, invocation in manual pages}
2589 @pindex gtbl@r{, invocation in manual pages}
2590 @pindex man@r{, invocation of preprocessors}
2592 Note the single space character after the double quote. @var{word}
2593 consists of letters for the needed preprocessors: @samp{e} for
2594 @code{geqn}, @samp{r} for @code{grefer}, @samp{t} for @code{gtbl}.
2595 Modern implementations of the @code{man} program read this first line
2596 and automatically call the right preprocessor(s).
2598 @c ---------------------------------------------------------------------
2600 @node Optional man extensions, , Preprocessors in man pages, man
2601 @subsection Optional @file{man} extensions
2604 Use the file @file{man.local} for local extensions
2605 to the @code{man} macros or for style changes.
2607 @unnumberedsubsubsec Custom headers and footers
2608 @cindex @code{man} macros, custom headers and footers
2610 In groff versions 1.18.2 and later, you can specify custom
2611 headers and footers by redefining the following macros in
2615 Control the content of the headers.
2616 Normally, the header prints the command name
2617 and section number on either side, and the
2618 optional fifth argument to @code{TH} in the center.
2622 Control the content of the footers.
2623 Normally, the footer prints the page number
2624 and the third and fourth arguments to @code{TH}.
2626 Use the @code{FT} number register to specify the
2628 The default is @minus{}0.5@dmn{i}.
2631 @unnumberedsubsubsec Ultrix-specific man macros
2632 @cindex Ultrix-specific @code{man} macros
2633 @cindex @code{man} macros, Ultrix-specific
2636 The @code{groff} source distribution includes
2637 a file named @file{man.ultrix}, containing
2638 macros compatible with the Ultrix variant of
2640 Copy this file into @file{man.local} (or use the @code{mso} request to
2641 load it) to enable the following macros.
2643 @Defmac {CT, @Var{key}, man}
2644 Print @samp{<CTRL/@var{key}>}.
2648 Print subsequent text using the constant width (Courier) typeface.
2652 Begin a non-filled display.
2656 End a non-filled display started with @code{Ds}.
2659 @Defmac {EX, [@Var{indent}], man}
2660 Begins a non-filled display
2661 using the constant width (Courier) typeface.
2662 Use the optional @var{indent} argument to
2667 End a non-filled display started with @code{EX}.
2670 @Defmac {G, [@Var{text}], man}
2671 Sets @var{text} in Helvetica.
2672 If no text is present on the line where
2673 the macro is called, then the text of the
2674 next line appears in Helvetica.
2677 @Defmac {GL, [@Var{text}], man}
2678 Sets @var{text} in Helvetica Oblique.
2679 If no text is present on the line where
2680 the macro is called, then the text of the
2681 next line appears in Helvetica Oblique.
2684 @Defmac {HB, [@Var{text}], man}
2685 Sets @var{text} in Helvetica Bold.
2686 If no text is present on the line where
2687 the macro is called, then all text up to
2688 the next @code{HB} appears in Helvetica Bold.
2691 @Defmac {TB, [@Var{text}], man}
2692 Identical to @code{HB}.
2695 @Defmac {MS, @Var{title} @Var{sect} [@Var{punct}], man}
2696 Set a manpage reference in Ultrix format.
2697 The @var{title} is in Courier instead of italic.
2698 Optional punctuation follows the section number without
2699 an intervening space.
2702 @Defmac {NT, [@code{C}] [@Var{title}], man}
2704 Print the optional @Var{title}, or the word ``Note'',
2705 centered on the page.
2706 Text following the macro makes up the body of the note,
2707 and is indented on both sides.
2708 If the first argument is @code{C}, the body of the
2709 note is printed centered (the second argument replaces
2710 the word ``Note'' if specified).
2714 End a note begun with @code{NT}.
2717 @Defmac {PN, @Var{path} [@Var{punct}], man}
2718 Set the path name in constant width (Courier),
2719 followed by optional punctuation.
2722 @Defmac {Pn, [@Var{punct}] @Var{path} [@Var{punct}], man}
2723 When called with two arguments, identical to @code{PN}.
2724 When called with three arguments,
2725 set the second argument in constant width (Courier),
2726 bracketed by the first and third arguments in the current font.
2730 Switch to roman font and turn off any underlining in effect.
2734 Print the string @samp{<RETURN>}.
2737 @Defmac {VS, [@code{4}], man}
2738 Start printing a change bar in the margin if
2739 the number @code{4} is specified.
2740 Otherwise, this macro does nothing.
2744 End printing the change bar begun by @code{VS}.
2747 @unnumberedsubsubsec Simple example
2749 The following example @file{man.local} file
2750 alters the @code{SH} macro to add some extra
2751 vertical space before printing the heading.
2752 Headings are printed in Helvetica Bold.
2755 .\" Make the heading fonts Helvetica
2758 .\" Put more whitespace in front of headings.
2761 . if t .sp (u;\\n[PD]*2)
2766 @c =====================================================================
2768 @node mdoc, ms, man, Macro Packages
2769 @section @file{mdoc}
2770 @cindex @code{mdoc} macros
2772 @c XXX documentation
2773 @c XXX this is a placeholder until we get stuff knocked into shape
2774 See the @cite{groff_mdoc(7)} man page (type @command{man groff_mdoc}
2775 at the command line).
2778 @c =====================================================================
2780 @node ms, me, mdoc, Macro Packages
2782 @cindex @code{ms} macros
2784 The @file{-ms} macros are suitable for reports, letters, books, user
2785 manuals, and so forth. The package provides macros for cover pages,
2786 section headings, paragraphs, lists, footnotes, pagination, and a
2791 * General ms Structure::
2792 * ms Document Control Registers::
2793 * ms Cover Page Macros::
2796 * Differences from AT&T ms::
2797 * Naming Conventions::
2800 @c ---------------------------------------------------------------------
2802 @node ms Intro, General ms Structure, ms, ms
2803 @subsection Introduction to @file{ms}
2805 The original @file{-ms} macros were included with @acronym{AT&T}
2806 @code{troff} as well as the @file{man} macros. While the @file{man}
2807 package is intended for brief documents that can be read on-line as
2808 well as printed, the @file{ms} macros are suitable for longer
2809 documents that are meant to be printed rather than read on-line.
2811 The @file{ms} macro package included with @code{groff} is a complete,
2812 bottom-up re-implementation. Several macros (specific to
2813 @acronym{AT&T} or Berkeley) are not included, while several new
2814 commands are. @xref{Differences from AT&T ms}, for more information.
2816 @c ---------------------------------------------------------------------
2818 @node General ms Structure, ms Document Control Registers, ms Intro, ms
2819 @subsection General structure of an @file{ms} document
2820 @cindex @code{ms} macros, general structure
2822 The @file{ms} macro package expects a certain amount of structure, but
2823 not as much as packages such as @file{man} or @file{mdoc}.
2825 The simplest documents can begin with a paragraph macro (such as
2826 @code{LP} or @code{PP}), and consist of text separated by paragraph
2827 macros or even blank lines. Longer documents have a structure as
2832 If you invoke the @code{RP} (report) macro on the first line of the
2833 document, @code{groff} prints the cover page information on its own
2834 page; otherwise it prints the information on the first page with your
2835 document text immediately following. Other document formats found in
2836 @acronym{AT&T} @code{troff} are specific to @acronym{AT&T} or
2837 Berkeley, and are not supported in @code{groff}.
2839 @item Format and layout
2840 By setting number registers, you can change your document's type (font
2841 and size), margins, spacing, headers and footers, and footnotes.
2842 @xref{ms Document Control Registers}, for more details.
2845 A cover page consists of a title, the author's name and institution,
2846 an abstract, and the date.@footnote{Actually, only the title is
2847 required.} @xref{ms Cover Page Macros}, for more details.
2850 Following the cover page is your document. You can use the @file{ms}
2851 macros to write reports, letters, books, and so forth. The package is
2852 designed for structured documents, consisting of paragraphs
2853 interspersed with headings and augmented by lists, footnotes, tables,
2854 and other common constructs. @xref{ms Body Text}, for more details.
2856 @item Table of contents
2857 Longer documents usually include a table of contents, which you can
2858 invoke by placing the @code{TC} macro at the end of your document.
2859 The @file{ms} macros have minimal indexing facilities, consisting of
2860 the @code{IX} macro, which prints an entry on standard error.
2861 Printing the table of contents at the end is necessary since
2862 @code{groff} is a single-pass text formatter, thus it cannot determine
2863 the page number of each section until that section has actually been
2864 set and printed. Since @file{ms} output is intended for hardcopy, you
2865 can manually relocate the pages containing the table of contents
2866 between the cover page and the body text after printing.
2869 @c ---------------------------------------------------------------------
2871 @node ms Document Control Registers, ms Cover Page Macros, General ms Structure, ms
2872 @subsection Document control registers
2873 @cindex @code{ms} macros, document control registers
2875 The following is a list of document control number registers. For the
2876 sake of consistency, set registers related to margins at the beginning
2877 of your document, or just after the @code{RP} macro. You can set
2878 other registers later in your document, but you should keep them
2879 together at the beginning to make them easy to find and edit as
2882 @unnumberedsubsubsec Margin Settings
2885 Defines the page offset (i.e., the left margin). There is no explicit
2886 right margin setting; the combination of the @code{PO} and @code{LL}
2887 registers implicitly define the right margin width.
2889 Effective: next page.
2891 Default value: 1@dmn{i}.
2895 Defines the line length (i.e., the width of the body text).
2897 Effective: next paragraph.
2903 Defines the title length (i.e., the header and footer width). This
2904 is usually the same as @code{LL}, but not necessarily.
2906 Effective: next paragraph.
2912 Defines the header margin height at the top of the page.
2914 Effective: next page.
2920 Defines the footer margin height at the bottom of the page.
2922 Effective: next page.
2927 @unnumberedsubsubsec Text Settings
2930 Defines the point size of the body text. If the value is larger than
2931 or equal to 1000, divide it by 1000 to get a fractional point size.
2932 For example, @samp{.nr PS 10250} sets the document's point size to
2935 Effective: next paragraph.
2941 Defines the space between lines (line height plus leading). If the
2942 value is larger than or equal to 1000, divide it by 1000 to get a
2943 fractional point size. Due to backwards compatibility, @code{VS} must
2944 be smaller than 40000 (this is 40.0@dmn{p}).
2946 Effective: next paragraph.
2951 @Defmpreg {PSINCR, ms}
2952 Defines an increment in point size, which will be applied to section
2953 headings at nesting levels below the value specified in @code{GROWPS}.
2954 The value of @code{PSINCR} should be specified in points, with the
2955 @dmn{p} scaling factor, and may include a fractional component; for
2956 example, @w{@samp{.nr PSINCR 1.5p}} sets a point size increment of
2959 Effective: next section heading.
2964 @Defmpreg {GROWPS, ms}
2965 Defines the heading level below which the point size increment set by
2966 @code{PSINCR} becomes effective. Section headings at and above the
2967 level specified by @code{GROWPS} will be printed at the point size set
2968 by @code{PS}; for each level below the value of @code{GROWPS}, the
2969 point size will be increased in steps equal to the value of
2970 @code{PSINCR}. Setting @code{GROWPS} to any value less than@tie{}2
2971 disables the incremental heading size feature.
2973 Effective: next section heading.
2979 Defines the hyphenation level. @code{HY} sets safely the value of the
2980 low-level @code{hy} register. Setting the value of @code{HY}
2981 to@tie{}0 is equivalent to using the @code{nh} request.
2983 Effective: next paragraph.
2989 Defines the font family used to typeset the document.
2991 Effective: next paragraph.
2993 Default: as defined in the output device.
2996 @unnumberedsubsubsec Paragraph Settings
2999 Defines the initial indentation of a (@code{PP} macro) paragraph.
3001 Effective: next paragraph.
3007 Defines the space between paragraphs.
3009 Effective: next paragraph.
3011 Default: 0.3@dmn{v}.
3015 Defines the indentation on both sides of a quoted (@code{QP} macro)
3018 Effective: next paragraph.
3023 @Defmpreg {PORPHANS, ms}
3024 Defines the minimum number of initial lines of any paragraph which
3025 should be kept together, to avoid orphan lines at the bottom of a
3026 page. If a new paragraph is started close to the bottom of a page,
3027 and there is insufficient space to accommodate @code{PORPHANS} lines
3028 before an automatic page break, then the page break will be forced,
3029 before the start of the paragraph.
3031 Effective: next paragraph.
3036 @Defmpreg {HORPHANS, ms}
3037 Defines the minimum number of lines of the following paragraph which
3038 should be kept together with any section heading introduced by the
3039 @code{NH} or @code{SH} macros. If a section heading is placed close
3040 to the bottom of a page, and there is insufficient space to
3041 accommodate both the heading and at least @code{HORPHANS} lines of the
3042 following paragraph, before an automatic page break, then the page
3043 break will be forced before the heading.
3045 Effective: next paragraph.
3050 @unnumberedsubsubsec Footnote Settings
3053 Defines the length of a footnote.
3055 Effective: next footnote.
3057 Default: @math{@code{@\n[LL]} * 5 / 6}.
3061 Defines the footnote indentation.
3063 Effective: next footnote.
3069 The footnote format:
3072 Print the footnote number as a superscript; indent the footnote
3076 Print the number followed by a period (like 1.@:) and indent the
3080 Like 1, without an indentation.
3083 Like 1, but print the footnote number as a hanging paragraph.
3086 Effective: next footnote.
3092 Defines the footnote point size. If the value is larger than or equal
3093 to 1000, divide it by 1000 to get a fractional point size.
3095 Effective: next footnote.
3097 Default: @math{@code{@\n[PS]} - 2}.
3101 Defines the footnote vertical spacing. If the value is larger than or
3102 equal to 1000, divide it by 1000 to get a fractional point size.
3104 Effective: next footnote.
3106 Default: @math{@code{@\n[FPS]} + 2}.
3110 Defines the footnote paragraph spacing.
3112 Effective: next footnote.
3114 Default: @math{@code{@\n[PD]} / 2}.
3117 @unnumberedsubsubsec Miscellaneous Number Registers
3119 @Defmpreg {MINGW, ms}
3120 Defines the minimum width between columns in a multi-column document.
3122 Effective: next page.
3127 @c ---------------------------------------------------------------------
3129 @node ms Cover Page Macros, ms Body Text, ms Document Control Registers, ms
3130 @subsection Cover page macros
3131 @cindex @code{ms} macros, cover page
3132 @cindex cover page macros, [@code{ms}]
3134 Use the following macros to create a cover page for your document in
3137 @Defmac {RP, [@code{no}], ms}
3138 Specifies the report format for your document. The report format
3139 creates a separate cover page. The default action (no @code{RP}
3140 macro) is to print a subset of the cover page on page@tie{}1 of your
3143 If you use the word @code{no} as an optional argument, @code{groff}
3144 prints a title page but does not repeat any of the title page
3145 information (title, author, abstract, etc.@:) on page@tie{}1 of the
3150 (P-one) Prints the header on page@tie{}1. The default is to suppress
3154 @Defmac {DA, [@dots{}], ms}
3155 (optional) Prints the current date, or the arguments to the macro if
3156 any, on the title page (if specified) and in the footers. This is the
3157 default for @code{nroff}.
3160 @Defmac {ND, [@dots{}], ms}
3161 (optional) Prints the current date, or the arguments to the macro if
3162 any, on the title page (if specified) but not in the footers. This is
3163 the default for @code{troff}.
3167 Specifies the document title. @code{groff} collects text following
3168 the @code{TL} macro into the title, until reaching the author name or
3173 Specifies the author's name, which appears on the line (or lines)
3174 immediately following. You can specify multiple authors as follows:
3180 University of West Bumblefuzz
3184 Monolithic Corporation
3191 Specifies the author's institution. You can specify multiple
3192 institutions in the same way that you specify multiple authors.
3195 @Defmac {AB, [@code{no}], ms}
3196 Begins the abstract. The default is to print the word
3197 @acronym{ABSTRACT}, centered and in italics, above the text of the
3198 abstract. The word @code{no} as an optional argument suppresses this
3206 The following is example mark-up for a title page.
3207 @cindex title page, example markup
3208 @cindex example markup, title page
3214 The Inevitability of Code Bloat
3215 in Commercial and Free Software
3219 University of West Bumblefuzz
3221 This report examines the long-term growth
3222 of the code bases in two large, popular software
3223 packages; the free Emacs and the commercial
3225 While differences appear in the type or order
3226 of features added, due to the different
3227 methodologies used, the results are the same
3230 The free software approach is shown to be
3231 superior in that while free software can
3232 become as bloated as commercial offerings,
3233 free software tends to have fewer serious
3234 bugs and the added features are in line with
3238 ... the rest of the paper follows ...
3242 @c ---------------------------------------------------------------------
3244 @node ms Body Text, ms Page Layout, ms Cover Page Macros, ms
3245 @subsection Body text
3246 @cindex @code{ms} macros, body text
3248 This section describes macros used to mark up the body of your
3249 document. Examples include paragraphs, sections, and other groups.
3252 * Paragraphs in ms::
3254 * Highlighting in ms::
3256 * Indentation values in ms::
3258 * ms Displays and Keeps::
3260 * Example multi-page table::
3264 @c ---------------------------------------------------------------------
3266 @node Paragraphs in ms, Headings in ms, ms Body Text, ms Body Text
3267 @subsubsection Paragraphs
3268 @cindex @code{ms} macros, paragraph handling
3270 The following paragraph types are available.
3272 @DefmacList {PP, , ms}
3273 @DefmacListEnd {LP, , ms}
3274 Sets a paragraph with an initial indentation.
3278 Sets a paragraph that is indented at both left and right margins. The
3279 effect is identical to the @acronym{HTML} @code{<BLOCKQUOTE>} element.
3280 The next paragraph or heading returns margins to normal.
3284 Sets a paragraph whose lines are indented, except for the first line.
3285 This is a Berkeley extension.
3288 The following markup uses all four paragraph macros.
3293 Cases used in the study
3295 The following software and versions were
3296 considered for this report.
3298 For commercial software, we chose
3299 .B "Microsoft Word for Windows" ,
3300 starting with version 1.0 through the
3301 current version (Word 2000).
3303 For free software, we chose
3305 from its first appearance as a standalone
3306 editor through the current version (v20).
3307 See [Bloggs 2002] for details.
3309 Franklin's Law applied to software:
3310 software expands to outgrow both
3311 RAM and disk space over time.
3316 .I "Everyone's a Critic" ,
3317 Underground Press, March 2002.
3318 A definitive work that answers all questions
3319 and criticisms about the quality and usability of
3324 The @code{PORPHANS} register (@pxref{ms Document Control Registers})
3325 operates in conjunction with each of these macros, to inhibit the
3326 printing of orphan lines at the bottom of any page.
3328 @c ---------------------------------------------------------------------
3330 @node Headings in ms, Highlighting in ms, Paragraphs in ms, ms Body Text
3331 @subsubsection Headings
3332 @cindex @code{ms} macros, headings
3334 Use headings to create a hierarchical structure for your document.
3335 The @file{ms} macros print headings in @strong{bold}, using the same
3336 font family and point size as the body text.
3338 The following describes the heading macros:
3340 @DefmacList {NH, @Var{curr-level}, ms}
3341 @DefmacListEnd {NH, @t{S} @Var{level0} @dots{}, ms}
3342 Numbered heading. The argument is either a numeric argument to
3343 indicate the level of the heading, or the letter@tie{}@code{S}
3344 followed by numeric arguments to set the heading level explicitly.
3346 If you specify heading levels out of sequence, such as invoking
3347 @samp{.NH 3} after @samp{.NH 1}, @code{groff} prints a warning on
3351 @DefstrList {SN, ms}
3352 @DefstrItem {SN-DOT, ms}
3353 @DefstrListEnd {SN-NO-DOT, ms}
3354 After invocation of @code{NH}, the assigned section number is made
3355 available in the strings @code{SN-DOT} (exactly as it appears in the
3356 printed section heading) and @code{SN-NO-DOT} (with the final period
3357 omitted). The string @code{SN} is also defined, as an alias for
3358 @code{SN-DOT}; if preferred, you may redefine it as an alias for
3359 @code{SN-NO-DOT}, by including the initialization
3367 @strong{before} your first use of @code{NH}, or simply
3374 @strong{after} your first use of @code{NH}.
3377 @Defmac {SH, [@Var{match-level}], ms}
3378 Unnumbered subheading.
3380 The optional @var{match-level} argument is a GNU extension. It is a
3381 number indicating the level of the heading, in a manner analogous to
3382 the @var{curr-level} argument to @code{.NH}. Its purpose is to match
3383 the point size, at which the heading is printed, to the size of a
3384 numbered heading at the same level, when the @code{GROWPS} and
3385 @code{PSINCR} heading size adjustment mechanism is in effect.
3386 @xref{ms Document Control Registers}.
3389 The @code{HORPHANS} register (@pxref{ms Document Control Registers})
3390 operates in conjunction with the @code{NH} and @code{SH} macros, to
3391 inhibit the printing of orphaned section headings at the bottom of any
3394 @c ---------------------------------------------------------------------
3396 @node Highlighting in ms, Lists in ms, Headings in ms, ms Body Text
3397 @subsubsection Highlighting
3398 @cindex @code{ms} macros, highlighting
3400 The @file{ms} macros provide a variety of methods to highlight or
3403 @Defmac {B, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3404 Sets its first argument in @strong{bold type}. If you specify a
3405 second argument, @code{groff} prints it in the previous font after the
3406 bold text, with no intervening space (this allows you to set
3407 punctuation after the highlighted text without highlighting the
3408 punctuation). Similarly, it prints the third argument (if any) in the
3409 previous font @strong{before} the first argument. For example,
3415 prints (@strong{foo}).
3417 If you give this macro no arguments, @code{groff} prints all text
3418 following in bold until the next highlighting, paragraph, or heading
3422 @Defmac {R, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3423 Sets its first argument in roman (or regular) type. It operates
3424 similarly to the @code{B}@tie{}macro otherwise.
3427 @Defmac {I, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3428 Sets its first argument in @emph{italic type}. It operates similarly
3429 to the @code{B}@tie{}macro otherwise.
3432 @Defmac {CW, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3433 Sets its first argument in a @code{constant width face}. It operates
3434 similarly to the @code{B}@tie{}macro otherwise.
3437 @Defmac {BI, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3438 Sets its first argument in bold italic type. It operates similarly to
3439 the @code{B}@tie{}macro otherwise.
3442 @Defmac {BX, [@Var{txt}], ms}
3443 Prints its argument and draws a box around it. If you want to box a
3444 string that contains spaces, use a digit-width space (@code{\0}).
3447 @Defmac {UL, [@Var{txt} [@Var{post}]], ms}
3448 Prints its first argument with an underline. If you specify a second
3449 argument, @code{groff} prints it in the previous font after the
3450 underlined text, with no intervening space.
3454 Prints all text following in larger type (two points larger than the
3455 current point size) until the next font size, highlighting, paragraph,
3456 or heading macro. You can specify this macro multiple times to
3457 enlarge the point size as needed.
3461 Prints all text following in smaller type (two points smaller than the
3462 current point size) until the next type size, highlighting, paragraph,
3463 or heading macro. You can specify this macro multiple times to reduce
3464 the point size as needed.
3468 Prints all text following in the normal point size (that is, the value
3469 of the @code{PS} register).
3472 @DefstrList {@Lbrace{}, ms}
3473 @DefstrListEnd {@Rbrace{}, ms}
3474 Text enclosed with @code{\*@{} and @code{\*@}} is printed as a
3478 @c ---------------------------------------------------------------------
3480 @node Lists in ms, Indentation values in ms, Highlighting in ms, ms Body Text
3481 @subsubsection Lists
3482 @cindex @code{ms} macros, lists
3484 The @code{IP} macro handles duties for all lists.
3486 @Defmac {IP, [@Var{marker} [@Var{width}]], ms}
3487 The @var{marker} is usually a bullet glyph (@code{\[bu]}) for
3488 unordered lists, a number (or auto-incrementing number register) for
3489 numbered lists, or a word or phrase for indented (glossary-style)
3492 The @var{width} specifies the indentation for the body of each list
3493 item; its default unit is @samp{n}. Once specified, the indentation
3494 remains the same for all list items in the document until specified
3497 The @code{PORPHANS} register (@pxref{ms Document Control Registers})
3498 operates in conjunction with the @code{IP} macro, to inhibit the
3499 printing of orphaned list markers at the bottom of any page.
3502 The following is an example of a bulleted list.
3503 @cindex example markup, bulleted list [@code{ms}]
3504 @cindex bulleted list, example markup [@code{ms}]
3528 The following is an example of a numbered list.
3529 @cindex example markup, numbered list [@code{ms}]
3530 @cindex numbered list, example markup [@code{ms}]
3555 Note the use of the auto-incrementing number register in this example.
3557 The following is an example of a glossary-style list.
3558 @cindex example markup, glossary-style list [@code{ms}]
3559 @cindex glossary-style list, example markup [@code{ms}]
3562 A glossary-style list:
3564 Two or more attorneys.
3566 Firearms, preferably
3576 A glossary-style list:
3579 Two or more attorneys.
3581 guns Firearms, preferably large-caliber.
3584 Gotta pay for those lawyers and guns!
3587 In the last example, the @code{IP} macro places the definition on the
3588 same line as the term if it has enough space; otherwise, it breaks to
3589 the next line and starts the definition below the term. This may or
3590 may not be the effect you want, especially if some of the definitions
3591 break and some do not. The following examples show two possible ways
3594 The first workaround uses the @code{br} request to force a break after
3595 printing the term or label.
3599 A glossary-style list:
3601 Two or more attorneys.
3604 Firearms, preferably large-caliber.
3606 Gotta pay for those lawyers and guns!
3610 The second workaround uses the @code{\p} escape to force the break.
3611 Note the space following the escape; this is important. If you omit
3612 the space, @code{groff} prints the first word on the same line as the
3613 term or label (if it fits) @strong{then} breaks the line.
3617 A glossary-style list:
3619 Two or more attorneys.
3621 \p Firearms, preferably large-caliber.
3623 Gotta pay for those lawyers and guns!
3627 To set nested lists, use the @code{RS} and @code{RE} macros.
3628 @xref{Indentation values in ms}, for more information.
3629 @cindex @code{ms} macros, nested lists
3630 @cindex nested lists [@code{ms}]
3665 @c ---------------------------------------------------------------------
3667 @node Indentation values in ms, Tabstops in ms, Lists in ms, ms Body Text
3668 @subsubsection Indentation values
3670 In many situations, you may need to indentation a section of text
3671 while still wrapping and filling. @xref{Lists in ms}, for an example
3674 @DefmacList {RS, , ms}
3675 @DefmacListEnd {RE, , ms}
3676 These macros begin and end an indented section. The @code{PI}
3677 register controls the amount of indentation, allowing the indented
3678 text to line up under hanging and indented paragraphs.
3681 @xref{ms Displays and Keeps}, for macros to indentation and turn off
3684 @c ---------------------------------------------------------------------
3686 @node Tabstops in ms, ms Displays and Keeps, Indentation values in ms, ms Body Text
3687 @subsubsection Tab Stops
3689 Use the @code{ta} request to define tab stops as needed. @xref{Tabs
3693 Use this macro to reset the tab stops to the default for @file{ms}
3694 (every 5n). You can redefine the @code{TA} macro to create a
3695 different set of default tab stops.
3698 @c ---------------------------------------------------------------------
3700 @node ms Displays and Keeps, ms Insertions, Tabstops in ms, ms Body Text
3701 @subsubsection Displays and keeps
3702 @cindex @code{ms} macros, displays
3703 @cindex @code{ms} macros, keeps
3704 @cindex keeps [@code{ms}]
3705 @cindex displays [@code{ms}]
3707 Use displays to show text-based examples or figures (such as code
3710 Displays turn off filling, so lines of code are displayed as-is
3711 without inserting @code{br} requests in between each line. Displays
3712 can be @dfn{kept} on a single page, or allowed to break across pages.
3714 @DefmacList {DS, @t{L}, ms}
3715 @DefmacItem {LD, , ms}
3716 @DefmacListEnd {DE, , ms}
3717 Left-justified display. The @samp{.DS L} call generates a page break,
3718 if necessary, to keep the entire display on one page. The @code{LD}
3719 macro allows the display to break across pages. The @code{DE} macro
3723 @DefmacList {DS, @t{I}, ms}
3724 @DefmacItem {ID, , ms}
3725 @DefmacListEnd {DE, , ms}
3726 Indents the display as defined by the @code{DI} register. The
3727 @samp{.DS I} call generates a page break, if necessary, to keep the
3728 entire display on one page. The @code{ID} macro allows the display to
3729 break across pages. The @code{DE} macro ends the display.
3732 @DefmacList {DS, @t{B}, ms}
3733 @DefmacItem {BD, , ms}
3734 @DefmacListEnd {DE, , ms}
3735 Sets a block-centered display: the entire display is left-justified,
3736 but indented so that the longest line in the display is centered on
3737 the page. The @samp{.DS B} call generates a page break, if necessary,
3738 to keep the entire display on one page. The @code{BD} macro allows
3739 the display to break across pages. The @code{DE} macro ends the
3743 @DefmacList {DS, @t{C}, ms}
3744 @DefmacItem {CD, , ms}
3745 @DefmacListEnd {DE, , ms}
3746 Sets a centered display: each line in the display is centered. The
3747 @samp{.DS C} call generates a page break, if necessary, to keep the
3748 entire display on one page. The @code{CD} macro allows the display to
3749 break across pages. The @code{DE} macro ends the display.
3752 @DefmacList {DS, @t{R}, ms}
3753 @DefmacItem {RD, , ms}
3754 @DefmacListEnd {DE, , ms}
3755 Right-justifies each line in the display. The @samp{.DS R} call
3756 generates a page break, if necessary, to keep the entire display on
3757 one page. The @code{RD} macro allows the display to break across
3758 pages. The @code{DE} macro ends the display.
3761 @DefmacList {Ds, , ms}
3762 @DefmacListEnd {De, , ms}
3763 These two macros were formerly provided as aliases for @code{DS} and
3764 @code{DE}, respectively. They have been removed, and should no longer
3765 be used. The original implementations of @code{DS} and @code{DE} are
3766 retained, and should be used instead. X11 documents which actually
3767 use @code{Ds} and @code{De} always load a specific macro file from the
3768 X11 distribution (@file{macros.t}) which provides proper definitions
3772 On occasion, you may want to @dfn{keep} other text together on a page.
3773 For example, you may want to keep two paragraphs together, or a
3774 paragraph that refers to a table (or list, or other item) immediately
3775 following. The @file{ms} macros provide the @code{KS} and @code{KE}
3776 macros for this purpose.
3778 @DefmacList {KS, , ms}
3779 @DefmacListEnd {KE, , ms}
3780 The @code{KS} macro begins a block of text to be kept on a single
3781 page, and the @code{KE} macro ends the block.
3784 @DefmacList {KF, , ms}
3785 @DefmacListEnd {KE, , ms}
3786 Specifies a @dfn{floating keep}; if the keep cannot fit on the current
3787 page, @code{groff} holds the contents of the keep and allows text
3788 following the keep (in the source file) to fill in the remainder of
3789 the current page. When the page breaks, whether by an explicit
3790 @code{bp} request or by reaching the end of the page, @code{groff}
3791 prints the floating keep at the top of the new page. This is useful
3792 for printing large graphics or tables that do not need to appear
3793 exactly where specified.
3796 You can also use the @code{ne} request to force a page break if there
3797 is not enough vertical space remaining on the page.
3799 Use the following macros to draw a box around a section of text (such
3802 @DefmacList {B1, , ms}
3803 @DefmacListEnd {B2, , ms}
3804 Marks the beginning and ending of text that is to have a box drawn
3805 around it. The @code{B1} macro begins the box; the @code{B2} macro
3806 ends it. Text in the box is automatically placed in a diversion
3810 @c ---------------------------------------------------------------------
3812 @node ms Insertions, Example multi-page table, ms Displays and Keeps, ms Body Text
3813 @subsubsection Tables, figures, equations, and references
3814 @cindex @code{ms} macros, tables
3815 @cindex @code{ms} macros, figures
3816 @cindex @code{ms} macros, equations
3817 @cindex @code{ms} macros, references
3818 @cindex tables [@code{ms}]
3819 @cindex figures [@code{ms}]
3820 @cindex equations [@code{ms}]
3821 @cindex references [@code{ms}]
3823 The @file{ms} macros support the standard @code{groff} preprocessors:
3824 @code{tbl}, @code{pic}, @code{eqn}, and @code{refer}.
3829 You mark text meant for preprocessors by enclosing it
3830 in pairs of tags as follows.
3832 @DefmacList {TS, [@code{H}], ms}
3833 @DefmacListEnd {TE, , ms}
3834 Denotes a table, to be processed by the @code{tbl} preprocessor. The
3835 optional argument@tie{}@code{H} to @code{TS} instructs @code{groff} to
3836 create a running header with the information up to the @code{TH}
3837 macro. @code{groff} prints the header at the beginning of the table;
3838 if the table runs onto another page, @code{groff} prints the header on
3839 the next page as well.
3842 @DefmacList {PS, , ms}
3843 @DefmacListEnd {PE, , ms}
3844 Denotes a graphic, to be processed by the @code{pic} preprocessor.
3845 You can create a @code{pic} file by hand, using the @acronym{AT&T}
3846 @code{pic} manual available on the Web as a reference, or by using a
3847 graphics program such as @code{xfig}.
3850 @DefmacList {EQ, [@Var{align}], ms}
3851 @DefmacListEnd {EN, , ms}
3852 Denotes an equation, to be processed by the @code{eqn} preprocessor.
3853 The optional @var{align} argument can be @code{C}, @code{L},
3854 or@tie{}@code{I} to center (the default), left-justify, or indent the
3858 @DefmacList {[, , ms}
3859 @DefmacListEnd {], , ms}
3860 Denotes a reference, to be processed by the @code{refer} preprocessor.
3861 The @acronym{GNU} @cite{refer(1)} man page provides a comprehensive
3862 reference to the preprocessor and the format of the bibliographic
3867 * Example multi-page table::
3870 @c ---------------------------------------------------------------------
3872 @node Example multi-page table, ms Footnotes, ms Insertions, ms Body Text
3873 @subsubsection An example multi-page table
3874 @cindex example markup, multi-page table [@code{ms}]
3875 @cindex multi-page table, example markup [@code{ms}]
3877 The following is an example of how to set up a table that may print
3878 across two or more pages.
3885 Text ...of heading...
3890 ... the rest of the table follows...
3896 @c ---------------------------------------------------------------------
3898 @node ms Footnotes, , Example multi-page table, ms Body Text
3899 @subsubsection Footnotes
3900 @cindex @code{ms} macros, footnotes
3901 @cindex footnotes [@code{ms}]
3903 The @file{ms} macro package has a flexible footnote system. You can
3904 specify either numbered footnotes or symbolic footnotes (that is,
3905 using a marker such as a dagger symbol).
3908 Specifies the location of a numbered footnote marker in the text.
3911 @DefmacList {FS, , ms}
3912 @DefmacListEnd {FE, , ms}
3913 Specifies the text of the footnote. The default action is to create a
3914 numbered footnote; you can create a symbolic footnote by specifying a
3915 @dfn{mark} glyph (such as @code{\[dg]} for the dagger glyph) in the
3916 body text and as an argument to the @code{FS} macro, followed by the
3917 text of the footnote and the @code{FE} macro.
3920 You can control how @code{groff} prints footnote numbers by changing
3921 the value of the @code{FF} register. @xref{ms Document Control
3924 @cindex footnotes, and keeps [@code{ms}]
3925 @cindex keeps, and footnotes [@code{ms}]
3926 @cindex footnotes, and displays [@code{ms}]
3927 @cindex displays, and footnotes [@code{ms}]
3928 Footnotes can be safely used within keeps and displays, but you should
3929 avoid using numbered footnotes within floating keeps. You can set a
3930 second @code{\**} marker between a @code{\**} and its corresponding
3931 @code{.FS} entry; as long as each @code{FS} macro occurs @emph{after}
3932 the corresponding @code{\**} and the occurrences of @code{.FS} are in
3933 the same order as the corresponding occurrences of @code{\**}.
3935 @c ---------------------------------------------------------------------
3937 @node ms Page Layout, Differences from AT&T ms, ms Body Text, ms
3938 @subsection Page layout
3939 @cindex @code{ms} macros, page layout
3940 @cindex page layout [@code{ms}]
3942 The default output from the @file{ms} macros provides a minimalist
3943 page layout: it prints a single column, with the page number centered
3944 at the top of each page. It prints no footers.
3946 You can change the layout by setting the proper number registers and
3950 * ms Headers and Footers::
3952 * ms Multiple Columns::
3954 * ms Strings and Special Characters::
3957 @c ---------------------------------------------------------------------
3959 @node ms Headers and Footers, ms Margins, ms Page Layout, ms Page Layout
3960 @subsubsection Headers and footers
3961 @cindex @code{ms} macros, headers
3962 @cindex @code{ms} macros, footers
3963 @cindex headers [@code{ms}]
3964 @cindex footers [@code{ms}]
3966 For documents that do not distinguish between odd and even pages, set
3967 the following strings:
3969 @DefstrList {LH, ms}
3970 @DefstrItem {CH, ms}
3971 @DefstrListEnd {RH, ms}
3972 Sets the left, center, and right headers.
3975 @DefstrList {LF, ms}
3976 @DefstrItem {CF, ms}
3977 @DefstrListEnd {RF, ms}
3978 Sets the left, center, and right footers.
3981 For documents that need different information printed in the even and
3982 odd pages, use the following macros:
3984 @DefmacList {OH, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
3985 @DefmacItem {EH, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
3986 @DefmacItem {OF, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
3987 @DefmacListEnd {EF, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
3988 The @code{OH} and @code{EH} macros define headers for the odd and even
3989 pages; the @code{OF} and @code{EF} macros define footers for the odd
3990 and even pages. This is more flexible than defining the individual
3993 You can replace the quote (@code{'}) marks with any character not
3994 appearing in the header or footer text.
3997 @c ---------------------------------------------------------------------
3999 @node ms Margins, ms Multiple Columns, ms Headers and Footers, ms Page Layout
4000 @subsubsection Margins
4001 @cindex @code{ms} macros, margins
4003 You control margins using a set of number registers. @xref{ms
4004 Document Control Registers}, for details.
4006 @c ---------------------------------------------------------------------
4008 @node ms Multiple Columns, ms TOC, ms Margins, ms Page Layout
4009 @subsubsection Multiple columns
4010 @cindex @code{ms} macros, multiple columns
4011 @cindex multiple columns [@code{ms}]
4013 The @file{ms} macros can set text in as many columns as will
4014 reasonably fit on the page. The following macros are available; all
4015 of them force a page break if a multi-column mode is already set.
4016 However, if the current mode is single-column, starting a multi-column
4017 mode does @emph{not} force a page break.
4027 @Defmac {MC, [@Var{width} [@Var{gutter}]], ms}
4028 Multi-column mode. If you specify no arguments, it is equivalent to
4029 the @code{2C} macro. Otherwise, @var{width} is the width of each
4030 column and @var{gutter} is the space between columns. The
4031 @code{MINGW} number register controls the default gutter width.
4034 @c ---------------------------------------------------------------------
4036 @node ms TOC, ms Strings and Special Characters, ms Multiple Columns, ms Page Layout
4037 @subsubsection Creating a table of contents
4038 @cindex @code{ms} macros, creating table of contents
4039 @cindex table of contents, creating [@code{ms}]
4041 The facilities in the @file{ms} macro package for creating a table of
4042 contents are semi-automated at best. Assuming that you want the table
4043 of contents to consist of the document's headings, you need to repeat
4044 those headings wrapped in @code{XS} and @code{XE} macros.
4046 @DefmacList {XS, [@Var{page}], ms}
4047 @DefmacItem {XA, [@Var{page}], ms}
4048 @DefmacListEnd {XE, , ms}
4049 These macros define a table of contents or an individual entry in the
4050 table of contents, depending on their use. The macros are very
4051 simple; they cannot indent a heading based on its level. The easiest
4052 way to work around this is to add tabs to the table of contents
4053 string. The following is an example:
4075 You can manually create a table of contents by beginning with the
4076 @code{XS} macro for the first entry, specifying the page number for
4077 that entry as the argument to @code{XS}. Add subsequent entries using
4078 the @code{XA} macro, specifying the page number for that entry as the
4079 argument to @code{XA}. The following is an example:
4086 A Brief History of the Universe
4088 Details of Galactic Formation
4095 @Defmac {TC, [@code{no}], ms}
4096 Prints the table of contents on a new page, setting the page number
4097 to@tie{}@strong{i} (Roman lowercase numeral one). You should usually
4098 place this macro at the end of the file, since @code{groff} is a
4099 single-pass formatter and can only print what has been collected up to
4100 the point that the @code{TC} macro appears.
4102 The optional argument @code{no} suppresses printing the title
4103 specified by the string register @code{TOC}.
4106 @Defmac{PX, [@code{no}], ms}
4107 Prints the table of contents on a new page, using the current page
4108 numbering sequence. Use this macro to print a manually-generated
4109 table of contents at the beginning of your document.
4111 The optional argument @code{no} suppresses printing the title
4112 specified by the string register @code{TOC}.
4115 The @cite{Groff and Friends HOWTO} includes a @code{sed} script that
4116 automatically inserts @code{XS} and @code{XE} macro entries after each
4117 heading in a document.
4119 Altering the @code{NH} macro to automatically build the table of
4120 contents is perhaps initially more difficult, but would save a great
4121 deal of time in the long run if you use @file{ms} regularly.
4123 @c ---------------------------------------------------------------------
4125 @node ms Strings and Special Characters, , ms TOC, ms Page Layout
4126 @subsubsection Strings and Special Characters
4127 @cindex @code{ms} macros, strings
4128 @cindex @code{ms} macros, special characters
4129 @cindex @code{ms} macros, accent marks
4130 @cindex accent marks [@code{ms}]
4131 @cindex special characters [@code{ms}]
4132 @cindex strings [@code{ms}]
4134 The @file{ms} macros provide the following predefined strings. You
4135 can change the string definitions to help in creating documents in
4136 languages other than English.
4138 @Defstr {REFERENCES, ms}
4139 Contains the string printed at the beginning of the references
4140 (bibliography) page. The default is @samp{References}.
4143 @Defstr {ABSTRACT, ms}
4144 Contains the string printed at the beginning of the abstract. The
4145 default is @samp{ABSTRACT}.
4149 Contains the string printed at the beginning of the table of contents.
4152 @DefstrList {MONTH1, ms}
4153 @DefstrItem {MONTH2, ms}
4154 @DefstrItem {MONTH3, ms}
4155 @DefstrItem {MONTH4, ms}
4156 @DefstrItem {MONTH5, ms}
4157 @DefstrItem {MONTH6, ms}
4158 @DefstrItem {MONTH7, ms}
4159 @DefstrItem {MONTH8, ms}
4160 @DefstrItem {MONTH9, ms}
4161 @DefstrItem {MONTH10, ms}
4162 @DefstrItem {MONTH11, ms}
4163 @DefstrListEnd {MONTH12, ms}
4164 Prints the full name of the month in dates. The default is
4165 @samp{January}, @samp{February}, etc.
4168 The following special characters are available@footnote{For an
4169 explanation what special characters are see @ref{Special
4177 @DefstrListEnd {U, ms}
4178 Prints typographer's quotes in troff, and plain quotes in nroff.
4179 @code{\*Q} is the left quote and @code{\*U} is the right quote.
4182 Improved accent marks are available in the @file{ms} macros.
4185 Specify this macro at the beginning of your document to enable
4186 extended accent marks and special characters. This is a Berkeley
4189 To use the accent marks, place them @strong{after} the character being
4192 Note that groff's native support for accents is superior to the
4193 following definitions.
4196 The following accent marks are available after invoking the @code{AM}
4219 @deffn String @t{\*[:]}
4221 @stindex : @r{[}ms@r{]}
4224 @stindex \*[@r{<colon>}] @r{[}ms@r{]}
4245 The following are standalone characters available after invoking the
4249 Upside-down question mark.
4253 Upside-down exclamation point.
4285 Lowercase æ ligature.
4289 Uppercase Æ ligature.
4292 @c ---------------------------------------------------------------------
4294 @node Differences from AT&T ms, Naming Conventions, ms Page Layout, ms
4295 @subsection Differences from @acronym{AT&T} @file{ms}
4296 @cindex @code{ms} macros, differences from @acronym{AT&T}
4297 @cindex @acronym{AT&T} @code{troff}, @code{ms} macro package differences
4299 This section lists the (minor) differences between the @code{groff
4300 -ms} macros and @acronym{AT&T} @code{troff -ms} macros.
4304 The internals of @code{groff -ms} differ from the internals of
4305 @acronym{AT&T} @code{troff -ms}. Documents that depend upon
4306 implementation details of @acronym{AT&T} @code{troff -ms} may not
4307 format properly with @code{groff -ms}.
4310 The general error-handling policy of @code{groff -ms} is to detect and
4311 report errors, rather than silently to ignore them.
4314 @code{groff -ms} does not work in compatibility mode (this is, with
4315 the @option{-C} option).
4318 There is no special support for typewriter-like devices.
4321 @code{groff -ms} does not provide cut marks.
4324 Multiple line spacing is not supported. Use a larger vertical spacing
4328 Some @acronym{UNIX} @code{ms} documentation says that the @code{CW}
4329 and @code{GW} number registers can be used to control the column width
4330 and gutter width, respectively. These number registers are not used in
4334 Macros that cause a reset (paragraphs, headings, etc.@:) may change
4335 the indentation. Macros that change the indentation do not increment
4336 or decrement the indentation, but rather set it absolutely. This can
4337 cause problems for documents that define additional macros of their
4338 own. The solution is to use not the @code{in} request but instead the
4339 @code{RS} and @code{RE} macros.
4342 To make @code{groff -ms} use the default page offset (which also
4343 specifies the left margin), the @code{PO} register must stay undefined
4344 until the first @file{-ms} macro is evaluated. This implies that
4345 @code{PO} should not be used early in the document, unless it is
4346 changed also: Remember that accessing an undefined register
4347 automatically defines it.
4351 This number register is set to@tie{}1 by the @code{groff -ms} macros,
4352 but it is not used by the @code{AT&T} @code{troff -ms} macros.
4353 Documents that need to determine whether they are being formatted with
4354 @code{AT&T} @code{troff -ms} or @code{groff -ms} should use this
4359 * Missing ms Macros::
4360 * Additional ms Macros::
4363 @c ---------------------------------------------------------------------
4365 @node Missing ms Macros, Additional ms Macros, Differences from AT&T ms, Differences from AT&T ms
4366 @subsubsection @code{troff} macros not appearing in @code{groff}
4368 Macros missing from @code{groff -ms} are cover page macros specific to
4369 Bell Labs and Berkeley. The macros known to be missing are:
4373 Technical memorandum; a cover sheet style
4376 Internal memorandum; a cover sheet style
4379 Memo for record; a cover sheet style
4382 Memo for file; a cover sheet style
4385 Engineer's notes; a cover sheet style
4388 Computing Science Tech Report; a cover sheet style
4394 Cover sheet information
4400 @c ---------------------------------------------------------------------
4402 @node Additional ms Macros, , Missing ms Macros, Differences from AT&T ms
4403 @subsubsection @code{groff} macros not appearing in @acronym{AT&T} @code{troff}
4405 The @code{groff -ms} macros have a few minor extensions
4406 compared to the @acronym{AT&T} @code{troff -ms} macros.
4409 Improved accent marks.
4410 @xref{ms Strings and Special Characters}, for details.
4413 @Defmac {DS, @t{I}, ms}
4415 The default behavior of @acronym{AT&T} @code{troff -ms}
4416 was to indent; the @code{groff} default prints displays
4417 flush left with the body text.
4421 Print text in @code{constant width} (Courier) font.
4425 Indexing term (printed on standard error).
4426 You can write a script to capture and process an index
4427 generated in this manner.
4430 The following additional number registers
4431 appear in @code{groff -ms}:
4433 @Defmpreg {MINGW, ms}
4434 Specifies a minimum space
4435 between columns (for multi-column output); this takes the
4436 place of the @code{GW} register that was documented but apparently
4437 not implemented in @acronym{AT&T} @code{troff}.
4440 Several new string registers are available as well.
4441 You can change these to handle (for example) the local language.
4442 @xref{ms Strings and Special Characters}, for details.
4444 @c ---------------------------------------------------------------------
4446 @node Naming Conventions, , Differences from AT&T ms, ms
4447 @subsection Naming Conventions
4448 @cindex @code{ms} macros, naming conventions
4449 @cindex naming conventions, @code{ms} macros
4451 The following conventions are used for names of macros, strings and
4452 number registers. External names available to documents that use the
4453 @code{groff -ms} macros contain only uppercase letters and digits.
4455 Internally the macros are divided into modules; naming conventions are
4460 Names used only within one module are of the form
4461 @var{module}@code{*}@var{name}.
4464 Names used outside the module in which they are defined are of the
4465 form @var{module}@code{@@}@var{name}.
4468 Names associated with a particular environment are of the form
4469 @var{environment}@code{:}@var{name}; these are used only within the
4473 @var{name} does not have a module prefix.
4476 Constructed names used to implement arrays are of the form
4477 @var{array}@code{!}@var{index}.
4480 Thus the groff ms macros reserve the following names:
4484 Names containing the characters @code{*}, @code{@@},
4488 Names containing only uppercase letters and digits.
4492 @c =====================================================================
4494 @node me, mm, ms, Macro Packages
4496 @cindex @code{me} macro package
4498 @c XXX documentation
4499 @c XXX this is a placeholder until we get stuff knocked into shape
4500 See the @file{meintro.me} and @file{meref.me} documents in
4501 groff's @file{doc} directory.
4504 @c =====================================================================
4506 @node mm, , me, Macro Packages
4508 @cindex @code{mm} macro package
4510 @c XXX documentation
4511 @c XXX this is a placeholder until we get stuff knocked into shape
4512 See the @cite{groff_mm(7)} man page (type @command{man groff_mm} at
4516 @c =====================================================================
4517 @c =====================================================================
4519 @node gtroff Reference, Preprocessors, Macro Packages, Top
4520 @chapter @code{gtroff} Reference
4521 @cindex reference, @code{gtroff}
4522 @cindex @code{gtroff}, reference
4524 This chapter covers @strong{all} of the facilities of @code{gtroff}.
4525 Users of macro packages may skip it if not interested in details.
4533 * Embedded Commands::
4535 * Manipulating Filling and Adjusting::
4536 * Manipulating Hyphenation::
4537 * Manipulating Spacing::
4539 * Character Translations::
4540 * Troff and Nroff Mode::
4545 * Fonts and Symbols::
4548 * Conditionals and Loops::
4551 * Drawing Requests::
4555 * Suppressing output::
4558 * Postprocessor Access::
4560 * Gtroff Internals::
4562 * Implementation Differences::
4566 @c =====================================================================
4568 @node Text, Measurements, gtroff Reference, gtroff Reference
4570 @cindex text, @code{gtroff} processing
4572 @code{gtroff} input files contain text with control commands
4573 interspersed throughout. But, even without control codes, @code{gtroff}
4574 still does several things with the input text:
4578 filling and adjusting
4581 adding additional space after sentences
4587 inserting implicit line breaks
4591 * Filling and Adjusting::
4595 * Implicit Line Breaks::
4596 * Input Conventions::
4600 @c ---------------------------------------------------------------------
4602 @node Filling and Adjusting, Hyphenation, Text, Text
4603 @subsection Filling and Adjusting
4607 When @code{gtroff} reads text, it collects words from the input and fits
4608 as many of them together on one output line as it can. This is known as
4611 @cindex leading spaces
4612 @cindex spaces, leading and trailing
4613 @cindex extra spaces
4614 @cindex trailing spaces
4615 Once @code{gtroff} has a @dfn{filled} line, it tries to @dfn{adjust}
4616 it. This means it widens the spacing between words until the text
4617 reaches the right margin (in the default adjustment mode). Extra spaces
4618 between words are preserved, but spaces at the end of lines are ignored.
4619 Spaces at the front of a line cause a @dfn{break} (breaks are
4620 explained in @ref{Implicit Line Breaks}).
4622 @xref{Manipulating Filling and Adjusting}.
4624 @c ---------------------------------------------------------------------
4626 @node Hyphenation, Sentences, Filling and Adjusting, Text
4627 @subsection Hyphenation
4630 Since the odds are not great for finding a set of words, for every
4631 output line, which fit nicely on a line without inserting excessive
4632 amounts of space between words, @code{gtroff} hyphenates words so
4633 that it can justify lines without inserting too much space between
4634 words. It uses an internal hyphenation algorithm (a simplified version
4635 of the algorithm used within @TeX{}) to indicate which words can be
4636 hyphenated and how to do so. When a word is hyphenated, the first part
4637 of the word is added to the current filled line being output (with
4638 an attached hyphen), and the other portion is added to the next
4641 @xref{Manipulating Hyphenation}.
4643 @c ---------------------------------------------------------------------
4645 @node Sentences, Tab Stops, Hyphenation, Text
4646 @subsection Sentences
4649 Although it is often debated, some typesetting rules say there should be
4650 different amounts of space after various punctuation marks. For
4651 example, the @cite{Chicago typsetting manual} says that a period at the
4652 end of a sentence should have twice as much space following it as would
4653 a comma or a period as part of an abbreviation.
4655 @c XXX exact citation of Chicago manual
4657 @cindex sentence space
4658 @cindex space between sentences
4659 @cindex french-spacing
4660 @code{gtroff} does this by flagging certain characters (normally
4661 @samp{!}, @samp{?}, and @samp{.}) as @dfn{end-of-sentence} characters.
4662 When @code{gtroff} encounters one of these characters at the end of a
4663 line, it appends a normal space followed by a @dfn{sentence space} in
4664 the formatted output. (This justifies one of the conventions mentioned
4665 in @ref{Input Conventions}.)
4667 @cindex transparent characters
4668 @cindex character, transparent
4669 @cindex @code{dg} glyph, at end of sentence
4670 @cindex @code{rq} glyph, at end of sentence
4671 @cindex @code{"}, at end of sentence
4672 @cindex @code{'}, at end of sentence
4673 @cindex @code{)}, at end of sentence
4674 @cindex @code{]}, at end of sentence
4675 @cindex @code{*}, at end of sentence
4676 In addition, the following characters and symbols are treated
4677 transparently while handling end-of-sentence characters: @samp{"},
4678 @samp{'}, @samp{)}, @samp{]}, @samp{*}, @code{\[dg]}, and @code{\[rq]}.
4680 See the @code{cflags} request in @ref{Using Symbols}, for more details.
4682 @cindex @code{\&}, at end of sentence
4683 To prevent the insertion of extra space after an end-of-sentence
4684 character (at the end of a line), append @code{\&}.
4686 @c ---------------------------------------------------------------------
4688 @node Tab Stops, Implicit Line Breaks, Sentences, Text
4689 @subsection Tab Stops
4691 @cindex stops, tabulator
4692 @cindex tab character
4693 @cindex character, tabulator
4695 @cindex @acronym{EBCDIC} encoding
4696 @cindex encoding, @acronym{EBCDIC}
4697 @code{gtroff} translates @dfn{tabulator characters}, also called
4698 @dfn{tabs} (normally code point @acronym{ASCII} @code{0x09} or
4699 @acronym{EBCDIC} @code{0x05}), in the input into movements to the next
4700 tabulator stop. These tab stops are initially located every half inch
4701 across the page. Using this, simple tables can be made easily.
4702 However, it can often be deceptive as the appearance (and width) of the
4703 text on a terminal and the results from @code{gtroff} can vary greatly.
4705 Also, a possible sticking point is that lines beginning with tab
4706 characters are still filled, again producing unexpected results.
4707 For example, the following input
4709 @multitable {12345678} {12345678} {12345678} {12345678}
4711 @tab 1 @tab 2 @tab 3
4719 @multitable {12345678} {12345678} {12345678} {12345678} {12345678} {12345678} {12345678}
4721 @tab 1 @tab 2 @tab 3 @tab @tab 4 @tab 5
4724 @xref{Tabs and Fields}.
4726 @c ---------------------------------------------------------------------
4728 @node Implicit Line Breaks, Input Conventions, Tab Stops, Text
4729 @subsection Implicit Line Breaks
4730 @cindex implicit line breaks
4731 @cindex implicit breaks of lines
4732 @cindex line, implicit breaks
4733 @cindex break, implicit
4736 An important concept in @code{gtroff} is the @dfn{break}. When a break
4737 occurs, @code{gtroff} outputs the partially filled line
4738 (unjustified), and resumes collecting and filling text on the next output
4744 @cindex blank line macro (@code{blm})
4745 There are several ways to cause a break in @code{gtroff}. A blank
4746 line not only causes a break, but it also outputs a one-line vertical
4747 space (effectively a blank line). Note that this behaviour can be
4748 modified with the blank line macro request @code{blm}.
4749 @xref{Blank Line Traps}.
4753 A line that begins with a space causes a break and the space is
4754 output at the beginning of the next line. Note that this space isn't
4755 adjusted, even in fill mode.
4757 The end of file also causes a break -- otherwise the last line of
4758 the document may vanish!
4760 Certain requests also cause breaks, implicitly or explicitly. This is
4761 discussed in @ref{Manipulating Filling and Adjusting}.
4763 @c ---------------------------------------------------------------------
4765 @node Input Conventions, Input Encodings, Implicit Line Breaks, Text
4766 @subsection Input Conventions
4767 @cindex input conventions
4768 @cindex conventions for input
4770 Since @code{gtroff} does filling automatically, it is traditional in
4771 @code{groff} not to try and type things in as nicely formatted
4772 paragraphs. These are some conventions commonly used when typing
4777 Break lines after punctuation, particularly at the end of a sentence
4778 and in other logical places. Keep separate phrases on lines by
4779 themselves, as entire phrases are often added or deleted when editing.
4782 Try to keep lines less than 40-60@tie{}characters, to allow space for
4783 inserting more text.
4786 Do not try to do any formatting in a @acronym{WYSIWYG} manner (i.e.,
4787 don't try using spaces to get proper indentation).
4790 @c ---------------------------------------------------------------------
4792 @node Input Encodings, , Input Conventions, Text
4793 @subsection Input Encodings
4795 Currently, the following input encodings are available.
4799 @cindex encoding, input, @acronym{EBCDIC}
4800 @cindex @acronym{EBCDIC}, input encoding
4801 @cindex input encoding, @acronym{EBCDIC}
4802 @cindex encoding, input, cp1047
4803 @cindex cp1047, input encoding
4804 @cindex input encoding, cp1047
4805 @cindex IBM cp1047 input encoding
4807 This input encoding works only on @acronym{EBCDIC} platforms (and vice
4808 versa, the other input encodings don't work with @acronym{EBCDIC}); the
4809 file @file{cp1047.tmac} is by default loaded at start-up.
4812 @cindex encoding, input, @w{latin-1} (ISO @w{8859-1})
4813 @cindex @w{latin-1} (ISO @w{8859-1}), input encoding
4814 @cindex ISO @w{8859-1} (@w{latin-1}), input encoding
4815 @cindex input encoding, @w{latin-1} (ISO @w{8859-1})
4817 This is the default input encoding on non-@acronym{EBCDIC} platforms;
4818 the file @file{latin1.tmac} is loaded at start-up.
4821 @cindex encoding, input, @w{latin-2} (ISO @w{8859-2})
4822 @cindex @w{latin-2} (ISO @w{8859-2}), input encoding
4823 @cindex ISO @w{8859-2} (@w{latin-2}), input encoding
4824 @cindex input encoding, @w{latin-2} (ISO @w{8859-2})
4826 To use this encoding, either say @w{@samp{.mso latin2.tmac}} at the very
4827 beginning of your document or use @samp{-mlatin2} as a command line
4828 argument for @code{groff}.
4830 @item latin-9 (latin-0)
4831 @cindex encoding, input, @w{latin-9} (@w{latin-0}, ISO @w{8859-15})
4832 @cindex @w{latin-9} (@w{latin-0}, ISO @w{8859-15}), input encoding
4833 @cindex ISO @w{8859-15} (@w{latin-9}, @w{latin-0}), input encoding
4834 @cindex input encoding, @w{latin-9} (@w{latin-9}, ISO @w{8859-15})
4836 This encoding is intended (at least in Europe) to replace @w{latin-1}
4837 encoding. The main difference to @w{latin-1} is that @w{latin-9}
4838 contains the Euro character. To use this encoding, either say
4839 @w{@samp{.mso latin9.tmac}} at the very beginning of your document or
4840 use @samp{-mlatin9} as a command line argument for @code{groff}.
4843 Note that it can happen that some input encoding characters are not
4844 available for a particular output device. For example, saying
4847 groff -Tlatin1 -mlatin9 ...
4851 will fail if you use the Euro character in the input. Usually, this
4852 limitation is present only for devices which have a limited set of
4853 output glyphs (e.g.@: @option{-Tascii} and @option{-Tlatin1}); for other
4854 devices it is usually sufficient to install proper fonts which contain
4855 the necessary glyphs.
4857 @pindex freeeuro.pfa
4859 Due to the importance of the Euro glyph in Europe, the groff package now
4860 comes with a @sc{PostScript} font called @file{freeeuro.pfa} which
4861 provides various glyph shapes for the Euro. With other words,
4862 @w{latin-9} encoding is supported for the @option{-Tps} device out of
4863 the box (@w{latin-2} isn't).
4865 By its very nature, @option{-Tutf8} supports all input encodings;
4866 @option{-Tdvi} has support for both @w{latin-2} and @w{latin-9} if the
4867 command line @option{-mec} is used also to load the file @file{ec.tmac}
4868 (which flips to the EC fonts).
4871 @c =====================================================================
4873 @node Measurements, Expressions, Text, gtroff Reference
4874 @section Measurements
4875 @cindex measurements
4877 @cindex units of measurement
4878 @cindex basic unit (@code{u})
4879 @cindex machine unit (@code{u})
4880 @cindex measurement unit
4881 @cindex @code{u} unit
4882 @cindex unit, @code{u}
4883 @code{gtroff} (like many other programs) requires numeric parameters to
4884 specify various measurements. Most numeric parameters@footnote{those
4885 that specify vertical or horizontal motion or a type size} may have a
4886 @dfn{measurement unit} attached. These units are specified as a single
4887 character which immediately follows the number or expression. Each of
4888 these units are understood, by @code{gtroff}, to be a multiple of its
4889 @dfn{basic unit}. So, whenever a different measurement unit is
4890 specified @code{gtroff} converts this into its @dfn{basic units}. This
4891 basic unit, represented by a @samp{u}, is a device dependent measurement
4892 which is quite small, ranging from 1/75@dmn{th} to 1/72000@dmn{th} of an
4893 inch. The values may be given as fractional numbers; however,
4894 fractional basic units are always rounded to integers.
4896 Some of the measurement units are completely independent of any of the
4897 current settings (e.g.@: type size) of @code{gtroff}.
4901 @cindex inch unit (@code{i})
4902 @cindex @code{i} unit
4903 @cindex unit, @code{i}
4904 Inches. An antiquated measurement unit still in use in certain
4905 backwards countries with incredibly low-cost computer equipment. One
4906 inch is equal to@tie{}2.54@dmn{cm}.
4909 @cindex centimeter unit (@code{c})
4910 @cindex @code{c} unit
4911 @cindex unit, @code{c}
4912 Centimeters. One centimeter is equal to@tie{}0.3937@dmn{in}.
4915 @cindex point unit (@code{p})
4916 @cindex @code{p} unit
4917 @cindex unit, @code{p}
4918 Points. This is a typesetter's measurement used for measure type size.
4919 It is 72@tie{}points to an inch.
4922 @cindex pica unit (@code{P})
4923 @cindex @code{P} unit
4924 @cindex unit, @code{P}
4925 Pica. Another typesetting measurement. 6@tie{}Picas to an inch (and
4926 12@tie{}points to a pica).
4930 @cindex @code{s} unit
4931 @cindex unit, @code{s}
4932 @cindex @code{z} unit
4933 @cindex unit, @code{z}
4934 @xref{Fractional Type Sizes}, for a discussion of these units.
4937 @cindex @code{f} unit
4938 @cindex unit, @code{f}
4939 Fractions. Value is 65536.
4940 @xref{Colors}, for usage.
4943 The other measurements understood by @code{gtroff} depend on
4944 settings currently in effect in @code{gtroff}. These are very useful
4945 for specifying measurements which should look proper with any size of
4950 @cindex em unit (@code{m})
4951 @cindex @code{m} unit
4952 @cindex unit, @code{m}
4953 Ems. This unit is equal to the current font size in points. So called
4954 because it is @emph{approximately} the width of the letter@tie{}@samp{m}
4955 in the current font.
4958 @cindex en unit (@code{n})
4959 @cindex @code{n} unit
4960 @cindex unit, @code{n}
4961 Ens. In @code{groff}, this is half of an em.
4964 @cindex vertical space unit (@code{v})
4965 @cindex space, vertical, unit (@code{v})
4966 @cindex @code{v} unit
4967 @cindex unit, @code{v}
4968 Vertical space. This is equivalent to the current line spacing.
4969 @xref{Sizes}, for more information about this.
4972 @cindex @code{M} unit
4973 @cindex unit, @code{M}
4981 @c ---------------------------------------------------------------------
4983 @node Default Units, , Measurements, Measurements
4984 @subsection Default Units
4985 @cindex default units
4986 @cindex units, default
4988 Many requests take a default unit. While this can be helpful at times,
4989 it can cause strange errors in some expressions. For example, the line
4990 length request expects em units. Here are several attempts to get a
4991 line length of 3.5@tie{}inches and their results:
4997 (7 / 2)u @result{} 0i
4999 7i/2u @result{} 3.5i
5003 Everything is converted to basic units first. In the above example it
5004 is assumed that 1@dmn{i} equals@tie{}240@dmn{u}, and 1@dmn{m}
5005 equals@tie{}10@dmn{p} (thus 1@dmn{m} equals@tie{}33@dmn{u}). The value
5006 7@dmn{i}/2 is first handled as 7@dmn{i}/2@dmn{m}, then converted to
5007 1680@dmn{u}/66@dmn{u} which is 25@dmn{u}, and this is approximately
5008 0.1@dmn{i}. As can be seen, a scaling indicator after a closing
5009 parenthesis is simply ignored.
5011 @cindex measurements, specifying safely
5012 Thus, the safest way to specify measurements is to always
5013 attach a scaling indicator. If you want to multiply or divide by a
5014 certain scalar value, use @samp{u} as the unit for that value.
5017 @c =====================================================================
5019 @node Expressions, Identifiers, Measurements, gtroff Reference
5020 @section Expressions
5023 @code{gtroff} has most arithmetic operators common to other languages:
5027 @cindex arithmetic operators
5028 @cindex operators, arithmetic
5034 Arithmetic: @samp{+} (addition), @samp{-} (subtraction), @samp{/}
5035 (division), @samp{*} (multiplication), @samp{%} (modulo).
5037 @code{gtroff} only provides integer arithmetic. The internal type used
5038 for computing results is @samp{int}, which is usually a 32@dmn{bit}
5042 @cindex comparison operators
5043 @cindex operators, comparison
5050 Comparison: @samp{<} (less than), @samp{>} (greater than), @samp{<=}
5051 (less than or equal), @samp{>=} (greater than or equal), @samp{=}
5052 (equal), @samp{==} (the same as @samp{=}).
5055 @cindex logical operators
5056 @cindex operators, logical
5062 @opindex @r{<colon>}
5064 Logical: @samp{&} (logical and), @samp{:} (logical or).
5067 @cindex unary operators
5068 @cindex operators, unary
5072 @cindex @code{if} request, and the @samp{!} operator
5073 @cindex @code{while} request, and the @samp{!} operator
5074 Unary operators: @samp{-} (negating, i.e.@: changing the sign), @samp{+}
5075 (just for completeness; does nothing in expressions), @samp{!} (logical
5076 not; this works only within @code{if} and @code{while} requests). See
5077 below for the use of unary operators in motion requests.
5080 @cindex extremum operators (@code{>?}, @code{<?})
5081 @cindex operators, extremum (@code{>?}, @code{<?})
5084 Extrema: @samp{>?} (maximum), @samp{<?} (minimum).
5091 .nr z (\n[x] >? \n[y])
5095 The register@tie{}@code{z} now contains@tie{}5.
5098 @cindex scaling operator
5099 @cindex operator, scaling
5100 Scaling: @code{(@var{c};@var{e})}. Evaluate@tie{}@var{e} using@tie{}@var{c}
5101 as the default scaling indicator. If @var{c} is missing, ignore scaling
5102 indicators in the evaluation of@tie{}@var{e}.
5106 @cindex order of evaluation in expressions
5107 @cindex expression, order of evaluation
5110 Parentheses may be used as in any other language. However, in
5111 @code{gtroff} they are necessary to ensure order of evaluation.
5112 @code{gtroff} has no operator precedence; expressions are evaluated left
5113 to right. This means that @code{gtroff} evaluates @samp{3+5*4} as if it were
5114 parenthesized like @samp{(3+5)*4}, not as @samp{3+(5*4)}, as might be
5117 @cindex @code{+}, and page motion
5118 @cindex @code{-}, and page motion
5119 @cindex motion operators
5120 @cindex operators, motion
5121 For many requests which cause a motion on the page, the unary operators
5122 @samp{+} and @samp{-} work differently if leading an expression. They
5123 then indicate a motion relative to the current position (down or up,
5126 @cindex @code{|}, and page motion
5127 @cindex absolute position operator (@code{|})
5128 @cindex position, absolute, operator (@code{|})
5129 Similarly, a leading @samp{|} operator indicates an absolute position.
5130 For vertical movements, it specifies the distance from the top of the
5131 page; for horizontal movements, it gives the distance from the beginning
5132 of the @emph{input} line.
5134 @cindex @code{bp} request, using @code{+} and@tie{}@code{-}
5135 @cindex @code{in} request, using @code{+} and@tie{}@code{-}
5136 @cindex @code{ll} request, using @code{+} and@tie{}@code{-}
5137 @cindex @code{lt} request, using @code{+} and@tie{}@code{-}
5138 @cindex @code{nm} request, using @code{+} and@tie{}@code{-}
5139 @cindex @code{nr} request, using @code{+} and@tie{}@code{-}
5140 @cindex @code{pl} request, using @code{+} and@tie{}@code{-}
5141 @cindex @code{pn} request, using @code{+} and@tie{}@code{-}
5142 @cindex @code{po} request, using @code{+} and@tie{}@code{-}
5143 @cindex @code{ps} request, using @code{+} and@tie{}@code{-}
5144 @cindex @code{pvs} request, using @code{+} and@tie{}@code{-}
5145 @cindex @code{rt} request, using @code{+} and@tie{}@code{-}
5146 @cindex @code{ti} request, using @code{+} and@tie{}@code{-}
5147 @cindex @code{\H}, using @code{+} and@tie{}@code{-}
5148 @cindex @code{\R}, using @code{+} and@tie{}@code{-}
5149 @cindex @code{\s}, using @code{+} and@tie{}@code{-}
5150 @samp{+} and @samp{-} are also treated differently by the following
5151 requests and escapes: @code{bp}, @code{in}, @code{ll}, @code{lt},
5152 @code{nm}, @code{nr}, @code{pl}, @code{pn}, @code{po}, @code{ps},
5153 @code{pvs}, @code{rt}, @code{ti}, @code{\H}, @code{\R}, and @code{\s}.
5154 Here, leading plus and minus signs indicate increments and decrements.
5156 @xref{Setting Registers}, for some examples.
5158 @Defesc {\\B, ', anything, '}
5159 @cindex numeric expression, valid
5160 @cindex valid numeric expression
5161 Return@tie{}1 if @var{anything} is a valid numeric expression;
5162 or@tie{}0 if @var{anything} is empty or not a valid numeric expression.
5165 @cindex space characters, in expressions
5166 @cindex expressions, and space characters
5167 Due to the way arguments are parsed, spaces are not allowed in
5168 expressions, unless the entire expression is surrounded by parentheses.
5170 @xref{Request and Macro Arguments}, and @ref{Conditionals and Loops}.
5173 @c =====================================================================
5175 @node Identifiers, Embedded Commands, Expressions, gtroff Reference
5176 @section Identifiers
5179 Like any other language, @code{gtroff} has rules for properly formed
5180 @dfn{identifiers}. In @code{gtroff}, an identifier can be made up of
5181 almost any printable character, with the exception of the following
5186 @cindex whitespace characters
5187 @cindex newline character
5188 @cindex character, whitespace
5189 Whitespace characters (spaces, tabs, and newlines).
5192 @cindex character, backspace
5193 @cindex backspace character
5194 @cindex @acronym{EBCDIC} encoding of backspace
5195 Backspace (@acronym{ASCII}@tie{}@code{0x08} or
5196 @acronym{EBCDIC}@tie{}@code{0x16}) and character code @code{0x01}.
5199 @cindex invalid input characters
5200 @cindex input characters, invalid
5201 @cindex characters, invalid input
5203 The following input characters are invalid and are ignored if
5204 @code{groff} runs on a machine based on @acronym{ASCII}, causing a
5205 warning message of type @samp{input} (see @ref{Debugging}, for more
5206 details): @code{0x00}, @code{0x0B}, @code{0x0D}-@code{0x1F},
5207 @code{0x80}-@code{0x9F}.
5209 And here are the invalid input characters if @code{groff} runs on an
5210 @acronym{EBCDIC} host: @code{0x00}, @code{0x08}, @code{0x09},
5211 @code{0x0B}, @code{0x0D}-@code{0x14}, @code{0x17}-@code{0x1F},
5212 @code{0x30}-@code{0x3F}.
5214 Currently, some of these reserved codepoints are used internally, thus
5215 making it non-trivial to extend @code{gtroff} to cover Unicode or other
5216 character sets and encodings which use characters of these ranges.
5218 Note that invalid characters are removed before parsing; an
5219 identifier @code{foo}, followed by an invalid character, followed by
5220 @code{bar} is treated as @code{foobar}.
5223 For example, any of the following is valid.
5233 @cindex @code{]}, as part of an identifier
5235 Note that identifiers longer than two characters with a closing bracket
5236 (@samp{]}) in its name can't be accessed with escape sequences which
5237 expect an identifier as a parameter. For example, @samp{\[foo]]}
5238 accesses the glyph @samp{foo}, followed by @samp{]}, whereas
5239 @samp{\C'foo]'} really asks for glyph @samp{foo]}.
5241 @cindex @code{refer}, and macro names starting with @code{[} or @code{]}
5242 @cindex @code{[}, macro names starting with, and @code{refer}
5243 @cindex @code{]}, macro names starting with, and @code{refer}
5244 @cindex macro names, starting with @code{[} or @code{]}, and @code{refer}
5245 To avoid problems with the @code{refer} preprocessor, macro names
5246 should not start with @samp{[} or @samp{]}. Due to backwards
5247 compatibility, everything after @samp{.[} and @samp{.]} is handled as
5248 a special argument to @code{refer}. For example, @samp{.[foo} makes
5249 @code{refer} to start a reference, using @samp{foo} as a parameter.
5251 @Defesc {\\A, ', ident, '}
5252 Test whether an identifier @var{ident} is valid in @code{gtroff}. It
5253 expands to the character@tie{}1 or@tie{}0 according to whether its
5254 argument (usually delimited by quotes) is or is not acceptable as the
5255 name of a string, macro, diversion, number register, environment, or
5256 font. It returns@tie{}0 if no argument is given. This is useful for
5257 looking up user input in some sort of associative table.
5265 @xref{Escapes}, for details on parameter delimiting characters.
5267 Identifiers in @code{gtroff} can be any length, but, in some contexts,
5268 @code{gtroff} needs to be told where identifiers end and text begins
5269 (and in different ways depending on their length):
5275 @cindex @code{(}, starting a two-character identifier
5277 Two characters. Must be prefixed with @samp{(} in some situations.
5279 @cindex @code{[}, starting an identifier
5280 @cindex @code{]}, ending an identifier
5282 Arbitrary length (@code{gtroff} only). Must be bracketed with @samp{[}
5283 and@tie{}@samp{]} in some situations. Any length identifier can be put
5287 @cindex undefined identifiers
5288 @cindex identifiers, undefined
5289 Unlike many other programming languages, undefined identifiers are
5290 silently ignored or expanded to nothing.
5291 When @code{gtroff} finds an undefined identifier, it emits a
5292 warning, doing the following:
5296 If the identifier is a string, macro, or diversion,
5297 @code{gtroff} defines it as empty.
5300 If the identifier is a number register, @code{gtroff}
5301 defines it with a value of@tie{}0.
5304 @xref{Warnings}., @ref{Interpolating Registers}, and @ref{Strings}.
5306 Note that macros, strings, and diversions share the same name space.
5323 As can be seen in the previous example, @code{gtroff} reuses the
5324 identifier @samp{xxx}, changing it from a macro to a diversion.
5325 No warning is emitted! The contents of the first macro definition is
5328 @xref{Interpolating Registers}, and @ref{Strings}.
5331 @c =====================================================================
5333 @node Embedded Commands, Registers, Identifiers, gtroff Reference
5334 @section Embedded Commands
5335 @cindex embedded commands
5336 @cindex commands, embedded
5338 Most documents need more functionality beyond filling, adjusting and
5339 implicit line breaking. In order to gain further functionality,
5340 @code{gtroff} allows commands to be embedded into the text, in two ways.
5342 The first is a @dfn{request} which takes up an entire line, and does
5343 some large-scale operation (e.g.@: break lines, start new pages).
5345 The other is an @dfn{escape} which can be usually embedded anywhere
5346 in the text; most requests can accept it even as an argument.
5347 Escapes generally do more minor operations like sub- and superscripts,
5348 print a symbol, etc.
5356 @c ---------------------------------------------------------------------
5358 @node Requests, Macros, Embedded Commands, Embedded Commands
5359 @subsection Requests
5362 @cindex control character (@code{.})
5363 @cindex character, control (@code{.})
5364 @cindex no-break control character (@code{'})
5365 @cindex character, no-break control (@code{'})
5366 @cindex control character, no-break (@code{'})
5367 A request line begins with a control character, which is either a single
5368 quote (@samp{'}, the @dfn{no-break control character}) or a period
5369 (@samp{.}, the normal @dfn{control character}). These can be changed;
5370 see @ref{Character Translations}, for details. After this there may be
5371 optional tabs or spaces followed by an identifier which is the name of
5372 the request. This may be followed by any number of space-separated
5373 arguments (@emph{no} tabs here).
5375 @cindex structuring source code of documents or macro packages
5376 @cindex documents, structuring the source code
5377 @cindex macro packages, structuring the source code
5378 Since a control character followed by whitespace only is ignored, it
5379 is common practice to use this feature for structuring the source code
5380 of documents or macro packages.
5394 @cindex blank line macro (@code{blm})
5395 Another possibility is to use the blank line macro request @code{blm}
5396 by assigning an empty macro to it.
5401 .blm do-nothing \" activate blank line macro
5412 .blm \" deactivate blank line macro
5415 @xref{Blank Line Traps}.
5417 @cindex zero width space character (@code{\&})
5418 @cindex character, zero width space (@code{\&})
5419 @cindex space character, zero width (@code{\&})
5420 @cindex @code{\&}, escaping control characters
5421 To begin a line with a control character without it being interpreted,
5422 precede it with @code{\&}. This represents a zero width space, which
5423 means it does not affect the output.
5425 In most cases the period is used as a control character. Several
5426 requests cause a break implicitly; using the single quote control
5427 character prevents this.
5430 * Request and Macro Arguments::
5433 @node Request and Macro Arguments, , Requests, Requests
5434 @subsubsection Request and Macro Arguments
5435 @cindex request arguments
5436 @cindex macro arguments
5437 @cindex arguments to requests and macros
5439 Arguments to requests and macros are processed much like the shell:
5440 The line is split into arguments according to
5441 spaces.@footnote{Plan@tie{}9's @code{troff} implementation also allows
5442 tabs for argument separation -- @code{gtroff} intentionally doesn't
5445 @cindex spaces, in a macro argument
5446 An argument to a macro which is intended to contain spaces can either be
5447 enclosed in double quotes, or have the spaces @dfn{escaped} with
5448 backslashes. This is @emph{not} true for requests.
5450 Here are a few examples for a hypothetical macro @code{uh}:
5453 .uh The Mouse Problem
5454 .uh "The Mouse Problem"
5455 .uh The\ Mouse\ Problem
5458 @cindex @code{\~}, difference to @code{\@key{SP}}
5459 @cindex @code{\@key{SP}}, difference to @code{\~}
5461 The first line is the @code{uh} macro being called with 3 arguments,
5462 @samp{The}, @samp{Mouse}, and @samp{Problem}. The latter two have the
5463 same effect of calling the @code{uh} macro with one argument, @samp{The
5464 Mouse Problem}.@footnote{The last solution, i.e., using escaped spaces,
5465 is ``classical'' in the sense that it can be found in most @code{troff}
5466 documents. Nevertheless, it is not optimal in all situations, since
5467 @w{@samp{\ }} inserts a fixed-width, non-breaking space character which
5468 can't stretch. @code{gtroff} provides a different command @code{\~} to
5469 insert a stretchable, non-breaking space.}
5471 @cindex @code{"}, in a macro argument
5472 @cindex double quote, in a macro argument
5473 A double quote which isn't preceded by a space doesn't start a macro
5474 argument. If not closing a string, it is printed literally.
5479 .xxx a" "b c" "de"fg"
5483 has the arguments @samp{a"}, @w{@samp{b c}}, @samp{de}, and @samp{fg"}.
5484 Don't rely on this obscure behaviour!
5486 There are two possibilities to get a double quote reliably.
5490 Enclose the whole argument with double quotes and use two consecutive double
5491 quotes to represent a single one. This traditional solution has the
5492 disadvantage that double quotes don't survive argument expansion again if
5493 called in compatibility mode (using the @option{-C} option of @code{groff}):
5497 . tm xx: `\\$1' `\\$2' `\\$3'
5499 . yy "\\$1" "\\$2" "\\$3"
5502 . tm yy: `\\$1' `\\$2' `\\$3'
5504 .xx A "test with ""quotes""" .
5505 @result{} xx: `A' `test with "quotes"' `.'
5506 @result{} yy: `A' `test with ' `quotes""'
5510 If not in compatibility mode, you get the expected result
5513 xx: `A' `test with "quotes"' `.'
5514 yy: `A' `test with "quotes"' `.'
5518 since @code{gtroff} preserves the input level.
5521 Use the double quote glyph @code{\(dq}. This works with and without
5522 compatibility mode enabled since @code{gtroff} doesn't convert @code{\(dq}
5523 back to a double quote input character.
5525 Not that this method won't work with @acronym{UNIX} @code{troff} in general
5526 since the glyph `dq' isn't defined normally.
5529 @cindex @code{ds} request, and double quotes
5530 Double quotes in the @code{ds} request are handled differently.
5531 @xref{Strings}, for more details.
5533 @c ---------------------------------------------------------------------
5535 @node Macros, Escapes, Requests, Embedded Commands
5539 @code{gtroff} has a @dfn{macro} facility for defining a series of lines
5540 which can be invoked by name. They are called in the same manner as
5541 requests -- arguments also may be passed basically in the same manner.
5543 @xref{Writing Macros}, and @ref{Request and Macro Arguments}.
5545 @c ---------------------------------------------------------------------
5547 @node Escapes, , Macros, Embedded Commands
5551 Escapes may occur anywhere in the input to @code{gtroff}. They usually
5552 begin with a backslash and are followed by a single character which
5553 indicates the function to be performed. The escape character can be
5554 changed; see @ref{Character Translations}.
5556 Escape sequences which require an identifier as a parameter accept three
5557 possible syntax forms.
5561 The next single character is the identifier.
5563 @cindex @code{(}, starting a two-character identifier
5565 If this single character is an opening parenthesis, take the following
5566 two characters as the identifier. Note that there is no closing
5567 parenthesis after the identifier.
5569 @cindex @code{[}, starting an identifier
5570 @cindex @code{]}, ending an identifier
5572 If this single character is an opening bracket, take all characters
5573 until a closing bracket as the identifier.
5585 @cindex @code{'}, delimiting arguments
5586 @cindex argument delimiting characters
5587 @cindex characters, argument delimiting
5588 @cindex delimiting characters for arguments
5589 Other escapes may require several arguments and/or some special format.
5590 In such cases the argument is traditionally enclosed in single quotes
5591 (and quotes are always used in this manual for the definitions of escape
5592 sequences). The enclosed text is then processed according to what that
5593 escape expects. Example:
5599 @cindex @code{\o}, possible quote characters
5600 @cindex @code{\b}, possible quote characters
5601 @cindex @code{\X}, possible quote characters
5602 Note that the quote character can be replaced with any other character
5603 which does not occur in the argument (even a newline or a space
5604 character) in the following escapes: @code{\o}, @code{\b}, and
5605 @code{\X}. This makes e.g.
5614 @result{} A café in Paris
5618 possible, but it is better not to use this feature to avoid confusion.
5620 @cindex @code{\%}, used as delimiter
5621 @cindex @code{\@key{SP}}, used as delimiter
5622 @cindex @code{\|}, used as delimiter
5623 @cindex @code{\^}, used as delimiter
5624 @cindex @code{\@{}, used as delimiter
5625 @cindex @code{\@}}, used as delimiter
5626 @cindex @code{\'}, used as delimiter
5627 @cindex @code{\`}, used as delimiter
5628 @cindex @code{\-}, used as delimiter
5629 @cindex @code{\_}, used as delimiter
5630 @cindex @code{\!}, used as delimiter
5631 @cindex @code{\?}, used as delimiter
5632 @cindex @code{\@@}, used as delimiter
5633 @cindex @code{\)}, used as delimiter
5634 @cindex @code{\/}, used as delimiter
5635 @cindex @code{\,}, used as delimiter
5636 @cindex @code{\&}, used as delimiter
5638 @cindex @code{\:}, used as delimiter
5641 @cindex @code{\@r{<colon>}}, used as delimiter
5643 @cindex @code{\~}, used as delimiter
5644 @cindex @code{\0}, used as delimiter
5645 @cindex @code{\a}, used as delimiter
5646 @cindex @code{\c}, used as delimiter
5647 @cindex @code{\d}, used as delimiter
5648 @cindex @code{\e}, used as delimiter
5649 @cindex @code{\E}, used as delimiter
5650 @cindex @code{\p}, used as delimiter
5651 @cindex @code{\r}, used as delimiter
5652 @cindex @code{\t}, used as delimiter
5653 @cindex @code{\u}, used as delimiter
5654 The following escapes sequences (which are handled similarly to
5655 characters since they don't take a parameter) are also allowed as
5656 delimiters: @code{\%}, @w{@samp{\ }}, @code{\|}, @code{\^}, @code{\@{},
5657 @code{\@}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
5658 @code{\?}, @code{\@@}, @code{\)}, @code{\/}, @code{\,}, @code{\&},
5659 @code{\:}, @code{\~}, @code{\0}, @code{\a}, @code{\c}, @code{\d},
5660 @code{\e}, @code{\E}, @code{\p}, @code{\r}, @code{\t}, and @code{\u}.
5661 Again, don't use these if possible.
5663 @cindex @code{\A}, allowed delimiters
5664 @cindex @code{\B}, allowed delimiters
5665 @cindex @code{\Z}, allowed delimiters
5666 @cindex @code{\C}, allowed delimiters
5667 @cindex @code{\w}, allowed delimiters
5668 No newline characters as delimiters are allowed in the following
5669 escapes: @code{\A}, @code{\B}, @code{\Z}, @code{\C}, and @code{\w}.
5671 @cindex @code{\D}, allowed delimiters
5672 @cindex @code{\h}, allowed delimiters
5673 @cindex @code{\H}, allowed delimiters
5674 @cindex @code{\l}, allowed delimiters
5675 @cindex @code{\L}, allowed delimiters
5676 @cindex @code{\N}, allowed delimiters
5677 @cindex @code{\R}, allowed delimiters
5678 @cindex @code{\s}, allowed delimiters
5679 @cindex @code{\S}, allowed delimiters
5680 @cindex @code{\v}, allowed delimiters
5681 @cindex @code{\x}, allowed delimiters
5682 Finally, the escapes @code{\D}, @code{\h}, @code{\H}, @code{\l},
5683 @code{\L}, @code{\N}, @code{\R}, @code{\s}, @code{\S}, @code{\v},
5684 and @code{\x} can't use the following characters as delimiters:
5688 @cindex numbers, and delimiters
5689 @cindex digits, and delimiters
5690 The digits @code{0}-@code{9}.
5693 @cindex operators, as delimiters
5694 @cindex @code{+}, as delimiter
5695 @cindex @code{-}, as delimiter
5696 @cindex @code{/}, as delimiter
5697 @cindex @code{*}, as delimiter
5698 @cindex @code{%}, as delimiter
5699 @cindex @code{<}, as delimiter
5700 @cindex @code{>}, as delimiter
5701 @cindex @code{=}, as delimiter
5702 @cindex @code{&}, as delimiter
5704 @cindex @code{:}, as delimiter
5707 @cindex <colon>, as delimiter
5709 @cindex @code{(}, as delimiter
5710 @cindex @code{)}, as delimiter
5711 @cindex @code{.}, as delimiter
5712 The (single-character) operators @samp{+-/*%<>=&:().}.
5715 @cindex space character
5716 @cindex character, space
5717 @cindex tab character
5718 @cindex character, tab
5719 @cindex newline character
5720 @cindex character, newline
5721 The space, tab, and newline characters.
5724 @cindex @code{\%}, used as delimiter
5726 @cindex @code{\:}, used as delimiter
5729 @cindex @code{\@r{<colon>}}, used as delimiter
5731 @cindex @code{\@{}, used as delimiter
5732 @cindex @code{\@}}, used as delimiter
5733 @cindex @code{\'}, used as delimiter
5734 @cindex @code{\`}, used as delimiter
5735 @cindex @code{\-}, used as delimiter
5736 @cindex @code{\_}, used as delimiter
5737 @cindex @code{\!}, used as delimiter
5738 @cindex @code{\@@}, used as delimiter
5739 @cindex @code{\/}, used as delimiter
5740 @cindex @code{\c}, used as delimiter
5741 @cindex @code{\e}, used as delimiter
5742 @cindex @code{\p}, used as delimiter
5743 All escape sequences except @code{\%}, @code{\:}, @code{\@{}, @code{\@}},
5744 @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!}, @code{\@@},
5745 @code{\/}, @code{\c}, @code{\e}, and @code{\p}.
5748 @cindex printing backslash (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
5749 @cindex backslash, printing (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
5750 To have a backslash (actually, the current escape character) appear in the
5751 output several escapes are defined: @code{\\}, @code{\e} or @code{\E}.
5752 These are very similar, and only differ with respect to being used in
5753 macros or diversions. @xref{Character Translations}, for an exact
5754 description of those escapes.
5756 @xref{Implementation Differences}, @ref{Copy-in Mode}, and @ref{Diversions},
5757 @ref{Identifiers}, for more information.
5763 @node Comments, , Escapes, Escapes
5764 @subsubsection Comments
5767 Probably one of the most@footnote{Unfortunately, this is a lie. But
5768 hopefully future @code{gtroff} hackers will believe it @code{:-)}}
5769 common forms of escapes is the comment.
5772 Start a comment. Everything to the end of the input line is ignored.
5774 This may sound simple, but it can be tricky to keep the comments from
5775 interfering with the appearance of the final output.
5777 @cindex @code{ds}, @code{ds1} requests, and comments
5778 @cindex @code{as}, @code{as1} requests, and comments
5779 If the escape is to the right of some text or a request, that portion
5780 of the line is ignored, but the space leading up to it is noticed by
5781 @code{gtroff}. This only affects the @code{ds} and @code{as}
5782 request and its variants.
5784 @cindex tabs, before comments
5785 @cindex comments, lining up with tabs
5786 One possibly irritating idiosyncracy is that tabs must not be used to
5787 line up comments. Tabs are not treated as whitespace between the
5788 request and macro arguments.
5790 @cindex undefined request
5791 @cindex request, undefined
5792 A comment on a line by itself is treated as a blank line, because
5793 after eliminating the comment, that is all that remains:
5810 To avoid this, it is common to start the line with @code{.\"} which
5811 causes the line to be treated as an undefined request and thus ignored
5814 @cindex @code{'}, as a comment
5815 Another commenting scheme seen sometimes is three consecutive single
5816 quotes (@code{'''}) at the beginning of a line. This works, but
5817 @code{gtroff} gives a warning about an undefined macro (namely
5818 @code{''}), which is harmless, but irritating.
5822 To avoid all this, @code{gtroff} has a new comment mechanism using the
5823 @code{\#} escape. This escape works the same as @code{\"} except that
5824 the newline is also ignored:
5843 @Defreq {ig, [@Var{end}]}
5844 Ignore all input until @code{gtroff} encounters the macro named
5845 @code{.}@var{end} on a line by itself (or @code{..} if @var{end} is not
5846 specified). This is useful for commenting out large blocks of text:
5851 This is part of a large block
5852 of text that has been
5853 temporarily(?) commented out.
5855 We can restore it simply by removing
5856 the .ig request and the ".." at the
5859 More text text text...
5866 text text text@dots{} More text text text@dots{}
5870 Note that the commented-out block of text does not
5873 The input is read in copy-mode; auto-incremented registers @emph{are}
5874 affected (@pxref{Auto-increment}).
5878 @c =====================================================================
5880 @node Registers, Manipulating Filling and Adjusting, Embedded Commands, gtroff Reference
5884 Numeric variables in @code{gtroff} are called @dfn{registers}. There
5885 are a number of built-in registers, supplying anything from the date to
5886 details of formatting parameters.
5888 @xref{Identifiers}, for details on register identifiers.
5891 * Setting Registers::
5892 * Interpolating Registers::
5894 * Assigning Formats::
5895 * Built-in Registers::
5898 @c ---------------------------------------------------------------------
5900 @node Setting Registers, Interpolating Registers, Registers, Registers
5901 @subsection Setting Registers
5902 @cindex setting registers (@code{nr}, @code{\R})
5903 @cindex registers, setting (@code{nr}, @code{\R})
5905 Define or set registers using the @code{nr} request or the
5908 @DefreqList {nr, ident value}
5909 @DefescListEnd {\\R, ', ident value, '}
5910 Set number register @var{ident} to @var{value}. If @var{ident}
5911 doesn't exist, @code{gtroff} creates it.
5913 The argument to @code{\R} usually has to be enclosed in quotes.
5914 @xref{Escapes}, for details on parameter delimiting characters.
5916 The @code{\R} escape doesn't produce an input token in @code{gtroff};
5917 with other words, it vanishes completely after @code{gtroff} has
5921 For example, the following two lines are equivalent:
5924 .nr a (((17 + (3 * 4))) % 4)
5925 \R'a (((17 + (3 * 4))) % 4)'
5929 Both @code{nr} and @code{\R} have two additional special forms to
5930 increment or decrement a register.
5932 @DefreqList {nr, ident @t{+}@Var{value}}
5933 @DefreqItem {nr, ident @t{-}@Var{value}}
5934 @DefescItem {\\R, ', ident @t{+}value, '}
5935 @DefescListEnd {\\R, ', ident @t{-}value, '}
5936 Increment (decrement) register @var{ident} by @var{value}.
5945 @cindex negating register values
5946 To assign the negated value of a register to another register, some care
5947 must be taken to get the desired result:
5961 The surrounding parentheses prevent the interpretation of the minus sign
5962 as a decrementing operator. An alternative is to start the assignment
5978 @cindex removing number register (@code{rr})
5979 @cindex number register, removing (@code{rr})
5980 @cindex register, removing (@code{rr})
5981 Remove number register @var{ident}. If @var{ident} doesn't exist, the
5985 @Defreq {rnn, ident1 ident2}
5986 @cindex renaming number register (@code{rnn})
5987 @cindex number register, renaming (@code{rnn})
5988 @cindex register, renaming (@code{rnn})
5989 Rename number register @var{ident1} to @var{ident2}. If either
5990 @var{ident1} or @var{ident2} doesn't exist, the request is ignored.
5993 @Defreq {aln, ident1 ident2}
5994 @cindex alias, number register, creating (@code{aln})
5995 @cindex creating alias, for number register (@code{aln})
5996 @cindex number register, creating alias (@code{aln})
5997 @cindex register, creating alias (@code{aln})
5998 Create an alias @var{ident1} for a number register @var{ident2}. The
5999 new name and the old name are exactly equivalent. If @var{ident1} is
6000 undefined, a warning of type @samp{reg} is generated, and the request
6001 is ignored. @xref{Debugging}, for information about warnings.
6004 @c ---------------------------------------------------------------------
6006 @node Interpolating Registers, Auto-increment, Setting Registers, Registers
6007 @subsection Interpolating Registers
6008 @cindex interpolating registers (@code{\n})
6009 @cindex registers, interpolating (@code{\n})
6011 Numeric registers can be accessed via the @code{\n} escape.
6013 @DefescList {\\n, , i, }
6014 @DefescItem {\\n, @Lparen{}, id, }
6015 @DefescListEnd {\\n, @Lbrack{}, ident, @Rbrack{}}
6016 @cindex nested assignments
6017 @cindex assignments, nested
6018 @cindex indirect assignments
6019 @cindex assignments, indirect
6020 Interpolate number register with name @var{ident} (one-character
6021 name@tie{}@var{i}, two-character name @var{id}). This means that the value
6022 of the register is expanded in-place while @code{gtroff} is parsing the
6023 input line. Nested assignments (also called indirect assignments) are
6045 @c ---------------------------------------------------------------------
6047 @node Auto-increment, Assigning Formats, Interpolating Registers, Registers
6048 @subsection Auto-increment
6049 @cindex auto-increment
6050 @cindex increment, automatic
6052 Number registers can also be auto-incremented and auto-decremented.
6053 The increment or decrement value can be specified with a third
6054 argument to the @code{nr} request or @code{\R} escape.
6056 @Defreq {nr, ident value incr}
6057 @cindex @code{\R}, difference to @code{nr}
6058 Set number register @var{ident} to @var{value}; the increment for
6059 auto-incrementing is set to @var{incr}. Note that the @code{\R}
6060 escape doesn't support this notation.
6063 To activate auto-incrementing, the escape @code{\n} has a special
6066 @DefescList {\\n, +, i, }
6067 @DefescItem {\\n, -, i, }
6068 @DefescItem {\\n, @Lparen{}+, id, }
6069 @DefescItem {\\n, @Lparen{}-, id, }
6070 @DefescItem {\\n, +@Lparen{}, id, }
6071 @DefescItem {\\n, -@Lparen{}, id, }
6072 @DefescItem {\\n, @Lbrack{}+, ident, @Rbrack{}}
6073 @DefescItem {\\n, @Lbrack{}-, ident, @Rbrack{}}
6074 @DefescItem {\\n, +@Lbrack{}, ident, @Rbrack{}}
6075 @DefescListEnd {\\n, -@Lbrack{}, ident, @Rbrack{}}
6076 Before interpolating, increment or decrement @var{ident}
6077 (one-character name@tie{}@var{i}, two-character name @var{id}) by the
6078 auto-increment value as specified with the @code{nr} request (or the
6079 @code{\R} escape). If no auto-increment value has been specified,
6080 these syntax forms are identical to @code{\n}.
6089 \n+a, \n+a, \n+a, \n+a, \n+a
6091 \n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
6093 \n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
6101 -5, -10, -15, -20, -25
6105 @cindex increment value without changing the register
6106 @cindex value, incrementing without changing the register
6107 To change the increment value without changing the value of a register
6108 (@var{a} in the example), the following can be used:
6114 @c ---------------------------------------------------------------------
6116 @node Assigning Formats, Built-in Registers, Auto-increment, Registers
6117 @subsection Assigning Formats
6118 @cindex assigning formats (@code{af})
6119 @cindex formats, assigning (@code{af})
6121 When a register is used in the text of an input file (as opposed to
6122 part of an expression), it is textually replaced (or interpolated)
6123 with a representation of that number. This output format can be
6124 changed to a variety of formats (numbers, Roman numerals, etc.). This
6125 is done using the @code{af} request.
6127 @Defreq {af, ident format}
6128 Change the output format of a number register. The first argument
6129 @var{ident} is the name of the number register to be changed, and the
6130 second argument @var{format} is the output format. The following
6131 output formats are available:
6135 Decimal arabic numbers. This is the default format: 0, 1, 2,
6139 Decimal numbers with as many digits as specified. So, @samp{00} would
6140 result in printing numbers as 01, 02, 03,@tie{}@enddots{}
6142 In fact, any digit instead of zero will do; @code{gtroff} only counts
6143 how many digits are specified. As a consequence, @code{af}'s default
6144 format @samp{1} could be specified as @samp{0} also (and exactly this is
6145 returned by the @code{\g} escape, see below).
6148 @cindex Roman numerals
6149 @cindex numerals, Roman
6150 Upper-case Roman numerals: 0, I, II, III, IV,@tie{}@enddots{}
6153 Lower-case Roman numerals: 0, i, ii, iii, iv,@tie{}@enddots{}
6156 Upper-case letters: 0, A, B, C, @dots{},@tie{}Z, AA, AB,@tie{}@enddots{}
6159 Lower-case letters: 0, a, b, c, @dots{},@tie{}z, aa, ab,@tie{}@enddots{}
6162 Omitting the number register format causes a warning of type
6163 @samp{missing}. @xref{Debugging}, for more details. Specifying a
6164 nonexistent format causes an error.
6166 The following example produces @samp{10, X, j, 010}:
6170 .af a 1 \" the default format
6180 @cindex Roman numerals, maximum and minimum
6181 @cindex maximum values of Roman numerals
6182 @cindex minimum values of Roman numerals
6183 The largest number representable for the @samp{i} and @samp{I} formats
6184 is 39999 (or @minus{}39999); @acronym{UNIX} @code{troff} uses @samp{z}
6185 and @samp{w} to represent 10000 and 5000 in Roman numerals, and so does
6186 @code{gtroff}. Currently, the correct glyphs of Roman numeral five
6187 thousand and Roman numeral ten thousand (Unicode code points
6188 @code{U+2182} and @code{U+2181}, respectively) are not available.
6190 If @var{ident} doesn't exist, it is created.
6192 @cindex read-only register, changing format
6193 @cindex changing format, and read-only registers
6194 Changing the output format of a read-only register causes an error. It
6195 is necessary to first copy the register's value to a writeable register,
6196 then apply the @code{af} request to this other register.
6199 @DefescList {\\g, , i, }
6200 @DefescItem {\\g, @Lparen{}, id, }
6201 @DefescListEnd {\\g, @Lbrack{}, ident, @Rbrack{}}
6202 @cindex format of register (@code{\g})
6203 @cindex register, format (@code{\g})
6204 Return the current format of the specified register @var{ident}
6205 (one-character name@tie{}@var{i}, two-character name @var{id}). For
6206 example, @samp{\ga} after the previous example would produce the
6207 string @samp{000}. If the register hasn't been defined yet, nothing
6211 @c ---------------------------------------------------------------------
6213 @node Built-in Registers, , Assigning Formats, Registers
6214 @subsection Built-in Registers
6215 @cindex built-in registers
6216 @cindex registers, built-in
6218 The following lists some built-in registers which are not described
6219 elsewhere in this manual. Any register which begins with a @samp{.} is
6220 read-only. A complete listing of all built-in registers can be found in
6221 @ref{Register Index}.
6225 @cindex current input file name register (@code{.F})
6226 @cindex input file name, current, register (@code{.F})
6228 This string-valued register returns the current input file name.
6231 @cindex horizontal resolution register (@code{.H})
6232 @cindex resolution, horizontal, register (@code{.H})
6234 Horizontal resolution in basic units.
6240 @cindex mode, unsafe
6241 If @code{gtroff} is called with the @option{-U} command line option, the
6242 number register @code{.U} is set to@tie{}1, and zero otherwise.
6243 @xref{Groff Options}.
6246 @cindex vertical resolution register (@code{.V})
6247 @cindex resolution, vertical, register (@code{.V})
6249 Vertical resolution in basic units.
6252 @cindex seconds, current time (@code{seconds})
6253 @cindex time, current, seconds (@code{seconds})
6254 @cindex current time, seconds (@code{seconds})
6256 The number of seconds after the minute, normally in the range@tie{}0
6257 to@tie{}59, but can be up to@tie{}61 to allow for leap seconds. Initialized
6258 at start-up of @code{gtroff}.
6261 @cindex minutes, current time (@code{minutes})
6262 @cindex time, current, minutes (@code{minutes})
6263 @cindex current time, minutes (@code{minutes})
6265 The number of minutes after the hour, in the range@tie{}0 to@tie{}59.
6266 Initialized at start-up of @code{gtroff}.
6269 @cindex hours, current time (@code{hours})
6270 @cindex time, current, hours (@code{hours})
6271 @cindex current time, hours (@code{hours})
6273 The number of hours past midnight, in the range@tie{}0 to@tie{}23.
6274 Initialized at start-up of @code{gtroff}.
6277 @cindex day of the week register (@code{dw})
6278 @cindex date, day of the week register (@code{dw})
6280 Day of the week (1-7).
6283 @cindex day of the month register (@code{dy})
6284 @cindex date, day of the month register (@code{dy})
6286 Day of the month (1-31).
6289 @cindex month of the year register (@code{mo})
6290 @cindex date, month of the year register (@code{mo})
6292 Current month (1-12).
6295 @cindex date, year register (@code{year}, @code{yr})
6296 @cindex year, current, register (@code{year}, @code{yr})
6302 The current year minus@tie{}1900. Unfortunately, the documentation of
6303 @acronym{UNIX} Version@tie{}7's @code{troff} had a year@tie{}2000 bug: It
6304 incorrectly claimed that @code{yr} contains the last two digits of the
6305 year. That claim has never been true of either @acronym{AT&T}
6306 @code{troff} or GNU @code{troff}. Old @code{troff} input that looks
6310 '\" The following line stopped working after 1999
6311 This document was formatted in 19\n(yr.
6315 can be corrected as follows:
6318 This document was formatted in \n[year].
6322 or, to be portable to older @code{troff} versions, as follows:
6326 This document was formatted in \n(y4.
6333 @cindex input line number register (@code{.c}, @code{c.})
6334 @cindex line number, input, register (@code{.c}, @code{c.})
6335 The current @emph{input} line number. Register @samp{.c} is read-only,
6336 whereas @samp{c.} (a @code{gtroff} extension) is writable also,
6337 affecting both @samp{.c} and @samp{c.}.
6341 @cindex output line number register (@code{ln})
6342 @cindex line number, output, register (@code{ln})
6343 The current @emph{output} line number after a call to the @code{nm}
6344 request to activate line numbering.
6346 @xref{Miscellaneous}, for more information about line numbering.
6350 @cindex major version number register (@code{.x})
6351 @cindex version number, major, register (@code{.x})
6352 The major version number. For example, if the version number
6353 is 1.03 then @code{.x} contains@tie{}@samp{1}.
6357 @cindex minor version number register (@code{.y})
6358 @cindex version number, minor, register (@code{.y})
6359 The minor version number. For example, if the version number
6360 is 1.03 then @code{.y} contains@tie{}@samp{03}.
6364 @cindex revision number register (@code{.Y})
6365 The revision number of @code{groff}.
6369 @cindex process ID of @code{gtroff} register (@code{$$})
6370 @cindex @code{gtroff}, process ID register (@code{$$})
6371 The process ID of @code{gtroff}.
6375 @cindex @code{gtroff}, identification register (@code{.g})
6376 @cindex GNU-specific register (@code{.g})
6377 Always@tie{}1. Macros should use this to determine whether they are
6378 running under GNU @code{troff}.
6382 @cindex @acronym{ASCII} approximation output register (@code{.A})
6383 If the command line option @option{-a} is used to produce an
6384 @acronym{ASCII} approximation of the output, this is set to@tie{}1, zero
6385 otherwise. @xref{Groff Options}.
6389 This register is set to@tie{}1 (and to@tie{}0 otherwise) if the current
6390 page is actually being printed, i.e., if the @option{-o} option is being
6391 used to only print selected pages. @xref{Groff Options}, for more
6396 If @code{gtroff} is called with the @option{-T} command line option, the
6397 number register @code{.T} is set to@tie{}1, and zero otherwise.
6398 @xref{Groff Options}.
6402 @cindex output device name string register (@code{.T})
6403 A single read-write string register which contains the current output
6404 device (for example, @samp{latin1} or @samp{ps}). This is the only
6405 string register defined by @code{gtroff}.
6409 @c =====================================================================
6411 @node Manipulating Filling and Adjusting, Manipulating Hyphenation, Registers, gtroff Reference
6412 @section Manipulating Filling and Adjusting
6413 @cindex manipulating filling and adjusting
6414 @cindex filling and adjusting, manipulating
6415 @cindex adjusting and filling, manipulating
6416 @cindex justifying text
6417 @cindex text, justifying
6421 @cindex @code{bp} request, causing implicit linebreak
6422 @cindex @code{ce} request, causing implicit linebreak
6423 @cindex @code{cf} request, causing implicit linebreak
6424 @cindex @code{fi} request, causing implicit linebreak
6425 @cindex @code{fl} request, causing implicit linebreak
6426 @cindex @code{in} request, causing implicit linebreak
6427 @cindex @code{nf} request, causing implicit linebreak
6428 @cindex @code{rj} request, causing implicit linebreak
6429 @cindex @code{sp} request, causing implicit linebreak
6430 @cindex @code{ti} request, causing implicit linebreak
6431 @cindex @code{trf} request, causing implicit linebreak
6432 Various ways of causing @dfn{breaks} were given in @ref{Implicit Line
6433 Breaks}. The @code{br} request likewise causes a break. Several
6434 other requests also cause breaks, but implicitly. These are
6435 @code{bp}, @code{ce}, @code{cf}, @code{fi}, @code{fl}, @code{in},
6436 @code{nf}, @code{rj}, @code{sp}, @code{ti}, and @code{trf}.
6439 Break the current line, i.e., the input collected so far is emitted
6442 If the no-break control character is used, @code{gtroff} suppresses
6453 Initially, @code{gtroff} fills and adjusts text to both margins.
6454 Filling can be disabled via the @code{nf} request and re-enabled with
6455 the @code{fi} request.
6459 @cindex fill mode (@code{fi})
6460 @cindex mode, fill (@code{fi})
6461 Activate fill mode (which is the default). This request implicitly
6462 enables adjusting; it also inserts a break in the text currently being
6463 filled. The read-only number register @code{.u} is set to@tie{}1.
6465 The fill mode status is associated with the current environment
6466 (@pxref{Environments}).
6468 See @ref{Line Control}, for interaction with the @code{\c} escape.
6472 @cindex no-fill mode (@code{nf})
6473 @cindex mode, no-fill (@code{nf})
6474 Activate no-fill mode. Input lines are output as-is, retaining line
6475 breaks and ignoring the current line length. This command implicitly
6476 disables adjusting; it also causes a break. The number register
6477 @code{.u} is set to@tie{}0.
6479 The fill mode status is associated with the current environment
6480 (@pxref{Environments}).
6482 See @ref{Line Control}, for interaction with the @code{\c} escape.
6485 @DefreqList {ad, [@Var{mode}]}
6489 Activation and deactivation of adjusting is done implicitly with
6490 calls to the @code{fi} or @code{nf} requests.
6492 @var{mode} can have one of the following values:
6496 @cindex ragged-right
6497 Adjust text to the left margin. This produces what is traditionally
6498 called ragged-right text.
6502 Adjust text to the right margin, producing ragged-left text.
6505 @cindex centered text
6506 @cindex @code{ce} request, difference to @samp{.ad@tie{}c}
6507 Center filled text. This is different to the @code{ce} request which
6508 only centers text without filling.
6512 Justify to both margins. This is the default used by @code{gtroff}.
6515 Finally, @var{mode} can be the numeric argument returned by the @code{.j}
6518 With no argument, @code{gtroff} adjusts lines in the same way it did
6519 before adjusting was deactivated (with a call to @code{na}, for
6531 .ad \" back to centering
6533 .ad \n[ad] \" back to right justifying
6536 @cindex adjustment mode register (@code{.j})
6537 The current adjustment mode is available in the read-only number
6538 register @code{.j}; it can be stored and subsequently used to set
6541 The adjustment mode status is associated with the current environment
6542 (@pxref{Environments}).
6546 Disable adjusting. This request won't change the current adjustment
6547 mode: A subsequent call to @code{ad} uses the previous adjustment
6550 The adjustment mode status is associated with the current environment
6551 (@pxref{Environments}).
6555 @DefescListEnd {\\p, , , }
6556 Adjust the current line and cause a break.
6558 In most cases this produces very ugly results since @code{gtroff}
6559 doesn't have a sophisticated paragraph building algorithm (as @TeX{}
6560 have, for example); instead, @code{gtroff} fills and adjusts a paragraph
6564 This is an uninteresting sentence.
6565 This is an uninteresting sentence.\p
6566 This is an uninteresting sentence.
6573 This is an uninteresting sentence. This is an
6574 uninteresting sentence.
6575 This is an uninteresting sentence.
6579 @DefreqList {ss, word_space_size [@Var{sentence_space_size}]}
6581 @DefregListEnd {.sss}
6582 @cindex word space size register (@code{.ss})
6583 @cindex size of word space register (@code{.ss})
6584 @cindex space between words register (@code{.ss})
6585 @cindex sentence space size register (@code{.sss})
6586 @cindex size of sentence space register (@code{.sss})
6587 @cindex space between sentences register (@code{.sss})
6588 Change the size of a space between words. It takes its units as one
6589 twelfth of the space width parameter for the current font.
6590 Initially both the @var{word_space_size} and @var{sentence_space_size}
6591 are@tie{}12. In fill mode, the values specify the minimum distance.
6595 If two arguments are given to the @code{ss} request, the second
6596 argument sets the sentence space size. If the second argument is not
6597 given, sentence space size is set to @var{word_space_size}. The
6598 sentence space size is used in two circumstances: If the end of a
6599 sentence occurs at the end of a line in fill mode, then both an
6600 inter-word space and a sentence space are added; if two spaces follow
6601 the end of a sentence in the middle of a line, then the second space
6602 is a sentence space. If a second argument is never given to the
6603 @code{ss} request, the behaviour of @acronym{UNIX} @code{troff} is the
6604 same as that exhibited by GNU @code{troff}. In GNU @code{troff}, as
6605 in @acronym{UNIX} @code{troff}, a sentence should always be followed
6606 by either a newline or two spaces.
6608 The read-only number registers @code{.ss} and @code{.sss} hold the
6609 values of the parameters set by the first and second arguments of the
6612 The word space and sentence space values are associated with the current
6613 environment (@pxref{Environments}).
6615 Contrary to @acronym{AT&T} @code{troff}, this request is @emph{not}
6616 ignored if a TTY output device is used; the given values are then
6617 rounded down to a multiple of@tie{}12 (@pxref{Implementation Differences}).
6619 The request is ignored if there is no parameter.
6621 @cindex discardable horizontal space
6622 @cindex space, discardable, horizontal
6623 @cindex horizontal discardable space
6624 Another useful application of the @code{ss} request is to insert
6625 discardable horizontal space, i.e., space which is discarded at a line
6626 break. For example, paragraph-style footnotes could be separated this
6631 1.\ This is the first footnote.\c
6635 2.\ This is the second footnote.
6642 1. This is the first footnote. 2. This
6643 is the second footnote.
6647 Note that the @code{\h} escape produces unbreakable space.
6650 @DefreqList {ce, [@Var{nnn}]}
6651 @DefregListEnd {.ce}
6652 @cindex centering lines (@code{ce})
6653 @cindex lines, centering (@code{ce})
6654 Center text. While the @w{@samp{.ad c}} request also centers text,
6655 it fills the text as well. @code{ce} does not fill the
6656 text it affects. This request causes a break. The number of lines
6657 still to be centered is associated with the current environment
6658 (@pxref{Environments}).
6660 The following example demonstrates the differences.
6666 This is a small text fragment which shows the differences
6667 between the `.ce' and the `.ad c' request.
6671 This is a small text fragment which shows the differences
6672 between the `.ce' and the `.ad c' request.
6676 And here the result:
6679 This is a small text fragment which
6680 shows the differences
6681 between the `.ce' and the `.ad c' request.
6683 This is a small text fragment which
6684 shows the differences between the `.ce'
6685 and the `.ad c' request.
6688 With no arguments, @code{ce} centers the next line of text. @var{nnn}
6689 specifies the number of lines to be centered. If the argument is zero
6690 or negative, centering is disabled.
6692 The basic length for centering text is the line length (as set with the
6693 @code{ll} request) minus the indentation (as set with the @code{in}
6694 request). Temporary indentation is ignored.
6696 As can be seen in the previous example, it is a common idiom to turn
6697 on centering for a large number of lines, and to turn off centering
6698 after text to be centered. This is useful for any request which takes
6699 a number of lines as an argument.
6701 The @code{.ce} read-only number register contains the number of lines
6702 remaining to be centered, as set by the @code{ce} request.
6705 @DefreqList {rj, [@Var{nnn}]}
6706 @DefregListEnd {.rj}
6707 @cindex justifying text (@code{rj})
6708 @cindex text, justifying (@code{rj})
6709 @cindex right-justifying (@code{rj})
6710 Justify unfilled text to the right margin. Arguments are identical to
6711 the @code{ce} request. The @code{.rj} read-only number register is
6712 the number of lines to be right-justified as set by the @code{rj}
6713 request. This request causes a break. The number of lines still to be
6714 right-justified is associated with the current environment
6715 (@pxref{Environments}).
6719 @c =====================================================================
6721 @node Manipulating Hyphenation, Manipulating Spacing, Manipulating Filling and Adjusting, gtroff Reference
6722 @section Manipulating Hyphenation
6723 @cindex manipulating hyphenation
6724 @cindex hyphenation, manipulating
6727 Here a description of requests which influence hyphenation.
6729 @DefreqList {hy, [@Var{mode}]}
6730 @DefregListEnd {.hy}
6731 Enable hyphenation. The request has an optional numeric argument,
6732 @var{mode}, to restrict hyphenation if necessary:
6736 The default argument if @var{mode} is omitted. Hyphenate without
6737 restrictions. This is also the start-up value of @code{gtroff}.
6740 Do not hyphenate the last word on a page or column.
6743 Do not hyphenate the last two characters of a word.
6746 Do not hyphenate the first two characters of a word.
6749 Values in the previous table are additive. For example, the
6750 value@tie{}12 causes @code{gtroff} to neither hyphenate the last
6751 two nor the first two characters of a word.
6753 @cindex hyphenation restrictions register (@code{.hy})
6754 The current hyphenation restrictions can be found in the read-only
6755 number register @samp{.hy}.
6757 The hyphenation mode is associated with the current environment
6758 (@pxref{Environments}).
6762 Disable hyphenation (i.e., set the hyphenation mode to zero). Note
6763 that the hyphenation mode of the last call to @code{hy} is not
6766 The hyphenation mode is associated with the current environment
6767 (@pxref{Environments}).
6770 @DefreqList {hlm, [@Var{nnn}]}
6772 @DefregListEnd {.hlc}
6773 @cindex explicit hyphen (@code{\%})
6774 @cindex hyphen, explicit (@code{\%})
6775 @cindex consecutive hyphenated lines (@code{hlm})
6776 @cindex lines, consecutive hyphenated (@code{hlm})
6777 @cindex hyphenated lines, consecutive (@code{hlm})
6778 Set the maximum number of consecutive hyphenated lines to @var{nnn}.
6779 If this number is negative, there is no maximum. The default value
6780 is@tie{}@minus{}1 if @var{nnn} is omitted. This value is associated
6781 with the current environment (@pxref{Environments}). Only lines
6782 output from a given environment count towards the maximum associated
6783 with that environment. Hyphens resulting from @code{\%} are counted;
6784 explicit hyphens are not.
6786 The current setting of @code{hlm} is available in the @code{.hlm}
6787 read-only number register. Also the number of immediately preceding
6788 consecutive hyphenated lines are available in the read-only number
6789 register @samp{.hlc}.
6792 @Defreq {hw, word1 word2 @dots{}}
6793 Define how @var{word1}, @var{word2}, etc.@: are to be hyphenated. The
6794 words must be given with hyphens at the hyphenation points. For
6802 Besides the space character, any character whose hyphenation code value
6803 is zero can be used to separate the arguments of @code{hw} (see the
6804 documentation for the @code{hcode} request below for more information).
6805 In addition, this request can be used more than once.
6807 Hyphenation exceptions specified with the @code{hw} request are
6808 associated with the current hyphenation language; it causes an error
6809 if there is no current hyphenation language.
6811 This request is ignored if there is no parameter.
6813 In old versions of @code{troff} there was a limited amount of space to
6814 store such information; fortunately, with @code{gtroff}, this is no
6815 longer a restriction.
6818 @DefescList {\\%, , , }
6819 @deffnx Escape @t{\:}
6824 @esindex \@r{<colon>}
6826 @cindex hyphenation character (@code{\%})
6827 @cindex character, hyphenation (@code{\%})
6828 @cindex disabling hyphenation (@code{\%})
6829 @cindex hyphenation, disabling (@code{\%})
6830 To tell @code{gtroff} how to hyphenate words on the fly, use the
6831 @code{\%} escape, also known as the @dfn{hyphenation character}.
6832 Preceding a word with this character prevents it from being
6833 hyphenated; putting it inside a word indicates to @code{gtroff} that
6834 the word may be hyphenated at that point. Note that this mechanism
6835 only affects that one occurrence of the word; to change the
6836 hyphenation of a word for the entire document, use the @code{hw}
6839 The @code{\:} escape inserts a zero-width break point
6840 (that is, the word breaks but without adding a hyphen).
6843 ... check the /var/log/\:httpd/\:access_log file ...
6846 @cindex @code{\X}, followed by @code{\%}
6847 @cindex @code{\Y}, followed by @code{\%}
6848 @cindex @code{\%}, following @code{\X} or @code{\Y}
6849 Note that @code{\X} and @code{\Y} start a word, that is, the @code{\%}
6850 escape in (say) @w{@samp{\X'...'\%foobar}} and
6851 @w{@samp{\Y'...'\%foobar}} no longer prevents hyphenation but inserts
6852 a hyphenation point at the beginning of @samp{foobar}; most likely
6853 this isn't what you want to do.
6856 @Defreq {hc, [@Var{char}]}
6857 Change the hyphenation character to @var{char}. This character then
6858 works the same as the @code{\%} escape, and thus, no longer appears in
6859 the output. Without an argument, @code{hc} resets the hyphenation
6860 character to be @code{\%} (the default) only.
6862 The hyphenation character is associated with the current environment
6863 (@pxref{Environments}).
6866 @DefreqList {hpf, pattern_file}
6867 @DefreqItem {hpfa, pattern_file}
6868 @DefreqListEnd {hpfcode, a b [c d @dots{}]}
6869 @cindex hyphenation patterns (@code{hpf})
6870 @cindex patterns for hyphenation (@code{hpf})
6871 Read in a file of hyphenation patterns. This file is searched for in
6872 the same way as @file{@var{name}.tmac} (or @file{tmac.@var{name}}) is
6873 searched for if the @option{-m@var{name}} option is specified.
6875 It should have the same format as (simple) @TeX{} patterns files.
6876 More specifically, the following scanning rules are implemented.
6880 A percent sign starts a comment (up to the end of the line)
6881 even if preceded by a backslash.
6884 No support for `digraphs' like @code{\$}.
6887 @code{^^@var{xx}} (@var{x} is 0-9 or a-f) and @code{^^@var{x}} (character
6888 code of @var{x} in the range 0-127) are recognized; other use of @code{^}
6895 @code{hpf} checks for the expression @code{\patterns@{@dots{}@}}
6896 (possibly with whitespace before and after the braces).
6897 Everything between the braces is taken as hyphenation patterns.
6898 Consequently, @code{@{} and @code{@}} are not allowed in patterns.
6901 Similarly, @code{\hyphenation@{@dots{}@}} gives a list of hyphenation
6905 @code{\endinput} is recognized also.
6908 For backwards compatibility, if @code{\patterns} is missing,
6909 the whole file is treated as a list of hyphenation patterns
6910 (only recognizing the @code{%} character as the start of a comment).
6913 If no @code{hpf} request is specified (either in the document or in a
6914 macro package), @code{gtroff} won't hyphenate at all.
6916 The @code{hpfa} request appends a file of patterns to the current list.
6918 The @code{hpfcode} request defines mapping values for character codes in
6919 hyphenation patterns. @code{hpf} or @code{hpfa} then apply the mapping
6920 (after reading the patterns) before replacing or appending them to
6921 the current list of patterns. Its arguments are pairs of character codes
6922 -- integers from 0 to@tie{}255. The request maps character code@tie{}@var{a}
6923 to code@tie{}@var{b}, code@tie{}@var{c} to code@tie{}@var{d}, and so on. You
6924 can use character codes which would be invalid otherwise.
6930 The set of hyphenation patterns is associated with the current language
6931 set by the @code{hla} request. The @code{hpf} request is usually
6932 invoked by the @file{troffrc} or @file{troffrc-end} file; by default,
6933 @file{troffrc} loads hyphenation patterns and exceptions for American
6934 English (in files @file{hyphen.us} and @file{hyphenex.us}).
6936 A second call to @code{hpf} (for the same language) will replace the
6937 hyphenation patterns with the new ones.
6939 Invoking @code{hpf} causes an error if there is no current hyphenation
6943 @Defreq {hcode, c1 code1 [c2 code2 @dots{}]}
6944 @cindex hyphenation code (@code{hcode})
6945 @cindex code, hyphenation (@code{hcode})
6946 Set the hyphenation code of character @var{c1} to @var{code1}, that of
6947 @var{c2} to @var{code2}, etc. A hyphenation code must be a single
6948 input character (not a special character) other than a digit or a
6951 To make hyphenation work, hyphenation codes must be set up. At
6952 start-up, groff only assigns hyphenation codes to the letters
6953 @samp{a}-@samp{z} (mapped to themselves) and to the letters
6954 @samp{A}-@samp{Z} (mapped to @samp{a}-@samp{z}); all other hyphenation
6955 codes are set to zero. Normally, hyphenation patterns contain only
6956 lowercase letters which should be applied regardless of case. With
6957 other words, the words `FOO' and `Foo' should be hyphenated exactly the
6958 same way as the word `foo' is hyphenated, and this is what @code{hcode}
6959 is good for. Words which contain other letters won't be hyphenated
6960 properly if the corresponding hyphenation patterns actually do contain
6961 them. For example, the following @code{hcode} requests are necessary to
6962 assign hyphenation codes to the letters @samp{ÄäÖöÜüß} (this is needed
6972 Without those assignments, groff treats German words like
6973 @w{`Kindergärten'} (the plural form of `kindergarten') as two
6974 substrings @w{`kinderg'} and @w{`rten'} because the hyphenation code
6975 of the umlaut@tie{}a is zero by default. There is a German
6976 hyphenation pattern which covers @w{`kinder'}, so groff finds the
6977 hyphenation `kin-der'. The other two hyphenation points
6978 (`kin-der-gär-ten') are missed.
6980 This request is ignored if it has no parameter.
6983 @DefreqList {hym, [@Var{length}]}
6984 @DefregListEnd {.hym}
6985 @cindex hyphenation margin (@code{hym})
6986 @cindex margin for hyphenation (@code{hym})
6987 @cindex @code{ad} request, and hyphenation margin
6988 Set the (right) hyphenation margin to @var{length}. If the current
6989 adjustment mode is not @samp{b} or @samp{n}, the line is not
6990 hyphenated if it is shorter than @var{length}. Without an argument,
6991 the hyphenation margin is reset to its default value, which is@tie{}0.
6992 The default scaling indicator for this request is @samp{m}. The
6993 hyphenation margin is associated with the current environment
6994 (@pxref{Environments}).
6996 A negative argument resets the hyphenation margin to zero, emitting
6997 a warning of type @samp{range}.
6999 @cindex hyphenation margin register (@code{.hym})
7000 The current hyphenation margin is available in the @code{.hym} read-only
7004 @DefreqList {hys, [@Var{hyphenation_space}]}
7005 @DefregListEnd {.hys}
7006 @cindex hyphenation space (@code{hys})
7007 @cindex @code{ad} request, and hyphenation space
7008 Set the hyphenation space to @var{hyphenation_space}. If the current
7009 adjustment mode is @samp{b} or @samp{n}, don't hyphenate the line
7010 if it can be justified by adding no more than @var{hyphenation_space}
7011 extra space to each word space. Without argument, the hyphenation
7012 space is set to its default value, which is@tie{}0. The default
7013 scaling indicator for this request is @samp{m}. The hyphenation
7014 space is associated with the current environment
7015 (@pxref{Environments}).
7017 A negative argument resets the hyphenation space to zero, emitting a
7018 warning of type @samp{range}.
7020 @cindex hyphenation space register (@code{.hys})
7021 The current hyphenation space is available in the @code{.hys} read-only
7025 @Defreq {shc, [@Var{glyph}]}
7026 @cindex soft hyphen character, setting (@code{shc})
7027 @cindex character, soft hyphen, setting (@code{shc})
7028 @cindex glyph, soft hyphen (@code{hy})
7029 @cindex soft hyphen glyph (@code{hy})
7030 @cindex @code{char} request, and soft hyphen character
7031 @cindex @code{tr} request, and soft hyphen character
7032 Set the @dfn{soft hyphen character} to @var{glyph}.@footnote{@dfn{Soft
7033 hyphen character} is a misnomer since it is an output glyph.} If the
7034 argument is omitted, the soft hyphen character is set to the default
7035 glyph @code{\(hy} (this is the start-up value of @code{gtroff} also).
7036 The soft hyphen character is the glyph that is inserted when a word is
7037 hyphenated at a line break. If the soft hyphen character does not
7038 exist in the font of the character immediately preceding a potential
7039 break point, then the line is not broken at that point. Neither
7040 definitions (specified with the @code{char} request) nor translations
7041 (specified with the @code{tr} request) are considered when finding the
7042 soft hyphen character.
7045 @DefreqList {hla, language}
7046 @DefregListEnd {.hla}
7047 @cindex @code{hpf} request, and hyphenation language
7048 @cindex @code{hw} request, and hyphenation language
7051 Set the current hyphenation language to the string @var{language}.
7052 Hyphenation exceptions specified with the @code{hw} request and
7053 hyphenation patterns specified with the @code{hpf} and @code{hpfa}
7054 requests are both associated with the current hyphenation language.
7055 The @code{hla} request is usually invoked by the @file{troffrc} or the
7056 @file{troffrc-end} files; @file{troffrc} sets the default language to
7059 @cindex hyphenation language register (@code{.hla})
7060 The current hyphenation language is available as a string in the
7061 read-only number register @samp{.hla}.
7064 .ds curr_language \n[.hla]
7071 @c =====================================================================
7073 @node Manipulating Spacing, Tabs and Fields, Manipulating Hyphenation, gtroff Reference
7074 @section Manipulating Spacing
7075 @cindex manipulating spacing
7076 @cindex spacing, manipulating
7078 @Defreq {sp, [@Var{distance}]}
7079 Space downwards @var{distance}. With no argument it advances
7080 1@tie{}line. A negative argument causes @code{gtroff} to move up the page
7081 the specified distance. If the argument is preceded by a @samp{|}
7082 then @code{gtroff} moves that distance from the top of the page. This
7083 request causes a line break. The default scaling indicator is @samp{v}.
7085 If a vertical trap is sprung during execution of @code{sp}, the amount of
7086 vertical space after the trap is discarded. For example, this
7114 @cindex @code{sp} request, and traps
7115 @cindex discarded space in traps
7116 @cindex space, discarded, in traps
7117 @cindex traps, and discarded space
7118 The amount of discarded space is available in the number register
7121 To protect @code{sp} against vertical traps, use the @code{vpt} request:
7130 @DefreqList {ls, [@Var{nnn}]}
7132 @cindex double-spacing (@code{ls})
7133 Output @w{@var{nnn}@minus{}1} blank lines after each line of text.
7134 With no argument, @code{gtroff} uses the previous value before the
7135 last @code{ls} call.
7138 .ls 2 \" This causes double-spaced output
7139 .ls 3 \" This causes triple-spaced output
7140 .ls \" Again double-spaced
7143 The line spacing is associated with the current environment
7144 (@pxref{Environments}).
7146 @cindex line spacing register (@code{.L})
7147 The read-only number register @code{.L} contains the current line
7151 @xref{Changing Type Sizes}, for the requests @code{vs} and @code{pvs}
7152 as alternatives to @code{ls}.
7154 @DefescList {\\x, ', spacing, '}
7156 Sometimes, extra vertical spacing is only needed occasionally, e.g.@:
7157 to allow space for a tall construct (like an equation). The @code{\x}
7158 escape does this. The escape is given a numerical argument, usually
7159 enclosed in quotes (like @samp{\x'3p'}); the default scaling indicator
7160 is @samp{v}. If this number is positive extra vertical space is
7161 inserted below the current line. A negative number adds space above.
7162 If this escape is used multiple times on the same line, the maximum of
7165 @xref{Escapes}, for details on parameter delimiting characters.
7167 @cindex extra post-vertical line space register (@code{.a})
7168 The @code{.a} read-only number register contains the most recent
7169 (nonnegative) extra vertical line space.
7171 Using @code{\x} can be necessary in combination with the @code{\b}
7172 escape, as the following example shows.
7175 This is a test with the \[rs]b escape.
7177 This is a test with the \[rs]b escape.
7179 This is a test with \b'xyz'\x'-1m'\x'1m'.
7181 This is a test with the \[rs]b escape.
7183 This is a test with the \[rs]b escape.
7190 This is a test with the \b escape.
7191 This is a test with the \b escape.
7193 This is a test with y.
7195 This is a test with the \b escape.
7196 This is a test with the \b escape.
7202 @DefregListEnd {.ns}
7203 @cindex @code{sp} request, and no-space mode
7204 @cindex no-space mode (@code{ns})
7205 @cindex mode, no-space (@code{ns})
7206 @cindex blank lines, disabling
7207 @cindex lines, blank, disabling
7208 Enable @dfn{no-space mode}. In this mode, spacing (either via
7209 @code{sp} or via blank lines) is disabled. The @code{bp} request to
7210 advance to the next page is also disabled, except if it is accompanied
7211 by a page number (see @ref{Page Control}, for more information). This
7212 mode ends when actual text is output or the @code{rs} request is
7213 encountered which ends no-space mode. The read-only number register
7214 @code{.ns} is set to@tie{}1 as long as no-space mode is active.
7216 This request is useful for macros that conditionally
7217 insert vertical space before the text starts
7218 (for example, a paragraph macro could insert some space
7219 except when it is the first paragraph after a section header).
7223 @c =====================================================================
7225 @node Tabs and Fields, Character Translations, Manipulating Spacing, gtroff Reference
7226 @section Tabs and Fields
7227 @cindex tabs, and fields
7228 @cindex fields, and tabs
7230 @cindex @acronym{EBCDIC} encoding of a tab
7231 A tab character (@acronym{ASCII} char@tie{}9, @acronym{EBCDIC}
7232 char@tie{}5) causes a horizontal movement to the next tab stop (much
7233 like it did on a typewriter).
7236 @cindex tab character, non-interpreted (@code{\t})
7237 @cindex character, tab, non-interpreted (@code{\t})
7238 This escape is a non-interpreted tab character. In copy mode
7239 (@pxref{Copy-in Mode}), @code{\t} is the same as a real tab character.
7242 @DefreqList {ta, [@Var{n1} @Var{n2} @dots{} @Var{nn} @t{T} @Var{r1} @Var{r2} @dots{} @Var{rn}]}
7243 @DefregListEnd {.tabs}
7244 Change tab stop positions. This request takes a series of tab
7245 specifiers as arguments (optionally divided into two groups with the
7246 letter @samp{T}) which indicate where each tab stop is to be
7247 (overriding any previous settings).
7249 Tab stops can be specified absolutely, i.e., as the distance from the
7250 left margin. For example, the following sets 6@tie{}tab stops every
7254 .ta 1i 2i 3i 4i 5i 6i
7257 Tab stops can also be specified using a leading @samp{+}
7258 which means that the specified tab stop is set relative to
7259 the previous tab stop. For example, the following is equivalent to the
7263 .ta 1i +1i +1i +1i +1i +1i
7266 @code{gtroff} supports an extended syntax to specify repeat values after
7267 the @samp{T} mark (these values are always taken as relative) -- this is
7268 the usual way to specify tabs set at equal intervals. The following is,
7269 yet again, the same as the previous examples. It does even more since
7270 it defines an infinite number of tab stops separated by one inch.
7276 Now we are ready to interpret the full syntax given at the beginning:
7277 Set tabs at positions @var{n1}, @var{n2}, @dots{}, @var{nn} and then set
7278 tabs at @var{nn}+@var{r1}, @var{nn}+@var{r2}, @dots{}, @var{nn}+@var{rn}
7279 and then at @var{nn}+@var{rn}+@var{r1}, @var{nn}+@var{rn}+@var{r2},
7280 @dots{}, @var{nn}+@var{rn}+@var{rn}, and so on.
7282 Example: @samp{4c +6c T 3c 5c 2c} is equivalent to @samp{4c 10c 13c 18c
7283 20c 23c 28c 30c @dots{}}.
7285 The material in each tab column (i.e., the column between two tab stops)
7286 may be justified to the right or left or centered in the column. This
7287 is specified by appending @samp{R}, @samp{L}, or @samp{C} to the tab
7288 specifier. The default justification is @samp{L}. Example:
7298 The default unit of the @code{ta} request is @samp{m}.
7301 A tab stop is converted into a non-breakable horizontal movement which
7302 can be neither stretched nor squeezed. For example,
7311 creates a single line which is a bit longer than 10@tie{}inches (a string
7312 is used to show exactly where the tab characters are). Now consider the
7322 @code{gtroff} first converts the tab stops of the line into unbreakable
7323 horizontal movements, then splits the line after the second @samp{b}
7324 (assuming a sufficiently short line length). Usually, this isn't what
7328 Superfluous tabs (i.e., tab characters which do not correspond to a tab
7329 stop) are ignored except the first one which delimits the characters
7330 belonging to the last tab stop for right-justifying or centering.
7331 Consider the following example
7335 .ds ZZ foo\tbar\tfoobar
7336 .ds ZZZ foo\tbar\tfoo\tbar
7347 which produces the following output:
7356 The first line right-justifies the second `foo' relative to the tab
7357 stop. The second line right-justifies `foobar'. The third line finally
7358 right-justifies only `foo' because of the additional tab character which
7359 marks the end of the string belonging to the last defined tab stop.
7362 Tab stops are associated with the current environment
7363 (@pxref{Environments}).
7366 Calling @code{ta} without an argument removes all tab stops.
7369 @cindex tab stops, for TTY output devices
7370 The start-up value of @code{gtroff} is @w{@samp{T 0.8i}}.
7373 @cindex tab settings register (@code{.tabs})
7374 The read-only number register @code{.tabs} contains a string
7375 representation of the current tab settings suitable for use as an
7376 argument to the @code{ta} request.
7379 .ds tab-string \n[.tabs]
7384 @cindex @code{.S} register, Plan@tie{}9 alias for @code{.tabs}
7385 @cindex @code{.tabs} register, Plan@tie{}9 alias (@code{.S})
7386 The @code{troff} version of the Plan@tie{}9 operating system uses
7387 register @code{.S} for the same purpose.
7390 @Defreq {tc, [@Var{fill-glyph}]}
7391 @cindex tab repetition character (@code{tc})
7392 @cindex character, tab repetition (@code{tc})
7393 @cindex glyph, tab repetition (@code{tc})
7394 Normally @code{gtroff} fills the space to the next tab stop with
7395 whitespace. This can be changed with the @code{tc} request. With no
7396 argument @code{gtroff} reverts to using whitespace, which is the
7397 default. The value of this @dfn{tab repetition character} is
7398 associated with the current environment
7399 (@pxref{Environments}).@footnote{@dfn{Tab repetition character} is a
7400 misnomer since it is an output glyph.}
7403 @DefreqList {linetabs, n}
7404 @DefregListEnd {.linetabs}
7405 @cindex tab, line-tabs mode
7406 @cindex line-tabs mode
7407 @cindex mode, line-tabs
7408 If @var{n} is missing or not zero, enable @dfn{line-tabs} mode,
7409 or disable it otherwise (the default).
7410 In line-tabs mode, @code{gtroff} computes tab distances
7411 relative to the (current) output line instead of the input line.
7413 For example, the following code:
7426 in normal mode, results in the output
7433 in line-tabs mode, the same code outputs
7439 Line-tabs mode is associated with the current environment.
7440 The read-only register @code{.linetabs} is set to@tie{}1 if in line-tabs
7441 mode, and 0 in normal mode.
7449 @c ---------------------------------------------------------------------
7451 @node Leaders, Fields, Tabs and Fields, Tabs and Fields
7455 Sometimes it may may be desirable to use the @code{tc} request to fill a
7456 particular tab stop with a given glyph (for example dots in a table
7457 of contents), but also normal tab stops on the rest of the line. For
7458 this @code{gtroff} provides an alternate tab mechanism, called
7459 @dfn{leaders} which does just that.
7461 @cindex leader character
7462 A leader character (character code@tie{}1) behaves similarly to a tab
7463 character: It moves to the next tab stop. The only difference is that
7464 for this movement, the fill glyph defaults to a period character and
7468 @cindex leader character, non-interpreted (@code{\a})
7469 @cindex character, leader, non-interpreted (@code{\a})
7470 This escape is a non-interpreted leader character. In copy mode
7471 (@pxref{Copy-in Mode}), @code{\a} is the same as a real leader
7475 @Defreq {lc, [@Var{fill-glyph}]}
7476 @cindex leader repetition character (@code{lc})
7477 @cindex character, leader repetition (@code{lc})
7478 @cindex glyph, leader repetition (@code{lc})
7479 Declare the @dfn{leader repetition character}.@footnote{@dfn{Leader
7480 repetition character} is a misnomer since it is an output glyph.}
7481 Without an argument, leaders act the same as tabs (i.e., using
7482 whitespace for filling). @code{gtroff}'s start-up value is a dot
7483 (@samp{.}). The value of the leader repetition character is
7484 associated with the current environment (@pxref{Environments}).
7487 @cindex table of contents
7488 @cindex contents, table of
7489 For a table of contents, to name an example, tab stops may be defined so
7490 that the section number is one tab stop, the title is the second with
7491 the remaining space being filled with a line of dots, and then the page
7492 number slightly separated from the dots.
7495 .ds entry 1.1\tFoo\a\t12
7505 1.1 Foo.......................................... 12
7508 @c ---------------------------------------------------------------------
7510 @node Fields, , Leaders, Tabs and Fields
7514 @cindex field delimiting character (@code{fc})
7515 @cindex delimiting character, for fields (@code{fc})
7516 @cindex character, field delimiting (@code{fc})
7517 @cindex field padding character (@code{fc})
7518 @cindex padding character, for fields (@code{fc})
7519 @cindex character, field padding (@code{fc})
7520 @dfn{Fields} are a more general way of laying out tabular data. A field
7521 is defined as the data between a pair of @dfn{delimiting characters}.
7522 It contains substrings which are separated by @dfn{padding characters}.
7523 The width of a field is the distance on the @emph{input} line from the
7524 position where the field starts to the next tab stop. A padding
7525 character inserts stretchable space similar to @TeX{}'s @code{\hss}
7526 command (thus it can even be negative) to make the sum of all substring
7527 lengths plus the stretchable space equal to the field width. If more
7528 than one padding character is inserted, the available space is evenly
7529 distributed among them.
7531 @Defreq {fc, [@Var{delim-char} [@Var{padding-char}]]}
7532 Define a delimiting and a padding character for fields. If the latter
7533 is missing, the padding character defaults to a space character. If
7534 there is no argument at all, the field mechanism is disabled (which is
7535 the default). Note that contrary to e.g.@: the tab repetition
7536 character, delimiting and padding characters are @emph{not} associated
7537 to the current environment (@pxref{Environments}).
7550 and here the result:
7559 @c =====================================================================
7561 @node Character Translations, Troff and Nroff Mode, Tabs and Fields, gtroff Reference
7562 @section Character Translations
7563 @cindex character translations
7564 @cindex translations of characters
7566 @cindex control character, changing (@code{cc})
7567 @cindex character, control, changing (@code{cc})
7568 @cindex no-break control character, changing (@code{c2})
7569 @cindex character, no-break control, changing (@code{c2})
7570 @cindex control character, no-break, changing (@code{c2})
7571 The control character (@samp{.}) and the no-break control character
7572 (@samp{'}) can be changed with the @code{cc} and @code{c2} requests,
7575 @Defreq {cc, [@Var{c}]}
7576 Set the control character to@tie{}@var{c}. With no argument the default
7577 control character @samp{.} is restored. The value of the control
7578 character is associated with the current environment
7579 (@pxref{Environments}).
7582 @Defreq {c2, [@Var{c}]}
7583 Set the no-break control character to@tie{}@var{c}. With no argument the
7584 default control character @samp{'} is restored. The value of the
7585 no-break control character is associated with the current environment
7586 (@pxref{Environments}).
7590 @cindex disabling @code{\} (@code{eo})
7591 @cindex @code{\}, disabling (@code{eo})
7592 Disable the escape mechanism completely. After executing this
7593 request, the backslash character @samp{\} no longer starts an escape
7596 This request can be very helpful in writing macros since it is not
7597 necessary then to double the escape character. Here an example:
7600 .\" This is a simplified version of the
7601 .\" .BR request from the man macro package
7605 . while (\n[.$] >= 2) \@{\
7606 . as result \fB\$1\fR\$2
7609 . if \n[.$] .as result \fB\$1
7617 @Defreq {ec, [@Var{c}]}
7618 @cindex escape character, changing (@code{ec})
7619 @cindex character, escape, changing (@code{ec})
7620 Set the escape character to@tie{}@var{c}. With no argument the default
7621 escape character @samp{\} is restored. It can be also used to
7622 re-enable the escape mechanism after an @code{eo} request.
7624 Note that changing the escape character globally will likely break
7625 macro packages since @code{gtroff} has no mechanism to `intern' macros,
7626 i.e., to convert a macro definition into an internal form which is
7627 independent of its representation (@TeX{} has this mechanism).
7628 If a macro is called, it is executed literally.
7632 @DefreqListEnd {ecr, }
7633 The @code{ecs} request saves the current escape character
7634 in an internal register.
7635 Use this request in combination with the @code{ec} request to
7636 temporarily change the escape character.
7638 The @code{ecr} request restores the escape character
7639 saved with @code{ecs}.
7640 Without a previous call to @code{ecs}, this request
7641 sets the escape character to @code{\}.
7644 @DefescList {\\\\, , , }
7645 @DefescItem {\\e, , , }
7646 @DefescListEnd {\\E, , , }
7647 Print the current escape character (which is the backslash character
7648 @samp{\} by default).
7650 @code{\\} is a `delayed' backslash; more precisely, it is the default
7651 escape character followed by a backslash, which no longer has special
7652 meaning due to the leading escape character. It is @emph{not} an escape
7653 sequence in the usual sense! In any unknown escape sequence
7654 @code{\@var{X}} the escape character is ignored and @var{X} is printed.
7655 But if @var{X} is equal to the current escape character, no warning is
7658 As a consequence, only at top-level or in a diversion a backslash glyph is
7659 printed; in copy-in mode, it expands to a single backslash which then
7660 combines with the following character to an escape sequence.
7662 The @code{\E} escape differs from @code{\e} by printing an escape
7663 character that is not interpreted in copy mode.
7664 Use this to define strings with escapes that work
7665 when used in copy mode (for example, as a macro argument).
7666 The following example defines strings to begin and end
7670 .ds @{ \v'-.3m'\s'\En[.s]*60/100'
7674 Another example to demonstrate the differences between the various escape
7675 sequences, using a strange escape character, @samp{-}.
7687 The result is surprising for most users, expecting @samp{1} since
7688 @samp{foo} is a valid identifier. What has happened? As mentioned
7689 above, the leading escape character makes the following character
7690 ordinary. Written with the default escape character the sequence
7691 @samp{--} becomes @samp{\-} -- this is the minus sign.
7693 If the escape character followed by itself is a valid escape sequence,
7694 only @code{\E} yields the expected result:
7707 Similar to @code{\\}, the sequence @code{\.} isn't a real escape sequence.
7708 As before, a warning message is suppressed if the escape character is
7709 followed by a dot, and the dot itself is printed.
7726 The first backslash is consumed while the macro is read, and the second
7727 is swallowed while exexuting macro @code{foo}.
7730 A @dfn{translation} is a mapping of an input character to an output
7731 glyph. The mapping occurs at output time, i.e., the input character
7732 gets assigned the metric information of the mapped output character
7733 right before input tokens are converted to nodes (@pxref{Gtroff
7734 Internals}, for more on this process).
7736 @DefreqList {tr, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
7737 @DefreqListEnd {trin, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
7738 Translate character @var{a} to glyph@tie{}@var{b}, character @var{c} to
7739 glyph@tie{}@var{d}, etc. If there is an odd number of arguments, the
7740 last one is translated to an unstretchable space (@w{@samp{\ }}).
7742 The @code{trin} request is identical to @code{tr},
7743 but when you unformat a diversion with @code{asciify}
7744 it ignores the translation.
7745 @xref{Diversions}, for details about the @code{asciify} request.
7751 @cindex @code{\(}, and translations
7752 @cindex @code{\[}, and translations
7753 @cindex @code{\'}, and translations
7754 @cindex @code{\`}, and translations
7755 @cindex @code{\-}, and translations
7756 @cindex @code{\_}, and translations
7757 @cindex @code{\C}, and translations
7758 @cindex @code{\N}, and translations
7759 @cindex @code{char} request, and translations
7760 @cindex special characters
7761 @cindex character, special
7762 @cindex numbered glyph (@code{\N})
7763 @cindex glyph, numbered (@code{\N})
7764 Special characters (@code{\(@var{xx}}, @code{\[@var{xxx}]},
7765 @code{\C'@var{xxx}'}, @code{\'}, @code{\`}, @code{\-}, @code{\_}),
7766 glyphs defined with the @code{char} request, and numbered glyphs
7767 (@code{\N'@var{xxx}'}) can be translated also.
7770 @cindex @code{\e}, and translations
7771 The @code{\e} escape can be translated also.
7774 @cindex @code{\%}, and translations
7775 @cindex @code{\~}, and translations
7776 Characters can be mapped onto the @code{\%} and @code{\~} escapes (but
7777 @code{\%} and @code{\~} can't be mapped onto another glyph).
7780 @cindex backspace character, and translations
7781 @cindex character, backspace, and translations
7782 @cindex leader character, and translations
7783 @cindex character, leader, and translations
7784 @cindex newline character, and translations
7785 @cindex character, newline, and translations
7786 @cindex tab character, and translations
7787 @cindex character, tab, and translations
7788 @cindex @code{\a}, and translations
7789 @cindex @code{\t}, and translations
7790 The following characters can't be translated: space (with one exception,
7791 see below), backspace, newline, leader (and @code{\a}), tab (and
7795 @cindex @code{shc} request, and translations
7796 Translations are not considered for finding the soft hyphen character
7797 set with the @code{shc} request.
7800 @cindex @code{\&}, and translations
7801 The pair @samp{@var{c}\&} (this is an arbitrary character@tie{}@var{c}
7802 followed by the zero width space character) maps this character to nothing.
7811 It is even possible to map the space character to nothing:
7820 As shown in the example, the space character can't be the first
7821 character/glyph pair as an argument of @code{tr}. Additionally, it is
7822 not possible to map the space character to any other glyph; requests
7823 like @w{@samp{.tr aa x}} undo @w{@samp{.tr aa \&}} instead.
7825 If justification is active, lines are justified in spite of the
7826 `empty' space character (but there is no minimal distance, i.e.@: the
7827 space character, between words).
7830 After an output glyph has been constructed (this happens at the
7831 moment immediately before the glyph is appended to an output
7832 glyph list, either by direct output, in a macro, diversion, or
7833 string), it is no longer affected by @code{tr}.
7836 Translating character to glyphs where one of them or both are
7837 undefined is possible also; @code{tr} does not check whether the
7838 entities in its argument do exist.
7840 @xref{Gtroff Internals}.
7843 @code{troff} no longer has a hard-coded dependency on @w{Latin-1};
7844 all @code{char@var{XXX}} entities have been removed from the font
7845 description files. This has a notable consequence which shows up in
7846 warnings like @code{can't find character with input code @var{XXX}}
7847 if the @code{tr} request isn't handled properly.
7849 Consider the following translation:
7856 This maps input character @code{é} onto glyph @code{É}, which is
7857 identical to glyph @code{char201}. But this glyph intentionally
7858 doesn't exist! Instead, @code{\[char201]} is treated as an input
7859 character entity and is by default mapped onto @code{\['E]}, and
7860 @code{gtroff} doesn't handle translations of translations.
7862 The right way to write the above translation is
7869 With other words, the first argument of @code{tr} should be an input
7870 character or entity, and the second one a glyph entity.
7873 Without an argument, the @code{tr} request is ignored.
7877 @Defreq {trnt, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
7878 @cindex @code{\!}, and @code{trnt}
7879 @code{trnt} is the same as the @code{tr} request except that the
7880 translations do not apply to text that is transparently throughput
7881 into a diversion with @code{\!}. @xref{Diversions}, for more
7895 prints @samp{b} to the standard error stream; if @code{trnt} is used
7896 instead of @code{tr} it prints @samp{a}.
7900 @c =====================================================================
7902 @node Troff and Nroff Mode, Line Layout, Character Translations, gtroff Reference
7903 @section Troff and Nroff Mode
7909 Originally, @code{nroff} and @code{troff} were two separate programs,
7910 the former for TTY output, the latter for everything else. With GNU
7911 @code{troff}, both programs are merged into one executable, sending
7912 its output to a device driver (@code{grotty} for TTY devices,
7913 @code{grops} for @sc{PostScript}, etc.) which interprets the
7914 intermediate output of @code{gtroff}. For @acronym{UNIX} @code{troff}
7915 it makes sense to talk about @dfn{Nroff mode} and @dfn{Troff mode}
7916 since the differences are hardcoded. For GNU @code{troff}, this
7917 distinction is not appropriate because @code{gtroff} simply takes the
7918 information given in the font files for a particular device without
7919 handling requests specially if a TTY output device is used.
7921 Usually, a macro package can be used with all output devices.
7922 Nevertheless, it is sometimes necessary to make a distinction between
7923 TTY and non-TTY devices: @code{gtroff} provides two built-in
7924 conditions @samp{n} and @samp{t} for the @code{if}, @code{ie}, and
7925 @code{while} requests to decide whether @code{gtroff} shall behave
7926 like @code{nroff} or like @code{troff}.
7931 Make the @samp{t} built-in condition true (and the @samp{n} built-in
7932 condition false) for @code{if}, @code{ie}, and @code{while}
7933 conditional requests. This is the default if @code{gtroff}
7934 (@emph{not} @code{groff}) is started with the @option{-R} switch to
7935 avoid loading of the start-up files @file{troffrc} and
7936 @file{troffrc-end}. Without @option{-R}, @code{gtroff} stays in troff
7937 mode if the output device is not a TTY (e.g.@: `ps').
7942 Make the @samp{n} built-in condition true (and the @samp{t} built-in
7943 condition false) for @code{if}, @code{ie}, and @code{while}
7944 conditional requests. This is the default if @code{gtroff} uses a TTY
7945 output device; the code for switching to nroff mode is in the file
7946 @file{tty.tmac} which is loaded by the start-up file @code{troffrc}.
7949 @xref{Conditionals and Loops}, for more details on built-in
7953 @c =====================================================================
7955 @node Line Layout, Line Control, Troff and Nroff Mode, gtroff Reference
7956 @section Line Layout
7958 @cindex layout, line
7960 @cindex dimensions, line
7961 @cindex line dimensions
7962 The following drawing shows the dimensions which @code{gtroff} uses for
7963 placing a line of output onto the page. They are labeled with the
7964 request which manipulates each dimension.
7968 |<-----------ll------------>|
7969 +----+----+----------------------+----+
7971 +----+----+----------------------+----+
7973 |<--------paper width---------------->|
7977 These dimensions are:
7981 @cindex left margin (@code{po})
7982 @cindex margin, left (@code{po})
7983 @cindex page offset (@code{po})
7984 @cindex offset, page (@code{po})
7985 @dfn{Page offset} -- this is the leftmost position of text on the final
7986 output, defining the @dfn{left margin}.
7989 @cindex indentation (@code{in})
7990 @cindex line indentation (@code{in})
7991 @dfn{Indentation} -- this is the distance from the left margin where
7995 @cindex line length (@code{ll})
7996 @cindex length of line (@code{ll})
7997 @dfn{Line length} -- this is the distance from the left margin to right
8001 A simple demonstration:
8005 This is text without indentation.
8006 The line length has been set to 3\~inch.
8009 Now the left and right margins are both increased.
8012 Calling .in and .ll without parameters restore
8013 the previous values.
8019 This is text without indenta-
8020 tion. The line length has
8025 Calling .in and .ll without
8026 parameters restore the previ-
8030 @DefreqList {po, [@Var{offset}]}
8031 @DefreqItem {po, @t{+}@Var{offset}}
8032 @DefreqItem {po, @t{-}@Var{offset}}
8035 Set horizontal page offset to @var{offset} (or increment or decrement
8036 the current value by @var{offset}). Note that this request does not
8037 cause a break, so changing the page offset in the middle of text being
8038 filled may not yield the expected result. The initial value is
8039 1@dmn{i}. For TTY output devices, it is set to 0 in the startup file
8040 @file{troffrc}; the default scaling indicator is @samp{m} (and
8041 not @samp{v} as incorrectly documented in the original
8042 @acronym{UNIX} troff manual).
8044 The current page offset can be found in the read-only number register
8047 If @code{po} is called without an argument, the page offset is reset to
8048 the previous value before the last call to @code{po}.
8063 @DefreqList {in, [@Var{indent}]}
8064 @DefreqItem {in, @t{+}@Var{indent}}
8065 @DefreqItem {in, @t{-}@Var{indent}}
8067 Set indentation to @var{indent} (or increment or decrement the
8068 current value by @var{indent}). This request causes a break.
8069 Initially, there is no indentation.
8071 If @code{in} is called without an argument, the indentation is reset to
8072 the previous value before the last call to @code{in}. The default
8073 scaling indicator is @samp{m}.
8075 The indentation is associated with the current environment
8076 (@pxref{Environments}).
8078 If a negative indentation value is specified (which is not allowed),
8079 @code{gtroff} emits a warning of type @samp{range} and sets the
8080 indentation to zero.
8082 The effect of @code{in} is delayed until a partially collected line
8083 (if it exists) is output. A temporary indentation value is reset to
8086 The current indentation (as set by @code{in}) can be found in the
8087 read-only number register @samp{.i}.
8090 @DefreqList {ti, offset}
8091 @DefreqItem {ti, @t{+}@Var{offset}}
8092 @DefreqItem {ti, @t{-}@Var{offset}}
8093 @DefregListEnd {.in}
8094 Temporarily indent the next output line by @var{offset}. If an
8095 increment or decrement value is specified, adjust the temporary
8096 indentation relative to the value set by the @code{in} request.
8098 This request causes a break; its value is associated with the current
8099 environment (@pxref{Environments}). The default scaling indicator
8100 is @samp{m}. A call of @code{ti} without an argument is ignored.
8102 If the total indentation value is negative (which is not allowed),
8103 @code{gtroff} emits a warning of type @samp{range} and sets the
8104 temporary indentation to zero. `Total indentation' is either
8105 @var{offset} if specified as an absolute value, or the temporary plus
8106 normal indentation, if @var{offset} is given as a relative value.
8108 The effect of @code{ti} is delayed until a partially collected line (if
8109 it exists) is output.
8111 The read-only number register @code{.in} is the indentation that applies
8112 to the current output line.
8114 The difference between @code{.i} and @code{.in} is that the latter takes
8115 into account whether a partially collected line still uses the old
8116 indentation value or a temporary indentation value is active.
8119 @DefreqList {ll, [@Var{length}]}
8120 @DefreqItem {ll, @t{+}@Var{length}}
8121 @DefreqItem {ll, @t{-}@Var{length}}
8123 @DefregListEnd {.ll}
8124 Set the line length to @var{length} (or increment or decrement the
8125 current value by @var{length}). Initially, the line length is set to
8126 6.5@dmn{i}. The effect of @code{ll} is delayed until a partially
8127 collected line (if it exists) is output. The default scaling
8128 indicator is @samp{m}.
8130 If @code{ll} is called without an argument, the line length is reset to
8131 the previous value before the last call to @code{ll}. If a negative
8132 line length is specified (which is not allowed), @code{gtroff} emits a
8133 warning of type @samp{range} and sets the line length to zero.
8135 The line length is associated with the current environment
8136 (@pxref{Environments}).
8138 @cindex line length register (@code{.l})
8139 The current line length (as set by @code{ll}) can be found in the
8140 read-only number register @samp{.l}. The read-only number register
8141 @code{.ll} is the line length that applies to the current output line.
8143 Similar to @code{.i} and @code{.in}, the difference between @code{.l}
8144 and @code{.ll} is that the latter takes into account whether a partially
8145 collected line still uses the old line length value.
8149 @c =====================================================================
8151 @node Line Control, Page Layout, Line Layout, gtroff Reference
8152 @section Line Control
8153 @cindex line control
8154 @cindex control, line
8156 It is important to understand how @code{gtroff} handles input and output
8159 Many escapes use positioning relative to the input line. For example,
8163 This is a \h'|1.2i'test.
8178 The main usage of this feature is to define macros which act exactly
8179 at the place where called.
8182 .\" A simple macro to underline a word
8184 . nop \\$1\l'|0\[ul]'
8189 In the above example, @samp{|0} specifies a negative distance from the
8190 current position (at the end of the just emitted argument @code{\$1}) back
8191 to the beginning of the input line. Thus, the @samp{\l} escape draws a
8192 line from right to left.
8194 @cindex input line continuation (@code{\})
8195 @cindex line, input, continuation (@code{\})
8196 @cindex continuation, input line (@code{\})
8197 @cindex output line, continuation (@code{\c})
8198 @cindex line, output, continuation (@code{\c})
8199 @cindex continuation, output line (@code{\c})
8200 @cindex interrupted line
8201 @cindex line, interrupted
8202 @code{gtroff} makes a difference between input and output line
8203 continuation; the latter is also called @dfn{interrupting} a line.
8205 @DefescList {\\@key{RET}, , ,}
8206 @DefescItem {\\c, , ,}
8207 @DefregListEnd{.int}
8208 Continue a line. @code{\@key{RET}} (this is a backslash at the end
8209 of a line immediately followed by a newline) works on the input level,
8210 suppressing the effects of the following newline in the input.
8215 @result{} This is a .test
8218 The @samp{|} operator is also affected.
8220 @cindex @code{\R}, after @code{\c}
8221 @code{\c} works on the output level. Anything after this escape on the
8222 same line is ignored, except @code{\R} which works as usual. Anything
8223 before @code{\c} on the same line will be appended to the current partial
8224 output line. The next non-command line after an interrupted line counts
8225 as a new input line.
8227 The visual results depend on whether no-fill mode is active.
8231 @cindex @code{\c}, and no-fill mode
8232 @cindex no-fill mode, and @code{\c}
8233 @cindex mode, no-fill, and @code{\c}
8234 If no-fill mode is active (using the @code{nf} request), the next input
8235 text line after @code{\c} will be handled as a continuation of the same
8242 @result{} This is a test.
8246 @cindex @code{\c}, and fill mode
8247 @cindex fill mode, and @code{\c}
8248 @cindex mode, fill, and @code{\c}
8249 If fill mode is active (using the @code{fi} request), a word interrupted
8250 with @code{\c} will be continued with the text on the next input text line,
8251 without an intervening space.
8256 @result{} This is a test.
8260 Note that an intervening control line which causes a break is stronger
8261 than @code{\c}, flushing out the current partial line in the usual way.
8263 @cindex interrupted line register (@code{.int})
8264 The @code{.int} register contains a positive value
8265 if the last output line was interrupted with @code{\c}; this is
8266 associated with the current environment (@pxref{Environments}).
8269 @c =====================================================================
8271 @node Page Layout, Page Control, Line Control, gtroff Reference
8272 @section Page Layout
8274 @cindex layout, page
8276 @code{gtroff} provides some very primitive operations for controlling
8279 @DefreqList {pl, [@Var{length}]}
8280 @DefreqItem {pl, @t{+}@Var{length}}
8281 @DefreqItem {pl, @t{-}@Var{length}}
8283 @cindex page length (@code{pl})
8284 @cindex length of page (@code{pl})
8285 Set the @dfn{page length} to @var{length} (or increment or decrement
8286 the current value by @var{length}). This is the length of the
8287 physical output page. The default scaling indicator is @samp{v}.
8289 @cindex page length register (@code{.p})
8290 The current setting can be found in the read-only number register
8295 @cindex bottom margin
8296 @cindex margin, bottom
8297 Note that this only specifies the size of the page, not the top and
8298 bottom margins. Those are not set by @code{gtroff} directly.
8299 @xref{Traps}, for further information on how to do this.
8301 Negative @code{pl} values are possible also, but not very useful: No
8302 trap is sprung, and each line is output on a single page (thus
8303 suppressing all vertical spacing).
8305 If no argument or an invalid argument is given, @code{pl} sets the page
8306 length to 11@dmn{i}.
8312 @code{gtroff} provides several operations which help in setting up top
8313 and bottom titles (or headers and footers).
8315 @Defreq {tl, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}}
8316 @cindex title line (@code{tl})
8317 @cindex three-part title (@code{tl})
8318 @cindex page number character (@code{%})
8319 Print a @dfn{title line}. It consists of three parts: a left
8320 justified portion, a centered portion, and a right justified portion.
8321 The argument separator @samp{'} can be replaced with any character not
8322 occurring in the title line. The @samp{%} character is replaced with
8323 the current page number. This character can be changed with the
8324 @code{pc} request (see below).
8326 Without argument, @code{tl} is ignored.
8332 A title line is not restricted to the top or bottom of a page.
8335 @code{tl} prints the title line immediately, ignoring a partially filled
8336 line (which stays untouched).
8339 It is not an error to omit closing delimiters. For example,
8340 @w{@samp{.tl /foo}} is equivalent to @w{@samp{.tl /foo///}}: It prints a
8341 title line with the left justified word @samp{foo}; the centered and
8342 right justfied parts are empty.
8345 @code{tl} accepts the same parameter delimiting characters as the
8346 @code{\A} escape; see @ref{Escapes}.
8350 @DefreqList {lt, [@Var{length}]}
8351 @DefreqItem {lt, @t{+}@Var{length}}
8352 @DefreqItem {lt, @t{-}@Var{length}}
8353 @DefregListEnd {.lt}
8354 @cindex length of title line (@code{lt})
8355 @cindex title line, length (@code{lt})
8356 @cindex title line length register (@code{.lt})
8357 The title line is printed using its own line length, which is
8358 specified (or incremented or decremented) with the @code{lt} request.
8359 Initially, the title line length is set to 6.5@dmn{i}. If a negative
8360 line length is specified (which is not allowed), @code{gtroff} emits a
8361 warning of type @samp{range} and sets the title line length to zero.
8362 The default scaling indicator is @samp{m}. If @code{lt} is called
8363 without an argument, the title length is reset to the previous value
8364 before the last call to @code{lt}.
8366 The current setting of this is available in the @code{.lt} read-only
8367 number register; it is associated with the current environment
8368 (@pxref{Environments}).
8371 @DefreqList {pn, page}
8372 @DefreqItem {pn, @t{+}@Var{page}}
8373 @DefreqItem {pn, @t{-}@Var{page}}
8374 @DefregListEnd {.pn}
8375 @cindex page number (@code{pn})
8376 @cindex number, page (@code{pn})
8377 Change (increase or decrease) the page number of the @emph{next} page.
8378 The only argument is the page number; the request is ignored without a
8381 The read-only number register @code{.pn} contains the number of the next
8382 page: either the value set by a @code{pn} request, or the number of the
8383 current page plus@tie{}1.
8386 @Defreq {pc, [@Var{char}]}
8387 @cindex changing the page number character (@code{pc})
8388 @cindex page number character, changing (@code{pc})
8390 Change the page number character (used by the @code{tl} request) to a
8391 different character. With no argument, this mechanism is disabled.
8392 Note that this doesn't affect the number register@tie{}@code{%}.
8398 @c =====================================================================
8400 @node Page Control, Fonts and Symbols, Page Layout, gtroff Reference
8401 @section Page Control
8402 @cindex page control
8403 @cindex control, page
8405 @DefreqList {bp, [@Var{page}]}
8406 @DefreqItem {bp, @t{+}@Var{page}}
8407 @DefreqItem {bp, @t{-}@Var{page}}
8409 @cindex new page (@code{bp})
8410 @cindex page, new (@code{bp})
8411 Stop processing the current page and move to the next page. This
8412 request causes a break. It can also take an argument to set
8413 (increase, decrease) the page number of the next page (which actually
8414 becomes the current page after @code{bp} has finished). The
8415 difference between @code{bp} and @code{pn} is that @code{pn} does not
8416 cause a break or actually eject a page. @xref{Page Layout}.
8419 .de newpage \" define macro
8421 'sp .5i \" vertical space
8422 .tl 'left top'center top'right top' \" title
8423 'sp .3i \" vertical space
8427 @cindex @code{bp} request, and top-level diversion
8428 @cindex top-level diversion, and @code{bp}
8429 @cindex diversion, top-level, and @code{bp}
8430 @code{bp} has no effect if not called within the top-level diversion
8431 (@pxref{Diversions}).
8433 @cindex page number register (@code{%})
8434 @cindex current page number (@code{%})
8435 The read-write register@tie{}@code{%} holds the current page number.
8437 The number register @code{.pe} is set to@tie{}1 while @code{bp} is
8438 active. @xref{Page Location Traps}.
8441 @Defreq {ne, [@Var{space}]}
8442 @cindex orphan lines, preventing with @code{ne}
8443 @cindex conditional page break (@code{ne})
8444 @cindex page break, conditional (@code{ne})
8445 It is often necessary to force a certain amount of space before a new
8446 page occurs. This is most useful to make sure that there is not a
8447 single @dfn{orphan} line left at the bottom of a page. The @code{ne}
8448 request ensures that there is a certain distance, specified by the
8449 first argument, before the next page is triggered (see @ref{Traps},
8450 for further information). The default scaling indicator for @code{ne}
8451 is @samp{v}; the default value of @var{space} is@tie{}1@dmn{v} if no
8454 For example, to make sure that no fewer than 2@tie{}lines get orphaned,
8455 do the following before each paragraph:
8462 @code{ne} will then automatically cause a page break if there is space
8466 @DefreqList {sv, [@Var{space}]}
8467 @DefreqListEnd {os, }
8468 @cindex @code{ne} request, comparison with @code{sv}
8469 @code{sv} is similar to the @code{ne} request; it reserves the
8470 specified amount of vertical space. If the desired amount of space
8471 exists before the next trap (or the bottom page boundary if no trap is
8472 set), the space is output immediately (ignoring a partially filled line
8473 which stays untouched). If there is not enough space, it is stored for
8474 later output via the @code{os} request. The default value is@tie{}1@dmn{v}
8475 if no argument is given; the default scaling indicator is @samp{v}.
8477 @cindex @code{sv} request, and no-space mode
8478 @cindex @code{os} request, and no-space mode
8479 Both @code{sv} and @code{os} ignore no-space mode. While the @code{sv}
8480 request allows negative values for @var{space}, @code{os} will ignore
8485 @cindex current vertical position (@code{nl})
8486 @cindex vertical position, current (@code{nl})
8487 @cindex position, vertical, current (@code{nl})
8488 This register contains the current vertical position. If the vertical
8489 position is zero and the top of page transition hasn't happened yet,
8490 @code{nl} is set to negative value. @code{gtroff} itself does this at
8491 the very beginning of a document before anything has been printed, but
8492 the main usage is to plant a header trap on a page if this page has
8495 Consider the following:
8527 Without resetting @code{nl} to a negative value, the just planted trap
8528 would be active beginning with the @emph{next} page, not the current
8531 @xref{Diversions}, for a comparison with the @code{.h} and @code{.d}
8535 @c =====================================================================
8537 @node Fonts and Symbols, Sizes, Page Control, gtroff Reference
8538 @section Fonts and Symbols
8541 @code{gtroff} can switch fonts at any point in the text.
8543 The basic set of fonts is @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
8544 These are Times Roman, Italic, Bold, and Bold Italic. For non-TTY
8545 devices, there is also at least one symbol font which contains various
8546 special symbols (Greek, mathematics).
8554 * Artificial Fonts::
8555 * Ligatures and Kerning::
8558 @c ---------------------------------------------------------------------
8560 @node Changing Fonts, Font Families, Fonts and Symbols, Fonts and Symbols
8561 @subsection Changing Fonts
8564 @DefreqList {ft, [@Var{font}]}
8565 @DefescItem {\\f, , f, }
8566 @DefescItem {\\f, @Lparen{}, fn, }
8567 @DefescItem {\\f, @Lbrack{}, font, @Rbrack{}}
8568 @DefregListEnd {.sty}
8569 @cindex changing fonts (@code{ft}, @code{\f})
8570 @cindex fonts, changing (@code{ft}, @code{\f})
8571 @cindex @code{sty} request, and changing fonts
8572 @cindex @code{fam} request, and changing fonts
8573 @cindex @code{\F}, and changing fonts
8577 The @code{ft} request and the @code{\f} escape change the current font
8578 to @var{font} (one-character name@tie{}@var{f}, two-character name
8581 If @var{font} is a style name (as set with the @code{sty} request or
8582 with the @code{styles} command in the @file{DESC} file), use it within
8583 the current font family (as set with the @code{fam} request, @code{\F}
8584 escape, or with the @code{family} command in the @file{DESC} file).
8586 @cindex previous font (@code{ft}, @code{\f[]}, @code{\fP})
8587 @cindex font, previous (@code{ft}, @code{\f[]}, @code{\fP})
8588 With no argument or using @samp{P} as an argument, @code{.ft} switches
8589 to the previous font. Use @code{\f[]} to do this with the escape. The
8590 old syntax forms @code{\fP} or @code{\f[P]} are also supported.
8592 Fonts are generally specified as upper-case strings, which are usually
8593 1@tie{}to 4 characters representing an abbreviation or acronym of the
8594 font name. This is no limitation, just a convention.
8596 The example below produces two identical lines.
8605 eggs, bacon, \fBspam\fP and sausage.
8608 Note that @code{\f} doesn't produce an input token in @code{gtroff}.
8609 As a consequence, it can be used in requests like @code{mc} (which
8610 expects a single character as an argument) to change the font on
8617 The current style name is available in the read-only number register
8618 @samp{.sty} (this is a string-valued register); if the current font
8619 isn't a style, the empty string is returned. It is associated with
8620 the current environment.
8622 @xref{Font Positions}, for an alternative syntax.
8625 @Defreq {ftr, f [@Var{g}]}
8626 @cindex @code{ft} request, and font translations
8627 @cindex @code{ul} request, and font translations
8628 @cindex @code{bd} request, and font translations
8629 @cindex @code{\f}, and font translations
8630 @cindex @code{cs} request, and font translations
8631 @cindex @code{tkf} request, and font translations
8632 @cindex @code{special} request, and font translations
8633 @cindex @code{fspecial} request, and font translations
8634 @cindex @code{fp} request, and font translations
8635 @cindex @code{sty} request, and font translations
8636 @cindex @code{if} request, and font translations
8637 @cindex @code{ie} request, and font translations
8638 @cindex @code{while} request, and font translations
8639 Translate font@tie{}@var{f} to font@tie{}@var{g}. Whenever a font
8640 named@tie{}@var{f} is referred to in a @code{\f} escape sequence,
8641 in the @code{F} and @code{S} conditional operators, or in the
8642 @code{ft}, @code{ul}, @code{bd}, @code{cs}, @code{tkf},
8643 @code{special}, @code{fspecial}, @code{fp}, or @code{sty} requests,
8644 font@tie{}@var{g} is used. If @var{g} is missing or equal to@tie{}@var{f}
8645 the translation is undone.
8648 @c ---------------------------------------------------------------------
8650 @node Font Families, Font Positions, Changing Fonts, Fonts and Symbols
8651 @subsection Font Families
8652 @cindex font families
8653 @cindex families, font
8655 @cindex styles, font
8657 Due to the variety of fonts available, @code{gtroff} has added the
8658 concept of @dfn{font families} and @dfn{font styles}. The fonts are
8659 specified as the concatenation of the font family and style. Specifying
8660 a font without the family part causes @code{gtroff} to use that style of
8663 @cindex PostScript fonts
8664 @cindex fonts, PostScript
8665 Currently, fonts for the devices @option{-Tps}, @option{-Tdvi},
8666 @option{-Tlj4}, @option{-Tlbp}, and the X11 fonts are set up to this
8667 mechanism. By default, @code{gtroff} uses the Times family with the four
8668 styles @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
8670 This way, it is possible to use the basic four fonts and to select a
8671 different font family on the command line (@pxref{Groff Options}).
8673 @DefreqList {fam, [@Var{family}]}
8675 @DefescItem {\\F, , f, }
8676 @DefescItem {\\F, @Lparen{}, fm, }
8677 @DefescItem {\\F, @Lbrack{}, family, @Rbrack{}}
8678 @DefregListEnd {.fn}
8679 @cindex changing font family (@code{fam}, @code{\F})
8680 @cindex font family, changing (@code{fam}, @code{\F})
8681 Switch font family to @var{family} (one-character name@tie{}@var{f},
8682 two-character name @var{fm}). If no argument is given, switch
8683 back to the previous font family. Use @code{\F[]} to do this with the
8684 escape. Note that @code{\FP} doesn't work; it selects font family
8687 The value at start-up is @samp{T}.
8688 The current font family is available in the read-only number register
8689 @samp{.fam} (this is a string-valued register); it is associated with
8690 the current environment.
8694 .fam H \" helvetica family
8695 spam, \" used font is family H + style R = HR
8696 .ft B \" family H + style B = font HB
8698 .fam T \" times family
8699 spam, \" used font is family T + style B = TB
8700 .ft AR \" font AR (not a style)
8702 .ft R \" family T + style R = font TR
8706 Note that @code{\F} doesn't produce an input token in @code{gtroff}.
8707 As a consequence, it can be used in requests like @code{mc} (which
8708 expects a single character as an argument) to change the font family on
8715 The @samp{.fn} register contains the current @dfn{real font name}
8716 of the current font.
8717 This is a string-valued register.
8718 If the current font is a style, the value of @code{\n[.fn]}
8719 is the proper concatenation of family and style name.
8722 @Defreq {sty, n style}
8723 @cindex changing font style (@code{sty})
8724 @cindex font style, changing (@code{sty})
8725 @cindex @code{cs} request, and font styles
8726 @cindex @code{bd} request, and font styles
8727 @cindex @code{tkf} request, and font styles
8728 @cindex @code{uf} request, and font styles
8729 @cindex @code{fspecial} request, and font styles
8730 Associate @var{style} with font position@tie{}@var{n}. A font position
8731 can be associated either with a font or with a style. The current
8732 font is the index of a font position and so is also either a font or a
8733 style. If it is a style, the font that is actually used is the font
8734 which name is the concatenation of the name of the current
8735 family and the name of the current style. For example, if the current
8736 font is@tie{}1 and font position@tie{}1 is associated with style
8737 @samp{R} and the current font family is @samp{T}, then font
8738 @samp{TR} will be used. If the current font is not a style, then the
8739 current family is ignored. If the requests @code{cs}, @code{bd},
8740 @code{tkf}, @code{uf}, or @code{fspecial} are applied to a style,
8741 they will instead be applied to the member of the current family
8742 corresponding to that style.
8744 @var{n}@tie{}must be a non-negative integer value.
8748 The default family can be set with the @option{-f} option
8749 (@pxref{Groff Options}). The @code{styles} command in the @file{DESC}
8750 file controls which font positions (if any) are initially associated
8751 with styles rather than fonts. For example, the default setting for
8752 @sc{PostScript} fonts
8768 @code{fam} and @code{\F} always check whether the current font position
8769 is valid; this can give surprising results if the current font position is
8770 associated with a style.
8772 In the following example, we want to access the @sc{PostScript} font
8773 @code{FooBar} from the font family @code{Foo}:
8778 @result{} warning: can't find font `FooR'
8782 The default font position at start-up is@tie{}1; for the
8783 @sc{PostScript} device, this is associated with style @samp{R}, so
8784 @code{gtroff} tries to open @code{FooR}.
8786 A solution to this problem is to use a dummy font like the following:
8789 .fp 0 dummy TR \" set up dummy font at position 0
8790 .sty \n[.fp] Bar \" register style `Bar'
8791 .ft 0 \" switch to font at position 0
8792 .fam Foo \" activate family `Foo'
8793 .ft Bar \" switch to font `FooBar'
8796 @xref{Font Positions}.
8799 @c ---------------------------------------------------------------------
8801 @node Font Positions, Using Symbols, Font Families, Fonts and Symbols
8802 @subsection Font Positions
8803 @cindex font positions
8804 @cindex positions, font
8806 For the sake of old phototypesetters and compatibility with old versions
8807 of @code{troff}, @code{gtroff} has the concept of font @dfn{positions},
8808 on which various fonts are mounted.
8810 @DefreqList {fp, pos font [@Var{external-name}]}
8812 @DefregListEnd {.fp}
8813 @cindex mounting font (@code{fp})
8814 @cindex font, mounting (@code{fp})
8815 Mount font @var{font} at position @var{pos} (which must be a
8816 non-negative integer). This numeric position can then be referred to
8817 with font changing commands. When @code{gtroff} starts it is using
8818 font position@tie{}1 (which must exist; position@tie{}0 is unused
8819 usually at start-up).
8821 @cindex font position register (@code{.f})
8822 The current font in use, as a font position, is available in the
8823 read-only number register @samp{.f}. This can be useful to remember the
8824 current font for later recall. It is associated with the current
8825 environment (@pxref{Environments}).
8828 .nr save-font \n[.f]
8830 ... text text text ...
8834 @cindex next free font position register (@code{.fp})
8835 The number of the next free font position is available in the read-only
8836 number register @samp{.fp}. This is useful when mounting a new font,
8840 .fp \n[.fp] NEATOFONT
8843 @pindex DESC@r{, and font mounting}
8844 Fonts not listed in the @file{DESC} file are automatically mounted on
8845 the next available font position when they are referenced. If a font
8846 is to be mounted explicitly with the @code{fp} request on an unused
8847 font position, it should be mounted on the first unused font position,
8848 which can be found in the @code{.fp} register. Although @code{gtroff}
8849 does not enforce this strictly, it is not allowed to mount a font at a
8850 position whose number is much greater (approx.@: 1000 positions) than
8851 that of any currently used position.
8853 The @code{fp} request has an optional third argument. This argument
8854 gives the external name of the font, which is used for finding the font
8855 description file. The second argument gives the internal name of the
8856 font which is used to refer to the font in @code{gtroff} after it has
8857 been mounted. If there is no third argument then the internal name is
8858 used as the external name. This feature makes it possible to use
8859 fonts with long names in compatibility mode.
8862 Both the @code{ft} request and the @code{\f} escape have alternative
8863 syntax forms to access font positions.
8865 @DefreqList {ft, nnn}
8866 @DefescItem {\\f, , n, }
8867 @DefescItem {\\f, @Lparen{}, nn, }
8868 @DefescListEnd {\\f, @Lbrack{}, nnn, @Rbrack{}}
8869 @cindex changing font position (@code{\f})
8870 @cindex font position, changing (@code{\f})
8871 @cindex @code{sty} request, and font positions
8872 @cindex @code{fam} request, and font positions
8873 @cindex @code{\F}, and font positions
8877 Change the current font position to @var{nnn} (one-digit
8878 position@tie{}@var{n}, two-digit position @var{nn}), which must be a
8879 non-negative integer.
8881 If @var{nnn} is associated with a style (as set with the @code{sty}
8882 request or with the @code{styles} command in the @file{DESC} file), use
8883 it within the current font family (as set with the @code{fam} request,
8884 the @code{\F} escape, or with the @code{family} command in the @file{DESC}
8891 .ft \" switch back to font 1
8895 this is font 1 again
8898 @xref{Changing Fonts}, for the standard syntax form.
8901 @c ---------------------------------------------------------------------
8903 @node Using Symbols, Special Fonts, Font Positions, Fonts and Symbols
8904 @subsection Using Symbols
8905 @cindex using symbols
8906 @cindex symbols, using
8911 A @dfn{glyph} is a graphical representation of a @dfn{character}.
8912 While a character is an abstract entity containing semantic
8913 information, a glyph is something which can be actually seen on screen
8914 or paper. It is possible that a character has multiple glyph
8915 representation forms (for example, the character `A' can be either
8916 written in a roman or an italic font, yielding two different glyphs);
8917 sometimes more than one character maps to a single glyph (this is a
8918 @dfn{ligature} -- the most common is `fi').
8921 @cindex special fonts
8924 @cindex @code{special} request, and glyph search order
8925 @cindex @code{fspecial} request, and glyph search order
8926 A @dfn{symbol} is simply a named glyph. Within @code{gtroff}, all
8927 glyph names of a particular font are defined in its font file. If the
8928 user requests a glyph not available in this font, @code{gtroff} looks
8929 up an ordered list of @dfn{special fonts}. By default, the
8930 @sc{PostScript} output device supports the two special fonts @samp{SS}
8931 (slanted symbols) and @samp{S} (symbols) (the former is looked up
8932 before the latter). Other output devices use different names for
8933 special fonts. Fonts mounted with the @code{fonts} keyword in the
8934 @file{DESC} file are globally available. To install additional
8935 special fonts locally (i.e.@: for a particular font), use the
8936 @code{fspecial} request.
8938 Here the exact rules how @code{gtroff} searches a given symbol:
8942 If the symbol has been defined with the @code{char} request, use it.
8943 This hides a symbol with the same name in the current font.
8946 Check the current font.
8949 If the symbol has been defined with the @code{fchar} request, use it.
8952 Check whether the current font has a font-specific list of special fonts;
8953 test all fonts in the order of appearance in the last @code{fspecial}
8954 call if appropriate.
8957 If the symbol has been defined with the @code{fschar} request for the
8958 current font, use it.
8961 Check all fonts in the order of appearance in the last @code{special}
8965 If the symbol has been defined with the @code{schar} request, use it.
8968 As a last resort, consult all fonts loaded up to now for special fonts
8969 and check them, starting with the lowest font number. Note that this can
8970 sometimes lead to surprising results since the @code{fonts} line in the
8971 @file{DESC} file often contains empty positions which are filled later
8972 on. For example, consider the following:
8979 This mounts font @code{foo} at font position@tie{}3. We assume that
8980 @code{FOO} is a special font, containing glyph @code{foo},
8981 and that no font has been loaded yet. The line
8988 makes font @code{BAZ} special only if font @code{BAR} is active. We
8989 further assume that @code{BAZ} is really a special font, i.e., the font
8990 description file contains the @code{special} keyword, and that it
8991 also contains glyph @code{foo} with a special shape fitting to font
8992 @code{BAR}. After executing @code{fspecial}, font @code{BAR} is loaded at
8993 font position@tie{}1, and @code{BAZ} at position@tie{}2.
8995 We now switch to a new font @code{XXX}, trying to access glyph @code{foo}
8996 which is assumed to be missing. There are neither font-specific special
8997 fonts for @code{XXX} nor any other fonts made special with the
8998 @code{special} request, so @code{gtroff} starts the search for special
8999 fonts in the list of already mounted fonts, with increasing font
9000 positions. Consequently, it finds @code{BAZ} before @code{FOO} even for
9001 @code{XXX} which is not the intended behaviour.
9004 @xref{Font Files}, and @ref{Special Fonts}, for more details.
9006 @cindex list of available glyphs (@cite{groff_char(7)} man page)
9007 @cindex available glyphs, list (@cite{groff_char(7)} man page)
9008 @cindex glyphs, available, list (@cite{groff_char(7)} man page)
9009 The list of available symbols is device dependent; see the
9010 @cite{groff_char(7)} man page for a complete list of all glyphs. For
9014 man -Tdvi groff_char > groff_char.dvi
9018 for a list using the default DVI fonts (not all versions of the
9019 @code{man} program support the @option{-T} option). If you want to
9020 use an additional macro package to change the used fonts, @code{groff}
9021 must be called directly:
9024 groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
9027 @cindex composite glyph names
9028 @cindex glyph names, composite
9029 @cindex groff glyph list (GGL)
9030 @cindex GGL (groff glyph list)
9031 @cindex adobe glyph list (AGL)
9032 @cindex AGL (adobe glyph list)
9033 Glyph names not listed in groff_char(7) are derived algorithmically,
9034 using a simplified version of the Adobe Glyph List (AGL) algorithm
9035 which is described in
9036 @uref{http://partners.adobe.com@//asn@//tech@//type@//unicodegn.jsp}.
9037 The (frozen) set of glyph names which can't be derived algorithmically
9038 is called @dfn{groff glyph list (GGL)}.
9042 A glyph for Unicode character U+@var{XXXX}[@var{X}[@var{X}]] which is
9043 not a composite character will be named
9044 @code{u@var{XXXX}@r{[}@var{X}@r{[}@var{X}@r{]]}}. @var{X} must be an
9045 uppercase hexadecimal digit. Examples: @code{u1234}, @code{u008E},
9046 @code{u12DB8}. The largest Unicode value is 0x10FFFF. There must be at
9047 least four @code{X} digits; if necessary, add leading zeroes (after the
9048 @samp{u}). No zero padding is allowed for character codes greater than
9049 0xFFFF. Surrogates (i.e., Unicode values greater than 0xFFFF
9050 represented with character codes from the surrogate area U+D800-U+DFFF)
9051 are not allowed too.
9054 A glyph representing more than a single input character will be named
9057 @samp{u} @var{component1} @samp{_} @var{component2} @samp{_} @var{component3} @dots{}
9061 Example: @code{u0045_0302_0301}.
9063 For simplicity, all Unicode characters which are composites must be
9064 decomposed maximally (this is normalization form@tie{}D in the Unicode
9065 standard); for example, @code{u00CA_0301} is not a valid glyph name
9066 since U+00CA (@sc{latin capital letter e with circumflex}) can be
9067 further decomposed into U+0045 (@sc{latin capital letter e}) and U+0302
9068 (@sc{combining circumflex accent}). @code{u0045_0302_0301} is thus the
9069 glyph name for U+1EBE, @sc{latin capital letter e with circumflex and
9073 groff maintains a table to decompose all algorithmically derived glyph
9074 names which are composites itself. For example, @code{u0100} (@sc{latin
9075 letter a with macron}) will be automatically decomposed into
9076 @code{u0041_0304}. Additionally, a glyph name of the GGL is preferred
9077 to an algorithmically derived glyph name; groff also automatically does
9078 the mapping. Example: The glyph @code{u0045_0302} will be mapped to
9082 glyph names of the GGL can't be used in composite glyph names; for
9083 example, @code{^E_u0301} is invalid.
9086 @DefescList {\\, @Lparen{}, nm, }
9087 @DefescItem {\\, @Lbrack{}, name, @Rbrack{}}
9088 @DefescListEnd {\\, @Lbrack{}, component1 component2 @dots{}, @Rbrack{}}
9089 Insert a symbol @var{name} (two-character name @var{nm}) or a composite
9090 glyph with component glyphs @var{component1}, @var{component2},
9091 @enddots{} There is no special syntax for one-character names -- the
9092 natural form @samp{\@var{n}} would collide with escapes.@footnote{Note
9093 that a one-character symbol is not the same as an input character, i.e.,
9094 the character @code{a} is not the same as @code{\[a]}. By default,
9095 @code{groff} defines only a single one-character symbol, @code{\[-]}; it
9096 is usually accessed as @code{\-}. On the other hand, @code{gtroff} has
9097 the special feature that @code{\[char@var{XXX}]} is the same as the
9098 input character with character code @var{XXX}. For example,
9099 @code{\[char97]} is identical to the letter @code{a} if @acronym{ASCII}
9100 encoding is active.}
9102 If @var{name} is undefined, a warning of type @samp{char} is generated,
9103 and the escape is ignored. @xref{Debugging}, for information about
9106 groff resolves @code{\[...]} with more than a single component as
9111 Any component which is found in the GGL will be converted to the
9112 @code{u@var{XXXX}} form.
9115 Any component @code{u@var{XXXX}} which is found in the list of
9116 decomposable glyphs will be decomposed.
9119 The resulting elements are then concatenated with @samp{_} inbetween,
9120 dropping the leading @samp{u} in all elements but the first.
9123 No check for the existence of any component (similar to @code{tr}
9124 request) will be done.
9130 @samp{A} maps to @code{u0041}, @samp{ho} maps to @code{u02DB}, thus the
9131 final glyph name would be @code{u0041_02DB}. Note this is not the
9132 expected result: The ogonek glyph @samp{ho} is a spacing ogonek, but for
9133 a proper composite a non-spacing ogonek (U+0328) is necessary. Looking
9134 into the file @file{composite.tmac} one can find @w{@samp{.composite ho
9135 u0328}} which changes the mapping of @samp{ho} while a composite glyph
9136 name is constructed, causing the final glyph name to be
9143 @samp{^E} maps to @code{u0045_0302}, thus the final glyph name is
9144 @code{u0045_0302_0301} in all forms (assuming proper calls of the
9145 @code{composite} request).
9148 It is not possible to define glyphs with names like @w{@samp{A ho}}
9149 within a groff font file. This is not really a limitation; instead, you
9150 have to define @code{u0041_0328}.
9153 @Defesc {\\C, ', xxx, '}
9154 @cindex named character (@code{\C})
9155 @cindex character, named (@code{\C})
9156 Typeset the glyph named @var{xxx}.@footnote{@code{\C} is actually a
9157 misnomer since it accesses an output glyph.} Normally it is more
9158 convenient to use @code{\[@var{xxx}]}, but @code{\C} has the advantage
9159 that it is compatible with newer versions of @acronym{AT&T}
9160 @code{troff} and is available in compatibility mode.
9163 @Defreq {composite, from to}
9164 @pindex composite.tmac
9165 Map glyph name @var{from} to glyph name @var{to} if it is used in
9166 @code{\[...]} with more than one component. See above for examples.
9168 This mapping is based on glyph names only; no check for the existence of
9169 either glyph is done.
9171 A set of default mappings for many accents can be found in the file
9172 @file{composite.tmac} which is loaded at start-up.
9175 @Defesc {\\N, ', n, '}
9176 @cindex numbered glyph (@code{\N})
9177 @cindex glyph, numbered (@code{\N})
9178 @cindex @code{char} request, used with @code{\N}
9180 Typeset the glyph with code@tie{}@var{n} in the current font
9181 (@code{n}@tie{}is @strong{not} the input character code). The
9182 number @var{n}@tie{}can be any non-negative decimal integer. Most devices
9183 only have glyphs with codes between 0 and@tie{}255; the Unicode
9184 output device uses codes in the range 0--65535. If the current
9185 font does not contain a glyph with that code, special fonts are
9186 @emph{not} searched. The @code{\N} escape sequence can be
9187 conveniently used in conjunction with the @code{char} request:
9190 .char \[phone] \f[ZD]\N'37'
9195 @cindex unnamed glyphs
9196 @cindex glyphs, unnamed
9197 The code of each glyph is given in the fourth column in the font
9198 description file after the @code{charset} command. It is possible to
9199 include unnamed glyphs in the font description file by using a
9200 name of @samp{---}; the @code{\N} escape sequence is the only way to
9203 No kerning is applied to glyphs accessed with @code{\N}.
9206 Some escape sequences directly map onto special glyphs.
9209 This is a backslash followed by the apostrophe character, @acronym{ASCII}
9210 character @code{0x27} (@acronym{EBCDIC} character @code{0x7D}). The same
9211 as @code{\[aa]}, the acute accent.
9215 This is a backslash followed by @acronym{ASCII} character @code{0x60}
9216 (@acronym{EBCDIC} character @code{0x79} usually). The same as
9217 @code{\[ga]}, the grave accent.
9221 This is the same as @code{\[-]}, the minus sign in the current font.
9224 @Defreq {cflags, n c1 c2 @dots{}}
9225 @cindex glyph properties (@code{cflags})
9226 @cindex character properties (@code{cflags})
9227 @cindex properties of glyphs (@code{cflags})
9228 @cindex properties of characters (@code{cflags})
9229 Input characters and symbols have certain properties associated
9230 with it.@footnote{Note that the output glyphs themselves don't have
9231 such properties. For @code{gtroff}, a glyph is a numbered box with
9232 a given width, depth, and height, nothing else. All manipulations
9233 with the @code{cflags} request work on the input level.} These
9234 properties can be modified with the @code{cflags} request. The
9235 first argument is the sum of the desired flags and the remaining
9236 arguments are the characters or symbols to have those properties.
9237 It is possible to omit the spaces between the characters or symbols.
9241 @cindex end-of-sentence characters
9242 @cindex characters, end-of-sentence
9243 The character ends sentences (initially characters @samp{.?!} have this
9247 @cindex hyphenating characters
9248 @cindex characters, hyphenation
9249 Lines can be broken before the character (initially no characters have
9253 @cindex @code{hy} glyph, and @code{cflags}
9254 @cindex @code{em} glyph, and @code{cflags}
9255 Lines can be broken after the character (initially the character
9256 @samp{-} and the symbols @samp{\[hy]} and @samp{\[em]} have this property).
9259 @cindex overlapping characters
9260 @cindex characters, overlapping
9261 @cindex @code{ul} glyph, and @code{cflags}
9262 @cindex @code{rn} glyph, and @code{cflags}
9263 @cindex @code{ru} glyph, and @code{cflags}
9264 @cindex @code{radicalex} glyph, and @code{cflags}
9265 @cindex @code{sqrtex} glyph, and @code{cflags}
9266 The character overlaps horizontally if used as a horizontal line building
9267 element. Initially the symbols @samp{\[ul]}, @samp{\[rn]}, @samp{\[ru]},
9268 @samp{\[radicalex]}, and @samp{\[sqrtex]} have this property.
9271 @cindex @code{br} glyph, and @code{cflags}
9272 The character overlaps vertically if used as vertical line building element.
9273 Initially symbol @samp{\[br]} has this property.
9276 @cindex transparent characters
9277 @cindex character, transparent
9278 @cindex @code{"}, at end of sentence
9279 @cindex @code{'}, at end of sentence
9280 @cindex @code{)}, at end of sentence
9281 @cindex @code{]}, at end of sentence
9282 @cindex @code{*}, at end of sentence
9283 @cindex @code{dg} glyph, at end of sentence
9284 @cindex @code{rq} glyph, at end of sentence
9285 An end-of-sentence character followed by any number of characters with
9286 this property is treated as the end of a sentence if followed by a
9287 newline or two spaces; in other words the character is
9288 @dfn{transparent} for the purposes of end-of-sentence recognition --
9289 this is the same as having a zero space factor in @TeX{} (initially
9290 characters @samp{"')]*} and the symbols @samp{\[dg]} and @samp{\[rq]} have
9295 @DefreqList {char, g [@Var{string}]}
9296 @DefreqItem {fchar, g [@Var{string}]}
9297 @DefreqItem {fschar, f g [@Var{string}]}
9298 @DefreqListEnd {schar, g [@Var{string}]}
9299 @cindex defining character (@code{char})
9300 @cindex defining fallback character (@code{fchar}, @code{fschar}, @code{schar})
9301 @cindex character, defining (@code{char})
9302 @cindex character, defining fallback (@code{fchar}, @code{fschar}, @code{schar})
9303 @cindex fallback character, defining (@code{fchar}, @code{fschar}, @code{schar})
9304 @cindex creating new characters (@code{char})
9305 @cindex defining symbol (@code{char})
9306 @cindex symbol, defining (@code{char})
9307 @cindex defining glyph (@code{char})
9308 @cindex glyph, defining (@code{char})
9309 @cindex escape character, while defining glyph
9310 @cindex character, escape, while defining glyph
9311 @cindex @code{tr} request, and glyph definitions
9312 @cindex @code{cp} request, and glyph definitions
9313 @cindex @code{rc} request, and glyph definitions
9314 @cindex @code{lc} request, and glyph definitions
9315 @cindex @code{\l}, and glyph definitions
9316 @cindex @code{\L}, and glyph definitions
9317 @cindex @code{\&}, and glyph definitions
9318 @cindex @code{\e}, and glyph definitions
9319 @cindex @code{hcode} request, and glyph definitions
9320 Define a new glyph@tie{}@var{g} to be @var{string} (which can be
9321 empty).@footnote{@code{char} is a misnomer since an output glyph is
9322 defined.} Every time glyph@tie{}@var{g} needs to be printed,
9323 @var{string} is processed in a temporary environment and the result is
9324 wrapped up into a single object. Compatibility mode is turned off and
9325 the escape character is set to @samp{\} while @var{string} is being
9326 processed. Any emboldening, constant spacing or track kerning is
9327 applied to this object rather than to individual characters in
9330 A glyph defined by these requests can be used just
9331 like a normal glyph provided by the output device. In particular,
9332 other characters can be translated to it with the @code{tr} or
9333 @code{trin} requests; it can be made the leader character by the
9334 @code{lc} request; repeated patterns can be drawn with the glyph
9335 using the @code{\l} and @code{\L} escape sequences; words containing
9336 the glyph can be hyphenated correctly if the @code{hcode} request
9337 is used to give the glyph's symbol a hyphenation code.
9339 There is a special anti-recursion feature: Use of @code{g} within
9340 the glyph's definition is handled like normal characters and symbols
9341 not defined with @code{char}.
9343 Note that the @code{tr} and @code{trin} requests take precedence if
9344 @code{char} accesses the same symbol.
9358 The @code{fchar} request defines a fallback glyph:
9359 @code{gtroff} only checks for glyphs defined with @code{fchar}
9360 if it cannot find the glyph in the current font.
9361 @code{gtroff} carries out this test before checking special fonts.
9363 @code{fschar} defines a fallback glyph for font@tie{}@var{f}: @code{gtroff}
9364 checks for glyphs defined with @code{fschar} after the list of fonts
9365 declared as font-specific special fonts with the @code{fspecial} request,
9366 but before the list of fonts declared as global special fonts with the
9367 @code{special} request.
9369 Finally, the @code{schar} request defines a global fallback glyph:
9370 @code{gtroff} checks for glyphs defined with @code{schar} after the list
9371 of fonts declared as global special fonts with the @code{special} request,
9372 but before the already mounted special fonts.
9374 @xref{Using Symbols}, for a detailed description of the glyph
9375 searching mechanism in @code{gtroff}.
9378 @DefreqList {rchar, c1 c2 @dots{}}
9379 @DefreqListEnd {rfschar, f c1 c2 @dots{}}
9380 @cindex removing glyph definition (@code{rchar}, @code{rfschar})
9381 @cindex glyph, removing definition (@code{rchar}, @code{rfschar})
9382 @cindex fallback glyph, removing definition (@code{rchar}, @code{rfschar})
9383 Remove the definitions of glyphs @var{c1}, @var{c2},@tie{}@enddots{}
9384 This undoes the effect of a @code{char}, @code{fchar}, or
9385 @code{schar} request.
9387 It is possible to omit the whitespace between arguments.
9389 The request @code{rfschar} removes glyph definitions defined with
9390 @code{fschar} for glyph@tie{}f.
9393 @xref{Special Characters}.
9395 @c ---------------------------------------------------------------------
9397 @node Special Fonts, Artificial Fonts, Using Symbols, Fonts and Symbols
9398 @subsection Special Fonts
9399 @cindex special fonts
9400 @cindex fonts, special
9402 Special fonts are those that @code{gtroff} searches
9403 when it cannot find the requested glyph in the current font.
9404 The Symbol font is usually a special font.
9406 @code{gtroff} provides the following two requests to add more special
9407 fonts. @xref{Using Symbols}, for a detailed description of the glyph
9408 searching mechanism in @code{gtroff}.
9410 Usually, only non-TTY devices have special fonts.
9412 @DefreqList {special, [@Var{s1} @Var{s2} @dots{}]}
9413 @DefreqListEnd {fspecial, f [@Var{s1} @Var{s2} @dots{}]}
9416 Use the @code{special} request to define special fonts. Initially, this
9419 Use the @code{fspecial} request to designate special fonts only when
9420 font@tie{}@var{f} is active. Initially, this list is empty.
9422 Previous calls to @code{special} or @code{fspecial} are overwritten;
9423 without arguments, the particular list of special fonts is set to empty.
9424 Special fonts are searched in the order they appear as arguments.
9426 All fonts which appear in a call to @code{special} or @code{fspecial} are
9429 @xref{Using Symbols}, for the exact search order of glyphs.
9432 @c ---------------------------------------------------------------------
9434 @node Artificial Fonts, Ligatures and Kerning, Special Fonts, Fonts and Symbols
9435 @subsection Artificial Fonts
9436 @cindex artificial fonts
9437 @cindex fonts, artificial
9439 There are a number of requests and escapes for artificially creating
9440 fonts. These are largely vestiges of the days when output devices
9441 did not have a wide variety of fonts, and when @code{nroff} and
9442 @code{troff} were separate programs. Most of them are no longer
9443 necessary in GNU @code{troff}. Nevertheless, they are supported.
9445 @DefescList {\\H, ', height, '}
9446 @DefescItem {\\H, ', @t{+}height, '}
9447 @DefescItem {\\H, ', @t{-}height, '}
9448 @DefregListEnd {.height}
9449 @cindex changing the font height (@code{\H})
9450 @cindex font height, changing (@code{\H})
9451 @cindex height, font, changing (@code{\H})
9452 Change (increment, decrement) the height of the current font, but not
9453 the width. If @var{height} is zero, restore the original height.
9454 Default scaling indicator is @samp{z}.
9456 The read-only number register @code{.height} contains the font height as
9459 Currently, only the @option{-Tps} device supports this feature.
9461 Note that @code{\H} doesn't produce an input token in @code{gtroff}.
9462 As a consequence, it can be used in requests like @code{mc} (which
9463 expects a single character as an argument) to change the font on
9470 In compatibility mode, @code{gtroff} behaves differently: If an
9471 increment or decrement is used, it is always taken relative to the
9472 current point size and not relative to the previously selected font
9477 \H'+5'test \H'+5'test
9481 prints the word @samp{test} twice with the same font height (five
9482 points larger than the current font size).
9485 @DefescList {\\S, ', slant, '}
9486 @DefregListEnd {.slant}
9487 @cindex changing the font slant (@code{\S})
9488 @cindex font slant, changing (@code{\S})
9489 @cindex slant, font, changing (@code{\S})
9490 Slant the current font by @var{slant} degrees. Positive values slant
9491 to the right. Only integer values are possible.
9493 The read-only number register @code{.slant} contains the font slant as
9496 Currently, only the @option{-Tps} device supports this feature.
9498 Note that @code{\S} doesn't produce an input token in @code{gtroff}.
9499 As a consequence, it can be used in requests like @code{mc} (which
9500 expects a single character as an argument) to change the font on
9507 This request is incorrectly documented in the original @acronym{UNIX}
9508 troff manual; the slant is always set to an absolute value.
9511 @Defreq {ul, [@Var{lines}]}
9512 @cindex underlining (@code{ul})
9513 The @code{ul} request normally underlines subsequent lines if a TTY
9514 output device is used. Otherwise, the lines are printed in italics
9515 (only the term `underlined' is used in the following). The single
9516 argument is the number of input lines to be underlined; with no
9517 argument, the next line is underlined. If @var{lines} is zero or
9518 negative, stop the effects of @code{ul} (if it was active). Requests
9519 and empty lines do not count for computing the number of underlined
9520 input lines, even if they produce some output like @code{tl}. Lines
9521 inserted by macros (e.g.@: invoked by a trap) do count.
9523 At the beginning of @code{ul}, the current font is stored and the
9524 underline font is activated. Within the span of a @code{ul} request,
9525 it is possible to change fonts, but after the last line affected by
9526 @code{ul} the saved font is restored.
9528 This number of lines still to be underlined is associated with the
9529 current environment (@pxref{Environments}). The underline font can be
9530 changed with the @code{uf} request.
9532 @c XXX @xref should be changed to grotty
9534 @c @xref{Troff and Nroff Mode}, for a discussion how underlining is
9535 @c implemented in for TTY output devices, and which problems can arise.
9537 The @code{ul} request does not underline spaces.
9540 @Defreq {cu, [@Var{lines}]}
9541 @cindex continuous underlining (@code{cu})
9542 @cindex underlining, continuous (@code{cu})
9543 The @code{cu} request is similar to @code{ul} but underlines spaces as
9544 well (if a TTY output device is used).
9548 @cindex underline font (@code{uf})
9549 @cindex font for underlining (@code{uf})
9550 Set the underline font (globally) used by @code{ul} and @code{cu}. By
9551 default, this is the font at position@tie{}2. @var{font} can be either
9552 a non-negative font position or the name of a font.
9555 @DefreqList {bd, font [@Var{offset}]}
9556 @DefreqItem {bd, font1 font2 [@Var{offset}]}
9558 @cindex imitating bold face (@code{bd})
9559 @cindex bold face, imitating (@code{bd})
9560 Artificially create a bold font by printing each glyph twice,
9563 Two syntax forms are available.
9567 Imitate a bold font unconditionally. The first argument specifies the
9568 font to embolden, and the second is the number of basic units, minus
9569 one, by which the two glyphs are offset. If the second argument is
9570 missing, emboldening is turned off.
9572 @var{font} can be either a non-negative font position or the name of a
9575 @var{offset} is available in the @code{.b} read-only register if a
9576 special font is active; in the @code{bd} request, its default unit is
9579 @cindex @code{fspecial} request, and imitating bold
9581 @cindex embolding of special fonts
9582 @cindex special fonts, emboldening
9584 Imitate a bold form conditionally. Embolden @var{font1} by
9585 @var{offset} only if font @var{font2} is the current font. This
9586 command can be issued repeatedly to set up different emboldening
9587 values for different current fonts. If the second argument is
9588 missing, emboldening is turned off for this particular current font.
9590 This affects special fonts only (either set up with the @code{special}
9591 command in font files or with the @code{fspecial} request).
9595 @Defreq {cs, font [@Var{width} [@Var{em-size}]]}
9596 @cindex constant glyph space mode (@code{cs})
9597 @cindex mode for constant glyph space (@code{cs})
9598 @cindex glyph, constant space
9599 @cindex @code{ps} request, and constant glyph space mode
9600 Switch to and from @dfn{constant glyph space mode}. If activated, the
9601 width of every glyph is @math{@var{width}/36} ems. The em size is
9602 given absolutely by @var{em-size}; if this argument is missing, the em
9603 value is taken from the current font size (as set with the @code{ps}
9604 request) when the font is effectively in use. Without second and
9605 third argument, constant glyph space mode is deactivated.
9607 Default scaling indicator for @var{em-size} is @samp{z}; @var{width} is
9611 @c ---------------------------------------------------------------------
9613 @node Ligatures and Kerning, , Artificial Fonts, Fonts and Symbols
9614 @subsection Ligatures and Kerning
9615 @cindex ligatures and kerning
9616 @cindex kerning and ligatures
9618 Ligatures are groups of characters that are run together, i.e, producing
9619 a single glyph. For example, the letters `f' and `i' can form a
9620 ligature `fi' as in the word `file'. This produces a cleaner look
9621 (albeit subtle) to the printed output. Usually, ligatures are not
9622 available in fonts for TTY output devices.
9624 Most @sc{PostScript} fonts support the fi and fl ligatures. The C/A/T
9625 typesetter that was the target of @acronym{AT&T} @code{troff} also
9626 supported `ff', `ffi', and `ffl' ligatures. Advanced typesetters or
9627 `expert' fonts may include ligatures for `ft' and `ct', although GNU
9628 @code{troff} does not support these (yet).
9630 Only the current font is checked for ligatures and kerns; neither special
9631 fonts nor entities defined with the @code{char} request (and its siblings)
9632 are taken into account.
9634 @DefreqList {lg, [@Var{flag}]}
9635 @DefregListEnd {.lg}
9636 @cindex activating ligatures (@code{lg})
9637 @cindex ligatures, activating (@code{lg})
9638 @cindex ligatures enabled register (@code{.lg})
9639 Switch the ligature mechanism on or off; if the parameter is non-zero
9640 or missing, ligatures are enabled, otherwise disabled. Default is on.
9641 The current ligature mode can be found in the read-only number register
9642 @code{.lg} (set to 1 or@tie{}2 if ligatures are enabled, 0@tie{}otherwise).
9644 Setting the ligature mode to@tie{}2 enables the two-character ligatures
9645 (fi, fl, and ff) and disables the three-character ligatures (ffi and
9649 @dfn{Pairwise kerning} is another subtle typesetting mechanism that
9650 modifies the distance between a glyph pair to improve readability.
9651 In most cases (but not always) the distance is decreased.
9653 For example, compare the combination of the letters `V' and `A'. With
9654 kerning, `VA' is printed. Without kerning it appears as `V@w{}A'.
9656 Typewriter-like fonts and fonts for terminals where all glyphs
9657 have the same width don't use kerning.
9659 @DefreqList {kern, [@Var{flag}]}
9660 @DefregListEnd {.kern}
9661 @cindex activating kerning (@code{kern})
9662 @cindex kerning, activating (@code{kern})
9663 @cindex kerning enabled register (@code{.kern})
9664 Switch kerning on or off. If the parameter is non-zero or missing,
9665 enable pairwise kerning, otherwise disable it. The read-only number
9666 register @code{.kern} is set to@tie{}1 if pairwise kerning is enabled,
9669 @cindex zero width space character (@code{\&})
9670 @cindex character, zero width space (@code{\&})
9671 @cindex space character, zero width (@code{\&})
9672 If the font description file contains pairwise kerning information,
9673 glyphs from that font are kerned. Kerning between two glyphs
9674 can be inhibited by placing @code{\&} between them: @samp{V\&A}.
9676 @xref{Font File Format}.
9679 @cindex track kerning
9680 @cindex kerning, track
9681 @dfn{Track kerning} expands or reduces the space between glyphs.
9682 This can be handy, for example, if you need to squeeze a long word
9683 onto a single line or spread some text to fill a narrow column. It
9684 must be used with great care since it is usually considered bad
9685 typography if the reader notices the effect.
9687 @Defreq {tkf, f s1 n1 s2 n2}
9688 @cindex activating track kerning (@code{tkf})
9689 @cindex track kerning, activating (@code{tkf})
9690 Enable track kerning for font@tie{}@var{f}. If the current font
9691 is@tie{}@var{f} the width of every glyph is increased by an amount
9692 between @var{n1} and @var{n2} (@var{n1}, @var{n2} can be negative); if
9693 the current point size is less than or equal to @var{s1} the width is
9694 increased by @var{n1}; if it is greater than or equal to @var{s2} the
9695 width is increased by @var{n2}; if the point size is greater than or
9696 equal to @var{s1} and less than or equal to @var{s2} the increase in
9697 width is a linear function of the point size.
9699 The default scaling indicator is @samp{z} for @var{s1} and @var{s2},
9700 @samp{p} for @var{n1} and @var{n2}.
9702 Note that the track kerning amount is added even to the rightmost glyph
9703 in a line; for large values it is thus recommended to increase the line
9704 length by the same amount to compensate it.
9707 Sometimes, when typesetting letters of different fonts, more or less
9708 space at such boundaries are needed. There are two escapes to help
9712 @cindex italic correction (@code{\/})
9713 @cindex correction, italic (@code{\/})
9714 @cindex correction between italic and roman glyph (@code{\/}, @code{\,})
9715 @cindex roman glyph, correction after italic glyph (@code{\/})
9716 @cindex italic glyph, correction before roman glyph (@code{\/})
9717 @cindex glyph, italic correction (@code{\/})
9718 Increase the width of the preceding glyph so that the spacing
9719 between that glyph and the following glyph is correct if the
9720 following glyph is a roman glyph. For example, if an
9721 italic@tie{}@code{f} is immediately followed by a roman right
9722 parenthesis, then in many fonts the top right portion of the@tie{}@code{f}
9723 overlaps the top left of the right parenthesis. Use this escape
9724 sequence whenever an italic glyph is immediately followed by a
9725 roman glyph without any intervening space. This small amount of
9726 space is also called @dfn{italic correction}.
9729 @c can't use @Example...@endExample here
9733 @result{} {@it f}@r{)}
9735 @result{} @i{f}@r{)}
9741 @Defesc {\\\,, , , }
9742 @cindex left italic correction (@code{\,})
9743 @cindex correction, left italic (@code{\,})
9744 @cindex glyph, left italic correction (@code{\,})
9745 @cindex roman glyph, correction before italic glyph (@code{\,})
9746 @cindex italic glyph, correction after roman glyph (@code{\,})
9747 Modify the spacing of the following glyph so that the spacing
9748 between that glyph and the preceding glyph is correct if the
9749 preceding glyph is a roman glyph. Use this escape sequence
9750 whenever a roman glyph is immediately followed by an italic
9751 glyph without any intervening space. In analogy to above, this
9752 space could be called @dfn{left italic correction}, but this term
9756 @c can't use @Example...@endExample here
9760 @result{} @r{q}@i{f}
9762 @result{} @r{q}@math{@ptexcomma}@i{f}
9769 Insert a zero-width character, which is invisible. Its intended use
9770 is to stop interaction of a character with its surrounding.
9774 It prevents the insertion of extra space after an end-of-sentence
9780 @result{} Test. Test.
9783 @result{} Test. Test.
9787 It prevents interpretation of a control character at the beginning of
9792 @result{} warning: `Test' not defined
9798 It prevents kerning between two glyphs.
9801 @c can't use @Example...@endExample here
9807 @result{} @r{V@w{}A}
9813 It is needed to map an arbitrary character to nothing in the @code{tr}
9814 request (@pxref{Character Translations}).
9819 This escape is similar to @code{\&} except that it behaves like a
9820 character declared with the @code{cflags} request to be transparent
9821 for the purposes of an end-of-sentence character.
9823 Its main usage is in macro definitions to protect against arguments
9824 starting with a control character.
9836 @result{}This is a test.' This is a test.
9840 @result{}This is a test.' This is a test.
9845 @c =====================================================================
9847 @node Sizes, Strings, Fonts and Symbols, gtroff Reference
9853 @cindex size of type
9854 @cindex vertical spacing
9855 @cindex spacing, vertical
9856 @code{gtroff} uses two dimensions with each line of text, type size
9857 and vertical spacing. The @dfn{type size} is approximately the height
9858 of the tallest glyph.@footnote{This is usually the parenthesis.
9859 Note that in most cases the real dimensions of the glyphs in a font
9860 are @emph{not} related to its type size! For example, the standard
9861 @sc{PostScript} font families `Times Roman', `Helvetica', and
9862 `Courier' can't be used together at 10@dmn{pt}; to get acceptable
9863 output, the size of `Helvetica' has to be reduced by one point, and
9864 the size of `Courier' must be increased by one point.} @dfn{Vertical
9865 spacing} is the amount of space @code{gtroff} allows for a line of
9866 text; normally, this is about 20%@tie{}larger than the current type
9867 size. Ratios smaller than this can result in hard-to-read text;
9868 larger than this, it spreads the text out more vertically (useful for
9869 term papers). By default, @code{gtroff} uses 10@tie{}point type on
9870 12@tie{}point spacing.
9873 The difference between type size and vertical spacing is known, by
9874 typesetters, as @dfn{leading} (this is pronounced `ledding').
9877 * Changing Type Sizes::
9878 * Fractional Type Sizes::
9881 @c ---------------------------------------------------------------------
9883 @node Changing Type Sizes, Fractional Type Sizes, Sizes, Sizes
9884 @subsection Changing Type Sizes
9886 @DefreqList {ps, [@Var{size}]}
9887 @DefreqItem {ps, @t{+}@Var{size}}
9888 @DefreqItem {ps, @t{-}@Var{size}}
9889 @DefescItem {\\s, , size, }
9891 @cindex changing type sizes (@code{ps}, @code{\s})
9892 @cindex type sizes, changing (@code{ps}, @code{\s})
9893 @cindex point sizes, changing (@code{ps}, @code{\s})
9894 Use the @code{ps} request or the @code{\s} escape to change (increase,
9895 decrease) the type size (in points). Specify @var{size} as either an
9896 absolute point size, or as a relative change from the current size.
9897 The size@tie{}0, or no argument, goes back to the previous size.
9899 Default scaling indicator of @code{size} is @samp{z}. If @code{size}
9900 is zero or negative, it is set to 1@dmn{u}.
9902 @cindex type size registers (@code{.s}, @code{.ps})
9903 @cindex point size registers (@code{.s}, @code{.ps})
9904 The read-only number register @code{.s} returns the point size in
9905 points as a decimal fraction. This is a string. To get the point
9906 size in scaled points, use the @code{.ps} register instead.
9908 @code{.s} is associated with the current environment
9909 (@pxref{Environments}).
9916 wink, wink, \s+2nudge, nudge,\s+8 say no more!
9920 The @code{\s} escape may be called in a variety of ways. Much like
9921 other escapes there must be a way to determine where the argument ends
9922 and the text begins. Any of the following forms are valid:
9926 Set the point size to @var{n}@tie{}points. @var{n}@tie{}must be either
9927 0 or in the range 4 to@tie{}39.
9931 Increase or decrease the point size by @var{n}@tie{}points.
9932 @var{n}@tie{}must be exactly one digit.
9935 Set the point size to @var{nn}@tie{}points. @var{nn} must be exactly
9942 Increase or decrease the point size by @var{nn}@tie{}points. @var{nn}
9943 must be exactly two digits.
9946 Note that @code{\s} doesn't produce an input token in @code{gtroff}.
9947 As a consequence, it can be used in requests like @code{mc} (which
9948 expects a single character as an argument) to change the font on
9955 @xref{Fractional Type Sizes}, for yet another syntactical form of
9956 using the @code{\s} escape.
9959 @Defreq {sizes, s1 s2 @dots{} sn [0]}
9960 Some devices may only have certain permissible sizes, in which case
9961 @code{gtroff} rounds to the nearest permissible size.
9962 The @file{DESC} file specifies which sizes are permissible for the device.
9964 Use the @code{sizes} request to change the permissible sizes
9965 for the current output device.
9966 Arguments are in scaled points;
9967 the @code{sizescale} line in the
9968 @file{DESC} file for the output device
9969 provides the scaling factor.
9970 For example, if the scaling factor is 1000,
9971 then the value 12000 is 12@tie{}points.
9973 Each argument can be a single point size (such as @samp{12000}),
9974 or a range of sizes (such as @samp{4000-72000}).
9975 You can optionally end the list with a zero.
9978 @DefreqList {vs, [@Var{space}]}
9979 @DefreqItem {vs, @t{+}@Var{space}}
9980 @DefreqItem {vs, @t{-}@Var{space}}
9982 @cindex changing vertical line spacing (@code{vs})
9983 @cindex vertical line spacing, changing (@code{vs})
9984 @cindex vertical line spacing register (@code{.v})
9985 Change (increase, decrease) the vertical spacing by @var{space}. The
9986 default scaling indicator is @samp{p}.
9988 If @code{vs} is called without an argument, the vertical spacing is
9989 reset to the previous value before the last call to @code{vs}.
9991 @cindex @code{.V} register, and @code{vs}
9992 @code{gtroff} creates a warning of type @samp{range} if @var{space} is
9993 negative; the vertical spacing is then set to smallest positive value,
9994 the vertical resolution (as given in the @code{.V} register).
9996 Note that @w{@samp{.vs 0}} isn't saved in a diversion since it doesn't
9997 result in a vertical motion. You explicitly have to repeat this command
9998 before inserting the diversion.
10000 The read-only number register @code{.v} contains the current vertical
10001 spacing; it is associated with the current environment
10002 (@pxref{Environments}).
10005 @cindex vertical line spacing, effective value
10006 The effective vertical line spacing consists of four components. Breaking
10007 a line causes the following actions (in the given order).
10011 @cindex extra pre-vertical line space (@code{\x})
10012 @cindex line space, extra pre-vertical (@code{\x})
10013 Move the current point vertically by the @dfn{extra pre-vertical line
10014 space}. This is the minimum value of all @code{\x} escapes with a
10015 negative argument in the current output line.
10018 Move the current point vertically by the vertical line spacing as set with
10019 the @code{vs} request.
10022 Output the current line.
10025 @cindex extra post-vertical line space (@code{\x})
10026 @cindex line space, extra post-vertical (@code{\x})
10027 Move the current point vertically by the @dfn{extra post-vertical line
10028 space}. This is the maximum value of all @code{\x} escapes with a
10029 positive argument in the line which has just been output.
10032 @cindex post-vertical line spacing
10033 @cindex line spacing, post-vertical (@code{pvs})
10034 Move the current point vertically by the @dfn{post-vertical line spacing}
10035 as set with the @code{pvs} request.
10038 @cindex double-spacing (@code{vs}, @code{pvs})
10039 It is usually better to use @code{vs} or @code{pvs} instead of @code{ls}
10040 to produce double-spaced documents: @code{vs} and @code{pvs} have a finer
10041 granularity for the inserted vertical space compared to @code{ls};
10042 furthermore, certain preprocessors assume single-spacing.
10044 @xref{Manipulating Spacing}, for more details on the @code{\x} escape
10045 and the @code{ls} request.
10047 @DefreqList {pvs, [@Var{space}]}
10048 @DefreqItem {pvs, @t{+}@Var{space}}
10049 @DefreqItem {pvs, @t{-}@Var{space}}
10050 @DefregListEnd {.pvs}
10051 @cindex @code{ls} request, alternative to (@code{pvs})
10052 @cindex post-vertical line spacing, changing (@code{pvs})
10053 @cindex post-vertical line spacing register (@code{.pvs})
10054 Change (increase, decrease) the post-vertical spacing by
10055 @var{space}. The default scaling indicator is @samp{p}.
10057 If @code{pvs} is called without an argument, the post-vertical spacing is
10058 reset to the previous value before the last call to @code{pvs}.
10060 @code{gtroff} creates a warning of type @samp{range} if @var{space} is
10061 zero or negative; the vertical spacing is then set to zero.
10063 The read-only number register @code{.pvs} contains the current
10064 post-vertical spacing; it is associated with the current environment
10065 (@pxref{Environments}).
10068 @c ---------------------------------------------------------------------
10070 @node Fractional Type Sizes, , Changing Type Sizes, Sizes
10071 @subsection Fractional Type Sizes
10072 @cindex fractional type sizes
10073 @cindex fractional point sizes
10074 @cindex type sizes, fractional
10075 @cindex point sizes, fractional
10076 @cindex sizes, fractional
10078 @cindex @code{s} unit
10079 @cindex unit, @code{s}
10080 @cindex @code{z} unit
10081 @cindex unit, @code{z}
10082 @cindex @code{ps} request, with fractional type sizes
10083 @cindex @code{cs} request, with fractional type sizes
10084 @cindex @code{tkf} request, with fractional type sizes
10085 @cindex @code{\H}, with fractional type sizes
10086 @cindex @code{\s}, with fractional type sizes
10087 A @dfn{scaled point} is equal to @math{1/@var{sizescale}} points,
10088 where @var{sizescale} is specified in the @file{DESC} file (1@tie{}by
10089 default). There is a new scale indicator @samp{z} which has the
10090 effect of multiplying by @var{sizescale}. Requests and escape
10091 sequences in @code{gtroff} interpret arguments that represent a point
10092 size as being in units of scaled points, but they evaluate each such
10093 argument using a default scale indicator of @samp{z}. Arguments
10094 treated in this way are the argument to the @code{ps} request, the
10095 third argument to the @code{cs} request, the second and fourth
10096 arguments to the @code{tkf} request, the argument to the @code{\H}
10097 escape sequence, and those variants of the @code{\s} escape sequence
10098 that take a numeric expression as their argument (see below).
10100 For example, suppose @var{sizescale} is@tie{}1000; then a scaled point
10101 is equivalent to a millipoint; the request @w{@samp{.ps 10.25}} is
10102 equivalent to @w{@samp{.ps 10.25z}} and thus sets the point size to
10103 10250@tie{}scaled points, which is equal to 10.25@tie{}points.
10105 @code{gtroff} disallows the use of the @samp{z} scale indicator in
10106 instances where it would make no sense, such as a numeric
10107 expression whose default scale indicator was neither @samp{u} nor
10108 @samp{z}. Similarly it would make
10109 no sense to use a scaling indicator other than @samp{z} or @samp{u} in a
10110 numeric expression whose default scale indicator was @samp{z}, and so
10111 @code{gtroff} disallows this as well.
10113 There is also new scale indicator @samp{s} which multiplies by the
10114 number of units in a scaled point. So, for example, @samp{\n[.ps]s} is
10115 equal to @samp{1m}. Be sure not to confuse the @samp{s} and @samp{z}
10119 A read-only number register returning the point size in scaled points.
10121 @code{.ps} is associated with the current environment
10122 (@pxref{Environments}).
10126 @DefregListEnd {.sr}
10127 @cindex last-requested point size registers (@code{.psr}, @code{.sr})
10128 @cindex point size registers, last-requested (@code{.psr}, @code{.sr})
10129 @cindex @code{.ps} register, in comparison with @code{.psr}
10130 @cindex @code{.s} register, in comparison with @code{.sr}
10131 The last-requested point size in scaled points is contained in the
10132 @code{.psr} read-only number register. The last requested point size
10133 in points as a decimal fraction can be found in @code{.sr}. This is a
10134 string-valued read-only number register.
10136 Note that the requested point sizes are device-independent, whereas
10137 the values returned by the @code{.ps} and @code{.s} registers are not.
10138 For example, if a point size of 11@dmn{pt} is requested, and a
10139 @code{sizes} request (or a @code{sizescale} line in a @file{DESC} file)
10140 specifies 10.95@dmn{pt} instead, this value is actually used.
10142 Both registers are associated with the current environment
10143 (@pxref{Environments}).
10146 The @code{\s} escape has the following syntax for working with
10147 fractional type sizes:
10152 Set the point size to @var{n}@tie{}scaled points; @var{n}@tie{}is a numeric
10153 expression with a default scale indicator of @samp{z}.
10156 @itemx \s[-@var{n}]
10157 @itemx \s+[@var{n}]
10158 @itemx \s-[@var{n}]
10159 @itemx \s'+@var{n}'
10160 @itemx \s'-@var{n}'
10161 @itemx \s+'@var{n}'
10162 @itemx \s-'@var{n}'
10163 Increase or or decrease the point size by @var{n}@tie{}scaled points;
10164 @var{n}@tie{}is a numeric expression with a default scale indicator of
10171 @c =====================================================================
10173 @node Strings, Conditionals and Loops, Sizes, gtroff Reference
10177 @code{gtroff} has string variables, which are entirely for user
10178 convenience (i.e.@: there are no built-in strings exept @code{.T}, but
10179 even this is a read-write string variable).
10181 @DefreqList {ds, name [@Var{string}]}
10182 @DefreqItem {ds1, name [@Var{string}]}
10183 @DefescItem {\\*, , n, }
10184 @DefescItem {\\*, @Lparen{}, nm, }
10185 @DefescListEnd {\\*, @Lbrack{}, name arg1 arg2 @dots{}, @Rbrack{}}
10186 @cindex string interpolation (@code{\*})
10187 @cindex string expansion (@code{\*})
10188 @cindex interpolation of strings (@code{\*})
10189 @cindex expansion of strings (@code{\*})
10190 @cindex string arguments
10191 @cindex arguments, of strings
10192 Define and access a string variable @var{name} (one-character
10193 name@tie{}@var{n}, two-character name @var{nm}). If @var{name} already
10194 exists, @code{ds} overwrites the previous definition. Only the syntax form
10195 using brackets can take arguments which are handled identically to
10196 macro arguments; the single exception is that a closing bracket as an
10197 argument must be enclosed in double quotes. @xref{Request and Macro
10198 Arguments}, and @ref{Parameters}.
10203 .ds foo a \\$1 test
10205 This is \*[foo nice].
10206 @result{} This is a nice test.
10209 The @code{\*} escape @dfn{interpolates} (expands in-place) a
10210 previously-defined string variable. To be more precise, the stored
10211 string is pushed onto the input stack which is then parsed by
10212 @code{gtroff}. Similar to number registers, it is possible to nest
10213 strings, i.e. string variables can be called within string variables.
10215 If the string named by the @code{\*} escape does not exist, it is
10216 defined as empty, and a warning of type @samp{mac} is emitted (see
10217 @ref{Debugging}, for more details).
10219 @cindex comments, with @code{ds}
10220 @cindex @code{ds} request, and comments
10221 @strong{Caution:} Unlike other requests, the second argument to the
10222 @code{ds} request takes up the entire line including trailing spaces.
10223 This means that comments on a line with such a request can introduce
10224 unwanted space into a string.
10227 .ds UX \s-1UNIX\s0\u\s-3tm\s0\d \" UNIX trademark
10231 Instead the comment should be put on another line or have the comment
10232 escape adjacent with the end of the string.
10235 .ds UX \s-1UNIX\s0\u\s-3tm\s0\d\" UNIX trademark
10238 @cindex trailing quotes
10239 @cindex quotes, trailing
10240 @cindex leading spaces with @code{ds}
10241 @cindex spaces with @code{ds}
10242 @cindex @code{ds} request, and leading spaces
10243 To produce leading space the string can be started with a double
10244 quote. No trailing quote is needed; in fact, any trailing quote is
10245 included in your string.
10248 .ds sign " Yours in a white wine sauce,
10251 @cindex multi-line strings
10252 @cindex strings, multi-line
10253 @cindex newline character, in strings, escaping
10254 @cindex escaping newline characters, in strings
10255 Strings are not limited to a single line of text. A string can span
10256 several lines by escaping the newlines with a backslash. The
10257 resulting string is stored @emph{without} the newlines.
10260 .ds foo lots and lots \
10261 of text are on these \
10265 It is not possible to have real newlines in a string. To put a single
10266 double quote character into a string, use two consecutive double quote
10269 The @code{ds1} request turns off compatibility mode
10270 while interpreting a string. To be more precise, a @dfn{compatibility
10271 save} input token is inserted at the beginning of the string, and a
10272 @dfn{compatibility restore} input token at the end.
10276 .ds aa The value of xxx is \\n[xxx].
10277 .ds1 bb The value of xxx ix \\n[xxx].
10282 @result{} warning: number register `[' not defined
10283 @result{} The value of xxx is 0xxx].
10285 @result{} The value of xxx ix 12345.
10288 @cindex name space, common, of macros, diversions, and strings
10289 @cindex common name space of macros, diversions, and strings
10290 @cindex macros, shared name space with strings and diversions
10291 @cindex strings, shared name space with macros and diversions
10292 @cindex diversions, shared name space with macros and strings
10293 Strings, macros, and diversions (and boxes) share the same name space.
10294 Internally, even the same mechanism is used to store them. This has
10295 some interesting consequences. For example, it is possible to call a
10296 macro with string syntax and vice versa.
10303 @result{} This is a funny test.
10305 .ds yyy a funny test
10308 @result{} This is a funny test.
10311 Diversions and boxes can be also called with string syntax.
10313 Another consequence is that you can copy one-line diversions or boxes
10321 .ds yyy This is \*[xxx]\c
10323 @result{} @r{This is a }@i{test}.
10327 As the previous example shows, it is possible to store formatted
10328 output in strings. The @code{\c} escape prevents the insertion of an
10329 additional blank line in the output.
10331 Copying diversions longer than a single output line produces
10332 unexpected results.
10341 .ds yyy This is \*[xxx]\c
10343 @result{} test This is a funny.
10346 Usually, it is not predictable whether a diversion contains one or
10347 more output lines, so this mechanism should be avoided. With
10348 @acronym{UNIX} @code{troff}, this was the only solution to strip off a
10349 final newline from a diversion. Another disadvantage is that the
10350 spaces in the copied string are already formatted, making them
10351 unstretchable. This can cause ugly results.
10353 @cindex stripping final newline in diversions
10354 @cindex diversion, stripping final newline
10355 @cindex final newline, stripping in diversions
10356 @cindex newline, final, stripping in diversions
10357 @cindex horizontal space, unformatting
10358 @cindex space, horizontal, unformatting
10359 @cindex unformatting horizontal space
10360 A clean solution to this problem is available in GNU @code{troff},
10361 using the requests @code{chop} to remove the final newline of a
10362 diversion, and @code{unformat} to make the horizontal spaces
10375 @result{} This is a funny test.
10378 @xref{Gtroff Internals}, for more information.
10381 @DefreqList {as, name [@Var{string}]}
10382 @DefreqListEnd {as1, name [@Var{string}]}
10383 @cindex appending to a string (@code{as})
10384 @cindex string, appending (@code{as})
10385 The @code{as} request is similar to @code{ds} but appends @var{string}
10386 to the string stored as @var{name} instead of redefining it. If
10387 @var{name} doesn't exist yet, it is created.
10390 .as sign " with shallots, onions and garlic,
10393 The @code{as1} request is similar to @code{as}, but compatibility mode
10394 is switched off while the appended string is interpreted. To be more
10395 precise, a @dfn{compatibility save} input token is inserted at the
10396 beginning of the appended string, and a @dfn{compatibility restore}
10397 input token at the end.
10400 Rudimentary string manipulation routines are given with the next two
10403 @Defreq {substring, str n1 [@Var{n2}]}
10404 @cindex substring (@code{substring})
10405 Replace the string named @var{str} with the substring
10406 defined by the indices @var{n1} and@tie{}@var{n2}. The first character
10407 in the string has index@tie{}0. If @var{n2} is omitted, it is taken to
10408 be equal to the string's length. If the index value @var{n1} or
10409 @var{n2} is negative, it is counted from the end of the
10410 string, going backwards: The last character has index@tie{}@minus{}1, the
10411 character before the last character has index@tie{}@minus{}2, etc.
10415 .substring xxx 1 -4
10421 @Defreq {length, reg str}
10422 @cindex length of a string (@code{length})
10423 @cindex string, length of (@code{length})
10424 Compute the number of characters of @var{str} and return it in the
10425 number register @var{reg}. If @var{reg} doesn't exist, it is created.
10426 @code{str} is read in copy mode.
10429 .ds xxx abcd\h'3i'efgh
10430 .length yyy \*[xxx]
10436 @Defreq {rn, xx yy}
10437 @cindex renaming request (@code{rn})
10438 @cindex request, renaming (@code{rn})
10439 @cindex renaming macro (@code{rn})
10440 @cindex macro, renaming (@code{rn})
10441 @cindex renaming string (@code{rn})
10442 @cindex string, renaming (@code{rn})
10443 @cindex renaming diversion (@code{rn})
10444 @cindex diversion, renaming (@code{rn})
10445 Rename the request, macro, diversion, or string @var{xx} to @var{yy}.
10449 @cindex removing request (@code{rm})
10450 @cindex request, removing (@code{rm})
10451 @cindex removing macro (@code{rm})
10452 @cindex macro, removing (@code{rm})
10453 @cindex removing string (@code{rm})
10454 @cindex string, removing (@code{rm})
10455 @cindex removing diversion (@code{rm})
10456 @cindex diversion, removing (@code{rm})
10457 Remove the request, macro, diversion, or string @var{xx}. @code{gtroff}
10458 treats subsequent invocations as if the object had never been defined.
10461 @Defreq {als, new old}
10462 @cindex alias, string, creating (@code{als})
10463 @cindex alias, macro, creating (@code{als})
10464 @cindex alias, diversion, creating (@code{als})
10465 @cindex creating alias, for string (@code{als})
10466 @cindex creating alias, for macro (@code{als})
10467 @cindex creating alias, for diversion (@code{als})
10468 @cindex string, creating alias (@code{als})
10469 @cindex macro, creating alias (@code{als})
10470 @cindex diversion, creating alias (@code{als})
10471 Create an alias named @var{new} for the request, string, macro, or
10472 diversion object named @var{old}. The new name and the old name are
10473 exactly equivalent (it is similar to a hard rather than a soft
10474 link). If @var{old} is undefined, @code{gtroff} generates a warning of
10475 type @samp{mac} and ignores the request.
10479 Remove (chop) the last character from the macro, string, or diversion
10480 named @var{xx}. This is useful for removing the newline from the end
10481 of diversions that are to be interpolated as strings. This command
10482 can be used repeatedly; see @ref{Gtroff Internals}, for details on
10483 nodes inserted additionally by @code{gtroff}.
10486 @xref{Identifiers}, and @ref{Comments}.
10489 @c =====================================================================
10491 @node Conditionals and Loops, Writing Macros, Strings, gtroff Reference
10492 @section Conditionals and Loops
10493 @cindex conditionals and loops
10494 @cindex loops and conditionals
10497 * Operators in Conditionals::
10502 @c ---------------------------------------------------------------------
10504 @node Operators in Conditionals, if-else, Conditionals and Loops, Conditionals and Loops
10505 @subsection Operators in Conditionals
10507 @cindex @code{if} request, operators to use with
10508 @cindex @code{while} request, operators to use with
10509 In @code{if} and @code{while} requests, there are several more
10510 operators available:
10515 True if the current page is even or odd numbered (respectively).
10518 True if the document is being processed in nroff mode (i.e., the
10519 @code{.nroff} command has been issued).
10522 True if the document is being processed in troff mode (i.e., the
10523 @code{.troff} command has been issued).
10526 Always false. This condition is for compatibility with other
10527 @code{troff} versions only (identifying a @code{-Tversatec} device).
10529 @item '@var{xxx}'@var{yyy}'
10530 True if the string @var{xxx} is equal to the string @var{yyy}. Other
10531 characters can be used in place of the single quotes; the same set of
10532 delimiters as for the @code{\D} escape is used (@pxref{Escapes}).
10533 @code{gtroff} formats the strings before being compared:
10544 The resulting motions, glyph sizes, and fonts have to
10545 match,@footnote{The created output nodes must be identical.
10546 @xref{Gtroff Internals}.} and not the individual motion, size, and
10547 font requests. In the previous example, @samp{|} and @samp{\fR|\fP}
10548 both result in a roman @samp{|} glyph with the same point size and
10549 at the same location on the page, so the strings are equal. If
10550 @samp{.ft@tie{}I} had been added before the @samp{.ie}, the result
10551 would be ``false'' because (the first) @samp{|} produces an italic
10552 @samp{|} rather than a roman one.
10555 True if there is a number register named @var{xxx}.
10558 True if there is a string, macro, diversion, or request named @var{xxx}.
10561 True if there is a color named @var{xxx}.
10564 True if there is a glyph @var{g} available@footnote{The name of this
10565 conditional operator is a misnomer since it tests names of output
10566 glyphs.}; @var{g} is either an @acronym{ASCII} character or a special
10567 character (@code{\(@var{gg}} or @code{\[@var{ggg}]}); the condition
10568 is also true if @var{g} has been defined by the @code{char} request.
10571 True if a font named @var{font} exists. @var{font} is handled as if it was
10572 opened with the @code{ft} request (this is, font translation and styles are
10573 applied), without actually mounting it.
10575 This test doesn't load the complete font but only its header to verify
10578 @item S @var{style}
10579 True if style @var{style} has been registered. Font translation is applied.
10582 Note that these operators can't be combined with other operators like
10583 @samp{:} or @samp{&}; only a leading @samp{!} (without whitespace
10584 between the exclamation mark and the operator) can be used to negate
10596 A whitespace after @samp{!} always evaluates to zero (this bizarre
10597 behaviour is due to compatibility with @acronym{UNIX} @code{troff}).
10605 @result{} r xxx true
10608 It is possible to omit the whitespace before the argument to the
10609 @samp{r}, @samp{d}, and @samp{c} operators.
10611 @xref{Expressions}.
10613 @c ---------------------------------------------------------------------
10615 @node if-else, while, Operators in Conditionals, Conditionals and Loops
10616 @subsection if-else
10619 @code{gtroff} has if-then-else constructs like other languages, although
10620 the formatting can be painful.
10622 @Defreq {if, expr anything}
10624 Evaluate the expression @var{expr}, and executes @var{anything} (the
10625 remainder of the line) if @var{expr} evaluates to a value greater than
10626 zero (true). @var{anything} is interpreted as though it was on a line
10627 by itself (except that leading spaces are swallowed).
10628 @xref{Expressions}, for more info.
10633 .if ((\n[xxx] == 1) & (\n[yyy] == 2)) true
10638 @Defreq{nop, anything}
10639 Executes @var{anything}.
10640 This is similar to @code{.if@tie{}1}.
10643 @DefreqList {ie, expr anything}
10644 @DefreqListEnd {el, anything}
10645 Use the @code{ie} and @code{el} requests to write an if-then-else.
10646 The first request is the `if' part and the latter is the `else' part.
10649 .ie n .ls 2 \" double-spacing in nroff
10650 .el .ls 1 \" single-spacing in troff
10654 @c there is a bug in makeinfo <= 4.1a: you can't have `@{' as an argument
10657 @c and in 4.2 you still can't use @{ in macros.
10659 @c @DefescList {\@{, , , }
10660 @c @DefescListEnd {\@}, , , }
10661 @deffn Escape @t{\@{}
10662 @deffnx Escape @t{\@}}
10665 @cindex begin of conditional block (@code{\@{})
10666 @cindex end of conditional block (@code{\@}})
10667 @cindex conditional block, begin (@code{\@{})
10668 @cindex conditional block, end (@code{\@}})
10669 @cindex block, conditional, begin (@code{\@{})
10670 @cindex block, condititional, end (@code{\@}})
10671 In many cases, an if (or if-else) construct needs to execute more than
10672 one request. This can be done using the @code{\@{} and @code{\@}}
10673 escapes. The following example shows the possible ways to use these
10674 escapes (note the position of the opening and closing braces).
10689 @xref{Expressions}.
10691 @c ---------------------------------------------------------------------
10693 @node while, , if-else, Conditionals and Loops
10697 @code{gtroff} provides a looping construct using the @code{while}
10698 request, which is used much like the @code{if} (and related) requests.
10700 @Defreq {while, expr anything}
10701 Evaluate the expression @var{expr}, and repeatedly execute
10702 @var{anything} (the remainder of the line) until @var{expr} evaluates
10707 .while (\na < 9) \@{\
10711 @result{} 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
10716 @cindex @code{de} request, and @code{while}
10719 The body of a @code{while} request is treated like the body of a
10720 @code{de} request: @code{gtroff} temporarily stores it in a macro
10721 which is deleted after the loop has been exited. It can considerably
10722 slow down a macro if the body of the @code{while} request (within the
10723 macro) is large. Each time the macro is executed, the @code{while}
10724 body is parsed and stored again as a temporary macro.
10729 . while (\\n[num] > 0) \@{\
10730 . \" many lines of code
10736 @cindex recursive macros
10737 @cindex macros, recursive
10739 The traditional and ofter better solution (@acronym{UNIX} @code{troff}
10740 doesn't have the @code{while} request) is to use a recursive macro
10741 instead which is parsed only once during its definition.
10745 . if (\\n[num] > 0) \@{\
10746 . \" many lines of code
10759 Note that the number of available recursion levels is set to@tie{}1000
10760 (this is a compile-time constant value of @code{gtroff}).
10763 The closing brace of a @code{while} body must end a line.
10768 . while (\n[a] < 10) \@{\
10771 @result{} unbalanced \@{ \@}
10777 @cindex @code{while} request, confusing with @code{br}
10778 @cindex @code{break} request, in a @code{while} loop
10779 @cindex @code{continue} request, in a @code{while} loop
10780 Break out of a @code{while} loop. Be sure not to confuse this with
10781 the @code{br} request (causing a line break).
10784 @Defreq {continue, }
10785 Finish the current iteration of a @code{while} loop, immediately
10786 restarting the next iteration.
10789 @xref{Expressions}.
10792 @c =====================================================================
10794 @node Writing Macros, Page Motions, Conditionals and Loops, gtroff Reference
10795 @section Writing Macros
10796 @cindex writing macros
10797 @cindex macros, writing
10799 A @dfn{macro} is a collection of text and embedded commands which can
10800 be invoked multiple times. Use macros to define common operations.
10802 @DefreqList {de, name [@Var{end}]}
10803 @DefreqItem {de1, name [@Var{end}]}
10804 @DefreqItem {dei, name [@Var{end}]}
10805 @DefreqListEnd {dei1, name [@Var{end}]}
10806 Define a new macro named @var{name}. @code{gtroff} copies subsequent
10807 lines (starting with the next one) into an internal buffer until it
10808 encounters the line @samp{..} (two dots). The optional second
10809 argument to @code{de} changes this to a macro to @samp{.@var{end}}.
10811 There can be whitespace after the first dot in the line containing the
10812 ending token (either @samp{.} or macro @samp{@var{end}}).
10814 Here a small example macro called @samp{P} which causes a break and
10815 inserts some vertical space. It could be used to separate paragraphs.
10824 The following example defines a macro within another. Remember that
10825 expansion must be protected twice; once for reading the macro and
10826 once for executing.
10829 \# a dummy macro to avoid a warning
10835 . nop \f[B]Hallo \\\\$1!\f[]
10841 @result{} @b{Hallo Joe!}
10845 Since @code{\f} has no expansion, it isn't necessary to protect its
10846 backslash. Had we defined another macro within @code{bar} which takes
10847 a parameter, eight backslashes would be necessary before @samp{$1}.
10849 The @code{de1} request turns off compatibility mode
10850 while executing the macro. On entry, the current compatibility mode
10851 is saved and restored at exit.
10857 The value of xxx is \\n[xxx].
10860 The value of xxx ix \\n[xxx].
10866 @result{} warning: number register `[' not defined
10867 @result{} The value of xxx is 0xxx].
10869 @result{} The value of xxx ix 12345.
10872 The @code{dei} request defines a macro indirectly.
10873 That is, it expands strings whose names
10874 are @var{name} or @var{end} before performing the append.
10891 The @code{dei1} request is similar to @code{dei} but with compatibility
10892 mode switched off during execution of the defined macro.
10894 If compatibility mode is on, @code{de} (and @code{dei}) behave similar to
10895 @code{de1} (and @code{dei1}): A `compatibility save' token is inserted at
10896 the beginning, and a `compatibility restore' token at the end, with
10897 compatibility mode switched on during execution. @xref{Gtroff Internals},
10898 for more information on switching compatibility mode on and off in a
10902 Using @file{trace.tmac}, you can trace calls to @code{de} and @code{de1}.
10904 Note that macro identifiers are shared with identifiers for strings and
10908 @DefreqList {am, name [@Var{end}]}
10909 @DefreqItem {am1, name [@Var{end}]}
10910 @DefreqItem {ami, name [@Var{end}]}
10911 @DefreqListEnd {ami1, name [@Var{end}]}
10912 @cindex appending to a macro (@code{am})
10913 @cindex macro, appending (@code{am})
10914 Works similarly to @code{de} except it appends onto the macro named
10915 @var{name}. So, to make the previously defined @samp{P} macro actually
10916 do indented instead of block paragraphs, add the necessary code to the
10917 existing macro like this:
10925 The @code{am1} request turns off compatibility mode
10926 while executing the appended macro piece. To be more precise, a
10927 @dfn{compatibility save} input token is inserted at the beginning of
10928 the appended code, and a @dfn{compatibility restore} input token at
10931 The @code{ami} request appends indirectly,
10932 meaning that @code{gtroff} expands strings whose names
10933 are @var{name} or @var{end} before performing the append.
10935 The @code{ami1} request is similar to @code{ami} but compatibility mode
10936 is switched off during execution of the defined macro.
10939 Using @file{trace.tmac}, you can trace calls to @code{am} and @code{am1}.
10942 @xref{Strings}, for the @code{als} request to rename a macro.
10944 The @code{de}, @code{am}, @code{di}, @code{da}, @code{ds}, and
10945 @code{as} requests (together with its variants) only create a new object
10946 if the name of the macro, diversion or string diversion is currently
10947 undefined or if it is defined to be a request; normally they modify the
10948 value of an existing object.
10950 @Defreq {return, [@Var{anything}]}
10951 Exit a macro, immediately returning to the caller.
10953 If called with an argument, exit twice, namely the current macro and the
10954 macro one level higher. This is used to define a wrapper macro for
10955 @code{return} in @file{trace.tmac}.
10963 @c ---------------------------------------------------------------------
10965 @node Copy-in Mode, Parameters, Writing Macros, Writing Macros
10966 @subsection Copy-in Mode
10967 @cindex copy-in mode
10968 @cindex mode, copy-in
10970 @cindex @code{\n}, when reading text for a macro
10971 @cindex @code{\$}, when reading text for a macro
10972 @cindex @code{\*}, when reading text for a macro
10973 @cindex @code{\\}, when reading text for a macro
10974 @cindex \@key{RET}, when reading text for a macro
10975 When @code{gtroff} reads in the text for a macro, string, or diversion,
10976 it copies the text (including request lines, but excluding escapes) into
10977 an internal buffer. Escapes are converted into an internal form,
10978 except for @code{\n}, @code{\$}, @code{\*}, @code{\\} and
10979 @code{\@key{RET}} which are evaluated and inserted into the text where
10980 the escape was located. This is known as @dfn{copy-in} mode or
10983 What this means is that you can specify when these escapes are to be
10984 evaluated (either at copy-in time or at the time of use) by insulating
10985 the escapes with an extra backslash. Compare this to the @code{\def}
10986 and @code{\edef} commands in @TeX{}.
10988 The following example prints the numbers 20 and@tie{}10:
11000 @c ---------------------------------------------------------------------
11002 @node Parameters, , Copy-in Mode, Writing Macros
11003 @subsection Parameters
11006 The arguments to a macro or string can be examined using a variety of
11010 @cindex number of arguments register (@code{.$})
11011 The number of arguments passed to a macro or string. This is a read-only
11014 Note that the @code{shift} request can change its value.
11017 Any individual argument can be retrieved with one of the following
11020 @DefescList {\\$, , n, }
11021 @DefescItem {\\$, @Lparen{}, nn, }
11022 @DefescListEnd {\\$, @Lbrack{}, nnn, @Rbrack{}}
11023 @cindex copy-in mode, and macro arguments
11024 @cindex macro, arguments (@code{\$})
11025 @cindex arguments, macro (@code{\$})
11026 Retrieve the @var{n}@dmn{th}, @var{nn}@dmn{th} or @var{nnn}@dmn{th}
11027 argument. As usual, the first form only accepts a single number
11028 (larger than zero), the second a two-digit number (larger or equal
11029 to@tie{}10), and the third any positive integer value (larger
11030 than zero). Macros and strings can have an unlimited number of arguments.
11031 Note that due to copy-in mode, use two backslashes on these in actual use
11032 to prevent interpolation until the macro is actually invoked.
11035 @Defreq {shift, [@Var{n}]}
11036 Shift the arguments 1@tie{}position, or as
11037 many positions as specified by its argument. After executing this
11038 request, argument@tie{}@var{i} becomes argument @math{@var{i}-@var{n}};
11039 arguments 1 to@tie{}@var{n} are no longer available. Shifting by
11040 negative amounts is currently undefined.
11042 The register @code{.$} is adjusted accordingly.
11045 @DefescList {\\$*, , , }
11046 @DefescListEnd {\\$@@, , , }
11047 In some cases it is convenient to use all of the arguments at once (for
11048 example, to pass the arguments along to another macro). The @code{\$*}
11049 escape concatenates all the arguments separated by spaces. A
11050 similar escape is @code{\$@@}, which concatenates all the
11051 arguments with each surrounded by double quotes, and separated by
11052 spaces. If not in compatibility mode, the input level of double quotes
11053 is preserved (see @ref{Request and Macro Arguments}).
11056 @Defesc {\\$0, , , }
11057 @cindex macro name register (@code{\$0})
11058 @cindex @code{als} request, and @code{\$0}
11059 The name used to invoke the current macro.
11060 The @code{als} request can make a macro have more than one name.
11065 . if \\n[error] \@{\
11066 . tm \\$0: Houston, we have a problem.
11071 .als foo generic-macro
11072 .als bar generic-macro
11076 @xref{Request and Macro Arguments}.
11079 @c =====================================================================
11081 @node Page Motions, Drawing Requests, Writing Macros, gtroff Reference
11082 @section Page Motions
11083 @cindex page motions
11084 @cindex motions, page
11086 @xref{Manipulating Spacing}, for a discussion of the main request for
11087 vertical motion, @code{sp}.
11089 @DefreqList {mk, [@Var{reg}]}
11090 @DefreqListEnd {rt, [@Var{dist}]}
11091 @cindex marking vertical page location (@code{mk})
11092 @cindex page location, vertical, marking (@code{mk})
11093 @cindex location, vertical, page, marking (@code{mk})
11094 @cindex vertical page location, marking (@code{mk})
11095 @cindex returning to marked vertical page location (@code{rt})
11096 @cindex page location, vertical, returning to marked (@code{rt})
11097 @cindex location, vertical, page, returning to marked (@code{rt})
11098 @cindex vertical page location, returning to marked (@code{rt})
11099 The request @code{mk} can be used to mark a location on a page, for
11100 movement to later. This request takes a register name as an argument
11101 in which to store the current page location. With no argument it
11102 stores the location in an internal register. The results of this can
11103 be used later by the @code{rt} or the @code{sp} request (or the
11106 The @code{rt} request returns @emph{upwards} to the location marked
11107 with the last @code{mk} request. If used with an argument, return to
11108 a position which distance from the top of the page is @var{dist} (no
11109 previous call to @code{mk} is necessary in this case). Default scaling
11110 indicator is @samp{v}.
11112 Here a primitive solution for a two-column macro.
11115 .nr column-length 1.5i
11117 .nr bottom-margin 1m
11124 . ll \\n[column-length]u
11125 . wh -\\n[bottom-margin]u 2c-trap
11132 . ie \\n[right-side] \@{\
11134 . po -(\\n[column-length]u + \\n[column-gap]u)
11136 . wh -\\n[bottom-margin]u
11139 . \" switch to right side
11141 . po +(\\n[column-length]u + \\n[column-gap]u)
11150 This is a small test which shows how the
11151 rt request works in combination with mk.
11154 Starting here, text is typeset in two columns.
11155 Note that this implementation isn't robust
11156 and thus not suited for a real two-column
11163 This is a small test which shows how the
11164 rt request works in combination with mk.
11166 Starting here, isn't robust
11167 text is typeset and thus not
11168 in two columns. suited for a
11169 Note that this real two-column
11170 implementation macro.
11174 The following escapes give fine control of movements about the page.
11176 @Defesc {\\v, ', e, '}
11177 @cindex vertical motion (@code{\v})
11178 @cindex motion, vertical (@code{\v})
11179 Move vertically, usually from the current location on the page (if no
11180 absolute position operator @samp{|} is used). The
11181 argument@tie{}@var{e} specifies the distance to move; positive is
11182 downwards and negative upwards. The default scaling indicator for this
11183 escape is @samp{v}. Beware, however, that @code{gtroff} continues text
11184 processing at the point where the motion ends, so you should always
11185 balance motions to avoid interference with text processing.
11187 @code{\v} doesn't trigger a trap. This can be quite useful; for example,
11188 consider a page bottom trap macro which prints a marker in the margin to
11189 indicate continuation of a footnote or something similar.
11192 There are some special-case escapes for vertical motion.
11194 @Defesc {\\r, , , }
11195 Move upwards@tie{}1@dmn{v}.
11198 @Defesc {\\u, , , }
11199 Move upwards@tie{}.5@dmn{v}.
11202 @Defesc {\\d, , , }
11203 Move down@tie{}.5@dmn{v}.
11206 @Defesc {\\h, ', e, '}
11207 @cindex inserting horizontal space (@code{\h})
11208 @cindex horizontal space (@code{\h})
11209 @cindex space, horizontal (@code{\h})
11210 @cindex horizontal motion (@code{\h})
11211 @cindex motion, horizontal (@code{\h})
11212 Move horizontally, usually from the current location (if no absolute
11213 position operator @samp{|} is used). The expression@tie{}@var{e}
11214 indicates how far to move: positive is rightwards and negative
11215 leftwards. The default scaling indicator for this escape is @samp{m}.
11217 This horizontal space is not discarded at the end of a line. To insert
11218 discardable space of a certain length use the @code{ss} request.
11221 There are a number of special-case escapes for horizontal motion.
11223 @Defesc {\\@key{SP}, , , }
11224 @cindex space, unbreakable
11225 @cindex unbreakable space
11226 An unbreakable and unpaddable (i.e.@: not expanded during filling)
11227 space. (Note: This is a backslash followed by a space.)
11230 @Defesc {\\~, , , }
11231 An unbreakable space that stretches like a normal inter-word space
11232 when a line is adjusted.
11235 @Defesc {\\|, , , }
11236 A 1/6@dmn{th} em space. Ignored for TTY output devices (rounded to
11240 @Defesc {\\^, , , }
11241 A 1/12@dmn{th} em space. Ignored for TTY output devices (rounded to
11245 @Defesc {\\0, , , }
11246 @cindex space, width of a digit (@code{\0})
11247 @cindex digit width space (@code{\0})
11248 A space the size of a digit.
11251 The following string sets the @TeX{} logo:
11254 .ds TeX T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
11257 @DefescList {\\w, ', text, '}
11264 @DefregListEnd {skw}
11265 @cindex width escape (@code{\w})
11266 Return the width of the specified @var{text} in basic units.
11267 This allows horizontal movement based on the width of some
11268 arbitrary text (e.g.@: given as an argument to a macro).
11271 The length of the string `abc' is \w'abc'u.
11272 @result{} The length of the string `abc' is 72u.
11275 Font changes may occur in @var{text} which don't affect current
11278 After use, @code{\w} sets several registers:
11283 The highest and lowest point of the baseline, respectively, in @var{text}.
11287 Like the @code{st} and @code{sb} registers, but takes account of the
11288 heights and depths of glyphs. With other words, this gives the
11289 highest and lowest point of @var{text}. Values below the baseline are
11293 Defines the kinds of glyphs occurring in @var{text}:
11297 only short glyphs, no descenders or tall glyphs.
11300 at least one descender.
11303 at least one tall glyph.
11306 at least one each of a descender and a tall glyph.
11310 The amount of horizontal space (possibly negative) that should be added
11311 to the last glyph before a subscript.
11314 How far to right of the center of the last glyph in the @code{\w}
11315 argument, the center of an accent from a roman font should be placed
11320 @DefescList {\\k, , p, }
11321 @DefescItem {\\k, @Lparen{}, ps, }
11322 @DefescListEnd {\\k, @Lbrack{}, position, @Rbrack{}}
11323 @cindex saving horizontal input line position (@code{\k})
11324 @cindex horizontal input line position, saving (@code{\k})
11325 @cindex input line position, horizontal, saving (@code{\k})
11326 @cindex position, horizontal input line, saving (@code{\k})
11327 @cindex line, input, horizontal position, saving (@code{\k})
11328 Store the current horizontal position in the @emph{input} line in
11329 number register with name @var{position} (one-character name@tie{}@var{p},
11330 two-character name @var{ps}). Use this, for example, to return to the
11331 beginning of a string for highlighting or other decoration.
11335 @cindex horizontal input line position register (@code{hp})
11336 @cindex input line, horizontal position, register (@code{hp})
11337 @cindex position, horizontal, in input line, register (@code{hp})
11338 @cindex line, input, horizontal position, register (@code{hp})
11339 The current horizontal position at the input line.
11343 @cindex horizontal output line position register (@code{.k})
11344 @cindex output line, horizontal position, register (@code{.k})
11345 @cindex position, horizontal, in output line, register (@code{.k})
11346 @cindex line, output, horizontal position, register (@code{.k})
11347 A read-only number register containing the current horizontal output
11348 position (relative to the current indentation).
11351 @Defesc {\\o, ', abc, '}
11352 @cindex overstriking glyphs (@code{\o})
11353 @cindex glyphs, overstriking (@code{\o})
11354 Overstrike glyphs @var{a}, @var{b}, @var{c}, @dots{}; the glyphs
11355 are centered, and the resulting spacing is the largest width of the
11359 @Defesc {\\z, , g, , }
11360 @cindex zero-width printing (@code{\z}, @code{\Z})
11361 @cindex printing, zero-width (@code{\z}, @code{\Z})
11362 Print glyph @var{g} with zero width, i.e., without spacing. Use
11363 this to overstrike glyphs left-aligned.
11366 @Defesc {\\Z, ', anything, '}
11367 @cindex zero-width printing (@code{\z}, @code{\Z})
11368 @cindex printing, zero-width (@code{\z}, @code{\Z})
11369 Print @var{anything}, then restore the horizontal and vertical position.
11370 The argument may not contain tabs or leaders.
11372 The following is an example of a strike-through macro:
11377 \Z@@\v'-.25m'\l'\\n[ww]u'@@\\$1
11382 an actual emergency!
11387 @c =====================================================================
11389 @node Drawing Requests, Traps, Page Motions, gtroff Reference
11390 @section Drawing Requests
11391 @cindex drawing requests
11392 @cindex requests for drawing
11394 @code{gtroff} provides a number of ways to draw lines and other figures
11395 on the page. Used in combination with the page motion commands (see
11396 @ref{Page Motions}, for more info), a wide variety of figures can be
11397 drawn. However, for complex drawings these operations can be quite
11398 cumbersome, and it may be wise to use graphic preprocessors like
11399 @code{gpic} or @code{ggrn}. @xref{gpic}, and @ref{ggrn}, for more
11402 All drawing is done via escapes.
11404 @DefescList {\\l, ', l, '}
11405 @DefescListEnd {\\l, ', lg, '}
11406 @cindex drawing horizontal lines (@code{\l})
11407 @cindex horizontal line, drawing (@code{\l})
11408 @cindex line, horizontal, drawing (@code{\l})
11409 Draw a line horizontally. @var{l} is the length of the line to be
11410 drawn. If it is positive, start the line at the current location and
11411 draw to the right; its end point is the new current location. Negative
11412 values are handled differently: The line starts at the current location
11413 and draws to the left, but the current location doesn't move.
11415 @var{l} can also be specified absolutely (i.e.@: with a leading
11416 @samp{|}) which draws back to the beginning of the input line.
11417 Default scaling indicator is @samp{m}.
11419 @cindex underscore glyph (@code{\[ru]})
11420 @cindex glyph, underscore (@code{\[ru]})
11421 @cindex line drawing glyph
11422 @cindex glyph, for line drawing
11423 The optional second parameter@tie{}@var{g} is a glyph to draw the line
11424 with. If this second argument is not specified, @code{gtroff} uses
11425 the underscore glyph, @code{\[ru]}.
11427 @cindex zero width space character (@code{\&})
11428 @cindex character, zero width space (@code{\&})
11429 @cindex space character, zero width (@code{\&})
11430 To separate the two arguments (to prevent @code{gtroff} from
11431 interpreting a drawing glyph as a scaling indicator if the glyph is
11432 represented by a single character) use @code{\&}.
11434 Here a small useful example:
11438 \[br]\\$*\[br]\l'|0\[rn]'\l'|0\[ul]'
11443 Note that this works by outputting a box rule (a vertical line), then
11444 the text given as an argument and then another box rule. Finally, the
11445 line drawing escapes both draw from the current location to the
11446 beginning of the @emph{input} line -- this works because the line
11447 length is negative, not moving the current point.
11450 @DefescList {\\L, ', l, '}
11451 @DefescListEnd {\\L, ', lg, '}
11452 @cindex drawing vertical lines (@code{\L})
11453 @cindex vertical line drawing (@code{\L})
11454 @cindex line, vertical, drawing (@code{\L})
11455 @cindex line drawing glyph
11456 @cindex glyph for line drawing
11457 @cindex box rule glyph (@code{\[br]})
11458 @cindex glyph, box rule (@code{\[br]})
11459 Draw vertical lines. Its parameters are
11460 similar to the @code{\l} escape, except that the default scaling
11461 indicator is @samp{v}. The movement is downwards for positive values,
11462 and upwards for negative values. The default glyph is the box rule
11463 glyph, @code{\[br]}. As with the vertical motion escapes, text
11464 processing blindly continues where the line ends.
11467 This is a \L'3v'test.
11471 Here the result, produced with @code{grotty}.
11481 @Defesc {\\D, ', command arg @dots{}, '}
11482 The @code{\D} escape provides a variety of drawing functions.
11483 Note that on character devices, only vertical and horizontal lines are
11484 supported within @code{grotty}; other devices may only support a subset
11485 of the available drawing functions.
11487 The default scaling indicator for all subcommands of @code{\D} is
11488 @samp{m} for horizontal distances and @samp{v} for vertical ones.
11489 Exceptions are @w{@code{\D'f @dots{}'}} and @w{@code{\D't @dots{}'}}
11490 which use @code{u} as the default, and @w{@code{\D'F@var{x} @dots{}'}}
11491 which arguments are treated similar to the @code{defcolor} request.
11494 @item \D'l @var{dx} @var{dy}'
11495 @cindex line, drawing (@w{@code{\D'l @dots{}'}})
11496 @cindex drawing a line (@w{@code{\D'l @dots{}'}})
11497 Draw a line from the current location to the relative point specified by
11498 (@var{dx},@var{dy}), where positive values mean down and right,
11499 respectively. The end point of the line is the new current location.
11501 The following example is a macro for creating a box around a text string;
11502 for simplicity, the box margin is taken as a fixed value, 0.2@dmn{m}.
11508 \h'-.2m'\v'(.2m - \\n[rsb]u)'\
11509 \D'l 0 -(\\n[rst]u - \\n[rsb]u + .4m)'\
11510 \D'l (\\n[@@wd]u + .4m) 0'\
11511 \D'l 0 (\\n[rst]u - \\n[rsb]u + .4m)'\
11512 \D'l -(\\n[@@wd]u + .4m) 0'\
11513 \h'.2m'\v'-(.2m - \\n[rsb]u)'\
11520 First, the width of the string is stored in register @code{@@wd}. Then,
11521 four lines are drawn to form a box, properly offset by the box margin.
11522 The registers @code{rst} and @code{rsb} are set by the @code{\w} escape,
11523 containing the largest height and depth of the whole string.
11525 @item \D'c @var{d}'
11526 @cindex circle, drawing (@w{@code{\D'c @dots{}'}})
11527 @cindex drawing a circle (@w{@code{\D'c @dots{}'}})
11528 Draw a circle with a diameter of@tie{}@var{d} with the leftmost point at the
11529 current position. After drawing, the current location is positioned at the
11530 rightmost point of the circle.
11532 @item \D'C @var{d}'
11533 @cindex circle, solid, drawing (@w{@code{\D'C @dots{}'}})
11534 @cindex drawing a solid circle (@w{@code{\D'C @dots{}'}})
11535 @cindex solid circle, drawing (@w{@code{\D'C @dots{}'}})
11536 Draw a solid circle with the same parameters and behaviour as an outlined
11537 circle. No outline is drawn.
11539 @item \D'e @var{x} @var{y}'
11540 @cindex drawing an ellipse (@w{@code{\D'e @dots{}'}})
11541 @cindex ellipse, drawing (@w{@code{\D'e @dots{}'}})
11542 Draw an ellipse with a horizontal diameter of @var{x} and a vertical
11543 diameter of @var{y} with the leftmost point at the current position.
11544 After drawing, the current location is positioned at the rightmost point of
11547 @item \D'E @var{x} @var{y}'
11548 @cindex ellipse, solid, drawing (@w{@code{\D'E @dots{}'}})
11549 @cindex drawing a solid ellipse (@w{@code{\D'E @dots{}'}})
11550 @cindex solid ellipse, drawing (@w{@code{\D'E @dots{}'}})
11551 Draw a solid ellipse with the same parameters and behaviour as an
11552 outlined ellipse. No outline is drawn.
11554 @item \D'a @var{dx1} @var{dy1} @var{dx2} @var{dy2}'
11555 @cindex arc, drawing (@w{@code{\D'a @dots{}'}})
11556 @cindex drawing an arc (@w{@code{\D'a @dots{}'}})
11557 Draw an arc clockwise from the current location through the two
11558 specified relative locations (@var{dx1},@var{dy1}) and
11559 (@var{dx2},@var{dy2}). The coordinates of the first point are relative
11560 to the current position, and the coordinates of the second point are
11561 relative to the first point. After drawing, the current position is moved
11562 to the final point of the arc.
11564 @item \D'~ @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
11565 @cindex drawing a spline (@w{@code{\D'~ @dots{}'}})
11566 @cindex spline, drawing (@w{@code{\D'~ @dots{}'}})
11567 Draw a spline from the current location to the relative point
11568 (@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}), and so on.
11569 The current position is moved to the terminal point of the drawn curve.
11571 @item \D'f @var{n}'
11572 @cindex gray shading (@w{@code{\D'f @dots{}'}})
11573 @cindex shading filled objects (@w{@code{\D'f @dots{}'}})
11574 Set the shade of gray to be used for filling solid objects to@tie{}@var{n};
11575 @var{n}@tie{}must be an integer between 0 and@tie{}1000, where 0
11576 corresponds solid white and 1000 to solid black, and values in between
11577 correspond to intermediate shades of gray. This applies only to solid
11578 circles, solid ellipses, and solid polygons. By default, a level of
11581 Despite of being silly, the current point is moved horizontally to the
11582 right by@tie{}@var{n}.
11584 @cindex @w{@code{\D'f @dots{}'}} and horizontal resolution
11585 Don't use this command! It has the serious drawback that it will be
11586 always rounded to the next integer multiple of the horizontal resolution
11587 (the value of the @code{hor} keyword in the @file{DESC} file). Use
11588 @code{\M} (@pxref{Colors}) or @w{@code{\D'Fg @dots{}'}} instead.
11590 @item \D'p @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
11591 @cindex drawing a polygon (@w{@code{\D'p @dots{}'}})
11592 @cindex polygon, drawing (@w{@code{\D'p @dots{}'}})
11593 Draw a polygon from the current location to the relative position
11594 (@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}) and so on.
11595 When the specified data points are exhausted, a line is drawn back
11596 to the starting point. The current position is changed by adding the
11597 sum of all arguments with odd index to the actual horizontal position and
11598 the even ones to the vertical position.
11600 @item \D'P @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
11601 @cindex polygon, solid, drawing (@w{@code{\D'P @dots{}'}})
11602 @cindex drawing a solid polygon (@w{@code{\D'P @dots{}'}})
11603 @cindex solid polygon, drawing (@w{@code{\D'P @dots{}'}})
11604 Draw a solid polygon with the same parameters and behaviour as an
11605 outlined polygon. No outline is drawn.
11607 Here a better variant of the box macro to fill the box with some color.
11608 Note that the box must be drawn before the text since colors in
11609 @code{gtroff} are not transparent; the filled polygon would hide the
11616 \h'-.2m'\v'(.2m - \\n[rsb]u)'\
11618 \D'P 0 -(\\n[rst]u - \\n[rsb]u + .4m) \
11619 (\\n[@@wd]u + .4m) 0 \
11620 0 (\\n[rst]u - \\n[rsb]u + .4m) \
11621 -(\\n[@@wd]u + .4m) 0'\
11622 \h'.2m'\v'-(.2m - \\n[rsb]u)'\
11629 @item \D't @var{n}'
11630 @cindex line thickness (@w{@code{\D't @dots{}'}})
11631 @cindex thickness of lines (@w{@code{\D't @dots{}'}})
11632 Set the current line thickness to @var{n}@tie{}machine units. A value of
11633 zero selects the smallest available line thickness. A negative value
11634 makes the line thickness proportional to the current point size (this is
11635 the default behaviour of @acronym{AT&T} @code{troff}).
11637 Despite of being silly, the current point is moved horizontally to the
11638 right by@tie{}@var{n}.
11640 @item \D'F@var{scheme} @var{color_components}'
11641 @cindex unnamed fill colors (@code{\D'F@dots{}'})
11642 @cindex fill colors, unnamed (@code{\D'F@dots{}'})
11643 @cindex colors, fill, unnamed (@code{\D'F@dots{}'})
11644 Change current fill color. @var{scheme} is a single letter denoting the
11645 color scheme: @samp{r} (rgb), @samp{c} (cmy), @samp{k} (cmyk), @samp{g}
11646 (gray), or @samp{d} (default color). The color components use exactly
11647 the same syntax as in the @code{defcolor} request (@pxref{Colors}); the
11648 command @code{\D'Fd'} doesn't take an argument.
11650 @emph{No} position changing!
11656 \D'Fg .3' \" same gray as \D'f 700'
11657 \D'Fr #0000ff' \" blue
11661 @xref{Graphics Commands}.
11663 @Defesc {\\b, ', string, '}
11664 @cindex pile, glyph (@code{\b})
11665 @cindex glyph pile (@code{\b})
11666 @cindex stacking glyphs (@code{\b})
11667 @dfn{Pile} a sequence of glyphs vertically, and center it vertically
11668 on the current line. Use it to build large brackets and braces.
11670 Here an example how to create a large opening brace:
11673 \b'\[lt]\[bv]\[lk]\[bv]\[lb]'
11676 @cindex @code{\b}, limitations
11677 @cindex limitations of @code{\b} escape
11678 The first glyph is on the top, the last glyph in @var{string} is
11679 at the bottom. Note that @code{gtroff} separates the glyphs
11680 vertically by 1@dmn{m}, and the whole object is centered 0.5@dmn{m}
11681 above the current baseline; the largest glyph width is used as the
11682 width for the whole object. This rather unflexible positioning
11683 algorithm doesn't work with @option{-Tdvi} since the bracket pieces vary
11684 in height for this device. Instead, use the @code{eqn} preprocessor.
11686 @xref{Manipulating Spacing}, how to adjust the vertical spacing with
11687 the @code{\x} escape.
11691 @c =====================================================================
11693 @node Traps, Diversions, Drawing Requests, gtroff Reference
11697 @dfn{Traps} are locations, which, when reached, call a specified
11698 macro. These traps can occur at a given location on the page, at a
11699 given location in the current diversion, at a blank line,
11700 after a certain number of input lines, or at the end of input.
11702 @cindex planting a trap
11703 @cindex trap, planting
11704 Setting a trap is also called @dfn{planting}.
11705 @cindex trap, springing
11706 @cindex springing a trap
11707 It is also said that a trap is @dfn{sprung} if the associated macro
11711 * Page Location Traps::
11712 * Diversion Traps::
11713 * Input Line Traps::
11714 * Blank Line Traps::
11715 * End-of-input Traps::
11718 @c ---------------------------------------------------------------------
11720 @node Page Location Traps, Diversion Traps, Traps, Traps
11721 @subsection Page Location Traps
11722 @cindex page location traps
11723 @cindex traps, page location
11725 @dfn{Page location traps} perform an action when @code{gtroff}
11726 reaches or passes a certain vertical location on the page. Page
11727 location traps have a variety of purposes, including:
11731 setting headers and footers
11734 setting body text in multiple columns
11740 @DefreqList {vpt, flag}
11741 @DefregListEnd {.vpt}
11742 @cindex enabling vertical position traps (@code{vpt})
11743 @cindex vertical position traps, enabling (@code{vpt})
11744 @cindex vertical position trap enable register (@code{.vpt})
11745 Enable vertical position traps if @var{flag} is non-zero, or disables
11746 them otherwise. Vertical position traps are traps set by the @code{wh}
11747 or @code{dt} requests. Traps set by the @code{it} request are not
11748 vertical position traps. The parameter that controls whether vertical
11749 position traps are enabled is global. Initially vertical position traps
11750 are enabled. The current setting of this is available in the
11751 @code{.vpt} read-only number register.
11753 Note that a page can't be ejected if @code{vpt} is set to zero.
11756 @Defreq {wh, dist [@Var{macro}]}
11757 Set a page location trap. Non-negative values for @var{dist} set
11758 the trap relative to the top of the page; negative values set
11759 the trap relative to the bottom of the page. Default scaling
11760 indicator is @samp{v}.
11762 @var{macro} is the name of the macro to execute when the
11763 trap is sprung. If @var{macro} is missing, remove the first trap
11764 (if any) at @var{dist}.
11766 @cindex page headers
11767 @cindex page footers
11770 The following is a simple example of how many macro packages
11771 set headers and footers.
11774 .de hd \" Page header
11780 .de fo \" Page footer
11786 .wh 0 hd \" trap at top of the page
11787 .wh -1i fo \" trap one inch from bottom
11790 A trap at or below the bottom of the page is ignored; it can be made
11791 active by either moving it up or increasing the page length so that the
11792 trap is on the page.
11794 It is possible to have more than one trap at the same location; to do so,
11795 the traps must be defined at different locations, then moved together with
11796 the @code{ch} request; otherwise the second trap would replace the first
11797 one. Earlier defined traps hide later defined traps if moved to the same
11798 position (the many empty lines caused by the @code{bp} request are omitted
11799 in the following example):
11832 @cindex distance to next trap register (@code{.t})
11833 @cindex trap, distance, register (@code{.t})
11834 A read-only number register holding the distance to the next trap.
11836 If there are no traps between the current position and the bottom of the
11837 page, it contains the distance to the page bottom. In a diversion, the
11838 distance to the page bottom is infinite (the returned value is the biggest
11839 integer which can be represented in @code{groff}) if there are no diversion
11843 @Defreq {ch, macro [@Var{dist}]}
11844 @cindex changing trap location (@code{ch})
11845 @cindex trap, changing location (@code{ch})
11846 Change the location of a trap.
11847 The first argument is the name of the macro to be invoked at
11848 the trap, and the second argument is the new location for the trap
11849 (note that the parameters are specified in opposite order as in the
11850 @code{wh} request). This is useful for building up footnotes in a
11851 diversion to allow more space at the bottom of the page for them.
11853 Default scaling indicator for @var{dist} is @samp{v}. If @var{dist}
11854 is missing, the trap is removed.
11860 ... (simplified) footnote example ...
11866 The read-only number register @code{.ne} contains the amount of space
11867 that was needed in the last @code{ne} request that caused a trap to be
11868 sprung. Useful in conjunction with the @code{.trunc} register.
11869 @xref{Page Control}, for more information.
11871 Since the @code{.ne} register is only set by traps it doesn't make
11872 much sense to use it outside of trap macros.
11876 @cindex @code{ne} request, and the @code{.trunc} register
11877 @cindex truncated vertical space register (@code{.trunc})
11878 A read-only register containing the amount of vertical space truncated
11879 by the most recently sprung vertical position trap, or, if the trap was
11880 sprung by an @code{ne} request, minus the amount of vertical motion
11881 produced by the @code{ne} request. In other words, at the point a trap
11882 is sprung, it represents the difference of what the vertical position
11883 would have been but for the trap, and what the vertical position
11886 Since the @code{.trunc} register is only set by traps it doesn't make
11887 much sense to use it outside of trap macros.
11891 @cindex @code{bp} request, and traps (@code{.pe})
11892 @cindex traps, sprung by @code{bp} request (@code{.pe})
11893 @cindex page ejecting register (@code{.pe})
11894 A read-only register which is set to@tie{}1 while a page is ejected with
11895 the @code{bp} request (or by the end of input).
11897 Outside of traps this register is always zero. In the following example,
11898 only the second call to@tie{}@code{x} is caused by @code{bp}.
11919 @cindex diversions, and traps
11920 @cindex traps, and diversions
11921 An important fact to consider while designing macros is that diversions and
11922 traps do not interact normally. For example, if a trap invokes a header
11923 macro (while outputting a diversion) which tries to change the font on the
11924 current page, the effect will not be visible before the diversion has
11925 completely been printed (except for input protected with @code{\!} or
11926 @code{\?}) since the data in the diversion is already formatted. In most
11927 cases, this is not the expected behaviour.
11929 @c ---------------------------------------------------------------------
11931 @node Diversion Traps, Input Line Traps, Page Location Traps, Traps
11932 @subsection Diversion Traps
11933 @cindex diversion traps
11934 @cindex traps, diversion
11936 @Defreq {dt, [@Var{dist} @Var{macro}]}
11937 @cindex @code{.t} register, and diversions
11938 @cindex setting diversion trap (@code{dt})
11939 @cindex diversion trap, setting (@code{dt})
11940 @cindex trap, diversion, setting (@code{dt})
11941 Set a trap @emph{within} a diversion.
11942 @var{dist} is the location of the trap
11943 (identical to the @code{wh} request; default scaling indicator is
11944 @samp{v}) and @var{macro} is the name of the macro to be invoked.
11945 If called without arguments, the diversion trap is removed.
11947 Note that there exists only a single diversion trap.
11949 The number register @code{.t} still works within diversions.
11950 @xref{Diversions}, for more information.
11953 @c ---------------------------------------------------------------------
11955 @node Input Line Traps, Blank Line Traps, Diversion Traps, Traps
11956 @subsection Input Line Traps
11957 @cindex input line traps
11958 @cindex traps, input line
11960 @DefreqList {it, n macro}
11961 @DefreqItem {itc, n macro}
11962 @cindex setting input line trap (@code{it})
11963 @cindex input line trap, setting (@code{it})
11964 @cindex trap, input line, setting (@code{it})
11965 Set an input line trap.
11966 @var{n}@tie{}is the number of lines of input which may be read before
11967 springing the trap, @var{macro} is the macro to be invoked.
11968 Request lines are not counted as input lines.
11970 For example, one possible use is to have a macro which prints the
11971 next @var{n}@tie{}lines in a bold font.
11984 @cindex input line traps and interrupted lines (@code{itc})
11985 @cindex interrupted lines and input line traps (@code{itc})
11986 @cindex traps, input line, and interrupted lines (@code{itc})
11987 @cindex lines, interrupted, and input line traps (@code{itc})
11988 The @code{itc} request is identical
11989 except that an interrupted text line (ending with @code{\c})
11990 is not counted as a separate line.
11992 Both requests are associated with the current environment
11993 (@pxref{Environments}); switching to another environment disables the
11994 current input trap, and going back reactivates it, restoring the number
11995 of already processed lines.
11998 @c ---------------------------------------------------------------------
12000 @node Blank Line Traps, End-of-input Traps, Input Line Traps, Traps
12001 @subsection Blank Line Traps
12002 @cindex blank line traps
12003 @cindex traps, blank line
12005 @Defreq {blm, macro}
12006 @cindex blank line macro (@code{blm})
12007 Set a blank line trap.
12008 @code{gtroff} executes @var{macro} when it encounters a blank line in
12012 @c ---------------------------------------------------------------------
12014 @node End-of-input Traps, , Blank Line Traps, Traps
12015 @subsection End-of-input Traps
12016 @cindex end-of-input traps
12017 @cindex traps, end-of-input
12019 @Defreq {em, macro}
12020 @cindex setting end-of-input trap (@code{em})
12021 @cindex end-of-input trap, setting (@code{em})
12022 @cindex trap, end-of-input, setting (@code{em})
12023 @cindex end-of-input macro (@code{em})
12024 @cindex macro, end-of-input (@code{em})
12025 Set a trap at the end of input. @var{macro} is executed after the
12026 last line of the input file has been processed.
12028 For example, if the document had to have a section at the bottom of the
12029 last page for someone to approve it, the @code{em} request could be
12035 . sp |(\\n[.t] - 6v)
12049 @c =====================================================================
12051 @node Diversions, Environments, Traps, gtroff Reference
12052 @section Diversions
12055 In @code{gtroff} it is possible to @dfn{divert} text into a named
12056 storage area. Due to the similarity to defining macros it is sometimes
12057 said to be stored in a macro. This is used for saving text for output
12058 at a later time, which is useful for keeping blocks of text on the same
12059 page, footnotes, tables of contents, and indices.
12061 @cindex top-level diversion
12062 @cindex diversion, top-level
12063 For orthogonality it is said that @code{gtroff} is in the @dfn{top-level
12064 diversion} if no diversion is active (i.e., the data is diverted to the
12067 @DefreqList {di, macro}
12068 @DefreqListEnd {da, macro}
12069 @cindex beginning diversion (@code{di})
12070 @cindex diversion, beginning (@code{di})
12071 @cindex ending diversion (@code{di})
12072 @cindex diversion, ending (@code{di})
12073 @cindex appending to a diversion (@code{da})
12074 @cindex diversion, appending (@code{da})
12075 Begin a diversion. Like the @code{de}
12076 request, it takes an argument of a macro name to divert subsequent text
12077 into. The @code{da} macro appends to an existing diversion.
12079 @code{di} or @code{da} without an argument ends the diversion.
12082 @DefreqList {box, macro}
12083 @DefreqListEnd {boxa, macro}
12084 Begin (or appends to) a diversion like the
12085 @code{di} and @code{da} requests.
12086 The difference is that @code{box} and @code{boxa}
12087 do not include a partially-filled line in the diversion.
12099 @result{} Before the box. After the box.
12101 @result{} In the box.
12108 Before the diversion.
12113 After the diversion.
12115 @result{} After the diversion.
12117 @result{} Before the diversion. In the diversion.
12120 @code{box} or @code{boxa} without an argument ends the diversion.
12124 @DefregListEnd {.d}
12125 @cindex @code{nl} register, and @code{.d}
12126 @cindex nested diversions
12127 @cindex diversion, nested
12128 @cindex diversion name register (@code{.z})
12129 @cindex vertical position in diversion register (@code{.d})
12130 @cindex position, vertical, in diversion, register (@code{.d})
12131 @cindex diversion, vertical position in, register (@code{.d})
12132 Diversions may be nested. The read-only number register @code{.z}
12133 contains the name of the current diversion (this is a string-valued
12134 register). The read-only number register @code{.d} contains the current
12135 vertical place in the diversion. If not in a diversion it is the same
12136 as register @code{nl}.
12140 @cindex high-water mark register (@code{.h})
12141 @cindex mark, high-water, register (@code{.h})
12142 @cindex position of lowest text line (@code{.h})
12143 @cindex text line, position of lowest (@code{.h})
12144 The @dfn{high-water mark} on the current page. It corresponds to the
12145 text baseline of the lowest line on the page. This is a read-only
12149 .tm .h==\n[.h], nl==\n[nl]
12150 @result{} .h==0, nl==-1
12154 .tm .h==\n[.h], nl==\n[nl]
12155 @result{} .h==40, nl==120
12158 @cindex @code{.h} register, difference to @code{nl}
12159 @cindex @code{nl} register, difference to @code{.h}
12161 As can be seen in the previous example, empty lines are not considered
12162 in the return value of the @code{.h} register.
12166 @DefregListEnd {dl}
12167 @cindex @code{dn} register, and @code{da} (@code{boxa})
12168 @cindex @code{dl} register, and @code{da} (@code{boxa})
12169 @cindex @code{da} request, and @code{dn} (@code{dl})
12170 @cindex @code{boxa} request, and @code{dn} (@code{dl})
12171 After completing a diversion, the read-write number registers @code{dn}
12172 and @code{dl} contain the vertical and horizontal size of the diversion.
12173 Note that only the just processed lines are counted: For the computation
12174 of @code{dn} and @code{dl}, the requests @code{da} and @code{boxa} are
12175 handled as if @code{di} and @code{box} had been used -- lines which have
12176 been already stored in a macro are not taken into account.
12179 .\" Center text both horizontally & vertically
12181 .\" Enclose macro definitions in .eo and .ec
12182 .\" to avoid the doubling of the backslash
12184 .\" macro .(c starts centering mode
12195 .\" macro .)c terminates centering mode
12200 . nr @@s (((\n[.t]u - \n[dn]u) / 2u) - 1v)
12212 .\" End of macro definitions, restore escape mechanism
12217 @DefescList {\\!, , , }
12218 @DefescListEnd {\\?, , anything, \\?}
12219 @cindex transparent output (@code{\!}, @code{\?})
12220 @cindex output, transparent (@code{\!}, @code{\?})
12221 Prevent requests, macros, and escapes from being
12222 interpreted when read into a diversion. Both escapes take the given text
12223 and @dfn{transparently} embed it into the diversion. This is useful for
12224 macros which shouldn't be invoked until the diverted text is actually
12227 The @code{\!} escape transparently embeds text up to
12228 and including the end of the line.
12229 The @code{\?} escape transparently embeds text until the next
12230 occurrence of the @code{\?} escape. Example:
12237 @var{anything} may not contain newlines; use @code{\!} to embed
12238 newlines in a diversion. The escape sequence @code{\?} is also
12239 recognized in copy mode and turned into a single internal code; it is
12240 this code that terminates @var{anything}. Thus the following example
12247 \?\\?\\\\?\\\\\\\\nx\\\\?\\?\?
12261 Both escapes read the data in copy mode.
12263 @cindex @code{\!}, in top-level diversion
12264 @cindex top-level diversion, and @code{\!}
12265 @cindex diversion, top-level, and @code{\!}
12266 If @code{\!} is used in the top-level diversion, its argument is
12267 directly embedded into the @code{gtroff} intermediate output. This can
12268 be used for example to control a postprocessor which processes the data
12269 before it is sent to the device driver.
12271 @cindex @code{\?}, in top-level diversion
12272 @cindex top-level diversion, and @code{\?}
12273 @cindex diversion, top-level, and @code{\?}
12274 The @code{\?} escape used in the top-level diversion produces no output
12275 at all; its argument is simply ignored.
12278 @cindex @code{\!}, and @code{output}
12279 @cindex @code{output} request, and @code{\!}
12280 @Defreq {output, string}
12281 Emit @var{string} directly to the @code{gtroff} intermediate output
12282 (subject to copy-mode interpretation); this is similar to @code{\!} used
12283 at the top level. An initial double quote in @var{string} is stripped off
12284 to allow initial blanks.
12286 This request can't be used before the first page has started -- if you get
12287 an error, simply insert @code{.br} before the @code{output} request.
12289 Without argument, @code{output} is ignored.
12291 Use with caution! It is normally only needed for mark-up used by a
12292 postprocessor which does something with the output before sending it to
12293 the output device, filtering out @var{string} again.
12296 @Defreq {asciify, div}
12297 @cindex unformatting diversions (@code{asciify})
12298 @cindex diversion, unformatting (@code{asciify})
12299 @cindex @code{trin} request, and @code{asciify}
12300 @dfn{Unformat} the diversion specified by @var{div}
12301 in such a way that @acronym{ASCII} characters, characters translated with
12302 the @code{trin} request, space characters, and some escape sequences that
12303 were formatted and diverted are treated like ordinary input
12304 characters when the diversion is reread. It can be also used for gross
12305 hacks; for example, the following sets register@tie{}@code{n} to@tie{}1.
12318 @xref{Copy-in Mode}.
12321 @Defreq {unformat, div}
12322 Like @code{asciify}, unformat the specified diversion.
12323 However, @code{unformat} only unformats spaces and tabs
12325 Unformatted tabs are treated as input tokens,
12326 and spaces are stretchable again.
12328 The vertical size of lines is not preserved; glyph information (font,
12329 font size, space width, etc.)@: is retained.
12333 @c =====================================================================
12335 @node Environments, Suppressing output, Diversions, gtroff Reference
12336 @section Environments
12337 @cindex environments
12339 It happens frequently that some text should be printed in a certain
12340 format regardless of what may be in effect at the time, for example, in
12341 a trap invoked macro to print headers and footers. To solve this
12342 @code{gtroff} processes text in @dfn{environments}. An
12343 environment contains most of the parameters that control text
12344 processing. It is possible to switch amongst these environments; by
12345 default @code{gtroff} processes text in environment@tie{}0. The
12346 following is the information kept in an environment.
12350 font parameters (size, family, style, glyph height and slant, space
12351 and sentence space size)
12354 page parameters (line length, title length, vertical spacing,
12355 line spacing, indentation, line numbering, centering, right-justifying,
12356 underlining, hyphenation data)
12359 fill and adjust mode
12362 tab stops, tab and leader characters, escape character,
12363 no-break and hyphen indicators, margin character data
12366 partially collected lines
12372 drawing and fill colours
12375 These environments may be given arbitrary names (see @ref{Identifiers},
12376 for more info). Old versions of @code{troff} only had environments
12377 named @samp{0}, @samp{1}, and @samp{2}.
12379 @DefreqList {ev, [@Var{env}]}
12380 @DefregListEnd {.ev}
12381 @cindex switching environments (@code{ev})
12382 @cindex environment, switching (@code{ev})
12383 @cindex environment number/name register (@code{.ev})
12384 Switch to another environment. The argument @var{env} is the name of
12385 the environment to switch to. With no argument, @code{gtroff} switches
12386 back to the previous environment. There is no limit on the number of
12387 named environments; they are created the first time that they are
12388 referenced. The @code{.ev} read-only register contains the name or
12389 number of the current environment. This is a string-valued register.
12391 Note that a call to @code{ev} (with argument) pushes the previously
12392 active environment onto a stack. If, say, environments @samp{foo},
12393 @samp{bar}, and @samp{zap} are called (in that order), the first
12394 @code{ev} request without parameter switches back to environment
12395 @samp{bar} (which is popped off the stack), and a second call
12396 switches back to environment @samp{foo}.
12398 Here is an example:
12411 \(dg Note the large, friendly letters.
12417 @cindex copying environment (@code{evc})
12418 @cindex environment, copying (@code{evc})
12419 Copy the environment @var{env} into the current environment.
12421 The following environment data is not copied:
12425 Partially filled lines.
12428 The status whether the previous line was interrupted.
12431 The number of lines still to center, or to right-justify, or to underline
12432 (with or without underlined spaces); they are set to zero.
12435 The status whether a temporary indentation is active.
12438 Input traps and its associated data.
12441 Line numbering mode is disabled; it can be reactivated with
12445 The number of consecutive hyphenated lines (set to zero).
12452 @DefregListEnd {.csk}
12453 @cindex environment, dimensions of last glyph (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
12454 @cindex width, of last glyph (@code{.w})
12455 @cindex height, of last glyph (@code{.cht})
12456 @cindex depth, of last glyph (@code{.cdp})
12457 @cindex skew, of last glyph (@code{.csk})
12458 @cindex last glyph, dimensions (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
12459 @cindex glyph, last, dimensions (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
12460 The @code{\n[.w]} register contains the
12461 width of the last glyph added to the current environment.
12463 The @code{\n[.cht]} register contains the
12464 height of the last glyph added to the current environment.
12466 The @code{\n[.cdp]} register contains the
12467 depth of the last glyph added to the current environment.
12468 It is positive for glyphs extending below the baseline.
12470 The @code{\n[.csk]} register contains the
12471 @dfn{skew} (how far to the right of the glyph's center
12472 that @code{gtroff} should place an accent)
12473 of the last glyph added to the current environment.
12477 @cindex environment, previous line length (@code{.n})
12478 @cindex line length, previous (@code{.n})
12479 @cindex length of previous line (@code{.n})
12480 @cindex previous line length (@code{.n})
12481 The @code{\n[.n]} register contains the
12482 length of the previous output line in the current environment.
12486 @c =====================================================================
12488 @node Suppressing output, Colors, Environments, gtroff Reference
12489 @section Suppressing output
12491 @Defesc {\\O, , num, }
12492 @cindex suppressing output (@code{\O})
12493 @cindex output, suppressing (@code{\O})
12494 Disable or enable output depending on the value of @var{num}:
12498 Disable any glyphs from being emitted to the device driver, provided that
12499 the escape occurs at the outer level (see @code{\O[3]} and @code{\O[4]}).
12500 Motion is not suppressed so effectively @code{\O[0]} means @emph{pen up}.
12503 Enable output of glyphs, provided that the escape occurs at the outer
12511 @code{\O0} and @code{\O1} also reset the four registers @samp{opminx},
12512 @samp{opminy}, @samp{opmaxx}, and @samp{opmaxy} to @minus{}1.
12513 @xref{Register Index}. These four registers mark the top left and
12514 bottom right hand corners of a box which encompasses all written glyphs.
12516 For example the input text:
12519 Hello \O[0]world \O[1]this is a test.
12523 produces the following output:
12526 Hello this is a test.
12531 Provided that the escape occurs at the outer level, enable output of
12532 glyphs and also write out to @code{stderr} the page number and four
12533 registers encompassing the glyphs previously written since the last call
12537 Begin a nesting level. At start-up, @code{gtroff} is at outer level.
12540 End a nesting level.
12542 @item \O[5@var{P}@var{filename}]
12543 This escape is @code{grohtml} specific. Provided that this escape
12544 occurs at the outer nesting level write the @code{filename} to
12545 @code{stderr}. The position of the image, @var{P}, must be specified
12546 and must be one of @code{l}, @code{r}, @code{c}, or@tie{}@code{i} (left,
12547 right, centered, inline). @var{filename} will be associated with the
12548 production of the next inline image.
12552 @c =====================================================================
12554 @node Colors, I/O, Suppressing output, gtroff Reference
12558 @DefreqList {color, [@Var{n}]}
12559 @DefregListEnd {.color}
12560 If @var{n} is missing or non-zero, activate colors (this is the default);
12561 otherwise, turn it off.
12563 The read-only number register @code{.color} is@tie{}1 if colors are active,
12566 Internally, @code{color} sets a global flag; it does not produce a token.
12567 Similar to the @code{cp} request, you should use it at the beginning of
12568 your document to control color output.
12570 Colors can be also turned off with the @option{-c} command line option.
12573 @Defreq {defcolor, ident scheme color_components}
12574 Define color with name @var{ident}. @var{scheme} can be one of the
12575 following values: @code{rgb} (three components), @code{cmy} (three
12576 components), @code{cmyk} (four components), and @code{gray} or
12577 @code{grey} (one component).
12579 @cindex default color
12580 @cindex color, default
12581 Color components can be given either as a hexadecimal string or as
12582 positive decimal integers in the range 0--65535. A hexadecimal string
12583 contains all color components concatenated. It must start with either
12584 @code{#} or @code{##}; the former specifies hex values in the range
12585 0--255 (which are internally multiplied by@tie{}257), the latter in the
12586 range 0--65535. Examples: @code{#FFC0CB} (pink), @code{##ffff0000ffff}
12587 (magenta). The default color name @c{default} can't be redefined; its
12588 value is device-specific (usually black). It is possible that the
12589 default color for @code{\m} and @code{\M} is not identical.
12591 @cindex @code{f} unit, and colors
12592 @cindex unit, @code{f}, and colors
12593 A new scaling indicator@tie{}@code{f} has been introduced which multiplies
12594 its value by 65536; this makes it convenient to specify color components
12595 as fractions in the range 0 to@tie{}1 (1f equals 65536u). Example:
12598 .defcolor darkgreen rgb 0.1f 0.5f 0.2f
12601 Note that @code{f} is the default scaling indicator for the
12602 @code{defcolor} request, thus the above statement is equivalent to
12605 .defcolor darkgreen rgb 0.1 0.5 0.2
12609 @DefreqList {gcolor, [@Var{color}]}
12610 @DefescItem {\\m, , c, }
12611 @DefescItem {\\m, @Lparen{}, co, }
12612 @DefescItem {\\m, @Lbrack{}, color, @Rbrack{}}
12613 @DefregListEnd {.m}
12614 Set (glyph) drawing color. The following examples show how to turn the
12615 next four words red.
12621 and these words are in black.
12625 \m[red]these are in red\m[] and these words are in black.
12628 The escape @code{\m[]} returns to the previous color, as does a call to
12629 @code{gcolor} without an argument.
12631 @cindex drawing color name register (@code{.m})
12632 @cindex name, drawing color, register (@code{.m})
12633 @cindex color name, drawing, register (@code{.m})
12634 The name of the current drawing color is available in the read-only,
12635 string-valued number register @samp{.m}.
12637 The drawing color is associated with the current environment
12638 (@pxref{Environments}).
12640 Note that @code{\m} doesn't produce an input token in @code{gtroff}.
12641 As a consequence, it can be used in requests like @code{mc} (which
12642 expects a single character as an argument) to change the color on
12650 @DefreqList {fcolor, [@Var{color}]}
12651 @DefescItem {\\M, , c, }
12652 @DefescItem {\\M, @Lparen{}, co, }
12653 @DefescItem {\\M, @Lbrack{}, color, @Rbrack{}}
12654 @DefregListEnd {.M}
12655 Set fill (background) color for filled objects drawn with the
12656 @code{\D'@dots{}'} commands.
12658 A red ellipse can be created with the following code:
12661 \M[red]\h'0.5i'\D'E 2i 1i'\M[]
12664 The escape @code{\M[]} returns to the previous fill color, as does a call to
12665 @code{fcolor} without an argument.
12667 @cindex background color name register (@code{.M})
12668 @cindex name, background color, register (@code{.M})
12669 @cindex color name, background, register (@code{.M})
12670 @cindex fill color name register (@code{.M})
12671 @cindex name, fill color, register (@code{.M})
12672 @cindex color name, fill, register (@code{.M})
12673 The name of the current fill (background) color is available in the
12674 read-only, string-valued number register @samp{.M}.
12676 The fill color is associated with the current environment
12677 (@pxref{Environments}).
12679 Note that @code{\M} doesn't produce an input token in @code{gtroff}.
12683 @c =====================================================================
12685 @node I/O, Postprocessor Access, Colors, gtroff Reference
12688 @cindex input and output requests
12689 @cindex requests for input and output
12690 @cindex output and input requests
12692 @code{gtroff} has several requests for including files:
12695 @cindex including a file (@code{so})
12696 @cindex file, inclusion (@code{so})
12697 Read in the specified @var{file} and
12698 includes it in place of the @code{so} request. This is quite useful for
12699 large documents, e.g.@: keeping each chapter in a separate file.
12700 @xref{gsoelim}, for more information.
12702 Since @code{gtroff} replaces the @code{so} request with the contents
12703 of @code{file}, it makes a difference whether the data is terminated with
12704 a newline or not: Assuming that file @file{xxx} contains the word
12705 @samp{foo} without a final newline, this
12714 yields @samp{This is foobar}.
12716 The search path for @var{file} can be controlled with the @option{-I} command
12720 @Defreq {pso, command}
12721 Read the standard output from the specified @var{command}
12722 and includes it in place of the @code{pso} request.
12725 @cindex mode, safer
12726 @cindex unsafe mode
12727 @cindex mode, unsafe
12728 This request causes an error if used in safer mode (which is the default).
12729 Use @code{groff}'s or @code{troff}'s @option{-U} option to activate unsafe
12732 The comment regarding a final newline for the @code{so} request is valid
12733 for @code{pso} also.
12736 @Defreq {mso, file}
12737 Identical to the @code{so} request except that @code{gtroff} searches for
12738 the specified @var{file} in the same directories as macro files for the
12739 the @option{-m} command line option. If the file name to be included
12740 has the form @file{@var{name}.tmac} and it isn't found, @code{mso} tries
12741 to include @file{tmac.@var{name}} and vice versa.
12744 @DefreqList {trf, file}
12745 @DefreqListEnd {cf, file}
12746 @cindex transparent output (@code{cf}, @code{trf})
12747 @cindex output, transparent (@code{cf}, @code{trf})
12748 Transparently output the contents of @var{file}. Each line is output
12749 as if it were preceded by @code{\!}; however, the lines are not subject
12750 to copy mode interpretation. If the file does not end with a newline,
12751 then a newline is added (@code{trf} only). For example, to define a
12752 macro@tie{}@code{x} containing the contents of file@tie{}@file{f}, use
12760 Both @code{trf} and @code{cf}, when used in a diversion,
12761 embeds an object in the diversion which, when reread, causes the
12762 contents of @var{file} to be transparently copied through to the
12763 output. In @acronym{UNIX} @code{troff}, the contents of @var{file}
12764 is immediately copied through to the output regardless of whether there
12765 is a current diversion; this behaviour is so anomalous that it must be
12768 @cindex @code{trf} request, and invalid characters
12769 @cindex characters, invalid for @code{trf} request
12770 @cindex invalid characters for @code{trf} request
12771 While @code{cf} copies the contents of @var{file} completely unprocessed,
12772 @code{trf} disallows characters such as NUL that are not valid
12773 @code{gtroff} input characters (@pxref{Identifiers}).
12775 Both requests cause a line break.
12778 @Defreq {nx, [@Var{file}]}
12779 @cindex processing next file (@code{nx})
12780 @cindex file, processing next (@code{nx})
12781 @cindex next file, processing (@code{nx})
12782 Force @code{gtroff} to continue processing of
12783 the file specified as an argument. If no argument is given, immediately
12784 jump to the end of file.
12787 @Defreq {rd, [@Var{prompt} [@Var{arg1} @Var{arg2} @dots{}]]}
12788 @cindex reading from standard input (@code{rd})
12789 @cindex standard input, reading from (@code{rd})
12790 @cindex input, standard, reading from (@code{rd})
12791 Read from standard input, and include what is read as though it
12792 were part of the input file. Text is read until a blank line
12795 If standard input is a TTY input device (keyboard), write @var{prompt}
12796 to standard error, followed by a colon (or send BEL for a beep if no
12797 argument is given).
12799 Arguments after @var{prompt} are available for the input. For example,
12806 with the input @w{@samp{This is \$2.}} prints
12813 @cindex form letters
12814 @cindex letters, form
12815 Using the @code{nx} and @code{rd} requests,
12816 it is easy to set up form letters. The form
12817 letter template is constructed like this, putting the following lines
12818 into a file called @file{repeat.let}:
12834 @cindex @code{ex} request, used with @code{nx} and @code{rd}
12836 When this is run, a file containing the following lines should be
12837 redirected in. Note that requests included in this file are executed
12838 as though they were part of the form letter. The last block of input
12839 is the @code{ex} request which tells @code{groff} to stop processing. If
12840 this was not there, @code{groff} would not know when to stop.
12844 708 NW 19th Av., #202
12851 San Diego, CA 92103
12859 Pipe the output of @code{gtroff} to the shell command(s)
12860 specified by @var{pipe}. This request must occur before
12861 @code{gtroff} has a chance to print anything.
12864 @cindex mode, safer
12865 @cindex unsafe mode
12866 @cindex mode, unsafe
12867 @code{pi} causes an error if used in safer mode (which is the default).
12868 Use @code{groff}'s or @code{troff}'s @option{-U} option to activate unsafe
12871 Multiple calls to @code{pi} are allowed, acting as a chain. For example,
12879 is the same as @w{@samp{.pi foo | bar}}.
12881 @cindex @code{groff}, and @code{pi} request
12882 @cindex @code{pi} request, and @code{groff}
12883 Note that the intermediate output format of @code{gtroff} is piped to
12884 the specified commands. Consequently, calling @code{groff} without the
12885 @option{-Z} option normally causes a fatal error.
12888 @DefreqList {sy, cmds}
12889 @DefregListEnd {systat}
12890 Execute the shell command(s) specified by @var{cmds}. The output is not
12891 saved anyplace, so it is up to the user to do so.
12894 @cindex mode, safer
12895 @cindex unsafe mode
12896 @cindex mode, unsafe
12897 This request causes an error if used in safer mode (which is the default).
12898 Use @code{groff}'s or @code{troff}'s @option{-U} option to activate unsafe
12901 For example, the following code fragment introduces the current time into a
12904 @cindex time, current
12905 @cindex current time
12908 .sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\
12909 (localtime(time))[2,1,0]' > /tmp/x\n[$$]
12911 .sy rm /tmp/x\n[$$]
12916 Note that this works by having the @code{perl} script (run by @code{sy})
12917 print out the @code{nr} requests which set the number registers
12918 @code{H}, @code{M}, and @code{S}, and then reads those commands in with
12919 the @code{so} request.
12921 For most practical purposes, the number registers @code{seconds},
12922 @code{minutes}, and @code{hours} which are initialized at start-up of
12923 @code{gtroff} should be sufficient. Use the @code{af} request to get a
12930 \n[hours]:\n[minutes]:\n[seconds]
12933 @cindex @code{system()} return value register (@code{systat})
12934 The @code{systat} read-write number register contains the return value
12935 of the @code{system()} function executed by the last @code{sy} request.
12938 @DefreqList {open, stream file}
12939 @DefreqListEnd {opena, stream file}
12940 @cindex opening file (@code{open})
12941 @cindex file, opening (@code{open})
12942 @cindex appending to a file (@code{opena})
12943 @cindex file, appending to (@code{opena})
12944 Open the specified @var{file} for writing and
12945 associates the specified @var{stream} with it.
12947 The @code{opena} request is like @code{open}, but if the file exists,
12948 append to it instead of truncating it.
12951 @cindex mode, safer
12952 @cindex unsafe mode
12953 @cindex mode, unsafe
12954 Both @code{open} and @code{opena} cause an error if used in safer mode
12955 (which is the default). Use @code{groff}'s or @code{troff}'s @option{-U}
12956 option to activate unsafe mode.
12959 @DefreqList {write, stream data}
12960 @DefreqListEnd {writec, stream data}
12961 @cindex copy-in mode, and @code{write} requests
12962 @cindex mode, copy-in, and @code{write} requests
12963 @cindex writing to file (@code{write})
12964 @cindex file, writing to (@code{write})
12965 Write to the file associated with the specified @var{stream}.
12966 The stream must previously have
12967 been the subject of an open request. The remainder of the line is
12968 interpreted as the @code{ds} request reads its second argument: A
12969 leading @samp{"} is stripped, and it is read in copy-in mode.
12971 The @code{writec} request is like @code{write}, but only
12972 @code{write} appends a newline to the data.
12975 @Defreq {writem, stream xx}
12976 @cindex @code{asciify} request, and @code{writem}
12977 Write the contents of the macro or string @var{xx}
12978 to the file associated with the specified @var{stream}.
12980 @var{xx} is read in copy mode, i.e., already formatted elements are
12981 ignored. Consequently, diversions must be unformatted with the
12982 @code{asciify} request before calling @code{writem}. Usually, this
12983 means a loss of information.
12986 @Defreq {close, stream}
12987 @cindex closing file (@code{close})
12988 @cindex file, closing (@code{close})
12989 Close the specified @var{stream};
12990 the stream is no longer an acceptable argument to the
12991 @code{write} request.
12993 Here a simple macro to write an index entry.
12999 . write idx \\n[%] \\$*
13008 @DefescList {\\V, , e, }
13009 @DefescItem {\\V, @Lparen{}, ev, }
13010 @DefescListEnd {\\V, @Lbrack{}, env, @Rbrack{}}
13011 Interpolate the contents of the specified environment variable
13012 @var{env} (one-character name@tie{}@var{e}, two-character name @var{ev})
13013 as returned by the function @code{getenv}. @code{\V} is interpreted
13018 @c =====================================================================
13020 @node Postprocessor Access, Miscellaneous, I/O, gtroff Reference
13021 @section Postprocessor Access
13022 @cindex postprocessor access
13023 @cindex access of postprocessor
13025 There are two escapes which give information directly to the
13026 postprocessor. This is particularly useful for embedding
13027 @sc{PostScript} into the final document.
13029 @Defesc {\\X, ', xxx, '}
13030 Embeds its argument into the @code{gtroff}
13031 output preceded with @w{@samp{x X}}.
13033 @cindex @code{\&}, in @code{\X}
13034 @cindex @code{\)}, in @code{\X}
13035 @cindex @code{\%}, in @code{\X}
13037 @cindex @code{\:}, in @code{\X}
13040 @cindex @code{\@r{<colon>}}, in @code{\X}
13042 The escapes @code{\&}, @code{\)}, @code{\%}, and @code{\:} are ignored
13043 within @code{\X}, @w{@samp{\ }} and @code{\~} are converted to single
13044 space characters. All other escapes (except @code{\\} which produces a
13045 backslash) cause an error.
13047 @kindex use_charnames_in_special
13048 @pindex DESC@r{, and @code{use_charnames_in_special}}
13049 @cindex @code{\X}, and special characters
13050 If the @samp{use_charnames_in_special} keyword is set in the @file{DESC}
13051 file, special characters no longer cause an error; the name @var{xx} is
13052 represented as @samp{\(@var{xx})} in the @w{@samp{x X}} output command.
13053 Additionally, the backslash is represented as @code{\\}.
13055 @samp{use_charnames_in_special} is currently used by @code{grohtml} only.
13058 @DefescList {\\Y, , n, }
13059 @DefescItem {\\Y, @Lparen{}, nm, }
13060 @DefescListEnd {\\Y, @Lbrack{}, name, @Rbrack{}}
13061 This is approximately equivalent to @samp{\X'\*[@var{name}]'}
13062 (one-character name@tie{}@var{n}, two-character name @var{nm}).
13063 However, the contents of the string or macro @var{name} are not
13064 interpreted; also it is permitted for @var{name} to have been defined
13065 as a macro and thus contain newlines (it is not permitted for the
13066 argument to @code{\X} to contain newlines). The inclusion of
13067 newlines requires an extension to the @acronym{UNIX} @code{troff}
13068 output format, and confuses drivers that do not know about this
13069 extension (@pxref{Device Control Commands}).
13072 @xref{Output Devices}.
13075 @c =====================================================================
13077 @node Miscellaneous, Gtroff Internals, Postprocessor Access, gtroff Reference
13078 @section Miscellaneous
13080 This section documents parts of @code{gtroff} which cannot (yet) be
13081 categorized elsewhere in this manual.
13083 @Defreq {nm, [@Var{start} [@Var{inc} [@Var{space} [@Var{indent}]]]]}
13084 @cindex printing line numbers (@code{nm})
13085 @cindex line numbers, printing (@code{nm})
13086 @cindex numbers, line, printing (@code{nm})
13087 Print line numbers.
13088 @var{start} is the line number of the @emph{next}
13089 output line. @var{inc} indicates which line numbers are printed.
13090 For example, the value@tie{}5 means to emit only line numbers which
13091 are multiples of@tie{}5; this defaults to@tie{}1. @var{space} is the
13092 space to be left between the number and the text; this defaults to
13093 one digit space. The fourth argument is the indentation of the line
13094 numbers, defaulting to zero. Both @var{space} and @var{indent} are
13095 given as multiples of digit spaces; they can be negative also.
13096 Without any arguments, line numbers are turned off.
13098 @code{gtroff} reserves three digit spaces for the line number (which is
13099 printed right-justified) plus the amount given by @var{indent}; the
13100 output lines are concatenated to the line numbers, separated by
13101 @var{space}, and @emph{without} reducing the line length. Depending
13102 on the value of the horizontal page offset (as set with the
13103 @code{po} request), line numbers which are longer than the reserved
13104 space stick out to the left, or the whole line is moved to the right.
13106 Parameters corresponding to missing arguments are not changed; any
13107 non-digit argument (to be more precise, any argument starting with a
13108 character valid as a delimiter for identifiers) is also treated as
13111 If line numbering has been disabled with a call to @code{nm} without
13112 an argument, it can be reactivated with @samp{.nm +0}, using the
13113 previously active line numbering parameters.
13115 The parameters of @code{nm} are associated with the current environment
13116 (@pxref{Environments}). The current output line number is available
13117 in the number register @code{ln}.
13122 This test shows how line numbering works with groff.
13124 This test shows how line numbering works with groff.
13128 This test shows how line numbering works with groff.
13130 This test shows how line numbering works with groff.
13134 And here the result:
13137 This test shows how
13138 line numbering works
13139 999 with groff. This
13140 1000 test shows how line
13141 1001 numbering works with
13143 This test shows how
13146 This test shows how
13147 1005 line numbering
13152 @Defreq {nn, [@Var{skip}]}
13153 Temporarily turn off line numbering. The argument is the number
13154 of lines not to be numbered; this defaults to@tie{}1.
13157 @Defreq {mc, glyph [@Var{dist}]}
13158 @cindex margin glyph (@code{mc})
13159 @cindex glyph, for margins (@code{mc})
13160 Print a @dfn{margin character} to the right of the
13161 text.@footnote{@dfn{Margin character} is a misnomer since it is an
13162 output glyph.} The first argument is the glyph to be
13163 printed. The second argument is the distance away from the right
13164 margin. If missing, the previously set value is used; default is
13165 10@dmn{pt}). For text lines that are too long (that is, longer than
13166 the text length plus @var{dist}), the margin character is directly
13167 appended to the lines.
13169 With no arguments the margin character is turned off.
13170 If this occurs before a break, no margin character is printed.
13172 For compatibility with @acronym{AT&T} @code{troff}, a call to @code{mc}
13173 to set the margin character can't be undone immediately; at least one
13174 line gets a margin character. Thus
13193 @cindex @code{tl} request, and @code{mc}
13194 For empty lines and lines produced by the @code{tl} request no margin
13195 character is emitted.
13197 The margin character is associated with the current environment
13198 (@pxref{Environments}).
13202 This is quite useful for indicating text that has changed, and, in fact,
13203 there are programs available for doing this (they are called
13204 @code{nrchbar} and @code{changebar} and can be found in any
13205 @samp{comp.sources.unix} archive).
13210 This paragraph is highlighted with a margin
13213 Note that vertical space isn't marked.
13217 But we can fake it with `\&'.
13223 This paragraph is highlighted |
13224 with a margin character. |
13226 Note that vertical space isn't |
13229 But we can fake it with `\&'. |
13233 @DefreqList {psbb, filename}
13237 @DefregListEnd {ury}
13238 @cindex PostScript, bounding box
13239 @cindex bounding box
13240 Retrieve the bounding box of the PostScript image
13241 found in @var{filename}.
13242 The file must conform to
13243 Adobe's @dfn{Document Structuring Conventions} (DSC);
13244 the command searches for a @code{%%BoundingBox} comment
13245 and extracts the bounding box values into the number registers
13246 @code{llx}, @code{lly}, @code{urx}, and @code{ury}.
13247 If an error occurs (for example, @code{psbb} cannot find
13248 the @code{%%BoundingBox} comment),
13249 it sets the four number registers to zero.
13251 The search path for @var{filename} can be controlled with the @option{-I}
13252 command line option.
13256 @c =====================================================================
13258 @node Gtroff Internals, Debugging, Miscellaneous, gtroff Reference
13259 @section @code{gtroff} Internals
13261 @cindex input token
13262 @cindex token, input
13263 @cindex output node
13264 @cindex node, output
13265 @code{gtroff} processes input in three steps. One or more input
13266 characters are converted to an @dfn{input token}.@footnote{Except the
13267 escapes @code{\f}, @code{\F}, @code{\H}, @code{\m}, @code{\M}, @code{\R},
13268 @code{\s}, and @code{\S} which are processed immediately if not in
13269 copy-in mode.} Then, one or more input tokens are converted to an
13270 @dfn{output node}. Finally, output nodes are converted to the
13271 intermediate output language understood by all output devices.
13273 Actually, before step one happens, @code{gtroff} converts certain
13274 escape sequences into reserved input characters (not accessible by
13275 the user); such reserved characters are used for other internal
13276 processing also -- this is the very reason why not all characters
13277 are valid input. @xref{Identifiers}, for more on this topic.
13279 For example, the input string @samp{fi\[:u]} is converted into a
13280 character token @samp{f}, a character token @samp{i}, and a special
13281 token @samp{:u} (representing u@tie{}umlaut). Later on, the character
13282 tokens @samp{f} and @samp{i} are merged to a single output node
13283 representing the ligature glyph @samp{fi} (provided the current font
13284 has a glyph for this ligature); the same happens with @samp{:u}. All
13285 output glyph nodes are `processed' which means that they are invariably
13286 associated with a given font, font size, advance width, etc. During
13287 the formatting process, @code{gtroff} itself adds various nodes to
13288 control the data flow.
13290 Macros, diversions, and strings collect elements in two chained lists:
13291 a list of input tokens which have been passed unprocessed, and a list
13292 of output nodes. Consider the following the diversion.
13304 It contains these elements.
13306 @multitable {@i{vertical size node}} {token list} {element number}
13307 @item node list @tab token list @tab element number
13309 @item @i{line start node} @tab --- @tab 1
13310 @item @i{glyph node @code{a}} @tab --- @tab 2
13311 @item @i{word space node} @tab --- @tab 3
13312 @item --- @tab @code{b} @tab 4
13313 @item --- @tab @code{\n} @tab 5
13314 @item @i{glyph node @code{c}} @tab --- @tab 6
13315 @item @i{vertical size node} @tab --- @tab 7
13316 @item @i{vertical size node} @tab --- @tab 8
13317 @item --- @tab @code{\n} @tab 9
13320 @cindex @code{\v}, internal representation
13322 Elements 1, 7, and@tie{}8 are inserted by @code{gtroff}; the latter two
13323 (which are always present) specify the vertical extent of the last
13324 line, possibly modified by @code{\x}. The @code{br} request finishes
13325 the current partial line, inserting a newline input token which is
13326 subsequently converted to a space when the diversion is reread. Note
13327 that the word space node has a fixed width which isn't stretchable
13328 anymore. To convert horizontal space nodes back to input tokens, use
13329 the @code{unformat} request.
13331 Macros only contain elements in the token list (and the node list is
13332 empty); diversions and strings can contain elements in both lists.
13334 Note that the @code{chop} request simply reduces the number of elements in a
13335 macro, string, or diversion by one. Exceptions are @dfn{compatibility save}
13336 and @dfn{compatibility ignore} input tokens which are ignored. The
13337 @code{substring} request also ignores those input tokens.
13339 Some requests like @code{tr} or @code{cflags} work on glyph
13340 identifiers only; this means that the associated glyph can be changed
13341 without destroying this association. This can be very helpful for
13342 substituting glyphs. In the following example, we assume that
13343 glyph @samp{foo} isn't available by default, so we provide a
13344 substitution using the @code{fchar} request and map it to input
13345 character @samp{x}.
13353 Now let us assume that we install an additional special font
13354 @samp{bar} which has glyph @samp{foo}.
13362 Since glyphs defined with @code{fchar} are searched before glyphs
13363 in special fonts, we must call @code{rchar} to remove the definition
13364 of the fallback glyph. Anyway, the translation is still active;
13365 @samp{x} now maps to the real glyph @samp{foo}.
13367 @cindex compatibility mode, and parameters
13368 @cindex mode, compatibility, and parameters
13369 @cindex arguments, and compatibility mode
13370 @cindex parameters, and compatibility mode
13371 @cindex macro arguments, and compatibility mode
13372 @cindex request arguments, and compatibility mode
13373 Macro and request arguments preserve the compatibility mode:
13376 .cp 1 \" switch to compatibility mode
13380 .cp 0 \" switch compatibility mode off
13386 Since compatibility mode is on while @code{de} is called, the macro
13387 @code{xx} activates compatibility mode while executing. Argument
13388 @code{$1} can still be handled properly because it inherits the
13389 compatibility mode status which was active at the point where @code{xx}
13392 After expansion of the parameters, the compatibility save and restore
13393 tokens are removed.
13396 @c =====================================================================
13398 @node Debugging, Implementation Differences, Gtroff Internals, gtroff Reference
13402 @code{gtroff} is not easy to debug, but there are some useful features
13403 and strategies for debugging.
13405 @Defreq {lf, line [@Var{filename}]}
13407 @cindex multi-file documents
13408 @cindex documents, multi-file
13409 @cindex setting input line number (@code{lf})
13410 @cindex input line number, setting (@code{lf})
13411 @cindex number, input line, setting (@code{lf})
13412 Change the line number and optionally the file name @code{gtroff} shall
13413 use for error and warning messages. @var{line} is the input line number
13414 of the @emph{next} line.
13416 Without argument, the request is ignored.
13418 This is a debugging aid for documents which are split into many files,
13419 then put together with @code{soelim} and other preprocessors. Usually,
13420 it isn't invoked manually.
13422 Note that other @code{troff} implementations (including the original
13423 @acronym{AT&T} version) handle @code{lf} differently. For them,
13424 @var{line} changes the line number of the @emph{current} line.
13427 @DefreqList {tm, string}
13428 @DefreqItem {tm1, string}
13429 @DefreqListEnd {tmc, string}
13430 @cindex printing to stderr (@code{tm}, @code{tm1}, @code{tmc})
13431 @cindex stderr, printing to (@code{tm}, @code{tm1}, @code{tmc})
13432 Send @var{string} to the standard error output;
13433 this is very useful for printing debugging messages among other things.
13435 @var{string} is read in copy mode.
13437 The @code{tm} request ignores leading spaces of @var{string}; @code{tm1}
13438 handles its argument similar to the @code{ds} request: a leading double
13439 quote in @var{string} is stripped to allow initial blanks.
13441 The @code{tmc} request is similar to @code{tm1} but does
13442 not append a newline (as is done in @code{tm} and @code{tm1}).
13445 @Defreq {ab, [@Var{string}]}
13446 @cindex aborting (@code{ab})
13447 Similar to the @code{tm} request, except that
13448 it causes @code{gtroff} to stop processing. With no argument it
13449 prints @samp{User Abort.} to standard error.
13453 @cindex @code{ex} request, use in debugging
13454 @cindex exiting (@code{ex})
13455 The @code{ex} request also causes @code{gtroff} to stop processing;
13456 see also @ref{I/O}.
13459 When doing something involved it is useful to leave the debugging
13460 statements in the code and have them turned on by a command line flag.
13463 .if \n(DB .tm debugging output
13467 To activate these statements say
13473 If it is known in advance that there will be many errors and no useful
13474 output, @code{gtroff} can be forced to suppress formatted output with
13475 the @option{-z} flag.
13478 @cindex dumping symbol table (@code{pm})
13479 @cindex symbol table, dumping (@code{pm})
13480 Print the entire symbol table on @code{stderr}. Names of all defined
13481 macros, strings, and diversions are print together with their size in
13482 bytes. Since @code{gtroff} sometimes adds nodes by itself, the
13483 returned size can be larger than expected.
13485 This request differs from @acronym{UNIX} @code{troff}: @code{gtroff}
13486 reports the sizes of diversions, ignores an additional argument to
13487 print only the total of the sizes, and the size isn't returned in
13488 blocks of 128 characters.
13492 @cindex dumping number registers (@code{pnr})
13493 @cindex number registers, dumping (@code{pnr})
13494 Print the names and contents of all
13495 currently defined number registers on @code{stderr}.
13499 @cindex dumping traps (@code{ptr})
13500 @cindex traps, dumping (@code{ptr})
13501 Print the names and positions of all traps
13502 (not including input line traps and diversion traps) on @code{stderr}.
13503 Empty slots in the page trap list are printed as well, because they can
13504 affect the priority of subsequently planted traps.
13508 @cindex flush output (@code{fl})
13509 @cindex output, flush (@code{fl})
13510 @cindex interactive use of @code{gtroff}
13511 @cindex @code{gtroff}, interactive use
13512 Instruct @code{gtroff} to flush its output immediately. The intent
13513 is for interactive use, but this behaviour is currently not
13514 implemented in @code{gtroff}. Contrary to @acronym{UNIX} @code{troff},
13515 TTY output is sent to a device driver also (@code{grotty}), making it
13516 non-trivial to communicate interactively.
13518 This request causes a line break.
13521 @Defreq {backtrace, }
13522 @cindex backtrace of input stack (@code{backtrace})
13523 @cindex input stack, backtrace (@code{backtrace})
13524 Print a backtrace of the input stack to the standard error stream.
13526 Consider the following in file @file{test}:
13540 On execution, @code{gtroff} prints the following:
13543 test:2: backtrace: macro `xxx'
13544 test:5: backtrace: macro `yyy'
13545 test:8: backtrace: file `test'
13548 The option @option{-b} of @code{gtroff} internally calls a variant of
13549 this request on each error and warning.
13553 @cindex input stack, setting limit
13554 Use the @code{slimit} number register
13555 to set the maximum number of objects on the input stack.
13556 If @code{slimit} is less than or equal to@tie{}0,
13557 there is no limit set.
13558 With no limit, a buggy recursive macro can exhaust virtual memory.
13560 The default value is 1000; this is a compile-time constant.
13563 @Defreq {warnscale, si}
13564 Set the scaling indicator used in warnings to @var{si}. Valid values for
13565 @var{si} are @samp{u}, @samp{i}, @samp{c}, @samp{p}, and @samp{P}. At
13566 startup, it is set to @samp{i}.
13569 @Defreq {spreadwarn, [@Var{limit}]}
13570 Make @code{gtroff} emit a warning if the additional space inserted for
13571 each space between words in an output line is larger or equal to
13572 @var{limit}. A negative value is changed to zero; no argument toggles the
13573 warning on and off without changing @var{limit}. The default scaling
13574 indicator is @samp{m}. At startup, @code{spreadwarn} is deactivated, and
13575 @var{limit} is set to 3@dmn{m}.
13584 will cause a warning if @code{gtroff} must add 0.2@dmn{m} or more for each
13585 interword space in a line.
13587 This request is active only if text is justified to both margins (using
13592 @code{gtroff} has command line options for printing out more warnings
13593 (@option{-w}) and for printing backtraces (@option{-b}) when a warning
13594 or an error occurs. The most verbose level of warnings is @option{-ww}.
13596 @DefreqList {warn, [@Var{flags}]}
13597 @DefregListEnd {.warn}
13598 @cindex level of warnings (@code{warn})
13599 @cindex warnings, level (@code{warn})
13600 Control the level of warnings checked for. The @var{flags} are the sum
13601 of the numbers associated with each warning that is to be enabled; all
13602 other warnings are disabled. The number associated with each warning is
13603 listed below. For example, @w{@code{.warn 0}} disables all warnings,
13604 and @w{@code{.warn 1}} disables all warnings except that about missing
13605 glyphs. If no argument is given, all warnings are enabled.
13607 The read-only number register @code{.warn} contains the current warning
13615 @c ---------------------------------------------------------------------
13617 @node Warnings, , Debugging, Debugging
13618 @subsection Warnings
13621 The warnings that can be given to @code{gtroff} are divided into the
13622 following categories. The name associated with each warning is used by
13623 the @option{-w} and @option{-W} options; the number is used by the
13624 @code{warn} request and by the @code{.warn} register.
13629 Non-existent glyphs.@footnote{@code{char} is a misnomer since it reports
13630 missing glyphs -- there aren't missing input characters, only invalid
13631 ones.} This is enabled by default.
13635 Invalid numeric expressions. This is enabled by default.
13636 @xref{Expressions}.
13642 In fill mode, lines which could not be broken so that their length was
13643 less than the line length. This is enabled by default.
13647 Missing or mismatched closing delimiters.
13651 @cindex @code{ie} request, and warnings
13652 @cindex @code{el} request, and warnings
13653 Use of the @code{el} request with no matching @code{ie} request.
13658 Meaningless scaling indicators.
13662 Out of range arguments.
13666 Dubious syntax in numeric expressions.
13670 @cindex @code{di} request, and warnings
13671 @cindex @code{da} request, and warnings
13672 Use of @code{di} or @code{da} without an argument when there is no
13677 @cindex @code{de}, @code{de1}, @code{dei} requests, and warnings
13678 @cindex @code{am}, @code{am1}, @code{ami} requests, and warnings
13679 @cindex @code{ds}, @code{ds1} requests, and warnings
13680 @cindex @code{as}, @code{as1} requests, and warnings
13681 @cindex @code{di} request, and warnings
13682 @cindex @code{da} request, and warnings
13683 @cindex @code{box}, @code{boxa} requests, and warnings
13684 @cindex @code{\*}, and warnings
13685 Use of undefined strings, macros and diversions. When an undefined
13686 string, macro, or diversion is used, that string is automatically
13687 defined as empty. So, in most cases, at most one warning is given
13692 @cindex @code{nr} request, and warnings
13693 @cindex @code{\R}, and warnings
13694 @cindex @code{\n}, and warnings
13695 Use of undefined number registers. When an undefined number register is
13696 used, that register is automatically defined to have a value of@tie{}0.
13697 So, in most cases, at most one warning is given for use of a particular
13702 @cindex @code{\t}, and warnings
13703 Use of a tab character where a number was expected.
13707 @cindex @code{\@}}, and warnings
13708 Use of @code{\@}} where a number was expected.
13712 Requests that are missing non-optional arguments.
13716 Invalid input characters.
13720 Unrecognized escape sequences. When an unrecognized escape sequence
13721 @code{\@var{X}} is encountered, the escape character is ignored, and
13722 @var{X} is printed.
13726 @cindex compatibility mode
13727 Missing space between a request or macro and its argument. This warning
13728 is given when an undefined name longer than two characters is
13729 encountered, and the first two characters of the name make a defined
13730 name. The request or macro is not invoked. When this warning is
13731 given, no macro is automatically defined. This is enabled by default.
13732 This warning never occurs in compatibility mode.
13736 Non-existent fonts. This is enabled by default.
13740 Invalid escapes in text ignored with the @code{ig} request. These are
13741 conditions that are errors when they do not occur in ignored text.
13745 Color related warnings.
13748 All warnings except @samp{di}, @samp{mac} and @samp{reg}. It is
13749 intended that this covers all warnings that are useful with traditional
13757 @c =====================================================================
13759 @node Implementation Differences, , Debugging, gtroff Reference
13760 @section Implementation Differences
13761 @cindex implementation differences
13762 @cindex differences in implementation
13763 @cindex incompatibilities with @acronym{AT&T} @code{troff}
13764 @cindex compatibility mode
13765 @cindex mode, compatibility
13767 GNU @code{troff} has a number of features which cause incompatibilities
13768 with documents written with old versions of @code{troff}.
13771 @cindex names, long
13772 Long names cause some incompatibilities. @acronym{UNIX} @code{troff}
13779 @cindex @code{\*}, incompatibilities with @acronym{AT&T} @code{troff}
13780 @cindex @code{\n}, incompatibilities with @acronym{AT&T} @code{troff}
13782 as defining a string @samp{ab} with contents @samp{cd}. Normally, GNU
13783 @code{troff} interprets this as a call of a macro named
13784 @code{dsabcd}. Also @acronym{UNIX} @code{troff} interprets
13785 @code{\*[} or @code{\n[} as references to a string or number register
13786 called @samp{[}. In GNU @code{troff}, however, this is normally
13787 interpreted as the start of a long name. In compatibility mode GNU
13788 @code{troff} interprets long names in the traditional way
13789 (which means that they are not recognized as names).
13791 @DefreqList {cp, [@Var{n}]}
13792 @DefreqItem {do, cmd}
13793 @DefregListEnd {.C}
13794 If @var{n} is missing or non-zero, turn on compatibility mode;
13795 otherwise, turn it off.
13797 The read-only number register @code{.C} is@tie{}1 if compatibility mode is
13798 on, 0@tie{}otherwise.
13800 Compatibility mode can be also turned on with the @option{-C} command line
13803 The @code{do} request turns off compatibility mode
13804 while executing its arguments as a @code{gtroff} command.
13811 executes the @code{fam} request when compatibility mode
13814 @code{gtroff} restores the previous compatibility setting
13815 before interpreting any files sourced by the @var{cmd}.
13818 @cindex input level in delimited arguments
13819 @cindex delimited arguments, incompatibilities with @acronym{AT&T} @code{troff}
13820 Two other features are controlled by @option{-C}. If not in
13821 compatibility mode, GNU @code{troff} preserves the input level in
13822 delimited arguments:
13830 In compatibility mode, the string @samp{72def'} is returned; without
13831 @option{-C} the resulting string is @samp{168} (assuming a TTY output
13834 @cindex @code{\f}, incompatibilities with @acronym{AT&T} @code{troff}
13835 @cindex @code{\H}, incompatibilities with @acronym{AT&T} @code{troff}
13836 @cindex @code{\s}, incompatibilities with @acronym{AT&T} @code{troff}
13837 @cindex @code{\S}, incompatibilities with @acronym{AT&T} @code{troff}
13838 Finally, the escapes @code{\f}, @code{\H}, @code{\m}, @code{\M},
13839 @code{\R}, @code{\s}, and @code{\S} are transparent for recognizing the
13840 beginning of a line only in compatibility mode (this is a rather obscure
13841 feature). For example, the code
13851 prints @samp{Hallo!} in bold face if in compatibility mode, and
13852 @samp{.xx} in bold face otherwise.
13854 @cindex @code{\A}, incompatibilities with @acronym{AT&T} @code{troff}
13855 @cindex @code{\|}, incompatibilities with @acronym{AT&T} @code{troff}
13856 @cindex @code{\^}, incompatibilities with @acronym{AT&T} @code{troff}
13857 @cindex @code{\&}, incompatibilities with @acronym{AT&T} @code{troff}
13858 @cindex @code{\@{}, incompatibilities with @acronym{AT&T} @code{troff}
13859 @cindex @code{\@}}, incompatibilities with @acronym{AT&T} @code{troff}
13860 @cindex @code{\@key{SP}}, incompatibilities with @acronym{AT&T} @code{troff}
13861 @cindex @code{\'}, incompatibilities with @acronym{AT&T} @code{troff}
13862 @cindex @code{\`}, incompatibilities with @acronym{AT&T} @code{troff}
13863 @cindex @code{\-}, incompatibilities with @acronym{AT&T} @code{troff}
13864 @cindex @code{\_}, incompatibilities with @acronym{AT&T} @code{troff}
13865 @cindex @code{\!}, incompatibilities with @acronym{AT&T} @code{troff}
13866 @cindex @code{\%}, incompatibilities with @acronym{AT&T} @code{troff}
13867 @cindex @code{\c}, incompatibilities with @acronym{AT&T} @code{troff}
13868 GNU @code{troff} does not allow the use of the escape sequences
13869 @code{\|}, @code{\^}, @code{\&}, @code{\@{}, @code{\@}},
13870 @code{\@key{SP}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
13871 @code{\%}, and @code{\c} in names of strings, macros, diversions, number
13872 registers, fonts or environments; @acronym{UNIX} @code{troff} does. The
13873 @code{\A} escape sequence (@pxref{Identifiers}) may be helpful in
13874 avoiding use of these escape sequences in names.
13876 @cindex fractional point sizes
13877 @cindex fractional type sizes
13878 @cindex point sizes, fractional
13879 @cindex type sizes, fractional
13880 @cindex sizes, fractional
13881 @cindex @code{ps} request, incompatibilities with @acronym{AT&T} @code{troff}
13882 Fractional point sizes cause one noteworthy incompatibility. In
13883 @acronym{UNIX} @code{troff} the @code{ps} request ignores scale
13884 indicators and thus
13891 sets the point size to 10@tie{}points, whereas in GNU @code{troff} it
13892 sets the point size to 10@tie{}scaled points. @xref{Fractional Type
13893 Sizes}, for more information.
13895 @cindex @code{bd} request, incompatibilities with @acronym{AT&T} @code{troff}
13896 @cindex @code{cs} request, incompatibilities with @acronym{AT&T} @code{troff}
13897 @cindex @code{tr} request, incompatibilities with @acronym{AT&T} @code{troff}
13898 @cindex @code{fp} request, incompatibilities with @acronym{AT&T} @code{troff}
13899 @cindex input characters and output glyphs, compatibility with @acronym{AT&T} @code{troff}
13900 @cindex output glyphs, and input characters,compatibility with @acronym{AT&T} @code{troff}
13901 @cindex characters, input, and output glyphs, compatibility with @acronym{AT&T} @code{troff}
13902 @cindex glyphs, output, and input characters, compatibility with @acronym{AT&T} @code{troff}
13903 In GNU @code{troff} there is a fundamental difference between
13904 (unformatted) input characters and (formatted) output glyphs.
13905 Everything that affects how a glyph is output is stored
13906 with the glyph node; once a glyph node has been constructed it is
13907 unaffected by any subsequent requests that are executed, including
13908 @code{bd}, @code{cs}, @code{tkf}, @code{tr}, or @code{fp} requests.
13909 Normally glyphs are constructed from input characters at the
13910 moment immediately before the glyph is added to the current output
13911 line. Macros, diversions and strings are all, in fact, the same type of
13912 object; they contain lists of input characters and glyph nodes in
13913 any combination. A glyph node does not behave like an input
13914 character for the purposes of macro processing; it does not inherit any
13915 of the special properties that the input character from which it was
13916 constructed might have had. For example,
13926 @cindex printing backslash (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
13927 @cindex backslash, printing (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
13928 @cindex @code{\e}, incompatibilities with @acronym{AT&T} @code{troff}
13929 @cindex @code{\!}, incompatibilities with @acronym{AT&T} @code{troff}
13930 @cindex @code{\?}, incompatibilities with @acronym{AT&T} @code{troff}
13931 @cindex transparent output, incompatibilities with @acronym{AT&T} @code{troff}
13932 @cindex output, transparent, incompatibilities with @acronym{AT&T} @code{troff}
13934 prints @samp{\\} in GNU @code{troff}; each pair of input backslashes
13935 is turned into one output backslash and the resulting output backslashes
13936 are not interpreted as escape characters when they are reread.
13937 @acronym{UNIX} @code{troff} would interpret them as escape characters
13938 when they were reread and would end up printing one @samp{\}. The
13939 correct way to obtain a printable backslash is to use the @code{\e}
13940 escape sequence: This always prints a single instance of the current
13941 escape character, regardless of whether or not it is used in a
13942 diversion; it also works in both GNU @code{troff} and @acronym{UNIX}
13943 @code{troff}.@footnote{To be completely independent of the current
13944 escape character, use @code{\(rs} which represents a reverse solidus
13945 (backslash) glyph.} To store, for some reason, an escape sequence in a
13946 diversion that will be interpreted when the diversion is reread, either
13947 use the traditional @code{\!} transparent output facility, or, if this
13948 is unsuitable, the new @code{\?} escape sequence.
13950 @xref{Diversions}, and @ref{Gtroff Internals}, for more information.
13954 @c =====================================================================
13955 @c =====================================================================
13957 @node Preprocessors, Output Devices, gtroff Reference, Top
13958 @chapter Preprocessors
13959 @cindex preprocessors
13961 This chapter describes all preprocessors that come with @code{groff} or
13962 which are freely available.
13975 @c =====================================================================
13977 @node geqn, gtbl, Preprocessors, Preprocessors
13978 @section @code{geqn}
13979 @cindex @code{eqn}, the program
13980 @cindex @code{geqn}, the program
13988 @c ---------------------------------------------------------------------
13990 @node Invoking geqn, , geqn, geqn
13991 @subsection Invoking @code{geqn}
13992 @cindex invoking @code{geqn}
13993 @cindex @code{geqn}, invoking
13998 @c =====================================================================
14000 @node gtbl, gpic, geqn, Preprocessors
14001 @section @code{gtbl}
14002 @cindex @code{tbl}, the program
14003 @cindex @code{gtbl}, the program
14011 @c ---------------------------------------------------------------------
14013 @node Invoking gtbl, , gtbl, gtbl
14014 @subsection Invoking @code{gtbl}
14015 @cindex invoking @code{gtbl}
14016 @cindex @code{gtbl}, invoking
14021 @c =====================================================================
14023 @node gpic, ggrn, gtbl, Preprocessors
14024 @section @code{gpic}
14025 @cindex @code{pic}, the program
14026 @cindex @code{gpic}, the program
14034 @c ---------------------------------------------------------------------
14036 @node Invoking gpic, , gpic, gpic
14037 @subsection Invoking @code{gpic}
14038 @cindex invoking @code{gpic}
14039 @cindex @code{gpic}, invoking
14044 @c =====================================================================
14046 @node ggrn, grap, gpic, Preprocessors
14047 @section @code{ggrn}
14048 @cindex @code{grn}, the program
14049 @cindex @code{ggrn}, the program
14057 @c ---------------------------------------------------------------------
14059 @node Invoking ggrn, , ggrn, ggrn
14060 @subsection Invoking @code{ggrn}
14061 @cindex invoking @code{ggrn}
14062 @cindex @code{ggrn}, invoking
14067 @c =====================================================================
14069 @node grap, grefer, ggrn, Preprocessors
14070 @section @code{grap}
14071 @cindex @code{grap}, the program
14073 A free implementation of @code{grap}, written by Ted Faber,
14074 is available as an extra package from the following address:
14077 @uref{http://www.lunabase.org/~faber/Vault/software/grap/}
14081 @c =====================================================================
14083 @node grefer, gsoelim, grap, Preprocessors
14084 @section @code{grefer}
14085 @cindex @code{refer}, the program
14086 @cindex @code{grefer}, the program
14091 * Invoking grefer::
14094 @c ---------------------------------------------------------------------
14096 @node Invoking grefer, , grefer, grefer
14097 @subsection Invoking @code{grefer}
14098 @cindex invoking @code{grefer}
14099 @cindex @code{grefer}, invoking
14104 @c =====================================================================
14106 @node gsoelim, , grefer, Preprocessors
14107 @section @code{gsoelim}
14108 @cindex @code{soelim}, the program
14109 @cindex @code{gsoelim}, the program
14114 * Invoking gsoelim::
14117 @c ---------------------------------------------------------------------
14119 @node Invoking gsoelim, , gsoelim, gsoelim
14120 @subsection Invoking @code{gsoelim}
14121 @cindex invoking @code{gsoelim}
14122 @cindex @code{gsoelim}, invoking
14128 @c =====================================================================
14129 @c =====================================================================
14131 @node Output Devices, File formats, Preprocessors, Top
14132 @chapter Output Devices
14133 @cindex output devices
14134 @cindex devices for output
14139 * Special Characters::
14150 @c =====================================================================
14152 @node Special Characters, grotty, Output Devices, Output Devices
14153 @section Special Characters
14154 @cindex special characters
14155 @cindex characters, special
14162 @c =====================================================================
14164 @node grotty, grops, Special Characters, Output Devices
14165 @section @code{grotty}
14166 @cindex @code{grotty}, the program
14171 * Invoking grotty::
14174 @c ---------------------------------------------------------------------
14176 @node Invoking grotty, , grotty, grotty
14177 @subsection Invoking @code{grotty}
14178 @cindex invoking @code{grotty}
14179 @cindex @code{grotty}, invoking
14183 @c The following is no longer true; fix and extend it.
14186 @c @cindex Teletype
14187 @c @cindex ISO 6249 SGR
14188 @c @cindex terminal control sequences
14189 @c @cindex control sequences, for terminals
14190 @c For TTY output devices, underlining is done by emitting sequences of
14191 @c @samp{_} and @samp{\b} (the backspace character) before the actual
14192 @c character. Literally, this is printing an underline character, then
14193 @c moving back one character position, and printing the actual character
14194 @c at the same position as the underline character (similar to a
14195 @c typewriter). Usually, a modern terminal can't interpret this (and the
14196 @c original Teletype machines for which this sequence was appropriate are
14197 @c no longer in use). You need a pager program like @code{less} which
14198 @c translates this into ISO 6429 SGR sequences to control terminals.
14201 @c =====================================================================
14203 @node grops, grodvi, grotty, Output Devices
14204 @section @code{grops}
14205 @cindex @code{grops}, the program
14211 * Embedding PostScript::
14214 @c ---------------------------------------------------------------------
14216 @node Invoking grops, Embedding PostScript, grops, grops
14217 @subsection Invoking @code{grops}
14218 @cindex invoking @code{grops}
14219 @cindex @code{grops}, invoking
14223 @c ---------------------------------------------------------------------
14225 @node Embedding PostScript, , Invoking grops, grops
14226 @subsection Embedding @sc{PostScript}
14227 @cindex embedding PostScript
14228 @cindex PostScript, embedding
14233 @c =====================================================================
14235 @node grodvi, grolj4, grops, Output Devices
14236 @section @code{grodvi}
14237 @cindex @code{grodvi}, the program
14242 * Invoking grodvi::
14245 @c ---------------------------------------------------------------------
14247 @node Invoking grodvi, , grodvi, grodvi
14248 @subsection Invoking @code{grodvi}
14249 @cindex invoking @code{grodvi}
14250 @cindex @code{grodvi}, invoking
14255 @c =====================================================================
14257 @node grolj4, grolbp, grodvi, Output Devices
14258 @section @code{grolj4}
14259 @cindex @code{grolj4}, the program
14264 * Invoking grolj4::
14267 @c ---------------------------------------------------------------------
14269 @node Invoking grolj4, , grolj4, grolj4
14270 @subsection Invoking @code{grolj4}
14271 @cindex invoking @code{grolj4}
14272 @cindex @code{grolj4}, invoking
14277 @c =====================================================================
14279 @node grolbp, grohtml, grolj4, Output Devices
14280 @section @code{grolbp}
14281 @cindex @code{grolbp}, the program
14286 * Invoking grolbp::
14289 @c ---------------------------------------------------------------------
14291 @node Invoking grolbp, , grolbp, grolbp
14292 @subsection Invoking @code{grolbp}
14293 @cindex invoking @code{grolbp}
14294 @cindex @code{grolbp}, invoking
14299 @c =====================================================================
14301 @node grohtml, gxditview, grolbp, Output Devices
14302 @section @code{grohtml}
14303 @cindex @code{grohtml}, the program
14308 * Invoking grohtml::
14309 * grohtml specific registers and strings::
14312 @c ---------------------------------------------------------------------
14314 @node Invoking grohtml, grohtml specific registers and strings, grohtml, grohtml
14315 @subsection Invoking @code{grohtml}
14316 @cindex invoking @code{grohtml}
14317 @cindex @code{grohtml}, invoking
14321 @c ---------------------------------------------------------------------
14323 @node grohtml specific registers and strings, , Invoking grohtml, grohtml
14324 @subsection @code{grohtml} specific registers and strings
14325 @cindex registers specific to @code{grohtml}
14326 @cindex strings specific to @code{grohtml}
14327 @cindex @code{grohtml}, registers and strings
14329 @DefmpregList {ps4html, grohtml}
14330 @DefstrListEnd {www-image-template, grohtml}
14331 The registers @code{ps4html} and @code{www-image-template} are defined
14332 by the @code{pre-grohtml} preprocessor. @code{pre-grohtml} reads in
14333 the @code{troff} input, marks up the inline equations and passes the
14337 troff -Tps -rps4html=1 -dwww-image-template=@var{template}
14347 The PostScript device is used to create all the image files, and the
14348 register @code{ps4html} enables the macro sets to ignore floating
14349 keeps, footers, and headings.
14351 The register @code{www-image-template} is set to the user specified
14352 template name or the default name.
14356 @c =====================================================================
14358 @node gxditview, , grohtml, Output Devices
14359 @section @code{gxditview}
14360 @cindex @code{gxditview}, the program
14365 * Invoking gxditview::
14368 @c ---------------------------------------------------------------------
14370 @node Invoking gxditview, , gxditview, gxditview
14371 @subsection Invoking @code{gxditview}
14372 @cindex invoking @code{gxditview}
14373 @cindex @code{gxditview}, invoking
14380 @c =====================================================================
14381 @c =====================================================================
14383 @node File formats, Installation, Output Devices, Top
14384 @chapter File formats
14385 @cindex file formats
14386 @cindex formats, file
14388 All files read and written by @code{gtroff} are text files. The
14389 following two sections describe their format.
14397 @c =====================================================================
14399 @node gtroff Output, Font Files, File formats, File formats
14400 @section @code{gtroff} Output
14401 @cindex @code{gtroff}, output
14402 @cindex output, @code{gtroff}
14404 This section describes the intermediate output format of GNU
14405 @code{troff}. This output is produced by a run of @code{gtroff}
14406 before it is fed into a device postprocessor program.
14408 As @code{groff} is a wrapper program around @code{gtroff} that
14409 automatically calls a postprocessor, this output does not show up
14410 normally. This is why it is called @dfn{intermediate}.
14411 @code{groff} provides the option @option{-Z} to inhibit postprocessing,
14412 such that the produced intermediate output is sent to standard output
14413 just like calling @code{gtroff} manually.
14415 @cindex troff output
14416 @cindex output, troff
14417 @cindex intermediate output
14418 @cindex output, intermediate
14419 Here, the term @dfn{troff output} describes what is output by
14420 @code{gtroff}, while @dfn{intermediate output} refers to the language
14421 that is accepted by the parser that prepares this output for the
14422 postprocessors. This parser is smarter on whitespace and implements
14423 obsolete elements for compatibility, otherwise both formats are the
14424 same.@footnote{The parser and postprocessor for intermediate output
14425 can be found in the file@*
14426 @file{@var{groff-source-dir}/src/libs/libdriver/input.cpp}.}
14428 The main purpose of the intermediate output concept is to facilitate
14429 the development of postprocessors by providing a common programming
14430 interface for all devices. It has a language of its own that is
14431 completely different from the @code{gtroff} language. While the
14432 @code{gtroff} language is a high-level programming language for text
14433 processing, the intermediate output language is a kind of low-level
14434 assembler language by specifying all positions on the page for writing
14437 The intermediate output produced by @code{gtroff} is fairly readable,
14438 while output from @acronym{AT&T} @code{troff} is rather hard to
14439 understand because of strange habits that are still supported, but not
14440 used any longer by @code{gtroff}.
14443 * Language Concepts::
14444 * Command Reference::
14445 * Intermediate Output Examples::
14446 * Output Language Compatibility::
14449 @c ---------------------------------------------------------------------
14451 @node Language Concepts, Command Reference, gtroff Output, gtroff Output
14452 @subsection Language Concepts
14454 During the run of @code{gtroff}, the input data is cracked down to the
14455 information on what has to be printed at what position on the intended
14456 device. So the language of the intermediate output format can be quite
14457 small. Its only elements are commands with and without arguments.
14458 In this section, the term @dfn{command} always refers to the intermediate
14459 output language, and never to the @code{gtroff} language used for document
14460 formatting. There are commands for positioning and text writing, for drawing, and
14461 for device controlling.
14469 @node Separation, Argument Units, Language Concepts, Language Concepts
14470 @subsubsection Separation
14472 @acronym{AT&T} @code{troff} output has strange requirements on whitespace.
14473 The @code{gtroff} output parser, however, is smart about whitespace by
14474 making it maximally optional. The whitespace characters, i.e., the
14475 tab, space, and newline characters, always have a syntactical meaning.
14476 They are never printable because spacing within the output is always
14477 done by positioning commands.
14479 Any sequence of space or tab characters is treated as a single
14480 @dfn{syntactical space}. It separates commands and arguments, but is
14481 only required when there would occur a clashing between the command code
14482 and the arguments without the space. Most often, this happens when
14483 variable-length command names, arguments, argument lists, or command
14484 clusters meet. Commands and arguments with a known, fixed length need
14485 not be separated by syntactical space.
14487 A line break is a syntactical element, too. Every command argument can be
14488 followed by whitespace, a comment, or a newline character. Thus a
14489 @dfn{syntactical line break} is defined to consist of optional
14490 syntactical space that is optionally followed by a comment, and a
14493 The normal commands, those for positioning and text, consist of a
14494 single letter taking a fixed number of arguments. For historical reasons,
14495 the parser allows to stack such commands on the same line, but
14496 fortunately, in @code{gtroff}'s intermediate output, every command with
14497 at least one argument is followed by a line break, thus providing
14498 excellent readability.
14500 The other commands -- those for drawing and device controlling --
14501 have a more complicated structure; some recognize long command names,
14502 and some take a variable number of arguments. So all @samp{D} and
14503 @samp{x} commands were designed to request a syntactical line break
14504 after their last argument. Only one command, @w{@samp{x X}},
14505 has an argument that can stretch over several lines; all other
14506 commands must have all of their arguments on the same line as the
14507 command, i.e., the arguments may not be splitted by a line break.
14509 Empty lines (these are lines containing only space and/or a comment), can
14510 occur everywhere. They are just ignored.
14512 @node Argument Units, Document Parts, Separation, Language Concepts
14513 @subsubsection Argument Units
14515 Some commands take integer arguments that are assumed to represent
14516 values in a measurement unit, but the letter for the corresponding
14517 scale indicator is not written with the output command arguments.
14518 Most commands assume the scale indicator @samp{u}, the basic unit of
14519 the device, some use @samp{z}, the scaled point unit of the device,
14520 while others, such as the color commands, expect plain integers.
14522 Note that single characters can have the eighth bit set, as can the
14523 names of fonts and special characters. The names of characters and
14524 fonts can be of arbitrary length. A character that is to be printed
14525 will always be in the current font.
14527 A string argument is always terminated by the next whitespace
14528 character (space, tab, or newline); an embedded @samp{#} character is
14529 regarded as part of the argument, not as the beginning of a comment
14530 command. An integer argument is already terminated by the next
14531 non-digit character, which then is regarded as the first character of
14532 the next argument or command.
14534 @node Document Parts, , Argument Units, Language Concepts
14535 @subsubsection Document Parts
14537 A correct intermediate output document consists of two parts, the
14538 @dfn{prologue} and the @dfn{body}.
14540 The task of the prologue is to set the general device parameters
14541 using three exactly specified commands. @code{gtroff}'s prologue
14542 is guaranteed to consist of the following three lines (in that order):
14546 x res @var{n} @var{h} @var{v}
14551 with the arguments set as outlined in @ref{Device Control Commands}.
14552 Note that the parser for the intermediate output format is able to
14553 swallow additional whitespace and comments as well even in the
14556 The body is the main section for processing the document data.
14557 Syntactically, it is a sequence of any commands different from the
14558 ones used in the prologue. Processing is terminated as soon as the
14559 first @w{@samp{x stop}} command is encountered; the last line of any
14560 @code{gtroff} intermediate output always contains such a command.
14562 Semantically, the body is page oriented. A new page is started by a
14563 @samp{p} command. Positioning, writing, and drawing commands are
14564 always done within the current page, so they cannot occur before the
14565 first @samp{p} command. Absolute positioning (by the @samp{H} and
14566 @samp{V} commands) is done relative to the current page; all other
14567 positioning is done relative to the current location within this page.
14569 @c ---------------------------------------------------------------------
14571 @node Command Reference, Intermediate Output Examples, Language Concepts, gtroff Output
14572 @subsection Command Reference
14574 This section describes all intermediate output commands, both from
14575 @acronym{AT&T} @code{troff} as well as the @code{gtroff} extensions.
14578 * Comment Command::
14579 * Simple Commands::
14580 * Graphics Commands::
14581 * Device Control Commands::
14582 * Obsolete Command::
14585 @node Comment Command, Simple Commands, Command Reference, Command Reference
14586 @subsubsection Comment Command
14589 @item #@var{anything}@angles{end of line}
14590 A comment. Ignore any characters from the @samp{#} character up to
14591 the next newline character.
14593 This command is the only possibility for commenting in the intermediate
14594 output. Each comment can be preceded by arbitrary syntactical space;
14595 every command can be terminated by a comment.
14598 @node Simple Commands, Graphics Commands, Comment Command, Command Reference
14599 @subsubsection Simple Commands
14601 The commands in this subsection have a command code consisting of a
14602 single character, taking a fixed number of arguments. Most of them
14603 are commands for positioning and text writing. These commands are
14604 smart about whitespace. Optionally, syntactical space can be inserted
14605 before, after, and between the command letter and its arguments.
14606 All of these commands are stackable, i.e., they can be preceded by
14607 other simple commands or followed by arbitrary other commands on the
14608 same line. A separating syntactical space is only necessary when two
14609 integer arguments would clash or if the preceding argument ends with a
14614 .if (\n[@USE_ENV_STACK] == 1) \{\
14616 Open a new environment by copying the actual device configuration data
14617 to the environment stack.
14619 The current environment is setup by the device specification and
14620 manipulated by the setting commands.
14624 Close the actual environment (opened by a preceding
14626 and restore the previous environment from the environment
14627 stack as the actual device configuration data.
14629 \} \" endif @USE_ENV_STACK
14632 @item C @var{xxx}@angles{whitespace}
14633 Print a special character named @var{xxx}. The trailing
14634 syntactical space or line break is necessary to allow glyph names
14635 of arbitrary length. The glyph is printed at the current print
14636 position; the glyph's size is read from the font file. The print
14637 position is not changed.
14640 Print glyph@tie{}@var{g} at the current print position;@footnote{@samp{c}
14641 is actually a misnomer since it outputs a glyph.} the glyph's size is
14642 read from the font file. The print position is not changed.
14645 Set font to font number@tie{}@var{n} (a non-negative integer).
14648 Move right to the absolute vertical position@tie{}@var{n} (a
14649 non-negative integer in basic units @samp{u} relative to left edge
14653 Move @var{n} (a non-negative integer) basic units @samp{u} horizontally
14654 to the right. The original @acronym{UNIX} troff manual allows negative
14655 values for @var{n} also, but @code{gtroff} doesn't use this.
14657 @item m @var{color-scheme} @r{[}@var{component} @dots{}@r{]}
14658 Set the color for text (glyphs), line drawing, and the outline of
14659 graphic objects using different color schemes; the analoguous command
14660 for the filling color of graphic objects is @samp{DF}. The color
14661 components are specified as integer arguments between 0 and 65536.
14662 The number of color components and their meaning vary for the
14663 different color schemes. These commands are generated by
14664 @code{gtroff}'s escape sequence @code{\m}. No position changing.
14665 These commands are a @code{gtroff} extension.
14668 @item mc @var{cyan} @var{magenta} @var{yellow}
14669 Set color using the CMY color scheme, having the 3@tie{}color components
14670 @var{cyan}, @var{magenta}, and @var{yellow}.
14673 Set color to the default color value (black in most cases).
14674 No component arguments.
14676 @item mg @var{gray}
14677 Set color to the shade of gray given by the argument, an integer
14678 between 0 (black) and 65536 (white).
14680 @item mk @var{cyan} @var{magenta} @var{yellow} @var{black}
14681 Set color using the CMYK color scheme, having the 4@tie{}color components
14682 @var{cyan}, @var{magenta}, @var{yellow}, and @var{black}.
14684 @item mr @var{red} @var{green} @var{blue}
14685 Set color using the RGB color scheme, having the 3@tie{}color components
14686 @var{red}, @var{green}, and @var{blue}.
14690 Print glyph with index@tie{}@var{n} (a non-negative integer) of the
14691 current font. This command is a @code{gtroff} extension.
14693 @item n @var{b} @var{a}
14694 Inform the device about a line break, but no positioning is done by
14695 this command. In @acronym{AT&T} @code{troff}, the integer arguments
14696 @var{b} and@tie{}@var{a} informed about the space before and after the
14697 current line to make the intermediate output more human readable
14698 without performing any action. In @code{groff}, they are just ignored, but
14699 they must be provided for compatibility reasons.
14702 Begin a new page in the outprint. The page number is set
14703 to@tie{}@var{n}. This page is completely independent of pages formerly
14704 processed even if those have the same page number. The vertical
14705 position on the outprint is automatically set to@tie{}0. All
14706 positioning, writing, and drawing is always done relative to a page,
14707 so a @samp{p} command must be issued before any of these commands.
14710 Set point size to @var{n}@tie{}scaled points (this is unit @samp{z}).
14711 @acronym{AT&T} @code{troff} used the unit points (@samp{p}) instead.
14712 @xref{Output Language Compatibility}.
14714 @item t @var{xxx}@angles{whitespace}
14715 @itemx t @var{xxx} @var{dummy-arg}@angles{whitespace}
14716 Print a word, i.e., a sequence of characters @var{xxx} representing
14717 output glyphs which names are single characters, terminated by
14718 a space character or a line break; an optional second integer argument
14719 is ignored (this allows the formatter to generate an even number of
14720 arguments). The first glyph should be printed at the current
14721 position, the current horizontal position should then be increased by
14722 the width of the first glyph, and so on for each glyph.
14723 The widths of the glyphs are read from the font file, scaled for the
14724 current point size, and rounded to a multiple of the horizontal
14725 resolution. Special characters cannot be printed using this command
14726 (use the @samp{C} command for special characters). This command is a
14727 @code{gtroff} extension; it is only used for devices whose @file{DESC}
14728 file contains the @code{tcommand} keyword (@pxref{DESC File Format}).
14730 @item u @var{n} @var{xxx}@angles{whitespace}
14731 Print word with track kerning. This is the same as the @samp{t}
14732 command except that after printing each glyph, the current
14733 horizontal position is increased by the sum of the width of that
14734 glyph and@tie{}@var{n} (an integer in basic units @samp{u}).
14735 This command is a @code{gtroff} extension; it is only used for devices
14736 whose @file{DESC} file contains the @code{tcommand} keyword
14737 (@pxref{DESC File Format}).
14740 Move down to the absolute vertical position@tie{}@var{n} (a
14741 non-negative integer in basic units @samp{u}) relative to upper edge
14745 Move @var{n}@tie{}basic units @samp{u} down (@var{n} is a non-negative
14746 integer). The original @acronym{UNIX} troff manual allows negative
14747 values for @var{n} also, but @code{gtroff} doesn't use this.
14750 Informs about a paddable white space to increase readability.
14751 The spacing itself must be performed explicitly by a move command.
14754 @node Graphics Commands, Device Control Commands, Simple Commands, Command Reference
14755 @subsubsection Graphics Commands
14757 Each graphics or drawing command in the intermediate output starts
14758 with the letter @samp{D}, followed by one or two characters that
14759 specify a subcommand; this is followed by a fixed or variable number
14760 of integer arguments that are separated by a single space character.
14761 A @samp{D} command may not be followed by another command on the same line
14762 (apart from a comment), so each @samp{D} command is terminated by a
14763 syntactical line break.
14765 @code{gtroff} output follows the classical spacing rules (no space
14766 between command and subcommand, all arguments are preceded by a
14767 single space character), but the parser allows optional space between
14768 the command letters and makes the space before the first argument
14769 optional. As usual, each space can be any sequence of tab and space
14772 Some graphics commands can take a variable number of arguments.
14773 In this case, they are integers representing a size measured in basic
14774 units @samp{u}. The arguments called @var{h1}, @var{h2}, @dots{},
14775 @var{hn} stand for horizontal distances where positive means right,
14776 negative left. The arguments called @var{v1}, @var{v2}, @dots{},
14777 @var{vn} stand for vertical distances where positive means down,
14778 negative up. All these distances are offsets relative to the current
14781 Each graphics command directly corresponds to a similar @code{gtroff}
14782 @code{\D} escape sequence. @xref{Drawing Requests}.
14784 Unknown @samp{D} commands are assumed to be device-specific.
14785 Its arguments are parsed as strings; the whole information is then
14786 sent to the postprocessor.
14788 In the following command reference, the syntax element
14789 @angles{line break} means a syntactical line break as defined above.
14792 @item D~ @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
14793 Draw B-spline from current position to offset (@var{h1},@var{v1}),
14794 then to offset (@var{h2},@var{v2}), if given, etc.@: up to
14795 (@var{hn},@var{vn}). This command takes a variable number of argument
14796 pairs; the current position is moved to the terminal point of the drawn
14799 @item Da @var{h1} @var{v1} @var{h2} @var{v2}@angles{line break}
14800 Draw arc from current position to
14801 (@var{h1},@var{v1})@math{+}(@var{h2},@var{v2}) with center at
14802 (@var{h1},@var{v1}); then move the current position to the final point
14805 @item DC @var{d}@angles{line break}
14806 @itemx DC @var{d} @var{dummy-arg}@angles{line break}
14807 Draw a solid circle using the current fill color with
14808 diameter@tie{}@var{d} (integer in basic units @samp{u}) with leftmost
14809 point at the current position; then move the current position to the
14810 rightmost point of the circle. An optional second integer argument is
14811 ignored (this allows the formatter to generate an even number of
14812 arguments). This command is a @code{gtroff} extension.
14814 @item Dc @var{d}@angles{line break}
14815 Draw circle line with diameter@tie{}@var{d} (integer in basic units
14816 @samp{u}) with leftmost point at the current position; then move the
14817 current position to the rightmost point of the circle.
14819 @item DE @var{h} @var{v}@angles{line break}
14820 Draw a solid ellipse in the current fill color with a horizontal
14821 diameter of@tie{}@var{h} and a vertical diameter of@tie{}@var{v} (both
14822 integers in basic units @samp{u}) with the leftmost point at the
14823 current position; then move to the rightmost point of the ellipse.
14824 This command is a @code{gtroff} extension.
14826 @item De @var{h} @var{v}@angles{line break}
14827 Draw an outlined ellipse with a horizontal diameter of@tie{}@var{h}
14828 and a vertical diameter of@tie{}@var{v} (both integers in basic units
14829 @samp{u}) with the leftmost point at current position; then move to
14830 the rightmost point of the ellipse.
14832 @item DF @var{color-scheme} @r{[}@var{component} @dots{}@r{]}@angles{line break}
14833 Set fill color for solid drawing objects using different color
14834 schemes; the analoguous command for setting the color of text, line
14835 graphics, and the outline of graphic objects is @samp{m}.
14836 The color components are specified as integer arguments between 0 and
14837 65536. The number of color components and their meaning vary for the
14838 different color schemes. These commands are generated by @code{gtroff}'s
14839 escape sequences @w{@code{\D'F @dots{}'}} and @code{\M} (with no other
14840 corresponding graphics commands). No position changing. This command
14841 is a @code{gtroff} extension.
14844 @item DFc @var{cyan} @var{magenta} @var{yellow}@angles{line break}
14845 Set fill color for solid drawing objects using the CMY color scheme,
14846 having the 3@tie{}color components @var{cyan}, @var{magenta}, and
14849 @item DFd@angles{line break}
14850 Set fill color for solid drawing objects to the default fill color value
14851 (black in most cases). No component arguments.
14853 @item DFg @var{gray}@angles{line break}
14854 Set fill color for solid drawing objects to the shade of gray given by
14855 the argument, an integer between 0 (black) and 65536 (white).
14857 @item DFk @var{cyan} @var{magenta} @var{yellow} @var{black}@angles{line break}
14858 Set fill color for solid drawing objects using the CMYK color scheme,
14859 having the 4@tie{}color components @var{cyan}, @var{magenta}, @var{yellow},
14862 @item DFr @var{red} @var{green} @var{blue}@angles{line break}
14863 Set fill color for solid drawing objects using the RGB color scheme,
14864 having the 3@tie{}color components @var{red}, @var{green}, and @var{blue}.
14867 @item Df @var{n}@angles{line break}
14868 The argument@tie{}@var{n} must be an integer in the range @math{-32767}
14872 @item @math{0 @LE{} @var{n} @LE{} 1000}
14873 Set the color for filling solid drawing objects to a shade of gray,
14874 where 0 corresponds to solid white, 1000 (the default) to solid black,
14875 and values in between to intermediate shades of gray; this is
14876 obsoleted by command @samp{DFg}.
14878 @item @math{@var{n} < 0} or @math{@var{n} > 1000}
14879 Set the filling color to the color that is currently being used for
14880 the text and the outline, see command @samp{m}. For example, the
14889 sets all colors to blue.
14893 No position changing. This command is a @code{gtroff} extension.
14895 @item Dl @var{h} @var{v}@angles{line break}
14896 Draw line from current position to offset (@var{h},@var{v}) (integers
14897 in basic units @samp{u}); then set current position to the end of the
14900 @item Dp @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
14901 Draw a polygon line from current position to offset (@var{h1},@var{v1}),
14902 from there to offset (@var{h2},@var{v2}), etc.@: up to offset
14903 (@var{hn},@var{vn}), and from there back to the starting position.
14904 For historical reasons, the position is changed by adding the sum of
14905 all arguments with odd index to the actual horizontal position and the
14906 even ones to the vertical position. Although this doesn't make sense
14907 it is kept for compatibility.
14909 As the polygon is closed, the end of drawing is the starting point, so
14910 the position doesn't change.
14912 This command is a @code{gtroff} extension.
14914 @item Dp @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
14915 Draw a solid polygon in the current fill color rather than an outlined
14916 polygon, using the same arguments and positioning as the corresponding
14919 No position changing.
14921 This command is a @code{gtroff} extension.
14923 @item Dt @var{n}@angles{line break}
14924 Set the current line thickness to@tie{}@var{n} (an integer in basic
14925 units @samp{u}) if @math{@var{n}>0}; if @math{@var{n}=0} select the
14926 smallest available line thickness; if @math{@var{n}<0} set the line
14927 thickness proportional to the point size (this is the default before
14928 the first @samp{Dt} command was specified). For historical reasons,
14929 the horizontal position is changed by adding the argument to the actual
14930 horizontal position, while the vertical position is not changed.
14931 Although this doesn't make sense it is kept for compatibility.
14933 No position changing.
14935 This command is a @code{gtroff} extension.
14938 @node Device Control Commands, Obsolete Command, Graphics Commands, Command Reference
14939 @subsubsection Device Control Commands
14941 Each device control command starts with the letter @samp{x},
14942 followed by a space character (optional or arbitrary space or tab in
14943 @code{gtroff}) and a subcommand letter or word; each argument (if any)
14944 must be preceded by a syntactical space. All @samp{x} commands are
14945 terminated by a syntactical line break; no device control command can
14946 be followed by another command on the same line (except a comment).
14948 The subcommand is basically a single letter, but to increase
14949 readability, it can be written as a word, i.e., an arbitrary sequence
14950 of characters terminated by the next tab, space, or newline character.
14951 All characters of the subcommand word but the first are simply ignored.
14952 For example, @code{gtroff} outputs the initialization command
14953 @w{@samp{x i}} as @w{@samp{x init}} and the resolution command
14954 @w{@samp{x r}} as @w{@samp{x res}}.
14956 In the following, the syntax element @angles{line break} means a
14957 syntactical line break (@pxref{Separation}).
14960 @item xF @var{name}@angles{line break}
14961 The @samp{F} stands for @var{Filename}.
14963 Use @var{name} as the intended name for the current file in error
14964 reports. This is useful for remembering the original file name when
14965 @code{gtroff} uses an internal piping mechanism. The input file is
14966 not changed by this command. This command is a @code{gtroff} extension.
14968 @item xf @var{n} @var{s}@angles{line break}
14969 The @samp{f} stands for @var{font}.
14971 Mount font position@tie{}@var{n} (a non-negative integer) with font
14972 named@tie{}@var{s} (a text word). @xref{Font Positions}.
14974 @item xH @var{n}@angles{line break}
14975 The @samp{H} stands for @var{Height}.
14977 Set glyph height to@tie{}@var{n} (a positive integer in scaled
14978 points @samp{z}). @acronym{AT&T} @code{troff} uses the unit points
14979 (@samp{p}) instead. @xref{Output Language Compatibility}.
14981 @item xi@angles{line break}
14982 The @samp{i} stands for @var{init}.
14984 Initialize device. This is the third command of the prologue.
14986 @item xp@angles{line break}
14987 The @samp{p} stands for @var{pause}.
14989 Parsed but ignored. The original @acronym{UNIX} troff manual writes
14992 pause device, can be restarted
14995 @item xr @var{n} @var{h} @var{v}@angles{line break}
14996 The @samp{r} stands for @var{resolution}.
14998 Resolution is@tie{}@var{n}, while @var{h} is the minimal horizontal
14999 motion, and @var{v} the minimal vertical motion possible with this
15000 device; all arguments are positive integers in basic units @samp{u}
15001 per inch. This is the second command of the prologue.
15003 @item xS @var{n}@angles{line break}
15004 The @samp{S} stands for @var{Slant}.
15006 Set slant to@tie{}@var{n} (an integer in basic units @samp{u}).
15008 @item xs@angles{line break}
15009 The @samp{s} stands for @var{stop}.
15011 Terminates the processing of the current file; issued as the last
15012 command of any intermediate troff output.
15014 @item xt@angles{line break}
15015 The @samp{t} stands for @var{trailer}.
15017 Generate trailer information, if any. In @var{gtroff}, this is
15018 actually just ignored.
15020 @item xT @var{xxx}@angles{line break}
15021 The @samp{T} stands for @var{Typesetter}.
15023 Set name of device to word @var{xxx}, a sequence of characters ended
15024 by the next white space character. The possible device names coincide
15025 with those from the @code{groff} @option{-T} option. This is the first
15026 command of the prologue.
15028 @item xu @var{n}@angles{line break}
15029 The @samp{u} stands for @var{underline}.
15031 Configure underlining of spaces. If @var{n} is@tie{}1, start
15032 underlining of spaces; if @var{n} is@tie{}0, stop underlining of spaces.
15033 This is needed for the @code{cu} request in nroff mode and is ignored
15034 otherwise. This command is a @code{gtroff} extension.
15036 @item xX @var{anything}@angles{line break}
15037 The @samp{x} stands for @var{X-escape}.
15039 Send string @var{anything} uninterpreted to the device. If the line
15040 following this command starts with a @samp{+} character this line is
15041 interpreted as a continuation line in the following sense. The
15042 @samp{+} is ignored, but a newline character is sent instead to the
15043 device, the rest of the line is sent uninterpreted. The same applies
15044 to all following lines until the first character of a line is not a
15045 @samp{+} character. This command is generated by the @code{gtroff}
15046 escape sequence @code{\X}. The line-continuing feature is a
15047 @code{gtroff} extension.
15050 @node Obsolete Command, , Device Control Commands, Command Reference
15051 @subsubsection Obsolete Command
15052 In @acronym{AT&T} @code{troff} output, the writing of a single
15053 glyph is mostly done by a very strange command that combines a
15054 horizontal move and a single character giving the glyph name. It
15055 doesn't have a command code, but is represented by a 3-character
15056 argument consisting of exactly 2@tie{}digits and a character.
15059 @item @var{dd}@var{g}
15060 Move right @var{dd} (exactly two decimal digits) basic units @samp{u},
15061 then print glyph@tie{}@var{g} (represented as a single character).
15063 In @code{gtroff}, arbitrary syntactical space around and within this
15064 command is allowed to be added. Only when a preceding command on the
15065 same line ends with an argument of variable length a separating space
15066 is obligatory. In @acronym{AT&T} @code{troff}, large clusters of these
15067 and other commands are used, mostly without spaces; this made such output
15071 For modern high-resolution devices, this command does not make sense
15072 because the width of the glyphs can become much larger than two
15073 decimal digits. In @code{gtroff}, this is only used for the devices
15074 @code{X75}, @code{X75-12}, @code{X100}, and @code{X100-12}. For other
15075 devices, the commands @samp{t} and @samp{u} provide a better
15078 @c ---------------------------------------------------------------------
15080 @node Intermediate Output Examples, Output Language Compatibility, Command Reference, gtroff Output
15081 @subsection Intermediate Output Examples
15083 This section presents the intermediate output generated from the same
15084 input for three different devices. The input is the sentence
15085 @samp{hell world} fed into @code{gtroff} on the command line.
15088 @item High-resolution device @code{ps}
15090 This is the standard output of @code{gtroff} if no @option{-T} option
15095 shell> echo "hell world" | groff -Z -T ps
15121 This output can be fed into @code{grops} to get its representation as
15124 @item Low-resolution device @code{latin1}
15126 This is similar to the high-resolution device except that the
15127 positioning is done at a minor scale. Some comments (lines starting
15128 with @samp{#}) were added for clarification; they were not generated
15133 shell> echo "hell world" | groff -Z -T latin1
15146 # initial positioning on the page
15149 # write text `hell'
15151 # inform about space, and issue a horizontal jump
15153 # write text `world'
15155 # announce line break, but do nothing because ...
15158 # ... the end of the document has been reached
15166 This output can be fed into @code{grotty} to get a formatted text
15169 @item @acronym{AT&T} @code{troff} output
15170 Since a computer monitor has a very low resolution compared to modern
15171 printers the intermediate output for the X@tie{}Window devices can use
15172 the jump-and-write command with its 2-digit displacements.
15176 shell> echo "hell world" | groff -Z -T X100
15188 # write text with jump-and-write commands
15189 ch07e07l03lw06w11o07r05l03dh7
15199 This output can be fed into @code{xditview} or @code{gxditview}
15200 for displaying in@tie{}X.
15202 Due to the obsolete jump-and-write command, the text clusters in the
15203 @acronym{AT&T} @code{troff} output are almost unreadable.
15206 @c ---------------------------------------------------------------------
15208 @node Output Language Compatibility, , Intermediate Output Examples, gtroff Output
15209 @subsection Output Language Compatibility
15211 The intermediate output language of @acronym{AT&T} @code{troff}
15212 was first documented in the @acronym{UNIX} troff manual, with later
15213 additions documented in @cite{A Typesetter-indenpendent TROFF},
15214 written by Brian Kernighan.
15216 The @code{gtroff} intermediate output format is compatible with this
15217 specification except for the following features.
15221 The classical quasi device independence is not yet implemented.
15224 The old hardware was very different from what we use today. So the
15225 @code{groff} devices are also fundamentally different from the ones in
15226 @acronym{AT&T} @code{troff}. For example, the @acronym{AT&T}
15227 PostScript device is called @code{post} and has a resolution of only
15228 720 units per inch, suitable for printers 20 years ago, while
15229 @code{groff}'s @code{ps} device has a resolution of
15230 72000 units per inch. Maybe, by implementing some rescaling
15231 mechanism similar to the classical quasi device independence,
15232 @code{groff} could emulate @acronym{AT&T}'s @code{post} device.
15235 The B-spline command @samp{D~} is correctly handled by the
15236 intermediate output parser, but the drawing routines aren't
15237 implemented in some of the postprocessor programs.
15240 The argument of the commands @samp{s} and @w{@samp{x H}} has the
15241 implicit unit scaled point @samp{z} in @code{gtroff}, while
15242 @acronym{AT&T} @code{troff} has point (@samp{p}). This isn't an
15243 incompatibility but a compatible extension, for both units coincide
15244 for all devices without a @code{sizescale} parameter in the @file{DESC}
15245 file, including all postprocessors from @acronym{AT&T} and
15246 @code{groff}'s text devices. The few @code{groff} devices with
15247 a @code{sizescale} parameter either do not exist for @acronym{AT&T}
15248 @code{troff}, have a different name, or seem to have a different
15249 resolution. So conflicts are very unlikely.
15252 The position changing after the commands @samp{Dp}, @samp{DP}, and
15253 @samp{Dt} is illogical, but as old versions of @code{gtroff} used this
15254 feature it is kept for compatibility reasons.
15257 Temporarily, there existed some confusion on the positioning after the
15258 @samp{D} commands that are groff extensions. This has been clarified
15259 by establishing the classical rule for all @code{groff} drawing commands:
15263 The position after a graphic object has been drawn is at its end;
15264 for circles and ellipses, the `end' is at the right side.
15267 From this, the positionings specified for the drawing commands above
15268 follow quite naturally.
15275 @c =====================================================================
15277 @node Font Files, , gtroff Output, File formats
15278 @section Font Files
15280 @cindex files, font
15282 The @code{gtroff} font format is roughly a superset of the
15283 @code{ditroff} font format (as used in later versions of @acronym{AT&T}
15284 @code{troff} and its descendants). Unlike the @code{ditroff} font
15285 format, there is no associated binary format; all files are text
15286 files.@footnote{Plan@tie{}9 @code{troff} has also abandoned the binary
15287 format.} The font files for device @var{name} are stored in a directory
15288 @file{dev@var{name}}. There are two types of file: a device description
15289 file called @file{DESC} and for each font@tie{}@var{f} a font file
15290 called@tie{}@file{@var{f}}.
15293 * DESC File Format::
15294 * Font File Format::
15297 @c ---------------------------------------------------------------------
15299 @node DESC File Format, Font File Format, Font Files, Font Files
15300 @subsection @file{DESC} File Format
15301 @cindex @file{DESC} file, format
15302 @cindex font description file, format
15303 @cindex format of font description file
15304 @pindex DESC@r{ file format}
15306 The @file{DESC} file can contain the following types of line. Except
15307 for the @code{charset} keyword which must comes last (if at all), the
15308 order of the lines is not important.
15313 @cindex device resolution
15314 @cindex resolution, device
15315 There are @var{n}@tie{}machine units per inch.
15319 @cindex horizontal resolution
15320 @cindex resolution, horizontal
15321 The horizontal resolution is @var{n}@tie{}machine units. All horizontal
15322 quantities are rounded to be multiples of this value.
15326 @cindex vertical resolution
15327 @cindex resolution, vertical
15328 The vertical resolution is @var{n}@tie{}machine units. All vertical
15329 quantities are rounded to be multiples of this value.
15331 @item sizescale @var{n}
15333 The scale factor for point sizes. By default this has a value of@tie{}1.
15334 One scaled point is equal to one point/@var{n}. The arguments to the
15335 @code{unitwidth} and @code{sizes} commands are given in scaled points.
15336 @xref{Fractional Type Sizes}, for more information.
15338 @item unitwidth @var{n}
15340 Quantities in the font files are given in machine units for fonts whose
15341 point size is @var{n}@tie{}scaled points.
15343 @item prepro @var{program}
15345 Call @var{program} as a preprocessor. Currently, this keyword is used
15346 by @code{groff} with option @option{-Thtml} only.
15348 @item postpro @var{program}
15350 Call @var{program} as a postprocessor. For example, the line
15357 in the file @file{devdvi/DESC} makes @code{groff} call @code{grodvi}
15358 if option @option{-Tdvi} is given (and @option{-Z} isn't used).
15362 This means that the postprocessor can handle the @samp{t} and @samp{u}
15363 intermediate output commands.
15365 @item sizes @var{s1} @var{s2} @dots{} @var{sn} 0
15367 This means that the device has fonts at @var{s1}, @var{s2}, @dots{}
15368 @var{sn} scaled points. The list of sizes must be terminated by@tie{}0
15369 (this is digit zero). Each @var{si} can also be a range of sizes
15370 @var{m}-@var{n}. The list can extend over more than one line.
15372 @item styles @var{S1} @var{S2} @dots{} @var{Sm}
15374 The first @var{m}@tie{}font positions are associated with styles
15375 @var{S1} @dots{} @var{Sm}.
15377 @item fonts @var{n} @var{F1} @var{F2} @var{F3} @dots{} @var{Fn}
15379 Fonts @var{F1} @dots{} @var{Fn} are mounted in the font positions
15380 @var{m}+1, @dots{}, @var{m}+@var{n} where @var{m} is the number of
15381 styles. This command may extend over more than one line. A font name
15382 of@tie{}0 means no font is mounted on the corresponding font position.
15384 @item family @var{fam}
15386 The default font family is @var{fam}.
15388 @item use_charnames_in_special
15389 @kindex use_charnames_in_special
15390 This command indicates that @code{gtroff} should encode special
15391 characters inside special commands. Currently, this is only used
15392 by the @acronym{HTML} output device. @xref{Postprocessor Access}.
15394 @item papersize @var{string} @dots{}
15396 Select a paper size. Valid values for @var{string} are the ISO paper
15397 types @code{A0}-@code{A7}, @code{B0}-@code{B7}, @code{C0}-@code{C7},
15398 @code{D0}-@code{D7}, @code{DL}, and the US paper types @code{letter},
15399 @code{legal}, @code{tabloid}, @code{ledger}, @code{statement},
15400 @code{executive}, @code{com10}, and @code{monarch}. Case is not significant
15401 for @var{string} if it holds predefined paper types. Alternatively,
15402 @var{string} can be a file name (e.g.@: @file{/etc/papersize}); if the file
15403 can be opened, @code{groff} reads the first line and tests for the above
15404 paper sizes. Finally, @var{string} can be a custom paper size in the format
15405 @code{@var{length},@var{width}} (no spaces before and after the comma).
15406 Both @var{length} and @var{width} must have a unit appended; valid values
15407 are @samp{i} for inches, @samp{C} for centimeters, @samp{p} for points, and
15408 @samp{P} for picas. Example: @code{12c,235p}. An argument which starts
15409 with a digit is always treated as a custom paper format. @code{papersize}
15410 sets both the vertical and horizontal dimension of the output medium.
15412 More than one argument can be specified; @code{groff} scans from left to
15413 right and uses the first valid paper specification.
15415 @item pass_filenames
15416 @kindex pass_filenames
15417 Tell @code{gtroff} to emit the name of the source file currently
15418 being processed. This is achieved by the intermediate output command
15419 @samp{F}. Currently, this is only used by the @acronym{HTML} output
15422 @item print @var{program}
15424 Use @var{program} as a spooler program for printing. If omitted,
15425 the @option{-l} and @option{-L} options of @code{groff} are ignored.
15429 This line and everything following in the file are ignored. It is
15430 allowed for the sake of backwards compatibility.
15433 The @code{res}, @code{unitwidth}, @code{fonts}, and @code{sizes} lines
15434 are mandatory. Other commands are ignored by @code{gtroff} but may be
15435 used by postprocessors to store arbitrary information about the device
15436 in the @file{DESC} file.
15440 @kindex biggestfont
15441 Here a list of obsolete keywords which are recognized by @code{groff}
15442 but completely ignored: @code{spare1}, @code{spare2},
15443 @code{biggestfont}.
15445 @c ---------------------------------------------------------------------
15447 @node Font File Format, , DESC File Format, Font Files
15448 @subsection Font File Format
15449 @cindex font file, format
15450 @cindex font description file, format
15451 @cindex format of font files
15452 @cindex format of font description files
15454 A @dfn{font file}, also (and probably better) called a @dfn{font
15455 description file}, has two sections. The first section is a sequence
15456 of lines each containing a sequence of blank delimited words; the first
15457 word in the line is a key, and subsequent words give a value for that
15463 The name of the font is@tie{}@var{f}.
15465 @item spacewidth @var{n}
15467 The normal width of a space is@tie{}@var{n}.
15469 @item slant @var{n}
15471 The glyphs of the font have a slant of @var{n}@tie{}degrees.
15472 (Positive means forward.)
15474 @item ligatures @var{lig1} @var{lig2} @dots{} @var{lign} [0]
15476 Glyphs @var{lig1}, @var{lig2}, @dots{}, @var{lign} are ligatures;
15477 possible ligatures are @samp{ff}, @samp{fi}, @samp{fl}, @samp{ffi} and
15478 @samp{ffl}. For backwards compatibility, the list of ligatures may be
15479 terminated with a@tie{}0. The list of ligatures may not extend over more
15483 @cindex special fonts
15485 The font is @dfn{special}; this means that when a glyph is requested
15486 that is not present in the current font, it is searched for in any
15487 special fonts that are mounted.
15490 Other commands are ignored by @code{gtroff} but may be used by
15491 postprocessors to store arbitrary information about the font in the font
15494 @cindex comments in font files
15495 @cindex font files, comments
15497 The first section can contain comments which start with the @samp{#}
15498 character and extend to the end of a line.
15500 The second section contains one or two subsections. It must contain a
15501 @code{charset} subsection and it may also contain a @code{kernpairs}
15502 subsection. These subsections can appear in any order. Each
15503 subsection starts with a word on a line by itself.
15506 The word @code{charset} starts the character set
15507 subsection.@footnote{This keyword is misnamed since it starts a list
15508 of ordered glyphs, not characters.} The @code{charset} line is
15509 followed by a sequence of lines. Each line gives information for one
15510 glyph. A line comprises a number of fields separated by blanks or
15511 tabs. The format is
15514 @var{name} @var{metrics} @var{type} @var{code}
15515 [@var{entity-name}] [@code{--} @var{comment}]
15518 @cindex 8-bit input
15519 @cindex input, 8-bit
15520 @cindex accessing unnamed glyphs with @code{\N}
15521 @cindex unnamed glyphs, accessing with @code{\N}
15522 @cindex characters, unnamed, accessing with @code{\N}
15523 @cindex glyphs, unnamed, accessing with @code{\N}
15526 @var{name} identifies the glyph name@footnote{The distinction between
15527 input, characters, and output, glyphs, is not clearly separated in the
15528 terminology of @code{groff}; for example, the @code{char} request
15529 should be called @code{glyph} since it defines an output entity.}:
15530 If @var{name} is a single character@tie{}@var{c} then it corresponds
15531 to the @code{gtroff} input character@tie{}@var{c}; if it is of the form
15532 @samp{\@var{c}} where @var{c} is a single character, then it
15533 corresponds to the special character @code{\[@var{c}]}; otherwise it
15534 corresponds to the special character @samp{\[@var{name}]}. If it
15535 is exactly two characters @var{xx} it can be entered as
15536 @samp{\(@var{xx}}. Note that single-letter special characters can't
15537 be accessed as @samp{\@var{c}}; the only exception is @samp{\-} which
15538 is identical to @code{\[-]}.
15540 @code{gtroff} supports 8-bit input characters; however some utilities
15541 have difficulties with eight-bit characters. For this reason, there is
15542 a convention that the entity name @samp{char@var{n}} is equivalent to
15543 the single input character whose code is@tie{}@var{n}. For example,
15544 @samp{char163} would be equivalent to the character with code@tie{}163
15545 which is the pounds sterling sign in the ISO@tie{}@w{Latin-1} character set.
15546 You shouldn't use @samp{char@var{n}} entities in font description files
15547 since they are related to input, not output. Otherwise, you get
15548 hard-coded connections between input and output encoding which
15549 prevents use of different (input) character sets.
15551 The name @samp{---} is special and indicates that the glyph is
15552 unnamed; such glyphs can only be used by means of the @code{\N}
15553 escape sequence in @code{gtroff}.
15555 The @var{type} field gives the glyph type:
15559 the glyph has a descender, for example, @samp{p};
15562 the glyph has an ascender, for example, @samp{b};
15565 the glyph has both an ascender and a descender, for example, @samp{(}.
15568 The @var{code} field gives the code which the postprocessor uses to
15569 print the glyph. The glyph can also be input to @code{gtroff}
15570 using this code by means of the @code{\N} escape sequence. @var{code}
15571 can be any integer. If it starts with @samp{0} it is interpreted as
15572 octal; if it starts with @samp{0x} or @samp{0X} it is interpreted as
15573 hexadecimal. Note, however, that the @code{\N} escape sequence only
15574 accepts a decimal integer.
15576 The @var{entity-name} field gives an @acronym{ASCII} string
15577 identifying the glyph which the postprocessor uses to print the
15578 @code{gtroff} glyph @var{name}. This field is optional and has been
15579 introduced so that the @acronym{HTML} device driver can encode its
15580 character set. For example, the glyph @samp{\[Po]} is
15581 represented as @samp{£} in @acronym{HTML} 4.0.
15583 Anything on the line after the @var{entity-name} field resp.@: after
15584 @samp{--} will be ignored.
15586 The @var{metrics} field has the form:
15590 @var{width}[@code{,}@var{height}[@code{,}@var{depth}[@code{,}@var{italic-correction}
15591 [@code{,}@var{left-italic-correction}[@code{,}@var{subscript-correction}]]]]]
15596 There must not be any spaces between these subfields (it has been split
15597 here into two lines for better legibility only). Missing subfields are
15598 assumed to be@tie{}0. The subfields are all decimal integers. Since
15599 there is no associated binary format, these values are not required to
15600 fit into a variable of type @samp{char} as they are in @code{ditroff}.
15601 The @var{width} subfield gives the width of the glyph. The @var{height}
15602 subfield gives the height of the glyph (upwards is positive); if a
15603 glyph does not extend above the baseline, it should be given a zero
15604 height, rather than a negative height. The @var{depth} subfield gives
15605 the depth of the glyph, that is, the distance from the baseline to the
15606 lowest point below the baseline to which the glyph extends (downwards is
15607 positive); if a glyph does not extend below the baseline, it should be
15608 given a zero depth, rather than a negative depth. The
15609 @var{italic-correction} subfield gives the amount of space that should
15610 be added after the glyph when it is immediately to be followed by a
15611 glyph from a roman font. The @var{left-italic-correction} subfield
15612 gives the amount of space that should be added before the glyph when it
15613 is immediately to be preceded by a glyph from a roman font. The
15614 @var{subscript-correction} gives the amount of space that should be
15615 added after a glyph before adding a subscript. This should be less
15616 than the italic correction.
15618 A line in the @code{charset} section can also have the format
15625 This indicates that @var{name} is just another name for the glyph
15626 mentioned in the preceding line.
15629 The word @code{kernpairs} starts the kernpairs section. This contains a
15630 sequence of lines of the form:
15633 @var{c1} @var{c2} @var{n}
15637 This means that when glyph @var{c1} appears next to glyph @var{c2}
15638 the space between them should be increased by@tie{}@var{n}. Most
15639 entries in the kernpairs section have a negative value for@tie{}@var{n}.
15643 @c =====================================================================
15644 @c =====================================================================
15646 @node Installation, Copying This Manual, File formats, Top
15647 @chapter Installation
15648 @cindex installation
15654 @c =====================================================================
15655 @c =====================================================================
15657 @node Copying This Manual, Request Index, Installation, Top
15658 @appendix Copying This Manual
15661 * GNU Free Documentation License:: License for copying this manual.
15668 @c =====================================================================
15669 @c =====================================================================
15671 @node Request Index, Escape Index, Copying This Manual, Top
15672 @appendix Request Index
15674 Requests appear without the leading control character (normally either
15675 @samp{.} or @samp{'}).
15681 @c =====================================================================
15682 @c =====================================================================
15684 @node Escape Index, Operator Index, Request Index, Top
15685 @appendix Escape Index
15687 Any escape sequence @code{\@var{X}} with @var{X} not in the list below
15688 emits a warning, printing glyph @var{X}.
15694 @c =====================================================================
15695 @c =====================================================================
15697 @node Operator Index, Register Index, Escape Index, Top
15698 @appendix Operator Index
15704 @c =====================================================================
15705 @c =====================================================================
15707 @node Register Index, Macro Index, Operator Index, Top
15708 @appendix Register Index
15710 The macro package or program a specific register belongs to is appended in
15713 A register name@tie{}@code{x} consisting of exactly one character can be
15714 accessed as @samp{\nx}. A register name @code{xx} consisting of exactly
15715 two characters can be accessed as @samp{\n(xx}. Register names @code{xxx}
15716 of any length can be accessed as @samp{\n[xxx]}.
15722 @c =====================================================================
15723 @c =====================================================================
15725 @node Macro Index, String Index, Register Index, Top
15726 @appendix Macro Index
15728 The macro package a specific macro belongs to is appended in brackets.
15729 They appear without the leading control character (normally @samp{.}).
15735 @c =====================================================================
15736 @c =====================================================================
15738 @node String Index, Glyph Name Index, Macro Index, Top
15739 @appendix String Index
15741 The macro package or program a specific string belongs to is appended in
15744 A string name@tie{}@code{x} consisting of exactly one character can be
15745 accessed as @samp{\*x}. A string name @code{xx} consisting of exactly
15746 two characters can be accessed as @samp{\*(xx}. String names @code{xxx}
15747 of any length can be accessed as @samp{\*[xxx]}.
15754 @c =====================================================================
15755 @c =====================================================================
15757 @node Glyph Name Index, Font File Keyword Index, String Index, Top
15758 @appendix Glyph Name Index
15760 A glyph name @code{xx} consisting of exactly two characters can be
15761 accessed as @samp{\(xx}. Glyph names @code{xxx} of any length can be
15762 accessed as @samp{\[xxx]}.
15768 @c =====================================================================
15769 @c =====================================================================
15771 @node Font File Keyword Index, Program and File Index, Glyph Name Index, Top
15772 @appendix Font File Keyword Index
15778 @c =====================================================================
15779 @c =====================================================================
15781 @node Program and File Index, Concept Index, Font File Keyword Index, Top
15782 @appendix Program and File Index
15788 @c =====================================================================
15789 @c =====================================================================
15791 @node Concept Index, , Program and File Index, Top
15792 @appendix Concept Index