4
@c Please convert this manual with `texi2dvi -e groff.texinfo' due to
5
@c problems in texinfo regarding expansion of user-defined macros.
7
@c You need texinfo 4.8 or newer to format this document!
10
@c %**start of header (This is for running Texinfo on a region.)
11
@setfilename groff.info
12
@settitle The GNU Troff Manual
13
@setchapternewpage odd
14
@footnotestyle separate
15
@c %**end of header (This is for running Texinfo on a region.)
18
@documentencoding ISO-8859-1
27
This manual documents GNU @code{troff} version 1.22.2.
29
Copyright @copyright{} 1994-2013 Free Software Foundation, Inc.
32
Permission is granted to copy, distribute and/or modify this document
33
under the terms of the GNU Free Documentation License, Version 1.3 or
34
any later version published by the Free Software Foundation; with no
35
Invariant Sections, with the Front-Cover texts being `A GNU Manual,''
36
and with the Back-Cover Texts as in (a) below. A copy of the license is
37
included in the section entitled `GNU Free Documentation License.''
39
(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
40
modify this GNU manual. Buying copies from the FSF supports it in
41
developing GNU and promoting software freedom.''
46
@c We use the following indices:
52
@c kindex: commands in font files
53
@c pindex: programs and files
54
@c tindex: environment variables
59
@c tindex and cindex are merged.
69
@c To avoid uppercasing in @deffn while converting to info, we define
70
@c our special @Var{}.
77
@c To assure correct HTML translation, some ugly hacks are necessary.
78
@c While processing a @def... request, the HTML translator looks at the
79
@c next line to decide whether to start indentation, and if the line
80
@c starts with @def... (e.g. @deffnx), indentation is started. We must
81
@c therefore ensure that a @def... is seen, during macro expansion.
83
@c The following macros have to be used:
102
@c The definition block must end with
106
@c The above is valid for texinfo 4.0f and above.
109
@c a dummy macro to assure the `@def...'
116
@c definition of requests
118
@macro Defreq{name, arg}
119
@deffn Request @t{.\name\} \arg\
124
@macro DefreqList{name, arg}
125
@deffn Request @t{.\name\} \arg\
131
@macro DefreqItem{name, arg}
132
@deffnx Request @t{.\name\} \arg\
138
@macro DefreqListEnd{name, arg}
139
@deffnx Request @t{.\name\} \arg\
149
@c definition of escapes
151
@macro Defesc{name, delimI, arg, delimII}
152
@deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
157
@macro DefescList{name, delimI, arg, delimII}
158
@deffn Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
164
@macro DefescItem{name, delimI, arg, delimII}
165
@deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
171
@macro DefescListEnd{name, delimI, arg, delimII}
172
@deffnx Escape @t{\name\\delimI\}@Var{\arg\}@t{\delimII\}
182
@c definition of registers
185
@deffn Register @t{\\n[\name\]}
190
@macro DefregList{name}
191
@deffn Register @t{\\n[\name\]}
197
@macro DefregItem{name}
198
@deffnx Register @t{\\n[\name\]}
204
@macro DefregListEnd{name}
205
@deffnx Register @t{\\n[\name\]}
215
@c definition of registers specific to macro packages, preprocessors, etc.
217
@macro Defmpreg{name, package}
218
@deffn Register @t{\\n[\name\]}
219
@vindex \name\ @r{[}\package\@r{]}
223
@macro DefmpregList{name, package}
224
@deffn Register @t{\\n[\name\]}
226
@vindex \name\ @r{[}\package\@r{]}
230
@macro DefmpregItem{name, package}
231
@deffnx Register @t{\\n[\name\]}
233
@vindex \name\ @r{[}\package\@r{]}
237
@macro DefmpregListEnd{name, package}
238
@deffnx Register @t{\\n[\name\]}
239
@vindex \name\ @r{[}\package\@r{]}
248
@c definition of macros
250
@macro Defmac{name, arg, package}
251
@defmac @t{.\name\} \arg\
252
@maindex \name\ @r{[}\package\@r{]}
256
@macro DefmacList{name, arg, package}
257
@defmac @t{.\name\} \arg\
259
@maindex \name\ @r{[}\package\@r{]}
263
@macro DefmacItem{name, arg, package}
264
@defmacx @t{.\name\} \arg\
266
@maindex \name\ @r{[}\package\@r{]}
270
@macro DefmacListEnd{name, arg, package}
271
@defmacx @t{.\name\} \arg\
272
@maindex \name\ @r{[}\package\@r{]}
281
@c definition of strings
283
@macro Defstr{name, package}
284
@deffn String @t{\\*[\name\]}
285
@stindex \name\ @r{[}\package\@r{]}
289
@macro DefstrList{name, package}
290
@deffn String @t{\\*[\name\]}
292
@stindex \name\ @r{[}\package\@r{]}
296
@macro DefstrItem{name, package}
297
@deffnx String @t{\\*[\name\]}
299
@stindex \name\ @r{[}\package\@r{]}
303
@macro DefstrListEnd{name, package}
304
@deffnx String @t{\\*[\name\]}
305
@stindex \name\ @r{[}\package\@r{]}
314
@c our example macros
326
@macro CartoucheExample
331
@macro endCartoucheExample
340
\gdef\Langlemacro{\angleleft}
341
\gdef\Ranglemacro{\angleright}
345
@set Langlemacro @Langlemacro
346
@set Ranglemacro @Ranglemacro
355
@value{Langlemacro}@r{\text\}@value{Ranglemacro}
361
@c A value defined with @set is embedded into three group levels if
362
@c called with @value, so we need seven \aftergroup to put \le outside
363
@c of the groups -- this is necessary to get proper mathematical
367
\gdef\LEmacro{\aftergroup\aftergroup\aftergroup\aftergroup
368
\aftergroup\aftergroup\aftergroup\le}
372
@set LEmacro @LEmacro
384
@c Special care is required with parentheses, brackets, and braces:
386
@c . Real parentheses in @deffn produce an error while compiling with
388
@c . Real brackets use the wrong font in @deffn, overriding @t{}.
390
@c . @{ and @} fail with info if used in a macro.
392
@c Since macros aren't expanded in @deffn during -E, the following
393
@c definitions are for non-TeX only.
395
@c This is true for texinfo 4.0 and above.
398
@set Lparenmacro @lparen
399
@set Rparenmacro @rparen
400
@set Lbrackmacro @lbrack
401
@set Rbrackmacro @rbrack
435
@c This suppresses the word `Appendix' in the appendix headers.
438
\gdef\gobblefirst#1#2{#2}
439
\gdef\putwordAppendix{\gobblefirst}
443
@c We map some latin-1 characters to corresponding texinfo macros.
444
@c Newer versions of texinfo.tex have similar code included already.
447
\global\catcode`^^e4\active % �
449
\global\catcode`^^c4\active % �
451
\global\catcode`^^e9\active % �
453
\global\catcode`^^c9\active % �
455
\global\catcode`^^f6\active % �
457
\global\catcode`^^d6\active % �
459
\global\catcode`^^fc\active % �
461
\global\catcode`^^dc\active % �
463
\global\catcode`^^e6\active % �
465
\global\catcode`^^c6\active % �
467
\global\catcode`^^df\active % �
472
@c Note: We say `Roman numerals' but `roman font'.
475
@dircategory Typesetting
477
* Groff: (groff). The GNU troff document formatting system.
483
@subtitle The GNU implementation of @code{troff}
484
@subtitle Edition 1.22.2
485
@subtitle Spring 2013
486
@author by Trent A.@tie{}Fisher
487
@author and Werner Lemberg (@email{bug-groff@@gnu.org})
490
@vskip 0pt plus 1filll
497
@node Top, Introduction, (dir), (dir)
504
* Tutorial for Macro Users::
511
* Copying This Manual::
519
* Font File Keyword Index::
520
* Program and File Index::
530
@c =====================================================================
531
@c =====================================================================
533
@node Introduction, Invoking groff, Top, Top
534
@chapter Introduction
537
GNU @code{troff} (or @code{groff}) is a system for typesetting
538
documents. @code{troff} is very flexible and has been used extensively
539
for some thirty years. It is well entrenched in the @acronym{UNIX}
545
* groff Capabilities::
546
* Macro Package Intro::
547
* Preprocessor Intro::
548
* Output device intro::
553
@c =====================================================================
555
@node What Is groff?, History, Introduction, Introduction
556
@section What Is @code{groff}?
557
@cindex what is @code{groff}?
558
@cindex @code{groff} -- what is it?
560
@code{groff} belongs to an older generation of document preparation
561
systems, which operate more like compilers than the more recent
562
interactive @acronym{WYSIWYG}@footnote{What You See Is What You Get}
563
systems. @code{groff} and its contemporary counterpart, @TeX{}, both
564
work using a @dfn{batch} paradigm: The input (or @dfn{source}) files are
565
normal text files with embedded formatting commands. These files can
566
then be processed by @code{groff} to produce a typeset document on a
569
@code{groff} should not be confused with a @dfn{word processor}, an
570
integrated system of editor and text formatter. Also, many word
571
processors follow the @acronym{WYSIWYG} paradigm discussed earlier.
573
Although @acronym{WYSIWYG} systems may be easier to use, they have a
574
number of disadvantages compared to @code{troff}:
578
They must be used on a graphics display to work on a document.
581
Most of the @acronym{WYSIWYG} systems are either non-free or are not
585
@code{troff} is firmly entrenched in all @acronym{UNIX} systems.
588
It is difficult to have a wide range of capabilities within the confines
589
of a GUI/window system.
592
It is more difficult to make global changes to a document.
596
``GUIs normally make it simple to accomplish simple actions and
597
impossible to accomplish complex actions.'' --Doug Gwyn (22/Jun/91 in
598
@code{comp.unix.wizards})
602
@c =====================================================================
604
@node History, groff Capabilities, What Is groff?, Introduction
608
@cindex @code{RUNOFF}, the program
609
@cindex @code{rf}, the program
610
@code{troff} can trace its origins back to a formatting program called
611
@code{RUNOFF}, written by Jerry Saltzer, which ran on the @acronym{CTSS}
612
(@emph{Compatible Time Sharing System}, a project of MIT, the
613
Massachusetts Institute of Technology) in the
614
mid-sixties.@footnote{Jerome H.@: Saltzer, a grad student then, later a
615
Professor of Electrical Engineering, now retired. Saltzer's PhD thesis
616
was the first application for @code{RUNOFF} and is available from the
617
MIT Libraries.} The name came from the use of the phrase ``run off a
618
document'', meaning to print it out.
620
@c Tom Van Vleck <thvv@multicians.org> writes about the following:
622
@c I am not sure about this.. I think the BCPL runoff was the port to
623
@c the 635 architecture, and that the order of events is
625
@c 2. BCPL runoff on Multics
626
@c 3. BCPL runoff on 635
629
Bob Morris ported it to the 635 architecture and called the program
630
@code{roff} (an abbreviation of @code{runoff}). It was rewritten as
631
@code{rf} for the @w{PDP-7} (before having @acronym{UNIX}), and at the
632
same time (1969), Doug McIllroy rewrote an extended and simplified
633
version of @code{roff} in the @acronym{BCPL} programming language.
635
@cindex @code{roff}, the program
636
In 1971, the UNIX developers wanted to get a @w{PDP-11}, and to justify
637
the cost, proposed the development of a document formatting system for
638
the @acronym{AT&T} patents division. This first formatting program was
639
a reimplementation of McIllroy's @code{roff}, written by J.@tie{}F.@:
642
@cindex @code{nroff}, the program
643
When they needed a more flexible language, a new version of @code{roff}
644
called @code{nroff} (``Newer @code{roff}'') was written. It had a much
645
more complicated syntax, but provided the basis for all future versions.
646
When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a
647
version of @code{nroff} that would drive it. It was dubbed
648
@code{troff}, for ``typesetter @code{roff}'', although many people have
649
speculated that it actually means ``Times @code{roff}'' because of the
650
use of the Times font family in @code{troff} by default. As such, the
651
name @code{troff} is pronounced `@w{t-roff}' rather than `trough'.
653
With @code{troff} came @code{nroff} (they were actually the same program
654
except for some @samp{#ifdef}s), which was for producing output for line
655
printers and character terminals. It understood everything @code{troff}
656
did, and ignored the commands which were not applicable (e.g.@: font
659
Since there are several things which cannot be done easily in
660
@code{troff}, work on several preprocessors began. These programs would
661
transform certain parts of a document into @code{troff}, which made a
662
very natural use of pipes in @acronym{UNIX}.
664
The @code{eqn} preprocessor allowed mathematical formul� to be specified
665
in a much simpler and more intuitive manner. @code{tbl} is a
666
preprocessor for formatting tables. The @code{refer} preprocessor (and
667
the similar program, @code{bib}) processes citations in a document
668
according to a bibliographic database.
670
Unfortunately, Ossanna's @code{troff} was written in @w{PDP-11} assembly
671
language and produced output specifically for the CAT phototypesetter.
672
He rewrote it in C, although it was now 7000@tie{}lines of uncommented
673
code and still dependent on the CAT. As the CAT became less common, and
674
was no longer supported by the manufacturer, the need to make it support
675
other devices became a priority. However, before this could be done,
676
Ossanna died by a severe heart attack in a hospital while recovering
680
@cindex @code{ditroff}, the program
681
So, Brian Kernighan took on the task of rewriting @code{troff}. The
682
newly rewritten version produced device independent code which was very
683
easy for postprocessors to read and translate to the appropriate printer
684
codes. Also, this new version of @code{troff} (called @code{ditroff}
685
for ``device independent @code{troff}'') had several extensions, which
686
included drawing functions.
688
Due to the additional abilities of the new version of @code{troff},
689
several new preprocessors appeared. The @code{pic} preprocessor
690
provides a wide range of drawing functions. Likewise the @code{ideal}
691
preprocessor did the same, although via a much different paradigm. The
692
@code{grap} preprocessor took specifications for graphs, but, unlike
693
other preprocessors, produced @code{pic} code.
695
James Clark began work on a GNU implementation of @code{ditroff} in
696
early@tie{}1989. The first version, @code{groff}@tie{}0.3.1, was
697
released June@tie{}1990. @code{groff} included:
701
A replacement for @code{ditroff} with many extensions.
704
The @code{soelim}, @code{pic}, @code{tbl}, and @code{eqn} preprocessors.
707
Postprocessors for character devices, @sc{PostScript}, @TeX{} DVI, and
708
X@tie{}Windows. GNU @code{troff} also eliminated the need for a
709
separate @code{nroff} program with a postprocessor which would produce
710
@acronym{ASCII} output.
713
A version of the @file{me} macros and an implementation of the
717
Also, a front-end was included which could construct the, sometimes
718
painfully long, pipelines required for all the post- and preprocessors.
720
Development of GNU @code{troff} progressed rapidly, and saw the
721
additions of a replacement for @code{refer}, an implementation of the
722
@file{ms} and @file{mm} macros, and a program to deduce how to format a
723
document (@code{grog}).
725
It was declared a stable (i.e.@: non-beta) package with the release of
726
version@tie{}1.04 around November@tie{}1991.
728
Beginning in@tie{}1999, @code{groff} has new maintainers (the package
729
was an orphan for a few years). As a result, new features and programs
730
like @code{grn}, a preprocessor for gremlin images, and an output device
731
to produce @acronym{HTML} and @acronym{XHTML} have been added.
734
@c =====================================================================
736
@node groff Capabilities, Macro Package Intro, History, Introduction
737
@section @code{groff} Capabilities
738
@cindex @code{groff} capabilities
739
@cindex capabilities of @code{groff}
741
So what exactly is @code{groff} capable of doing? @code{groff} provides
742
a wide range of low-level text formatting operations. Using these, it
743
is possible to perform a wide range of formatting tasks, such as
744
footnotes, table of contents, multiple columns, etc. Here's a list of
745
the most important operations supported by @code{groff}:
749
text filling, adjusting, and centering
758
font and glyph size control
761
vertical spacing (e.g.@: double-spacing)
764
line length and indenting
767
macros, strings, diversions, and traps
773
tabs, leaders, and fields
776
input and output conventions and character translation
779
overstrike, bracket, line drawing, and zero-width functions
782
local horizontal and vertical motions and the width function
788
output line numbering
791
conditional acceptance of input
794
environment switching
797
insertions from the standard input
800
input/output file switching
803
output and error messages
807
@c =====================================================================
809
@node Macro Package Intro, Preprocessor Intro, groff Capabilities, Introduction
810
@section Macro Packages
811
@cindex macro packages
813
Since @code{groff} provides such low-level facilities, it can be quite
814
difficult to use by itself. However, @code{groff} provides a
815
@dfn{macro} facility to specify how certain routine operations
816
(e.g.@tie{}starting paragraphs, printing headers and footers, etc.)@:
817
should be done. These macros can be collected together into a
818
@dfn{macro package}. There are a number of macro packages available;
819
the most common (and the ones described in this manual) are @file{man},
820
@file{mdoc}, @file{me}, @file{ms}, and @file{mm}.
823
@c =====================================================================
825
@node Preprocessor Intro, Output device intro, Macro Package Intro, Introduction
826
@section Preprocessors
827
@cindex preprocessors
829
Although @code{groff} provides most functions needed to format a
830
document, some operations would be unwieldy (e.g.@: to draw pictures).
831
Therefore, programs called @dfn{preprocessors} were written which
832
understand their own language and produce the necessary @code{groff}
833
operations. These preprocessors are able to differentiate their own
834
input from the rest of the document via markers.
836
To use a preprocessor, @acronym{UNIX} pipes are used to feed the output
837
from the preprocessor into @code{groff}. Any number of preprocessors
838
may be used on a given document; in this case, the preprocessors are
839
linked together into one pipeline. However, with @code{groff}, the user
840
does not need to construct the pipe, but only tell @code{groff} what
841
preprocessors to use.
843
@code{groff} currently has preprocessors for producing tables
844
(@code{tbl}), typesetting equations (@code{eqn}), drawing pictures
845
(@code{pic} and @code{grn}), processing bibliographies
846
(@code{refer}), and drawing chemical structures (@code{chem}). An
847
associated program which is useful when dealing with preprocessors is
850
A free implementation of @code{grap}, a preprocessor for drawing graphs,
851
can be obtained as an extra package; @code{groff} can use @code{grap}
854
Unique to @code{groff} is the @code{preconv} preprocessor which enables
855
@code{groff} to handle documents in various input encodings.
857
There are other preprocessors in existence, but, unfortunately, no free
858
implementations are available. Among them is a preprocessor for drawing
859
mathematical pictures (@code{ideal}).
862
@c =====================================================================
864
@node Output device intro, Credits, Preprocessor Intro, Introduction
865
@section Output Devices
866
@cindex postprocessors
867
@cindex output devices
868
@cindex devices for output
870
@code{groff} actually produces device independent code which may be fed
871
into a postprocessor to produce output for a particular device.
872
Currently, @code{groff} has postprocessors for @sc{PostScript} devices,
873
character terminals, X@tie{}Windows (for previewing), @TeX{} DVI format,
874
HP LaserJet@tie{}4 and Canon LBP printers (which use @acronym{CAPSL}),
875
@acronym{HTML}, @acronym{XHTML}, and PDF.
878
@c =====================================================================
880
@node Credits, , Output device intro, Introduction
884
Large portions of this manual were taken from existing documents, most
885
notably, the manual pages for the @code{groff} package by James Clark,
886
and Eric Allman's papers on the @file{me} macro package.
888
The section on the @file{man} macro package is partly based on
889
Susan@tie{}G.@: Kleinmann's @file{groff_man} manual page written for the
890
Debian GNU/Linux system.
892
Larry Kollar contributed the section in the @file{ms} macro package.
896
@c =====================================================================
897
@c =====================================================================
899
@node Invoking groff, Tutorial for Macro Users, Introduction, Top
900
@chapter Invoking @code{groff}
901
@cindex invoking @code{groff}
902
@cindex @code{groff} invocation
904
This section focuses on how to invoke the @code{groff} front end. This
905
front end takes care of the details of constructing the pipeline among
906
the preprocessors, @code{gtroff} and the postprocessor.
908
It has become a tradition that GNU programs get the prefix @samp{g} to
909
distinguish it from its original counterparts provided by the host (see
910
@ref{Environment}, for more details). Thus, for example, @code{geqn} is
911
GNU @code{eqn}. On operating systems like GNU/Linux or the Hurd, which
912
don't contain proprietary versions of @code{troff}, and on
913
MS-DOS/MS-Windows, where @code{troff} and associated programs are not
914
available at all, this prefix is omitted since GNU @code{troff} is the
915
only used incarnation of @code{troff}. Exception: @samp{groff} is never
916
replaced by @samp{roff}.
918
In this document, we consequently say @samp{gtroff} when talking about
919
the GNU @code{troff} program. All other implementations of @code{troff}
920
are called @acronym{AT&T} @code{troff} which is the common origin of all
921
@code{troff} derivates (with more or less compatible changes).
922
Similarly, we say @samp{gpic}, @samp{geqn}, etc.
927
* Macro Directories::
930
* Invocation Examples::
934
@c =====================================================================
936
@node Groff Options, Environment, Invoking groff, Invoking groff
951
@code{groff} normally runs the @code{gtroff} program and a
952
postprocessor appropriate for the selected device. The default device
953
is @samp{ps} (but it can be changed when @code{groff} is configured and
954
built). It can optionally preprocess with any of @code{gpic},
955
@code{geqn}, @code{gtbl}, @code{ggrn}, @code{grap}, @code{gchem},
956
@code{grefer}, @code{gsoelim}, or @code{preconv}.
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 gchem},
963
@ref{Invoking gsoelim}, @ref{Invoking preconv}, @ref{Invoking grotty},
964
@ref{Invoking grops}, @ref{Invoking gropdf}, @ref{Invoking grohtml},
965
@ref{Invoking grodvi}, @ref{Invoking grolj4}, @ref{Invoking grolbp}, and
966
@ref{Invoking gxditview}.
968
The command line format for @code{groff} is:
971
groff [ -abceghijklpstvzCEGNRSUVXZ ] [ -d@var{cs} ] [ -D@var{arg} ]
972
[ -f@var{fam} ] [ -F@var{dir} ] [ -I@var{dir} ] [ -K@var{arg} ]
973
[ -L@var{arg} ] [ -m@var{name} ] [ -M@var{dir} ] [ -n@var{num} ]
974
[ -o@var{list} ] [ -P@var{arg} ] [ -r@var{cn} ] [ -T@var{def} ]
975
[ -w@var{name} ] [ -W@var{name} ] [ @var{files}@dots{} ]
978
The command line format for @code{gtroff} is as follows.
981
gtroff [ -abcivzCERU ] [ -d@var{cs} ] [ -f@var{fam} ] [ -F@var{dir} ]
982
[ -m@var{name} ] [ -M@var{dir} ] [ -n@var{num} ] [ -o@var{list} ]
983
[ -r@var{cn} ] [ -T@var{name} ] [ -w@var{name} ] [ -W@var{name} ]
984
[ @var{files}@dots{} ]
988
Obviously, many of the options to @code{groff} are actually passed on to
991
Options without an argument can be grouped behind a
992
single@tie{}@option{-}. A filename of@tie{}@file{-} denotes the
993
standard input. It is possible to have whitespace between an option and
996
The @code{grog} command can be used to guess the correct @code{groff}
997
command to format a file.
999
Here's the description of the command-line options:
1001
@cindex command-line options
1004
@cindex @acronym{ASCII} approximation output register (@code{.A})
1005
Generate an @acronym{ASCII} approximation of the typeset output. The
1006
read-only register @code{.A} is then set to@tie{}1. @xref{Built-in
1007
Registers}. A typical example is
1010
groff -a -man -Tdvi troff.man | less
1014
which shows how lines are broken for the DVI device. Note that this
1015
option is rather useless today since graphic output devices are
1016
available virtually everywhere.
1019
Print a backtrace with each warning or error message. This backtrace
1020
should help track down the cause of the error. The line numbers given
1021
in the backtrace may not always be correct: @code{gtroff} can get
1022
confused by @code{as} or @code{am} requests while counting line numbers.
1025
Suppress color output.
1028
Enable compatibility mode. @xref{Implementation Differences}, for the
1029
list of incompatibilities between @code{groff} and @acronym{AT&T}
1032
@item -d@var{c}@var{s}
1033
@itemx -d@var{name}=@var{s}
1034
Define @var{c} or @var{name} to be a string@tie{}@var{s}.
1035
@var{c}@tie{}must be a one-letter name; @var{name} can be of arbitrary
1036
length. All string assignments happen before loading any macro file
1037
(including the start-up file).
1040
Set default input encoding used by @code{preconv} to @var{arg}. Implies
1044
Preprocess with @code{geqn}.
1047
Inhibit all error messages.
1050
Use @var{fam} as the default font family. @xref{Font Families}.
1053
Search @file{@var{dir}} for subdirectories @file{dev@var{name}}
1054
(@var{name} is the name of the device), for the @file{DESC} file, and
1055
for font files before looking in the standard directories (@pxref{Font
1056
Directories}). This option is passed to all pre- and postprocessors
1057
using the @env{GROFF_FONT_PATH} environment variable.
1060
Preprocess with @code{ggrn}.
1063
Preprocess with @code{grap}. Implies @option{-p}.
1066
Print a help message.
1069
Read the standard input after all the named input files have been
1073
This option may be used to specify a directory to search for files.
1074
It is passed to the following programs:
1078
@code{gsoelim} (see @ref{gsoelim} for more details);
1079
it also implies @code{groff}'s @option{-s} option.
1082
@code{gtroff}; it is used to search files named in the @code{psbb} and
1086
@code{grops}; it is used to search files named in the
1087
@w{@code{\X'ps: import}} and @w{@code{\X'ps: file}} escapes.
1090
The current directory is always searched first. This option may be
1091
specified more than once; the directories are searched in the order
1092
specified. No directory search is performed for files specified using
1096
Preprocess with @code{gchem}. Implies @option{-p}.
1099
Preprocess with @code{preconv}. This is run before any other
1100
preprocessor. Please refer to @code{preconv}'s manual page for its
1101
behaviour if no @option{-K} (or @option{-D}) option is specified.
1104
Set input encoding used by preconv to @var{arg}. Implies @option{-k}.
1107
Send the output to a spooler for printing. The command used for this is
1108
specified by the @code{print} command in the device description file
1109
(see @ref{Font Files}, for more info). If not present, @option{-l} is
1113
Pass @var{arg} to the spooler. Each argument should be passed with a
1114
separate @option{-L} option. Note that @code{groff} does not prepend a
1115
@samp{-} to @var{arg} before passing it to the postprocessor. If the
1116
@code{print} keyword in the device description file is missing,
1117
@option{-L} is ignored.
1120
Read in the file @file{@var{name}.tmac}. Normally @code{groff} searches
1121
for this in its macro directories. If it isn't found, it tries
1122
@file{tmac.@var{name}} (searching in the same directories).
1125
Search directory @file{@var{dir}} for macro files before the standard
1126
directories (@pxref{Macro Directories}).
1129
Number the first page @var{num}.
1132
Don't allow newlines with @code{eqn} delimiters. This is the same as
1133
the @option{-N} option in @code{geqn}.
1136
@cindex print current page register (@code{.P})
1137
Output only pages in @var{list}, which is a comma-separated list of page
1138
ranges; @samp{@var{n}} means print page@tie{}@var{n},
1139
@samp{@var{m}-@var{n}} means print every page between @var{m}
1140
and@tie{}@var{n}, @samp{-@var{n}} means print every page up
1141
to@tie{}@var{n}, @samp{@var{n}-} means print every page beginning
1142
with@tie{}@var{n}. @code{gtroff} exits after printing the last page in
1143
the list. All the ranges are inclusive on both ends.
1145
Within @code{gtroff}, this information can be extracted with the
1146
@samp{.P} register. @xref{Built-in Registers}.
1148
If your document restarts page numbering at the beginning of each
1149
chapter, then @code{gtroff} prints the specified page range for each
1153
Preprocess with @code{gpic}.
1156
Pass @var{arg} to the postprocessor. Each argument should be passed
1157
with a separate @option{-P} option. Note that @code{groff} does not
1158
prepend @samp{-} to @var{arg} before passing it to the postprocessor.
1160
@item -r@var{c}@var{n}
1161
@itemx -r@var{name}=@var{n}
1162
Set number register@tie{}@var{c} or @var{name} to the
1163
value@tie{}@var{n}. @var{c}@tie{}must be a one-letter name; @var{name}
1164
can be of arbitrary length. @var{n}@tie{}can be any @code{gtroff}
1165
numeric expression. All register assignments happen before loading any
1166
macro file (including the start-up file).
1169
Preprocess with @code{grefer}. No mechanism is provided for passing
1170
arguments to @code{grefer} because most @code{grefer} options have
1171
equivalent commands which can be included in the file. @xref{grefer},
1176
Note that @code{gtroff} also accepts a @option{-R} option, which is not
1177
accessible via @code{groff}. This option prevents the loading of the
1178
@file{troffrc} and @file{troffrc-end} files.
1181
Preprocess with @code{gsoelim}.
1184
@cindex @code{open} request, and safer mode
1185
@cindex @code{opena} request, and safer mode
1186
@cindex @code{pso} request, and safer mode
1187
@cindex @code{sy} request, and safer mode
1188
@cindex @code{pi} request, and safer mode
1191
Safer mode. Pass the @option{-S} option to @code{gpic} and disable the
1192
@code{open}, @code{opena}, @code{pso}, @code{sy}, and @code{pi}
1193
requests. For security reasons, this is enabled by default.
1196
Preprocess with @code{gtbl}.
1199
Prepare output for device @var{dev}. The default device is @samp{ps},
1200
unless changed when @code{groff} was configured and built. The
1201
following are the output devices currently available:
1205
For @sc{PostScript} printers and previewers.
1208
For PDF viewers or printers.
1211
For @TeX{} DVI format.
1214
For a 75@dmn{dpi} X11 previewer.
1217
For a 75@dmn{dpi} X11 previewer with a 12@dmn{pt} base font in the
1221
For a 100@dmn{dpi} X11 previewer.
1224
For a 100@dmn{dpi} X11 previewer with a 12@dmn{pt} base font in the
1228
@cindex encoding, output, @acronym{ASCII}
1229
@cindex @acronym{ASCII}, output encoding
1230
@cindex output encoding, @acronym{ASCII}
1231
For typewriter-like devices using the (7-bit) @acronym{ASCII}
1235
@cindex encoding, output, @w{latin-1} (ISO @w{8859-1})
1236
@cindex @w{latin-1} (ISO @w{8859-1}), output encoding
1237
@cindex ISO @w{8859-1} (@w{latin-1}), output encoding
1238
@cindex output encoding, @w{latin-1} (ISO @w{8859-1})
1239
For typewriter-like devices that support the @w{Latin-1}
1240
(ISO@tie{}@w{8859-1}) character set.
1243
@cindex encoding, output, @w{utf-8}
1244
@cindex @w{utf-8}, output encoding
1245
@cindex output encoding, @w{utf-8}
1246
For typewriter-like devices which use the Unicode (ISO@tie{}10646)
1247
character set with @w{UTF-8} encoding.
1250
@cindex encoding, output, @acronym{EBCDIC}
1251
@cindex @acronym{EBCDIC}, output encoding
1252
@cindex output encoding, @acronym{EBCDIC}
1253
@cindex encoding, output, cp1047
1254
@cindex cp1047, output encoding
1255
@cindex output encoding, cp1047
1256
@cindex IBM cp1047 output encoding
1257
For typewriter-like devices which use the @acronym{EBCDIC} encoding IBM
1261
For HP LaserJet4-compatible (or other PCL5-compatible) printers.
1264
For Canon @acronym{CAPSL} printers (@w{LBP-4} and @w{LBP-8} series laser
1268
@pindex post-grohtml
1269
@cindex @code{grohtml}, the program
1272
To produce @acronym{HTML} and @acronym{XHTML} output, respectively.
1273
Note that this driver consists of two parts, a preprocessor
1274
(@code{pre-grohtml}) and a postprocessor (@code{post-grohtml}).
1277
@cindex output device name string register (@code{.T})
1278
@cindex output device usage number register (@code{.T})
1279
The predefined @code{gtroff} string register @code{.T} contains the
1280
current output device; the read-only number register @code{.T} is set
1281
to@tie{}1 if this option is used (which is always true if @code{groff}
1282
is used to call @code{gtroff}). @xref{Built-in Registers}.
1284
The postprocessor to be used for a device is specified by the
1285
@code{postpro} command in the device description file. (@xref{Font
1286
Files}, for more info.) This can be overridden with the @option{-X}
1290
@cindex mode, unsafe
1292
Unsafe mode. This enables the @code{open}, @code{opena}, @code{pso},
1293
@code{sy}, and @code{pi} requests.
1296
Enable warning @var{name}. Available warnings are described in
1297
@ref{Debugging}. Multiple @option{-w} options are allowed.
1300
Inhibit warning @var{name}. Multiple @option{-W} options are allowed.
1303
Make programs run by @code{groff} print out their version number.
1306
Print the pipeline on @code{stdout} instead of executing it. If
1307
specified more than once, print the pipeline on @code{stderr} and
1311
Preview with @code{gxditview} instead of using the usual postprocessor.
1312
This is unlikely to produce good results except with @option{-Tps}.
1314
Note that this is not the same as using @option{-TX75} or
1315
@option{-TX100} to view a document with @code{gxditview}: The former
1316
uses the metrics of the specified device, whereas the latter uses
1317
X-specific fonts and metrics.
1320
Suppress output from @code{gtroff}. Only error messages are printed.
1323
Do not postprocess the output of @code{gtroff}. Normally @code{groff}
1324
automatically runs the appropriate postprocessor.
1328
@c =====================================================================
1330
@node Environment, Macro Directories, Groff Options, Invoking groff
1331
@section Environment
1332
@cindex environment variables
1333
@cindex variables in environment
1335
There are also several environment variables (of the operating system,
1336
not within @code{gtroff}) which can modify the behavior of @code{groff}.
1339
@item GROFF_BIN_PATH
1340
@tindex GROFF_BIN_PATH@r{, environment variable}
1341
This search path, followed by @code{PATH}, is used for commands executed
1344
@item GROFF_COMMAND_PREFIX
1345
@tindex GROFF_COMMAND_PREFIX@r{, environment variable}
1346
@cindex command prefix
1347
@cindex prefix, for commands
1348
If this is set to@tie{}@var{X}, then @code{groff} runs
1349
@code{@var{X}troff} instead of @code{gtroff}. This also applies to
1350
@code{tbl}, @code{pic}, @code{eqn}, @code{grn}, @code{chem},
1351
@code{refer}, and @code{soelim}. It does not apply to @code{grops},
1352
@code{grodvi}, @code{grotty}, @code{pre-grohtml}, @code{post-grohtml},
1353
@code{preconv}, @code{grolj4}, @code{gropdf}, and @code{gxditview}.
1355
The default command prefix is determined during the installation
1356
process. If a non-GNU troff system is found, prefix @samp{g} is used,
1359
@item GROFF_ENCODING
1360
@tindex GROFF_ENCODING@r{, environment variable}
1361
The value of this environment value is passed to the @code{preconv}
1362
preprocessor to select the encoding of input files. Setting this option
1363
implies @code{groff}'s command line option @option{-k} (this is,
1364
@code{groff} actually always calls @code{preconv}). If set without a
1365
value, @code{groff} calls @code{preconv} without arguments. An explicit
1366
@option{-K} command line option overrides the value of
1367
@env{GROFF_ENCODING}. See the manual page of @code{preconv} for details.
1369
@item GROFF_FONT_PATH
1370
@tindex GROFF_FONT_PATH@r{, environment variable}
1371
A colon-separated list of directories in which to search for the
1372
@code{dev}@var{name} directory (before the default directories are
1373
tried). @xref{Font Directories}.
1375
@item GROFF_TMAC_PATH
1376
@tindex GROFF_TMAC_PATH@r{, environment variable}
1377
A colon-separated list of directories in which to search for macro files
1378
(before the default directories are tried). @xref{Macro Directories}.
1381
@tindex GROFF_TMPDIR@r{, environment variable}
1382
@tindex TMPDIR@r{, environment variable}
1383
The directory in which @code{groff} creates temporary files. If this is
1384
not set and @env{TMPDIR} is set, temporary files are created in that
1385
directory. Otherwise temporary files are created in a system-dependent
1386
default directory (on Unix and GNU/Linux systems, this is usually
1387
@file{/tmp}). @code{grops}, @code{grefer}, @code{pre-grohtml}, and
1388
@code{post-grohtml} can create temporary files in this directory.
1390
@item GROFF_TYPESETTER
1391
@tindex GROFF_TYPESETTER@r{, environment variable}
1392
The default output device.
1395
Note that MS-DOS and MS-Windows ports of @code{groff} use semi-colons,
1396
rather than colons, to separate the directories in the lists described
1400
@c =====================================================================
1402
@node Macro Directories, Font Directories, Environment, Invoking groff
1403
@section Macro Directories
1404
@cindex macro directories
1405
@cindex directories for macros
1406
@cindex searching macros
1407
@cindex macros, searching
1409
All macro file names must be named @code{@var{name}.tmac} or
1410
@code{tmac.@var{name}} to make the @option{-m@var{name}} command line
1411
option work. The @code{mso} request doesn't have this restriction; any
1412
file name can be used, and @code{gtroff} won't try to append or prepend
1413
the @samp{tmac} string.
1415
@cindex tmac, directory
1416
@cindex directory, for tmac files
1418
@cindex path, for tmac files
1419
@cindex searching macro files
1420
@cindex macro files, searching
1421
@cindex files, macro, searching
1422
Macro files are kept in the @dfn{tmac directories}, all of which
1423
constitute the @dfn{tmac path}. The elements of the search path for
1424
macro files are (in that order):
1428
The directories specified with @code{gtroff}'s or @code{groff}'s
1429
@option{-M} command line option.
1432
@tindex GROFF_TMAC_PATH@r{, environment variable}
1433
The directories given in the @env{GROFF_TMAC_PATH} environment variable.
1439
@cindex mode, unsafe
1440
@cindex current directory
1441
@cindex directory, current
1442
The current directory (only if in unsafe mode using the @option{-U}
1443
command line switch).
1446
@cindex home directory
1447
@cindex directory, home
1451
@cindex site-specific directory
1452
@cindex directory, site-specific
1453
@cindex platform-specific directory
1454
@cindex directory, platform-specific
1455
A platform-dependent directory, a site-specific (platform-independent)
1456
directory, and the main tmac directory; the default locations are
1459
/usr/local/lib/groff/site-tmac
1460
/usr/local/share/groff/site-tmac
1461
/usr/local/share/groff/1.22.2/tmac
1465
assuming that the version of @code{groff} is 1.22.2, and the
1466
installation prefix was @file{/usr/local}. It is possible to fine-tune
1467
those directories during the installation process.
1471
@c =====================================================================
1473
@node Font Directories, Paper Size, Macro Directories, Invoking groff
1474
@section Font Directories
1475
@cindex font directories
1476
@cindex directories for fonts
1477
@cindex searching fonts
1478
@cindex fonts, searching
1480
Basically, there is no restriction how font files for @code{groff} are
1481
named and how long font names are; however, to make the font family
1482
mechanism work (@pxref{Font Families}), fonts within a family should
1483
start with the family name, followed by the shape. For example, the
1484
Times family uses @samp{T} for the family name and @samp{R}, @samp{B},
1485
@samp{I}, and @samp{BI} to indicate the shapes `roman', `bold',
1486
`italic', and `bold italic', respectively. Thus the final font names
1487
are @samp{TR}, @samp{TB}, @samp{TI}, and @samp{TBI}.
1490
@cindex path, for font files
1491
All font files are kept in the @dfn{font directories} which constitute
1492
the @dfn{font path}. The file search functions always append the
1493
directory @code{dev}@var{name}, where @var{name} is the name of the
1494
output device. Assuming, say, DVI output, and @file{/foo/bar} as a font
1495
directory, the font files for @code{grodvi} must be in
1496
@file{/foo/bar/devdvi}.
1498
The elements of the search path for font files are (in that order):
1502
The directories specified with @code{gtroff}'s or @code{groff}'s
1503
@option{-F} command line option. All device drivers and some
1504
preprocessors also have this option.
1507
@tindex GROFF_FONT_PATH@r{, environment variable}
1508
The directories given in the @env{GROFF_FONT_PATH} environment variable.
1511
@cindex site-specific directory
1512
@cindex directory, site-specific
1513
A site-specific directory and the main font directory; the default
1517
/usr/local/share/groff/site-font
1518
/usr/local/share/groff/1.22.2/font
1522
assuming that the version of @code{groff} is 1.22.2, and the
1523
installation prefix was @file{/usr/local}. It is possible to fine-tune
1524
those directories during the installation process.
1528
@c =====================================================================
1530
@node Paper Size, Invocation Examples, Font Directories, Invoking groff
1534
@cindex landscape page orientation
1535
@cindex orientation, landscape
1536
@cindex page orientation, landscape
1538
In groff, the page size for @code{gtroff} and for output devices are
1539
handled separately. @xref{Page Layout}, for vertical manipulation of
1540
the page size. @xref{Line Layout}, for horizontal changes.
1542
A default paper size can be set in the device's @file{DESC} file. Most
1543
output devices also have a command line option @option{-p} to override
1544
the default paper size and option @option{-l} to use landscape
1545
orientation. @xref{DESC File Format}, for a description of the
1546
@code{papersize} keyword which takes the same argument as @option{-p}.
1548
@pindex papersize.tmac
1550
A convenient shorthand to set a particular paper size for @code{gtroff}
1551
is command line option @option{-dpaper=@var{size}}. This defines string
1552
@code{paper} which is processed in file @file{papersize.tmac} (loaded in
1553
the start-up file @file{troffrc} by default). Possible values for
1554
@var{size} are the same as the predefined values for the
1555
@code{papersize} keyword (but only in lowercase) except
1556
@code{a7}-@code{d7}. An appended @samp{l} (ell) character denotes
1557
landscape orientation.
1559
For example, use the following for PS output on A4 paper in landscape
1563
groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
1566
Note that it is up to the particular macro package to respect default
1567
page dimensions set in this way (most do).
1570
@c =====================================================================
1572
@node Invocation Examples, , Paper Size, Invoking groff
1573
@section Invocation Examples
1574
@cindex invocation examples
1575
@cindex examples of invocation
1577
This section lists several common uses of @code{groff} and the
1578
corresponding command lines.
1585
This command processes @file{file} without a macro package or a
1586
preprocessor. The output device is the default, @samp{ps}, and the
1587
output is sent to @code{stdout}.
1590
groff -t -mandoc -Tascii file | less
1594
This is basically what a call to the @code{man} program does.
1595
@code{gtroff} processes the manual page @file{file} with the
1596
@file{mandoc} macro file (which in turn either calls the @file{man} or
1597
the @file{mdoc} macro package), using the @code{tbl} preprocessor and
1598
the @acronym{ASCII} output device. Finally, the @code{less} pager
1599
displays the result.
1606
Preview @file{file} with @code{gxditview}, using the @file{me} macro
1607
package. Since no @option{-T} option is specified, use the default
1608
device (@samp{ps}). Note that you can either say @w{@samp{-m me}} or
1609
@w{@samp{-me}}; the latter is an anachronism from the early days of
1610
@acronym{UNIX}.@footnote{The same is true for the other main macro
1611
packages that come with @code{groff}: @file{man}, @file{mdoc},
1612
@file{ms}, @file{mm}, and @file{mandoc}. This won't work in general;
1613
for example, to load @file{trace.tmac}, either @samp{-mtrace} or
1614
@w{@samp{-m trace}} must be used.}
1617
groff -man -rD1 -z file
1621
Check @file{file} with the @file{man} macro package, forcing
1622
double-sided printing -- don't produce any output.
1628
@c ---------------------------------------------------------------------
1630
@node grog, , Invocation Examples, Invocation Examples
1631
@subsection @code{grog}
1634
@code{grog} reads files, guesses which of the @code{groff} preprocessors
1635
and/or macro packages are required for formatting them, and prints the
1636
@code{groff} command including those options on the standard output. It
1637
generates one or more of the options @option{-e}, @option{-man},
1638
@option{-me}, @option{-mm}, @option{-mom}, @option{-ms}, @option{-mdoc},
1639
@option{-mdoc-old}, @option{-p}, @option{-R}, @option{-g}, @option{-G},
1640
@option{-s}, and @option{-t}.
1642
A special file name@tie{}@file{-} refers to the standard input.
1643
Specifying no files also means to read the standard input. Any
1644
specified options are included in the printed command. No space is
1645
allowed between options and their arguments. The only options
1646
recognized are @option{-C} (which is also passed on) to enable
1647
compatibility mode, and @option{-v} to print the version number and
1657
guesses the appropriate command to print @file{paper.ms} and then prints
1658
it to the command line after adding the @option{-Tdvi} option. For
1659
direct execution, enclose the call to @code{grog} in backquotes at the
1660
@acronym{UNIX} shell prompt:
1663
`grog -Tdvi paper.ms` > paper.dvi
1667
As seen in the example, it is still necessary to redirect the output to
1668
something meaningful (i.e.@: either a file or a pager program like
1673
@c =====================================================================
1674
@c =====================================================================
1676
@node Tutorial for Macro Users, Macro Packages, Invoking groff, Top
1677
@chapter Tutorial for Macro Users
1678
@cindex tutorial for macro users
1679
@cindex macros, tutorial for users
1680
@cindex user's tutorial for macros
1681
@cindex user's macro tutorial
1683
Most users tend to use a macro package to format their papers. This
1684
means that the whole breadth of @code{groff} is not necessary for most
1685
people. This chapter covers the material needed to efficiently use a
1694
@c =====================================================================
1696
@node Basics, Common Features, Tutorial for Macro Users, Tutorial for Macro Users
1698
@cindex basics of macros
1699
@cindex macro basics
1701
This section covers some of the basic concepts necessary to understand
1702
how to use a macro package.@footnote{This section is derived from
1703
@cite{Writing Papers with nroff using -me} by Eric P.@tie{}Allman.}
1704
References are made throughout to more detailed information, if desired.
1706
@code{gtroff} reads an input file prepared by the user and outputs a
1707
formatted document suitable for publication or framing. The input
1708
consists of text, or words to be printed, and embedded commands
1709
(@dfn{requests} and @dfn{escapes}), which tell @code{gtroff} how to
1710
format the output. For more detail on this, see @ref{Embedded
1713
The word @dfn{argument} is used in this chapter to mean a word or number
1714
which appears on the same line as a request, and which modifies the
1715
meaning of that request. For example, the request
1722
spaces one line, but
1729
spaces four lines. The number@tie{}4 is an argument to the @code{sp}
1730
request which says to space four lines instead of one. Arguments are
1731
separated from the request and from each other by spaces (@emph{no}
1732
tabs). More details on this can be found in @ref{Request and Macro
1735
The primary function of @code{gtroff} is to collect words from input
1736
lines, fill output lines with those words, justify the right-hand margin
1737
by inserting extra spaces in the line, and output the result. For
1745
Four score and seven
1750
is read, packed onto output lines, and justified to produce:
1753
Now is the time for all good men to come to the aid of their party.
1754
Four score and seven years ago, etc.
1759
Sometimes a new output line should be started even though the current
1760
line is not yet full; for example, at the end of a paragraph. To do
1761
this it is possible to cause a @dfn{break}, which starts a new output
1762
line. Some requests cause a break automatically, as normally do blank
1763
input lines and input lines beginning with a space.
1765
Not all input lines are text to be formatted. Some input lines are
1766
requests which describe how to format the text. Requests always have a
1767
period (@samp{.}) or an apostrophe (@samp{'}) as the first character of
1770
The text formatter also does more complex things, such as automatically
1771
numbering pages, skipping over page boundaries, putting footnotes in the
1772
correct place, and so forth.
1774
Here are a few hints for preparing text for input to @code{gtroff}.
1778
First, keep the input lines short. Short input lines are easier to
1779
edit, and @code{gtroff} packs words onto longer lines anyhow.
1782
In keeping with this, it is helpful to begin a new line after every
1783
comma or phrase, since common corrections are to add or delete sentences
1787
End each sentence with two spaces -- or better, start each sentence on a
1788
new line. @code{gtroff} recognizes characters that usually end a
1789
sentence, and inserts sentence space accordingly.
1792
Do not hyphenate words at the end of lines -- @code{gtroff} is smart
1793
enough to hyphenate words as needed, but is not smart enough to take
1794
hyphens out and join a word back together. Also, words such as
1795
``mother-in-law'' should not be broken over a line, since then a space
1796
can occur where not wanted, such as ``@w{mother- in}-law''.
1799
@cindex double-spacing (@code{ls})
1801
@code{gtroff} double-spaces output text automatically if you use the
1802
request @w{@samp{.ls 2}}. Reactivate single-spaced mode by typing
1803
@w{@samp{.ls 1}}.@footnote{If you need finer granularity of the vertical
1804
space, use the @code{pvs} request (@pxref{Changing Type Sizes}).}
1806
A number of requests allow to change the way the output looks, sometimes
1807
called the @dfn{layout} of the output page. Most of these requests
1808
adjust the placing of @dfn{whitespace} (blank lines or spaces).
1810
@cindex new page (@code{bp})
1811
The @code{bp} request starts a new page, causing a line break.
1813
@cindex blank line (@code{sp})
1814
@cindex empty line (@code{sp})
1815
@cindex line, empty (@code{sp})
1816
The request @w{@samp{.sp @var{N}}} leaves @var{N}@tie{}lines of blank
1817
space. @var{N}@tie{}can be omitted (meaning skip a single line) or can
1818
be of the form @var{N}i (for @var{N}@tie{}inches) or @var{N}c (for
1819
@var{N}@tie{}centimeters). For example, the input:
1823
My thoughts on the subject
1828
leaves one and a half inches of space, followed by the line ``My
1829
thoughts on the subject'', followed by a single blank line (more
1830
measurement units are available, see @ref{Measurements}).
1832
@cindex centering lines (@code{ce})
1833
@cindex lines, centering (@code{ce})
1834
Text lines can be centered by using the @code{ce} request. The line
1835
after @code{ce} is centered (horizontally) on the page. To center more
1836
than one line, use @w{@samp{.ce @var{N}}} (where @var{N} is the number
1837
of lines to center), followed by the @var{N}@tie{}lines. To center many
1838
lines without counting them, type:
1847
The @w{@samp{.ce 0}} request tells @code{groff} to center zero more
1848
lines, in other words, stop centering.
1850
@cindex line break (@code{br})
1851
@cindex break (@code{br})
1852
All of these requests cause a break; that is, they always start a new
1853
line. To start a new line without performing any other action, use
1857
@c =====================================================================
1859
@node Common Features, , Basics, Tutorial for Macro Users
1860
@section Common Features
1861
@cindex common features
1862
@cindex features, common
1864
@code{gtroff} provides very low-level operations for formatting a
1865
document. There are many common routine operations which are done in
1866
all documents. These common operations are written into @dfn{macros}
1867
and collected into a @dfn{macro package}.
1869
All macro packages provide certain common capabilities which fall into
1870
the following categories.
1874
* Sections and Chapters::
1875
* Headers and Footers::
1876
* Page Layout Adjustment::
1878
* Footnotes and Annotations::
1879
* Table of Contents::
1882
* Multiple Columns::
1883
* Font and Size Changes::
1884
* Predefined Strings::
1885
* Preprocessor Support::
1886
* Configuration and Customization::
1889
@c ---------------------------------------------------------------------
1891
@node Paragraphs, Sections and Chapters, Common Features, Common Features
1892
@subsection Paragraphs
1895
One of the most common and most used capability is starting a paragraph.
1896
There are a number of different types of paragraphs, any of which can be
1897
initiated with macros supplied by the macro package. Normally,
1898
paragraphs start with a blank line and the first line indented, like the
1899
text in this manual. There are also block style paragraphs, which omit
1903
Some men look at constitutions with sanctimonious
1904
reverence, and deem them like the ark of the covenant, too
1905
sacred to be touched.
1909
And there are also indented paragraphs which begin with a tag or label
1910
at the margin and the remaining text indented.
1913
one This is the first paragraph. Notice how the first
1914
line of the resulting paragraph lines up with the
1915
other lines in the paragraph.
1919
This paragraph had a long label. The first
1920
character of text on the first line does not line up
1921
with the text on second and subsequent lines,
1922
although they line up with each other.
1925
A variation of this is a bulleted list.
1928
. Bulleted lists start with a bullet. It is possible
1929
to use other glyphs instead of the bullet. In nroff
1930
mode using the ASCII character set for output, a dot
1931
is used instead of a real bullet.
1934
@c ---------------------------------------------------------------------
1936
@node Sections and Chapters, Headers and Footers, Paragraphs, Common Features
1937
@subsection Sections and Chapters
1939
Most macro packages supply some form of section headers. The simplest
1940
kind is simply the heading on a line by itself in bold type. Others
1941
supply automatically numbered section heading or different heading
1942
styles at different levels. Some, more sophisticated, macro packages
1943
supply macros for starting chapters and appendices.
1945
@c ---------------------------------------------------------------------
1947
@node Headers and Footers, Page Layout Adjustment, Sections and Chapters, Common Features
1948
@subsection Headers and Footers
1950
Every macro package gives some way to manipulate the @dfn{headers} and
1951
@dfn{footers} (also called @dfn{titles}) on each page. This is text put
1952
at the top and bottom of each page, respectively, which contain data
1953
like the current page number, the current chapter title, and so on. Its
1954
appearance is not affected by the running text. Some packages allow for
1955
different ones on the even and odd pages (for material printed in a book
1958
The titles are called @dfn{three-part titles}, that is, there is a
1959
left-justified part, a centered part, and a right-justified part. An
1960
automatically generated page number may be put in any of these fields
1961
with the @samp{%} character (see @ref{Page Layout}, for more details).
1963
@c ---------------------------------------------------------------------
1965
@node Page Layout Adjustment, Displays, Headers and Footers, Common Features
1966
@subsection Page Layout
1968
Most macro packages let the user specify top and bottom margins and
1969
other details about the appearance of the printed pages.
1971
@c ---------------------------------------------------------------------
1973
@node Displays, Footnotes and Annotations, Page Layout Adjustment, Common Features
1974
@subsection Displays
1977
@dfn{Displays} are sections of text to be set off from the body of the
1978
paper. Major quotes, tables, and figures are types of displays, as are
1979
all the examples used in this document.
1981
@cindex quotes, major
1982
@cindex major quotes
1983
@dfn{Major quotes} are quotes which are several lines long, and hence
1984
are set in from the rest of the text without quote marks around them.
1987
A @dfn{list} is an indented, single-spaced, unfilled display. Lists
1988
should be used when the material to be printed should not be filled and
1989
justified like normal text, such as columns of figures or the examples
1993
A @dfn{keep} is a display of lines which are kept on a single page if
1994
possible. An example for a keep might be a diagram. Keeps differ from
1995
lists in that lists may be broken over a page boundary whereas keeps are
1998
@cindex keep, floating
1999
@cindex floating keep
2000
@dfn{Floating keeps} move relative to the text. Hence, they are good
2001
for things which are referred to by name, such as ``See figure@tie{}3''.
2002
A floating keep appears at the bottom of the current page if it fits;
2003
otherwise, it appears at the top of the next page. Meanwhile, the
2004
surrounding text `flows' around the keep, thus leaving no blank areas.
2006
@c ---------------------------------------------------------------------
2008
@node Footnotes and Annotations, Table of Contents, Displays, Common Features
2009
@subsection Footnotes and Annotations
2013
There are a number of requests to save text for later printing.
2015
@dfn{Footnotes} are printed at the bottom of the current page.
2017
@cindex delayed text
2018
@dfn{Delayed text} is very similar to a footnote except that it is
2019
printed when called for explicitly. This allows a list of references to
2020
appear (for example) at the end of each chapter, as is the convention in
2023
Most macro packages which supply this functionality also supply a means
2024
of automatically numbering either type of annotation.
2026
@c ---------------------------------------------------------------------
2028
@node Table of Contents, Indices, Footnotes and Annotations, Common Features
2029
@subsection Table of Contents
2030
@cindex table of contents
2031
@cindex contents, table of
2033
@dfn{Tables of contents} are a type of delayed text having a tag
2034
(usually the page number) attached to each entry after a row of dots.
2035
The table accumulates throughout the paper until printed, usually after
2036
the paper has ended. Many macro packages provide the ability to have
2037
several tables of contents (e.g.@: a standard table of contents, a list
2040
@c ---------------------------------------------------------------------
2042
@node Indices, Paper Formats, Table of Contents, Common Features
2044
@cindex index, in macro package
2046
While some macro packages use the term @dfn{index}, none actually
2047
provide that functionality. The facilities they call indices are
2048
actually more appropriate for tables of contents.
2051
To produce a real index in a document, external tools like the
2052
@code{makeindex} program are necessary.
2054
@c ---------------------------------------------------------------------
2056
@node Paper Formats, Multiple Columns, Indices, Common Features
2057
@subsection Paper Formats
2058
@cindex paper formats
2060
Some macro packages provide stock formats for various kinds of
2061
documents. Many of them provide a common format for the title and
2062
opening pages of a technical paper. The @file{mm} macros in particular
2063
provide formats for letters and memoranda.
2065
@c ---------------------------------------------------------------------
2067
@node Multiple Columns, Font and Size Changes, Paper Formats, Common Features
2068
@subsection Multiple Columns
2070
Some macro packages (but not @file{man}) provide the ability to have two
2071
or more columns on a page.
2073
@c ---------------------------------------------------------------------
2075
@node Font and Size Changes, Predefined Strings, Multiple Columns, Common Features
2076
@subsection Font and Size Changes
2078
The built-in font and size functions are not always intuitive, so all
2079
macro packages provide macros to make these operations simpler.
2081
@c ---------------------------------------------------------------------
2083
@node Predefined Strings, Preprocessor Support, Font and Size Changes, Common Features
2084
@subsection Predefined Strings
2086
Most macro packages provide various predefined strings for a variety of
2087
uses; examples are sub- and superscripts, printable dates, quotes and
2088
various special characters.
2090
@c ---------------------------------------------------------------------
2092
@node Preprocessor Support, Configuration and Customization, Predefined Strings, Common Features
2093
@subsection Preprocessor Support
2095
All macro packages provide support for various preprocessors and may
2096
extend their functionality.
2098
For example, all macro packages mark tables (which are processed with
2099
@code{gtbl}) by placing them between @code{TS} and @code{TE} macros.
2100
The @file{ms} macro package has an option, @samp{.TS@tie{}H}, that
2101
prints a caption at the top of a new page (when the table is too long to
2102
fit on a single page).
2104
@c ---------------------------------------------------------------------
2106
@node Configuration and Customization, , Preprocessor Support, Common Features
2107
@subsection Configuration and Customization
2109
Some macro packages provide means of customizing many of the details of
2110
how the package behaves. This ranges from setting the default type size
2111
to changing the appearance of section headers.
2115
@c =====================================================================
2116
@c =====================================================================
2118
@node Macro Packages, gtroff Reference, Tutorial for Macro Users, Top
2119
@chapter Macro Packages
2120
@cindex macro packages
2121
@cindex packages, macros
2123
This chapter documents the main macro packages that come with
2126
Different main macro packages can't be used at the same time; for
2130
groff -m man foo.man -m ms bar.doc
2134
doesn't work. Note that option arguments are processed before
2135
non-option arguments; the above (failing) sample is thus reordered to
2138
groff -m man -m ms foo.man bar.doc
2151
@c =====================================================================
2153
@node man, mdoc, Macro Packages, Macro Packages
2155
@cindex manual pages
2159
@pindex man-old.tmac
2161
This is the most popular and probably the most important macro package
2162
of @code{groff}. It is easy to use, and a vast majority of manual pages
2169
* Miscellaneous man macros::
2170
* Predefined man strings::
2171
* Preprocessors in man pages::
2172
* Optional man extensions::
2175
@c ---------------------------------------------------------------------
2177
@node Man options, Man usage, man, man
2180
The command line format for using the @file{man} macros with
2184
groff -m man [ -rLL=@var{length} ] [ -rLT=@var{length} ] [ -rFT=@var{dist} ]
2185
[ -rcR=1 ] [ -rC1 ] [ -rD1 ] [-rHY=@var{flags} ]
2186
[ -rP@var{nnn} ] [ -rS@var{xx} ] [ -rX@var{nnn} ]
2187
[ -rIN=@var{length} ] [ -rSN=@var{length} ] [ @var{files}@dots{} ]
2191
It is possible to use @samp{-man} instead of @w{@samp{-m man}}.
2195
This option (the default if a TTY output device is used) creates a
2196
single, very long page instead of multiple pages. Use @code{-rcR=0} to
2200
If more than one manual page is given on the command line, number the
2201
pages continuously, rather than starting each at@tie{}1.
2204
Double-sided printing. Footers for even and odd pages are formatted
2207
@item -rFT=@var{dist}
2208
Set the position of the footer text to @var{dist}. If positive, the
2209
distance is measured relative to the top of the page, otherwise it is
2210
relative to the bottom. The default is @minus{}0.5@dmn{i}.
2212
@item -rHY=@var{flags}
2213
Set hyphenation flags. Possible values are 1@tie{}to hyphenate without
2214
restrictions, 2@tie{}to not hyphenate the last word on a page, 4@tie{}to
2215
not hyphenate the last two characters of a word, and 8@tie{}to not
2216
hyphenate the first two characters of a word. These values are
2217
additive; the default is@tie{}14.
2219
@item -rIN=@var{length}
2220
Set the body text indentation to @var{length}. If not specified, the
2221
indentation defaults to 7@dmn{n} (7@tie{}characters) in nroff mode and
2222
7.2@dmn{n} otherwise. For nroff, this value should always be an integer
2223
multiple of unit @samp{n} to get consistent indentation.
2225
@item -rLL=@var{length}
2226
Set line length to @var{length}. If not specified, the line length is
2227
set to respect any value set by a prior @samp{ll} request (which
2228
@emph{must} be in effect when the @samp{TH} macro is invoked), if this
2229
differs from the built-in default for the formatter; otherwise it
2230
defaults to 78@dmn{n} in nroff mode (this is 78 characters per line) and
2231
6.5@dmn{i} in troff mode.@footnote{Note that the use of a @samp{.ll
2232
@var{length}} request to initialize the line length, prior to use of the
2233
@samp{TH} macro, is supported for backward compatibility with some
2234
versions of the @code{man} program. @emph{Always} use the
2235
@option{-rLL=@var{length}} option, or an equivalent @samp{.nr LL
2236
@var{length}} request, in preference to such a @samp{.ll @var{length}}
2237
request. In particular, note that in nroff mode, the request @samp{.ll
2238
65n}, (with any @var{length} expression which evaluates equal to
2239
65@dmn{n}, i.e., the formatter's default line length in nroff mode),
2240
does @emph{not} set the line length to 65@dmn{n} (it is adjusted to the
2241
@code{man} macro package's default setting of 78@dmn{n}), whereas the
2242
use of the @option{-rLL=65n} option, or the @samp{.nr LL 65n} request
2243
@emph{does} establish a line length of 65@dmn{n}.}
2245
@item -rLT=@var{length}
2246
Set title length to @var{length}. If not specified, the title length
2247
defaults to the line length.
2250
Page numbering starts with @var{nnn} rather than with@tie{}1.
2253
Use @var{xx} (which can be 10, 11, or@tie{}12@dmn{pt}) as the base
2254
document font size instead of the default value of@tie{}10@dmn{pt}.
2256
@item -rSN=@var{length}
2257
Set the indentation for sub-subheadings to @var{length}. If not
2258
specified, the indentation defaults to 3@dmn{n}.
2261
After page @var{nnn}, number pages as @var{nnn}a, @var{nnn}b,
2262
@var{nnn}c, etc. For example, the option @option{-rX2} produces the
2263
following page numbers: 1, 2, 2a, 2b, 2c, etc.
2266
@c ---------------------------------------------------------------------
2268
@node Man usage, Man font macros, Man options, man
2270
@cindex @code{man} macros
2271
@cindex macros for manual pages [@code{man}]
2274
This section describes the available macros for manual pages. For
2275
further customization, put additional macros and requests into the file
2276
@file{man.local} which is loaded immediately after the @file{man}
2279
@Defmac {TH, title section [@Var{extra1} [@Var{extra2} [@Var{extra3}]]], man}
2280
Set the title of the man page to @var{title} and the section to
2281
@var{section}, which must have a value between 1 and@tie{}8. The value
2282
of @var{section} may also have a string appended, e.g.@: @samp{.pm}, to
2283
indicate a specific subsection of the man pages.
2285
Both @var{title} and @var{section} are positioned at the left and right
2286
in the header line (with @var{section} in parentheses immediately
2287
appended to @var{title}. @var{extra1} is positioned in the middle of
2288
the footer line. @var{extra2} is positioned at the left in the footer
2289
line (or at the left on even pages and at the right on odd pages if
2290
double-sided printing is active). @var{extra3} is centered in the
2293
For @acronym{HTML} and @acronym{XHTML} output, headers and footers are
2294
completely suppressed.
2296
Additionally, this macro starts a new page; the new line number
2297
is@tie{}1 again (except if the @option{-rC1} option is given on the
2298
command line) -- this feature is intended only for formatting multiple
2299
man pages; a single man page should contain exactly one @code{TH} macro
2300
at the beginning of the file.
2303
@Defmac {SH, [@Var{heading}], man}
2304
Set up an unnumbered section heading sticking out to the left. Prints
2305
out all the text following @code{SH} up to the end of the line (or the
2306
text in the next line if there is no argument to @code{SH}) in bold face
2307
(or the font specified by the string @code{HF}), one size larger than
2308
the base document size. Additionally, the left margin and the
2309
indentation for the following text is reset to its default value.
2312
@Defmac {SS, [@Var{heading}], man}
2313
Set up an unnumbered (sub)section heading. Prints out all the text
2314
following @code{SS} up to the end of the line (or the text in the next
2315
line if there is no argument to @code{SS}) in bold face (or the font
2316
specified by the string @code{HF}), at the same size as the base
2317
document size. Additionally, the left margin and the indentation for
2318
the following text is reset to its default value.
2321
@Defmac {TP, [@Var{nnn}], man}
2322
Set up an indented paragraph with label. The indentation is set to
2323
@var{nnn} if that argument is supplied (the default unit is @samp{n} if
2324
omitted), otherwise it is set to the previous indentation value
2325
specified with @code{TP}, @code{IP}, or @code{HP} (or to the default
2326
value if none of them have been used yet).
2328
The first line of text following this macro is interpreted as a string
2329
to be printed flush-left, as it is appropriate for a label. It is not
2330
interpreted as part of a paragraph, so there is no attempt to fill the
2331
first line with text from the following input lines. Nevertheless, if
2332
the label is not as wide as the indentation the paragraph starts at the
2333
same line (but indented), continuing on the following lines. If the
2334
label is wider than the indentation the descriptive part of the
2335
paragraph begins on the line following the label, entirely indented.
2336
Note that neither font shape nor font size of the label is set to a
2337
default value; on the other hand, the rest of the text has default font
2341
@DefmacList {LP, , man}
2342
@DefmacItem {PP, , man}
2343
@DefmacListEnd {P, , man}
2344
These macros are mutual aliases. Any of them causes a line break at the
2345
current position, followed by a vertical space downwards by the amount
2346
specified by the @code{PD} macro. The font size and shape are reset to
2347
the default value (10@dmn{pt} roman if no @option{-rS} option is given
2348
on the command line). Finally, the current left margin and the
2349
indentation is restored.
2352
@Defmac {IP, [@Var{designator} [@Var{nnn}]], man}
2353
Set up an indented paragraph, using @var{designator} as a tag to mark
2354
its beginning. The indentation is set to @var{nnn} if that argument is
2355
supplied (default unit is @samp{n}), otherwise it is set to the previous
2356
indentation value specified with @code{TP}, @code{IP}, or @code{HP} (or
2357
the default value if none of them have been used yet). Font size and
2358
face of the paragraph (but not the designator) are reset to their
2361
To start an indented paragraph with a particular indentation but without
2362
a designator, use @samp{""} (two double quotes) as the first argument of
2365
For example, to start a paragraph with bullets as the designator and
2366
4@tie{}en indentation, write
2373
@Defmac {HP, [@Var{nnn}], man}
2374
@cindex hanging indentation [@code{man}]
2375
@cindex @code{man} macros, hanging indentation
2376
Set up a paragraph with hanging left indentation. The indentation is
2377
set to @var{nnn} if that argument is supplied (default unit is
2378
@samp{n}), otherwise it is set to the previous indentation value
2379
specified with @code{TP}, @code{IP}, or @code{HP} (or the default value
2380
if non of them have been used yet). Font size and face are reset to
2381
their default values.
2384
@Defmac {RS, [@Var{nnn}], man}
2385
@cindex left margin, how to move [@code{man}]
2386
@cindex @code{man} macros, moving left margin
2387
Move the left margin to the right by the value @var{nnn} if specified
2388
(default unit is @samp{n}); otherwise it is set to the previous
2389
indentation value specified with @code{TP}, @code{IP}, or @code{HP} (or
2390
to the default value if none of them have been used yet). The
2391
indentation value is then set to the default.
2393
Calls to the @code{RS} macro can be nested.
2396
@Defmac {RE, [@Var{nnn}], man}
2397
Move the left margin back to level @var{nnn}, restoring the previous
2398
left margin. If no argument is given, it moves one level back. The
2399
first level (i.e., no call to @code{RS} yet) has number@tie{}1, and each
2400
call to @code{RS} increases the level by@tie{}1.
2403
@cindex line breaks, with vertical space [@code{man}]
2404
@cindex @code{man} macros, line breaks with vertical space
2405
To summarize, the following macros cause a line break with the insertion
2406
of vertical space (which amount can be changed with the @code{PD}
2407
macro): @code{SH}, @code{SS}, @code{TP}, @code{LP} (@code{PP},
2408
@code{P}), @code{IP}, and @code{HP}.
2410
@cindex line breaks, without vertical space [@code{man}]
2411
@cindex @code{man} macros, line breaks without vertical space
2412
The macros @code{RS} and @code{RE} also cause a break but do not insert
2415
@cindex default indentation, resetting [@code{man}]
2416
@cindex indentaion, resetting to default [@code{man}]
2417
@cindex @code{man} macros, resetting default indentation
2418
Finally, the macros @code{SH}, @code{SS}, @code{LP} (@code{PP},
2419
@code{P}), and @code{RS} reset the indentation to its default value.
2421
@c ---------------------------------------------------------------------
2423
@node Man font macros, Miscellaneous man macros, Man usage, man
2424
@subsection Macros to set fonts
2425
@cindex font selection [@code{man}]
2426
@cindex @code{man} macros, how to set fonts
2428
The standard font is roman; the default text size is 10@tie{}point. If
2429
command line option @option{-rS=@var{n}} is given, use @var{n}@dmn{pt}
2430
as the default text size.
2432
@Defmac {SM, [@Var{text}], man}
2433
Set the text on the same line or the text on the next line in a font
2434
that is one point size smaller than the default font.
2437
@Defmac {SB, [@Var{text}], man}
2438
@cindex bold face [@code{man}]
2439
@cindex @code{man} macros, bold face
2440
Set the text on the same line or the text on the next line in bold face
2441
font, one point size smaller than the default font.
2444
@Defmac {BI, text, man}
2445
Set its arguments alternately in bold face and italic, without a space
2446
between the arguments. Thus,
2449
.BI this "word and" that
2453
produces ``thisword andthat'' with ``this'' and ``that'' in bold face,
2454
and ``word and'' in italics.
2457
@Defmac {IB, text, man}
2458
Set its arguments alternately in italic and bold face, without a space
2459
between the arguments.
2462
@Defmac {RI, text, man}
2463
Set its arguments alternately in roman and italic, without a space
2464
between the arguments.
2467
@Defmac {IR, text, man}
2468
Set its arguments alternately in italic and roman, without a space
2469
between the arguments.
2472
@Defmac {BR, text, man}
2473
Set its arguments alternately in bold face and roman, without a space
2474
between the arguments.
2477
@Defmac {RB, text, man}
2478
Set its arguments alternately in roman and bold face, without a space
2479
between the arguments.
2482
@Defmac {B, [@Var{text}], man}
2483
Set @var{text} in bold face. If no text is present on the line where
2484
the macro is called, then the text of the next line appears in bold
2488
@Defmac {I, [@Var{text}], man}
2489
@cindex italic fonts [@code{man}]
2490
@cindex @code{man} macros, italic fonts
2491
Set @var{text} in italic. If no text is present on the line where the
2492
macro is called, then the text of the next line appears in italic.
2495
@c ---------------------------------------------------------------------
2497
@node Miscellaneous man macros, Predefined man strings, Man font macros, man
2498
@subsection Miscellaneous macros
2501
@cindex @code{man} macros, default indentation
2502
@cindex default indentation [@code{man}]
2503
The default indentation is 7.2@dmn{n} in troff mode and 7@dmn{n} in
2504
nroff mode except for @code{grohtml} which ignores indentation.
2507
@cindex tab stops [@code{man}]
2508
@cindex @code{man} macros, tab stops
2509
Set tabs every 0.5@tie{}inches. Since this macro is always executed
2510
during a call to the @code{TH} macro, it makes sense to call it only if
2511
the tab positions have been changed.
2514
@Defmac {PD, [@Var{nnn}], man}
2515
@cindex empty space before a paragraph [@code{man}]
2516
@cindex @code{man} macros, empty space before a paragraph
2517
Adjust the empty space before a new paragraph (or section). The
2518
optional argument gives the amount of space (default unit is @samp{v});
2519
without parameter, the value is reset to its default value (1@tie{}line
2520
in nroff mode, 0.4@dmn{v}@tie{}otherwise).
2522
This affects the macros @code{SH}, @code{SS}, @code{TP}, @code{LP} (as
2523
well as @code{PP} and @code{P}), @code{IP}, and @code{HP}.
2526
The following two macros are included for BSD compatibility.
2528
@Defmac {AT, [@Var{system} [@Var{release}]], man}
2529
@cindex @code{man}macros, BSD compatibility
2530
Alter the footer for use with @acronym{AT&T} manpages. This command
2531
exists only for compatibility; don't use it. The first argument
2532
@var{system} can be:
2536
7th Edition (the default)
2545
An optional second argument @var{release} to @code{AT} specifies the
2546
release number (such as ``System V Release 3'').
2549
@Defmac {UC, [@Var{version}], man}
2550
@cindex @code{man}macros, BSD compatibility
2551
Alters the footer for use with BSD manpages. This command exists only
2552
for compatibility; don't use it. The argument can be:
2556
3rd Berkeley Distribution (the default)
2559
4th Berkeley Distribution
2562
4.2 Berkeley Distribution
2565
4.3 Berkeley Distribution
2568
4.4 Berkeley Distribution
2572
@c ---------------------------------------------------------------------
2574
@node Predefined man strings, Preprocessors in man pages, Miscellaneous man macros, man
2575
@subsection Predefined strings
2577
The following strings are defined:
2580
Switch back to the default font size.
2584
The typeface used for headings.
2585
The default is @samp{B}.
2589
The `registered' sign.
2593
The `trademark' sign.
2596
@DefstrList {lq, man}
2597
@DefstrListEnd {rq, man}
2598
@cindex @code{lq} glyph, and @code{lq} string [@code{man}]
2599
@cindex @code{rq} glyph, and @code{rq} string [@code{man}]
2600
Left and right quote. This is equal to @code{\(lq} and @code{\(rq},
2604
@c ---------------------------------------------------------------------
2606
@node Preprocessors in man pages, Optional man extensions, Predefined man strings, man
2607
@subsection Preprocessors in @file{man} pages
2609
@cindex preprocessor, calling convention
2610
@cindex calling convention of preprocessors
2611
If a preprocessor like @code{gtbl} or @code{geqn} is needed, it has
2612
become common usage to make the first line of the man page look like
2619
@pindex geqn@r{, invocation in manual pages}
2620
@pindex grefer@r{, invocation in manual pages}
2621
@pindex gtbl@r{, invocation in manual pages}
2622
@pindex man@r{, invocation of preprocessors}
2624
Note the single space character after the double quote. @var{word}
2625
consists of letters for the needed preprocessors: @samp{e} for
2626
@code{geqn}, @samp{r} for @code{grefer}, @samp{t} for @code{gtbl}.
2627
Modern implementations of the @code{man} program read this first line
2628
and automatically call the right preprocessor(s).
2630
@c ---------------------------------------------------------------------
2632
@node Optional man extensions, , Preprocessors in man pages, man
2633
@subsection Optional @file{man} extensions
2636
Use the file @file{man.local} for local extensions to the @code{man}
2637
macros or for style changes.
2639
@unnumberedsubsubsec Custom headers and footers
2640
@cindex @code{man} macros, custom headers and footers
2642
In groff versions 1.18.2 and later, you can specify custom headers and
2643
footers by redefining the following macros in @file{man.local}.
2646
Control the content of the headers. Normally, the header prints the
2647
command name and section number on either side, and the optional fifth
2648
argument to @code{TH} in the center.
2652
Control the content of the footers. Normally, the footer prints the
2653
page number and the third and fourth arguments to @code{TH}.
2655
Use the @code{FT} number register to specify the footer position. The
2656
default is @minus{}0.5@dmn{i}.
2659
@unnumberedsubsubsec Ultrix-specific man macros
2660
@cindex Ultrix-specific @code{man} macros
2661
@cindex @code{man} macros, Ultrix-specific
2664
The @code{groff} source distribution includes a file named
2665
@file{man.ultrix}, containing macros compatible with the Ultrix variant
2666
of @code{man}. Copy this file into @file{man.local} (or use the
2667
@code{mso} request to load it) to enable the following macros.
2669
@Defmac {CT, @Var{key}, man}
2670
Print @samp{<CTRL/@var{key}>}.
2674
Print subsequent text using the constant width (Courier) typeface.
2678
Begin a non-filled display.
2682
End a non-filled display started with @code{Ds}.
2685
@Defmac {EX, [@Var{indent}], man}
2686
Begin a non-filled display using the constant width (Courier) typeface.
2687
Use the optional @var{indent} argument to indent the display.
2691
End a non-filled display started with @code{EX}.
2694
@Defmac {G, [@Var{text}], man}
2695
Set @var{text} in Helvetica. If no text is present on the line where
2696
the macro is called, then the text of the next line appears in
2700
@Defmac {GL, [@Var{text}], man}
2701
Set @var{text} in Helvetica Oblique. If no text is present on the line
2702
where the macro is called, then the text of the next line appears in
2706
@Defmac {HB, [@Var{text}], man}
2707
Set @var{text} in Helvetica Bold. If no text is present on the line
2708
where the macro is called, then all text up to the next @code{HB}
2709
appears in Helvetica Bold.
2712
@Defmac {TB, [@Var{text}], man}
2713
Identical to @code{HB}.
2716
@Defmac {MS, @Var{title} @Var{sect} [@Var{punct}], man}
2717
Set a manpage reference in Ultrix format. The @var{title} is in Courier
2718
instead of italic. Optional punctuation follows the section number
2719
without an intervening space.
2722
@Defmac {NT, [@code{C}] [@Var{title}], man}
2723
Begin a note. Print the optional @Var{title}, or the word ``Note'',
2724
centered on the page. Text following the macro makes up the body of the
2725
note, and is indented on both sides. If the first argument is @code{C},
2726
the body of the note is printed centered (the second argument replaces
2727
the word ``Note'' if specified).
2731
End a note begun with @code{NT}.
2734
@Defmac {PN, @Var{path} [@Var{punct}], man}
2735
Set the path name in constant width (Courier), followed by optional
2739
@Defmac {Pn, [@Var{punct}] @Var{path} [@Var{punct}], man}
2740
If called with two arguments, identical to @code{PN}. If called with
2741
three arguments, set the second argument in constant width (Courier),
2742
bracketed by the first and third arguments in the current font.
2746
Switch to roman font and turn off any underlining in effect.
2750
Print the string @samp{<RETURN>}.
2753
@Defmac {VS, [@code{4}], man}
2754
Start printing a change bar in the margin if the number@tie{}@code{4} is
2755
specified. Otherwise, this macro does nothing.
2759
End printing the change bar begun by @code{VS}.
2762
@unnumberedsubsubsec Simple example
2764
The following example @file{man.local} file alters the @code{SH} macro
2765
to add some extra vertical space before printing the heading. Headings
2766
are printed in Helvetica Bold.
2769
.\" Make the heading fonts Helvetica
2772
.\" Put more whitespace in front of headings.
2775
. if t .sp (u;\\n[PD]*2)
2781
@c =====================================================================
2783
@node mdoc, ms, man, Macro Packages
2784
@section @file{mdoc}
2785
@cindex @code{mdoc} macros
2787
@c XXX documentation
2788
@c XXX this is a placeholder until we get stuff knocked into shape
2789
See the @cite{groff_mdoc(7)} man page (type @command{man groff_mdoc}
2790
at the command line).
2793
@c =====================================================================
2795
@node ms, me, mdoc, Macro Packages
2797
@cindex @code{ms} macros
2799
The @file{-ms} macros are suitable for reports, letters, books, user
2800
manuals, and so forth. The package provides macros for cover pages,
2801
section headings, paragraphs, lists, footnotes, pagination, and a table
2806
* General ms Structure::
2807
* ms Document Control Registers::
2808
* ms Cover Page Macros::
2811
* Differences from AT&T ms::
2812
* Naming Conventions::
2815
@c ---------------------------------------------------------------------
2817
@node ms Intro, General ms Structure, ms, ms
2818
@subsection Introduction to @file{ms}
2820
The original @file{-ms} macros were included with @acronym{AT&T}
2821
@code{troff} as well as the @file{man} macros. While the @file{man}
2822
package is intended for brief documents that can be read on-line as well
2823
as printed, the @file{ms} macros are suitable for longer documents that
2824
are meant to be printed rather than read on-line.
2826
The @file{ms} macro package included with @code{groff} is a complete,
2827
bottom-up re-implementation. Several macros (specific to @acronym{AT&T}
2828
or Berkeley) are not included, while several new commands are.
2829
@xref{Differences from AT&T ms}, for more information.
2831
@c ---------------------------------------------------------------------
2833
@node General ms Structure, ms Document Control Registers, ms Intro, ms
2834
@subsection General structure of an @file{ms} document
2835
@cindex @code{ms} macros, general structure
2837
The @file{ms} macro package expects a certain amount of structure, but
2838
not as much as packages such as @file{man} or @file{mdoc}.
2840
The simplest documents can begin with a paragraph macro (such as
2841
@code{LP} or @code{PP}), and consist of text separated by paragraph
2842
macros or even blank lines. Longer documents have a structure as
2847
If you invoke the @code{RP} (report) macro on the first line of the
2848
document, @code{groff} prints the cover page information on its own
2849
page; otherwise it prints the information on the first page with your
2850
document text immediately following. Other document formats found in
2851
@acronym{AT&T} @code{troff} are specific to @acronym{AT&T} or Berkeley,
2852
and are not supported in @code{groff}.
2854
@item Format and layout
2855
By setting number registers, you can change your document's type (font
2856
and size), margins, spacing, headers and footers, and footnotes.
2857
@xref{ms Document Control Registers}, for more details.
2860
A cover page consists of a title, the author's name and institution, an
2861
abstract, and the date.@footnote{Actually, only the title is required.}
2862
@xref{ms Cover Page Macros}, for more details.
2865
Following the cover page is your document. You can use the @file{ms}
2866
macros to write reports, letters, books, and so forth. The package is
2867
designed for structured documents, consisting of paragraphs interspersed
2868
with headings and augmented by lists, footnotes, tables, and other
2869
common constructs. @xref{ms Body Text}, for more details.
2871
@item Table of contents
2872
Longer documents usually include a table of contents, which you can
2873
invoke by placing the @code{TC} macro at the end of your document. The
2874
@file{ms} macros have minimal indexing facilities, consisting of the
2875
@code{IX} macro, which prints an entry on standard error. Printing the
2876
table of contents at the end is necessary since @code{groff} is a
2877
single-pass text formatter, thus it cannot determine the page number of
2878
each section until that section has actually been set and printed.
2879
Since @file{ms} output is intended for hardcopy, you can manually
2880
relocate the pages containing the table of contents between the cover
2881
page and the body text after printing.
2884
@c ---------------------------------------------------------------------
2886
@node ms Document Control Registers, ms Cover Page Macros, General ms Structure, ms
2887
@subsection Document control registers
2888
@cindex @code{ms} macros, document control registers
2890
The following is a list of document control number registers. For the
2891
sake of consistency, set registers related to margins at the beginning
2892
of your document, or just after the @code{RP} macro. You can set other
2893
registers later in your document, but you should keep them together at
2894
the beginning to make them easy to find and edit as necessary.
2896
@unnumberedsubsubsec Margin Settings
2899
Defines the page offset (i.e., the left margin). There is no explicit
2900
right margin setting; the combination of the @code{PO} and @code{LL}
2901
registers implicitly define the right margin width.
2903
Effective: next page.
2905
Default value: 1@dmn{i}.
2909
Defines the line length (i.e., the width of the body text).
2911
Effective: next paragraph.
2917
Defines the title length (i.e., the header and footer width). This
2918
is usually the same as @code{LL}, but not necessarily.
2920
Effective: next paragraph.
2926
Defines the header margin height at the top of the page.
2928
Effective: next page.
2934
Defines the footer margin height at the bottom of the page.
2936
Effective: next page.
2941
@unnumberedsubsubsec Text Settings
2944
Defines the point size of the body text. If the value is larger than or
2945
equal to 1000, divide it by 1000 to get a fractional point size. For
2946
example, @samp{.nr PS 10250} sets the document's point size to
2949
Effective: next paragraph.
2955
Defines the space between lines (line height plus leading). If the
2956
value is larger than or equal to 1000, divide it by 1000 to get a
2957
fractional point size. Due to backwards compatibility, @code{VS} must
2958
be smaller than 40000 (this is 40.0@dmn{p}).
2960
Effective: next paragraph.
2965
@Defmpreg {PSINCR, ms}
2966
Defines an increment in point size, which is applied to section headings
2967
at nesting levels below the value specified in @code{GROWPS}. The value
2968
of @code{PSINCR} should be specified in points, with the @dmn{p} scaling
2969
factor, and may include a fractional component; for example,
2970
@w{@samp{.nr PSINCR 1.5p}} sets a point size increment of 1.5@dmn{p}.
2972
Effective: next section heading.
2977
@Defmpreg {GROWPS, ms}
2978
Defines the heading level below which the point size increment set by
2979
@code{PSINCR} becomes effective. Section headings at and above the
2980
level specified by @code{GROWPS} are printed at the point size set by
2981
@code{PS}; for each level below the value of @code{GROWPS}, the point
2982
size is increased in steps equal to the value of @code{PSINCR}. Setting
2983
@code{GROWPS} to any value less than@tie{}2 disables the incremental
2984
heading size feature.
2986
Effective: next section heading.
2992
Defines the hyphenation level. @code{HY} sets safely the value of the
2993
low-level @code{hy} register. Setting the value of @code{HY} to@tie{}0
2994
is equivalent to using the @code{nh} request.
2996
Effective: next paragraph.
3002
Defines the font family used to typeset the document.
3004
Effective: next paragraph.
3006
Default: as defined in the output device.
3009
@unnumberedsubsubsec Paragraph Settings
3012
Defines the initial indentation of a (@code{PP} macro) paragraph.
3014
Effective: next paragraph.
3020
Defines the space between paragraphs.
3022
Effective: next paragraph.
3024
Default: 0.3@dmn{v}.
3028
Defines the indentation on both sides of a quoted (@code{QP} macro)
3031
Effective: next paragraph.
3036
@Defmpreg {PORPHANS, ms}
3037
Defines the minimum number of initial lines of any paragraph which
3038
should be kept together, to avoid orphan lines at the bottom of a page.
3039
If a new paragraph is started close to the bottom of a page, and there
3040
is insufficient space to accommodate @code{PORPHANS} lines before an
3041
automatic page break, then the page break is forced, before the start of
3044
Effective: next paragraph.
3049
@Defmpreg {HORPHANS, ms}
3050
Defines the minimum number of lines of the following paragraph which
3051
should be kept together with any section heading introduced by the
3052
@code{NH} or @code{SH} macros. If a section heading is placed close to
3053
the bottom of a page, and there is insufficient space to accommodate
3054
both the heading and at least @code{HORPHANS} lines of the following
3055
paragraph, before an automatic page break, then the page break is forced
3058
Effective: next paragraph.
3063
@unnumberedsubsubsec Footnote Settings
3066
Defines the length of a footnote.
3068
Effective: next footnote.
3070
Default: @math{@code{@\n[LL]} * 5 / 6}.
3074
Defines the footnote indentation.
3076
Effective: next footnote.
3082
The footnote format:
3085
Print the footnote number as a superscript; indent the footnote
3089
Print the number followed by a period (like 1.@:) and indent the
3093
Like 1, without an indentation.
3096
Like 1, but print the footnote number as a hanging paragraph.
3099
Effective: next footnote.
3105
Defines the footnote point size. If the value is larger than or equal
3106
to 1000, divide it by 1000 to get a fractional point size.
3108
Effective: next footnote.
3110
Default: @math{@code{@\n[PS]} - 2}.
3114
Defines the footnote vertical spacing. If the value is larger than or
3115
equal to 1000, divide it by 1000 to get a fractional point size.
3117
Effective: next footnote.
3119
Default: @math{@code{@\n[FPS]} + 2}.
3123
Defines the footnote paragraph spacing.
3125
Effective: next footnote.
3127
Default: @math{@code{@\n[PD]} / 2}.
3130
@unnumberedsubsubsec Miscellaneous Number Registers
3132
@Defmpreg {MINGW, ms}
3133
Defines the minimum width between columns in a multi-column document.
3135
Effective: next page.
3141
Sets the vertical spacing before and after a display, a @code{tbl} table, an
3142
@code{eqn} equation, or a @code{pic} image.
3144
Effective: next paragraph.
3146
Default: 0.5@dmn{v}.
3149
@c ---------------------------------------------------------------------
3151
@node ms Cover Page Macros, ms Body Text, ms Document Control Registers, ms
3152
@subsection Cover page macros
3153
@cindex @code{ms} macros, cover page
3154
@cindex cover page macros, [@code{ms}]
3156
Use the following macros to create a cover page for your document in the
3159
@Defmac {RP, [@code{no}], ms}
3160
Specifies the report format for your document. The report format
3161
creates a separate cover page. The default action (no @code{RP} macro)
3162
is to print a subset of the cover page on page@tie{}1 of your document.
3164
If you use the word @code{no} as an optional argument, @code{groff}
3165
prints a title page but does not repeat any of the title page
3166
information (title, author, abstract, etc.@:) on page@tie{}1 of the
3171
(P-one) Prints the header on page@tie{}1. The default is to suppress
3175
@Defmac {DA, [@dots{}], ms}
3176
(optional) Prints the current date, or the arguments to the macro if
3177
any, on the title page (if specified) and in the footers. This is the
3178
default for @code{nroff}.
3181
@Defmac {ND, [@dots{}], ms}
3182
(optional) Prints the current date, or the arguments to the macro if
3183
any, on the title page (if specified) but not in the footers. This is
3184
the default for @code{troff}.
3188
Specifies the document title. @code{groff} collects text following the
3189
@code{TL} macro into the title, until reaching the author name or
3194
Specifies the author's name, which appears on the line (or lines)
3195
immediately following. You can specify multiple authors as follows:
3201
University of West Bumblefuzz
3205
Monolithic Corporation
3212
Specifies the author's institution. You can specify multiple
3213
institutions in the same way that you specify multiple authors.
3216
@Defmac {AB, [@code{no}], ms}
3217
Begins the abstract. The default is to print the word
3218
@acronym{ABSTRACT}, centered and in italics, above the text of the
3219
abstract. The word @code{no} as an optional argument suppresses this
3227
The following is example mark-up for a title page.
3228
@cindex title page, example markup
3229
@cindex example markup, title page
3234
The Inevitability of Code Bloat
3235
in Commercial and Free Software
3239
University of West Bumblefuzz
3241
This report examines the long-term growth
3242
of the code bases in two large, popular software
3243
packages; the free Emacs and the commercial
3245
While differences appear in the type or order
3246
of features added, due to the different
3247
methodologies used, the results are the same
3250
The free software approach is shown to be
3251
superior in that while free software can
3252
become as bloated as commercial offerings,
3253
free software tends to have fewer serious
3254
bugs and the added features are in line with
3258
... the rest of the paper follows ...
3259
@endCartoucheExample
3261
@c ---------------------------------------------------------------------
3263
@node ms Body Text, ms Page Layout, ms Cover Page Macros, ms
3264
@subsection Body text
3265
@cindex @code{ms} macros, body text
3267
This section describes macros used to mark up the body of your document.
3268
Examples include paragraphs, sections, and other groups.
3271
* Paragraphs in ms::
3273
* Highlighting in ms::
3275
* Indentation values in ms::
3277
* ms Displays and Keeps::
3279
* Example multi-page table::
3283
@c ---------------------------------------------------------------------
3285
@node Paragraphs in ms, Headings in ms, ms Body Text, ms Body Text
3286
@subsubsection Paragraphs
3287
@cindex @code{ms} macros, paragraph handling
3289
The following paragraph types are available.
3292
Sets a paragraph with an initial indentation.
3296
Sets a paragraph without an initial indentation.
3300
Sets a paragraph that is indented at both left and right margins. The
3301
effect is identical to the @acronym{HTML} @code{<BLOCKQUOTE>} element.
3302
The next paragraph or heading returns margins to normal.
3306
Sets a paragraph whose lines are indented, except for the first line.
3307
This is a Berkeley extension.
3310
The following markup uses all four paragraph macros.
3314
Cases used in the study
3316
The following software and versions were
3317
considered for this report.
3319
For commercial software, we chose
3320
.B "Microsoft Word for Windows" ,
3321
starting with version 1.0 through the
3322
current version (Word 2000).
3324
For free software, we chose
3326
from its first appearance as a standalone
3327
editor through the current version (v20).
3328
See [Bloggs 2002] for details.
3330
Franklin's Law applied to software:
3331
software expands to outgrow both
3332
RAM and disk space over time.
3337
.I "Everyone's a Critic" ,
3338
Underground Press, March 2002.
3339
A definitive work that answers all questions
3340
and criticisms about the quality and usability of
3342
@endCartoucheExample
3344
The @code{PORPHANS} register (@pxref{ms Document Control Registers})
3345
operates in conjunction with each of these macros, to inhibit the
3346
printing of orphan lines at the bottom of any page.
3348
@c ---------------------------------------------------------------------
3350
@node Headings in ms, Highlighting in ms, Paragraphs in ms, ms Body Text
3351
@subsubsection Headings
3352
@cindex @code{ms} macros, headings
3354
Use headings to create a hierarchical structure for your document. The
3355
@file{ms} macros print headings in @strong{bold}, using the same font
3356
family and point size as the body text.
3358
The following describes the heading macros:
3360
@DefmacList {NH, @Var{curr-level}, ms}
3361
@DefmacListEnd {NH, @t{S} @Var{level0} @dots{}, ms}
3362
Numbered heading. The argument is either a numeric argument to indicate
3363
the level of the heading, or the letter@tie{}@code{S} followed by
3364
numeric arguments to set the heading level explicitly.
3366
If you specify heading levels out of sequence, such as invoking
3367
@samp{.NH 3} after @samp{.NH 1}, @code{groff} prints a warning on
3371
@DefstrList {SN, ms}
3372
@DefstrItem {SN-DOT, ms}
3373
@DefstrListEnd {SN-NO-DOT, ms}
3374
After invocation of @code{NH}, the assigned section number is made
3375
available in the strings @code{SN-DOT} (as it appears in a printed
3376
section heading with default formatting, followed by a terminating
3377
period), and @code{SN-NO-DOT} (with the terminating period omitted).
3378
The string @code{SN} is also defined, as an alias for @code{SN-DOT}; if
3379
preferred, you may redefine it as an alias for @code{SN-NO-DOT}, by
3380
including the initialization
3386
at any time @strong{before} you would like the change to take effect.
3389
@Defstr {SN-STYLE, ms}
3390
You may control the style used to print section numbers, within numbered
3391
section headings, by defining an appropriate alias for the string
3392
@code{SN-STYLE}. The default style, in which the printed section number
3393
is followed by a terminating period, is obtained by defining the alias
3395
.als SN-STYLE SN-DOT
3399
If you prefer to omit the terminating period, from section numbers
3400
appearing in numbered section headings, you may define the alias
3402
.als SN-STYLE SN-NO-DOT
3406
Any such change in section numbering style becomes effective from the
3407
next use of @code{.NH}, following redefinition of the alias for
3411
@Defmac {SH, [@Var{match-level}], ms}
3412
Unnumbered subheading.
3414
The optional @var{match-level} argument is a GNU extension. It is a
3415
number indicating the level of the heading, in a manner analogous to the
3416
@var{curr-level} argument to @code{.NH}. Its purpose is to match the
3417
point size, at which the heading is printed, to the size of a numbered
3418
heading at the same level, when the @code{GROWPS} and @code{PSINCR}
3419
heading size adjustment mechanism is in effect. @xref{ms Document
3423
The @code{HORPHANS} register (@pxref{ms Document Control Registers})
3424
operates in conjunction with the @code{NH} and @code{SH} macros, to
3425
inhibit the printing of orphaned section headings at the bottom of any
3428
@c ---------------------------------------------------------------------
3430
@node Highlighting in ms, Lists in ms, Headings in ms, ms Body Text
3431
@subsubsection Highlighting
3432
@cindex @code{ms} macros, highlighting
3434
The @file{ms} macros provide a variety of methods to highlight or
3437
@Defmac {B, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3438
Sets its first argument in @strong{bold type}. If you specify a second
3439
argument, @code{groff} prints it in the previous font after the bold
3440
text, with no intervening space (this allows you to set punctuation
3441
after the highlighted text without highlighting the punctuation).
3442
Similarly, it prints the third argument (if any) in the previous font
3443
@strong{before} the first argument. For example,
3449
prints (@strong{foo}).
3451
If you give this macro no arguments, @code{groff} prints all text
3452
following in bold until the next highlighting, paragraph, or heading
3456
@Defmac {R, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3457
Sets its first argument in roman (or regular) type. It operates
3458
similarly to the @code{B}@tie{}macro otherwise.
3461
@Defmac {I, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3462
Sets its first argument in @emph{italic type}. It operates similarly
3463
to the @code{B}@tie{}macro otherwise.
3466
@Defmac {CW, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3467
Sets its first argument in a @code{constant width face}. It operates
3468
similarly to the @code{B}@tie{}macro otherwise.
3471
@Defmac {BI, [@Var{txt} [@Var{post} [@Var{pre}]]], ms}
3472
Sets its first argument in bold italic type. It operates similarly to
3473
the @code{B}@tie{}macro otherwise.
3476
@Defmac {BX, [@Var{txt}], ms}
3477
Prints its argument and draws a box around it. If you want to box a
3478
string that contains spaces, use a digit-width space (@code{\0}).
3481
@Defmac {UL, [@Var{txt} [@Var{post}]], ms}
3482
Prints its first argument with an underline. If you specify a second
3483
argument, @code{groff} prints it in the previous font after the
3484
underlined text, with no intervening space.
3488
Prints all text following in larger type (two points larger than the
3489
current point size) until the next font size, highlighting, paragraph,
3490
or heading macro. You can specify this macro multiple times to
3491
enlarge the point size as needed.
3495
Prints all text following in smaller type (two points smaller than the
3496
current point size) until the next type size, highlighting, paragraph,
3497
or heading macro. You can specify this macro multiple times to reduce
3498
the point size as needed.
3502
Prints all text following in the normal point size (that is, the value
3503
of the @code{PS} register).
3506
@DefstrList {@Lbrace{}, ms}
3507
@DefstrListEnd {@Rbrace{}, ms}
3508
Text enclosed with @code{\*@{} and @code{\*@}} is printed as a
3512
@c ---------------------------------------------------------------------
3514
@node Lists in ms, Indentation values in ms, Highlighting in ms, ms Body Text
3515
@subsubsection Lists
3516
@cindex @code{ms} macros, lists
3518
The @code{IP} macro handles duties for all lists.
3520
@Defmac {IP, [@Var{marker} [@Var{width}]], ms}
3521
The @var{marker} is usually a bullet glyph (@code{\[bu]}) for unordered
3522
lists, a number (or auto-incrementing number register) for numbered
3523
lists, or a word or phrase for indented (glossary-style) lists.
3525
The @var{width} specifies the indentation for the body of each list
3526
item; its default unit is @samp{n}. Once specified, the indentation
3527
remains the same for all list items in the document until specified
3530
The @code{PORPHANS} register (@pxref{ms Document Control Registers})
3531
operates in conjunction with the @code{IP} macro, to inhibit the
3532
printing of orphaned list markers at the bottom of any page.
3535
The following is an example of a bulleted list.
3536
@cindex example markup, bulleted list [@code{ms}]
3537
@cindex bulleted list, example markup [@code{ms}]
3561
The following is an example of a numbered list.
3562
@cindex example markup, numbered list [@code{ms}]
3563
@cindex numbered list, example markup [@code{ms}]
3588
Note the use of the auto-incrementing number register in this example.
3590
The following is an example of a glossary-style list.
3591
@cindex example markup, glossary-style list [@code{ms}]
3592
@cindex glossary-style list, example markup [@code{ms}]
3595
A glossary-style list:
3597
Two or more attorneys.
3599
Firearms, preferably
3609
A glossary-style list:
3612
Two or more attorneys.
3614
guns Firearms, preferably large-caliber.
3617
Gotta pay for those lawyers and guns!
3620
In the last example, the @code{IP} macro places the definition on the
3621
same line as the term if it has enough space; otherwise, it breaks to
3622
the next line and starts the definition below the term. This may or may
3623
not be the effect you want, especially if some of the definitions break
3624
and some do not. The following examples show two possible ways to force
3627
The first workaround uses the @code{br} request to force a break after
3628
printing the term or label.
3631
A glossary-style list:
3633
Two or more attorneys.
3636
Firearms, preferably large-caliber.
3638
Gotta pay for those lawyers and guns!
3639
@endCartoucheExample
3641
The second workaround uses the @code{\p} escape to force the break.
3642
Note the space following the escape; this is important. If you omit the
3643
space, @code{groff} prints the first word on the same line as the term
3644
or label (if it fits) @strong{then} breaks the line.
3647
A glossary-style list:
3649
Two or more attorneys.
3651
\p Firearms, preferably large-caliber.
3653
Gotta pay for those lawyers and guns!
3654
@endCartoucheExample
3656
To set nested lists, use the @code{RS} and @code{RE} macros.
3657
@xref{Indentation values in ms}, for more information.
3658
@cindex @code{ms} macros, nested lists
3659
@cindex nested lists [@code{ms}]
3676
@endCartoucheExample
3692
@c ---------------------------------------------------------------------
3694
@node Indentation values in ms, Tabstops in ms, Lists in ms, ms Body Text
3695
@subsubsection Indentation values
3697
In many situations, you may need to indentation a section of text while
3698
still wrapping and filling. @xref{Lists in ms}, for an example of
3701
@DefmacList {RS, , ms}
3702
@DefmacListEnd {RE, , ms}
3703
These macros begin and end an indented section. The @code{PI} register
3704
controls the amount of indentation, allowing the indented text to line
3705
up under hanging and indented paragraphs.
3708
@xref{ms Displays and Keeps}, for macros to indentation and turn off
3711
@c ---------------------------------------------------------------------
3713
@node Tabstops in ms, ms Displays and Keeps, Indentation values in ms, ms Body Text
3714
@subsubsection Tab Stops
3716
Use the @code{ta} request to define tab stops as needed. @xref{Tabs and
3720
Use this macro to reset the tab stops to the default for @file{ms}
3721
(every 5n). You can redefine the @code{TA} macro to create a different
3722
set of default tab stops.
3725
@c ---------------------------------------------------------------------
3727
@node ms Displays and Keeps, ms Insertions, Tabstops in ms, ms Body Text
3728
@subsubsection Displays and keeps
3729
@cindex @code{ms} macros, displays
3730
@cindex @code{ms} macros, keeps
3731
@cindex keeps [@code{ms}]
3732
@cindex displays [@code{ms}]
3734
Use displays to show text-based examples or figures (such as code
3737
Displays turn off filling, so lines of code are displayed as-is without
3738
inserting @code{br} requests in between each line. Displays can be
3739
@dfn{kept} on a single page, or allowed to break across pages.
3741
@DefmacList {DS, @t{L}, ms}
3742
@DefmacItem {LD, , ms}
3743
@DefmacListEnd {DE, , ms}
3744
Left-justified display. The @samp{.DS L} call generates a page break,
3745
if necessary, to keep the entire display on one page. The @code{LD}
3746
macro allows the display to break across pages. The @code{DE} macro
3750
@DefmacList {DS, @t{I}, ms}
3751
@DefmacItem {ID, , ms}
3752
@DefmacListEnd {DE, , ms}
3753
Indents the display as defined by the @code{DI} register. The @samp{.DS
3754
I} call generates a page break, if necessary, to keep the entire display
3755
on one page. The @code{ID} macro allows the display to break across
3756
pages. The @code{DE} macro ends the display.
3759
@DefmacList {DS, @t{B}, ms}
3760
@DefmacItem {BD, , ms}
3761
@DefmacListEnd {DE, , ms}
3762
Sets a block-centered display: the entire display is left-justified, but
3763
indented so that the longest line in the display is centered on the
3764
page. The @samp{.DS B} call generates a page break, if necessary, to
3765
keep the entire display on one page. The @code{BD} macro allows the
3766
display to break across pages. The @code{DE} macro ends the display.
3769
@DefmacList {DS, @t{C}, ms}
3770
@DefmacItem {CD, , ms}
3771
@DefmacListEnd {DE, , ms}
3772
Sets a centered display: each line in the display is centered. The
3773
@samp{.DS C} call generates a page break, if necessary, to keep the
3774
entire display on one page. The @code{CD} macro allows the display to
3775
break across pages. The @code{DE} macro ends the display.
3778
@DefmacList {DS, @t{R}, ms}
3779
@DefmacItem {RD, , ms}
3780
@DefmacListEnd {DE, , ms}
3781
Right-justifies each line in the display. The @samp{.DS R} call
3782
generates a page break, if necessary, to keep the entire display on one
3783
page. The @code{RD} macro allows the display to break across pages.
3784
The @code{DE} macro ends the display.
3787
@DefmacList {Ds, , ms}
3788
@DefmacListEnd {De, , ms}
3789
These two macros were formerly provided as aliases for @code{DS} and
3790
@code{DE}, respectively. They have been removed, and should no longer
3791
be used. The original implementations of @code{DS} and @code{DE} are
3792
retained, and should be used instead. X11 documents which actually use
3793
@code{Ds} and @code{De} always load a specific macro file from the X11
3794
distribution (@file{macros.t}) which provides proper definitions for the
3798
On occasion, you may want to @dfn{keep} other text together on a page.
3799
For example, you may want to keep two paragraphs together, or a
3800
paragraph that refers to a table (or list, or other item) immediately
3801
following. The @file{ms} macros provide the @code{KS} and @code{KE}
3802
macros for this purpose.
3804
@DefmacList {KS, , ms}
3805
@DefmacListEnd {KE, , ms}
3806
The @code{KS} macro begins a block of text to be kept on a single page,
3807
and the @code{KE} macro ends the block.
3810
@DefmacList {KF, , ms}
3811
@DefmacListEnd {KE, , ms}
3812
Specifies a @dfn{floating keep}; if the keep cannot fit on the current
3813
page, @code{groff} holds the contents of the keep and allows text
3814
following the keep (in the source file) to fill in the remainder of the
3815
current page. When the page breaks, whether by an explicit @code{bp}
3816
request or by reaching the end of the page, @code{groff} prints the
3817
floating keep at the top of the new page. This is useful for printing
3818
large graphics or tables that do not need to appear exactly where
3822
You can also use the @code{ne} request to force a page break if there is
3823
not enough vertical space remaining on the page.
3825
Use the following macros to draw a box around a section of text (such as
3828
@DefmacList {B1, , ms}
3829
@DefmacListEnd {B2, , ms}
3830
Marks the beginning and ending of text that is to have a box drawn
3831
around it. The @code{B1} macro begins the box; the @code{B2} macro ends
3832
it. Text in the box is automatically placed in a diversion (keep).
3835
@c ---------------------------------------------------------------------
3837
@node ms Insertions, Example multi-page table, ms Displays and Keeps, ms Body Text
3838
@subsubsection Tables, figures, equations, and references
3839
@cindex @code{ms} macros, tables
3840
@cindex @code{ms} macros, figures
3841
@cindex @code{ms} macros, equations
3842
@cindex @code{ms} macros, references
3843
@cindex tables [@code{ms}]
3844
@cindex figures [@code{ms}]
3845
@cindex equations [@code{ms}]
3846
@cindex references [@code{ms}]
3848
The @file{ms} macros support the standard @code{groff} preprocessors:
3849
@code{tbl}, @code{pic}, @code{eqn}, and @code{refer}.
3854
You mark text meant for preprocessors by enclosing it in pairs of tags
3857
@DefmacList {TS, [@code{H}], ms}
3858
@DefmacListEnd {TE, , ms}
3859
Denotes a table, to be processed by the @code{tbl} preprocessor. The
3860
optional argument@tie{}@code{H} to @code{TS} instructs @code{groff} to
3861
create a running header with the information up to the @code{TH} macro.
3862
@code{groff} prints the header at the beginning of the table; if the
3863
table runs onto another page, @code{groff} prints the header on the next
3867
@DefmacList {PS, , ms}
3868
@DefmacListEnd {PE, , ms}
3869
Denotes a graphic, to be processed by the @code{pic} preprocessor. You
3870
can create a @code{pic} file by hand, using the @acronym{AT&T}
3871
@code{pic} manual available on the Web as a reference, or by using a
3872
graphics program such as @code{xfig}.
3875
@DefmacList {EQ, [@Var{align}], ms}
3876
@DefmacListEnd {EN, , ms}
3877
Denotes an equation, to be processed by the @code{eqn} preprocessor.
3878
The optional @var{align} argument can be @code{C}, @code{L},
3879
or@tie{}@code{I} to center (the default), left-justify, or indent the
3883
@DefmacList {[, , ms}
3884
@DefmacListEnd {], , ms}
3885
Denotes a reference, to be processed by the @code{refer} preprocessor.
3886
The GNU @cite{refer(1)} man page provides a comprehensive reference to
3887
the preprocessor and the format of the bibliographic database.
3891
* Example multi-page table::
3894
@c ---------------------------------------------------------------------
3896
@node Example multi-page table, ms Footnotes, ms Insertions, ms Body Text
3897
@subsubsection An example multi-page table
3898
@cindex example markup, multi-page table [@code{ms}]
3899
@cindex multi-page table, example markup [@code{ms}]
3901
The following is an example of how to set up a table that may print
3902
across two or more pages.
3908
Text ...of heading...
3913
... the rest of the table follows...
3916
@endCartoucheExample
3918
@c ---------------------------------------------------------------------
3920
@node ms Footnotes, , Example multi-page table, ms Body Text
3921
@subsubsection Footnotes
3922
@cindex @code{ms} macros, footnotes
3923
@cindex footnotes [@code{ms}]
3925
The @file{ms} macro package has a flexible footnote system. You can
3926
specify either numbered footnotes or symbolic footnotes (that is, using
3927
a marker such as a dagger symbol).
3930
Specifies the location of a numbered footnote marker in the text.
3933
@DefmacList {FS, , ms}
3934
@DefmacListEnd {FE, , ms}
3935
Specifies the text of the footnote. The default action is to create a
3936
numbered footnote; you can create a symbolic footnote by specifying a
3937
@dfn{mark} glyph (such as @code{\[dg]} for the dagger glyph) in the body
3938
text and as an argument to the @code{FS} macro, followed by the text of
3939
the footnote and the @code{FE} macro.
3942
You can control how @code{groff} prints footnote numbers by changing the
3943
value of the @code{FF} register. @xref{ms Document Control Registers}.
3945
@cindex footnotes, and keeps [@code{ms}]
3946
@cindex keeps, and footnotes [@code{ms}]
3947
@cindex footnotes, and displays [@code{ms}]
3948
@cindex displays, and footnotes [@code{ms}]
3949
Footnotes can be safely used within keeps and displays, but you should
3950
avoid using numbered footnotes within floating keeps. You can set a
3951
second @code{\**} marker between a @code{\**} and its corresponding
3952
@code{.FS} entry; as long as each @code{FS} macro occurs @emph{after}
3953
the corresponding @code{\**} and the occurrences of @code{.FS} are in
3954
the same order as the corresponding occurrences of @code{\**}.
3956
@c ---------------------------------------------------------------------
3958
@node ms Page Layout, Differences from AT&T ms, ms Body Text, ms
3959
@subsection Page layout
3960
@cindex @code{ms} macros, page layout
3961
@cindex page layout [@code{ms}]
3963
The default output from the @file{ms} macros provides a minimalist page
3964
layout: it prints a single column, with the page number centered at the
3965
top of each page. It prints no footers.
3967
You can change the layout by setting the proper number registers and
3971
* ms Headers and Footers::
3973
* ms Multiple Columns::
3975
* ms Strings and Special Characters::
3978
@c ---------------------------------------------------------------------
3980
@node ms Headers and Footers, ms Margins, ms Page Layout, ms Page Layout
3981
@subsubsection Headers and footers
3982
@cindex @code{ms} macros, headers
3983
@cindex @code{ms} macros, footers
3984
@cindex headers [@code{ms}]
3985
@cindex footers [@code{ms}]
3987
For documents that do not distinguish between odd and even pages, set
3988
the following strings:
3990
@DefstrList {LH, ms}
3991
@DefstrItem {CH, ms}
3992
@DefstrListEnd {RH, ms}
3993
Sets the left, center, and right headers.
3996
@DefstrList {LF, ms}
3997
@DefstrItem {CF, ms}
3998
@DefstrListEnd {RF, ms}
3999
Sets the left, center, and right footers.
4002
For documents that need different information printed in the even and
4003
odd pages, use the following macros:
4005
@DefmacList {OH, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4006
@DefmacItem {EH, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4007
@DefmacItem {OF, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4008
@DefmacListEnd {EF, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}, ms}
4009
The @code{OH} and @code{EH} macros define headers for the odd and even
4010
pages; the @code{OF} and @code{EF} macros define footers for the odd and
4011
even pages. This is more flexible than defining the individual strings.
4013
You can replace the quote (@code{'}) marks with any character not
4014
appearing in the header or footer text.
4017
To specify custom header and footer processing, redefine the following
4020
@DefmacList {PT,, ms}
4021
@DefmacItem {HD,, ms}
4022
@DefmacListEnd {BT,, ms}
4023
The @code{PT} macro defines a custom header; the @code{BT} macro defines
4024
a custom footer. These macros must handle odd/even/first page
4025
differences if necessary.
4027
The @code{HD} macro defines additional header processing to take place
4028
after executing the @code{PT} macro.
4031
@c ---------------------------------------------------------------------
4033
@node ms Margins, ms Multiple Columns, ms Headers and Footers, ms Page Layout
4034
@subsubsection Margins
4035
@cindex @code{ms} macros, margins
4037
You control margins using a set of number registers. @xref{ms Document
4038
Control Registers}, for details.
4040
@c ---------------------------------------------------------------------
4042
@node ms Multiple Columns, ms TOC, ms Margins, ms Page Layout
4043
@subsubsection Multiple columns
4044
@cindex @code{ms} macros, multiple columns
4045
@cindex multiple columns [@code{ms}]
4047
The @file{ms} macros can set text in as many columns as do reasonably
4048
fit on the page. The following macros are available; all of them force
4049
a page break if a multi-column mode is already set. However, if the
4050
current mode is single-column, starting a multi-column mode does
4051
@emph{not} force a page break.
4061
@Defmac {MC, [@Var{width} [@Var{gutter}]], ms}
4062
Multi-column mode. If you specify no arguments, it is equivalent to the
4063
@code{2C} macro. Otherwise, @var{width} is the width of each column and
4064
@var{gutter} is the space between columns. The @code{MINGW} number
4065
register controls the default gutter width.
4068
@c ---------------------------------------------------------------------
4070
@node ms TOC, ms Strings and Special Characters, ms Multiple Columns, ms Page Layout
4071
@subsubsection Creating a table of contents
4072
@cindex @code{ms} macros, creating table of contents
4073
@cindex table of contents, creating [@code{ms}]
4075
The facilities in the @file{ms} macro package for creating a table of
4076
contents are semi-automated at best. Assuming that you want the table
4077
of contents to consist of the document's headings, you need to repeat
4078
those headings wrapped in @code{XS} and @code{XE} macros.
4080
@DefmacList {XS, [@Var{page}], ms}
4081
@DefmacItem {XA, [@Var{page}], ms}
4082
@DefmacListEnd {XE, , ms}
4083
These macros define a table of contents or an individual entry in the
4084
table of contents, depending on their use. The macros are very simple;
4085
they cannot indent a heading based on its level. The easiest way to
4086
work around this is to add tabs to the table of contents string. The
4087
following is an example:
4105
@endCartoucheExample
4107
You can manually create a table of contents by beginning with the
4108
@code{XS} macro for the first entry, specifying the page number for that
4109
entry as the argument to @code{XS}. Add subsequent entries using the
4110
@code{XA} macro, specifying the page number for that entry as the
4111
argument to @code{XA}. The following is an example:
4117
A Brief History of the Universe
4119
Details of Galactic Formation
4122
@endCartoucheExample
4125
@Defmac {TC, [@code{no}], ms}
4126
Prints the table of contents on a new page, setting the page number
4127
to@tie{}@strong{i} (Roman lowercase numeral one). You should usually
4128
place this macro at the end of the file, since @code{groff} is a
4129
single-pass formatter and can only print what has been collected up to
4130
the point that the @code{TC} macro appears.
4132
The optional argument @code{no} suppresses printing the title specified
4133
by the string register @code{TOC}.
4136
@Defmac {PX, [@code{no}], ms}
4137
Prints the table of contents on a new page, using the current page
4138
numbering sequence. Use this macro to print a manually-generated table
4139
of contents at the beginning of your document.
4141
The optional argument @code{no} suppresses printing the title specified
4142
by the string register @code{TOC}.
4145
The @cite{Groff and Friends HOWTO} includes a @code{sed} script that
4146
automatically inserts @code{XS} and @code{XE} macro entries after each
4147
heading in a document.
4149
Altering the @code{NH} macro to automatically build the table of
4150
contents is perhaps initially more difficult, but would save a great
4151
deal of time in the long run if you use @file{ms} regularly.
4153
@c ---------------------------------------------------------------------
4155
@node ms Strings and Special Characters, , ms TOC, ms Page Layout
4156
@subsubsection Strings and Special Characters
4157
@cindex @code{ms} macros, strings
4158
@cindex @code{ms} macros, special characters
4159
@cindex @code{ms} macros, accent marks
4160
@cindex accent marks [@code{ms}]
4161
@cindex special characters [@code{ms}]
4162
@cindex strings [@code{ms}]
4164
The @file{ms} macros provide the following predefined strings. You can
4165
change the string definitions to help in creating documents in languages
4168
@Defstr {REFERENCES, ms}
4169
Contains the string printed at the beginning of the references
4170
(bibliography) page. The default is @samp{References}.
4173
@Defstr {ABSTRACT, ms}
4174
Contains the string printed at the beginning of the abstract. The
4175
default is @samp{ABSTRACT}.
4179
Contains the string printed at the beginning of the table of contents.
4182
@DefstrList {MONTH1, ms}
4183
@DefstrItem {MONTH2, ms}
4184
@DefstrItem {MONTH3, ms}
4185
@DefstrItem {MONTH4, ms}
4186
@DefstrItem {MONTH5, ms}
4187
@DefstrItem {MONTH6, ms}
4188
@DefstrItem {MONTH7, ms}
4189
@DefstrItem {MONTH8, ms}
4190
@DefstrItem {MONTH9, ms}
4191
@DefstrItem {MONTH10, ms}
4192
@DefstrItem {MONTH11, ms}
4193
@DefstrListEnd {MONTH12, ms}
4194
Prints the full name of the month in dates. The default is
4195
@samp{January}, @samp{February}, etc.
4198
The following special characters are available@footnote{For an
4199
explanation what special characters are see @ref{Special Characters}.}:
4206
@DefstrListEnd {U, ms}
4207
Prints typographer's quotes in troff, and plain quotes in nroff.
4208
@code{\*Q} is the left quote and @code{\*U} is the right quote.
4211
Improved accent marks are available in the @file{ms} macros.
4214
Specify this macro at the beginning of your document to enable extended
4215
accent marks and special characters. This is a Berkeley extension.
4217
To use the accent marks, place them @strong{after} the character being
4220
Note that groff's native support for accents is superior to the
4221
following definitions.
4224
The following accent marks are available after invoking the @code{AM}
4247
@deffn String @t{\*[:]}
4249
@stindex : @r{[}ms@r{]}
4252
@stindex \*[@r{<colon>}] @r{[}ms@r{]}
4273
The following are standalone characters available after invoking the
4277
Upside-down question mark.
4281
Upside-down exclamation point.
4313
Lowercase � ligature.
4317
Uppercase � ligature.
4320
@c ---------------------------------------------------------------------
4322
@node Differences from AT&T ms, Naming Conventions, ms Page Layout, ms
4323
@subsection Differences from @acronym{AT&T} @file{ms}
4324
@cindex @code{ms} macros, differences from @acronym{AT&T}
4325
@cindex @acronym{AT&T} @code{troff}, @code{ms} macro package differences
4327
This section lists the (minor) differences between the @code{groff -ms}
4328
macros and @acronym{AT&T} @code{troff -ms} macros.
4332
The internals of @code{groff -ms} differ from the internals of
4333
@acronym{AT&T} @code{troff -ms}. Documents that depend upon
4334
implementation details of @acronym{AT&T} @code{troff -ms} may not format
4335
properly with @code{groff -ms}.
4338
The general error-handling policy of @code{groff -ms} is to detect and
4339
report errors, rather than silently to ignore them.
4342
@code{groff -ms} does not work in compatibility mode (this is, with the
4343
@option{-C} option).
4346
There is no special support for typewriter-like devices.
4349
@code{groff -ms} does not provide cut marks.
4352
Multiple line spacing is not supported. Use a larger vertical spacing
4356
Some @acronym{UNIX} @code{ms} documentation says that the @code{CW} and
4357
@code{GW} number registers can be used to control the column width and
4358
gutter width, respectively. These number registers are not used in
4362
Macros that cause a reset (paragraphs, headings, etc.@:) may change the
4363
indentation. Macros that change the indentation do not increment or
4364
decrement the indentation, but rather set it absolutely. This can cause
4365
problems for documents that define additional macros of their own. The
4366
solution is to use not the @code{in} request but instead the @code{RS}
4367
and @code{RE} macros.
4370
To make @code{groff -ms} use the default page offset (which also
4371
specifies the left margin), the @code{PO} register must stay undefined
4372
until the first @file{-ms} macro is evaluated. This implies that
4373
@code{PO} should not be used early in the document, unless it is changed
4374
also: Remember that accessing an undefined register automatically
4379
This number register is set to@tie{}1 by the @code{groff -ms} macros,
4380
but it is not used by the @code{AT&T} @code{troff -ms} macros.
4381
Documents that need to determine whether they are being formatted with
4382
@code{AT&T} @code{troff -ms} or @code{groff -ms} should use this number
4386
Emulations of a few ancient Bell Labs macros can be re-enabled by
4387
calling the otherwise undocumented @code{SC} section-header macro.
4388
Calling @code{SC} enables @code{UC} for marking up a product or
4389
application name, and the pair @code{P1}/@code{P2} for surrounding code
4392
These are not enabled by default because (a)@tie{}they were not
4393
documented, in the original @code{ms} manual, and (b)@tie{}the @code{P1}
4394
and @code{UC} macros collide with different macros with the same names
4395
in the Berkeley version of @code{ms}.
4397
These @code{groff} emulations are sufficient to give back the 1976
4398
Kernighan@tie{}& Cherry paper @cite{Typsetting Mathematics -- User's
4399
Guide} its section headings, and restore some text that had gone missing
4400
as arguments of undefined macros. No warranty express or implied is
4401
given as to how well the typographic details these produce match the
4402
original Bell Labs macros.
4405
* Missing ms Macros::
4406
* Additional ms Macros::
4409
@c ---------------------------------------------------------------------
4411
@node Missing ms Macros, Additional ms Macros, Differences from AT&T ms, Differences from AT&T ms
4412
@subsubsection @code{troff} macros not appearing in @code{groff}
4414
Macros missing from @code{groff -ms} are cover page macros specific to
4415
Bell Labs and Berkeley. The macros known to be missing are:
4419
Technical memorandum; a cover sheet style
4422
Internal memorandum; a cover sheet style
4425
Memo for record; a cover sheet style
4428
Memo for file; a cover sheet style
4431
Engineer's notes; a cover sheet style
4434
Computing Science Tech Report; a cover sheet style
4440
Cover sheet information
4446
@c ---------------------------------------------------------------------
4448
@node Additional ms Macros, , Missing ms Macros, Differences from AT&T ms
4449
@subsubsection @code{groff} macros not appearing in @acronym{AT&T} @code{troff}
4451
The @code{groff -ms} macros have a few minor extensions compared to the
4452
@acronym{AT&T} @code{troff -ms} macros.
4455
Improved accent marks. @xref{ms Strings and Special Characters}, for
4459
@Defmac {DS, @t{I}, ms}
4460
Indented display. The default behavior of @acronym{AT&T} @code{troff
4461
-ms} was to indent; the @code{groff} default prints displays flush left
4466
Print text in @code{constant width} (Courier) font.
4470
Indexing term (printed on standard error). You can write a script to
4471
capture and process an index generated in this manner.
4474
The following additional number registers
4475
appear in @code{groff -ms}:
4477
@Defmpreg {MINGW, ms}
4478
Specifies a minimum space between columns (for multi-column output);
4479
this takes the place of the @code{GW} register that was documented but
4480
apparently not implemented in @acronym{AT&T} @code{troff}.
4483
Several new string registers are available as well. You can change
4484
these to handle (for example) the local language. @xref{ms Strings and
4485
Special Characters}, for details.
4487
@c ---------------------------------------------------------------------
4489
@node Naming Conventions, , Differences from AT&T ms, ms
4490
@subsection Naming Conventions
4491
@cindex @code{ms} macros, naming conventions
4492
@cindex naming conventions, @code{ms} macros
4494
The following conventions are used for names of macros, strings and
4495
number registers. External names available to documents that use the
4496
@code{groff -ms} macros contain only uppercase letters and digits.
4498
Internally the macros are divided into modules; naming conventions are
4503
Names used only within one module are of the form
4504
@var{module}@code{*}@var{name}.
4507
Names used outside the module in which they are defined are of the form
4508
@var{module}@code{@@}@var{name}.
4511
Names associated with a particular environment are of the form
4512
@var{environment}@code{:}@var{name}; these are used only within the
4516
@var{name} does not have a module prefix.
4519
Constructed names used to implement arrays are of the form
4520
@var{array}@code{!}@var{index}.
4523
Thus the groff ms macros reserve the following names:
4527
Names containing the characters @code{*}, @code{@@}, and@tie{}@code{:}.
4530
Names containing only uppercase letters and digits.
4534
@c =====================================================================
4536
@node me, mm, ms, Macro Packages
4538
@cindex @code{me} macro package
4540
@c XXX documentation
4541
@c XXX this is a placeholder until we get stuff knocked into shape
4542
See the @file{meintro.me} and @file{meref.me} documents in groff's
4543
@file{doc} directory.
4546
@c =====================================================================
4548
@node mm, mom, me, Macro Packages
4550
@cindex @code{mm} macro package
4552
@c XXX documentation
4553
@c XXX this is a placeholder until we get stuff knocked into shape
4554
See the @cite{groff_mm(7)} man page (type @command{man groff_mm} at the
4558
@c =====================================================================
4560
@node mom, , mm, Macro Packages
4562
@cindex @code{mom} macro package
4564
@c XXX documentation
4565
@c XXX this is a placeholder until we get stuff knocked into shape
4566
See the @cite{groff_mom(7)} man page (type @command{man groff_mom} at
4567
the command line), which gives a short overview and a link to its
4568
extensive documentation in HTML format.
4572
@c =====================================================================
4573
@c =====================================================================
4575
@node gtroff Reference, Preprocessors, Macro Packages, Top
4576
@chapter @code{gtroff} Reference
4577
@cindex reference, @code{gtroff}
4578
@cindex @code{gtroff}, reference
4580
This chapter covers @strong{all} of the facilities of @code{gtroff}.
4581
Users of macro packages may skip it if not interested in details.
4589
* Embedded Commands::
4591
* Manipulating Filling and Adjusting::
4592
* Manipulating Hyphenation::
4593
* Manipulating Spacing::
4595
* Character Translations::
4596
* Troff and Nroff Mode::
4601
* Fonts and Symbols::
4604
* Conditionals and Loops::
4607
* Drawing Requests::
4611
* Suppressing output::
4614
* Postprocessor Access::
4616
* Gtroff Internals::
4618
* Implementation Differences::
4622
@c =====================================================================
4624
@node Text, Measurements, gtroff Reference, gtroff Reference
4626
@cindex text, @code{gtroff} processing
4628
@code{gtroff} input files contain text with control commands
4629
interspersed throughout. But, even without control codes, @code{gtroff}
4630
still does several things with the input text:
4634
filling and adjusting
4637
adding additional space after sentences
4643
inserting implicit line breaks
4647
* Filling and Adjusting::
4651
* Implicit Line Breaks::
4652
* Input Conventions::
4656
@c ---------------------------------------------------------------------
4658
@node Filling and Adjusting, Hyphenation, Text, Text
4659
@subsection Filling and Adjusting
4663
When @code{gtroff} reads text, it collects words from the input and fits
4664
as many of them together on one output line as it can. This is known as
4667
@cindex leading spaces
4668
@cindex spaces, leading and trailing
4669
@cindex extra spaces
4670
@cindex trailing spaces
4671
Once @code{gtroff} has a @dfn{filled} line, it tries to @dfn{adjust} it.
4672
This means it widens the spacing between words until the text reaches
4673
the right margin (in the default adjustment mode). Extra spaces between
4674
words are preserved, but spaces at the end of lines are ignored. Spaces
4675
at the front of a line cause a @dfn{break} (breaks are explained in
4676
@ref{Implicit Line Breaks}).
4678
@xref{Manipulating Filling and Adjusting}.
4680
@c ---------------------------------------------------------------------
4682
@node Hyphenation, Sentences, Filling and Adjusting, Text
4683
@subsection Hyphenation
4686
Since the odds are not great for finding a set of words, for every
4687
output line, which fit nicely on a line without inserting excessive
4688
amounts of space between words, @code{gtroff} hyphenates words so that
4689
it can justify lines without inserting too much space between words. It
4690
uses an internal hyphenation algorithm (a simplified version of the
4691
algorithm used within @TeX{}) to indicate which words can be hyphenated
4692
and how to do so. When a word is hyphenated, the first part of the word
4693
is added to the current filled line being output (with an attached
4694
hyphen), and the other portion is added to the next line to be filled.
4696
@xref{Manipulating Hyphenation}.
4698
@c ---------------------------------------------------------------------
4700
@node Sentences, Tab Stops, Hyphenation, Text
4701
@subsection Sentences
4704
Although it is often debated, some typesetting rules say there should be
4705
different amounts of space after various punctuation marks. For
4706
example, the @cite{Chicago typsetting manual} says that a period at the
4707
end of a sentence should have twice as much space following it as would
4708
a comma or a period as part of an abbreviation.
4710
@c XXX exact citation of Chicago manual
4712
@cindex sentence space
4713
@cindex space between sentences
4714
@cindex french-spacing
4715
@code{gtroff} does this by flagging certain characters (normally
4716
@samp{!}, @samp{?}, and @samp{.}) as @dfn{end-of-sentence} characters.
4717
When @code{gtroff} encounters one of these characters at the end of a
4718
line, it appends a normal space followed by a @dfn{sentence space} in
4719
the formatted output. (This justifies one of the conventions mentioned
4720
in @ref{Input Conventions}.)
4722
@cindex transparent characters
4723
@cindex character, transparent
4724
@cindex @code{dg} glyph, at end of sentence
4725
@cindex @code{rq} glyph, at end of sentence
4726
@cindex @code{"}, at end of sentence
4727
@cindex @code{'}, at end of sentence
4728
@cindex @code{)}, at end of sentence
4729
@cindex @code{]}, at end of sentence
4730
@cindex @code{*}, at end of sentence
4731
In addition, the following characters and symbols are treated
4732
transparently while handling end-of-sentence characters: @samp{"},
4733
@samp{'}, @samp{)}, @samp{]}, @samp{*}, @code{\[dg]}, and @code{\[rq]}.
4735
See the @code{cflags} request in @ref{Using Symbols}, for more details.
4737
@cindex @code{\&}, at end of sentence
4738
To prevent the insertion of extra space after an end-of-sentence
4739
character (at the end of a line), append @code{\&}.
4741
@c ---------------------------------------------------------------------
4743
@node Tab Stops, Implicit Line Breaks, Sentences, Text
4744
@subsection Tab Stops
4746
@cindex stops, tabulator
4747
@cindex tab character
4748
@cindex character, tabulator
4750
@cindex @acronym{EBCDIC} encoding
4751
@cindex encoding, @acronym{EBCDIC}
4752
@code{gtroff} translates @dfn{tabulator characters}, also called
4753
@dfn{tabs} (normally code point @acronym{ASCII} @code{0x09} or
4754
@acronym{EBCDIC} @code{0x05}), in the input into movements to the next
4755
tabulator stop. These tab stops are initially located every half inch
4756
across the page. Using this, simple tables can be made easily.
4757
However, it can often be deceptive as the appearance (and width) of the
4758
text on a terminal and the results from @code{gtroff} can vary greatly.
4760
Also, a possible sticking point is that lines beginning with tab
4761
characters are still filled, again producing unexpected results. For
4762
example, the following input
4764
@multitable {12345678} {12345678} {12345678} {12345678}
4766
@tab 1 @tab 2 @tab 3
4774
@multitable {12345678} {12345678} {12345678} {12345678} {12345678} {12345678} {12345678}
4776
@tab 1 @tab 2 @tab 3 @tab @tab 4 @tab 5
4779
@xref{Tabs and Fields}.
4781
@c ---------------------------------------------------------------------
4783
@node Implicit Line Breaks, Input Conventions, Tab Stops, Text
4784
@subsection Implicit Line Breaks
4785
@cindex implicit line breaks
4786
@cindex implicit breaks of lines
4787
@cindex line, implicit breaks
4788
@cindex break, implicit
4791
An important concept in @code{gtroff} is the @dfn{break}. When a break
4792
occurs, @code{gtroff} outputs the partially filled line (unjustified),
4793
and resumes collecting and filling text on the next output line.
4798
@cindex blank line macro (@code{blm})
4799
There are several ways to cause a break in @code{gtroff}. A blank line
4800
not only causes a break, but it also outputs a one-line vertical space
4801
(effectively a blank line). Note that this behaviour can be modified
4802
with the blank line macro request @code{blm}. @xref{Blank Line Traps}.
4806
@cindex leading spaces macro (@code{lsm})
4807
A line that begins with a space causes a break and the space is output
4808
at the beginning of the next line. Note that this space isn't adjusted,
4809
even in fill mode; however, the behaviour can be modified with the
4810
leading spaces macro request @code{lsm}. @xref{Leading Spaces Traps}.
4812
The end of file also causes a break -- otherwise the last line of the
4813
document may vanish!
4815
Certain requests also cause breaks, implicitly or explicitly. This is
4816
discussed in @ref{Manipulating Filling and Adjusting}.
4818
@c ---------------------------------------------------------------------
4820
@node Input Conventions, Input Encodings, Implicit Line Breaks, Text
4821
@subsection Input Conventions
4822
@cindex input conventions
4823
@cindex conventions for input
4825
Since @code{gtroff} does filling automatically, it is traditional in
4826
@code{groff} not to try and type things in as nicely formatted
4827
paragraphs. These are some conventions commonly used when typing
4832
Break lines after punctuation, particularly at the end of a sentence and
4833
in other logical places. Keep separate phrases on lines by themselves,
4834
as entire phrases are often added or deleted when editing.
4837
Try to keep lines less than 40-60@tie{}characters, to allow space for
4838
inserting more text.
4841
Do not try to do any formatting in a @acronym{WYSIWYG} manner (i.e.,
4842
don't try using spaces to get proper indentation).
4845
@c ---------------------------------------------------------------------
4847
@node Input Encodings, , Input Conventions, Text
4848
@subsection Input Encodings
4850
Currently, the following input encodings are available.
4854
@cindex encoding, input, @acronym{EBCDIC}
4855
@cindex @acronym{EBCDIC}, input encoding
4856
@cindex input encoding, @acronym{EBCDIC}
4857
@cindex encoding, input, cp1047
4858
@cindex cp1047, input encoding
4859
@cindex input encoding, cp1047
4860
@cindex IBM cp1047 input encoding
4862
This input encoding works only on @acronym{EBCDIC} platforms (and vice
4863
versa, the other input encodings don't work with @acronym{EBCDIC}); the
4864
file @file{cp1047.tmac} is by default loaded at start-up.
4867
@cindex encoding, input, @w{latin-1} (ISO @w{8859-1})
4868
@cindex @w{latin-1} (ISO @w{8859-1}), input encoding
4869
@cindex ISO @w{8859-1} (@w{latin-1}), input encoding
4870
@cindex input encoding, @w{latin-1} (ISO @w{8859-1})
4872
This is the default input encoding on non-@acronym{EBCDIC} platforms;
4873
the file @file{latin1.tmac} is loaded at start-up.
4876
@cindex encoding, input, @w{latin-2} (ISO @w{8859-2})
4877
@cindex @w{latin-2} (ISO @w{8859-2}), input encoding
4878
@cindex ISO @w{8859-2} (@w{latin-2}), input encoding
4879
@cindex input encoding, @w{latin-2} (ISO @w{8859-2})
4881
To use this encoding, either say @w{@samp{.mso latin2.tmac}} at the very
4882
beginning of your document or use @samp{-mlatin2} as a command line
4883
argument for @code{groff}.
4886
@cindex encoding, input, @w{latin-5} (ISO @w{8859-9})
4887
@cindex @w{latin-2} (ISO @w{8859-9}), input encoding
4888
@cindex ISO @w{8859-9} (@w{latin-2}), input encoding
4889
@cindex input encoding, @w{latin-2} (ISO @w{8859-9})
4891
For Turkish. Either say @w{@samp{.mso latin9.tmac}} at the very
4892
beginning of your document or use @samp{-mlatin9} as a command line
4893
argument for @code{groff}.
4895
@item latin-9 (latin-0)
4896
@cindex encoding, input, @w{latin-9} (@w{latin-0}, ISO @w{8859-15})
4897
@cindex @w{latin-9} (@w{latin-0}, ISO @w{8859-15}), input encoding
4898
@cindex ISO @w{8859-15} (@w{latin-9}, @w{latin-0}), input encoding
4899
@cindex input encoding, @w{latin-9} (@w{latin-9}, ISO @w{8859-15})
4901
This encoding is intended (at least in Europe) to replace @w{latin-1}
4902
encoding. The main difference to @w{latin-1} is that @w{latin-9}
4903
contains the Euro character. To use this encoding, either say
4904
@w{@samp{.mso latin9.tmac}} at the very beginning of your document or
4905
use @samp{-mlatin9} as a command line argument for @code{groff}.
4908
Note that it can happen that some input encoding characters are not
4909
available for a particular output device. For example, saying
4912
groff -Tlatin1 -mlatin9 ...
4916
fails if you use the Euro character in the input. Usually, this
4917
limitation is present only for devices which have a limited set of
4918
output glyphs (e.g.@: @option{-Tascii} and @option{-Tlatin1}); for other
4919
devices it is usually sufficient to install proper fonts which contain
4920
the necessary glyphs.
4922
@pindex freeeuro.pfa
4924
Due to the importance of the Euro glyph in Europe, the groff package now
4925
comes with a @sc{PostScript} font called @file{freeeuro.pfa} which
4926
provides various glyph shapes for the Euro. In other words,
4927
@w{latin-9} encoding is supported for the @option{-Tps} device out of
4928
the box (@w{latin-2} isn't).
4930
By its very nature, @option{-Tutf8} supports all input encodings;
4931
@option{-Tdvi} has support for both @w{latin-2} and @w{latin-9} if the
4932
command line @option{-mec} is used also to load the file @file{ec.tmac}
4933
(which flips to the EC fonts).
4936
@c =====================================================================
4938
@node Measurements, Expressions, Text, gtroff Reference
4939
@section Measurements
4940
@cindex measurements
4941
@cindex scaling indicator
4942
@cindex indicator, scaling
4944
@cindex units of measurement
4945
@cindex basic unit (@code{u})
4946
@cindex machine unit (@code{u})
4947
@cindex measurement unit
4948
@cindex @code{u} unit
4949
@cindex unit, @code{u}
4950
@code{gtroff} (like many other programs) requires numeric parameters to
4951
specify various measurements. Most numeric parameters@footnote{those
4952
that specify vertical or horizontal motion or a type size} may have a
4953
@dfn{measurement unit} attached. These units are specified as a single
4954
character which immediately follows the number or expression. Each of
4955
these units are understood, by @code{gtroff}, to be a multiple of its
4956
@dfn{basic unit}. So, whenever a different measurement unit is
4957
specified @code{gtroff} converts this into its @dfn{basic units}. This
4958
basic unit, represented by a @samp{u}, is a device dependent measurement
4959
which is quite small, ranging from 1/75@dmn{th} to 1/72000@dmn{th} of an
4960
inch. The values may be given as fractional numbers; however,
4961
fractional basic units are always rounded to integers.
4963
Some of the measurement units are completely independent of any of the
4964
current settings (e.g.@: type size) of @code{gtroff}.
4968
@cindex inch unit (@code{i})
4969
@cindex @code{i} unit
4970
@cindex unit, @code{i}
4971
Inches. An antiquated measurement unit still in use in certain
4972
backwards countries with incredibly low-cost computer equipment. One
4973
inch is equal to@tie{}2.54@dmn{cm}.
4976
@cindex centimeter unit (@code{c})
4977
@cindex @code{c} unit
4978
@cindex unit, @code{c}
4979
Centimeters. One centimeter is equal to@tie{}0.3937@dmn{in}.
4982
@cindex point unit (@code{p})
4983
@cindex @code{p} unit
4984
@cindex unit, @code{p}
4985
Points. This is a typesetter's measurement used for measure type size.
4986
It is 72@tie{}points to an inch.
4989
@cindex pica unit (@code{P})
4990
@cindex @code{P} unit
4991
@cindex unit, @code{P}
4992
Pica. Another typesetting measurement. 6@tie{}Picas to an inch (and
4993
12@tie{}points to a pica).
4997
@cindex @code{s} unit
4998
@cindex unit, @code{s}
4999
@cindex @code{z} unit
5000
@cindex unit, @code{z}
5001
@xref{Fractional Type Sizes}, for a discussion of these units.
5004
@cindex @code{f} unit
5005
@cindex unit, @code{f}
5006
Fractions. Value is 65536.
5007
@xref{Colors}, for usage.
5010
The other measurements understood by @code{gtroff} depend on settings
5011
currently in effect in @code{gtroff}. These are very useful for
5012
specifying measurements which should look proper with any size of text.
5016
@cindex em unit (@code{m})
5017
@cindex @code{m} unit
5018
@cindex unit, @code{m}
5019
Ems. This unit is equal to the current font size in points. So called
5020
because it is @emph{approximately} the width of the letter@tie{}@samp{m}
5021
in the current font.
5024
@cindex en unit (@code{n})
5025
@cindex @code{n} unit
5026
@cindex unit, @code{n}
5027
Ens. In @code{groff}, this is half of an em.
5030
@cindex vertical space unit (@code{v})
5031
@cindex space, vertical, unit (@code{v})
5032
@cindex @code{v} unit
5033
@cindex unit, @code{v}
5034
Vertical space. This is equivalent to the current line spacing.
5035
@xref{Sizes}, for more information about this.
5038
@cindex @code{M} unit
5039
@cindex unit, @code{M}
5047
@c ---------------------------------------------------------------------
5049
@node Default Units, , Measurements, Measurements
5050
@subsection Default Units
5051
@cindex default units
5052
@cindex units, default
5054
Many requests take a default unit. While this can be helpful at times,
5055
it can cause strange errors in some expressions. For example, the line
5056
length request expects em units. Here are several attempts to get a
5057
line length of 3.5@tie{}inches and their results:
5063
(7 / 2)u @result{} 0i
5065
7i/2u @result{} 3.5i
5069
Everything is converted to basic units first. In the above example it
5070
is assumed that 1@dmn{i} equals@tie{}240@dmn{u}, and 1@dmn{m}
5071
equals@tie{}10@dmn{p} (thus 1@dmn{m} equals@tie{}33@dmn{u}). The value
5072
7@dmn{i}/2 is first handled as 7@dmn{i}/2@dmn{m}, then converted to
5073
1680@dmn{u}/66@dmn{u} which is 25@dmn{u}, and this is approximately
5074
0.1@dmn{i}. As can be seen, a scaling indicator after a closing
5075
parenthesis is simply ignored.
5077
@cindex measurements, specifying safely
5078
Thus, the safest way to specify measurements is to always attach a
5079
scaling indicator. If you want to multiply or divide by a certain
5080
scalar value, use @samp{u} as the unit for that value.
5083
@c =====================================================================
5085
@node Expressions, Identifiers, Measurements, gtroff Reference
5086
@section Expressions
5089
@code{gtroff} has most arithmetic operators common to other languages:
5093
@cindex arithmetic operators
5094
@cindex operators, arithmetic
5100
Arithmetic: @samp{+} (addition), @samp{-} (subtraction), @samp{/}
5101
(division), @samp{*} (multiplication), @samp{%} (modulo).
5103
@code{gtroff} only provides integer arithmetic. The internal type used
5104
for computing results is @samp{int}, which is usually a 32@dmn{bit}
5108
@cindex comparison operators
5109
@cindex operators, comparison
5116
Comparison: @samp{<} (less than), @samp{>} (greater than), @samp{<=}
5117
(less than or equal), @samp{>=} (greater than or equal), @samp{=}
5118
(equal), @samp{==} (the same as @samp{=}).
5121
@cindex logical operators
5122
@cindex operators, logical
5128
@opindex @r{<colon>}
5130
Logical: @samp{&} (logical and), @samp{:} (logical or).
5133
@cindex unary operators
5134
@cindex operators, unary
5138
@cindex @code{if} request, and the @samp{!} operator
5139
@cindex @code{while} request, and the @samp{!} operator
5140
Unary operators: @samp{-} (negating, i.e.@: changing the sign), @samp{+}
5141
(just for completeness; does nothing in expressions), @samp{!} (logical
5142
not; this works only within @code{if} and @code{while}
5143
requests).@footnote{Note that, for example, @samp{!(-1)} evaluates to
5144
`true' because @code{gtroff} treats both negative numbers and zero as
5145
`false'.} See below for the use of unary operators in motion requests.
5147
@cindex logical not, limitation in expression
5148
@cindex expression, limitation of logical not in
5149
The logical not operator,
5151
works only within @code{if} and @code{while} requests.
5152
Furthermore, it may appear
5153
only at the beginning of an expression,
5154
and negates the entire expression.
5155
Attempting to insert the @samp{!} operator
5156
within the expression results in a
5157
@samp{numeric expression expected} warning. This
5158
maintains compatibility
5159
with old versions of @code{troff}.
5166
.\" This does not work as expected
5167
.if (\n[X])&(!\n[Y]) .nop X only
5169
.\" Use this construct instead
5170
.if (\n[X]=1)&(\n[Y]=0) .nop X only
5174
@cindex extremum operators (@code{>?}, @code{<?})
5175
@cindex operators, extremum (@code{>?}, @code{<?})
5178
Extrema: @samp{>?} (maximum), @samp{<?} (minimum).
5185
.nr z (\n[x] >? \n[y])
5189
The register@tie{}@code{z} now contains@tie{}5.
5192
@cindex scaling operator
5193
@cindex operator, scaling
5194
Scaling: @code{(@var{c};@var{e})}. Evaluate@tie{}@var{e}
5195
using@tie{}@var{c} as the default scaling indicator. If @var{c} is
5196
missing, ignore scaling indicators in the evaluation of@tie{}@var{e}.
5200
@cindex order of evaluation in expressions
5201
@cindex expression, order of evaluation
5204
Parentheses may be used as in any other language. However, in
5205
@code{gtroff} they are necessary to ensure order of evaluation.
5206
@code{gtroff} has no operator precedence; expressions are evaluated left
5207
to right. This means that @code{gtroff} evaluates @samp{3+5*4} as if it
5208
were parenthesized like @samp{(3+5)*4}, not as @samp{3+(5*4)}, as might
5211
@cindex @code{+}, and page motion
5212
@cindex @code{-}, and page motion
5213
@cindex motion operators
5214
@cindex operators, motion
5215
For many requests which cause a motion on the page, the unary operators
5216
@samp{+} and @samp{-} work differently if leading an expression. They
5217
then indicate a motion relative to the current position (down or up,
5220
@cindex @code{|}, and page motion
5221
@cindex absolute position operator (@code{|})
5222
@cindex position, absolute, operator (@code{|})
5223
Similarly, a leading @samp{|} operator indicates an absolute position.
5224
For vertical movements, it specifies the distance from the top of the
5225
page; for horizontal movements, it gives the distance from the beginning
5226
of the @emph{input} line.
5228
@cindex @code{bp} request, using @code{+} and@tie{}@code{-}
5229
@cindex @code{in} request, using @code{+} and@tie{}@code{-}
5230
@cindex @code{ll} request, using @code{+} and@tie{}@code{-}
5231
@cindex @code{lt} request, using @code{+} and@tie{}@code{-}
5232
@cindex @code{nm} request, using @code{+} and@tie{}@code{-}
5233
@cindex @code{nr} request, using @code{+} and@tie{}@code{-}
5234
@cindex @code{pl} request, using @code{+} and@tie{}@code{-}
5235
@cindex @code{pn} request, using @code{+} and@tie{}@code{-}
5236
@cindex @code{po} request, using @code{+} and@tie{}@code{-}
5237
@cindex @code{ps} request, using @code{+} and@tie{}@code{-}
5238
@cindex @code{pvs} request, using @code{+} and@tie{}@code{-}
5239
@cindex @code{rt} request, using @code{+} and@tie{}@code{-}
5240
@cindex @code{ti} request, using @code{+} and@tie{}@code{-}
5241
@cindex @code{\H}, using @code{+} and@tie{}@code{-}
5242
@cindex @code{\R}, using @code{+} and@tie{}@code{-}
5243
@cindex @code{\s}, using @code{+} and@tie{}@code{-}
5244
@samp{+} and @samp{-} are also treated differently by the following
5245
requests and escapes: @code{bp}, @code{in}, @code{ll}, @code{lt},
5246
@code{nm}, @code{nr}, @code{pl}, @code{pn}, @code{po}, @code{ps},
5247
@code{pvs}, @code{rt}, @code{ti}, @code{\H}, @code{\R}, and @code{\s}.
5248
Here, leading plus and minus signs indicate increments and decrements.
5250
@xref{Setting Registers}, for some examples.
5252
@Defesc {\\B, ', anything, '}
5253
@cindex numeric expression, valid
5254
@cindex valid numeric expression
5255
Return@tie{}1 if @var{anything} is a valid numeric expression; or@tie{}0
5256
if @var{anything} is empty or not a valid numeric expression.
5259
@cindex space characters, in expressions
5260
@cindex expressions, and space characters
5261
Due to the way arguments are parsed, spaces are not allowed in
5262
expressions, unless the entire expression is surrounded by parentheses.
5264
@xref{Request and Macro Arguments}, and @ref{Conditionals and Loops}.
5267
@c =====================================================================
5269
@node Identifiers, Embedded Commands, Expressions, gtroff Reference
5270
@section Identifiers
5273
Like any other language, @code{gtroff} has rules for properly formed
5274
@dfn{identifiers}. In @code{gtroff}, an identifier can be made up of
5275
almost any printable character, with the exception of the following
5280
@cindex whitespace characters
5281
@cindex newline character
5282
@cindex character, whitespace
5283
Whitespace characters (spaces, tabs, and newlines).
5286
@cindex character, backspace
5287
@cindex backspace character
5288
@cindex @acronym{EBCDIC} encoding of backspace
5289
Backspace (@acronym{ASCII}@tie{}@code{0x08} or
5290
@acronym{EBCDIC}@tie{}@code{0x16}) and character code @code{0x01}.
5293
@cindex invalid input characters
5294
@cindex input characters, invalid
5295
@cindex characters, invalid input
5297
The following input characters are invalid and are ignored if
5298
@code{groff} runs on a machine based on @acronym{ASCII}, causing a
5299
warning message of type @samp{input} (see @ref{Debugging}, for more
5300
details): @code{0x00}, @code{0x0B}, @code{0x0D}-@code{0x1F},
5301
@code{0x80}-@code{0x9F}.
5303
And here are the invalid input characters if @code{groff} runs on an
5304
@acronym{EBCDIC} host: @code{0x00}, @code{0x08}, @code{0x09},
5305
@code{0x0B}, @code{0x0D}-@code{0x14}, @code{0x17}-@code{0x1F},
5306
@code{0x30}-@code{0x3F}.
5308
Currently, some of these reserved codepoints are used internally, thus
5309
making it non-trivial to extend @code{gtroff} to cover Unicode or other
5310
character sets and encodings which use characters of these ranges.
5312
Note that invalid characters are removed before parsing; an identifier
5313
@code{foo}, followed by an invalid character, followed by @code{bar} is
5314
treated as @code{foobar}.
5317
For example, any of the following is valid.
5327
@cindex @code{]}, as part of an identifier
5329
Note that identifiers longer than two characters with a closing bracket
5330
(@samp{]}) in its name can't be accessed with escape sequences which
5331
expect an identifier as a parameter. For example, @samp{\[foo]]}
5332
accesses the glyph @samp{foo}, followed by @samp{]}, whereas
5333
@samp{\C'foo]'} really asks for glyph @samp{foo]}.
5335
@cindex @code{refer}, and macro names starting with @code{[} or @code{]}
5336
@cindex @code{[}, macro names starting with, and @code{refer}
5337
@cindex @code{]}, macro names starting with, and @code{refer}
5338
@cindex macro names, starting with @code{[} or @code{]}, and @code{refer}
5339
To avoid problems with the @code{refer} preprocessor, macro names should
5340
not start with @samp{[} or @samp{]}. Due to backwards compatibility,
5341
everything after @samp{.[} and @samp{.]} is handled as a special
5342
argument to @code{refer}. For example, @samp{.[foo} makes @code{refer}
5343
to start a reference, using @samp{foo} as a parameter.
5345
@Defesc {\\A, ', ident, '}
5346
Test whether an identifier @var{ident} is valid in @code{gtroff}. It
5347
expands to the character@tie{}1 or@tie{}0 according to whether its
5348
argument (usually delimited by quotes) is or is not acceptable as the
5349
name of a string, macro, diversion, number register, environment, or
5350
font. It returns@tie{}0 if no argument is given. This is useful for
5351
looking up user input in some sort of associative table.
5359
@xref{Escapes}, for details on parameter delimiting characters.
5361
Identifiers in @code{gtroff} can be any length, but, in some contexts,
5362
@code{gtroff} needs to be told where identifiers end and text begins
5363
(and in different ways depending on their length):
5369
@cindex @code{(}, starting a two-character identifier
5371
Two characters. Must be prefixed with @samp{(} in some situations.
5373
@cindex @code{[}, starting an identifier
5374
@cindex @code{]}, ending an identifier
5376
Arbitrary length (@code{gtroff} only). Must be bracketed with @samp{[}
5377
and@tie{}@samp{]} in some situations. Any length identifier can be put
5381
@cindex undefined identifiers
5382
@cindex identifiers, undefined
5383
Unlike many other programming languages, undefined identifiers are
5384
silently ignored or expanded to nothing. When @code{gtroff} finds an
5385
undefined identifier, it emits a warning, doing the following:
5389
If the identifier is a string, macro, or diversion, @code{gtroff}
5390
defines it as empty.
5393
If the identifier is a number register, @code{gtroff} defines it with a
5397
@xref{Warnings}., @ref{Interpolating Registers}, and @ref{Strings}.
5399
Note that macros, strings, and diversions share the same name space.
5416
As can be seen in the previous example, @code{gtroff} reuses the
5417
identifier @samp{xxx}, changing it from a macro to a diversion. No
5418
warning is emitted! The contents of the first macro definition is lost.
5420
@xref{Interpolating Registers}, and @ref{Strings}.
5423
@c =====================================================================
5425
@node Embedded Commands, Registers, Identifiers, gtroff Reference
5426
@section Embedded Commands
5427
@cindex embedded commands
5428
@cindex commands, embedded
5430
Most documents need more functionality beyond filling, adjusting and
5431
implicit line breaking. In order to gain further functionality,
5432
@code{gtroff} allows commands to be embedded into the text, in two ways.
5434
The first is a @dfn{request} which takes up an entire line, and does
5435
some large-scale operation (e.g.@: break lines, start new pages).
5437
The other is an @dfn{escape} which can be usually embedded anywhere in
5438
the text; most requests can accept it even as an argument. Escapes
5439
generally do more minor operations like sub- and superscripts, print a
5448
@c ---------------------------------------------------------------------
5450
@node Requests, Macros, Embedded Commands, Embedded Commands
5451
@subsection Requests
5454
@cindex control character (@code{.})
5455
@cindex character, control (@code{.})
5456
@cindex no-break control character (@code{'})
5457
@cindex character, no-break control (@code{'})
5458
@cindex control character, no-break (@code{'})
5459
A request line begins with a control character, which is either a single
5460
quote (@samp{'}, the @dfn{no-break control character}) or a period
5461
(@samp{.}, the normal @dfn{control character}). These can be changed;
5462
see @ref{Character Translations}, for details. After this there may be
5463
optional tabs or spaces followed by an identifier which is the name of
5464
the request. This may be followed by any number of space-separated
5465
arguments (@emph{no} tabs here).
5467
@cindex structuring source code of documents or macro packages
5468
@cindex documents, structuring the source code
5469
@cindex macro packages, structuring the source code
5470
Since a control character followed by whitespace only is ignored, it is
5471
common practice to use this feature for structuring the source code of
5472
documents or macro packages.
5486
@cindex blank line macro (@code{blm})
5487
Another possibility is to use the blank line macro request @code{blm} by
5488
assigning an empty macro to it.
5493
.blm do-nothing \" activate blank line macro
5504
.blm \" deactivate blank line macro
5507
@xref{Blank Line Traps}.
5509
@cindex zero width space character (@code{\&})
5510
@cindex character, zero width space (@code{\&})
5511
@cindex space character, zero width (@code{\&})
5512
@cindex @code{\&}, escaping control characters
5513
To begin a line with a control character without it being interpreted,
5514
precede it with @code{\&}. This represents a zero width space, which
5515
means it does not affect the output.
5517
In most cases the period is used as a control character. Several
5518
requests cause a break implicitly; using the single quote control
5519
character prevents this.
5522
A read-only number register which is set to@tie{}1 if a macro is called
5523
with the normal control character (as defined with the @code{cc}
5524
request), and set to@tie{}0 otherwise.
5526
@cindex modifying requests
5527
@cindex requests, modifying
5528
This allows to reliably modify requests.
5534
. ie \\n[.br] .bp*orig
5540
Using this register outside of a macro makes no sense (it always returns
5541
zero in such cases).
5543
If a macro is called as a string (this is, using @code{\*}), the value
5544
of the @code{.br} register is inherited from the calling macro.
5548
* Request and Macro Arguments::
5551
@node Request and Macro Arguments, , Requests, Requests
5552
@subsubsection Request and Macro Arguments
5553
@cindex request arguments
5554
@cindex macro arguments
5555
@cindex arguments to requests and macros
5557
@cindex tabs, and macro arguments
5558
@cindex macro arguments, and tabs
5559
@cindex arguments to macros, and tabs
5560
Arguments to requests and macros are processed much like the shell:
5561
The line is split into arguments according to
5562
spaces.@footnote{Plan@tie{}9's @code{troff} implementation also allows
5563
tabs for argument separation -- @code{gtroff} intentionally doesn't
5566
@cindex spaces, in a macro argument
5567
An argument to a macro which is intended to contain spaces can either be
5568
enclosed in double quotes, or have the spaces @dfn{escaped} with
5569
backslashes. This is @emph{not} true for requests.
5571
Here are a few examples for a hypothetical macro @code{uh}:
5574
.uh The Mouse Problem
5575
.uh "The Mouse Problem"
5576
.uh The\ Mouse\ Problem
5579
@cindex @code{\~}, difference to @code{\@key{SP}}
5580
@cindex @code{\@key{SP}}, difference to @code{\~}
5582
The first line is the @code{uh} macro being called with 3 arguments,
5583
@samp{The}, @samp{Mouse}, and @samp{Problem}. The latter two have the
5584
same effect of calling the @code{uh} macro with one argument, @samp{The
5585
Mouse Problem}.@footnote{The last solution, i.e., using escaped spaces,
5586
is ``classical'' in the sense that it can be found in most @code{troff}
5587
documents. Nevertheless, it is not optimal in all situations, since
5588
@w{@samp{\ }} inserts a fixed-width, non-breaking space character which
5589
can't stretch. @code{gtroff} provides a different command @code{\~} to
5590
insert a stretchable, non-breaking space.}
5592
@cindex @code{"}, in a macro argument
5593
@cindex double quote, in a macro argument
5594
A double quote which isn't preceded by a space doesn't start a macro
5595
argument. If not closing a string, it is printed literally.
5600
.xxx a" "b c" "de"fg"
5604
has the arguments @samp{a"}, @w{@samp{b c}}, @samp{de}, and @samp{fg"}.
5605
Don't rely on this obscure behaviour!
5607
There are two possibilities to get a double quote reliably.
5611
Enclose the whole argument with double quotes and use two consecutive
5612
double quotes to represent a single one. This traditional solution has
5613
the disadvantage that double quotes don't survive argument expansion
5614
again if called in compatibility mode (using the @option{-C} option of
5619
. tm xx: `\\$1' `\\$2' `\\$3'
5621
. yy "\\$1" "\\$2" "\\$3"
5624
. tm yy: `\\$1' `\\$2' `\\$3'
5626
.xx A "test with ""quotes""" .
5627
@result{} xx: `A' `test with "quotes"' `.'
5628
@result{} yy: `A' `test with ' `quotes""'
5632
If not in compatibility mode, you get the expected result
5635
xx: `A' `test with "quotes"' `.'
5636
yy: `A' `test with "quotes"' `.'
5640
since @code{gtroff} preserves the input level.
5643
Use the double quote glyph @code{\(dq}. This works with and without
5644
compatibility mode enabled since @code{gtroff} doesn't convert
5645
@code{\(dq} back to a double quote input character.
5647
Note that this method won't work with @acronym{UNIX} @code{troff} in
5648
general since the glyph `dq' isn't defined normally.
5651
@cindex @code{ds} request, and double quotes
5652
Double quotes in the @code{ds} request are handled differently.
5653
@xref{Strings}, for more details.
5655
@c ---------------------------------------------------------------------
5657
@node Macros, Escapes, Requests, Embedded Commands
5661
@code{gtroff} has a @dfn{macro} facility for defining a series of lines
5662
which can be invoked by name. They are called in the same manner as
5663
requests -- arguments also may be passed basically in the same manner.
5665
@xref{Writing Macros}, and @ref{Request and Macro Arguments}.
5667
@c ---------------------------------------------------------------------
5669
@node Escapes, , Macros, Embedded Commands
5673
Escapes may occur anywhere in the input to @code{gtroff}. They usually
5674
begin with a backslash and are followed by a single character which
5675
indicates the function to be performed. The escape character can be
5676
changed; see @ref{Character Translations}.
5678
Escape sequences which require an identifier as a parameter accept three
5679
possible syntax forms.
5683
The next single character is the identifier.
5685
@cindex @code{(}, starting a two-character identifier
5687
If this single character is an opening parenthesis, take the following
5688
two characters as the identifier. Note that there is no closing
5689
parenthesis after the identifier.
5691
@cindex @code{[}, starting an identifier
5692
@cindex @code{]}, ending an identifier
5694
If this single character is an opening bracket, take all characters
5695
until a closing bracket as the identifier.
5707
@cindex @code{'}, delimiting arguments
5708
@cindex argument delimiting characters
5709
@cindex characters, argument delimiting
5710
@cindex delimiting characters for arguments
5711
Other escapes may require several arguments and/or some special format.
5712
In such cases the argument is traditionally enclosed in single quotes
5713
(and quotes are always used in this manual for the definitions of escape
5714
sequences). The enclosed text is then processed according to what that
5715
escape expects. Example:
5721
@cindex @code{\o}, possible quote characters
5722
@cindex @code{\b}, possible quote characters
5723
@cindex @code{\X}, possible quote characters
5724
Note that the quote character can be replaced with any other character
5725
which does not occur in the argument (even a newline or a space
5726
character) in the following escapes: @code{\o}, @code{\b}, and
5727
@code{\X}. This makes e.g.
5736
@result{} A caf� in Paris
5740
possible, but it is better not to use this feature to avoid confusion.
5742
@cindex @code{\%}, used as delimiter
5743
@cindex @code{\@key{SP}}, used as delimiter
5744
@cindex @code{\|}, used as delimiter
5745
@cindex @code{\^}, used as delimiter
5746
@cindex @code{\@{}, used as delimiter
5747
@cindex @code{\@}}, used as delimiter
5748
@cindex @code{\'}, used as delimiter
5749
@cindex @code{\`}, used as delimiter
5750
@cindex @code{\-}, used as delimiter
5751
@cindex @code{\_}, used as delimiter
5752
@cindex @code{\!}, used as delimiter
5753
@cindex @code{\?}, used as delimiter
5754
@cindex @code{\)}, used as delimiter
5755
@cindex @code{\/}, used as delimiter
5756
@cindex @code{\,}, used as delimiter
5757
@cindex @code{\&}, used as delimiter
5759
@cindex @code{\:}, used as delimiter
5762
@cindex @code{\@r{<colon>}}, used as delimiter
5764
@cindex @code{\~}, used as delimiter
5765
@cindex @code{\0}, used as delimiter
5766
@cindex @code{\a}, used as delimiter
5767
@cindex @code{\c}, used as delimiter
5768
@cindex @code{\d}, used as delimiter
5769
@cindex @code{\e}, used as delimiter
5770
@cindex @code{\E}, used as delimiter
5771
@cindex @code{\p}, used as delimiter
5772
@cindex @code{\r}, used as delimiter
5773
@cindex @code{\t}, used as delimiter
5774
@cindex @code{\u}, used as delimiter
5775
The following escapes sequences (which are handled similarly to
5776
characters since they don't take a parameter) are also allowed as
5777
delimiters: @code{\%}, @w{@samp{\ }}, @code{\|}, @code{\^}, @code{\@{},
5778
@code{\@}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
5779
@code{\?}, @code{\)}, @code{\/}, @code{\,}, @code{\&}, @code{\:},
5780
@code{\~}, @code{\0}, @code{\a}, @code{\c}, @code{\d}, @code{\e},
5781
@code{\E}, @code{\p}, @code{\r}, @code{\t}, and @code{\u}. Again, don't
5782
use these if possible.
5784
@cindex @code{\A}, allowed delimiters
5785
@cindex @code{\B}, allowed delimiters
5786
@cindex @code{\Z}, allowed delimiters
5787
@cindex @code{\C}, allowed delimiters
5788
@cindex @code{\w}, allowed delimiters
5789
No newline characters as delimiters are allowed in the following
5790
escapes: @code{\A}, @code{\B}, @code{\Z}, @code{\C}, and @code{\w}.
5792
@cindex @code{\D}, allowed delimiters
5793
@cindex @code{\h}, allowed delimiters
5794
@cindex @code{\H}, allowed delimiters
5795
@cindex @code{\l}, allowed delimiters
5796
@cindex @code{\L}, allowed delimiters
5797
@cindex @code{\N}, allowed delimiters
5798
@cindex @code{\R}, allowed delimiters
5799
@cindex @code{\s}, allowed delimiters
5800
@cindex @code{\S}, allowed delimiters
5801
@cindex @code{\v}, allowed delimiters
5802
@cindex @code{\x}, allowed delimiters
5803
Finally, the escapes @code{\D}, @code{\h}, @code{\H}, @code{\l},
5804
@code{\L}, @code{\N}, @code{\R}, @code{\s}, @code{\S}, @code{\v}, and
5805
@code{\x} can't use the following characters as delimiters:
5809
@cindex numbers, and delimiters
5810
@cindex digits, and delimiters
5811
The digits @code{0}-@code{9}.
5814
@cindex operators, as delimiters
5815
@cindex @code{+}, as delimiter
5816
@cindex @code{-}, as delimiter
5817
@cindex @code{/}, as delimiter
5818
@cindex @code{*}, as delimiter
5819
@cindex @code{%}, as delimiter
5820
@cindex @code{<}, as delimiter
5821
@cindex @code{>}, as delimiter
5822
@cindex @code{=}, as delimiter
5823
@cindex @code{&}, as delimiter
5825
@cindex @code{:}, as delimiter
5828
@cindex <colon>, as delimiter
5830
@cindex @code{(}, as delimiter
5831
@cindex @code{)}, as delimiter
5832
@cindex @code{.}, as delimiter
5833
The (single-character) operators @samp{+-/*%<>=&:().}.
5836
@cindex space character
5837
@cindex character, space
5838
@cindex tab character
5839
@cindex character, tab
5840
@cindex newline character
5841
@cindex character, newline
5842
The space, tab, and newline characters.
5845
@cindex @code{\%}, used as delimiter
5847
@cindex @code{\:}, used as delimiter
5850
@cindex @code{\@r{<colon>}}, used as delimiter
5852
@cindex @code{\@{}, used as delimiter
5853
@cindex @code{\@}}, used as delimiter
5854
@cindex @code{\'}, used as delimiter
5855
@cindex @code{\`}, used as delimiter
5856
@cindex @code{\-}, used as delimiter
5857
@cindex @code{\_}, used as delimiter
5858
@cindex @code{\!}, used as delimiter
5859
@cindex @code{\/}, used as delimiter
5860
@cindex @code{\c}, used as delimiter
5861
@cindex @code{\e}, used as delimiter
5862
@cindex @code{\p}, used as delimiter
5863
All escape sequences except @code{\%}, @code{\:}, @code{\@{},
5864
@code{\@}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
5865
@code{\/}, @code{\c}, @code{\e}, and @code{\p}.
5868
@cindex printing backslash (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
5869
@cindex backslash, printing (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
5870
To have a backslash (actually, the current escape character) appear in
5871
the output several escapes are defined: @code{\\}, @code{\e} or
5872
@code{\E}. These are very similar, and only differ with respect to
5873
being used in macros or diversions. @xref{Character Translations}, for
5874
an exact description of those escapes.
5876
@xref{Implementation Differences}, @ref{Copy-in Mode}, and
5877
@ref{Diversions}, @ref{Identifiers}, for more information.
5883
@node Comments, , Escapes, Escapes
5884
@subsubsection Comments
5887
Probably one of the most@footnote{Unfortunately, this is a lie. But
5888
hopefully future @code{gtroff} hackers will believe it @code{:-)}}
5889
common forms of escapes is the comment.
5892
Start a comment. Everything to the end of the input line is ignored.
5894
This may sound simple, but it can be tricky to keep the comments from
5895
interfering with the appearance of the final output.
5897
@cindex @code{ds}, @code{ds1} requests, and comments
5898
@cindex @code{as}, @code{as1} requests, and comments
5899
If the escape is to the right of some text or a request, that portion of
5900
the line is ignored, but the space leading up to it is noticed by
5901
@code{gtroff}. This only affects the @code{ds} and @code{as} request
5904
@cindex tabs, before comments
5905
@cindex comments, lining up with tabs
5906
One possibly irritating idiosyncracy is that tabs must not be used to
5907
line up comments. Tabs are not treated as whitespace between the
5908
request and macro arguments.
5910
@cindex undefined request
5911
@cindex request, undefined
5912
A comment on a line by itself is treated as a blank line, because after
5913
eliminating the comment, that is all that remains:
5930
To avoid this, it is common to start the line with @code{.\"} which
5931
causes the line to be treated as an undefined request and thus ignored
5934
@cindex @code{'}, as a comment
5935
Another commenting scheme seen sometimes is three consecutive single
5936
quotes (@code{'''}) at the beginning of a line. This works, but
5937
@code{gtroff} gives a warning about an undefined macro (namely
5938
@code{''}), which is harmless, but irritating.
5942
To avoid all this, @code{gtroff} has a new comment mechanism using the
5943
@code{\#} escape. This escape works the same as @code{\"} except that
5944
the newline is also ignored:
5963
@Defreq {ig, [@Var{end}]}
5964
Ignore all input until @code{gtroff} encounters the macro named
5965
@code{.}@var{end} on a line by itself (or @code{..} if @var{end} is not
5966
specified). This is useful for commenting out large blocks of text:
5971
This is part of a large block
5972
of text that has been
5973
temporarily(?) commented out.
5975
We can restore it simply by removing
5976
the .ig request and the ".." at the
5979
More text text text...
5986
text text text@dots{} More text text text@dots{}
5990
Note that the commented-out block of text does not cause a break.
5992
@cindex @code{ig} request, and copy-in mode
5993
@cindex copy-in mode, and @code{ig} request
5994
@cindex mode, copy-in, and @code{ig} request
5995
@cindex @code{ig} request, and auto-increment
5996
@cindex auto-increment, and @code{ig} request
5997
The input is read in copy-mode; auto-incremented registers @emph{are}
5998
affected (@pxref{Auto-increment}).
6002
@c =====================================================================
6004
@node Registers, Manipulating Filling and Adjusting, Embedded Commands, gtroff Reference
6008
Numeric variables in @code{gtroff} are called @dfn{registers}. There
6009
are a number of built-in registers, supplying anything from the date to
6010
details of formatting parameters.
6012
@xref{Identifiers}, for details on register identifiers.
6015
* Setting Registers::
6016
* Interpolating Registers::
6018
* Assigning Formats::
6019
* Built-in Registers::
6022
@c ---------------------------------------------------------------------
6024
@node Setting Registers, Interpolating Registers, Registers, Registers
6025
@subsection Setting Registers
6026
@cindex setting registers (@code{nr}, @code{\R})
6027
@cindex registers, setting (@code{nr}, @code{\R})
6029
Define or set registers using the @code{nr} request or the @code{\R}
6032
Although the following requests and escapes can be used to create
6033
registers, simply using an undefined register will cause it to be
6036
@DefreqList {nr, ident value}
6037
@DefescListEnd {\\R, ', ident value, '}
6038
Set number register @var{ident} to @var{value}. If @var{ident} doesn't
6039
exist, @code{gtroff} creates it.
6041
The argument to @code{\R} usually has to be enclosed in quotes.
6042
@xref{Escapes}, for details on parameter delimiting characters.
6044
The @code{\R} escape doesn't produce an input token in @code{gtroff};
6045
in other words, it vanishes completely after @code{gtroff} has
6048
For example, the following two lines are equivalent:
6051
.nr a (((17 + (3 * 4))) % 4)
6052
\R'a (((17 + (3 * 4))) % 4)'
6056
Note that the complete transparency of @code{\R} can cause surprising
6057
effects if you use number registers like @code{.k} which get evaluated
6058
at the time they are accessed.
6063
aaa bbb ccc ddd eee fff ggg hhh\R':k \n[.k]'
6065
@result{} :k == 126950
6069
aaa bbb ccc ddd eee fff ggg hhh\h'0'\R':k \n[.k]'
6071
@result{} :k == 15000
6074
If you process this with the @sc{PostScript} device (@code{-Tps}),
6075
there will be a line break eventually after @code{ggg} in both input
6076
lines. However, after processing the space after @code{ggg}, the
6077
partially collected line is not overfull yet, so @code{troff}
6078
continues to collect input until it sees the space (or in this case,
6079
the newline) after @code{hhh}. At this point, the line is longer
6080
than the line length, and the line gets broken.
6082
In the first input line, since the @code{\R} escape leaves no traces,
6083
the check for the overfull line hasn't been done yet at the point where
6084
@code{\R} gets handled, and you get a value for the @code{.k} number
6085
register which is even greater than the current line length.
6087
In the second input line, the insertion of @code{\h'0'} to emit an
6088
invisible zero-width space forces @code{troff} to check the line length
6089
which in turn causes the start of a new output line. Now @code{.k}
6090
returns the expected value.
6093
Both @code{nr} and @code{\R} have two additional special forms to
6094
increment or decrement a register.
6096
@DefreqList {nr, ident @t{+}@Var{value}}
6097
@DefreqItem {nr, ident @t{-}@Var{value}}
6098
@DefescItem {\\R, ', ident @t{+}value, '}
6099
@DefescListEnd {\\R, ', ident @t{-}value, '}
6100
Increment (decrement) register @var{ident} by @var{value}.
6109
@cindex negating register values
6110
To assign the negated value of a register to another register, some care
6111
must be taken to get the desired result:
6125
The surrounding parentheses prevent the interpretation of the minus sign
6126
as a decrementing operator. An alternative is to start the assignment
6142
@cindex removing number register (@code{rr})
6143
@cindex number register, removing (@code{rr})
6144
@cindex register, removing (@code{rr})
6145
Remove number register @var{ident}. If @var{ident} doesn't exist, the
6149
@Defreq {rnn, ident1 ident2}
6150
@cindex renaming number register (@code{rnn})
6151
@cindex number register, renaming (@code{rnn})
6152
@cindex register, renaming (@code{rnn})
6153
Rename number register @var{ident1} to @var{ident2}. If either
6154
@var{ident1} or @var{ident2} doesn't exist, the request is ignored.
6157
@Defreq {aln, ident1 ident2}
6158
@cindex alias, number register, creating (@code{aln})
6159
@cindex creating alias, for number register (@code{aln})
6160
@cindex number register, creating alias (@code{aln})
6161
@cindex register, creating alias (@code{aln})
6162
Create an alias @var{ident1} for a number register @var{ident2}. The
6163
new name and the old name are exactly equivalent. If @var{ident1} is
6164
undefined, a warning of type @samp{reg} is generated, and the request is
6165
ignored. @xref{Debugging}, for information about warnings.
6168
@c ---------------------------------------------------------------------
6170
@node Interpolating Registers, Auto-increment, Setting Registers, Registers
6171
@subsection Interpolating Registers
6172
@cindex interpolating registers (@code{\n})
6173
@cindex registers, interpolating (@code{\n})
6175
Numeric registers can be accessed via the @code{\n} escape.
6177
@DefescList {\\n, , i, }
6178
@DefescItem {\\n, @Lparen{}, id, }
6179
@DefescListEnd {\\n, @Lbrack{}, ident, @Rbrack{}}
6180
@cindex nested assignments
6181
@cindex assignments, nested
6182
@cindex indirect assignments
6183
@cindex assignments, indirect
6184
Interpolate number register with name @var{ident} (one-character
6185
name@tie{}@var{i}, two-character name @var{id}). This means that the
6186
value of the register is expanded in-place while @code{gtroff} is
6187
parsing the input line. Nested assignments (also called indirect
6188
assignments) are possible.
6209
@c ---------------------------------------------------------------------
6211
@node Auto-increment, Assigning Formats, Interpolating Registers, Registers
6212
@subsection Auto-increment
6213
@cindex auto-increment
6214
@cindex increment, automatic
6216
Number registers can also be auto-incremented and auto-decremented. The
6217
increment or decrement value can be specified with a third argument to
6218
the @code{nr} request or @code{\R} escape.
6220
@Defreq {nr, ident value incr}
6221
@cindex @code{\R}, difference to @code{nr}
6222
Set number register @var{ident} to @var{value}; the increment for
6223
auto-incrementing is set to @var{incr}. Note that the @code{\R} escape
6224
doesn't support this notation.
6227
To activate auto-incrementing, the escape @code{\n} has a special syntax
6230
@DefescList {\\n, +, i, }
6231
@DefescItem {\\n, -, i, }
6232
@DefescItem {\\n, @Lparen{}+, id, }
6233
@DefescItem {\\n, @Lparen{}-, id, }
6234
@DefescItem {\\n, +@Lparen{}, id, }
6235
@DefescItem {\\n, -@Lparen{}, id, }
6236
@DefescItem {\\n, @Lbrack{}+, ident, @Rbrack{}}
6237
@DefescItem {\\n, @Lbrack{}-, ident, @Rbrack{}}
6238
@DefescItem {\\n, +@Lbrack{}, ident, @Rbrack{}}
6239
@DefescListEnd {\\n, -@Lbrack{}, ident, @Rbrack{}}
6240
Before interpolating, increment or decrement @var{ident} (one-character
6241
name@tie{}@var{i}, two-character name @var{id}) by the auto-increment
6242
value as specified with the @code{nr} request (or the @code{\R} escape).
6243
If no auto-increment value has been specified, these syntax forms are
6244
identical to @code{\n}.
6253
\n+a, \n+a, \n+a, \n+a, \n+a
6255
\n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
6257
\n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
6265
-5, -10, -15, -20, -25
6269
@cindex increment value without changing the register
6270
@cindex value, incrementing without changing the register
6271
To change the increment value without changing the value of a register
6272
(@var{a} in the example), the following can be used:
6278
@c ---------------------------------------------------------------------
6280
@node Assigning Formats, Built-in Registers, Auto-increment, Registers
6281
@subsection Assigning Formats
6282
@cindex assigning formats (@code{af})
6283
@cindex formats, assigning (@code{af})
6285
When a register is used, it is always textually replaced (or
6286
interpolated) with a representation of that number. This output format
6287
can be changed to a variety of formats (numbers, Roman numerals, etc.).
6288
This is done using the @code{af} request.
6290
@Defreq {af, ident format}
6291
Change the output format of a number register. The first argument
6292
@var{ident} is the name of the number register to be changed, and the
6293
second argument @var{format} is the output format. The following output
6294
formats are available:
6298
Decimal arabic numbers. This is the default format: 0, 1, 2,
6302
Decimal numbers with as many digits as specified. So, @samp{00} would
6303
result in printing numbers as 01, 02, 03,@tie{}@enddots{}
6305
In fact, any digit instead of zero does work; @code{gtroff} only counts
6306
how many digits are specified. As a consequence, @code{af}'s default
6307
format @samp{1} could be specified as @samp{0} also (and exactly this is
6308
returned by the @code{\g} escape, see below).
6311
@cindex Roman numerals
6312
@cindex numerals, Roman
6313
Upper-case Roman numerals: 0, I, II, III, IV,@tie{}@enddots{}
6316
Lower-case Roman numerals: 0, i, ii, iii, iv,@tie{}@enddots{}
6319
Upper-case letters: 0, A, B, C, @dots{},@tie{}Z, AA, AB,@tie{}@enddots{}
6322
Lower-case letters: 0, a, b, c, @dots{},@tie{}z, aa, ab,@tie{}@enddots{}
6325
Omitting the number register format causes a warning of type
6326
@samp{missing}. @xref{Debugging}, for more details. Specifying a
6327
nonexistent format causes an error.
6329
The following example produces @samp{10, X, j, 010}:
6333
.af a 1 \" the default format
6343
@cindex Roman numerals, maximum and minimum
6344
@cindex maximum values of Roman numerals
6345
@cindex minimum values of Roman numerals
6346
The largest number representable for the @samp{i} and @samp{I} formats
6347
is 39999 (or @minus{}39999); @acronym{UNIX} @code{troff} uses @samp{z}
6348
and @samp{w} to represent 10000 and 5000 in Roman numerals, and so does
6349
@code{gtroff}. Currently, the correct glyphs of Roman numeral five
6350
thousand and Roman numeral ten thousand (Unicode code points
6351
@code{U+2182} and @code{U+2181}, respectively) are not available.
6353
If @var{ident} doesn't exist, it is created.
6355
@cindex read-only register, changing format
6356
@cindex changing format, and read-only registers
6357
Changing the output format of a read-only register causes an error. It
6358
is necessary to first copy the register's value to a writeable register,
6359
then apply the @code{af} request to this other register.
6362
@DefescList {\\g, , i, }
6363
@DefescItem {\\g, @Lparen{}, id, }
6364
@DefescListEnd {\\g, @Lbrack{}, ident, @Rbrack{}}
6365
@cindex format of register (@code{\g})
6366
@cindex register, format (@code{\g})
6367
Return the current format of the specified register @var{ident}
6368
(one-character name@tie{}@var{i}, two-character name @var{id}). For
6369
example, @samp{\ga} after the previous example would produce the string
6370
@samp{000}. If the register hasn't been defined yet, nothing is
6374
@c ---------------------------------------------------------------------
6376
@node Built-in Registers, , Assigning Formats, Registers
6377
@subsection Built-in Registers
6378
@cindex built-in registers
6379
@cindex registers, built-in
6381
The following lists some built-in registers which are not described
6382
elsewhere in this manual. Any register which begins with a @samp{.} is
6383
read-only. A complete listing of all built-in registers can be found in
6384
@ref{Register Index}.
6388
@cindex current input file name register (@code{.F})
6389
@cindex input file name, current, register (@code{.F})
6391
This string-valued register returns the current input file name.
6394
@cindex horizontal resolution register (@code{.H})
6395
@cindex resolution, horizontal, register (@code{.H})
6397
Horizontal resolution in basic units.
6400
@cindex number of registers register (@code{.R})
6401
@cindex registers, number of, register (@code{.R})
6403
The number of number registers available. This is always 10000 in
6404
GNU@tie{}@code{troff}; it exists for backward compatibility.
6410
@cindex mode, unsafe
6412
If @code{gtroff} is called with the @option{-U} command line option to
6413
activate unsafe mode, the number register @code{.U} is set to@tie{}1,
6414
and to zero otherwise. @xref{Groff Options}.
6417
@cindex vertical resolution register (@code{.V})
6418
@cindex resolution, vertical, register (@code{.V})
6420
Vertical resolution in basic units.
6423
@cindex seconds, current time (@code{seconds})
6424
@cindex time, current, seconds (@code{seconds})
6425
@cindex current time, seconds (@code{seconds})
6427
The number of seconds after the minute, normally in the range@tie{}0
6428
to@tie{}59, but can be up to@tie{}61 to allow for leap seconds.
6429
Initialized at start-up of @code{gtroff}.
6432
@cindex minutes, current time (@code{minutes})
6433
@cindex time, current, minutes (@code{minutes})
6434
@cindex current time, minutes (@code{minutes})
6436
The number of minutes after the hour, in the range@tie{}0 to@tie{}59.
6437
Initialized at start-up of @code{gtroff}.
6440
@cindex hours, current time (@code{hours})
6441
@cindex time, current, hours (@code{hours})
6442
@cindex current time, hours (@code{hours})
6444
The number of hours past midnight, in the range@tie{}0 to@tie{}23.
6445
Initialized at start-up of @code{gtroff}.
6448
@cindex day of the week register (@code{dw})
6449
@cindex date, day of the week register (@code{dw})
6451
Day of the week (1-7).
6454
@cindex day of the month register (@code{dy})
6455
@cindex date, day of the month register (@code{dy})
6457
Day of the month (1-31).
6460
@cindex month of the year register (@code{mo})
6461
@cindex date, month of the year register (@code{mo})
6463
Current month (1-12).
6466
@cindex date, year register (@code{year}, @code{yr})
6467
@cindex year, current, register (@code{year}, @code{yr})
6473
The current year minus@tie{}1900. Unfortunately, the documentation of
6474
@acronym{UNIX} Version@tie{}7's @code{troff} had a year@tie{}2000 bug:
6475
It incorrectly claimed that @code{yr} contains the last two digits of
6476
the year. That claim has never been true of either @acronym{AT&T}
6477
@code{troff} or GNU @code{troff}. Old @code{troff} input that looks
6481
'\" The following line stopped working after 1999
6482
This document was formatted in 19\n(yr.
6486
can be corrected as follows:
6489
This document was formatted in \n[year].
6493
or, to be portable to older @code{troff} versions, as follows:
6497
This document was formatted in \n(y4.
6504
@cindex input line number register (@code{.c}, @code{c.})
6505
@cindex line number, input, register (@code{.c}, @code{c.})
6506
The current @emph{input} line number. Register @samp{.c} is read-only,
6507
whereas @samp{c.} (a @code{gtroff} extension) is writable also,
6508
affecting both @samp{.c} and @samp{c.}.
6512
@cindex output line number register (@code{ln})
6513
@cindex line number, output, register (@code{ln})
6514
The current @emph{output} line number after a call to the @code{nm}
6515
request to activate line numbering.
6517
@xref{Miscellaneous}, for more information about line numbering.
6521
@cindex major version number register (@code{.x})
6522
@cindex version number, major, register (@code{.x})
6523
The major version number. For example, if the version number is 1.03
6524
then @code{.x} contains@tie{}@samp{1}.
6528
@cindex minor version number register (@code{.y})
6529
@cindex version number, minor, register (@code{.y})
6530
The minor version number. For example, if the version number is 1.03
6531
then @code{.y} contains@tie{}@samp{03}.
6535
@cindex revision number register (@code{.Y})
6536
The revision number of @code{groff}.
6540
@cindex process ID of @code{gtroff} register (@code{$$})
6541
@cindex @code{gtroff}, process ID register (@code{$$})
6542
The process ID of @code{gtroff}.
6546
@cindex @code{gtroff}, identification register (@code{.g})
6547
@cindex GNU-specific register (@code{.g})
6548
Always@tie{}1. Macros should use this to determine whether they are
6549
running under GNU @code{troff}.
6553
@cindex @acronym{ASCII} approximation output register (@code{.A})
6554
If the command line option @option{-a} is used to produce an
6555
@acronym{ASCII} approximation of the output, this is set to@tie{}1, zero
6556
otherwise. @xref{Groff Options}.
6560
This read-only register is set to the suppression nesting level (see
6561
escapes @code{\O}). @xref{Suppressing output}.
6565
This register is set to@tie{}1 (and to@tie{}0 otherwise) if the current
6566
page is actually being printed, i.e., if the @option{-o} option is being
6567
used to only print selected pages. @xref{Groff Options}, for more
6572
If @code{gtroff} is called with the @option{-T} command line option, the
6573
number register @code{.T} is set to@tie{}1, and zero otherwise.
6574
@xref{Groff Options}.
6578
@cindex output device name string register (@code{.T})
6579
A single read-write string register which contains the current output
6580
device (for example, @samp{latin1} or @samp{ps}). This is the only
6581
string register defined by @code{gtroff}.
6585
@c =====================================================================
6587
@node Manipulating Filling and Adjusting, Manipulating Hyphenation, Registers, gtroff Reference
6588
@section Manipulating Filling and Adjusting
6589
@cindex manipulating filling and adjusting
6590
@cindex filling and adjusting, manipulating
6591
@cindex adjusting and filling, manipulating
6592
@cindex justifying text
6593
@cindex text, justifying
6597
@cindex @code{bp} request, causing implicit linebreak
6598
@cindex @code{ce} request, causing implicit linebreak
6599
@cindex @code{cf} request, causing implicit linebreak
6600
@cindex @code{fi} request, causing implicit linebreak
6601
@cindex @code{fl} request, causing implicit linebreak
6602
@cindex @code{in} request, causing implicit linebreak
6603
@cindex @code{nf} request, causing implicit linebreak
6604
@cindex @code{rj} request, causing implicit linebreak
6605
@cindex @code{sp} request, causing implicit linebreak
6606
@cindex @code{ti} request, causing implicit linebreak
6607
@cindex @code{trf} request, causing implicit linebreak
6608
Various ways of causing @dfn{breaks} were given in @ref{Implicit Line
6609
Breaks}. The @code{br} request likewise causes a break. Several other
6610
requests also cause breaks, but implicitly. These are @code{bp},
6611
@code{ce}, @code{cf}, @code{fi}, @code{fl}, @code{in}, @code{nf},
6612
@code{rj}, @code{sp}, @code{ti}, and @code{trf}.
6615
Break the current line, i.e., the input collected so far is emitted
6618
If the no-break control character is used, @code{gtroff} suppresses the
6629
Initially, @code{gtroff} fills and adjusts text to both margins.
6630
Filling can be disabled via the @code{nf} request and re-enabled with
6631
the @code{fi} request.
6635
@cindex fill mode (@code{fi})
6636
@cindex mode, fill (@code{fi})
6637
Activate fill mode (which is the default). This request implicitly
6638
enables adjusting; it also inserts a break in the text currently being
6639
filled. The read-only number register @code{.u} is set to@tie{}1.
6641
The fill mode status is associated with the current environment
6642
(@pxref{Environments}).
6644
See @ref{Line Control}, for interaction with the @code{\c} escape.
6648
@cindex no-fill mode (@code{nf})
6649
@cindex mode, no-fill (@code{nf})
6650
Activate no-fill mode. Input lines are output as-is, retaining line
6651
breaks and ignoring the current line length. This command implicitly
6652
disables adjusting; it also causes a break. The number register
6653
@code{.u} is set to@tie{}0.
6655
The fill mode status is associated with the current environment
6656
(@pxref{Environments}).
6658
See @ref{Line Control}, for interaction with the @code{\c} escape.
6661
@DefreqList {ad, [@Var{mode}]}
6665
Activation and deactivation of adjusting is done implicitly with calls
6666
to the @code{fi} or @code{nf} requests.
6668
@var{mode} can have one of the following values:
6672
@cindex ragged-right
6673
Adjust text to the left margin. This produces what is traditionally
6674
called ragged-right text.
6678
Adjust text to the right margin, producing ragged-left text.
6681
@cindex centered text
6682
@cindex @code{ce} request, difference to @samp{.ad@tie{}c}
6683
Center filled text. This is different to the @code{ce} request which
6684
only centers text without filling.
6688
Justify to both margins. This is the default used by @code{gtroff}.
6691
Finally, @var{mode} can be the numeric argument returned by the
6694
Using @code{ad} without argument is the same as saying
6695
@w{@code{.ad \[.j]}}. In particular, @code{gtroff} adjusts lines
6696
in the same way it did before adjusting was deactivated (with a call
6697
to @code{na}, say). For example, this input code
6718
.AD \" back to centering
6720
.AD \n[ad] \" back to right justifying
6725
produces the following output:
6736
@cindex adjustment mode register (@code{.j})
6737
As just demonstrated, the current adjustment mode is available in the
6738
read-only number register @code{.j}; it can be stored and
6739
subsequently used to set adjustment.
6741
The adjustment mode status is associated with the current environment
6742
(@pxref{Environments}).
6746
Disable adjusting. This request won't change the current adjustment
6747
mode: A subsequent call to @code{ad} uses the previous adjustment
6750
The adjustment mode status is associated with the current environment
6751
(@pxref{Environments}).
6755
@DefescListEnd {\\p, , , }
6756
Adjust the current line and cause a break.
6758
In most cases this produces very ugly results since @code{gtroff}
6759
doesn't have a sophisticated paragraph building algorithm (as @TeX{}
6760
have, for example); instead, @code{gtroff} fills and adjusts a paragraph
6764
This is an uninteresting sentence.
6765
This is an uninteresting sentence.\p
6766
This is an uninteresting sentence.
6773
This is an uninteresting sentence. This is an
6774
uninteresting sentence.
6775
This is an uninteresting sentence.
6779
@DefreqList {ss, word_space_size [@Var{sentence_space_size}]}
6781
@DefregListEnd {.sss}
6782
@cindex word space size register (@code{.ss})
6783
@cindex size of word space register (@code{.ss})
6784
@cindex space between words register (@code{.ss})
6785
@cindex sentence space size register (@code{.sss})
6786
@cindex size of sentence space register (@code{.sss})
6787
@cindex space between sentences register (@code{.sss})
6788
Change the size of a space between words. It takes its units as one
6789
twelfth of the space width parameter for the current font. Initially
6790
both the @var{word_space_size} and @var{sentence_space_size}
6791
are@tie{}12. In fill mode, the values specify the minimum distance.
6795
If two arguments are given to the @code{ss} request, the second argument
6796
sets the sentence space size. If the second argument is not given,
6797
sentence space size is set to @var{word_space_size}. The sentence space
6798
size is used in two circumstances: If the end of a sentence occurs at
6799
the end of a line in fill mode, then both an inter-word space and a
6800
sentence space are added; if two spaces follow the end of a sentence in
6801
the middle of a line, then the second space is a sentence space. If a
6802
second argument is never given to the @code{ss} request, the behaviour
6803
of @acronym{UNIX} @code{troff} is the same as that exhibited by GNU
6804
@code{troff}. In GNU @code{troff}, as in @acronym{UNIX} @code{troff}, a
6805
sentence should always be followed by either a newline or two spaces.
6807
The read-only number registers @code{.ss} and @code{.sss} hold the
6808
values of the parameters set by the first and second arguments of the
6811
The word space and sentence space values are associated with the current
6812
environment (@pxref{Environments}).
6814
Contrary to @acronym{AT&T} @code{troff}, this request is @emph{not}
6815
ignored if a TTY output device is used; the given values are then
6816
rounded down to a multiple of@tie{}12 (@pxref{Implementation
6819
The request is ignored if there is no parameter.
6821
@cindex discardable horizontal space
6822
@cindex space, discardable, horizontal
6823
@cindex horizontal discardable space
6824
Another useful application of the @code{ss} request is to insert
6825
discardable horizontal space, i.e., space which is discarded at a line
6826
break. For example, paragraph-style footnotes could be separated this
6831
1.\ This is the first footnote.\c
6835
2.\ This is the second footnote.
6842
1. This is the first footnote. 2. This
6843
is the second footnote.
6847
Note that the @code{\h} escape produces unbreakable space.
6850
@DefreqList {ce, [@Var{nnn}]}
6851
@DefregListEnd {.ce}
6852
@cindex centering lines (@code{ce})
6853
@cindex lines, centering (@code{ce})
6854
Center text. While the @w{@samp{.ad c}} request also centers text, it
6855
fills the text as well. @code{ce} does not fill the text it affects.
6856
This request causes a break. The number of lines still to be centered
6857
is associated with the current environment (@pxref{Environments}).
6859
The following example demonstrates the differences. Here the input:
6864
This is a small text fragment which shows the differences
6865
between the `.ce' and the `.ad c' request.
6869
This is a small text fragment which shows the differences
6870
between the `.ce' and the `.ad c' request.
6874
And here the result:
6877
This is a small text fragment which
6878
shows the differences
6879
between the `.ce' and the `.ad c' request.
6881
This is a small text fragment which
6882
shows the differences between the `.ce'
6883
and the `.ad c' request.
6886
With no arguments, @code{ce} centers the next line of text. @var{nnn}
6887
specifies the number of lines to be centered. If the argument is zero
6888
or negative, centering is disabled.
6890
The basic length for centering text is the line length (as set with the
6891
@code{ll} request) minus the indentation (as set with the @code{in}
6892
request). Temporary indentation is ignored.
6894
As can be seen in the previous example, it is a common idiom to turn on
6895
centering for a large number of lines, and to turn off centering after
6896
text to be centered. This is useful for any request which takes a
6897
number of lines as an argument.
6899
The @code{.ce} read-only number register contains the number of lines
6900
remaining to be centered, as set by the @code{ce} request.
6903
@DefreqList {rj, [@Var{nnn}]}
6904
@DefregListEnd {.rj}
6905
@cindex justifying text (@code{rj})
6906
@cindex text, justifying (@code{rj})
6907
@cindex right-justifying (@code{rj})
6908
Justify unfilled text to the right margin. Arguments are identical to
6909
the @code{ce} request. The @code{.rj} read-only number register is the
6910
number of lines to be right-justified as set by the @code{rj} request.
6911
This request causes a break. The number of lines still to be
6912
right-justified is associated with the current environment
6913
(@pxref{Environments}).
6917
@c =====================================================================
6919
@node Manipulating Hyphenation, Manipulating Spacing, Manipulating Filling and Adjusting, gtroff Reference
6920
@section Manipulating Hyphenation
6921
@cindex manipulating hyphenation
6922
@cindex hyphenation, manipulating
6924
Here a description of requests which influence hyphenation.
6926
@DefreqList {hy, [@Var{mode}]}
6927
@DefregListEnd {.hy}
6928
Enable hyphenation. The request has an optional numeric argument,
6929
@var{mode}, to restrict hyphenation if necessary:
6933
The default argument if @var{mode} is omitted. Hyphenate without
6934
restrictions. This is also the start-up value of @code{gtroff}.
6937
Do not hyphenate the last word on a page or column.
6940
Do not hyphenate the last two characters of a word.
6943
Do not hyphenate the first two characters of a word.
6946
Values in the previous table are additive. For example, the
6947
value@tie{}12 causes @code{gtroff} to neither hyphenate the last two nor
6948
the first two characters of a word.
6950
@cindex hyphenation restrictions register (@code{.hy})
6951
The current hyphenation restrictions can be found in the read-only
6952
number register @samp{.hy}.
6954
The hyphenation mode is associated with the current environment
6955
(@pxref{Environments}).
6959
Disable hyphenation (i.e., set the hyphenation mode to zero). Note that
6960
the hyphenation mode of the last call to @code{hy} is not remembered.
6962
The hyphenation mode is associated with the current environment
6963
(@pxref{Environments}).
6966
@DefreqList {hlm, [@Var{nnn}]}
6968
@DefregListEnd {.hlc}
6969
@cindex explicit hyphen (@code{\%})
6970
@cindex hyphen, explicit (@code{\%})
6971
@cindex consecutive hyphenated lines (@code{hlm})
6972
@cindex lines, consecutive hyphenated (@code{hlm})
6973
@cindex hyphenated lines, consecutive (@code{hlm})
6974
Set the maximum number of consecutive hyphenated lines to @var{nnn}. If
6975
this number is negative, there is no maximum. The default value
6976
is@tie{}@minus{}1 if @var{nnn} is omitted. This value is associated
6977
with the current environment (@pxref{Environments}). Only lines output
6978
from a given environment count towards the maximum associated with that
6979
environment. Hyphens resulting from @code{\%} are counted; explicit
6982
The current setting of @code{hlm} is available in the @code{.hlm}
6983
read-only number register. Also the number of immediately preceding
6984
consecutive hyphenated lines are available in the read-only number
6985
register @samp{.hlc}.
6988
@Defreq {hw, word1 word2 @dots{}}
6989
Define how @var{word1}, @var{word2}, etc.@: are to be hyphenated. The
6990
words must be given with hyphens at the hyphenation points. For
6998
Besides the space character, any character whose hyphenation code value
6999
is zero can be used to separate the arguments of @code{hw} (see the
7000
documentation for the @code{hcode} request below for more information).
7001
In addition, this request can be used more than once.
7003
Hyphenation exceptions specified with the @code{hw} request are
7004
associated with the current hyphenation language; it causes an error if
7005
there is no current hyphenation language.
7007
This request is ignored if there is no parameter.
7009
In old versions of @code{troff} there was a limited amount of space to
7010
store such information; fortunately, with @code{gtroff}, this is no
7011
longer a restriction.
7014
@DefescList {\\%, , , }
7015
@deffnx Escape @t{\:}
7020
@esindex \@r{<colon>}
7022
@cindex hyphenation character (@code{\%})
7023
@cindex character, hyphenation (@code{\%})
7024
@cindex disabling hyphenation (@code{\%})
7025
@cindex hyphenation, disabling (@code{\%})
7026
To tell @code{gtroff} how to hyphenate words on the fly, use the
7027
@code{\%} escape, also known as the @dfn{hyphenation character}.
7028
Preceding a word with this character prevents it from being
7029
hyphenated; putting it inside a word indicates to @code{gtroff} that
7030
the word may be hyphenated at that point. Note that this mechanism
7031
only affects that one occurrence of the word; to change the
7032
hyphenation of a word for the entire document, use the @code{hw}
7035
The @code{\:} escape inserts a zero-width break point (that is, the word
7036
breaks but without adding a hyphen).
7039
... check the /var/log/\:httpd/\:access_log file ...
7042
@cindex @code{\X}, followed by @code{\%}
7043
@cindex @code{\Y}, followed by @code{\%}
7044
@cindex @code{\%}, following @code{\X} or @code{\Y}
7045
Note that @code{\X} and @code{\Y} start a word, that is, the @code{\%}
7046
escape in (say) @w{@samp{\X'...'\%foobar}} and
7047
@w{@samp{\Y'...'\%foobar}} no longer prevents hyphenation but inserts a
7048
hyphenation point at the beginning of @samp{foobar}; most likely this
7049
isn't what you want to do.
7052
@Defreq {hc, [@Var{char}]}
7053
Change the hyphenation character to @var{char}. This character then
7054
works the same as the @code{\%} escape, and thus, no longer appears in
7055
the output. Without an argument, @code{hc} resets the hyphenation
7056
character to be @code{\%} (the default) only.
7058
The hyphenation character is associated with the current environment
7059
(@pxref{Environments}).
7062
@DefreqList {hpf, pattern_file}
7063
@DefreqItem {hpfa, pattern_file}
7064
@DefreqListEnd {hpfcode, a b [c d @dots{}]}
7065
@cindex hyphenation patterns (@code{hpf})
7066
@cindex patterns for hyphenation (@code{hpf})
7067
Read in a file of hyphenation patterns. This file is searched for in
7068
the same way as @file{@var{name}.tmac} (or @file{tmac.@var{name}}) is
7069
searched for if the @option{-m@var{name}} option is specified.
7071
It should have the same format as (simple) @TeX{} patterns files. More
7072
specifically, the following scanning rules are implemented.
7076
A percent sign starts a comment (up to the end of the line) even if
7077
preceded by a backslash.
7080
No support for `digraphs' like @code{\$}.
7083
@code{^^@var{xx}} (@var{x} is 0-9 or a-f) and @code{^^@var{x}}
7084
(character code of @var{x} in the range 0-127) are recognized; other use
7085
of @code{^} causes an error.
7091
@code{hpf} checks for the expression @code{\patterns@{@dots{}@}}
7092
(possibly with whitespace before and after the braces). Everything
7093
between the braces is taken as hyphenation patterns. Consequently,
7094
@code{@{} and @code{@}} are not allowed in patterns.
7097
Similarly, @code{\hyphenation@{@dots{}@}} gives a list of hyphenation
7101
@code{\endinput} is recognized also.
7104
For backwards compatibility, if @code{\patterns} is missing, the whole
7105
file is treated as a list of hyphenation patterns (only recognizing the
7106
@code{%} character as the start of a comment).
7109
If no @code{hpf} request is specified (either in the document or in a
7110
macro package), @code{gtroff} won't hyphenate at all.
7112
The @code{hpfa} request appends a file of patterns to the current list.
7114
The @code{hpfcode} request defines mapping values for character codes in
7115
hyphenation patterns. @code{hpf} or @code{hpfa} then apply the mapping
7116
(after reading the patterns) before replacing or appending them to the
7117
current list of patterns. Its arguments are pairs of character codes --
7118
integers from 0 to@tie{}255. The request maps character
7119
code@tie{}@var{a} to code@tie{}@var{b}, code@tie{}@var{c} to
7120
code@tie{}@var{d}, and so on. You can use character codes which would
7121
be invalid otherwise. By default, everything maps to itself except
7122
letters `A' to `Z' which map to `a' to `z'.
7129
The set of hyphenation patterns is associated with the current language
7130
set by the @code{hla} request. The @code{hpf} request is usually
7131
invoked by the @file{troffrc} or @file{troffrc-end} file; by default,
7132
@file{troffrc} loads hyphenation patterns and exceptions for American
7133
English (in files @file{hyphen.us} and @file{hyphenex.us}).
7135
A second call to @code{hpf} (for the same language) replaces the
7136
hyphenation patterns with the new ones.
7138
Invoking @code{hpf} causes an error if there is no current hyphenation
7142
@Defreq {hcode, c1 code1 [c2 code2 @dots{}]}
7143
@cindex hyphenation code (@code{hcode})
7144
@cindex code, hyphenation (@code{hcode})
7145
Set the hyphenation code of character @var{c1} to @var{code1}, that of
7146
@var{c2} to @var{code2}, etc. A hyphenation code must be a single input
7147
character (not a special character) other than a digit or a space.
7149
To make hyphenation work, hyphenation codes must be set up. At
7150
start-up, groff only assigns hyphenation codes to the letters
7151
@samp{a}-@samp{z} (mapped to themselves) and to the letters
7152
@samp{A}-@samp{Z} (mapped to @samp{a}-@samp{z}); all other hyphenation
7153
codes are set to zero. Normally, hyphenation patterns contain only
7154
lowercase letters which should be applied regardless of case. In
7155
other words, the words `FOO' and `Foo' should be hyphenated exactly the
7156
same way as the word `foo' is hyphenated, and this is what @code{hcode}
7157
is good for. Words which contain other letters won't be hyphenated
7158
properly if the corresponding hyphenation patterns actually do contain
7159
them. For example, the following @code{hcode} requests are necessary to
7160
assign hyphenation codes to the letters @samp{�������} (this is needed
7170
Without those assignments, groff treats German words like
7171
@w{`Kinderg�rten'} (the plural form of `kindergarten') as two substrings
7172
@w{`kinderg'} and @w{`rten'} because the hyphenation code of the
7173
umlaut@tie{}a is zero by default. There is a German hyphenation pattern
7174
which covers @w{`kinder'}, so groff finds the hyphenation `kin-der'.
7175
The other two hyphenation points (`kin-der-g�r-ten') are missed.
7177
This request is ignored if it has no parameter.
7180
@DefreqList {hym, [@Var{length}]}
7181
@DefregListEnd {.hym}
7182
@cindex hyphenation margin (@code{hym})
7183
@cindex margin for hyphenation (@code{hym})
7184
@cindex @code{ad} request, and hyphenation margin
7185
Set the (right) hyphenation margin to @var{length}. If the current
7186
adjustment mode is not @samp{b} or @samp{n}, the line is not hyphenated
7187
if it is shorter than @var{length}. Without an argument, the
7188
hyphenation margin is reset to its default value, which is@tie{}0. The
7189
default scaling indicator for this request is @samp{m}. The hyphenation
7190
margin is associated with the current environment
7191
(@pxref{Environments}).
7193
A negative argument resets the hyphenation margin to zero, emitting a
7194
warning of type @samp{range}.
7196
@cindex hyphenation margin register (@code{.hym})
7197
The current hyphenation margin is available in the @code{.hym} read-only
7201
@DefreqList {hys, [@Var{hyphenation_space}]}
7202
@DefregListEnd {.hys}
7203
@cindex hyphenation space (@code{hys})
7204
@cindex @code{ad} request, and hyphenation space
7205
Set the hyphenation space to @var{hyphenation_space}. If the current
7206
adjustment mode is @samp{b} or @samp{n}, don't hyphenate the line if it
7207
can be justified by adding no more than @var{hyphenation_space} extra
7208
space to each word space. Without argument, the hyphenation space is
7209
set to its default value, which is@tie{}0. The default scaling
7210
indicator for this request is @samp{m}. The hyphenation space is
7211
associated with the current environment (@pxref{Environments}).
7213
A negative argument resets the hyphenation space to zero, emitting a
7214
warning of type @samp{range}.
7216
@cindex hyphenation space register (@code{.hys})
7217
The current hyphenation space is available in the @code{.hys} read-only
7221
@Defreq {shc, [@Var{glyph}]}
7222
@cindex soft hyphen character, setting (@code{shc})
7223
@cindex character, soft hyphen, setting (@code{shc})
7224
@cindex glyph, soft hyphen (@code{hy})
7225
@cindex soft hyphen glyph (@code{hy})
7226
@cindex @code{char} request, and soft hyphen character
7227
@cindex @code{tr} request, and soft hyphen character
7228
Set the @dfn{soft hyphen character} to @var{glyph}.@footnote{@dfn{Soft
7229
hyphen character} is a misnomer since it is an output glyph.} If the
7230
argument is omitted, the soft hyphen character is set to the default
7231
glyph @code{\(hy} (this is the start-up value of @code{gtroff} also).
7232
The soft hyphen character is the glyph that is inserted when a word is
7233
hyphenated at a line break. If the soft hyphen character does not exist
7234
in the font of the character immediately preceding a potential break
7235
point, then the line is not broken at that point. Neither definitions
7236
(specified with the @code{char} request) nor translations (specified
7237
with the @code{tr} request) are considered when finding the soft hyphen
7241
@DefreqList {hla, language}
7242
@DefregListEnd {.hla}
7243
@cindex @code{hpf} request, and hyphenation language
7244
@cindex @code{hw} request, and hyphenation language
7247
Set the current hyphenation language to the string @var{language}.
7248
Hyphenation exceptions specified with the @code{hw} request and
7249
hyphenation patterns specified with the @code{hpf} and @code{hpfa}
7250
requests are both associated with the current hyphenation language. The
7251
@code{hla} request is usually invoked by the @file{troffrc} or the
7252
@file{troffrc-end} files; @file{troffrc} sets the default language to
7255
@cindex hyphenation language register (@code{.hla})
7256
The current hyphenation language is available as a string in the
7257
read-only number register @samp{.hla}.
7260
.ds curr_language \n[.hla]
7267
@c =====================================================================
7269
@node Manipulating Spacing, Tabs and Fields, Manipulating Hyphenation, gtroff Reference
7270
@section Manipulating Spacing
7271
@cindex manipulating spacing
7272
@cindex spacing, manipulating
7274
@Defreq {sp, [@Var{distance}]}
7275
Space downwards @var{distance}. With no argument it advances
7276
1@tie{}line. A negative argument causes @code{gtroff} to move up the
7277
page the specified distance. If the argument is preceded by a @samp{|}
7278
then @code{gtroff} moves that distance from the top of the page. This
7279
request causes a line break, and that adds the current line spacing to
7280
the space you have just specified. The default scaling indicator is
7283
For convenience you may wish to use the following macros to set the
7284
height of the next line at a given distance from the top or the bottom
7293
. sp |\\n[.p]u-\\$1-\\n[.v]u
7298
A call to @samp{.y-from-bot-up 10c} means that the bottom of the next
7299
line will be at 10@dmn{cm} from the paper edge at the bottom.
7301
If a vertical trap is sprung during execution of @code{sp}, the amount
7302
of vertical space after the trap is discarded. For example, this
7330
@cindex @code{sp} request, and traps
7331
@cindex discarded space in traps
7332
@cindex space, discarded, in traps
7333
@cindex traps, and discarded space
7334
The amount of discarded space is available in the number register
7337
To protect @code{sp} against vertical traps, use the @code{vpt} request:
7346
@DefreqList {ls, [@Var{nnn}]}
7348
@cindex double-spacing (@code{ls})
7349
Output @w{@var{nnn}@minus{}1} blank lines after each line of text. With
7350
no argument, @code{gtroff} uses the previous value before the last
7354
.ls 2 \" This causes double-spaced output
7355
.ls 3 \" This causes triple-spaced output
7356
.ls \" Again double-spaced
7359
The line spacing is associated with the current environment
7360
(@pxref{Environments}).
7362
@cindex line spacing register (@code{.L})
7363
The read-only number register @code{.L} contains the current line
7367
@xref{Changing Type Sizes}, for the requests @code{vs} and @code{pvs} as
7368
alternatives to @code{ls}.
7370
@DefescList {\\x, ', spacing, '}
7372
Sometimes, extra vertical spacing is only needed occasionally, e.g.@: to
7373
allow space for a tall construct (like an equation). The @code{\x}
7374
escape does this. The escape is given a numerical argument, usually
7375
enclosed in quotes (like @samp{\x'3p'}); the default scaling indicator
7376
is @samp{v}. If this number is positive extra vertical space is
7377
inserted below the current line. A negative number adds space above.
7378
If this escape is used multiple times on the same line, the maximum of
7381
@xref{Escapes}, for details on parameter delimiting characters.
7383
@cindex extra post-vertical line space register (@code{.a})
7384
The @code{.a} read-only number register contains the most recent
7385
(nonnegative) extra vertical line space.
7387
Using @code{\x} can be necessary in combination with the @code{\b}
7388
escape, as the following example shows.
7391
This is a test with the \[rs]b escape.
7393
This is a test with the \[rs]b escape.
7395
This is a test with \b'xyz'\x'-1m'\x'1m'.
7397
This is a test with the \[rs]b escape.
7399
This is a test with the \[rs]b escape.
7406
This is a test with the \b escape.
7407
This is a test with the \b escape.
7409
This is a test with y.
7411
This is a test with the \b escape.
7412
This is a test with the \b escape.
7418
@DefregListEnd {.ns}
7419
@cindex @code{sp} request, and no-space mode
7420
@cindex no-space mode (@code{ns})
7421
@cindex mode, no-space (@code{ns})
7422
@cindex blank lines, disabling
7423
@cindex lines, blank, disabling
7424
Enable @dfn{no-space mode}. In this mode, spacing (either via @code{sp}
7425
or via blank lines) is disabled. The @code{bp} request to advance to
7426
the next page is also disabled, except if it is accompanied by a page
7427
number (see @ref{Page Control}, for more information). This mode ends
7428
when actual text is output or the @code{rs} request is encountered which
7429
ends no-space mode. The read-only number register @code{.ns} is set
7430
to@tie{}1 as long as no-space mode is active.
7432
This request is useful for macros that conditionally insert vertical
7433
space before the text starts (for example, a paragraph macro could
7434
insert some space except when it is the first paragraph after a section
7439
@c =====================================================================
7441
@node Tabs and Fields, Character Translations, Manipulating Spacing, gtroff Reference
7442
@section Tabs and Fields
7443
@cindex tabs, and fields
7444
@cindex fields, and tabs
7446
@cindex @acronym{EBCDIC} encoding of a tab
7447
A tab character (@acronym{ASCII} char@tie{}9, @acronym{EBCDIC}
7448
char@tie{}5) causes a horizontal movement to the next tab stop (much
7449
like it did on a typewriter).
7452
@cindex tab character, non-interpreted (@code{\t})
7453
@cindex character, tab, non-interpreted (@code{\t})
7454
@cindex @code{\t}, and copy-in mode
7455
@cindex copy-in mode, and @code{\t}
7456
@cindex mode, copy-in, and @code{\t}
7457
This escape is a non-interpreted tab character. In copy mode
7458
(@pxref{Copy-in Mode}), @code{\t} is the same as a real tab character.
7461
@DefreqList {ta, [@Var{n1} @Var{n2} @dots{} @Var{nn} @t{T} @Var{r1} @Var{r2} @dots{} @Var{rn}]}
7462
@DefregListEnd {.tabs}
7463
Change tab stop positions. This request takes a series of tab
7464
specifiers as arguments (optionally divided into two groups with the
7465
letter @samp{T}) which indicate where each tab stop is to be (overriding
7466
any previous settings).
7468
Tab stops can be specified absolutely, i.e., as the distance from the
7469
left margin. For example, the following sets 6@tie{}tab stops every one
7473
.ta 1i 2i 3i 4i 5i 6i
7476
Tab stops can also be specified using a leading @samp{+} which means
7477
that the specified tab stop is set relative to the previous tab stop.
7478
For example, the following is equivalent to the previous example.
7481
.ta 1i +1i +1i +1i +1i +1i
7484
@code{gtroff} supports an extended syntax to specify repeat values after
7485
the @samp{T} mark (these values are always taken as relative) -- this is
7486
the usual way to specify tabs set at equal intervals. The following is,
7487
yet again, the same as the previous examples. It does even more since
7488
it defines an infinite number of tab stops separated by one inch.
7494
Now we are ready to interpret the full syntax given at the beginning:
7495
Set tabs at positions @var{n1}, @var{n2}, @dots{}, @var{nn} and then set
7496
tabs at @var{nn}+@var{r1}, @var{nn}+@var{r2}, @dots{}, @var{nn}+@var{rn}
7497
and then at @var{nn}+@var{rn}+@var{r1}, @var{nn}+@var{rn}+@var{r2},
7498
@dots{}, @var{nn}+@var{rn}+@var{rn}, and so on.
7500
Example: @samp{4c +6c T 3c 5c 2c} is equivalent to @samp{4c 10c 13c 18c
7501
20c 23c 28c 30c @dots{}}.
7503
The material in each tab column (i.e., the column between two tab stops)
7504
may be justified to the right or left or centered in the column. This
7505
is specified by appending @samp{R}, @samp{L}, or @samp{C} to the tab
7506
specifier. The default justification is @samp{L}. Example:
7516
The default unit of the @code{ta} request is @samp{m}.
7519
A tab stop is converted into a non-breakable horizontal movement which
7520
can be neither stretched nor squeezed. For example,
7529
creates a single line which is a bit longer than 10@tie{}inches (a
7530
string is used to show exactly where the tab characters are). Now
7531
consider the following:
7540
@code{gtroff} first converts the tab stops of the line into unbreakable
7541
horizontal movements, then splits the line after the second @samp{b}
7542
(assuming a sufficiently short line length). Usually, this isn't what
7546
Superfluous tabs (i.e., tab characters which do not correspond to a tab
7547
stop) are ignored except the first one which delimits the characters
7548
belonging to the last tab stop for right-justifying or centering.
7549
Consider the following example
7553
.ds ZZ foo\tbar\tfoobar
7554
.ds ZZZ foo\tbar\tfoo\tbar
7565
which produces the following output:
7574
The first line right-justifies the second `foo' relative to the tab
7575
stop. The second line right-justifies `foobar'. The third line finally
7576
right-justifies only `foo' because of the additional tab character which
7577
marks the end of the string belonging to the last defined tab stop.
7580
Tab stops are associated with the current environment
7581
(@pxref{Environments}).
7584
Calling @code{ta} without an argument removes all tab stops.
7587
@cindex tab stops, for TTY output devices
7588
The start-up value of @code{gtroff} is @w{@samp{T 0.8i}}.
7591
@cindex tab settings register (@code{.tabs})
7592
The read-only number register @code{.tabs} contains a string
7593
representation of the current tab settings suitable for use as an
7594
argument to the @code{ta} request.
7597
.ds tab-string \n[.tabs]
7602
@cindex @code{.S} register, Plan@tie{}9 alias for @code{.tabs}
7603
@cindex @code{.tabs} register, Plan@tie{}9 alias (@code{.S})
7604
The @code{troff} version of the Plan@tie{}9 operating system uses
7605
register @code{.S} for the same purpose.
7608
@Defreq {tc, [@Var{fill-glyph}]}
7609
@cindex tab repetition character (@code{tc})
7610
@cindex character, tab repetition (@code{tc})
7611
@cindex glyph, tab repetition (@code{tc})
7612
Normally @code{gtroff} fills the space to the next tab stop with
7613
whitespace. This can be changed with the @code{tc} request. With no
7614
argument @code{gtroff} reverts to using whitespace, which is the
7615
default. The value of this @dfn{tab repetition character} is associated
7616
with the current environment (@pxref{Environments}).@footnote{@dfn{Tab
7617
repetition character} is a misnomer since it is an output glyph.}
7620
@DefreqList {linetabs, n}
7621
@DefregListEnd {.linetabs}
7622
@cindex tab, line-tabs mode
7623
@cindex line-tabs mode
7624
@cindex mode, line-tabs
7625
If @var{n} is missing or not zero, enable @dfn{line-tabs} mode, or
7626
disable it otherwise (the default). In line-tabs mode, @code{gtroff}
7627
computes tab distances relative to the (current) output line instead of
7630
For example, the following code:
7643
in normal mode, results in the output
7650
in line-tabs mode, the same code outputs
7656
Line-tabs mode is associated with the current environment. The
7657
read-only register @code{.linetabs} is set to@tie{}1 if in line-tabs
7658
mode, and 0 in normal mode.
7666
@c ---------------------------------------------------------------------
7668
@node Leaders, Fields, Tabs and Fields, Tabs and Fields
7672
Sometimes it may may be desirable to use the @code{tc} request to fill a
7673
particular tab stop with a given glyph (for example dots in a table of
7674
contents), but also normal tab stops on the rest of the line. For this
7675
@code{gtroff} provides an alternate tab mechanism, called @dfn{leaders}
7676
which does just that.
7678
@cindex leader character
7679
A leader character (character code@tie{}1) behaves similarly to a tab
7680
character: It moves to the next tab stop. The only difference is that
7681
for this movement, the fill glyph defaults to a period character and not
7685
@cindex leader character, non-interpreted (@code{\a})
7686
@cindex character, leader, non-interpreted (@code{\a})
7687
@cindex @code{\a}, and copy-in mode
7688
@cindex copy-in mode, and @code{\a}
7689
@cindex mode, copy-in, and @code{\a}
7690
This escape is a non-interpreted leader character. In copy mode
7691
(@pxref{Copy-in Mode}), @code{\a} is the same as a real leader
7695
@Defreq {lc, [@Var{fill-glyph}]}
7696
@cindex leader repetition character (@code{lc})
7697
@cindex character, leader repetition (@code{lc})
7698
@cindex glyph, leader repetition (@code{lc})
7699
Declare the @dfn{leader repetition character}.@footnote{@dfn{Leader
7700
repetition character} is a misnomer since it is an output glyph.}
7701
Without an argument, leaders act the same as tabs (i.e., using
7702
whitespace for filling). @code{gtroff}'s start-up value is a dot
7703
(@samp{.}). The value of the leader repetition character is associated
7704
with the current environment (@pxref{Environments}).
7707
@cindex table of contents
7708
@cindex contents, table of
7709
For a table of contents, to name an example, tab stops may be defined so
7710
that the section number is one tab stop, the title is the second with
7711
the remaining space being filled with a line of dots, and then the page
7712
number slightly separated from the dots.
7715
.ds entry 1.1\tFoo\a\t12
7725
1.1 Foo.......................................... 12
7728
@c ---------------------------------------------------------------------
7730
@node Fields, , Leaders, Tabs and Fields
7734
@cindex field delimiting character (@code{fc})
7735
@cindex delimiting character, for fields (@code{fc})
7736
@cindex character, field delimiting (@code{fc})
7737
@cindex field padding character (@code{fc})
7738
@cindex padding character, for fields (@code{fc})
7739
@cindex character, field padding (@code{fc})
7740
@dfn{Fields} are a more general way of laying out tabular data. A field
7741
is defined as the data between a pair of @dfn{delimiting characters}.
7742
It contains substrings which are separated by @dfn{padding characters}.
7743
The width of a field is the distance on the @emph{input} line from the
7744
position where the field starts to the next tab stop. A padding
7745
character inserts stretchable space similar to @TeX{}'s @code{\hss}
7746
command (thus it can even be negative) to make the sum of all substring
7747
lengths plus the stretchable space equal to the field width. If more
7748
than one padding character is inserted, the available space is evenly
7749
distributed among them.
7751
@Defreq {fc, [@Var{delim-char} [@Var{padding-char}]]}
7752
Define a delimiting and a padding character for fields. If the latter
7753
is missing, the padding character defaults to a space character. If
7754
there is no argument at all, the field mechanism is disabled (which is
7755
the default). Note that contrary to e.g.@: the tab repetition
7756
character, delimiting and padding characters are @emph{not} associated
7757
to the current environment (@pxref{Environments}).
7770
and here the result:
7779
@c =====================================================================
7781
@node Character Translations, Troff and Nroff Mode, Tabs and Fields, gtroff Reference
7782
@section Character Translations
7783
@cindex character translations
7784
@cindex translations of characters
7786
@cindex control character, changing (@code{cc})
7787
@cindex character, control, changing (@code{cc})
7788
@cindex no-break control character, changing (@code{c2})
7789
@cindex character, no-break control, changing (@code{c2})
7790
@cindex control character, no-break, changing (@code{c2})
7791
The control character (@samp{.}) and the no-break control character
7792
(@samp{'}) can be changed with the @code{cc} and @code{c2} requests,
7795
@Defreq {cc, [@Var{c}]}
7796
Set the control character to@tie{}@var{c}. With no argument the default
7797
control character @samp{.} is restored. The value of the control
7798
character is associated with the current environment
7799
(@pxref{Environments}).
7802
@Defreq {c2, [@Var{c}]}
7803
Set the no-break control character to@tie{}@var{c}. With no argument
7804
the default control character @samp{'} is restored. The value of the
7805
no-break control character is associated with the current environment
7806
(@pxref{Environments}).
7812
@cindex disabling @code{\} (@code{eo})
7813
@cindex @code{\}, disabling (@code{eo})
7814
Disable the escape mechanism completely. After executing this request,
7815
the backslash character @samp{\} no longer starts an escape sequence.
7817
This request can be very helpful in writing macros since it is not
7818
necessary then to double the escape character. Here an example:
7821
.\" This is a simplified version of the
7822
.\" .BR request from the man macro package
7826
. while (\n[.$] >= 2) \@{\
7827
. as result \fB\$1\fR\$2
7830
. if \n[.$] .as result \fB\$1
7838
@Defreq {ec, [@Var{c}]}
7839
@cindex escape character, changing (@code{ec})
7840
@cindex character, escape, changing (@code{ec})
7841
Set the escape character to@tie{}@var{c}. With no argument the default
7842
escape character @samp{\} is restored. It can be also used to re-enable
7843
the escape mechanism after an @code{eo} request.
7845
Note that changing the escape character globally likely breaks macro
7846
packages since @code{gtroff} has no mechanism to `intern' macros, i.e.,
7847
to convert a macro definition into an internal form which is independent
7848
of its representation (@TeX{} has this mechanism). If a macro is
7849
called, it is executed literally.
7853
@DefreqListEnd {ecr, }
7854
The @code{ecs} request saves the current escape character in an internal
7855
register. Use this request in combination with the @code{ec} request to
7856
temporarily change the escape character.
7858
The @code{ecr} request restores the escape character saved with
7859
@code{ecs}. Without a previous call to @code{ecs}, this request sets
7860
the escape character to @code{\}.
7863
@DefescList {\\\\, , , }
7864
@DefescItem {\\e, , , }
7865
@DefescListEnd {\\E, , , }
7866
Print the current escape character (which is the backslash character
7867
@samp{\} by default).
7869
@code{\\} is a `delayed' backslash; more precisely, it is the default
7870
escape character followed by a backslash, which no longer has special
7871
meaning due to the leading escape character. It is @emph{not} an escape
7872
sequence in the usual sense! In any unknown escape sequence
7873
@code{\@var{X}} the escape character is ignored and @var{X} is printed.
7874
But if @var{X} is equal to the current escape character, no warning is
7877
@cindex @code{\E}, and copy-in mode
7878
@cindex copy-in mode, and @code{\E}
7879
@cindex mode, copy-in, and @code{\E}
7880
As a consequence, only at top-level or in a diversion a backslash glyph
7881
is printed; in copy-in mode, it expands to a single backslash which then
7882
combines with the following character to an escape sequence.
7884
The @code{\E} escape differs from @code{\e} by printing an escape
7885
character that is not interpreted in copy mode. Use this to define
7886
strings with escapes that work when used in copy mode (for example, as a
7887
macro argument). The following example defines strings to begin and end
7891
.ds @{ \v'-.3m'\s'\En[.s]*60/100'
7895
Another example to demonstrate the differences between the various
7896
escape sequences, using a strange escape character, @samp{-}.
7908
The result is surprising for most users, expecting @samp{1} since
7909
@samp{foo} is a valid identifier. What has happened? As mentioned
7910
above, the leading escape character makes the following character
7911
ordinary. Written with the default escape character the sequence
7912
@samp{--} becomes @samp{\-} -- this is the minus sign.
7914
If the escape character followed by itself is a valid escape sequence,
7915
only @code{\E} yields the expected result:
7928
Similar to @code{\\}, the sequence @code{\.} isn't a real escape
7929
sequence. As before, a warning message is suppressed if the escape
7930
character is followed by a dot, and the dot itself is printed.
7947
The first backslash is consumed while the macro is read, and the second
7948
is swallowed while executing macro @code{foo}.
7951
A @dfn{translation} is a mapping of an input character to an output
7952
glyph. The mapping occurs at output time, i.e., the input character
7953
gets assigned the metric information of the mapped output character
7954
right before input tokens are converted to nodes (@pxref{Gtroff
7955
Internals}, for more on this process).
7957
@DefreqList {tr, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
7958
@DefreqListEnd {trin, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
7959
Translate character @var{a} to glyph@tie{}@var{b}, character @var{c} to
7960
glyph@tie{}@var{d}, etc. If there is an odd number of arguments, the
7961
last one is translated to an unstretchable space (@w{@samp{\ }}).
7963
The @code{trin} request is identical to @code{tr}, but when you unformat
7964
a diversion with @code{asciify} it ignores the translation.
7965
@xref{Diversions}, for details about the @code{asciify} request.
7971
@cindex @code{\(}, and translations
7972
@cindex @code{\[}, and translations
7973
@cindex @code{\'}, and translations
7974
@cindex @code{\`}, and translations
7975
@cindex @code{\-}, and translations
7976
@cindex @code{\_}, and translations
7977
@cindex @code{\C}, and translations
7978
@cindex @code{\N}, and translations
7979
@cindex @code{char} request, and translations
7980
@cindex special characters
7981
@cindex character, special
7982
@cindex numbered glyph (@code{\N})
7983
@cindex glyph, numbered (@code{\N})
7984
Special characters (@code{\(@var{xx}}, @code{\[@var{xxx}]},
7985
@code{\C'@var{xxx}'}, @code{\'}, @code{\`}, @code{\-}, @code{\_}),
7986
glyphs defined with the @code{char} request, and numbered glyphs
7987
(@code{\N'@var{xxx}'}) can be translated also.
7990
@cindex @code{\e}, and translations
7991
The @code{\e} escape can be translated also.
7994
@cindex @code{\%}, and translations
7995
@cindex @code{\~}, and translations
7996
Characters can be mapped onto the @code{\%} and @code{\~} escapes (but
7997
@code{\%} and @code{\~} can't be mapped onto another glyph).
8000
@cindex backspace character, and translations
8001
@cindex character, backspace, and translations
8002
@cindex leader character, and translations
8003
@cindex character, leader, and translations
8004
@cindex newline character, and translations
8005
@cindex character, newline, and translations
8006
@cindex tab character, and translations
8007
@cindex character, tab, and translations
8008
@cindex @code{\a}, and translations
8009
@cindex @code{\t}, and translations
8010
The following characters can't be translated: space (with one exception,
8011
see below), backspace, newline, leader (and @code{\a}), tab (and
8015
@cindex @code{shc} request, and translations
8016
Translations are not considered for finding the soft hyphen character
8017
set with the @code{shc} request.
8020
@cindex @code{\&}, and translations
8021
The pair @samp{@var{c}\&} (this is an arbitrary character@tie{}@var{c}
8022
followed by the zero width space character) maps this character to
8032
It is even possible to map the space character to nothing:
8041
As shown in the example, the space character can't be the first
8042
character/glyph pair as an argument of @code{tr}. Additionally, it is
8043
not possible to map the space character to any other glyph; requests
8044
like @w{@samp{.tr aa x}} undo @w{@samp{.tr aa \&}} instead.
8046
If justification is active, lines are justified in spite of the `empty'
8047
space character (but there is no minimal distance, i.e.@: the space
8048
character, between words).
8051
After an output glyph has been constructed (this happens at the moment
8052
immediately before the glyph is appended to an output glyph list, either
8053
by direct output, in a macro, diversion, or string), it is no longer
8054
affected by @code{tr}.
8057
Translating character to glyphs where one of them or both are undefined
8058
is possible also; @code{tr} does not check whether the entities in its
8061
@xref{Gtroff Internals}.
8064
@code{troff} no longer has a hard-coded dependency on @w{Latin-1}; all
8065
@code{char@var{XXX}} entities have been removed from the font
8066
description files. This has a notable consequence which shows up in
8067
warnings like @code{can't find character with input code @var{XXX}} if
8068
the @code{tr} request isn't handled properly.
8070
Consider the following translation:
8077
This maps input character @code{�} onto glyph @code{�}, which is
8078
identical to glyph @code{char201}. But this glyph intentionally doesn't
8079
exist! Instead, @code{\[char201]} is treated as an input character
8080
entity and is by default mapped onto @code{\['E]}, and @code{gtroff}
8081
doesn't handle translations of translations.
8083
The right way to write the above translation is
8090
In other words, the first argument of @code{tr} should be an input
8091
character or entity, and the second one a glyph entity.
8094
Without an argument, the @code{tr} request is ignored.
8098
@Defreq {trnt, @Var{a}@Var{b}@Var{c}@Var{d}@dots{}}
8099
@cindex @code{\!}, and @code{trnt}
8100
@code{trnt} is the same as the @code{tr} request except that the
8101
translations do not apply to text that is transparently throughput into
8102
a diversion with @code{\!}. @xref{Diversions}, for more information.
8115
prints @samp{b} to the standard error stream; if @code{trnt} is used
8116
instead of @code{tr} it prints @samp{a}.
8120
@c =====================================================================
8122
@node Troff and Nroff Mode, Line Layout, Character Translations, gtroff Reference
8123
@section Troff and Nroff Mode
8129
Originally, @code{nroff} and @code{troff} were two separate programs,
8130
the former for TTY output, the latter for everything else. With GNU
8131
@code{troff}, both programs are merged into one executable, sending its
8132
output to a device driver (@code{grotty} for TTY devices, @code{grops}
8133
for @sc{PostScript}, etc.)@: which interprets the intermediate output of
8134
@code{gtroff}. For @acronym{UNIX} @code{troff} it makes sense to talk
8135
about @dfn{Nroff mode} and @dfn{Troff mode} since the differences are
8136
hardcoded. For GNU @code{troff}, this distinction is not appropriate
8137
because @code{gtroff} simply takes the information given in the font
8138
files for a particular device without handling requests specially if a
8139
TTY output device is used.
8141
Usually, a macro package can be used with all output devices.
8142
Nevertheless, it is sometimes necessary to make a distinction between
8143
TTY and non-TTY devices: @code{gtroff} provides two built-in conditions
8144
@samp{n} and @samp{t} for the @code{if}, @code{ie}, and @code{while}
8145
requests to decide whether @code{gtroff} shall behave like @code{nroff}
8146
or like @code{troff}.
8151
Make the @samp{t} built-in condition true (and the @samp{n} built-in
8152
condition false) for @code{if}, @code{ie}, and @code{while} conditional
8153
requests. This is the default if @code{gtroff} (@emph{not}
8154
@code{groff}) is started with the @option{-R} switch to avoid loading of
8155
the start-up files @file{troffrc} and @file{troffrc-end}. Without
8156
@option{-R}, @code{gtroff} stays in troff mode if the output device is
8157
not a TTY (e.g.@: `ps').
8162
Make the @samp{n} built-in condition true (and the @samp{t} built-in
8163
condition false) for @code{if}, @code{ie}, and @code{while} conditional
8164
requests. This is the default if @code{gtroff} uses a TTY output
8165
device; the code for switching to nroff mode is in the file
8166
@file{tty.tmac} which is loaded by the start-up file @code{troffrc}.
8169
@xref{Conditionals and Loops}, for more details on built-in conditions.
8172
@c =====================================================================
8174
@node Line Layout, Line Control, Troff and Nroff Mode, gtroff Reference
8175
@section Line Layout
8177
@cindex layout, line
8179
@cindex dimensions, line
8180
@cindex line dimensions
8181
The following drawing shows the dimensions which @code{gtroff} uses for
8182
placing a line of output onto the page. They are labeled with the
8183
request which manipulates each dimension.
8187
|<-----------ll------------>|
8188
+----+----+----------------------+----+
8190
+----+----+----------------------+----+
8192
|<--------paper width---------------->|
8196
These dimensions are:
8200
@cindex left margin (@code{po})
8201
@cindex margin, left (@code{po})
8202
@cindex page offset (@code{po})
8203
@cindex offset, page (@code{po})
8204
@dfn{Page offset} -- this is the leftmost position of text on the final
8205
output, defining the @dfn{left margin}.
8208
@cindex indentation (@code{in})
8209
@cindex line indentation (@code{in})
8210
@dfn{Indentation} -- this is the distance from the left margin where
8214
@cindex line length (@code{ll})
8215
@cindex length of line (@code{ll})
8216
@dfn{Line length} -- this is the distance from the left margin to right
8220
A simple demonstration:
8224
This is text without indentation.
8225
The line length has been set to 3\~inch.
8228
Now the left and right margins are both increased.
8231
Calling .in and .ll without parameters restore
8232
the previous values.
8238
This is text without indenta-
8239
tion. The line length has
8244
Calling .in and .ll without
8245
parameters restore the previ-
8249
@DefreqList {po, [@Var{offset}]}
8250
@DefreqItem {po, @t{+}@Var{offset}}
8251
@DefreqItem {po, @t{-}@Var{offset}}
8254
Set horizontal page offset to @var{offset} (or increment or decrement
8255
the current value by @var{offset}). Note that this request does not
8256
cause a break, so changing the page offset in the middle of text being
8257
filled may not yield the expected result. The initial value is
8258
1@dmn{i}. For TTY output devices, it is set to 0 in the startup file
8259
@file{troffrc}; the default scaling indicator is @samp{m} (and not
8260
@samp{v} as incorrectly documented in the original @acronym{UNIX} troff
8263
The current page offset can be found in the read-only number register
8266
If @code{po} is called without an argument, the page offset is reset to
8267
the previous value before the last call to @code{po}.
8282
@DefreqList {in, [@Var{indent}]}
8283
@DefreqItem {in, @t{+}@Var{indent}}
8284
@DefreqItem {in, @t{-}@Var{indent}}
8286
Set indentation to @var{indent} (or increment or decrement the current
8287
value by @var{indent}). This request causes a break. Initially, there
8290
If @code{in} is called without an argument, the indentation is reset to
8291
the previous value before the last call to @code{in}. The default
8292
scaling indicator is @samp{m}.
8294
The indentation is associated with the current environment
8295
(@pxref{Environments}).
8297
If a negative indentation value is specified (which is not allowed),
8298
@code{gtroff} emits a warning of type @samp{range} and sets the
8299
indentation to zero.
8301
The effect of @code{in} is delayed until a partially collected line (if
8302
it exists) is output. A temporary indentation value is reset to zero
8305
The current indentation (as set by @code{in}) can be found in the
8306
read-only number register @samp{.i}.
8309
@DefreqList {ti, offset}
8310
@DefreqItem {ti, @t{+}@Var{offset}}
8311
@DefreqItem {ti, @t{-}@Var{offset}}
8312
@DefregListEnd {.in}
8313
Temporarily indent the next output line by @var{offset}. If an
8314
increment or decrement value is specified, adjust the temporary
8315
indentation relative to the value set by the @code{in} request.
8317
This request causes a break; its value is associated with the current
8318
environment (@pxref{Environments}). The default scaling indicator is
8319
@samp{m}. A call of @code{ti} without an argument is ignored.
8321
If the total indentation value is negative (which is not allowed),
8322
@code{gtroff} emits a warning of type @samp{range} and sets the
8323
temporary indentation to zero. `Total indentation' is either
8324
@var{offset} if specified as an absolute value, or the temporary plus
8325
normal indentation, if @var{offset} is given as a relative value.
8327
The effect of @code{ti} is delayed until a partially collected line (if
8328
it exists) is output.
8330
The read-only number register @code{.in} is the indentation that applies
8331
to the current output line.
8333
The difference between @code{.i} and @code{.in} is that the latter takes
8334
into account whether a partially collected line still uses the old
8335
indentation value or a temporary indentation value is active.
8338
@DefreqList {ll, [@Var{length}]}
8339
@DefreqItem {ll, @t{+}@Var{length}}
8340
@DefreqItem {ll, @t{-}@Var{length}}
8342
@DefregListEnd {.ll}
8343
Set the line length to @var{length} (or increment or decrement the
8344
current value by @var{length}). Initially, the line length is set to
8345
6.5@dmn{i}. The effect of @code{ll} is delayed until a partially
8346
collected line (if it exists) is output. The default scaling indicator
8349
If @code{ll} is called without an argument, the line length is reset to
8350
the previous value before the last call to @code{ll}. If a negative
8351
line length is specified (which is not allowed), @code{gtroff} emits a
8352
warning of type @samp{range} and sets the line length to zero.
8354
The line length is associated with the current environment
8355
(@pxref{Environments}).
8357
@cindex line length register (@code{.l})
8358
The current line length (as set by @code{ll}) can be found in the
8359
read-only number register @samp{.l}. The read-only number register
8360
@code{.ll} is the line length that applies to the current output line.
8362
Similar to @code{.i} and @code{.in}, the difference between @code{.l}
8363
and @code{.ll} is that the latter takes into account whether a partially
8364
collected line still uses the old line length value.
8368
@c =====================================================================
8370
@node Line Control, Page Layout, Line Layout, gtroff Reference
8371
@section Line Control
8372
@cindex line control
8373
@cindex control, line
8375
It is important to understand how @code{gtroff} handles input and output
8378
Many escapes use positioning relative to the input line. For example,
8382
This is a \h'|1.2i'test.
8397
The main usage of this feature is to define macros which act exactly at
8398
the place where called.
8401
.\" A simple macro to underline a word
8403
. nop \\$1\l'|0\[ul]'
8408
In the above example, @samp{|0} specifies a negative distance from the
8409
current position (at the end of the just emitted argument @code{\$1})
8410
back to the beginning of the input line. Thus, the @samp{\l} escape
8411
draws a line from right to left.
8413
@cindex input line continuation (@code{\})
8414
@cindex line, input, continuation (@code{\})
8415
@cindex continuation, input line (@code{\})
8416
@cindex output line, continuation (@code{\c})
8417
@cindex line, output, continuation (@code{\c})
8418
@cindex continuation, output line (@code{\c})
8419
@cindex interrupted line
8420
@cindex line, interrupted
8421
@code{gtroff} makes a difference between input and output line
8422
continuation; the latter is also called @dfn{interrupting} a line.
8424
@DefescList {\\@key{RET}, , ,}
8425
@DefescItem {\\c, , ,}
8426
@DefregListEnd {.int}
8427
Continue a line. @code{\@key{RET}} (this is a backslash at the end of a
8428
line immediately followed by a newline) works on the input level,
8429
suppressing the effects of the following newline in the input.
8434
@result{} This is a .test
8437
The @samp{|} operator is also affected.
8439
@cindex @code{\R}, after @code{\c}
8440
@code{\c} works on the output level. Anything after this escape on the
8441
same line is ignored, except @code{\R} which works as usual. Anything
8442
before @code{\c} on the same line is appended to the current partial
8443
output line. The next non-command line after an interrupted line counts
8444
as a new input line.
8446
The visual results depend on whether no-fill mode is active.
8450
@cindex @code{\c}, and no-fill mode
8451
@cindex no-fill mode, and @code{\c}
8452
@cindex mode, no-fill, and @code{\c}
8453
If no-fill mode is active (using the @code{nf} request), the next input
8454
text line after @code{\c} is handled as a continuation of the same input
8461
@result{} This is a test.
8465
@cindex @code{\c}, and fill mode
8466
@cindex fill mode, and @code{\c}
8467
@cindex mode, fill, and @code{\c}
8468
If fill mode is active (using the @code{fi} request), a word interrupted
8469
with @code{\c} is continued with the text on the next input text line,
8470
without an intervening space.
8475
@result{} This is a test.
8479
Note that an intervening control line which causes a break is stronger
8480
than @code{\c}, flushing out the current partial line in the usual way.
8482
@cindex interrupted line register (@code{.int})
8483
The @code{.int} register contains a positive value if the last output
8484
line was interrupted with @code{\c}; this is associated with the current
8485
environment (@pxref{Environments}).
8489
@c =====================================================================
8491
@node Page Layout, Page Control, Line Control, gtroff Reference
8492
@section Page Layout
8494
@cindex layout, page
8496
@code{gtroff} provides some very primitive operations for controlling
8499
@DefreqList {pl, [@Var{length}]}
8500
@DefreqItem {pl, @t{+}@Var{length}}
8501
@DefreqItem {pl, @t{-}@Var{length}}
8503
@cindex page length (@code{pl})
8504
@cindex length of page (@code{pl})
8505
Set the @dfn{page length} to @var{length} (or increment or decrement the
8506
current value by @var{length}). This is the length of the physical
8507
output page. The default scaling indicator is @samp{v}.
8509
@cindex page length register (@code{.p})
8510
The current setting can be found in the read-only number register
8515
@cindex bottom margin
8516
@cindex margin, bottom
8517
Note that this only specifies the size of the page, not the top and
8518
bottom margins. Those are not set by @code{gtroff} directly.
8519
@xref{Traps}, for further information on how to do this.
8521
Negative @code{pl} values are possible also, but not very useful: No
8522
trap is sprung, and each line is output on a single page (thus
8523
suppressing all vertical spacing).
8525
If no argument or an invalid argument is given, @code{pl} sets the page
8526
length to 11@dmn{i}.
8532
@code{gtroff} provides several operations which help in setting up top
8533
and bottom titles (or headers and footers).
8535
@Defreq {tl, @t{'}@Var{left}@t{'}@Var{center}@t{'}@Var{right}@t{'}}
8536
@cindex title line (@code{tl})
8537
@cindex three-part title (@code{tl})
8538
@cindex page number character (@code{%})
8539
Print a @dfn{title line}. It consists of three parts: a left justified
8540
portion, a centered portion, and a right justified portion. The
8541
argument separator @samp{'} can be replaced with any character not
8542
occurring in the title line. The @samp{%} character is replaced with
8543
the current page number. This character can be changed with the
8544
@code{pc} request (see below).
8546
Without argument, @code{tl} is ignored.
8552
The line length set by the @code{ll} request is not honoured by
8553
@code{tl}; use the @code{lt} request (described below) instead, to
8554
control line length for text set by @code{tl}.
8557
A title line is not restricted to the top or bottom of a page.
8560
@code{tl} prints the title line immediately, ignoring a partially filled
8561
line (which stays untouched).
8564
It is not an error to omit closing delimiters. For example,
8565
@w{@samp{.tl /foo}} is equivalent to @w{@samp{.tl /foo///}}: It prints a
8566
title line with the left justified word @samp{foo}; the centered and
8567
right justfied parts are empty.
8570
@code{tl} accepts the same parameter delimiting characters as the
8571
@code{\A} escape; see @ref{Escapes}.
8575
@DefreqList {lt, [@Var{length}]}
8576
@DefreqItem {lt, @t{+}@Var{length}}
8577
@DefreqItem {lt, @t{-}@Var{length}}
8578
@DefregListEnd {.lt}
8579
@cindex length of title line (@code{lt})
8580
@cindex title line, length (@code{lt})
8581
@cindex title line length register (@code{.lt})
8582
The title line is printed using its own line length, which is specified
8583
(or incremented or decremented) with the @code{lt} request. Initially,
8584
the title line length is set to 6.5@dmn{i}. If a negative line length
8585
is specified (which is not allowed), @code{gtroff} emits a warning of
8586
type @samp{range} and sets the title line length to zero. The default
8587
scaling indicator is @samp{m}. If @code{lt} is called without an
8588
argument, the title length is reset to the previous value before the
8589
last call to @code{lt}.
8591
The current setting of this is available in the @code{.lt} read-only
8592
number register; it is associated with the current environment
8593
(@pxref{Environments}).
8596
@DefreqList {pn, page}
8597
@DefreqItem {pn, @t{+}@Var{page}}
8598
@DefreqItem {pn, @t{-}@Var{page}}
8599
@DefregListEnd {.pn}
8600
@cindex page number (@code{pn})
8601
@cindex number, page (@code{pn})
8602
Change (increase or decrease) the page number of the @emph{next} page.
8603
The only argument is the page number; the request is ignored without a
8606
The read-only number register @code{.pn} contains the number of the next
8607
page: either the value set by a @code{pn} request, or the number of the
8608
current page plus@tie{}1.
8611
@Defreq {pc, [@Var{char}]}
8612
@cindex changing the page number character (@code{pc})
8613
@cindex page number character, changing (@code{pc})
8615
Change the page number character (used by the @code{tl} request) to a
8616
different character. With no argument, this mechanism is disabled.
8617
Note that this doesn't affect the number register@tie{}@code{%}.
8623
@c =====================================================================
8625
@node Page Control, Fonts and Symbols, Page Layout, gtroff Reference
8626
@section Page Control
8627
@cindex page control
8628
@cindex control, page
8630
@DefreqList {bp, [@Var{page}]}
8631
@DefreqItem {bp, @t{+}@Var{page}}
8632
@DefreqItem {bp, @t{-}@Var{page}}
8634
@cindex new page (@code{bp})
8635
@cindex page, new (@code{bp})
8636
Stop processing the current page and move to the next page. This
8637
request causes a break. It can also take an argument to set (increase,
8638
decrease) the page number of the next page (which actually becomes the
8639
current page after @code{bp} has finished). The difference between
8640
@code{bp} and @code{pn} is that @code{pn} does not cause a break or
8641
actually eject a page. @xref{Page Layout}.
8644
.de newpage \" define macro
8646
'sp .5i \" vertical space
8647
.tl 'left top'center top'right top' \" title
8648
'sp .3i \" vertical space
8652
@cindex @code{bp} request, and top-level diversion
8653
@cindex top-level diversion, and @code{bp}
8654
@cindex diversion, top-level, and @code{bp}
8655
@code{bp} has no effect if not called within the top-level diversion
8656
(@pxref{Diversions}).
8658
@cindex page number register (@code{%})
8659
@cindex current page number (@code{%})
8660
The read-write register@tie{}@code{%} holds the current page number.
8662
The number register @code{.pe} is set to@tie{}1 while @code{bp} is
8663
active. @xref{Page Location Traps}.
8666
@Defreq {ne, [@Var{space}]}
8667
@cindex orphan lines, preventing with @code{ne}
8668
@cindex conditional page break (@code{ne})
8669
@cindex page break, conditional (@code{ne})
8670
It is often necessary to force a certain amount of space before a new
8671
page occurs. This is most useful to make sure that there is not a
8672
single @dfn{orphan} line left at the bottom of a page. The @code{ne}
8673
request ensures that there is a certain distance, specified by the first
8674
argument, before the next page is triggered (see @ref{Traps}, for
8675
further information). The default scaling indicator for @code{ne} is
8676
@samp{v}; the default value of @var{space} is@tie{}1@dmn{v} if no
8679
For example, to make sure that no fewer than 2@tie{}lines get orphaned,
8680
do the following before each paragraph:
8687
@code{ne} then automatically causes a page break if there is space for
8691
@DefreqList {sv, [@Var{space}]}
8692
@DefreqListEnd {os, }
8693
@cindex @code{ne} request, comparison with @code{sv}
8694
@code{sv} is similar to the @code{ne} request; it reserves the specified
8695
amount of vertical space. If the desired amount of space exists before
8696
the next trap (or the bottom page boundary if no trap is set), the space
8697
is output immediately (ignoring a partially filled line which stays
8698
untouched). If there is not enough space, it is stored for later output
8699
via the @code{os} request. The default value is@tie{}1@dmn{v} if no
8700
argument is given; the default scaling indicator is @samp{v}.
8702
@cindex @code{sv} request, and no-space mode
8703
@cindex @code{os} request, and no-space mode
8704
Both @code{sv} and @code{os} ignore no-space mode. While the @code{sv}
8705
request allows negative values for @var{space}, @code{os} ignores them.
8709
@cindex current vertical position (@code{nl})
8710
@cindex vertical position, current (@code{nl})
8711
@cindex position, vertical, current (@code{nl})
8712
This register contains the current vertical position. If the vertical
8713
position is zero and the top of page transition hasn't happened yet,
8714
@code{nl} is set to negative value. @code{gtroff} itself does this at
8715
the very beginning of a document before anything has been printed, but
8716
the main usage is to plant a header trap on a page if this page has
8719
Consider the following:
8751
Without resetting @code{nl} to a negative value, the just planted trap
8752
would be active beginning with the @emph{next} page, not the current
8755
@xref{Diversions}, for a comparison with the @code{.h} and @code{.d}
8760
@c =====================================================================
8762
@node Fonts and Symbols, Sizes, Page Control, gtroff Reference
8763
@section Fonts and Symbols
8766
@code{gtroff} can switch fonts at any point in the text.
8768
The basic set of fonts is @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
8769
These are Times Roman, Italic, Bold, and Bold Italic. For non-TTY
8770
devices, there is also at least one symbol font which contains various
8771
special symbols (Greek, mathematics).
8778
* Character Classes::
8780
* Artificial Fonts::
8781
* Ligatures and Kerning::
8784
@c ---------------------------------------------------------------------
8786
@node Changing Fonts, Font Families, Fonts and Symbols, Fonts and Symbols
8787
@subsection Changing Fonts
8790
@DefreqList {ft, [@Var{font}]}
8791
@DefescItem {\\f, , f, }
8792
@DefescItem {\\f, @Lparen{}, fn, }
8793
@DefescItem {\\f, @Lbrack{}, font, @Rbrack{}}
8794
@DefregListEnd {.sty}
8795
@cindex changing fonts (@code{ft}, @code{\f})
8796
@cindex fonts, changing (@code{ft}, @code{\f})
8797
@cindex @code{sty} request, and changing fonts
8798
@cindex @code{fam} request, and changing fonts
8799
@cindex @code{\F}, and changing fonts
8803
The @code{ft} request and the @code{\f} escape change the current font
8804
to @var{font} (one-character name@tie{}@var{f}, two-character name
8807
If @var{font} is a style name (as set with the @code{sty} request or
8808
with the @code{styles} command in the @file{DESC} file), use it within
8809
the current font family (as set with the @code{fam} request, @code{\F}
8810
escape, or with the @code{family} command in the @file{DESC} file).
8812
It is not possible to switch to a font with the name @samp{DESC}
8813
(whereas this name could be used as a style name; however, this is not
8816
@cindex previous font (@code{ft}, @code{\f[]}, @code{\fP})
8817
@cindex font, previous (@code{ft}, @code{\f[]}, @code{\fP})
8818
With no argument or using @samp{P} as an argument, @code{.ft} switches
8819
to the previous font. Use @code{\f[]} to do this with the escape. The
8820
old syntax forms @code{\fP} or @code{\f[P]} are also supported.
8822
Fonts are generally specified as upper-case strings, which are usually
8823
1@tie{}to 4 characters representing an abbreviation or acronym of the
8824
font name. This is no limitation, just a convention.
8826
The example below produces two identical lines.
8835
eggs, bacon, \fBspam\fP and sausage.
8838
Note that @code{\f} doesn't produce an input token in @code{gtroff}. As
8839
a consequence, it can be used in requests like @code{mc} (which expects
8840
a single character as an argument) to change the font on the fly:
8846
The current style name is available in the read-only number register
8847
@samp{.sty} (this is a string-valued register); if the current font
8848
isn't a style, the empty string is returned. It is associated with the
8849
current environment.
8851
@xref{Font Positions}, for an alternative syntax.
8854
@Defreq {ftr, f [@Var{g}]}
8855
@cindex font translation (@code{ftr})
8856
@cindex @code{ft} request, and font translations
8857
@cindex @code{ul} request, and font translations
8858
@cindex @code{bd} request, and font translations
8859
@cindex @code{\f}, and font translations
8860
@cindex @code{cs} request, and font translations
8861
@cindex @code{tkf} request, and font translations
8862
@cindex @code{special} request, and font translations
8863
@cindex @code{fspecial} request, and font translations
8864
@cindex @code{fp} request, and font translations
8865
@cindex @code{sty} request, and font translations
8866
@cindex @code{if} request, and font translations
8867
@cindex @code{ie} request, and font translations
8868
@cindex @code{while} request, and font translations
8869
Translate font@tie{}@var{f} to font@tie{}@var{g}. Whenever a font
8870
named@tie{}@var{f} is referred to in a @code{\f} escape sequence, in the
8871
@code{F} and @code{S} conditional operators, or in the @code{ft},
8872
@code{ul}, @code{bd}, @code{cs}, @code{tkf}, @code{special},
8873
@code{fspecial}, @code{fp}, or @code{sty} requests, font@tie{}@var{g} is
8874
used. If @var{g} is missing or equal to@tie{}@var{f} the translation is
8877
Note that it is not possible to chain font translations. Example:
8883
@result{} warning: can't find font `XXX'
8887
@DefreqList {fzoom, f [@Var{zoom}]}
8888
@DefregListEnd {.zoom}
8889
@cindex magnification of a font (@code{fzoom})
8890
@cindex font, magnification (@code{fzoom})
8891
@cindex zoom factor of a font (@code{fzoom})
8892
@cindex factor, zoom, of a font (@code{fzoom})
8893
@cindex font, zoom factor (@code{fzoom})
8894
@cindex optical size of a font
8895
@cindex font, optical size
8896
@cindex size, optical, of a font
8897
Set magnification of font@tie{}@var{f} to factor @var{zoom}, which must
8898
be a non-negative integer multiple of 1/1000th. This request is useful
8899
to adjust the optical size of a font in relation to the others. In the
8900
example below, font @code{CR} is magnified by 10% (the zoom factor is
8907
Palatino and \f[CR]Courier\f[]
8910
A missing or zero value of @var{zoom} is the same as a value of 1000,
8911
which means no magnification. @var{f}@tie{}must be a real font name,
8914
Note that the magnification of a font is completely transparent to
8915
troff; a change of the zoom factor doesn't cause any effect except that
8916
the dimensions of glyphs, (word) spaces, kerns, etc., of the affected
8917
font are adjusted accordingly.
8919
The zoom factor of the current font is available in the read-only number
8920
register @samp{.zoom}, in multiples of 1/1000th. It returns zero if
8921
there is no magnification.
8924
@c ---------------------------------------------------------------------
8926
@node Font Families, Font Positions, Changing Fonts, Fonts and Symbols
8927
@subsection Font Families
8928
@cindex font families
8929
@cindex families, font
8931
@cindex styles, font
8933
Due to the variety of fonts available, @code{gtroff} has added the
8934
concept of @dfn{font families} and @dfn{font styles}. The fonts are
8935
specified as the concatenation of the font family and style. Specifying
8936
a font without the family part causes @code{gtroff} to use that style of
8939
@cindex PostScript fonts
8940
@cindex fonts, PostScript
8941
Currently, fonts for the devices @option{-Tps}, @option{-Tpdf},
8942
@option{-Tdvi}, @option{-Tlj4}, @option{-Tlbp}, and the X11 fonts are
8943
set up to this mechanism. By default, @code{gtroff} uses the Times
8944
family with the four styles @samp{R}, @samp{I}, @samp{B}, and @samp{BI}.
8946
This way, it is possible to use the basic four fonts and to select a
8947
different font family on the command line (@pxref{Groff Options}).
8949
@DefreqList {fam, [@Var{family}]}
8951
@DefescItem {\\F, , f, }
8952
@DefescItem {\\F, @Lparen{}, fm, }
8953
@DefescItem {\\F, @Lbrack{}, family, @Rbrack{}}
8954
@DefregListEnd {.fn}
8955
@cindex changing font family (@code{fam}, @code{\F})
8956
@cindex font family, changing (@code{fam}, @code{\F})
8957
Switch font family to @var{family} (one-character name@tie{}@var{f},
8958
two-character name @var{fm}). If no argument is given, switch back to
8959
the previous font family. Use @code{\F[]} to do this with the escape.
8960
Note that @code{\FP} doesn't work; it selects font family @samp{P}
8963
The value at start-up is @samp{T}. The current font family is available
8964
in the read-only number register @samp{.fam} (this is a string-valued
8965
register); it is associated with the current environment.
8969
.fam H \" helvetica family
8970
spam, \" used font is family H + style R = HR
8971
.ft B \" family H + style B = font HB
8973
.fam T \" times family
8974
spam, \" used font is family T + style B = TB
8975
.ft AR \" font AR (not a style)
8977
.ft R \" family T + style R = font TR
8981
Note that @code{\F} doesn't produce an input token in @code{gtroff}. As
8982
a consequence, it can be used in requests like @code{mc} (which expects
8983
a single character as an argument) to change the font family on the fly:
8989
The @samp{.fn} register contains the current @dfn{real font name} of the
8990
current font. This is a string-valued register. If the current font is
8991
a style, the value of @code{\n[.fn]} is the proper concatenation of
8992
family and style name.
8995
@Defreq {sty, n style}
8996
@cindex changing font style (@code{sty})
8997
@cindex font style, changing (@code{sty})
8998
@cindex @code{cs} request, and font styles
8999
@cindex @code{bd} request, and font styles
9000
@cindex @code{tkf} request, and font styles
9001
@cindex @code{uf} request, and font styles
9002
@cindex @code{fspecial} request, and font styles
9003
Associate @var{style} with font position@tie{}@var{n}. A font position
9004
can be associated either with a font or with a style. The current font
9005
is the index of a font position and so is also either a font or a style.
9006
If it is a style, the font that is actually used is the font which name
9007
is the concatenation of the name of the current family and the name of
9008
the current style. For example, if the current font is@tie{}1 and font
9009
position@tie{}1 is associated with style @samp{R} and the current font
9010
family is @samp{T}, then font @samp{TR} is used. If the current font is
9011
not a style, then the current family is ignored. If the requests
9012
@code{cs}, @code{bd}, @code{tkf}, @code{uf}, or @code{fspecial} are
9013
applied to a style, they are instead applied to the member of the
9014
current family corresponding to that style.
9016
@var{n}@tie{}must be a non-negative integer value.
9020
The default family can be set with the @option{-f} option (@pxref{Groff
9021
Options}). The @code{styles} command in the @file{DESC} file controls
9022
which font positions (if any) are initially associated with styles
9023
rather than fonts. For example, the default setting for @sc{PostScript}
9040
@code{fam} and @code{\F} always check whether the current font position
9041
is valid; this can give surprising results if the current font position
9042
is associated with a style.
9044
In the following example, we want to access the @sc{PostScript} font
9045
@code{FooBar} from the font family @code{Foo}:
9050
@result{} warning: can't find font `FooR'
9054
The default font position at start-up is@tie{}1; for the @sc{PostScript}
9055
device, this is associated with style @samp{R}, so @code{gtroff} tries
9056
to open @code{FooR}.
9058
A solution to this problem is to use a dummy font like the following:
9061
.fp 0 dummy TR \" set up dummy font at position 0
9062
.sty \n[.fp] Bar \" register style `Bar'
9063
.ft 0 \" switch to font at position 0
9064
.fam Foo \" activate family `Foo'
9065
.ft Bar \" switch to font `FooBar'
9068
@xref{Font Positions}.
9071
@c ---------------------------------------------------------------------
9073
@node Font Positions, Using Symbols, Font Families, Fonts and Symbols
9074
@subsection Font Positions
9075
@cindex font positions
9076
@cindex positions, font
9078
For the sake of old phototypesetters and compatibility with old versions
9079
of @code{troff}, @code{gtroff} has the concept of font @dfn{positions},
9080
on which various fonts are mounted.
9082
@DefreqList {fp, pos font [@Var{external-name}]}
9084
@DefregListEnd {.fp}
9085
@cindex mounting font (@code{fp})
9086
@cindex font, mounting (@code{fp})
9087
Mount font @var{font} at position @var{pos} (which must be a
9088
non-negative integer). This numeric position can then be referred to
9089
with font changing commands. When @code{gtroff} starts it is using font
9090
position@tie{}1 (which must exist; position@tie{}0 is unused usually at
9093
@cindex font position register (@code{.f})
9094
The current font in use, as a font position, is available in the
9095
read-only number register @samp{.f}. This can be useful to remember the
9096
current font for later recall. It is associated with the current
9097
environment (@pxref{Environments}).
9100
.nr save-font \n[.f]
9102
... text text text ...
9106
@cindex next free font position register (@code{.fp})
9107
The number of the next free font position is available in the read-only
9108
number register @samp{.fp}. This is useful when mounting a new font,
9112
.fp \n[.fp] NEATOFONT
9115
@pindex DESC@r{, and font mounting}
9116
Fonts not listed in the @file{DESC} file are automatically mounted on
9117
the next available font position when they are referenced. If a font is
9118
to be mounted explicitly with the @code{fp} request on an unused font
9119
position, it should be mounted on the first unused font position, which
9120
can be found in the @code{.fp} register. Although @code{gtroff} does
9121
not enforce this strictly, it is not allowed to mount a font at a
9122
position whose number is much greater (approx.@: 1000 positions) than
9123
that of any currently used position.
9125
The @code{fp} request has an optional third argument. This argument
9126
gives the external name of the font, which is used for finding the font
9127
description file. The second argument gives the internal name of the
9128
font which is used to refer to the font in @code{gtroff} after it has
9129
been mounted. If there is no third argument then the internal name is
9130
used as the external name. This feature makes it possible to use fonts
9131
with long names in compatibility mode.
9134
Both the @code{ft} request and the @code{\f} escape have alternative
9135
syntax forms to access font positions.
9137
@DefreqList {ft, nnn}
9138
@DefescItem {\\f, , n, }
9139
@DefescItem {\\f, @Lparen{}, nn, }
9140
@DefescListEnd {\\f, @Lbrack{}, nnn, @Rbrack{}}
9141
@cindex changing font position (@code{\f})
9142
@cindex font position, changing (@code{\f})
9143
@cindex @code{sty} request, and font positions
9144
@cindex @code{fam} request, and font positions
9145
@cindex @code{\F}, and font positions
9149
Change the current font position to @var{nnn} (one-digit
9150
position@tie{}@var{n}, two-digit position @var{nn}), which must be a
9151
non-negative integer.
9153
If @var{nnn} is associated with a style (as set with the @code{sty}
9154
request or with the @code{styles} command in the @file{DESC} file), use
9155
it within the current font family (as set with the @code{fam} request,
9156
the @code{\F} escape, or with the @code{family} command in the
9163
.ft \" switch back to font 1
9167
this is font 1 again
9170
@xref{Changing Fonts}, for the standard syntax form.
9173
@c ---------------------------------------------------------------------
9175
@node Using Symbols, Character Classes, Font Positions, Fonts and Symbols
9176
@subsection Using Symbols
9177
@cindex using symbols
9178
@cindex symbols, using
9183
A @dfn{glyph} is a graphical representation of a @dfn{character}. While
9184
a character is an abstract entity containing semantic information, a
9185
glyph is something which can be actually seen on screen or paper. It is
9186
possible that a character has multiple glyph representation forms (for
9187
example, the character `A' can be either written in a roman or an italic
9188
font, yielding two different glyphs); sometimes more than one character
9189
maps to a single glyph (this is a @dfn{ligature} -- the most common is
9193
@cindex special fonts
9196
@cindex @code{special} request, and glyph search order
9197
@cindex @code{fspecial} request, and glyph search order
9198
A @dfn{symbol} is simply a named glyph. Within @code{gtroff}, all glyph
9199
names of a particular font are defined in its font file. If the user
9200
requests a glyph not available in this font, @code{gtroff} looks up an
9201
ordered list of @dfn{special fonts}. By default, the @sc{PostScript}
9202
output device supports the two special fonts @samp{SS} (slanted symbols)
9203
and @samp{S} (symbols) (the former is looked up before the latter).
9204
Other output devices use different names for special fonts. Fonts
9205
mounted with the @code{fonts} keyword in the @file{DESC} file are
9206
globally available. To install additional special fonts locally (i.e.@:
9207
for a particular font), use the @code{fspecial} request.
9209
Here the exact rules how @code{gtroff} searches a given symbol:
9213
If the symbol has been defined with the @code{char} request, use it.
9214
This hides a symbol with the same name in the current font.
9217
Check the current font.
9220
If the symbol has been defined with the @code{fchar} request, use it.
9223
Check whether the current font has a font-specific list of special
9224
fonts; test all fonts in the order of appearance in the last
9225
@code{fspecial} call if appropriate.
9228
If the symbol has been defined with the @code{fschar} request for the
9229
current font, use it.
9232
Check all fonts in the order of appearance in the last @code{special}
9236
If the symbol has been defined with the @code{schar} request, use it.
9239
As a last resort, consult all fonts loaded up to now for special fonts
9240
and check them, starting with the lowest font number. Note that this
9241
can sometimes lead to surprising results since the @code{fonts} line in
9242
the @file{DESC} file often contains empty positions which are filled
9243
later on. For example, consider the following:
9250
This mounts font @code{foo} at font position@tie{}3. We assume that
9251
@code{FOO} is a special font, containing glyph @code{foo}, and that no
9252
font has been loaded yet. The line
9259
makes font @code{BAZ} special only if font @code{BAR} is active. We
9260
further assume that @code{BAZ} is really a special font, i.e., the font
9261
description file contains the @code{special} keyword, and that it also
9262
contains glyph @code{foo} with a special shape fitting to font
9263
@code{BAR}. After executing @code{fspecial}, font @code{BAR} is loaded
9264
at font position@tie{}1, and @code{BAZ} at position@tie{}2.
9266
We now switch to a new font @code{XXX}, trying to access glyph
9267
@code{foo} which is assumed to be missing. There are neither
9268
font-specific special fonts for @code{XXX} nor any other fonts made
9269
special with the @code{special} request, so @code{gtroff} starts the
9270
search for special fonts in the list of already mounted fonts, with
9271
increasing font positions. Consequently, it finds @code{BAZ} before
9272
@code{FOO} even for @code{XXX} which is not the intended behaviour.
9275
@xref{Font Files}, and @ref{Special Fonts}, for more details.
9277
@cindex list of available glyphs (@cite{groff_char(7)} man page)
9278
@cindex available glyphs, list (@cite{groff_char(7)} man page)
9279
@cindex glyphs, available, list (@cite{groff_char(7)} man page)
9280
The list of available symbols is device dependent; see the
9281
@cite{groff_char(7)} man page for a complete list of all glyphs. For
9285
man -Tdvi groff_char > groff_char.dvi
9289
for a list using the default DVI fonts (not all versions of the
9290
@code{man} program support the @option{-T} option). If you want to use
9291
an additional macro package to change the used fonts, @code{groff} must
9295
groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
9298
@cindex composite glyph names
9299
@cindex glyph names, composite
9300
@cindex groff glyph list (GGL)
9301
@cindex GGL (groff glyph list)
9302
@cindex adobe glyph list (AGL)
9303
@cindex AGL (adobe glyph list)
9304
Glyph names not listed in groff_char(7) are derived algorithmically,
9305
using a simplified version of the Adobe Glyph List (AGL) algorithm which
9307
@uref{http://partners.adobe.com@//public@//developer@//opentype@//index_glyph.html}.
9308
The (frozen) set of glyph names which can't be derived algorithmically
9309
is called @dfn{groff glyph list (GGL)}.
9313
A glyph for Unicode character U+@var{XXXX}[@var{X}[@var{X}]] which is
9314
not a composite character is named
9315
@code{u@var{XXXX}@r{[}@var{X}@r{[}@var{X}@r{]]}}. @var{X} must be an
9316
uppercase hexadecimal digit. Examples: @code{u1234}, @code{u008E},
9317
@code{u12DB8}. The largest Unicode value is 0x10FFFF. There must be at
9318
least four @code{X} digits; if necessary, add leading zeroes (after the
9319
@samp{u}). No zero padding is allowed for character codes greater than
9320
0xFFFF. Surrogates (i.e., Unicode values greater than 0xFFFF
9321
represented with character codes from the surrogate area U+D800-U+DFFF)
9322
are not allowed too.
9325
A glyph representing more than a single input character is named
9328
@samp{u} @var{component1} @samp{_} @var{component2} @samp{_} @var{component3} @dots{}
9332
Example: @code{u0045_0302_0301}.
9334
For simplicity, all Unicode characters which are composites must be
9335
decomposed maximally (this is normalization form@tie{}D in the Unicode
9336
standard); for example, @code{u00CA_0301} is not a valid glyph name
9337
since U+00CA (@sc{latin capital letter e with circumflex}) can be
9338
further decomposed into U+0045 (@sc{latin capital letter e}) and U+0302
9339
(@sc{combining circumflex accent}). @code{u0045_0302_0301} is thus the
9340
glyph name for U+1EBE, @sc{latin capital letter e with circumflex and
9344
groff maintains a table to decompose all algorithmically derived glyph
9345
names which are composites itself. For example, @code{u0100} (@sc{latin
9346
letter a with macron}) is automatically decomposed into
9347
@code{u0041_0304}. Additionally, a glyph name of the GGL is preferred
9348
to an algorithmically derived glyph name; groff also automatically does
9349
the mapping. Example: The glyph @code{u0045_0302} is mapped to
9353
glyph names of the GGL can't be used in composite glyph names; for
9354
example, @code{^E_u0301} is invalid.
9357
@DefescList {\\, @Lparen{}, nm, }
9358
@DefescItem {\\, @Lbrack{}, name, @Rbrack{}}
9359
@DefescListEnd {\\, @Lbrack{}, component1 component2 @dots{}, @Rbrack{}}
9360
Insert a symbol @var{name} (two-character name @var{nm}) or a composite
9361
glyph with component glyphs @var{component1}, @var{component2},
9362
@enddots{} There is no special syntax for one-character names -- the
9363
natural form @samp{\@var{n}} would collide with escapes.@footnote{Note
9364
that a one-character symbol is not the same as an input character, i.e.,
9365
the character @code{a} is not the same as @code{\[a]}. By default,
9366
@code{groff} defines only a single one-character symbol, @code{\[-]}; it
9367
is usually accessed as @code{\-}. On the other hand, @code{gtroff} has
9368
the special feature that @code{\[char@var{XXX}]} is the same as the
9369
input character with character code @var{XXX}. For example,
9370
@code{\[char97]} is identical to the letter @code{a} if @acronym{ASCII}
9371
encoding is active.}
9373
If @var{name} is undefined, a warning of type @samp{char} is generated,
9374
and the escape is ignored. @xref{Debugging}, for information about
9377
groff resolves @code{\[...]} with more than a single component as
9382
Any component which is found in the GGL is converted to the
9383
@code{u@var{XXXX}} form.
9386
Any component @code{u@var{XXXX}} which is found in the list of
9387
decomposable glyphs is decomposed.
9390
The resulting elements are then concatenated with @samp{_} in between,
9391
dropping the leading @samp{u} in all elements but the first.
9394
No check for the existence of any component (similar to @code{tr}
9401
@samp{A} maps to @code{u0041}, @samp{ho} maps to @code{u02DB}, thus the
9402
final glyph name would be @code{u0041_02DB}. Note this is not the
9403
expected result: The ogonek glyph @samp{ho} is a spacing ogonek, but for
9404
a proper composite a non-spacing ogonek (U+0328) is necessary. Looking
9405
into the file @file{composite.tmac} one can find @w{@samp{.composite ho
9406
u0328}} which changes the mapping of @samp{ho} while a composite glyph
9407
name is constructed, causing the final glyph name to be
9414
@samp{^E} maps to @code{u0045_0302}, thus the final glyph name is
9415
@code{u0045_0302_0301} in all forms (assuming proper calls of the
9416
@code{composite} request).
9419
It is not possible to define glyphs with names like @w{@samp{A ho}}
9420
within a groff font file. This is not really a limitation; instead, you
9421
have to define @code{u0041_0328}.
9424
@Defesc {\\C, ', xxx, '}
9425
@cindex named character (@code{\C})
9426
@cindex character, named (@code{\C})
9427
Typeset the glyph named @var{xxx}.@footnote{@code{\C} is actually a
9428
misnomer since it accesses an output glyph.} Normally it is more
9429
convenient to use @code{\[@var{xxx}]}, but @code{\C} has the advantage
9430
that it is compatible with newer versions of @acronym{AT&T} @code{troff}
9431
and is available in compatibility mode.
9434
@Defreq {composite, from to}
9435
@pindex composite.tmac
9436
Map glyph name @var{from} to glyph name @var{to} if it is used in
9437
@code{\[...]} with more than one component. See above for examples.
9439
This mapping is based on glyph names only; no check for the existence of
9440
either glyph is done.
9442
A set of default mappings for many accents can be found in the file
9443
@file{composite.tmac} which is loaded at start-up.
9446
@Defesc {\\N, ', n, '}
9447
@cindex numbered glyph (@code{\N})
9448
@cindex glyph, numbered (@code{\N})
9449
@cindex @code{char} request, used with @code{\N}
9451
Typeset the glyph with code@tie{}@var{n} in the current font
9452
(@code{n}@tie{}is @strong{not} the input character code). The number
9453
@var{n}@tie{}can be any non-negative decimal integer. Most devices only
9454
have glyphs with codes between 0 and@tie{}255; the Unicode output device
9455
uses codes in the range 0--65535. If the current font does not contain
9456
a glyph with that code, special fonts are @emph{not} searched. The
9457
@code{\N} escape sequence can be conveniently used in conjunction with
9458
the @code{char} request:
9461
.char \[phone] \f[ZD]\N'37'
9466
@cindex unnamed glyphs
9467
@cindex glyphs, unnamed
9468
The code of each glyph is given in the fourth column in the font
9469
description file after the @code{charset} command. It is possible to
9470
include unnamed glyphs in the font description file by using a name of
9471
@samp{---}; the @code{\N} escape sequence is the only way to use these.
9473
No kerning is applied to glyphs accessed with @code{\N}.
9476
Some escape sequences directly map onto special glyphs.
9479
This is a backslash followed by the apostrophe character,
9480
@acronym{ASCII} character @code{0x27} (@acronym{EBCDIC} character
9481
@code{0x7D}). The same as @code{\[aa]}, the acute accent.
9485
This is a backslash followed by @acronym{ASCII} character @code{0x60}
9486
(@acronym{EBCDIC} character @code{0x79} usually). The same as
9487
@code{\[ga]}, the grave accent.
9491
This is the same as @code{\[-]}, the minus sign in the current font.
9495
This is the same as @code{\[ul]}, the underline character.
9498
@Defreq {cflags, n c1 c2 @dots{}}
9499
@cindex glyph properties (@code{cflags})
9500
@cindex character properties (@code{cflags})
9501
@cindex properties of glyphs (@code{cflags})
9502
@cindex properties of characters (@code{cflags})
9503
Input characters and symbols have certain properties associated with
9504
it.@footnote{Note that the output glyphs themselves don't have such
9505
properties. For @code{gtroff}, a glyph is a numbered box with a given
9506
width, depth, and height, nothing else. All manipulations with the
9507
@code{cflags} request work on the input level.} These properties can be
9508
modified with the @code{cflags} request. The first argument is the sum
9509
of the desired flags and the remaining arguments are the characters or
9510
symbols to have those properties. It is possible to omit the spaces
9511
between the characters or symbols. Instead of single characters or
9512
symbols you can also use character classes (see @ref{Character Classes}
9517
@cindex end-of-sentence characters
9518
@cindex characters, end-of-sentence
9519
The character ends sentences (initially characters @samp{.?!} have this
9523
@cindex hyphenating characters
9524
@cindex characters, hyphenation
9525
Lines can be broken before the character (initially no characters have
9526
this property). This only works if both the characters before and after
9527
have non-zero hyphenation codes (as set with the @code{hcode} request).
9528
Use value@tie{}64 to override this behaviour.
9531
@cindex @code{hy} glyph, and @code{cflags}
9532
@cindex @code{em} glyph, and @code{cflags}
9533
Lines can be broken after the character (initially the character
9534
@samp{-} and the symbols @samp{\[hy]} and @samp{\[em]} have this
9535
property). This only works if both the characters before and after have
9536
non-zero hyphenation codes (as set with the @code{hcode} request). Use
9537
value@tie{}64 to override this behaviour.
9540
@cindex overlapping characters
9541
@cindex characters, overlapping
9542
@cindex @code{ul} glyph, and @code{cflags}
9543
@cindex @code{rn} glyph, and @code{cflags}
9544
@cindex @code{ru} glyph, and @code{cflags}
9545
@cindex @code{radicalex} glyph, and @code{cflags}
9546
@cindex @code{sqrtex} glyph, and @code{cflags}
9547
The character overlaps horizontally if used as a horizontal line
9548
building element. Initially the symbols @samp{\[ul]}, @samp{\[rn]},
9549
@samp{\[ru]}, @samp{\[radicalex]}, and @samp{\[sqrtex]} have this
9553
@cindex @code{br} glyph, and @code{cflags}
9554
The character overlaps vertically if used as vertical line building
9555
element. Initially symbol @samp{\[br]} has this property.
9558
@cindex transparent characters
9559
@cindex character, transparent
9560
@cindex @code{"}, at end of sentence
9561
@cindex @code{'}, at end of sentence
9562
@cindex @code{)}, at end of sentence
9563
@cindex @code{]}, at end of sentence
9564
@cindex @code{*}, at end of sentence
9565
@cindex @code{dg} glyph, at end of sentence
9566
@cindex @code{rq} glyph, at end of sentence
9567
An end-of-sentence character followed by any number of characters with
9568
this property is treated as the end of a sentence if followed by a
9569
newline or two spaces; in other words the character is @dfn{transparent}
9570
for the purposes of end-of-sentence recognition -- this is the same as
9571
having a zero space factor in @TeX{} (initially characters @samp{"')]*}
9572
and the symbols @samp{\[dg]} and @samp{\[rq]} have this property).
9575
Ignore hyphenation code values of the surrounding characters. Use this
9576
in combination with values 2 and@tie{}4 (initially no characters have
9577
this property). For example, if you need an automatic break point after
9578
the hyphen in number ranges like `3000-5000', insert
9585
into your document. Note, however, that this can lead to bad layout if
9586
done without thinking; in most situations, a better solution instead of
9587
changing the @code{cflags} value is to insert @code{\:} right after the
9588
hyphen at the places which really need a break point.
9591
Prohibit a line break before the character, but allow a line break after
9592
the character. This works only in combination with flags 256 and 512
9593
(see below) and has no effect otherwise.
9596
Prohibit a line break after the character, but allow a line break before
9597
the character. This works only in combination with flags 128 and 512
9598
(see below) and has no effect otherwise.
9601
Allow line break before or after the character. This works only in
9602
combination with flags 128 and 256 and has no effect otherwise.
9604
Contrary to flag values 2 and@tie{}4, the flags 128, 256, and 512 work
9605
pairwise. If, for example, the left character has value 512, and the
9606
right character 128, no line break gets inserted. If we use
9607
value@tie{}6 instead for the left character, a line break after the
9608
character can't be suppressed since the right neighbour character
9609
doesn't get examined.
9613
@DefreqList {char, g [@Var{string}]}
9614
@DefreqItem {fchar, g [@Var{string}]}
9615
@DefreqItem {fschar, f g [@Var{string}]}
9616
@DefreqListEnd {schar, g [@Var{string}]}
9617
@cindex defining character (@code{char})
9618
@cindex defining fallback character (@code{fchar}, @code{fschar}, @code{schar})
9619
@cindex character, defining (@code{char})
9620
@cindex character, defining fallback (@code{fchar}, @code{fschar}, @code{schar})
9621
@cindex fallback character, defining (@code{fchar}, @code{fschar}, @code{schar})
9622
@cindex creating new characters (@code{char})
9623
@cindex defining symbol (@code{char})
9624
@cindex symbol, defining (@code{char})
9625
@cindex defining glyph (@code{char})
9626
@cindex glyph, defining (@code{char})
9627
@cindex escape character, while defining glyph
9628
@cindex character, escape, while defining glyph
9629
@cindex @code{tr} request, and glyph definitions
9630
@cindex @code{cp} request, and glyph definitions
9631
@cindex @code{rc} request, and glyph definitions
9632
@cindex @code{lc} request, and glyph definitions
9633
@cindex @code{\l}, and glyph definitions
9634
@cindex @code{\L}, and glyph definitions
9635
@cindex @code{\&}, and glyph definitions
9636
@cindex @code{\e}, and glyph definitions
9637
@cindex @code{hcode} request, and glyph definitions
9638
Define a new glyph@tie{}@var{g} to be @var{string} (which can be
9639
empty).@footnote{@code{char} is a misnomer since an output glyph is
9640
defined.} Every time glyph@tie{}@var{g} needs to be printed,
9641
@var{string} is processed in a temporary environment and the result is
9642
wrapped up into a single object. Compatibility mode is turned off and
9643
the escape character is set to @samp{\} while @var{string} is being
9644
processed. Any emboldening, constant spacing or track kerning is
9645
applied to this object rather than to individual characters in
9648
A glyph defined by these requests can be used just like a normal glyph
9649
provided by the output device. In particular, other characters can be
9650
translated to it with the @code{tr} or @code{trin} requests; it can be
9651
made the leader character by the @code{lc} request; repeated patterns
9652
can be drawn with the glyph using the @code{\l} and @code{\L} escape
9653
sequences; words containing the glyph can be hyphenated correctly if the
9654
@code{hcode} request is used to give the glyph's symbol a hyphenation
9657
There is a special anti-recursion feature: Use of @code{g} within the
9658
glyph's definition is handled like normal characters and symbols not
9659
defined with @code{char}.
9661
Note that the @code{tr} and @code{trin} requests take precedence if
9662
@code{char} accesses the same symbol.
9676
The @code{fchar} request defines a fallback glyph: @code{gtroff} only
9677
checks for glyphs defined with @code{fchar} if it cannot find the glyph
9678
in the current font. @code{gtroff} carries out this test before
9679
checking special fonts.
9681
@code{fschar} defines a fallback glyph for font@tie{}@var{f}:
9682
@code{gtroff} checks for glyphs defined with @code{fschar} after the
9683
list of fonts declared as font-specific special fonts with the
9684
@code{fspecial} request, but before the list of fonts declared as global
9685
special fonts with the @code{special} request.
9687
Finally, the @code{schar} request defines a global fallback glyph:
9688
@code{gtroff} checks for glyphs defined with @code{schar} after the list
9689
of fonts declared as global special fonts with the @code{special}
9690
request, but before the already mounted special fonts.
9692
@xref{Using Symbols}, for a detailed description of the glyph searching
9693
mechanism in @code{gtroff}.
9696
@DefreqList {rchar, c1 c2 @dots{}}
9697
@DefreqListEnd {rfschar, f c1 c2 @dots{}}
9698
@cindex removing glyph definition (@code{rchar}, @code{rfschar})
9699
@cindex glyph, removing definition (@code{rchar}, @code{rfschar})
9700
@cindex fallback glyph, removing definition (@code{rchar}, @code{rfschar})
9701
Remove the definitions of glyphs @var{c1}, @var{c2},@tie{}@enddots{}
9702
This undoes the effect of a @code{char}, @code{fchar}, or @code{schar}
9705
It is possible to omit the whitespace between arguments.
9707
The request @code{rfschar} removes glyph definitions defined with
9708
@code{fschar} for glyph@tie{}f.
9711
@xref{Special Characters}.
9713
@c ---------------------------------------------------------------------
9715
@node Character Classes, Special Fonts, Using Symbols, Fonts and Symbols
9716
@subsection Character Classes
9717
@cindex character classes
9718
@cindex classes, character
9720
Classes are particularly useful for East Asian languages such as
9721
Chinese, Japanese, and Korean, where the number of needed characters is
9722
much larger than in European languages, and where large sets of
9723
characters share the same properties.
9725
@Defreq {class, n c1 c2 @dots{}}
9726
@cindex character class (@code{class})
9727
@cindex defining character class (@code{class})
9728
@cindex class of characters (@code{class})
9729
In @code{groff}, a @dfn{character class} (or simply ``class'') is a set
9730
of characters, grouped by some user aspect. The @code{class} request
9731
defines such classes so that other requests can refer to all characters
9732
belonging to this set with a single class name. Currently, only the
9733
@code{cflags} request can handle character classes.
9735
A @code{class} request takes a class name followed by a list of
9736
entities. In its simplest form, the entities are characters or symbols:
9739
.class [prepunct] , : ; > @}
9742
Since class and glyph names share the same namespace, it is recommended
9743
to start and end the class name with @code{[} and @code{]},
9744
respectively, to avoid collisions with normal @code{groff} symbols (and
9745
symbols defined by the user). In particular, the presence of @code{]}
9746
in the symbol name intentionally prevents the usage of @code{\[...]},
9747
thus you must use the @code{\C} escape to access a class with such a
9750
@cindex GGL (groff glyph list)
9751
@cindex groff glyph list (GGL)
9752
You can also use a special character range notation, consisting of a
9753
start character or symbol, followed by @samp{-}, and an end character or
9754
symbol. Internally, @code{gtroff} converts these two symbol names to
9755
Unicode values (according to the groff glyph gist) which then give the
9756
start and end value of the range. If that fails, the class definition
9759
Finally, classes can be nested, too.
9761
Here is a more complex example:
9764
.class [prepunctx] \C'[prepunct]' \[u2013]-\[u2016]
9767
The class @samp{prepunctx} now contains the contents of the class
9768
@code{prepunct} as defined above (the set @samp{, : ; > @}}), and
9769
characters in the range between @code{U+2013} and @code{U+2016}.
9771
If you want to add @samp{-} to a class, it must be the first character
9772
value in the argument list, otherwise it gets misinterpreted as a range.
9774
Note that it is not possible to use class names within range
9777
Typical use of the @code{class} request is to control line-breaking and
9778
hyphenation rules as defined by the @code{cflags} request. For example,
9779
to inhibit line breaks before the characters belonging to the
9780
@code{prepunctx} class, you can write:
9783
.cflags 2 \C'[prepunctx]'
9786
See the @code{cflags} request in @ref{Using Symbols}, for more details.
9789
@c ---------------------------------------------------------------------
9791
@node Special Fonts, Artificial Fonts, Character Classes, Fonts and Symbols
9792
@subsection Special Fonts
9793
@cindex special fonts
9794
@cindex fonts, special
9796
Special fonts are those that @code{gtroff} searches when it cannot find
9797
the requested glyph in the current font. The Symbol font is usually a
9800
@code{gtroff} provides the following two requests to add more special
9801
fonts. @xref{Using Symbols}, for a detailed description of the glyph
9802
searching mechanism in @code{gtroff}.
9804
Usually, only non-TTY devices have special fonts.
9806
@DefreqList {special, [@Var{s1} @Var{s2} @dots{}]}
9807
@DefreqListEnd {fspecial, f [@Var{s1} @Var{s2} @dots{}]}
9810
Use the @code{special} request to define special fonts. Initially, this
9813
Use the @code{fspecial} request to designate special fonts only when
9814
font@tie{}@var{f} is active. Initially, this list is empty.
9816
Previous calls to @code{special} or @code{fspecial} are overwritten;
9817
without arguments, the particular list of special fonts is set to empty.
9818
Special fonts are searched in the order they appear as arguments.
9820
All fonts which appear in a call to @code{special} or @code{fspecial}
9823
@xref{Using Symbols}, for the exact search order of glyphs.
9826
@c ---------------------------------------------------------------------
9828
@node Artificial Fonts, Ligatures and Kerning, Special Fonts, Fonts and Symbols
9829
@subsection Artificial Fonts
9830
@cindex artificial fonts
9831
@cindex fonts, artificial
9833
There are a number of requests and escapes for artificially creating
9834
fonts. These are largely vestiges of the days when output devices did
9835
not have a wide variety of fonts, and when @code{nroff} and @code{troff}
9836
were separate programs. Most of them are no longer necessary in GNU
9837
@code{troff}. Nevertheless, they are supported.
9839
@DefescList {\\H, ', height, '}
9840
@DefescItem {\\H, ', @t{+}height, '}
9841
@DefescItem {\\H, ', @t{-}height, '}
9842
@DefregListEnd {.height}
9843
@cindex changing the font height (@code{\H})
9844
@cindex font height, changing (@code{\H})
9845
@cindex height, font, changing (@code{\H})
9846
Change (increment, decrement) the height of the current font, but not
9847
the width. If @var{height} is zero, restore the original height.
9848
Default scaling indicator is @samp{z}.
9850
The read-only number register @code{.height} contains the font height as
9853
Currently, only the @option{-Tps} and @option{-Tpdf} devices support
9856
Note that @code{\H} doesn't produce an input token in @code{gtroff}. As
9857
a consequence, it can be used in requests like @code{mc} (which expects
9858
a single character as an argument) to change the font on the fly:
9864
In compatibility mode, @code{gtroff} behaves differently: If an
9865
increment or decrement is used, it is always taken relative to the
9866
current point size and not relative to the previously selected font
9871
\H'+5'test \H'+5'test
9875
prints the word @samp{test} twice with the same font height (five points
9876
larger than the current font size).
9879
@DefescList {\\S, ', slant, '}
9880
@DefregListEnd {.slant}
9881
@cindex changing the font slant (@code{\S})
9882
@cindex font slant, changing (@code{\S})
9883
@cindex slant, font, changing (@code{\S})
9884
Slant the current font by @var{slant} degrees. Positive values slant to
9885
the right. Only integer values are possible.
9887
The read-only number register @code{.slant} contains the font slant as
9890
Currently, only the @option{-Tps} and @option{-Tpdf} devices support
9893
Note that @code{\S} doesn't produce an input token in @code{gtroff}. As
9894
a consequence, it can be used in requests like @code{mc} (which expects
9895
a single character as an argument) to change the font on the fly:
9901
This request is incorrectly documented in the original @acronym{UNIX}
9902
troff manual; the slant is always set to an absolute value.
9905
@Defreq {ul, [@Var{lines}]}
9906
@cindex underlining (@code{ul})
9907
The @code{ul} request normally underlines subsequent lines if a TTY
9908
output device is used. Otherwise, the lines are printed in italics
9909
(only the term `underlined' is used in the following). The single
9910
argument is the number of input lines to be underlined; with no
9911
argument, the next line is underlined. If @var{lines} is zero or
9912
negative, stop the effects of @code{ul} (if it was active). Requests
9913
and empty lines do not count for computing the number of underlined
9914
input lines, even if they produce some output like @code{tl}. Lines
9915
inserted by macros (e.g.@: invoked by a trap) do count.
9917
At the beginning of @code{ul}, the current font is stored and the
9918
underline font is activated. Within the span of a @code{ul} request, it
9919
is possible to change fonts, but after the last line affected by
9920
@code{ul} the saved font is restored.
9922
This number of lines still to be underlined is associated with the
9923
current environment (@pxref{Environments}). The underline font can be
9924
changed with the @code{uf} request.
9926
@c XXX @xref should be changed to grotty
9928
@c @xref{Troff and Nroff Mode}, for a discussion how underlining is
9929
@c implemented in for TTY output devices, and which problems can arise.
9931
The @code{ul} request does not underline spaces.
9934
@Defreq {cu, [@Var{lines}]}
9935
@cindex continuous underlining (@code{cu})
9936
@cindex underlining, continuous (@code{cu})
9937
The @code{cu} request is similar to @code{ul} but underlines spaces as
9938
well (if a TTY output device is used).
9942
@cindex underline font (@code{uf})
9943
@cindex font for underlining (@code{uf})
9944
Set the underline font (globally) used by @code{ul} and @code{cu}. By
9945
default, this is the font at position@tie{}2. @var{font} can be either
9946
a non-negative font position or the name of a font.
9949
@DefreqList {bd, font [@Var{offset}]}
9950
@DefreqItem {bd, font1 font2 [@Var{offset}]}
9952
@cindex imitating bold face (@code{bd})
9953
@cindex bold face, imitating (@code{bd})
9954
Artificially create a bold font by printing each glyph twice, slightly
9957
Two syntax forms are available.
9961
Imitate a bold font unconditionally. The first argument specifies the
9962
font to embolden, and the second is the number of basic units, minus
9963
one, by which the two glyphs are offset. If the second argument is
9964
missing, emboldening is turned off.
9966
@var{font} can be either a non-negative font position or the name of a
9969
@var{offset} is available in the @code{.b} read-only register if a
9970
special font is active; in the @code{bd} request, its default unit is
9973
@cindex @code{fspecial} request, and imitating bold
9975
@cindex embolding of special fonts
9976
@cindex special fonts, emboldening
9978
Imitate a bold form conditionally. Embolden @var{font1} by @var{offset}
9979
only if font @var{font2} is the current font. This command can be
9980
issued repeatedly to set up different emboldening values for different
9981
current fonts. If the second argument is missing, emboldening is turned
9982
off for this particular current font.
9984
This affects special fonts only (either set up with the @code{special}
9985
command in font files or with the @code{fspecial} request).
9989
@Defreq {cs, font [@Var{width} [@Var{em-size}]]}
9990
@cindex constant glyph space mode (@code{cs})
9991
@cindex mode for constant glyph space (@code{cs})
9992
@cindex glyph, constant space
9993
@cindex @code{ps} request, and constant glyph space mode
9994
Switch to and from @dfn{constant glyph space mode}. If activated, the
9995
width of every glyph is @math{@var{width}/36} ems. The em size is given
9996
absolutely by @var{em-size}; if this argument is missing, the em value
9997
is taken from the current font size (as set with the @code{ps} request)
9998
when the font is effectively in use. Without second and third argument,
9999
constant glyph space mode is deactivated.
10001
Default scaling indicator for @var{em-size} is @samp{z}; @var{width} is
10005
@c ---------------------------------------------------------------------
10007
@node Ligatures and Kerning, , Artificial Fonts, Fonts and Symbols
10008
@subsection Ligatures and Kerning
10009
@cindex ligatures and kerning
10010
@cindex kerning and ligatures
10012
Ligatures are groups of characters that are run together, i.e, producing
10013
a single glyph. For example, the letters `f' and `i' can form a
10014
ligature `fi' as in the word `file'. This produces a cleaner look
10015
(albeit subtle) to the printed output. Usually, ligatures are not
10016
available in fonts for TTY output devices.
10018
Most @sc{PostScript} fonts support the fi and fl ligatures. The C/A/T
10019
typesetter that was the target of @acronym{AT&T} @code{troff} also
10020
supported `ff', `ffi', and `ffl' ligatures. Advanced typesetters or
10021
`expert' fonts may include ligatures for `ft' and `ct', although GNU
10022
@code{troff} does not support these (yet).
10024
Only the current font is checked for ligatures and kerns; neither
10025
special fonts nor entities defined with the @code{char} request (and its
10026
siblings) are taken into account.
10028
@DefreqList {lg, [@Var{flag}]}
10029
@DefregListEnd {.lg}
10030
@cindex activating ligatures (@code{lg})
10031
@cindex ligatures, activating (@code{lg})
10032
@cindex ligatures enabled register (@code{.lg})
10033
Switch the ligature mechanism on or off; if the parameter is non-zero or
10034
missing, ligatures are enabled, otherwise disabled. Default is on. The
10035
current ligature mode can be found in the read-only number register
10036
@code{.lg} (set to 1 or@tie{}2 if ligatures are enabled,
10039
Setting the ligature mode to@tie{}2 enables the two-character ligatures
10040
(fi, fl, and ff) and disables the three-character ligatures (ffi and
10044
@dfn{Pairwise kerning} is another subtle typesetting mechanism that
10045
modifies the distance between a glyph pair to improve readability. In
10046
most cases (but not always) the distance is decreased.
10048
For example, compare the combination of the letters `V' and `A'. With
10049
kerning, `VA' is printed. Without kerning it appears as `V@w{}A'.
10051
Typewriter-like fonts and fonts for terminals where all glyphs have the
10052
same width don't use kerning.
10054
@DefreqList {kern, [@Var{flag}]}
10055
@DefregListEnd {.kern}
10056
@cindex activating kerning (@code{kern})
10057
@cindex kerning, activating (@code{kern})
10058
@cindex kerning enabled register (@code{.kern})
10059
Switch kerning on or off. If the parameter is non-zero or missing,
10060
enable pairwise kerning, otherwise disable it. The read-only number
10061
register @code{.kern} is set to@tie{}1 if pairwise kerning is enabled,
10064
@cindex zero width space character (@code{\&})
10065
@cindex character, zero width space (@code{\&})
10066
@cindex space character, zero width (@code{\&})
10067
If the font description file contains pairwise kerning information,
10068
glyphs from that font are kerned. Kerning between two glyphs can be
10069
inhibited by placing @code{\&} between them: @samp{V\&A}.
10071
@xref{Font File Format}.
10074
@cindex track kerning
10075
@cindex kerning, track
10076
@dfn{Track kerning} expands or reduces the space between glyphs. This
10077
can be handy, for example, if you need to squeeze a long word onto a
10078
single line or spread some text to fill a narrow column. It must be
10079
used with great care since it is usually considered bad typography if
10080
the reader notices the effect.
10082
@Defreq {tkf, f s1 n1 s2 n2}
10083
@cindex activating track kerning (@code{tkf})
10084
@cindex track kerning, activating (@code{tkf})
10085
Enable track kerning for font@tie{}@var{f}. If the current font
10086
is@tie{}@var{f} the width of every glyph is increased by an amount
10087
between @var{n1} and @var{n2} (@var{n1}, @var{n2} can be negative); if
10088
the current point size is less than or equal to @var{s1} the width is
10089
increased by @var{n1}; if it is greater than or equal to @var{s2} the
10090
width is increased by @var{n2}; if the point size is greater than or
10091
equal to @var{s1} and less than or equal to @var{s2} the increase in
10092
width is a linear function of the point size.
10094
The default scaling indicator is @samp{z} for @var{s1} and @var{s2},
10095
@samp{p} for @var{n1} and @var{n2}.
10097
Note that the track kerning amount is added even to the rightmost glyph
10098
in a line; for large values it is thus recommended to increase the line
10099
length by the same amount to compensate it.
10102
Sometimes, when typesetting letters of different fonts, more or less
10103
space at such boundaries are needed. There are two escapes to help with
10106
@Defesc {\\/, , , }
10107
@cindex italic correction (@code{\/})
10108
@cindex correction, italic (@code{\/})
10109
@cindex correction between italic and roman glyph (@code{\/}, @code{\,})
10110
@cindex roman glyph, correction after italic glyph (@code{\/})
10111
@cindex italic glyph, correction before roman glyph (@code{\/})
10112
@cindex glyph, italic correction (@code{\/})
10113
Increase the width of the preceding glyph so that the spacing between
10114
that glyph and the following glyph is correct if the following glyph is
10115
a roman glyph. For example, if an italic@tie{}@code{f} is immediately
10116
followed by a roman right parenthesis, then in many fonts the top right
10117
portion of the@tie{}@code{f} overlaps the top left of the right
10118
parenthesis. Use this escape sequence whenever an italic glyph is
10119
immediately followed by a roman glyph without any intervening space.
10120
This small amount of space is also called @dfn{italic correction}.
10123
@c can't use @Example...@endExample here
10127
@result{} {@it f}@r{)}
10129
@result{} @i{f}@r{)}
10135
@Defesc {\\\,, , , }
10136
@cindex left italic correction (@code{\,})
10137
@cindex correction, left italic (@code{\,})
10138
@cindex glyph, left italic correction (@code{\,})
10139
@cindex roman glyph, correction before italic glyph (@code{\,})
10140
@cindex italic glyph, correction after roman glyph (@code{\,})
10141
Modify the spacing of the following glyph so that the spacing between
10142
that glyph and the preceding glyph is correct if the preceding glyph is
10143
a roman glyph. Use this escape sequence whenever a roman glyph is
10144
immediately followed by an italic glyph without any intervening space.
10145
In analogy to above, this space could be called @dfn{left italic
10146
correction}, but this term isn't used widely.
10149
@c can't use @Example...@endExample here
10153
@result{} @r{q}@i{f}
10155
@result{} @r{q}@math{@ptexcomma}@i{f}
10161
@Defesc {\\&, , , }
10162
Insert a zero-width character, which is invisible. Its intended use is
10163
to stop interaction of a character with its surrounding.
10167
It prevents the insertion of extra space after an end-of-sentence
10173
@result{} Test. Test.
10176
@result{} Test. Test.
10180
It prevents interpretation of a control character at the beginning of an
10185
@result{} warning: `Test' not defined
10191
It prevents kerning between two glyphs.
10194
@c can't use @Example...@endExample here
10200
@result{} @r{V@w{}A}
10206
It is needed to map an arbitrary character to nothing in the @code{tr}
10207
request (@pxref{Character Translations}).
10211
@Defesc {\\), , , }
10212
This escape is similar to @code{\&} except that it behaves like a
10213
character declared with the @code{cflags} request to be transparent for
10214
the purposes of an end-of-sentence character.
10216
Its main usage is in macro definitions to protect against arguments
10217
starting with a control character.
10229
@result{}This is a test.' This is a test.
10233
@result{}This is a test.' This is a test.
10238
@c =====================================================================
10240
@node Sizes, Strings, Fonts and Symbols, gtroff Reference
10246
@cindex size of type
10247
@cindex vertical spacing
10248
@cindex spacing, vertical
10249
@code{gtroff} uses two dimensions with each line of text, type size and
10250
vertical spacing. The @dfn{type size} is approximately the height of
10251
the tallest glyph.@footnote{This is usually the parenthesis. Note that
10252
in most cases the real dimensions of the glyphs in a font are @emph{not}
10253
related to its type size! For example, the standard @sc{PostScript}
10254
font families `Times Roman', `Helvetica', and `Courier' can't be used
10255
together at 10@dmn{pt}; to get acceptable output, the size of
10256
`Helvetica' has to be reduced by one point, and the size of `Courier'
10257
must be increased by one point.} @dfn{Vertical spacing} is the amount
10258
of space @code{gtroff} allows for a line of text; normally, this is
10259
about 20%@tie{}larger than the current type size. Ratios smaller than
10260
this can result in hard-to-read text; larger than this, it spreads the
10261
text out more vertically (useful for term papers). By default,
10262
@code{gtroff} uses 10@tie{}point type on 12@tie{}point spacing.
10265
The difference between type size and vertical spacing is known, by
10266
typesetters, as @dfn{leading} (this is pronounced `ledding').
10269
* Changing Type Sizes::
10270
* Fractional Type Sizes::
10273
@c ---------------------------------------------------------------------
10275
@node Changing Type Sizes, Fractional Type Sizes, Sizes, Sizes
10276
@subsection Changing Type Sizes
10278
@DefreqList {ps, [@Var{size}]}
10279
@DefreqItem {ps, @t{+}@Var{size}}
10280
@DefreqItem {ps, @t{-}@Var{size}}
10281
@DefescItem {\\s, , size, }
10282
@DefregListEnd {.s}
10283
@cindex changing type sizes (@code{ps}, @code{\s})
10284
@cindex type sizes, changing (@code{ps}, @code{\s})
10285
@cindex point sizes, changing (@code{ps}, @code{\s})
10286
Use the @code{ps} request or the @code{\s} escape to change (increase,
10287
decrease) the type size (in points). Specify @var{size} as either an
10288
absolute point size, or as a relative change from the current size. The
10289
size@tie{}0, or no argument, goes back to the previous size.
10291
Default scaling indicator of @code{size} is @samp{z}. If @code{size} is
10292
zero or negative, it is set to 1@dmn{u}.
10294
@cindex type size registers (@code{.s}, @code{.ps})
10295
@cindex point size registers (@code{.s}, @code{.ps})
10296
The read-only number register @code{.s} returns the point size in points
10297
as a decimal fraction. This is a string. To get the point size in
10298
scaled points, use the @code{.ps} register instead.
10300
@code{.s} is associated with the current environment
10301
(@pxref{Environments}).
10308
wink, wink, \s+2nudge, nudge,\s+8 say no more!
10312
The @code{\s} escape may be called in a variety of ways. Much like
10313
other escapes there must be a way to determine where the argument ends
10314
and the text begins. Any of the following forms are valid:
10318
Set the point size to @var{n}@tie{}points. @var{n}@tie{}must be either
10319
0 or in the range 4 to@tie{}39.
10323
Increase or decrease the point size by @var{n}@tie{}points.
10324
@var{n}@tie{}must be exactly one digit.
10327
Set the point size to @var{nn}@tie{}points. @var{nn} must be exactly
10331
@itemx \s-(@var{nn}
10332
@itemx \s(+@var{nn}
10333
@itemx \s(-@var{nn}
10334
Increase or decrease the point size by @var{nn}@tie{}points. @var{nn}
10335
must be exactly two digits.
10338
Note that @code{\s} doesn't produce an input token in @code{gtroff}. As
10339
a consequence, it can be used in requests like @code{mc} (which expects
10340
a single character as an argument) to change the font on the fly:
10346
@xref{Fractional Type Sizes}, for yet another syntactical form of using
10347
the @code{\s} escape.
10350
@Defreq {sizes, s1 s2 @dots{} sn [0]}
10351
Some devices may only have certain permissible sizes, in which case
10352
@code{gtroff} rounds to the nearest permissible size. The @file{DESC}
10353
file specifies which sizes are permissible for the device.
10355
Use the @code{sizes} request to change the permissible sizes for the
10356
current output device. Arguments are in scaled points; the
10357
@code{sizescale} line in the @file{DESC} file for the output device
10358
provides the scaling factor. For example, if the scaling factor is
10359
1000, then the value 12000 is 12@tie{}points.
10361
Each argument can be a single point size (such as @samp{12000}), or a
10362
range of sizes (such as @samp{4000-72000}). You can optionally end the
10366
@DefreqList {vs, [@Var{space}]}
10367
@DefreqItem {vs, @t{+}@Var{space}}
10368
@DefreqItem {vs, @t{-}@Var{space}}
10369
@DefregListEnd {.v}
10370
@cindex changing vertical line spacing (@code{vs})
10371
@cindex vertical line spacing, changing (@code{vs})
10372
@cindex vertical line spacing register (@code{.v})
10373
Change (increase, decrease) the vertical spacing by @var{space}. The
10374
default scaling indicator is @samp{p}.
10376
If @code{vs} is called without an argument, the vertical spacing is
10377
reset to the previous value before the last call to @code{vs}.
10379
@cindex @code{.V} register, and @code{vs}
10380
@code{gtroff} creates a warning of type @samp{range} if @var{space} is
10381
negative; the vertical spacing is then set to smallest positive value,
10382
the vertical resolution (as given in the @code{.V} register).
10384
Note that @w{@samp{.vs 0}} isn't saved in a diversion since it doesn't
10385
result in a vertical motion. You explicitly have to repeat this command
10386
before inserting the diversion.
10388
The read-only number register @code{.v} contains the current vertical
10389
spacing; it is associated with the current environment
10390
(@pxref{Environments}).
10393
@cindex vertical line spacing, effective value
10394
The effective vertical line spacing consists of four components.
10395
Breaking a line causes the following actions (in the given order).
10399
@cindex extra pre-vertical line space (@code{\x})
10400
@cindex line space, extra pre-vertical (@code{\x})
10401
Move the current point vertically by the @dfn{extra pre-vertical line
10402
space}. This is the minimum value of all @code{\x} escapes with a
10403
negative argument in the current output line.
10406
Move the current point vertically by the vertical line spacing as set
10407
with the @code{vs} request.
10410
Output the current line.
10413
@cindex extra post-vertical line space (@code{\x})
10414
@cindex line space, extra post-vertical (@code{\x})
10415
Move the current point vertically by the @dfn{extra post-vertical line
10416
space}. This is the maximum value of all @code{\x} escapes with a
10417
positive argument in the line which has just been output.
10420
@cindex post-vertical line spacing
10421
@cindex line spacing, post-vertical (@code{pvs})
10422
Move the current point vertically by the @dfn{post-vertical line
10423
spacing} as set with the @code{pvs} request.
10426
@cindex double-spacing (@code{vs}, @code{pvs})
10427
It is usually better to use @code{vs} or @code{pvs} instead of @code{ls}
10428
to produce double-spaced documents: @code{vs} and @code{pvs} have a
10429
finer granularity for the inserted vertical space compared to @code{ls};
10430
furthermore, certain preprocessors assume single-spacing.
10432
@xref{Manipulating Spacing}, for more details on the @code{\x} escape
10433
and the @code{ls} request.
10435
@DefreqList {pvs, [@Var{space}]}
10436
@DefreqItem {pvs, @t{+}@Var{space}}
10437
@DefreqItem {pvs, @t{-}@Var{space}}
10438
@DefregListEnd {.pvs}
10439
@cindex @code{ls} request, alternative to (@code{pvs})
10440
@cindex post-vertical line spacing, changing (@code{pvs})
10441
@cindex post-vertical line spacing register (@code{.pvs})
10442
Change (increase, decrease) the post-vertical spacing by @var{space}.
10443
The default scaling indicator is @samp{p}.
10445
If @code{pvs} is called without an argument, the post-vertical spacing
10446
is reset to the previous value before the last call to @code{pvs}.
10448
@code{gtroff} creates a warning of type @samp{range} if @var{space} is
10449
zero or negative; the vertical spacing is then set to zero.
10451
The read-only number register @code{.pvs} contains the current
10452
post-vertical spacing; it is associated with the current environment
10453
(@pxref{Environments}).
10456
@c ---------------------------------------------------------------------
10458
@node Fractional Type Sizes, , Changing Type Sizes, Sizes
10459
@subsection Fractional Type Sizes
10460
@cindex fractional type sizes
10461
@cindex fractional point sizes
10462
@cindex type sizes, fractional
10463
@cindex point sizes, fractional
10464
@cindex sizes, fractional
10466
@cindex @code{s} unit
10467
@cindex unit, @code{s}
10468
@cindex @code{z} unit
10469
@cindex unit, @code{z}
10470
@cindex @code{ps} request, with fractional type sizes
10471
@cindex @code{cs} request, with fractional type sizes
10472
@cindex @code{tkf} request, with fractional type sizes
10473
@cindex @code{\H}, with fractional type sizes
10474
@cindex @code{\s}, with fractional type sizes
10475
A @dfn{scaled point} is equal to @math{1/@var{sizescale}} points, where
10476
@var{sizescale} is specified in the @file{DESC} file (1@tie{}by
10477
default). There is a new scale indicator @samp{z} which has the effect
10478
of multiplying by @var{sizescale}. Requests and escape sequences in
10479
@code{gtroff} interpret arguments that represent a point size as being
10480
in units of scaled points, but they evaluate each such argument using a
10481
default scale indicator of @samp{z}. Arguments treated in this way are
10482
the argument to the @code{ps} request, the third argument to the
10483
@code{cs} request, the second and fourth arguments to the @code{tkf}
10484
request, the argument to the @code{\H} escape sequence, and those
10485
variants of the @code{\s} escape sequence that take a numeric expression
10486
as their argument (see below).
10488
For example, suppose @var{sizescale} is@tie{}1000; then a scaled point
10489
is equivalent to a millipoint; the request @w{@samp{.ps 10.25}} is
10490
equivalent to @w{@samp{.ps 10.25z}} and thus sets the point size to
10491
10250@tie{}scaled points, which is equal to 10.25@tie{}points.
10493
@code{gtroff} disallows the use of the @samp{z} scale indicator in
10494
instances where it would make no sense, such as a numeric expression
10495
whose default scale indicator was neither @samp{u} nor @samp{z}.
10496
Similarly it would make no sense to use a scaling indicator other than
10497
@samp{z} or @samp{u} in a numeric expression whose default scale
10498
indicator was @samp{z}, and so @code{gtroff} disallows this as well.
10500
There is also new scale indicator @samp{s} which multiplies by the
10501
number of units in a scaled point. So, for example, @samp{\n[.ps]s} is
10502
equal to @samp{1m}. Be sure not to confuse the @samp{s} and @samp{z}
10506
A read-only number register returning the point size in scaled points.
10508
@code{.ps} is associated with the current environment
10509
(@pxref{Environments}).
10513
@DefregListEnd {.sr}
10514
@cindex last-requested point size registers (@code{.psr}, @code{.sr})
10515
@cindex point size registers, last-requested (@code{.psr}, @code{.sr})
10516
@cindex @code{.ps} register, in comparison with @code{.psr}
10517
@cindex @code{.s} register, in comparison with @code{.sr}
10518
The last-requested point size in scaled points is contained in the
10519
@code{.psr} read-only number register. The last requested point size in
10520
points as a decimal fraction can be found in @code{.sr}. This is a
10521
string-valued read-only number register.
10523
Note that the requested point sizes are device-independent, whereas the
10524
values returned by the @code{.ps} and @code{.s} registers are not. For
10525
example, if a point size of 11@dmn{pt} is requested, and a @code{sizes}
10526
request (or a @code{sizescale} line in a @file{DESC} file) specifies
10527
10.95@dmn{pt} instead, this value is actually used.
10529
Both registers are associated with the current environment
10530
(@pxref{Environments}).
10533
The @code{\s} escape has the following syntax for working with
10534
fractional type sizes:
10539
Set the point size to @var{n}@tie{}scaled points; @var{n}@tie{}is a
10540
numeric expression with a default scale indicator of @samp{z}.
10543
@itemx \s[-@var{n}]
10544
@itemx \s+[@var{n}]
10545
@itemx \s-[@var{n}]
10546
@itemx \s'+@var{n}'
10547
@itemx \s'-@var{n}'
10548
@itemx \s+'@var{n}'
10549
@itemx \s-'@var{n}'
10550
Increase or or decrease the point size by @var{n}@tie{}scaled points;
10551
@var{n}@tie{}is a numeric expression (which may start with a minus sign)
10552
with a default scale indicator of @samp{z}.
10558
@c =====================================================================
10560
@node Strings, Conditionals and Loops, Sizes, gtroff Reference
10564
@code{gtroff} has string variables, which are entirely for user
10565
convenience (i.e.@: there are no built-in strings exept @code{.T}, but
10566
even this is a read-write string variable).
10568
Although the following requests can be used to create strings,
10569
simply using an undefined string will cause it to be defined as empty.
10570
@xref{Identifiers}.
10572
@DefreqList {ds, name [@Var{string}]}
10573
@DefreqItem {ds1, name [@Var{string}]}
10574
@DefescItem {\\*, , n, }
10575
@DefescItem {\\*, @Lparen{}, nm, }
10576
@DefescListEnd {\\*, @Lbrack{}, name arg1 arg2 @dots{}, @Rbrack{}}
10577
@cindex string interpolation (@code{\*})
10578
@cindex string expansion (@code{\*})
10579
@cindex interpolation of strings (@code{\*})
10580
@cindex expansion of strings (@code{\*})
10581
@cindex string arguments
10582
@cindex arguments, of strings
10583
Define and access a string variable @var{name} (one-character
10584
name@tie{}@var{n}, two-character name @var{nm}). If @var{name} already
10585
exists, @code{ds} overwrites the previous definition. Only the syntax
10586
form using brackets can take arguments which are handled identically to
10587
macro arguments; the single exception is that a closing bracket as an
10588
argument must be enclosed in double quotes. @xref{Request and Macro
10589
Arguments}, and @ref{Parameters}.
10594
.ds foo a \\$1 test
10596
This is \*[foo nice].
10597
@result{} This is a nice test.
10600
The @code{\*} escape @dfn{interpolates} (expands in-place) a
10601
previously-defined string variable. To be more precise, the stored
10602
string is pushed onto the input stack which is then parsed by
10603
@code{gtroff}. Similar to number registers, it is possible to nest
10604
strings, i.e., string variables can be called within string variables.
10606
If the string named by the @code{\*} escape does not exist, it is
10607
defined as empty, and a warning of type @samp{mac} is emitted (see
10608
@ref{Debugging}, for more details).
10610
@cindex comments, with @code{ds}
10611
@cindex @code{ds} request, and comments
10612
@strong{Caution:} Unlike other requests, the second argument to the
10613
@code{ds} request takes up the entire line including trailing spaces.
10614
This means that comments on a line with such a request can introduce
10615
unwanted space into a string.
10618
.ds UX \s-1UNIX\s0\u\s-3tm\s0\d \" UNIX trademark
10622
Instead the comment should be put on another line or have the comment
10623
escape adjacent with the end of the string.
10626
.ds UX \s-1UNIX\s0\u\s-3tm\s0\d\" UNIX trademark
10629
@cindex trailing quotes
10630
@cindex quotes, trailing
10631
@cindex leading spaces with @code{ds}
10632
@cindex spaces with @code{ds}
10633
@cindex @code{ds} request, and leading spaces
10634
To produce leading space the string can be started with a double quote.
10635
No trailing quote is needed; in fact, any trailing quote is included in
10639
.ds sign " Yours in a white wine sauce,
10642
@cindex multi-line strings
10643
@cindex strings, multi-line
10644
@cindex newline character, in strings, escaping
10645
@cindex escaping newline characters, in strings
10646
Strings are not limited to a single line of text. A string can span
10647
several lines by escaping the newlines with a backslash. The resulting
10648
string is stored @emph{without} the newlines.
10651
.ds foo lots and lots \
10652
of text are on these \
10656
It is not possible to have real newlines in a string. To put a single
10657
double quote character into a string, use two consecutive double quote
10660
The @code{ds1} request turns off compatibility mode while interpreting a
10661
string. To be more precise, a @dfn{compatibility save} input token is
10662
inserted at the beginning of the string, and a @dfn{compatibility
10663
restore} input token at the end.
10667
.ds aa The value of xxx is \\n[xxx].
10668
.ds1 bb The value of xxx ix \\n[xxx].
10673
@result{} warning: number register `[' not defined
10674
@result{} The value of xxx is 0xxx].
10676
@result{} The value of xxx ix 12345.
10679
@cindex name space, common, of macros, diversions, and strings
10680
@cindex common name space of macros, diversions, and strings
10681
@cindex macros, shared name space with strings and diversions
10682
@cindex strings, shared name space with macros and diversions
10683
@cindex diversions, shared name space with macros and strings
10684
Strings, macros, and diversions (and boxes) share the same name space.
10685
Internally, even the same mechanism is used to store them. This has
10686
some interesting consequences. For example, it is possible to call a
10687
macro with string syntax and vice versa.
10694
@result{} This is a funny test.
10696
.ds yyy a funny test
10699
@result{} This is a funny test.
10702
In particular, interpolating a string does not hide existing macro
10703
arguments. Thus in a macro, a more efficient way of doing
10717
Note that the latter calling syntax doesn't change the value of
10718
@code{\$0}, which is then inherited from the calling macro.
10720
Diversions and boxes can be also called with string syntax.
10722
Another consequence is that you can copy one-line diversions or boxes to
10730
.ds yyy This is \*[xxx]\c
10732
@result{} @r{This is a }@i{test}.
10736
As the previous example shows, it is possible to store formatted output
10737
in strings. The @code{\c} escape prevents the insertion of an
10738
additional blank line in the output.
10740
Copying diversions longer than a single output line produces unexpected
10750
.ds yyy This is \*[xxx]\c
10752
@result{} test This is a funny.
10755
Usually, it is not predictable whether a diversion contains one or more
10756
output lines, so this mechanism should be avoided. With @acronym{UNIX}
10757
@code{troff}, this was the only solution to strip off a final newline
10758
from a diversion. Another disadvantage is that the spaces in the copied
10759
string are already formatted, making them unstretchable. This can cause
10762
@cindex stripping final newline in diversions
10763
@cindex diversion, stripping final newline
10764
@cindex final newline, stripping in diversions
10765
@cindex newline, final, stripping in diversions
10766
@cindex horizontal space, unformatting
10767
@cindex space, horizontal, unformatting
10768
@cindex unformatting horizontal space
10769
A clean solution to this problem is available in GNU @code{troff}, using
10770
the requests @code{chop} to remove the final newline of a diversion, and
10771
@code{unformat} to make the horizontal spaces stretchable again.
10783
@result{} This is a funny test.
10786
@xref{Gtroff Internals}, for more information.
10789
@DefreqList {as, name [@Var{string}]}
10790
@DefreqListEnd {as1, name [@Var{string}]}
10791
@cindex appending to a string (@code{as})
10792
@cindex string, appending (@code{as})
10793
The @code{as} request is similar to @code{ds} but appends @var{string}
10794
to the string stored as @var{name} instead of redefining it. If
10795
@var{name} doesn't exist yet, it is created.
10798
.as sign " with shallots, onions and garlic,
10801
The @code{as1} request is similar to @code{as}, but compatibility mode
10802
is switched off while the appended string is interpreted. To be more
10803
precise, a @dfn{compatibility save} input token is inserted at the
10804
beginning of the appended string, and a @dfn{compatibility restore}
10805
input token at the end.
10808
Rudimentary string manipulation routines are given with the next two
10811
@Defreq {substring, str n1 [@Var{n2}]}
10812
@cindex substring (@code{substring})
10813
Replace the string named @var{str} with the substring defined by the
10814
indices @var{n1} and@tie{}@var{n2}. The first character in the string
10815
has index@tie{}0. If @var{n2} is omitted, it is taken to be equal to
10816
the string's length. If the index value @var{n1} or @var{n2} is
10817
negative, it is counted from the end of the string, going backwards: The
10818
last character has index@tie{}@minus{}1, the character before the last
10819
character has index@tie{}@minus{}2, etc.
10823
.substring xxx 1 -4
10829
@Defreq {length, reg str}
10830
@cindex length of a string (@code{length})
10831
@cindex string, length of (@code{length})
10832
@cindex @code{length} request, and copy-in mode
10833
@cindex copy-in mode, and @code{length} request
10834
@cindex mode, copy-in, and @code{length} request
10835
Compute the number of characters of @var{str} and return it in the
10836
number register @var{reg}. If @var{reg} doesn't exist, it is created.
10837
@code{str} is read in copy mode.
10840
.ds xxx abcd\h'3i'efgh
10841
.length yyy \*[xxx]
10847
@Defreq {rn, xx yy}
10848
@cindex renaming request (@code{rn})
10849
@cindex request, renaming (@code{rn})
10850
@cindex renaming macro (@code{rn})
10851
@cindex macro, renaming (@code{rn})
10852
@cindex renaming string (@code{rn})
10853
@cindex string, renaming (@code{rn})
10854
@cindex renaming diversion (@code{rn})
10855
@cindex diversion, renaming (@code{rn})
10856
Rename the request, macro, diversion, or string @var{xx} to @var{yy}.
10860
@cindex removing request (@code{rm})
10861
@cindex request, removing (@code{rm})
10862
@cindex removing macro (@code{rm})
10863
@cindex macro, removing (@code{rm})
10864
@cindex removing string (@code{rm})
10865
@cindex string, removing (@code{rm})
10866
@cindex removing diversion (@code{rm})
10867
@cindex diversion, removing (@code{rm})
10868
Remove the request, macro, diversion, or string @var{xx}. @code{gtroff}
10869
treats subsequent invocations as if the object had never been defined.
10873
@Defreq {als, new old}
10874
@cindex alias, string, creating (@code{als})
10875
@cindex alias, macro, creating (@code{als})
10876
@cindex alias, diversion, creating (@code{als})
10877
@cindex creating alias, for string (@code{als})
10878
@cindex creating alias, for macro (@code{als})
10879
@cindex creating alias, for diversion (@code{als})
10880
@cindex string, creating alias (@code{als})
10881
@cindex macro, creating alias (@code{als})
10882
@cindex diversion, creating alias (@code{als})
10883
Create an alias named @var{new} for the request, string, macro, or
10884
diversion object named @var{old}. The new name and the old name are
10885
exactly equivalent (it is similar to a hard rather than a soft link). If
10886
@var{old} is undefined, @code{gtroff} generates a warning of type
10887
@samp{mac} and ignores the request.
10889
To understand how the @code{als} request works it is probably best to
10890
think of two different pools: one pool for objects (macros, strings,
10891
etc.), and another one for names. As soon as an object is defined,
10892
@code{gtroff} adds it to the object pool, adds its name to the name
10893
pool, and creates a link between them. When @code{als} creates an
10894
alias, it adds a new name to the name pool which gets linked to the same
10895
object as the old name.
10897
Now consider this example.
10910
@result{} input stack limit exceeded
10914
The definition of macro @code{bar} replaces the old object this name is
10915
linked to. However, the alias to @code{foo} is still active! In
10916
other words, @code{foo} is still linked to the same object as
10917
@code{bar}, and the result of calling @code{bar} is an infinite,
10918
recursive loop which finally leads to an error.
10920
@cindex alias, string, removing (@code{rm})
10921
@cindex alias, macro, removing (@code{rm})
10922
@cindex alias, diversion, removing (@code{rm})
10923
@cindex removing alias, for string (@code{rm})
10924
@cindex removing alias, for macro (@code{rm})
10925
@cindex removing alias, for diversion (@code{rm})
10926
@cindex string, removing alias (@code{rm})
10927
@cindex macro, removing alias (@code{rm})
10928
@cindex diversion, removing alias (@code{rm})
10929
To undo an alias, simply call @code{rm} on the aliased name. The object
10930
itself is not destroyed until there are no more aliases.
10934
Remove (chop) the last character from the macro, string, or diversion
10935
named @var{xx}. This is useful for removing the newline from the end of
10936
diversions that are to be interpolated as strings. This command can be
10937
used repeatedly; see @ref{Gtroff Internals}, for details on nodes
10938
inserted additionally by @code{gtroff}.
10941
@xref{Identifiers}, and @ref{Comments}.
10944
@c =====================================================================
10946
@node Conditionals and Loops, Writing Macros, Strings, gtroff Reference
10947
@section Conditionals and Loops
10948
@cindex conditionals and loops
10949
@cindex loops and conditionals
10952
* Operators in Conditionals::
10957
@c ---------------------------------------------------------------------
10959
@node Operators in Conditionals, if-else, Conditionals and Loops, Conditionals and Loops
10960
@subsection Operators in Conditionals
10962
@cindex @code{if} request, operators to use with
10963
@cindex @code{ie} request, operators to use with
10964
@cindex @code{while} request, operators to use with
10965
In @code{if}, @code{ie}, and @code{while} requests, in addition to ordinary
10966
@ref{Expressions}, there are several more operators available:
10971
True if the current page is even or odd numbered (respectively).
10974
@cindex conditional output for terminal (TTY)
10975
@cindex TTY, conditional output for
10976
@cindex terminal, conditional output for
10977
True if the document is being processed in nroff mode (i.e., the
10978
@code{.nroff} command has been issued). @xref{Troff and Nroff Mode}.
10981
True if the document is being processed in troff mode (i.e., the
10982
@code{.troff} command has been issued). @xref{Troff and Nroff Mode}.
10985
Always false. This condition is for compatibility with other
10986
@code{troff} versions only (identifying a @code{-Tversatec} device).
10988
@item '@var{xxx}'@var{yyy}'
10989
True if the output produced by @var{xxx} is equal to the output produced
10990
by @var{yyy}. Other characters can be used in place of the single
10991
quotes; the same set of delimiters as for the @code{\D} escape is used
10992
(@pxref{Escapes}). @code{gtroff} formats @var{xxx} and @var{yyy} in
10993
separate environments; after the comparison the resulting data is
11005
The resulting motions, glyph sizes, and fonts have to
11006
match,@footnote{The created output nodes must be identical.
11007
@xref{Gtroff Internals}.} and not the individual motion, size, and font
11008
requests. In the previous example, @samp{|} and @samp{\fR|\fP} both
11009
result in a roman @samp{|} glyph with the same point size and at the
11010
same location on the page, so the strings are equal. If
11011
@samp{.ft@tie{}I} had been added before the @samp{.ie}, the result would
11012
be ``false'' because (the first) @samp{|} produces an italic @samp{|}
11013
rather than a roman one.
11015
@cindex string comparison
11016
@cindex comparison of strings
11017
To compare strings without processing, surround the data with @code{\?}.
11020
.ie "\?|\?"\?\fR|\fP\?" \
11027
@cindex @code{\?}, and copy-in mode
11028
@cindex copy-in mode, and @code{\?}
11029
@cindex mode, copy-in, and @code{\?}
11031
Since data protected with @code{\?} is read in copy-in mode it is even
11032
possible to use incomplete input without causing an error.
11037
.ie '\?\*a\?'\?\*b\?' \
11045
True if there is a number register named @var{xxx}.
11048
True if there is a string, macro, diversion, or request named @var{xxx}.
11051
True if there is a color named @var{xxx}.
11054
True if there is a glyph @var{g} available@footnote{The name of this
11055
conditional operator is a misnomer since it tests names of output
11056
glyphs.}; @var{g} is either an @acronym{ASCII} character or a special
11057
character (@code{\N'@var{xxx}'}, @code{\(@var{gg}} or
11058
@code{\[@var{ggg}]}); the condition is also true if @var{g} has been
11059
defined by the @code{char} request.
11062
True if a font named @var{font} exists. @var{font} is handled as if it
11063
was opened with the @code{ft} request (this is, font translation and
11064
styles are applied), without actually mounting it.
11066
This test doesn't load the complete font but only its header to verify
11069
@item S @var{style}
11070
True if style @var{style} has been registered. Font translation is
11074
Note that these operators can't be combined with other operators like
11075
@samp{:} or @samp{&}; only a leading @samp{!} (without whitespace
11076
between the exclamation mark and the operator) can be used to negate the
11088
A whitespace after @samp{!} always evaluates to zero (this bizarre
11089
behaviour is due to compatibility with @acronym{UNIX} @code{troff}).
11097
@result{} r xxx true
11100
It is possible to omit the whitespace before the argument to the
11101
@samp{r}, @samp{d}, and @samp{c} operators.
11103
@xref{Expressions}.
11105
@c ---------------------------------------------------------------------
11107
@node if-else, while, Operators in Conditionals, Conditionals and Loops
11108
@subsection if-else
11111
@code{gtroff} has if-then-else constructs like other languages, although
11112
the formatting can be painful.
11114
@Defreq {if, expr anything}
11116
Evaluate the expression @var{expr}, and executes @var{anything} (the
11117
remainder of the line) if @var{expr} evaluates to a value greater than
11118
zero (true). @var{anything} is interpreted as though it was on a line
11119
by itself (except that leading spaces are swallowed).
11120
@xref{Operators in Conditionals}, for more info.
11125
.if ((\n[xxx] == 1) & (\n[yyy] == 2)) true
11130
@Defreq {nop, anything}
11131
Executes @var{anything}. This is similar to @code{.if@tie{}1}.
11134
@DefreqList {ie, expr anything}
11135
@DefreqListEnd {el, anything}
11136
Use the @code{ie} and @code{el} requests to write an if-then-else. The
11137
first request is the `if' part and the latter is the `else' part.
11140
.ie n .ls 2 \" double-spacing in nroff
11141
.el .ls 1 \" single-spacing in troff
11145
@c there is a bug in makeinfo <= 4.1a: you can't have `@{' as an argument
11148
@c and in 4.2 you still can't use @{ in macros.
11150
@c @DefescList {\@{, , , }
11151
@c @DefescListEnd {\@}, , , }
11152
@deffn Escape @t{\@{}
11153
@deffnx Escape @t{\@}}
11156
@cindex begin of conditional block (@code{\@{})
11157
@cindex end of conditional block (@code{\@}})
11158
@cindex conditional block, begin (@code{\@{})
11159
@cindex conditional block, end (@code{\@}})
11160
@cindex block, conditional, begin (@code{\@{})
11161
@cindex block, condititional, end (@code{\@}})
11162
In many cases, an if (or if-else) construct needs to execute more than
11163
one request. This can be done using the @code{\@{} and @code{\@}}
11164
escapes. The following example shows the possible ways to use these
11165
escapes (note the position of the opening and closing braces).
11180
@xref{Expressions}.
11182
@c ---------------------------------------------------------------------
11184
@node while, , if-else, Conditionals and Loops
11188
@code{gtroff} provides a looping construct using the @code{while}
11189
request, which is used much like the @code{if} (and related) requests.
11191
@Defreq {while, expr anything}
11192
Evaluate the expression @var{expr}, and repeatedly execute
11193
@var{anything} (the remainder of the line) until @var{expr} evaluates
11198
.while (\na < 9) \@{\
11202
@result{} 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
11207
@cindex @code{de} request, and @code{while}
11210
The body of a @code{while} request is treated like the body of a
11211
@code{de} request: @code{gtroff} temporarily stores it in a macro which
11212
is deleted after the loop has been exited. It can considerably slow
11213
down a macro if the body of the @code{while} request (within the macro)
11214
is large. Each time the macro is executed, the @code{while} body is
11215
parsed and stored again as a temporary macro.
11220
. while (\\n[num] > 0) \@{\
11221
. \" many lines of code
11227
@cindex recursive macros
11228
@cindex macros, recursive
11230
The traditional and ofter better solution (@acronym{UNIX} @code{troff}
11231
doesn't have the @code{while} request) is to use a recursive macro
11232
instead which is parsed only once during its definition.
11236
. if (\\n[num] > 0) \@{\
11237
. \" many lines of code
11250
Note that the number of available recursion levels is set to@tie{}1000
11251
(this is a compile-time constant value of @code{gtroff}).
11254
The closing brace of a @code{while} body must end a line.
11259
. while (\n[a] < 10) \@{\
11262
@result{} unbalanced \@{ \@}
11268
@cindex @code{while} request, confusing with @code{br}
11269
@cindex @code{break} request, in a @code{while} loop
11270
@cindex @code{continue} request, in a @code{while} loop
11271
Break out of a @code{while} loop. Be sure not to confuse this with the
11272
@code{br} request (causing a line break).
11275
@Defreq {continue, }
11276
Finish the current iteration of a @code{while} loop, immediately
11277
restarting the next iteration.
11280
@xref{Expressions}.
11283
@c =====================================================================
11285
@node Writing Macros, Page Motions, Conditionals and Loops, gtroff Reference
11286
@section Writing Macros
11287
@cindex writing macros
11288
@cindex macros, writing
11290
A @dfn{macro} is a collection of text and embedded commands which can be
11291
invoked multiple times. Use macros to define common operations.
11292
@xref{Strings}, for a (limited) alternative syntax to call macros.
11294
Although the following requests can be used to create macros,
11295
simply using an undefined macro will cause it to be defined as empty.
11296
@xref{Identifiers}.
11298
@DefreqList {de, name [@Var{end}]}
11299
@DefreqItem {de1, name [@Var{end}]}
11300
@DefreqItem {dei, name [@Var{end}]}
11301
@DefreqListEnd {dei1, name [@Var{end}]}
11302
Define a new macro named @var{name}. @code{gtroff} copies subsequent
11303
lines (starting with the next one) into an internal buffer until it
11304
encounters the line @samp{..} (two dots). If the optional second
11305
argument to @code{de} is present it is used as the macro closure
11306
request instead of @samp{..}.
11308
There can be whitespace after the first dot in the line containing the
11309
ending token (either @samp{.} or macro @samp{@var{end}}). Don't insert
11310
a tab character immediately after the @samp{..}, otherwise it isn't
11311
recognized as the end-of-macro symbol.@footnote{While it is possible to
11312
define and call a macro @samp{.} with
11319
.. \" This calls macro `.'!
11323
you can't use this as the end-of-macro macro: during a macro definition,
11324
@samp{..} is never handled as a call to @samp{.}, even if you say
11325
@samp{.de foo .} explicitly.}
11327
Here a small example macro called @samp{P} which causes a break and
11328
inserts some vertical space. It could be used to separate paragraphs.
11337
The following example defines a macro within another. Remember that
11338
expansion must be protected twice; once for reading the macro and once
11342
\# a dummy macro to avoid a warning
11348
. nop \f[B]Hallo \\\\$1!\f[]
11354
@result{} @b{Hallo Joe!}
11358
Since @code{\f} has no expansion, it isn't necessary to protect its
11359
backslash. Had we defined another macro within @code{bar} which takes a
11360
parameter, eight backslashes would be necessary before @samp{$1}.
11362
The @code{de1} request turns off compatibility mode while executing the
11363
macro. On entry, the current compatibility mode is saved and restored
11370
The value of xxx is \\n[xxx].
11373
The value of xxx ix \\n[xxx].
11379
@result{} warning: number register `[' not defined
11380
@result{} The value of xxx is 0xxx].
11382
@result{} The value of xxx ix 12345.
11385
The @code{dei} request defines a macro indirectly. That is, it expands
11386
strings whose names are @var{name} or @var{end} before performing the
11404
The @code{dei1} request is similar to @code{dei} but with compatibility
11405
mode switched off during execution of the defined macro.
11407
If compatibility mode is on, @code{de} (and @code{dei}) behave similar
11408
to @code{de1} (and @code{dei1}): A `compatibility save' token is
11409
inserted at the beginning, and a `compatibility restore' token at the
11410
end, with compatibility mode switched on during execution. @xref{Gtroff
11411
Internals}, for more information on switching compatibility mode on and
11412
off in a single document.
11415
Using @file{trace.tmac}, you can trace calls to @code{de} and
11418
Note that macro identifiers are shared with identifiers for strings and
11421
@xref{als,,the description of the @code{als} request}, for possible
11422
pitfalls if redefining a macro which has been aliased.
11425
@DefreqList {am, name [@Var{end}]}
11426
@DefreqItem {am1, name [@Var{end}]}
11427
@DefreqItem {ami, name [@Var{end}]}
11428
@DefreqListEnd {ami1, name [@Var{end}]}
11429
@cindex appending to a macro (@code{am})
11430
@cindex macro, appending (@code{am})
11431
Works similarly to @code{de} except it appends onto the macro named
11432
@var{name}. So, to make the previously defined @samp{P} macro actually
11433
do indented instead of block paragraphs, add the necessary code to the
11434
existing macro like this:
11442
The @code{am1} request turns off compatibility mode while executing the
11443
appended macro piece. To be more precise, a @dfn{compatibility save}
11444
input token is inserted at the beginning of the appended code, and a
11445
@dfn{compatibility restore} input token at the end.
11447
The @code{ami} request appends indirectly, meaning that @code{gtroff}
11448
expands strings whose names are @var{name} or @var{end} before
11449
performing the append.
11451
The @code{ami1} request is similar to @code{ami} but compatibility mode
11452
is switched off during execution of the defined macro.
11455
Using @file{trace.tmac}, you can trace calls to @code{am} and
11459
@xref{Strings}, for the @code{als} and @code{rn} request to create an
11460
alias and rename a macro, respectively.
11462
The @code{de}, @code{am}, @code{di}, @code{da}, @code{ds}, and @code{as}
11463
requests (together with its variants) only create a new object if the
11464
name of the macro, diversion or string diversion is currently undefined
11465
or if it is defined to be a request; normally they modify the value of
11466
an existing object.
11468
@Defreq {return, [@Var{anything}]}
11469
Exit a macro, immediately returning to the caller.
11471
If called with an argument, exit twice, namely the current macro and the
11472
macro one level higher. This is used to define a wrapper macro for
11473
@code{return} in @file{trace.tmac}.
11481
@c ---------------------------------------------------------------------
11483
@node Copy-in Mode, Parameters, Writing Macros, Writing Macros
11484
@subsection Copy-in Mode
11486
@cindex copy-in mode
11488
@cindex mode, copy-in
11490
@cindex @code{\n}, when reading text for a macro
11491
@cindex @code{\$}, when reading text for a macro
11492
@cindex @code{\*}, when reading text for a macro
11493
@cindex @code{\\}, when reading text for a macro
11494
@cindex \@key{RET}, when reading text for a macro
11495
When @code{gtroff} reads in the text for a macro, string, or diversion,
11496
it copies the text (including request lines, but excluding escapes) into
11497
an internal buffer. Escapes are converted into an internal form, except
11498
for @code{\n}, @code{\$}, @code{\*}, @code{\\} and @code{\@key{RET}}
11499
which are evaluated and inserted into the text where the escape was
11500
located. This is known as @dfn{copy-in} mode or @dfn{copy} mode.
11502
What this means is that you can specify when these escapes are to be
11503
evaluated (either at copy-in time or at the time of use) by insulating
11504
the escapes with an extra backslash. Compare this to the @code{\def}
11505
and @code{\edef} commands in @TeX{}.
11507
The following example prints the numbers 20 and@tie{}10:
11519
@c ---------------------------------------------------------------------
11521
@node Parameters, , Copy-in Mode, Writing Macros
11522
@subsection Parameters
11525
The arguments to a macro or string can be examined using a variety of
11529
@cindex number of arguments register (@code{.$})
11530
The number of arguments passed to a macro or string. This is a
11531
read-only number register.
11533
Note that the @code{shift} request can change its value.
11536
Any individual argument can be retrieved with one of the following
11539
@DefescList {\\$, , n, }
11540
@DefescItem {\\$, @Lparen{}, nn, }
11541
@DefescListEnd {\\$, @Lbrack{}, nnn, @Rbrack{}}
11542
@cindex copy-in mode, and macro arguments
11543
@cindex mode, copy-in, and macro arguments
11544
@cindex macro, arguments (@code{\$})
11545
@cindex arguments, macro (@code{\$})
11546
Retrieve the @var{n}@dmn{th}, @var{nn}@dmn{th} or @var{nnn}@dmn{th}
11547
argument. As usual, the first form only accepts a single number (larger
11548
than zero), the second a two-digit number (larger or equal to@tie{}10),
11549
and the third any positive integer value (larger than zero). Macros and
11550
strings can have an unlimited number of arguments. Note that due to
11551
copy-in mode, use two backslashes on these in actual use to prevent
11552
interpolation until the macro is actually invoked.
11555
@Defreq {shift, [@Var{n}]}
11556
Shift the arguments 1@tie{}position, or as many positions as specified
11557
by its argument. After executing this request, argument@tie{}@var{i}
11558
becomes argument @math{@var{i}-@var{n}}; arguments 1 to@tie{}@var{n} are
11559
no longer available. Shifting by negative amounts is currently
11562
The register @code{.$} is adjusted accordingly.
11565
@DefescList {\\$*, , , }
11566
@DefescListEnd {\\$@@, , , }
11567
In some cases it is convenient to use all of the arguments at once (for
11568
example, to pass the arguments along to another macro). The @code{\$*}
11569
escape concatenates all the arguments separated by spaces. A similar
11570
escape is @code{\$@@}, which concatenates all the arguments with each
11571
surrounded by double quotes, and separated by spaces. If not in
11572
compatibility mode, the input level of double quotes is preserved (see
11573
@ref{Request and Macro Arguments}).
11576
@Defesc {\\$^, , , }
11577
Handle the parameters of a macro as if they were an argument to the
11578
@code{ds} or similar requests.
11588
.foo " This is a "test"
11589
@result{} $1=` This is a '
11590
@result{} $2=`test"'
11591
@result{} $*=` This is a test"'
11592
@result{} $@@=`" This is a " "test""'
11593
@result{} $^=`" This is a "test"'
11596
This escape is useful mainly for macro packages like @file{trace.tmac}
11597
which redefines some requests and macros for debugging purposes.
11600
@Defesc {\\$0, , , }
11601
@cindex macro name register (@code{\$0})
11602
@cindex @code{als} request, and @code{\$0}
11603
The name used to invoke the current macro. The @code{als} request can
11604
make a macro have more than one name.
11606
If a macro is called as a string (within another macro), the value of
11607
@code{\$0} isn't changed.
11643
@xref{Request and Macro Arguments}.
11646
@c =====================================================================
11648
@node Page Motions, Drawing Requests, Writing Macros, gtroff Reference
11649
@section Page Motions
11650
@cindex page motions
11651
@cindex motions, page
11653
@xref{Manipulating Spacing}, for a discussion of the main request for
11654
vertical motion, @code{sp}.
11656
@DefreqList {mk, [@Var{reg}]}
11657
@DefreqListEnd {rt, [@Var{dist}]}
11658
@cindex marking vertical page location (@code{mk})
11659
@cindex page location, vertical, marking (@code{mk})
11660
@cindex location, vertical, page, marking (@code{mk})
11661
@cindex vertical page location, marking (@code{mk})
11662
@cindex returning to marked vertical page location (@code{rt})
11663
@cindex page location, vertical, returning to marked (@code{rt})
11664
@cindex location, vertical, page, returning to marked (@code{rt})
11665
@cindex vertical page location, returning to marked (@code{rt})
11666
The request @code{mk} can be used to mark a location on a page, for
11667
movement to later. This request takes a register name as an argument in
11668
which to store the current page location. With no argument it stores
11669
the location in an internal register. The results of this can be used
11670
later by the @code{rt} or the @code{sp} request (or the @code{\v}
11673
The @code{rt} request returns @emph{upwards} to the location marked with
11674
the last @code{mk} request. If used with an argument, return to a
11675
position which distance from the top of the page is @var{dist} (no
11676
previous call to @code{mk} is necessary in this case). Default scaling
11677
indicator is @samp{v}.
11679
Here a primitive solution for a two-column macro.
11682
.nr column-length 1.5i
11684
.nr bottom-margin 1m
11691
. ll \\n[column-length]u
11692
. wh -\\n[bottom-margin]u 2c-trap
11699
. ie \\n[right-side] \@{\
11701
. po -(\\n[column-length]u + \\n[column-gap]u)
11703
. wh -\\n[bottom-margin]u
11706
. \" switch to right side
11708
. po +(\\n[column-length]u + \\n[column-gap]u)
11717
This is a small test which shows how the
11718
rt request works in combination with mk.
11721
Starting here, text is typeset in two columns.
11722
Note that this implementation isn't robust
11723
and thus not suited for a real two-column
11730
This is a small test which shows how the
11731
rt request works in combination with mk.
11733
Starting here, isn't robust
11734
text is typeset and thus not
11735
in two columns. suited for a
11736
Note that this real two-column
11737
implementation macro.
11741
The following escapes give fine control of movements about the page.
11743
@Defesc {\\v, ', e, '}
11744
@cindex vertical motion (@code{\v})
11745
@cindex motion, vertical (@code{\v})
11746
Move vertically, usually from the current location on the page (if no
11747
absolute position operator @samp{|} is used). The argument@tie{}@var{e}
11748
specifies the distance to move; positive is downwards and negative
11749
upwards. The default scaling indicator for this escape is @samp{v}.
11750
Beware, however, that @code{gtroff} continues text processing at the
11751
point where the motion ends, so you should always balance motions to
11752
avoid interference with text processing.
11754
@code{\v} doesn't trigger a trap. This can be quite useful; for
11755
example, consider a page bottom trap macro which prints a marker in the
11756
margin to indicate continuation of a footnote or something similar.
11759
There are some special-case escapes for vertical motion.
11761
@Defesc {\\r, , , }
11762
Move upwards@tie{}1@dmn{v}.
11765
@Defesc {\\u, , , }
11766
Move upwards@tie{}.5@dmn{v}.
11769
@Defesc {\\d, , , }
11770
Move down@tie{}.5@dmn{v}.
11773
@Defesc {\\h, ', e, '}
11774
@cindex inserting horizontal space (@code{\h})
11775
@cindex horizontal space (@code{\h})
11776
@cindex space, horizontal (@code{\h})
11777
@cindex horizontal motion (@code{\h})
11778
@cindex motion, horizontal (@code{\h})
11779
Move horizontally, usually from the current location (if no absolute
11780
position operator @samp{|} is used). The expression@tie{}@var{e}
11781
indicates how far to move: positive is rightwards and negative
11782
leftwards. The default scaling indicator for this escape is @samp{m}.
11784
This horizontal space is not discarded at the end of a line. To insert
11785
discardable space of a certain length use the @code{ss} request.
11788
There are a number of special-case escapes for horizontal motion.
11790
@Defesc {\\@key{SP}, , , }
11791
@cindex space, unbreakable
11792
@cindex unbreakable space
11793
An unbreakable and unpaddable (i.e.@: not expanded during filling)
11794
space. (Note: This is a backslash followed by a space.)
11797
@Defesc {\\~, , , }
11798
An unbreakable space that stretches like a normal inter-word space when
11799
a line is adjusted.
11802
@Defesc {\\|, , , }
11803
A 1/6@dmn{th} em space. Ignored for TTY output devices (rounded to
11806
However, if there is a glyph defined in the current font file with name
11807
@code{\|} (note the leading backslash), the width of this glyph is used
11808
instead (even for TTYs).
11811
@Defesc {\\^, , , }
11812
A 1/12@dmn{th} em space. Ignored for TTY output devices (rounded to
11815
However, if there is a glyph defined in the current font file with name
11816
@code{\^} (note the leading backslash), the width of this glyph is used
11817
instead (even for TTYs).
11820
@Defesc {\\0, , , }
11821
@cindex space, width of a digit (@code{\0})
11822
@cindex digit width space (@code{\0})
11823
A space the size of a digit.
11826
The following string sets the @TeX{} logo:
11829
.ds TeX T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
11832
@DefescList {\\w, ', text, '}
11839
@DefregListEnd {skw}
11840
@cindex width escape (@code{\w})
11841
Return the width of the specified @var{text} in basic units. This
11842
allows horizontal movement based on the width of some arbitrary text
11843
(e.g.@: given as an argument to a macro).
11846
The length of the string `abc' is \w'abc'u.
11847
@result{} The length of the string `abc' is 72u.
11850
Font changes may occur in @var{text} which don't affect current
11853
After use, @code{\w} sets several registers:
11858
The highest and lowest point of the baseline, respectively, in
11863
Like the @code{st} and @code{sb} registers, but takes account of the
11864
heights and depths of glyphs. In other words, this gives the highest
11865
and lowest point of @var{text}. Values below the baseline are negative.
11868
Defines the kinds of glyphs occurring in @var{text}:
11872
only short glyphs, no descenders or tall glyphs.
11875
at least one descender.
11878
at least one tall glyph.
11881
at least one each of a descender and a tall glyph.
11885
The amount of horizontal space (possibly negative) that should be added
11886
to the last glyph before a subscript.
11889
How far to right of the center of the last glyph in the @code{\w}
11890
argument, the center of an accent from a roman font should be placed
11895
@DefescList {\\k, , p, }
11896
@DefescItem {\\k, @Lparen{}, ps, }
11897
@DefescListEnd {\\k, @Lbrack{}, position, @Rbrack{}}
11898
@cindex saving horizontal input line position (@code{\k})
11899
@cindex horizontal input line position, saving (@code{\k})
11900
@cindex input line position, horizontal, saving (@code{\k})
11901
@cindex position, horizontal input line, saving (@code{\k})
11902
@cindex line, input, horizontal position, saving (@code{\k})
11903
Store the current horizontal position in the @emph{input} line in number
11904
register with name @var{position} (one-character name@tie{}@var{p},
11905
two-character name @var{ps}). Use this, for example, to return to the
11906
beginning of a string for highlighting or other decoration.
11910
@cindex horizontal input line position register (@code{hp})
11911
@cindex input line, horizontal position, register (@code{hp})
11912
@cindex position, horizontal, in input line, register (@code{hp})
11913
@cindex line, input, horizontal position, register (@code{hp})
11914
The current horizontal position at the input line.
11918
@cindex horizontal output line position register (@code{.k})
11919
@cindex output line, horizontal position, register (@code{.k})
11920
@cindex position, horizontal, in output line, register (@code{.k})
11921
@cindex line, output, horizontal position, register (@code{.k})
11922
A read-only number register containing the current horizontal output
11923
position (relative to the current indentation).
11926
@Defesc {\\o, ', abc, '}
11927
@cindex overstriking glyphs (@code{\o})
11928
@cindex glyphs, overstriking (@code{\o})
11929
Overstrike glyphs @var{a}, @var{b}, @var{c}, @dots{}; the glyphs are
11930
centered, and the resulting spacing is the largest width of the affected
11934
@Defesc {\\z, , g, , }
11935
@cindex zero-width printing (@code{\z}, @code{\Z})
11936
@cindex printing, zero-width (@code{\z}, @code{\Z})
11937
Print glyph @var{g} with zero width, i.e., without spacing. Use this to
11938
overstrike glyphs left-aligned.
11941
@Defesc {\\Z, ', anything, '}
11942
@cindex zero-width printing (@code{\z}, @code{\Z})
11943
@cindex printing, zero-width (@code{\z}, @code{\Z})
11944
Print @var{anything}, then restore the horizontal and vertical position.
11945
The argument may not contain tabs or leaders.
11947
The following is an example of a strike-through macro:
11952
\Z@@\v'-.25m'\l'\\n[ww]u'@@\\$1
11957
an actual emergency!
11962
@c =====================================================================
11964
@node Drawing Requests, Traps, Page Motions, gtroff Reference
11965
@section Drawing Requests
11966
@cindex drawing requests
11967
@cindex requests for drawing
11969
@code{gtroff} provides a number of ways to draw lines and other figures
11970
on the page. Used in combination with the page motion commands (see
11971
@ref{Page Motions}, for more info), a wide variety of figures can be
11972
drawn. However, for complex drawings these operations can be quite
11973
cumbersome, and it may be wise to use graphic preprocessors like
11974
@code{gpic} or @code{ggrn}. @xref{gpic}, and @ref{ggrn}, for more
11977
All drawing is done via escapes.
11979
@DefescList {\\l, ', l, '}
11980
@DefescListEnd {\\l, ', lg, '}
11981
@cindex drawing horizontal lines (@code{\l})
11982
@cindex horizontal line, drawing (@code{\l})
11983
@cindex line, horizontal, drawing (@code{\l})
11984
Draw a line horizontally. @var{l} is the length of the line to be
11985
drawn. If it is positive, start the line at the current location and
11986
draw to the right; its end point is the new current location. Negative
11987
values are handled differently: The line starts at the current location
11988
and draws to the left, but the current location doesn't move.
11990
@var{l} can also be specified absolutely (i.e.@: with a leading
11991
@samp{|}) which draws back to the beginning of the input line. Default
11992
scaling indicator is @samp{m}.
11994
@cindex underscore glyph (@code{\[ru]})
11995
@cindex glyph, underscore (@code{\[ru]})
11996
@cindex line drawing glyph
11997
@cindex glyph, for line drawing
11998
The optional second parameter@tie{}@var{g} is a glyph to draw the line
11999
with. If this second argument is not specified, @code{gtroff} uses the
12000
underscore glyph, @code{\[ru]}.
12002
@cindex zero width space character (@code{\&})
12003
@cindex character, zero width space (@code{\&})
12004
@cindex space character, zero width (@code{\&})
12005
To separate the two arguments (to prevent @code{gtroff} from
12006
interpreting a drawing glyph as a scaling indicator if the glyph is
12007
represented by a single character) use @code{\&}.
12009
Here a small useful example:
12013
\[br]\\$*\[br]\l'|0\[rn]'\l'|0\[ul]'
12018
Note that this works by outputting a box rule (a vertical line), then
12019
the text given as an argument and then another box rule. Finally, the
12020
line drawing escapes both draw from the current location to the
12021
beginning of the @emph{input} line -- this works because the line length
12022
is negative, not moving the current point.
12025
@DefescList {\\L, ', l, '}
12026
@DefescListEnd {\\L, ', lg, '}
12027
@cindex drawing vertical lines (@code{\L})
12028
@cindex vertical line drawing (@code{\L})
12029
@cindex line, vertical, drawing (@code{\L})
12030
@cindex line drawing glyph
12031
@cindex glyph for line drawing
12032
@cindex box rule glyph (@code{\[br]})
12033
@cindex glyph, box rule (@code{\[br]})
12034
Draw vertical lines. Its parameters are similar to the @code{\l}
12035
escape, except that the default scaling indicator is @samp{v}. The
12036
movement is downwards for positive values, and upwards for negative
12037
values. The default glyph is the box rule glyph, @code{\[br]}. As with
12038
the vertical motion escapes, text processing blindly continues where the
12042
This is a \L'3v'test.
12046
Here the result, produced with @code{grotty}.
12056
@Defesc {\\D, ', command arg @dots{}, '}
12057
The @code{\D} escape provides a variety of drawing functions. Note that
12058
on character devices, only vertical and horizontal lines are supported
12059
within @code{grotty}; other devices may only support a subset of the
12060
available drawing functions.
12062
The default scaling indicator for all subcommands of @code{\D} is
12063
@samp{m} for horizontal distances and @samp{v} for vertical ones.
12064
Exceptions are @w{@code{\D'f @dots{}'}} and @w{@code{\D't @dots{}'}}
12065
which use @code{u} as the default, and @w{@code{\D'F@var{x} @dots{}'}}
12066
which arguments are treated similar to the @code{defcolor} request.
12069
@item \D'l @var{dx} @var{dy}'
12070
@cindex line, drawing (@w{@code{\D'l @dots{}'}})
12071
@cindex drawing a line (@w{@code{\D'l @dots{}'}})
12072
Draw a line from the current location to the relative point specified by
12073
(@var{dx},@var{dy}), where positive values mean down and right,
12074
respectively. The end point of the line is the new current location.
12076
The following example is a macro for creating a box around a text
12077
string; for simplicity, the box margin is taken as a fixed value,
12084
\h'-.2m'\v'(.2m - \\n[rsb]u)'\
12085
\D'l 0 -(\\n[rst]u - \\n[rsb]u + .4m)'\
12086
\D'l (\\n[@@wd]u + .4m) 0'\
12087
\D'l 0 (\\n[rst]u - \\n[rsb]u + .4m)'\
12088
\D'l -(\\n[@@wd]u + .4m) 0'\
12089
\h'.2m'\v'-(.2m - \\n[rsb]u)'\
12096
First, the width of the string is stored in register @code{@@wd}. Then,
12097
four lines are drawn to form a box, properly offset by the box margin.
12098
The registers @code{rst} and @code{rsb} are set by the @code{\w} escape,
12099
containing the largest height and depth of the whole string.
12101
@item \D'c @var{d}'
12102
@cindex circle, drawing (@w{@code{\D'c @dots{}'}})
12103
@cindex drawing a circle (@w{@code{\D'c @dots{}'}})
12104
Draw a circle with a diameter of@tie{}@var{d} with the leftmost point at
12105
the current position. After drawing, the current location is positioned
12106
at the rightmost point of the circle.
12108
@item \D'C @var{d}'
12109
@cindex circle, solid, drawing (@w{@code{\D'C @dots{}'}})
12110
@cindex drawing a solid circle (@w{@code{\D'C @dots{}'}})
12111
@cindex solid circle, drawing (@w{@code{\D'C @dots{}'}})
12112
Draw a solid circle with the same parameters and behaviour as an
12113
outlined circle. No outline is drawn.
12115
@item \D'e @var{x} @var{y}'
12116
@cindex drawing an ellipse (@w{@code{\D'e @dots{}'}})
12117
@cindex ellipse, drawing (@w{@code{\D'e @dots{}'}})
12118
Draw an ellipse with a horizontal diameter of @var{x} and a vertical
12119
diameter of @var{y} with the leftmost point at the current position.
12120
After drawing, the current location is positioned at the rightmost point
12123
@item \D'E @var{x} @var{y}'
12124
@cindex ellipse, solid, drawing (@w{@code{\D'E @dots{}'}})
12125
@cindex drawing a solid ellipse (@w{@code{\D'E @dots{}'}})
12126
@cindex solid ellipse, drawing (@w{@code{\D'E @dots{}'}})
12127
Draw a solid ellipse with the same parameters and behaviour as an
12128
outlined ellipse. No outline is drawn.
12130
@item \D'a @var{dx1} @var{dy1} @var{dx2} @var{dy2}'
12131
@cindex arc, drawing (@w{@code{\D'a @dots{}'}})
12132
@cindex drawing an arc (@w{@code{\D'a @dots{}'}})
12133
Draw an arc clockwise from the current location through the two
12134
specified relative locations (@var{dx1},@var{dy1}) and
12135
(@var{dx2},@var{dy2}). The coordinates of the first point are relative
12136
to the current position, and the coordinates of the second point are
12137
relative to the first point. After drawing, the current position is
12138
moved to the final point of the arc.
12140
@item \D'~ @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
12141
@cindex drawing a spline (@w{@code{\D'~ @dots{}'}})
12142
@cindex spline, drawing (@w{@code{\D'~ @dots{}'}})
12143
Draw a spline from the current location to the relative point
12144
(@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}), and so on. The
12145
current position is moved to the terminal point of the drawn curve.
12147
@item \D'f @var{n}'
12148
@cindex gray shading (@w{@code{\D'f @dots{}'}})
12149
@cindex shading filled objects (@w{@code{\D'f @dots{}'}})
12150
Set the shade of gray to be used for filling solid objects
12151
to@tie{}@var{n}; @var{n}@tie{}must be an integer between 0
12152
and@tie{}1000, where 0 corresponds solid white and 1000 to solid black,
12153
and values in between correspond to intermediate shades of gray. This
12154
applies only to solid circles, solid ellipses, and solid polygons. By
12155
default, a level of 1000 is used.
12157
Despite of being silly, the current point is moved horizontally to the
12158
right by@tie{}@var{n}.
12160
@cindex @w{@code{\D'f @dots{}'}} and horizontal resolution
12161
Don't use this command! It has the serious drawback that it is always
12162
rounded to the next integer multiple of the horizontal resolution (the
12163
value of the @code{hor} keyword in the @file{DESC} file). Use @code{\M}
12164
(@pxref{Colors}) or @w{@code{\D'Fg @dots{}'}} instead.
12166
@item \D'p @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
12167
@cindex drawing a polygon (@w{@code{\D'p @dots{}'}})
12168
@cindex polygon, drawing (@w{@code{\D'p @dots{}'}})
12169
Draw a polygon from the current location to the relative position
12170
(@var{dx1},@var{dy1}) and then to (@var{dx2},@var{dy2}) and so on. When
12171
the specified data points are exhausted, a line is drawn back to the
12172
starting point. The current position is changed by adding the sum of
12173
all arguments with odd index to the actual horizontal position and the
12174
even ones to the vertical position.
12176
@item \D'P @var{dx1} @var{dy1} @var{dx2} @var{dy2} @dots{}'
12177
@cindex polygon, solid, drawing (@w{@code{\D'P @dots{}'}})
12178
@cindex drawing a solid polygon (@w{@code{\D'P @dots{}'}})
12179
@cindex solid polygon, drawing (@w{@code{\D'P @dots{}'}})
12180
Draw a solid polygon with the same parameters and behaviour as an
12181
outlined polygon. No outline is drawn.
12183
Here a better variant of the box macro to fill the box with some color.
12184
Note that the box must be drawn before the text since colors in
12185
@code{gtroff} are not transparent; the filled polygon would hide the
12192
\h'-.2m'\v'(.2m - \\n[rsb]u)'\
12194
\D'P 0 -(\\n[rst]u - \\n[rsb]u + .4m) \
12195
(\\n[@@wd]u + .4m) 0 \
12196
0 (\\n[rst]u - \\n[rsb]u + .4m) \
12197
-(\\n[@@wd]u + .4m) 0'\
12198
\h'.2m'\v'-(.2m - \\n[rsb]u)'\
12205
If you want a filled polygon which has exactly the same size as an
12206
unfilled one, you must draw both an unfilled and a filled polygon. A
12207
filled polygon is always smaller than an unfilled one because the latter
12208
uses straight lines with a given line thickness to connect the polygon's
12209
corners, while the former simply fills the area defined by the
12214
\# increase line thickness
12216
\# draw unfilled polygon
12217
\Z'\D'p 3 3 -6 0''\
12218
\# draw filled polygon
12222
@item \D't @var{n}'
12223
@cindex line thickness (@w{@code{\D't @dots{}'}})
12224
@cindex thickness of lines (@w{@code{\D't @dots{}'}})
12225
Set the current line thickness to @var{n}@tie{}machine units. A value
12226
of zero selects the smallest available line thickness. A negative value
12227
makes the line thickness proportional to the current point size (this is
12228
the default behaviour of @acronym{AT&T} @code{troff}).
12230
Despite of being silly, the current point is moved horizontally to the
12231
right by@tie{}@var{n}.
12233
@item \D'F@var{scheme} @var{color_components}'
12234
@cindex unnamed fill colors (@code{\D'F@dots{}'})
12235
@cindex fill colors, unnamed (@code{\D'F@dots{}'})
12236
@cindex colors, fill, unnamed (@code{\D'F@dots{}'})
12237
Change current fill color. @var{scheme} is a single letter denoting the
12238
color scheme: @samp{r} (rgb), @samp{c} (cmy), @samp{k} (cmyk), @samp{g}
12239
(gray), or @samp{d} (default color). The color components use exactly
12240
the same syntax as in the @code{defcolor} request (@pxref{Colors}); the
12241
command @code{\D'Fd'} doesn't take an argument.
12243
@emph{No} position changing!
12249
\D'Fg .3' \" same gray as \D'f 700'
12250
\D'Fr #0000ff' \" blue
12254
@xref{Graphics Commands}.
12256
@Defesc {\\b, ', string, '}
12257
@cindex pile, glyph (@code{\b})
12258
@cindex glyph pile (@code{\b})
12259
@cindex stacking glyphs (@code{\b})
12260
@dfn{Pile} a sequence of glyphs vertically, and center it vertically on
12261
the current line. Use it to build large brackets and braces.
12263
Here an example how to create a large opening brace:
12266
\b'\[lt]\[bv]\[lk]\[bv]\[lb]'
12269
@cindex @code{\b}, limitations
12270
@cindex limitations of @code{\b} escape
12271
The first glyph is on the top, the last glyph in @var{string} is at the
12272
bottom. Note that @code{gtroff} separates the glyphs vertically by
12273
1@dmn{m}, and the whole object is centered 0.5@dmn{m} above the current
12274
baseline; the largest glyph width is used as the width for the whole
12275
object. This rather unflexible positioning algorithm doesn't work with
12276
@option{-Tdvi} since the bracket pieces vary in height for this device.
12277
Instead, use the @code{eqn} preprocessor.
12279
@xref{Manipulating Spacing}, how to adjust the vertical spacing with the
12284
@c =====================================================================
12286
@node Traps, Diversions, Drawing Requests, gtroff Reference
12290
@dfn{Traps} are locations, which, when reached, call a specified macro.
12291
These traps can occur at a given location on the page, at a given
12292
location in the current diversion, at a blank line, after a certain
12293
number of input lines, or at the end of input.
12295
@cindex planting a trap
12296
@cindex trap, planting
12297
Setting a trap is also called @dfn{planting}.
12298
@cindex trap, springing
12299
@cindex springing a trap
12300
It is also said that a trap is @dfn{sprung} if the associated macro is
12304
* Page Location Traps::
12305
* Diversion Traps::
12306
* Input Line Traps::
12307
* Blank Line Traps::
12308
* Leading Spaces Traps::
12309
* End-of-input Traps::
12312
@c ---------------------------------------------------------------------
12314
@node Page Location Traps, Diversion Traps, Traps, Traps
12315
@subsection Page Location Traps
12316
@cindex page location traps
12317
@cindex traps, page location
12319
@dfn{Page location traps} perform an action when @code{gtroff} reaches
12320
or passes a certain vertical location on the page. Page location traps
12321
have a variety of purposes, including:
12325
setting headers and footers
12328
setting body text in multiple columns
12334
@DefreqList {vpt, flag}
12335
@DefregListEnd {.vpt}
12336
@cindex enabling vertical position traps (@code{vpt})
12337
@cindex vertical position traps, enabling (@code{vpt})
12338
@cindex vertical position trap enable register (@code{.vpt})
12339
Enable vertical position traps if @var{flag} is non-zero, or disables
12340
them otherwise. Vertical position traps are traps set by the @code{wh}
12341
or @code{dt} requests. Traps set by the @code{it} request are not
12342
vertical position traps. The parameter that controls whether vertical
12343
position traps are enabled is global. Initially vertical position traps
12344
are enabled. The current setting of this is available in the
12345
@code{.vpt} read-only number register.
12347
Note that a page can't be ejected if @code{vpt} is set to zero.
12350
@Defreq {wh, dist [@Var{macro}]}
12351
Set a page location trap. Non-negative values for @var{dist} set the
12352
trap relative to the top of the page; negative values set the trap
12353
relative to the bottom of the page. Default scaling indicator is
12354
@samp{v}; values of @var{dist} are always rounded to be multiples of the
12355
vertical resolution (as given in register @code{.V}).
12357
@var{macro} is the name of the macro to execute when the trap is sprung.
12358
If @var{macro} is missing, remove the first trap (if any) at @var{dist}.
12360
@cindex page headers
12361
@cindex page footers
12364
The following is a simple example of how many macro packages set headers
12368
.de hd \" Page header
12374
.de fo \" Page footer
12380
.wh 0 hd \" trap at top of the page
12381
.wh -1i fo \" trap one inch from bottom
12384
A trap at or below the bottom of the page is ignored; it can be made
12385
active by either moving it up or increasing the page length so that the
12386
trap is on the page.
12388
Negative trap values always use the @emph{current} page length; they are
12389
not converted to an absolute vertical position:
12401
It is possible to have more than one trap at the same location; to do
12402
so, the traps must be defined at different locations, then moved
12403
together with the @code{ch} request; otherwise the second trap would
12404
replace the first one. Earlier defined traps hide later defined traps
12405
if moved to the same position (the many empty lines caused by the
12406
@code{bp} request are omitted in the following example):
12439
@cindex distance to next trap register (@code{.t})
12440
@cindex trap, distance, register (@code{.t})
12441
A read-only number register holding the distance to the next trap.
12443
If there are no traps between the current position and the bottom of the
12444
page, it contains the distance to the page bottom. In a diversion, the
12445
distance to the page bottom is infinite (the returned value is the
12446
biggest integer which can be represented in @code{groff}) if there are
12447
no diversion traps.
12450
@Defreq {ch, macro [@Var{dist}]}
12451
@cindex changing trap location (@code{ch})
12452
@cindex trap, changing location (@code{ch})
12453
Change the location of a trap. The first argument is the name of the
12454
macro to be invoked at the trap, and the second argument is the new
12455
location for the trap (note that the parameters are specified in
12456
opposite order as in the @code{wh} request). This is useful for
12457
building up footnotes in a diversion to allow more space at the bottom
12458
of the page for them.
12460
Default scaling indicator for @var{dist} is @samp{v}. If @var{dist} is
12461
missing, the trap is removed.
12467
... (simplified) footnote example ...
12473
The read-only number register @code{.ne} contains the amount of space
12474
that was needed in the last @code{ne} request that caused a trap to be
12475
sprung. Useful in conjunction with the @code{.trunc} register.
12476
@xref{Page Control}, for more information.
12478
Since the @code{.ne} register is only set by traps it doesn't make much
12479
sense to use it outside of trap macros.
12483
@cindex @code{ne} request, and the @code{.trunc} register
12484
@cindex truncated vertical space register (@code{.trunc})
12485
A read-only register containing the amount of vertical space truncated
12486
by the most recently sprung vertical position trap, or, if the trap was
12487
sprung by an @code{ne} request, minus the amount of vertical motion
12488
produced by the @code{ne} request. In other words, at the point a trap
12489
is sprung, it represents the difference of what the vertical position
12490
would have been but for the trap, and what the vertical position
12493
Since the @code{.trunc} register is only set by traps it doesn't make
12494
much sense to use it outside of trap macros.
12498
@cindex @code{bp} request, and traps (@code{.pe})
12499
@cindex traps, sprung by @code{bp} request (@code{.pe})
12500
@cindex page ejecting register (@code{.pe})
12501
A read-only register which is set to@tie{}1 while a page is ejected with
12502
the @code{bp} request (or by the end of input).
12504
Outside of traps this register is always zero. In the following
12505
example, only the second call to@tie{}@code{x} is caused by @code{bp}.
12526
@cindex diversions, and traps
12527
@cindex traps, and diversions
12528
An important fact to consider while designing macros is that diversions
12529
and traps do not interact normally. For example, if a trap invokes a
12530
header macro (while outputting a diversion) which tries to change the
12531
font on the current page, the effect is not visible before the diversion
12532
has completely been printed (except for input protected with @code{\!}
12533
or @code{\?}) since the data in the diversion is already formatted. In
12534
most cases, this is not the expected behaviour.
12536
@c ---------------------------------------------------------------------
12538
@node Diversion Traps, Input Line Traps, Page Location Traps, Traps
12539
@subsection Diversion Traps
12540
@cindex diversion traps
12541
@cindex traps, diversion
12543
@Defreq {dt, [@Var{dist} @Var{macro}]}
12544
@cindex @code{.t} register, and diversions
12545
@cindex setting diversion trap (@code{dt})
12546
@cindex diversion trap, setting (@code{dt})
12547
@cindex trap, diversion, setting (@code{dt})
12548
Set a trap @emph{within} a diversion. @var{dist} is the location of the
12549
trap (identical to the @code{wh} request; default scaling indicator is
12550
@samp{v}) and @var{macro} is the name of the macro to be invoked. If
12551
called without arguments, the diversion trap is removed.
12553
Note that there exists only a single diversion trap.
12555
The number register @code{.t} still works within diversions.
12556
@xref{Diversions}, for more information.
12559
@c ---------------------------------------------------------------------
12561
@node Input Line Traps, Blank Line Traps, Diversion Traps, Traps
12562
@subsection Input Line Traps
12563
@cindex input line traps
12564
@cindex traps, input line
12566
@DefreqList {it, n macro}
12567
@DefreqItem {itc, n macro}
12568
@cindex setting input line trap (@code{it})
12569
@cindex input line trap, setting (@code{it})
12570
@cindex trap, input line, setting (@code{it})
12571
Set an input line trap. @var{n}@tie{}is the number of lines of input
12572
which may be read before springing the trap, @var{macro} is the macro to
12573
be invoked. Request lines are not counted as input lines.
12575
For example, one possible use is to have a macro which prints the next
12576
@var{n}@tie{}lines in a bold font.
12589
@cindex input line traps and interrupted lines (@code{itc})
12590
@cindex interrupted lines and input line traps (@code{itc})
12591
@cindex traps, input line, and interrupted lines (@code{itc})
12592
@cindex lines, interrupted, and input line traps (@code{itc})
12593
The @code{itc} request is identical except that an interrupted text line
12594
(ending with @code{\c}) is not counted as a separate line.
12596
Both requests are associated with the current environment
12597
(@pxref{Environments}); switching to another environment disables the
12598
current input trap, and going back reactivates it, restoring the number
12599
of already processed lines.
12602
@c ---------------------------------------------------------------------
12604
@node Blank Line Traps, Leading Spaces Traps, Input Line Traps, Traps
12605
@subsection Blank Line Traps
12606
@cindex blank line traps
12607
@cindex traps, blank line
12609
@Defreq {blm, macro}
12610
@cindex blank line macro (@code{blm})
12611
Set a blank line trap. @code{gtroff} executes @var{macro} when it
12612
encounters a blank line in the input file.
12615
@c ---------------------------------------------------------------------
12617
@node Leading Spaces Traps, End-of-input Traps, Blank Line Traps, Traps
12618
@subsection Leading Spaces Traps
12619
@cindex leading spaces traps
12620
@cindex traps, leading spaces
12622
@DefreqList {lsm, macro}
12624
@DefregListEnd {lss}
12625
@cindex leading spaces macro (@code{lsm})
12626
Set a leading spaces trap. @code{gtroff} executes @var{macro} when it
12627
encounters leading spaces in an input line; the implicit line break
12628
which normally happens in this case is suppressed. A line consisting
12629
of spaces only, however, is treated as an empty line, possibly subject
12630
to an empty line macro set with the @code{blm} request.
12632
Leading spaces are removed from the input line before calling the
12633
leading spaces macro. The number of removed spaces is stored in
12634
register @code{lsn}; the horizontal space which would be emitted if
12635
there was no leading space macro is stored in register @code{lss}.
12636
Note that @code{lsn} and @code{lss} are available even if no leading
12637
space macro has been set.
12639
The first thing a leading space macro sees is a token. However, some
12640
escapes like @code{\f} or @code{\m} are handled on the fly (see
12641
@ref{Gtroff Internals}, for a complete list) without creating a token
12642
at all. Consider that a line starts with two spaces followed by
12643
@code{\fIfoo}. While skipping the spaces @code{\fI} is handled too so
12644
that groff's current font is properly set to @samp{I}, but the leading
12645
space macro only sees @code{foo}, without the preceding @code{\fI}.
12646
If the macro should see the font escape you have to `protect' it with
12647
something which creates a token, for example with @code{\&\fIfoo}.
12650
@c ---------------------------------------------------------------------
12652
@node End-of-input Traps, , Leading Spaces Traps, Traps
12653
@subsection End-of-input Traps
12654
@cindex end-of-input traps
12655
@cindex traps, end-of-input
12657
@Defreq {em, macro}
12658
@cindex setting end-of-input trap (@code{em})
12659
@cindex end-of-input trap, setting (@code{em})
12660
@cindex trap, end-of-input, setting (@code{em})
12661
@cindex end-of-input macro (@code{em})
12662
@cindex macro, end-of-input (@code{em})
12663
Set a trap at the end of input. @var{macro} is executed after the last
12664
line of the input file has been processed.
12666
For example, if the document had to have a section at the bottom of the
12667
last page for someone to approve it, the @code{em} request could be
12674
. sp (\\n[.t]u - 3v)
12686
The @code{\c} in the above example needs explanation. For historical
12687
reasons (and for compatibility with @acronym{AT&T} @code{troff}), the
12688
end macro exits as soon as it causes a page break and no remaining
12689
data is in the partially collected line.
12691
Let us assume that there is no @code{\c} in the above @code{approval}
12692
macro, and that the page is full and has been ended with, say, a
12693
@code{br} request. The @code{ne} request now causes the start of a new
12694
page, which in turn makes @code{troff} exit immediately for the reasons
12695
just described. In most situations this is not intended.
12697
To always force processing the whole end macro independently of this
12698
behaviour it is thus advisable to insert something which starts an
12699
empty partially filled line (@code{\c}) whenever there is a chance that
12700
a page break can happen. In the above example, the call of the
12701
@code{ne} request assures that the remaining code stays on the same
12702
page, so we have to insert @code{\c} only once.
12704
The next example shows how to append three lines, then starting a new
12705
page unconditionally. Since @w{@samp{.ne 1}} doesn't give the desired
12706
effect -- there is always one line available or we are already at the
12707
beginning of the next page -- we temporarily increase the page length
12708
by one line so that we can use @w{@samp{.ne 2}}.
12732
Note that this specific feature affects only the first potential page
12733
break caused by the end macro; further page breaks emitted by the end
12734
macro are handled normally.
12736
Another possible use of the @code{em} request is to make @code{gtroff}
12737
emit a single large page instead of multiple pages. For example, one
12738
may want to produce a long plain-text file for reading on-screen. The
12739
idea is to set the page length at the beginning of the document to a
12740
very large value to hold all the text, and automatically adjust it to
12741
the exact height of the document after the text has been output.
12744
.de adjust-page-length
12746
. pl \\n[nl]u \" \n[nl] holds the current page length
12749
.de single-page-mode
12751
. em adjust-page-length
12754
.\" activate the above code
12758
Since only one end-of-input trap does exist and other macro packages
12759
may already use it, care must be taken not to break the mechanism. A
12760
simple solution would be to append the above macro to the macro
12761
package's end-of-input macro using the @code{.am} request.
12765
@c =====================================================================
12767
@node Diversions, Environments, Traps, gtroff Reference
12768
@section Diversions
12771
In @code{gtroff} it is possible to @dfn{divert} text into a named
12772
storage area. Due to the similarity to defining macros it is sometimes
12773
said to be stored in a macro. This is used for saving text for output
12774
at a later time, which is useful for keeping blocks of text on the same
12775
page, footnotes, tables of contents, and indices.
12777
@cindex top-level diversion
12778
@cindex diversion, top-level
12779
For orthogonality it is said that @code{gtroff} is in the @dfn{top-level
12780
diversion} if no diversion is active (i.e., the data is diverted to the
12783
Although the following requests can be used to create diversions,
12784
simply using an undefined diversion will cause it to be defined as empty.
12785
@xref{Identifiers}.
12787
@DefreqList {di, macro}
12788
@DefreqListEnd {da, macro}
12789
@cindex beginning diversion (@code{di})
12790
@cindex diversion, beginning (@code{di})
12791
@cindex ending diversion (@code{di})
12792
@cindex diversion, ending (@code{di})
12793
@cindex appending to a diversion (@code{da})
12794
@cindex diversion, appending (@code{da})
12795
Begin a diversion. Like the @code{de} request, it takes an argument of
12796
a macro name to divert subsequent text into. The @code{da} macro
12797
appends to an existing diversion.
12799
@code{di} or @code{da} without an argument ends the diversion.
12801
The current partially-filled line is included into the diversion. See
12802
the @code{box} request below for an example. Note that switching to
12803
another (empty) environment (with the @code{ev} request) avoids the
12804
inclusion of the current partially-filled line.
12807
@DefreqList {box, macro}
12808
@DefreqListEnd {boxa, macro}
12809
Begin (or append to) a diversion like the @code{di} and @code{da}
12810
requests. The difference is that @code{box} and @code{boxa} do not
12811
include a partially-filled line in the diversion.
12823
@result{} Before the box. After the box.
12825
@result{} In the box.
12832
Before the diversion.
12837
After the diversion.
12839
@result{} After the diversion.
12841
@result{} Before the diversion. In the diversion.
12844
@code{box} or @code{boxa} without an argument ends the diversion.
12848
@DefregListEnd {.d}
12849
@cindex @code{nl} register, and @code{.d}
12850
@cindex nested diversions
12851
@cindex diversion, nested
12852
@cindex diversion name register (@code{.z})
12853
@cindex vertical position in diversion register (@code{.d})
12854
@cindex position, vertical, in diversion, register (@code{.d})
12855
@cindex diversion, vertical position in, register (@code{.d})
12856
Diversions may be nested. The read-only number register @code{.z}
12857
contains the name of the current diversion (this is a string-valued
12858
register). The read-only number register @code{.d} contains the current
12859
vertical place in the diversion. If not in a diversion it is the same
12860
as register @code{nl}.
12864
@cindex high-water mark register (@code{.h})
12865
@cindex mark, high-water, register (@code{.h})
12866
@cindex position of lowest text line (@code{.h})
12867
@cindex text line, position of lowest (@code{.h})
12868
The @dfn{high-water mark} on the current page. It corresponds to the
12869
text baseline of the lowest line on the page. This is a read-only
12873
.tm .h==\n[.h], nl==\n[nl]
12874
@result{} .h==0, nl==-1
12878
.tm .h==\n[.h], nl==\n[nl]
12879
@result{} .h==40, nl==120
12882
@cindex @code{.h} register, difference to @code{nl}
12883
@cindex @code{nl} register, difference to @code{.h}
12885
As can be seen in the previous example, empty lines are not considered
12886
in the return value of the @code{.h} register.
12890
@DefregListEnd {dl}
12891
@cindex @code{dn} register, and @code{da} (@code{boxa})
12892
@cindex @code{dl} register, and @code{da} (@code{boxa})
12893
@cindex @code{da} request, and @code{dn} (@code{dl})
12894
@cindex @code{boxa} request, and @code{dn} (@code{dl})
12895
After completing a diversion, the read-write number registers @code{dn}
12896
and @code{dl} contain the vertical and horizontal size of the diversion.
12897
Note that only the just processed lines are counted: For the computation
12898
of @code{dn} and @code{dl}, the requests @code{da} and @code{boxa} are
12899
handled as if @code{di} and @code{box} had been used -- lines which have
12900
been already stored in a macro are not taken into account.
12903
.\" Center text both horizontally & vertically
12905
.\" Enclose macro definitions in .eo and .ec
12906
.\" to avoid the doubling of the backslash
12908
.\" macro .(c starts centering mode
12919
.\" macro .)c terminates centering mode
12924
. nr @@s (((\n[.t]u - \n[dn]u) / 2u) - 1v)
12936
.\" End of macro definitions, restore escape mechanism
12941
@DefescList {\\!, , , }
12942
@DefescListEnd {\\?, , anything, \\?}
12943
@cindex transparent output (@code{\!}, @code{\?})
12944
@cindex output, transparent (@code{\!}, @code{\?})
12945
Prevent requests, macros, and escapes from being interpreted when read
12946
into a diversion. Both escapes take the given text and
12947
@dfn{transparently} embed it into the diversion. This is useful for
12948
macros which shouldn't be invoked until the diverted text is actually
12951
The @code{\!} escape transparently embeds text up to and including the
12952
end of the line. The @code{\?} escape transparently embeds text until
12953
the next occurrence of the @code{\?} escape. Example:
12959
@cindex @code{\?}, and copy-in mode
12960
@cindex copy-in mode, and @code{\?}
12961
@cindex mode, copy-in, and @code{\?}
12962
@cindex @code{\!}, and copy-in mode
12963
@cindex copy-in mode, and @code{\!}
12964
@cindex mode, copy-in, and @code{\!}
12966
@var{anything} may not contain newlines; use @code{\!} to embed
12967
newlines in a diversion. The escape sequence @code{\?} is also
12968
recognized in copy mode and turned into a single internal code; it is
12969
this code that terminates @var{anything}. Thus the following example
12976
\?\\?\\\\?\\\\\\\\nx\\\\?\\?\?
12990
Both escapes read the data in copy mode.
12992
@cindex @code{\!}, in top-level diversion
12993
@cindex top-level diversion, and @code{\!}
12994
@cindex diversion, top-level, and @code{\!}
12995
If @code{\!} is used in the top-level diversion, its argument is
12996
directly embedded into the @code{gtroff} intermediate output. This can
12997
be used for example to control a postprocessor which processes the data
12998
before it is sent to the device driver.
13000
@cindex @code{\?}, in top-level diversion
13001
@cindex top-level diversion, and @code{\?}
13002
@cindex diversion, top-level, and @code{\?}
13003
The @code{\?} escape used in the top-level diversion produces no output
13004
at all; its argument is simply ignored.
13007
@cindex @code{\!}, and @code{output} request
13008
@cindex @code{output} request, and @code{\!}
13009
@cindex @code{output} request, and copy-in mode
13010
@cindex copy-in mode, and @code{output} request
13011
@cindex mode, copy-in, and @code{output} request
13012
@Defreq {output, string}
13013
Emit @var{string} directly to the @code{gtroff} intermediate output
13014
(subject to copy mode interpretation); this is similar to @code{\!} used
13015
at the top level. An initial double quote in @var{string} is stripped
13016
off to allow initial blanks.
13018
This request can't be used before the first page has started -- if you
13019
get an error, simply insert @code{.br} before the @code{output} request.
13021
Without argument, @code{output} is ignored.
13023
Use with caution! It is normally only needed for mark-up used by a
13024
postprocessor which does something with the output before sending it to
13025
the output device, filtering out @var{string} again.
13028
@Defreq {asciify, div}
13029
@cindex unformatting diversions (@code{asciify})
13030
@cindex diversion, unformatting (@code{asciify})
13031
@cindex @code{trin} request, and @code{asciify}
13032
@dfn{Unformat} the diversion specified by @var{div} in such a way that
13033
@acronym{ASCII} characters, characters translated with the @code{trin}
13034
request, space characters, and some escape sequences that were formatted
13035
and diverted are treated like ordinary input characters when the
13036
diversion is reread. It can be also used for gross hacks; for example,
13037
the following sets register@tie{}@code{n} to@tie{}1.
13050
Note that @code{asciify} cannot return all items in a diversion back
13051
to their source equivalent, nodes such as @code{\N[...]} will still
13052
remain as nodes, so the result cannot be guaranteed to be a pure string.
13054
@xref{Copy-in Mode}.
13057
@Defreq {unformat, div}
13058
Like @code{asciify}, unformat the specified diversion. However,
13059
@code{unformat} only unformats spaces and tabs between words.
13060
Unformatted tabs are treated as input tokens, and spaces are stretchable
13063
The vertical size of lines is not preserved; glyph information (font,
13064
font size, space width, etc.)@: is retained.
13068
@c =====================================================================
13070
@node Environments, Suppressing output, Diversions, gtroff Reference
13071
@section Environments
13072
@cindex environments
13074
It happens frequently that some text should be printed in a certain
13075
format regardless of what may be in effect at the time, for example, in
13076
a trap invoked macro to print headers and footers. To solve this
13077
@code{gtroff} processes text in @dfn{environments}. An environment
13078
contains most of the parameters that control text processing. It is
13079
possible to switch amongst these environments; by default @code{gtroff}
13080
processes text in environment@tie{}0. The following is the information
13081
kept in an environment.
13085
font parameters (size, family, style, glyph height and slant, space and
13086
sentence space size)
13089
page parameters (line length, title length, vertical spacing, line
13090
spacing, indentation, line numbering, centering, right-justifying,
13091
underlining, hyphenation data)
13094
fill and adjust mode
13097
tab stops, tab and leader characters, escape character, no-break and
13098
hyphen indicators, margin character data
13101
partially collected lines
13107
drawing and fill colours
13110
These environments may be given arbitrary names (see @ref{Identifiers},
13111
for more info). Old versions of @code{troff} only had environments
13112
named @samp{0}, @samp{1}, and @samp{2}.
13114
@DefreqList {ev, [@Var{env}]}
13115
@DefregListEnd {.ev}
13116
@cindex switching environments (@code{ev})
13117
@cindex environment, switching (@code{ev})
13118
@cindex environment number/name register (@code{.ev})
13119
Switch to another environment. The argument @var{env} is the name of
13120
the environment to switch to. With no argument, @code{gtroff} switches
13121
back to the previous environment. There is no limit on the number of
13122
named environments; they are created the first time that they are
13123
referenced. The @code{.ev} read-only register contains the name or
13124
number of the current environment. This is a string-valued register.
13126
Note that a call to @code{ev} (with argument) pushes the previously
13127
active environment onto a stack. If, say, environments @samp{foo},
13128
@samp{bar}, and @samp{zap} are called (in that order), the first
13129
@code{ev} request without parameter switches back to environment
13130
@samp{bar} (which is popped off the stack), and a second call switches
13131
back to environment @samp{foo}.
13133
Here is an example:
13146
\(dg Note the large, friendly letters.
13152
@cindex copying environment (@code{evc})
13153
@cindex environment, copying (@code{evc})
13154
Copy the environment @var{env} into the current environment.
13156
The following environment data is not copied:
13160
Partially filled lines.
13163
The status whether the previous line was interrupted.
13166
The number of lines still to center, or to right-justify, or to
13167
underline (with or without underlined spaces); they are set to zero.
13170
The status whether a temporary indentation is active.
13173
Input traps and its associated data.
13176
Line numbering mode is disabled; it can be reactivated with @w{@samp{.nm
13180
The number of consecutive hyphenated lines (set to zero).
13187
@DefregListEnd {.csk}
13188
@cindex environment, dimensions of last glyph (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
13189
@cindex width, of last glyph (@code{.w})
13190
@cindex height, of last glyph (@code{.cht})
13191
@cindex depth, of last glyph (@code{.cdp})
13192
@cindex skew, of last glyph (@code{.csk})
13193
@cindex last glyph, dimensions (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
13194
@cindex glyph, last, dimensions (@code{.w}, @code{.cht}, @code{.cdp}, @code{.csk})
13195
The @code{\n[.w]} register contains the width of the last glyph added to
13196
the current environment.
13198
The @code{\n[.cht]} register contains the height of the last glyph added
13199
to the current environment.
13201
The @code{\n[.cdp]} register contains the depth of the last glyph added
13202
to the current environment. It is positive for glyphs extending below
13205
The @code{\n[.csk]} register contains the @dfn{skew} (how far to the
13206
right of the glyph's center that @code{gtroff} should place an accent)
13207
of the last glyph added to the current environment.
13211
@cindex environment, previous line length (@code{.n})
13212
@cindex line length, previous (@code{.n})
13213
@cindex length of previous line (@code{.n})
13214
@cindex previous line length (@code{.n})
13215
The @code{\n[.n]} register contains the length of the previous output
13216
line in the current environment.
13220
@c =====================================================================
13222
@node Suppressing output, Colors, Environments, gtroff Reference
13223
@section Suppressing output
13225
@Defesc {\\O, , num, }
13226
@cindex suppressing output (@code{\O})
13227
@cindex output, suppressing (@code{\O})
13228
Disable or enable output depending on the value of @var{num}:
13232
Disable any glyphs from being emitted to the device driver, provided
13233
that the escape occurs at the outer level (see @code{\O[3]} and
13234
@code{\O[4]}). Motion is not suppressed so effectively @code{\O[0]}
13235
means @emph{pen up}.
13238
Enable output of glyphs, provided that the escape occurs at the outer
13246
@code{\O0} and @code{\O1} also reset the four registers @samp{opminx},
13247
@samp{opminy}, @samp{opmaxx}, and @samp{opmaxy} to @minus{}1.
13248
@xref{Register Index}. These four registers mark the top left and
13249
bottom right hand corners of a box which encompasses all written glyphs.
13251
For example the input text:
13254
Hello \O[0]world \O[1]this is a test.
13258
produces the following output:
13261
Hello this is a test.
13266
Provided that the escape occurs at the outer level, enable output of
13267
glyphs and also write out to @code{stderr} the page number and four
13268
registers encompassing the glyphs previously written since the last call
13272
Begin a nesting level. At start-up, @code{gtroff} is at outer level.
13273
The current level is contained within the read-only register @code{.O}.
13274
@xref{Built-in Registers}.
13277
End a nesting level. The current level is contained within the
13278
read-only register @code{.O}. @xref{Built-in Registers}.
13280
@item \O[5@var{P}@var{filename}]
13281
This escape is @code{grohtml} specific. Provided that this escape
13282
occurs at the outer nesting level write the @code{filename} to
13283
@code{stderr}. The position of the image, @var{P}, must be specified
13284
and must be one of @code{l}, @code{r}, @code{c}, or@tie{}@code{i} (left,
13285
right, centered, inline). @var{filename} is associated with the
13286
production of the next inline image.
13291
@c =====================================================================
13293
@node Colors, I/O, Suppressing output, gtroff Reference
13297
@DefreqList {color, [@Var{n}]}
13298
@DefregListEnd {.color}
13299
If @var{n} is missing or non-zero, activate colors (this is the
13300
default); otherwise, turn it off.
13302
The read-only number register @code{.color} is@tie{}1 if colors are
13303
active, 0@tie{}otherwise.
13305
Internally, @code{color} sets a global flag; it does not produce a
13306
token. Similar to the @code{cp} request, you should use it at the
13307
beginning of your document to control color output.
13309
Colors can be also turned off with the @option{-c} command line option.
13312
@Defreq {defcolor, ident scheme color_components}
13313
Define color with name @var{ident}. @var{scheme} can be one of the
13314
following values: @code{rgb} (three components), @code{cmy} (three
13315
components), @code{cmyk} (four components), and @code{gray} or
13316
@code{grey} (one component).
13318
@cindex default color
13319
@cindex color, default
13320
Color components can be given either as a hexadecimal string or as
13321
positive decimal integers in the range 0--65535. A hexadecimal string
13322
contains all color components concatenated. It must start with either
13323
@code{#} or @code{##}; the former specifies hex values in the range
13324
0--255 (which are internally multiplied by@tie{}257), the latter in the
13325
range 0--65535. Examples: @code{#FFC0CB} (pink), @code{##ffff0000ffff}
13326
(magenta). The default color name @c{default} can't be redefined; its
13327
value is device-specific (usually black). It is possible that the
13328
default color for @code{\m} and @code{\M} is not identical.
13330
@cindex @code{f} unit, and colors
13331
@cindex unit, @code{f}, and colors
13332
A new scaling indicator@tie{}@code{f} has been introduced which
13333
multiplies its value by 65536; this makes it convenient to specify color
13334
components as fractions in the range 0 to@tie{}1 (1f equals 65536u).
13338
.defcolor darkgreen rgb 0.1f 0.5f 0.2f
13341
Note that @code{f} is the default scaling indicator for the
13342
@code{defcolor} request, thus the above statement is equivalent to
13345
.defcolor darkgreen rgb 0.1 0.5 0.2
13349
@DefreqList {gcolor, [@Var{color}]}
13350
@DefescItem {\\m, , c, }
13351
@DefescItem {\\m, @Lparen{}, co, }
13352
@DefescItem {\\m, @Lbrack{}, color, @Rbrack{}}
13353
@DefregListEnd {.m}
13354
Set (glyph) drawing color. The following examples show how to turn the
13355
next four words red.
13361
and these words are in black.
13365
\m[red]these are in red\m[] and these words are in black.
13368
The escape @code{\m[]} returns to the previous color, as does a call to
13369
@code{gcolor} without an argument.
13371
@cindex drawing color name register (@code{.m})
13372
@cindex name, drawing color, register (@code{.m})
13373
@cindex color name, drawing, register (@code{.m})
13374
The name of the current drawing color is available in the read-only,
13375
string-valued number register @samp{.m}.
13377
The drawing color is associated with the current environment
13378
(@pxref{Environments}).
13380
Note that @code{\m} doesn't produce an input token in @code{gtroff}. As
13381
a consequence, it can be used in requests like @code{mc} (which expects
13382
a single character as an argument) to change the color on the fly:
13389
@DefreqList {fcolor, [@Var{color}]}
13390
@DefescItem {\\M, , c, }
13391
@DefescItem {\\M, @Lparen{}, co, }
13392
@DefescItem {\\M, @Lbrack{}, color, @Rbrack{}}
13393
@DefregListEnd {.M}
13394
Set fill (background) color for filled objects drawn with the
13395
@code{\D'@dots{}'} commands.
13397
A red ellipse can be created with the following code:
13400
\M[red]\h'0.5i'\D'E 2i 1i'\M[]
13403
The escape @code{\M[]} returns to the previous fill color, as does a
13404
call to @code{fcolor} without an argument.
13406
@cindex background color name register (@code{.M})
13407
@cindex name, background color, register (@code{.M})
13408
@cindex color name, background, register (@code{.M})
13409
@cindex fill color name register (@code{.M})
13410
@cindex name, fill color, register (@code{.M})
13411
@cindex color name, fill, register (@code{.M})
13412
The name of the current fill (background) color is available in the
13413
read-only, string-valued number register @samp{.M}.
13415
The fill color is associated with the current environment
13416
(@pxref{Environments}).
13418
Note that @code{\M} doesn't produce an input token in @code{gtroff}.
13422
@c =====================================================================
13424
@node I/O, Postprocessor Access, Colors, gtroff Reference
13427
@cindex input and output requests
13428
@cindex requests for input and output
13429
@cindex output and input requests
13431
@code{gtroff} has several requests for including files:
13434
@cindex including a file (@code{so})
13435
@cindex file, inclusion (@code{so})
13436
Read in the specified @var{file} and includes it in place of the
13437
@code{so} request. This is quite useful for large documents, e.g.@:
13438
keeping each chapter in a separate file. @xref{gsoelim}, for more
13441
Since @code{gtroff} replaces the @code{so} request with the contents of
13442
@code{file}, it makes a difference whether the data is terminated with a
13443
newline or not: Assuming that file @file{xxx} contains the word
13444
@samp{foo} without a final newline, this
13453
yields @samp{This is foobar}.
13455
The search path for @var{file} can be controlled with the @option{-I}
13456
command line option.
13459
@Defreq {pso, command}
13460
Read the standard output from the specified @var{command} and includes
13461
it in place of the @code{pso} request.
13464
@cindex mode, safer
13465
@cindex unsafe mode
13466
@cindex mode, unsafe
13467
This request causes an error if used in safer mode (which is the
13468
default). Use @code{groff}'s or @code{troff}'s @option{-U} option to
13469
activate unsafe mode.
13471
The comment regarding a final newline for the @code{so} request is valid
13472
for @code{pso} also.
13475
@Defreq {mso, file}
13476
Identical to the @code{so} request except that @code{gtroff} searches
13477
for the specified @var{file} in the same directories as macro files for
13478
the the @option{-m} command line option. If the file name to be
13479
included has the form @file{@var{name}.tmac} and it isn't found,
13480
@code{mso} tries to include @file{tmac.@var{name}} and vice versa.
13481
If the file does not exist, a warning of type @samp{file} is emitted.
13482
@xref{Debugging}, for information about warnings.
13485
@DefreqList {trf, file}
13486
@DefreqListEnd {cf, file}
13487
@cindex transparent output (@code{cf}, @code{trf})
13488
@cindex output, transparent (@code{cf}, @code{trf})
13489
@cindex @code{cf} request, and copy-in mode
13490
@cindex copy-in mode, and @code{cf} request
13491
@cindex mode, copy-in, and @code{cf} request
13492
@cindex @code{trf} request, and copy-in mode
13493
@cindex copy-in mode, and @code{trf} request
13494
@cindex mode, copy-in, and @code{trf} request
13495
Transparently output the contents of @var{file}. Each line is output as
13496
if it were preceded by @code{\!}; however, the lines are @emph{not}
13497
subject to copy mode interpretation. If the file does not end with a
13498
newline, then a newline is added (@code{trf} only). For example, to
13499
define a macro@tie{}@code{x} containing the contents of
13500
file@tie{}@file{f}, use
13511
The calls to @code{ev} prevent that the current partial input line
13512
becomes part of the diversion.
13514
Both @code{trf} and @code{cf}, when used in a diversion, embeds an
13515
object in the diversion which, when reread, causes the contents of
13516
@var{file} to be transparently copied through to the output. In
13517
@acronym{UNIX} @code{troff}, the contents of @var{file} is immediately
13518
copied through to the output regardless of whether there is a current
13519
diversion; this behaviour is so anomalous that it must be considered a
13522
@cindex @code{trf} request, and invalid characters
13523
@cindex characters, invalid for @code{trf} request
13524
@cindex invalid characters for @code{trf} request
13526
While @code{cf} copies the contents of @var{file} completely
13527
unprocessed, @code{trf} disallows characters such as NUL that are not
13528
valid @code{gtroff} input characters (@pxref{Identifiers}).
13530
For @code{cf}, within a diversion, `completely unprocessed' means that
13531
each line of a file to be inserted is handled as if it were preceded by
13534
Both requests cause a line break.
13537
@Defreq {nx, [@Var{file}]}
13538
@cindex processing next file (@code{nx})
13539
@cindex file, processing next (@code{nx})
13540
@cindex next file, processing (@code{nx})
13541
Force @code{gtroff} to continue processing of the file specified as an
13542
argument. If no argument is given, immediately jump to the end of file.
13545
@Defreq {rd, [@Var{prompt} [@Var{arg1} @Var{arg2} @dots{}]]}
13546
@cindex reading from standard input (@code{rd})
13547
@cindex standard input, reading from (@code{rd})
13548
@cindex input, standard, reading from (@code{rd})
13549
Read from standard input, and include what is read as though it were
13550
part of the input file. Text is read until a blank line is encountered.
13552
If standard input is a TTY input device (keyboard), write @var{prompt}
13553
to standard error, followed by a colon (or send BEL for a beep if no
13554
argument is given).
13556
Arguments after @var{prompt} are available for the input. For example,
13563
with the input @w{@samp{This is \$2.}} prints
13570
@cindex form letters
13571
@cindex letters, form
13572
Using the @code{nx} and @code{rd} requests, it is easy to set up form
13573
letters. The form letter template is constructed like this, putting the
13574
following lines into a file called @file{repeat.let}:
13590
@cindex @code{ex} request, used with @code{nx} and @code{rd}
13592
When this is run, a file containing the following lines should be
13593
redirected in. Note that requests included in this file are executed as
13594
though they were part of the form letter. The last block of input is
13595
the @code{ex} request which tells @code{groff} to stop processing. If
13596
this was not there, @code{groff} would not know when to stop.
13600
708 NW 19th Av., #202
13607
San Diego, CA 92103
13615
Pipe the output of @code{gtroff} to the shell command(s) specified by
13616
@var{pipe}. This request must occur before @code{gtroff} has a chance
13620
@cindex mode, safer
13621
@cindex unsafe mode
13622
@cindex mode, unsafe
13623
@code{pi} causes an error if used in safer mode (which is the default).
13624
Use @code{groff}'s or @code{troff}'s @option{-U} option to activate
13627
Multiple calls to @code{pi} are allowed, acting as a chain. For
13636
is the same as @w{@samp{.pi foo | bar}}.
13638
@cindex @code{groff}, and @code{pi} request
13639
@cindex @code{pi} request, and @code{groff}
13640
Note that the intermediate output format of @code{gtroff} is piped to
13641
the specified commands. Consequently, calling @code{groff} without the
13642
@option{-Z} option normally causes a fatal error.
13645
@DefreqList {sy, cmds}
13646
@DefregListEnd {systat}
13647
Execute the shell command(s) specified by @var{cmds}. The output is not
13648
saved anyplace, so it is up to the user to do so.
13651
@cindex mode, safer
13652
@cindex unsafe mode
13653
@cindex mode, unsafe
13654
This request causes an error if used in safer mode (which is the
13655
default). Use @code{groff}'s or @code{troff}'s @option{-U} option to
13656
activate unsafe mode.
13658
For example, the following code fragment introduces the current time
13661
@cindex time, current
13662
@cindex current time
13665
.sy perl -e 'printf ".nr H %d\\n.nr M %d\\n.nr S %d\\n",\
13666
(localtime(time))[2,1,0]' > /tmp/x\n[$$]
13668
.sy rm /tmp/x\n[$$]
13673
Note that this works by having the @code{perl} script (run by @code{sy})
13674
print out the @code{nr} requests which set the number registers
13675
@code{H}, @code{M}, and @code{S}, and then reads those commands in with
13676
the @code{so} request.
13678
For most practical purposes, the number registers @code{seconds},
13679
@code{minutes}, and @code{hours} which are initialized at start-up of
13680
@code{gtroff} should be sufficient. Use the @code{af} request to get a
13687
\n[hours]:\n[minutes]:\n[seconds]
13690
@cindex @code{system()} return value register (@code{systat})
13691
The @code{systat} read-write number register contains the return value
13692
of the @code{system()} function executed by the last @code{sy} request.
13695
@DefreqList {open, stream file}
13696
@DefreqListEnd {opena, stream file}
13697
@cindex opening file (@code{open})
13698
@cindex file, opening (@code{open})
13699
@cindex appending to a file (@code{opena})
13700
@cindex file, appending to (@code{opena})
13701
Open the specified @var{file} for writing and associates the specified
13702
@var{stream} with it.
13704
The @code{opena} request is like @code{open}, but if the file exists,
13705
append to it instead of truncating it.
13708
@cindex mode, safer
13709
@cindex unsafe mode
13710
@cindex mode, unsafe
13711
Both @code{open} and @code{opena} cause an error if used in safer mode
13712
(which is the default). Use @code{groff}'s or @code{troff}'s
13713
@option{-U} option to activate unsafe mode.
13716
@DefreqList {write, stream data}
13717
@DefreqListEnd {writec, stream data}
13718
@cindex copy-in mode, and @code{write} request
13719
@cindex @code{write} request, and copy-in mode
13720
@cindex mode, copy-in, and @code{write} request
13721
@cindex copy-in mode, and @code{writec} request
13722
@cindex @code{writec} request, and copy-in mode
13723
@cindex mode, copy-in, and @code{writec} request
13724
@cindex writing to file (@code{write}, @code{writec})
13725
@cindex file, writing to (@code{write}, @code{writec})
13726
Write to the file associated with the specified @var{stream}. The
13727
stream must previously have been the subject of an open request. The
13728
remainder of the line is interpreted as the @code{ds} request reads its
13729
second argument: A leading @samp{"} is stripped, and it is read in
13732
The @code{writec} request is like @code{write}, but only @code{write}
13733
appends a newline to the data.
13736
@Defreq {writem, stream xx}
13737
@cindex @code{asciify} request, and @code{writem}
13738
Write the contents of the macro or string @var{xx} to the file
13739
associated with the specified @var{stream}.
13741
@cindex @code{writem} request, and copy-in mode
13742
@cindex copy-in mode, and @code{writem} request
13743
@cindex mode, copy-in, and @code{writem} request
13744
@var{xx} is read in copy mode, i.e., already formatted elements are
13745
ignored. Consequently, diversions must be unformatted with the
13746
@code{asciify} request before calling @code{writem}. Usually, this
13747
means a loss of information.
13750
@Defreq {close, stream}
13751
@cindex closing file (@code{close})
13752
@cindex file, closing (@code{close})
13753
Close the specified @var{stream}; the stream is no longer an acceptable
13754
argument to the @code{write} request.
13756
Here a simple macro to write an index entry.
13762
. write idx \\n[%] \\$*
13771
@DefescList {\\V, , e, }
13772
@DefescItem {\\V, @Lparen{}, ev, }
13773
@DefescListEnd {\\V, @Lbrack{}, env, @Rbrack{}}
13774
@cindex @code{\V}, and copy-in mode
13775
@cindex copy-in mode, and @code{\V}
13776
@cindex mode, copy-in, and @code{\V}
13777
Interpolate the contents of the specified environment variable @var{env}
13778
(one-character name@tie{}@var{e}, two-character name @var{ev}) as
13779
returned by the function @code{getenv}. @code{\V} is interpreted in
13784
@c =====================================================================
13786
@node Postprocessor Access, Miscellaneous, I/O, gtroff Reference
13787
@section Postprocessor Access
13788
@cindex postprocessor access
13789
@cindex access of postprocessor
13791
There are two escapes which give information directly to the
13792
postprocessor. This is particularly useful for embedding
13793
@sc{PostScript} into the final document.
13795
@DefreqList {device, xxx}
13796
@DefescListEnd {\\X, ', xxx, '}
13797
Embeds its argument into the @code{gtroff} output preceded with
13800
@cindex @code{\&}, in @code{\X}
13801
@cindex @code{\)}, in @code{\X}
13802
@cindex @code{\%}, in @code{\X}
13804
@cindex @code{\:}, in @code{\X}
13807
@cindex @code{\@r{<colon>}}, in @code{\X}
13809
The escapes @code{\&}, @code{\)}, @code{\%}, and @code{\:} are ignored
13810
within @code{\X}, @w{@samp{\ }} and @code{\~} are converted to single
13811
space characters. All other escapes (except @code{\\} which produces a
13812
backslash) cause an error.
13814
@cindex @code{device} request, and copy-in mode
13815
@cindex copy-in mode, and @code{device} request
13816
@cindex mode, copy-in, and @code{device} request
13817
Contrary to @code{\X}, the @code{device} request simply processes its
13818
argument in copy mode (@pxref{Copy-in Mode}).
13820
@kindex use_charnames_in_special
13821
@pindex DESC@r{, and @code{use_charnames_in_special}}
13822
@cindex @code{\X}, and special characters
13823
If the @samp{use_charnames_in_special} keyword is set in the @file{DESC}
13824
file, special characters no longer cause an error; they are simply
13825
output verbatim. Additionally, the backslash is represented as
13828
@samp{use_charnames_in_special} is currently used by @code{grohtml}
13832
@DefreqList {devicem, xx}
13833
@DefescItem {\\Y, , n, }
13834
@DefescItem {\\Y, @Lparen{}, nm, }
13835
@DefescListEnd {\\Y, @Lbrack{}, name, @Rbrack{}}
13836
This is approximately equivalent to @samp{\X'\*[@var{name}]'}
13837
(one-character name@tie{}@var{n}, two-character name @var{nm}).
13838
However, the contents of the string or macro @var{name} are not
13839
interpreted; also it is permitted for @var{name} to have been defined as
13840
a macro and thus contain newlines (it is not permitted for the argument
13841
to @code{\X} to contain newlines). The inclusion of newlines requires
13842
an extension to the @acronym{UNIX} @code{troff} output format, and
13843
confuses drivers that do not know about this extension (@pxref{Device
13844
Control Commands}).
13847
@xref{Output Devices}.
13850
@c =====================================================================
13852
@node Miscellaneous, Gtroff Internals, Postprocessor Access, gtroff Reference
13853
@section Miscellaneous
13855
This section documents parts of @code{gtroff} which cannot (yet) be
13856
categorized elsewhere in this manual.
13858
@Defreq {nm, [@Var{start} [@Var{inc} [@Var{space} [@Var{indent}]]]]}
13859
@cindex printing line numbers (@code{nm})
13860
@cindex line numbers, printing (@code{nm})
13861
@cindex numbers, line, printing (@code{nm})
13862
Print line numbers. @var{start} is the line number of the @emph{next}
13863
output line. @var{inc} indicates which line numbers are printed. For
13864
example, the value@tie{}5 means to emit only line numbers which are
13865
multiples of@tie{}5; this defaults to@tie{}1. @var{space} is the space
13866
to be left between the number and the text; this defaults to one digit
13867
space. The fourth argument is the indentation of the line numbers,
13868
defaulting to zero. Both @var{space} and @var{indent} are given as
13869
multiples of digit spaces; they can be negative also. Without any
13870
arguments, line numbers are turned off.
13872
@code{gtroff} reserves three digit spaces for the line number (which is
13873
printed right-justified) plus the amount given by @var{indent}; the
13874
output lines are concatenated to the line numbers, separated by
13875
@var{space}, and @emph{without} reducing the line length. Depending on
13876
the value of the horizontal page offset (as set with the @code{po}
13877
request), line numbers which are longer than the reserved space stick
13878
out to the left, or the whole line is moved to the right.
13880
Parameters corresponding to missing arguments are not changed; any
13881
non-digit argument (to be more precise, any argument starting with a
13882
character valid as a delimiter for identifiers) is also treated as
13885
If line numbering has been disabled with a call to @code{nm} without an
13886
argument, it can be reactivated with @samp{.nm +0}, using the previously
13887
active line numbering parameters.
13889
The parameters of @code{nm} are associated with the current environment
13890
(@pxref{Environments}). The current output line number is available in
13891
the number register @code{ln}.
13896
This test shows how line numbering works with groff.
13898
This test shows how line numbering works with groff.
13902
This test shows how line numbering works with groff.
13904
This test shows how line numbering works with groff.
13908
And here the result:
13911
This test shows how
13912
line numbering works
13913
999 with groff. This
13914
1000 test shows how line
13915
1001 numbering works with
13917
This test shows how
13920
This test shows how
13921
1005 line numbering
13926
@Defreq {nn, [@Var{skip}]}
13927
Temporarily turn off line numbering. The argument is the number of
13928
lines not to be numbered; this defaults to@tie{}1.
13931
@Defreq {mc, glyph [@Var{dist}]}
13932
@cindex margin glyph (@code{mc})
13933
@cindex glyph, for margins (@code{mc})
13934
Print a @dfn{margin character} to the right of the
13935
text.@footnote{@dfn{Margin character} is a misnomer since it is an
13936
output glyph.} The first argument is the glyph to be printed. The
13937
second argument is the distance away from the right margin. If missing,
13938
the previously set value is used; default is 10@dmn{pt}). For text
13939
lines that are too long (that is, longer than the text length plus
13940
@var{dist}), the margin character is directly appended to the lines.
13942
With no arguments the margin character is turned off. If this occurs
13943
before a break, no margin character is printed.
13945
For compatibility with @acronym{AT&T} @code{troff}, a call to @code{mc}
13946
to set the margin character can't be undone immediately; at least one
13947
line gets a margin character. Thus
13966
@cindex @code{tl} request, and @code{mc}
13967
For empty lines and lines produced by the @code{tl} request no margin
13968
character is emitted.
13970
The margin character is associated with the current environment
13971
(@pxref{Environments}).
13975
This is quite useful for indicating text that has changed, and, in fact,
13976
there are programs available for doing this (they are called
13977
@code{nrchbar} and @code{changebar} and can be found in any
13978
@samp{comp.sources.unix} archive).
13983
This paragraph is highlighted with a margin
13986
Note that vertical space isn't marked.
13990
But we can fake it with `\&'.
13996
This paragraph is highlighted |
13997
with a margin character. |
13999
Note that vertical space isn't |
14002
But we can fake it with `\&'. |
14006
@DefreqList {psbb, filename}
14010
@DefregListEnd {ury}
14011
@cindex PostScript, bounding box
14012
@cindex bounding box
14013
Retrieve the bounding box of the @sc{PostScript} image found in
14014
@var{filename}. The file must conform to Adobe's @dfn{Document
14015
Structuring Conventions} (DSC); the command searches for a
14016
@code{%%BoundingBox} comment and extracts the bounding box values into
14017
the number registers @code{llx}, @code{lly}, @code{urx}, and @code{ury}.
14018
If an error occurs (for example, @code{psbb} cannot find the
14019
@code{%%BoundingBox} comment), it sets the four number registers to
14022
The search path for @var{filename} can be controlled with the
14023
@option{-I} command line option.
14027
@c =====================================================================
14029
@node Gtroff Internals, Debugging, Miscellaneous, gtroff Reference
14030
@section @code{gtroff} Internals
14032
@cindex input token
14033
@cindex token, input
14034
@cindex output node
14035
@cindex node, output
14036
@code{gtroff} processes input in three steps. One or more input
14037
characters are converted to an @dfn{input token}.@footnote{Except the
14038
escapes @code{\f}, @code{\F}, @code{\H}, @code{\m}, @code{\M},
14039
@code{\R}, @code{\s}, and @code{\S} which are processed immediately if
14040
not in copy-in mode.} Then, one or more input tokens are converted to
14041
an @dfn{output node}. Finally, output nodes are converted to the
14042
intermediate output language understood by all output devices.
14044
Actually, before step one happens, @code{gtroff} converts certain escape
14045
sequences into reserved input characters (not accessible by the user);
14046
such reserved characters are used for other internal processing also --
14047
this is the very reason why not all characters are valid input.
14048
@xref{Identifiers}, for more on this topic.
14050
For example, the input string @samp{fi\[:u]} is converted into a
14051
character token @samp{f}, a character token @samp{i}, and a special
14052
token @samp{:u} (representing u@tie{}umlaut). Later on, the character
14053
tokens @samp{f} and @samp{i} are merged to a single output node
14054
representing the ligature glyph @samp{fi} (provided the current font has
14055
a glyph for this ligature); the same happens with @samp{:u}. All output
14056
glyph nodes are `processed' which means that they are invariably
14057
associated with a given font, font size, advance width, etc. During the
14058
formatting process, @code{gtroff} itself adds various nodes to control
14061
Macros, diversions, and strings collect elements in two chained lists: a
14062
list of input tokens which have been passed unprocessed, and a list of
14063
output nodes. Consider the following the diversion.
14075
It contains these elements.
14077
@multitable {@i{vertical size node}} {token list} {element number}
14078
@item node list @tab token list @tab element number
14080
@item @i{line start node} @tab --- @tab 1
14081
@item @i{glyph node @code{a}} @tab --- @tab 2
14082
@item @i{word space node} @tab --- @tab 3
14083
@item --- @tab @code{b} @tab 4
14084
@item --- @tab @code{\n} @tab 5
14085
@item @i{glyph node @code{c}} @tab --- @tab 6
14086
@item @i{vertical size node} @tab --- @tab 7
14087
@item @i{vertical size node} @tab --- @tab 8
14088
@item --- @tab @code{\n} @tab 9
14091
@cindex @code{\v}, internal representation
14093
Elements 1, 7, and@tie{}8 are inserted by @code{gtroff}; the latter two
14094
(which are always present) specify the vertical extent of the last line,
14095
possibly modified by @code{\x}. The @code{br} request finishes the
14096
current partial line, inserting a newline input token which is
14097
subsequently converted to a space when the diversion is reread. Note
14098
that the word space node has a fixed width which isn't stretchable
14099
anymore. To convert horizontal space nodes back to input tokens, use
14100
the @code{unformat} request.
14102
Macros only contain elements in the token list (and the node list is
14103
empty); diversions and strings can contain elements in both lists.
14105
Note that the @code{chop} request simply reduces the number of elements
14106
in a macro, string, or diversion by one. Exceptions are
14107
@dfn{compatibility save} and @dfn{compatibility ignore} input tokens
14108
which are ignored. The @code{substring} request also ignores those
14111
Some requests like @code{tr} or @code{cflags} work on glyph identifiers
14112
only; this means that the associated glyph can be changed without
14113
destroying this association. This can be very helpful for substituting
14114
glyphs. In the following example, we assume that glyph @samp{foo} isn't
14115
available by default, so we provide a substitution using the
14116
@code{fchar} request and map it to input character @samp{x}.
14124
Now let us assume that we install an additional special font @samp{bar}
14125
which has glyph @samp{foo}.
14133
Since glyphs defined with @code{fchar} are searched before glyphs in
14134
special fonts, we must call @code{rchar} to remove the definition of the
14135
fallback glyph. Anyway, the translation is still active; @samp{x} now
14136
maps to the real glyph @samp{foo}.
14138
@cindex compatibility mode, and parameters
14139
@cindex mode, compatibility, and parameters
14140
@cindex arguments, and compatibility mode
14141
@cindex parameters, and compatibility mode
14142
@cindex macro arguments, and compatibility mode
14143
@cindex request arguments, and compatibility mode
14144
Macro and request arguments preserve the compatibility mode:
14147
.cp 1 \" switch to compatibility mode
14151
.cp 0 \" switch compatibility mode off
14157
Since compatibility mode is on while @code{de} is called, the macro
14158
@code{xx} activates compatibility mode while executing. Argument
14159
@code{$1} can still be handled properly because it inherits the
14160
compatibility mode status which was active at the point where @code{xx}
14163
After expansion of the parameters, the compatibility save and restore
14164
tokens are removed.
14167
@c =====================================================================
14169
@node Debugging, Implementation Differences, Gtroff Internals, gtroff Reference
14173
@code{gtroff} is not easy to debug, but there are some useful features
14174
and strategies for debugging.
14176
@Defreq {lf, line [@Var{filename}]}
14178
@cindex multi-file documents
14179
@cindex documents, multi-file
14180
@cindex setting input line number (@code{lf})
14181
@cindex input line number, setting (@code{lf})
14182
@cindex number, input line, setting (@code{lf})
14183
Change the line number and optionally the file name @code{gtroff} shall
14184
use for error and warning messages. @var{line} is the input line number
14185
of the @emph{next} line.
14187
Without argument, the request is ignored.
14189
This is a debugging aid for documents which are split into many files,
14190
then put together with @code{soelim} and other preprocessors. Usually,
14191
it isn't invoked manually.
14193
Note that other @code{troff} implementations (including the original
14194
@acronym{AT&T} version) handle @code{lf} differently. For them,
14195
@var{line} changes the line number of the @emph{current} line.
14198
@DefreqList {tm, string}
14199
@DefreqItem {tm1, string}
14200
@DefreqListEnd {tmc, string}
14201
@cindex printing to stderr (@code{tm}, @code{tm1}, @code{tmc})
14202
@cindex stderr, printing to (@code{tm}, @code{tm1}, @code{tmc})
14203
Send @var{string} to the standard error output; this is very useful for
14204
printing debugging messages among other things.
14206
@cindex @code{tm} request, and copy-in mode
14207
@cindex copy-in mode, and @code{tm} request
14208
@cindex mode, copy-in, and @code{tm} request
14209
@cindex @code{tm1} request, and copy-in mode
14210
@cindex copy-in mode, and @code{tm1} request
14211
@cindex mode, copy-in, and @code{tm1} request
14212
@cindex @code{tmc} request, and copy-in mode
14213
@cindex copy-in mode, and @code{tmc} request
14214
@cindex mode, copy-in, and @code{tmc} request
14215
@var{string} is read in copy mode.
14217
The @code{tm} request ignores leading spaces of @var{string}; @code{tm1}
14218
handles its argument similar to the @code{ds} request: a leading double
14219
quote in @var{string} is stripped to allow initial blanks.
14221
The @code{tmc} request is similar to @code{tm1} but does not append a
14222
newline (as is done in @code{tm} and @code{tm1}).
14225
@Defreq {ab, [@Var{string}]}
14226
@cindex aborting (@code{ab})
14227
Similar to the @code{tm} request, except that it causes @code{gtroff} to
14228
stop processing. With no argument it prints @samp{User Abort.} to
14233
@cindex @code{ex} request, use in debugging
14234
@cindex exiting (@code{ex})
14235
The @code{ex} request also causes @code{gtroff} to stop processing; see
14239
When doing something involved it is useful to leave the debugging
14240
statements in the code and have them turned on by a command line flag.
14243
.if \n(DB .tm debugging output
14247
To activate these statements say
14253
If it is known in advance that there are many errors and no useful
14254
output, @code{gtroff} can be forced to suppress formatted output with
14255
the @option{-z} flag.
14258
@cindex dumping environments (@code{pev})
14259
@cindex environments, dumping (@code{pev})
14260
Print the contents of the current environment and all the currently
14261
defined environments (both named and numbered) on @code{stderr}.
14265
@cindex dumping symbol table (@code{pm})
14266
@cindex symbol table, dumping (@code{pm})
14267
Print the entire symbol table on @code{stderr}. Names of all defined
14268
macros, strings, and diversions are print together with their size in
14269
bytes. Since @code{gtroff} sometimes adds nodes by itself, the returned
14270
size can be larger than expected.
14272
This request differs from @acronym{UNIX} @code{troff}: @code{gtroff}
14273
reports the sizes of diversions, ignores an additional argument to print
14274
only the total of the sizes, and the size isn't returned in blocks of
14279
@cindex dumping number registers (@code{pnr})
14280
@cindex number registers, dumping (@code{pnr})
14281
Print the names and contents of all currently defined number registers
14286
@cindex dumping traps (@code{ptr})
14287
@cindex traps, dumping (@code{ptr})
14288
Print the names and positions of all traps (not including input line
14289
traps and diversion traps) on @code{stderr}. Empty slots in the page
14290
trap list are printed as well, because they can affect the priority of
14291
subsequently planted traps.
14295
@cindex flush output (@code{fl})
14296
@cindex output, flush (@code{fl})
14297
@cindex interactive use of @code{gtroff}
14298
@cindex @code{gtroff}, interactive use
14299
Instruct @code{gtroff} to flush its output immediately. The intent is
14300
for interactive use, but this behaviour is currently not implemented in
14301
@code{gtroff}. Contrary to @acronym{UNIX} @code{troff}, TTY output is
14302
sent to a device driver also (@code{grotty}), making it non-trivial to
14303
communicate interactively.
14305
This request causes a line break.
14308
@Defreq {backtrace, }
14309
@cindex backtrace of input stack (@code{backtrace})
14310
@cindex input stack, backtrace (@code{backtrace})
14311
Print a backtrace of the input stack to the standard error stream.
14313
Consider the following in file @file{test}:
14327
On execution, @code{gtroff} prints the following:
14330
test:2: backtrace: macro `xxx'
14331
test:5: backtrace: macro `yyy'
14332
test:8: backtrace: file `test'
14335
The option @option{-b} of @code{gtroff} internally calls a variant of
14336
this request on each error and warning.
14340
@cindex input stack, setting limit
14341
Use the @code{slimit} number register to set the maximum number of
14342
objects on the input stack. If @code{slimit} is less than or equal
14343
to@tie{}0, there is no limit set. With no limit, a buggy recursive
14344
macro can exhaust virtual memory.
14346
The default value is 1000; this is a compile-time constant.
14349
@Defreq {warnscale, si}
14350
Set the scaling indicator used in warnings to @var{si}. Valid values
14351
for @var{si} are @samp{u}, @samp{i}, @samp{c}, @samp{p}, and @samp{P}.
14352
At startup, it is set to @samp{i}.
14355
@Defreq {spreadwarn, [@Var{limit}]}
14356
Make @code{gtroff} emit a warning if the additional space inserted for
14357
each space between words in an output line is larger or equal to
14358
@var{limit}. A negative value is changed to zero; no argument toggles
14359
the warning on and off without changing @var{limit}. The default
14360
scaling indicator is @samp{m}. At startup, @code{spreadwarn} is
14361
deactivated, and @var{limit} is set to 3@dmn{m}.
14370
causes a warning if @code{gtroff} must add 0.2@dmn{m} or more for each
14371
interword space in a line.
14373
This request is active only if text is justified to both margins (using
14378
@code{gtroff} has command line options for printing out more warnings
14379
(@option{-w}) and for printing backtraces (@option{-b}) when a warning
14380
or an error occurs. The most verbose level of warnings is @option{-ww}.
14382
@DefreqList {warn, [@Var{flags}]}
14383
@DefregListEnd {.warn}
14384
@cindex level of warnings (@code{warn})
14385
@cindex warnings, level (@code{warn})
14386
Control the level of warnings checked for. The @var{flags} are the sum
14387
of the numbers associated with each warning that is to be enabled; all
14388
other warnings are disabled. The number associated with each warning is
14389
listed below. For example, @w{@code{.warn 0}} disables all warnings,
14390
and @w{@code{.warn 1}} disables all warnings except that about missing
14391
glyphs. If no argument is given, all warnings are enabled.
14393
The read-only number register @code{.warn} contains the current warning
14401
@c ---------------------------------------------------------------------
14403
@node Warnings, , Debugging, Debugging
14404
@subsection Warnings
14407
The warnings that can be given to @code{gtroff} are divided into the
14408
following categories. The name associated with each warning is used by
14409
the @option{-w} and @option{-W} options; the number is used by the
14410
@code{warn} request and by the @code{.warn} register.
14415
Non-existent glyphs.@footnote{@code{char} is a misnomer since it reports
14416
missing glyphs -- there aren't missing input characters, only invalid
14417
ones.} This is enabled by default.
14421
Invalid numeric expressions. This is enabled by default.
14422
@xref{Expressions}.
14428
In fill mode, lines which could not be broken so that their length was
14429
less than the line length. This is enabled by default.
14433
Missing or mismatched closing delimiters.
14437
@cindex @code{ie} request, and warnings
14438
@cindex @code{el} request, and warnings
14439
Use of the @code{el} request with no matching @code{ie} request.
14444
Meaningless scaling indicators.
14448
Out of range arguments.
14452
Dubious syntax in numeric expressions.
14456
@cindex @code{di} request, and warnings
14457
@cindex @code{da} request, and warnings
14458
Use of @code{di} or @code{da} without an argument when there is no
14463
@cindex @code{de}, @code{de1}, @code{dei} requests, and warnings
14464
@cindex @code{am}, @code{am1}, @code{ami} requests, and warnings
14465
@cindex @code{ds}, @code{ds1} requests, and warnings
14466
@cindex @code{as}, @code{as1} requests, and warnings
14467
@cindex @code{di} request, and warnings
14468
@cindex @code{da} request, and warnings
14469
@cindex @code{box}, @code{boxa} requests, and warnings
14470
@cindex @code{\*}, and warnings
14471
Use of undefined strings, macros and diversions. When an undefined
14472
string, macro, or diversion is used, that string is automatically
14473
defined as empty. So, in most cases, at most one warning is given for
14478
@cindex @code{nr} request, and warnings
14479
@cindex @code{\R}, and warnings
14480
@cindex @code{\n}, and warnings
14481
Use of undefined number registers. When an undefined number register is
14482
used, that register is automatically defined to have a value of@tie{}0.
14483
So, in most cases, at most one warning is given for use of a particular
14488
@cindex @code{\t}, and warnings
14489
Use of a tab character where a number was expected.
14493
@cindex @code{\@}}, and warnings
14494
Use of @code{\@}} where a number was expected.
14498
Requests that are missing non-optional arguments.
14502
Invalid input characters.
14506
Unrecognized escape sequences. When an unrecognized escape sequence
14507
@code{\@var{X}} is encountered, the escape character is ignored, and
14508
@var{X} is printed.
14512
@cindex compatibility mode
14513
Missing space between a request or macro and its argument. This warning
14514
is given when an undefined name longer than two characters is
14515
encountered, and the first two characters of the name make a defined
14516
name. The request or macro is not invoked. When this warning is given,
14517
no macro is automatically defined. This is enabled by default. This
14518
warning never occurs in compatibility mode.
14522
Non-existent fonts. This is enabled by default.
14526
Invalid escapes in text ignored with the @code{ig} request. These are
14527
conditions that are errors when they do not occur in ignored text.
14531
Color related warnings.
14535
Missing files. The @code{mso} request gives this warning when the
14536
requested macro file does not exist. This is enabled by default.
14539
All warnings except @samp{di}, @samp{mac} and @samp{reg}. It is
14540
intended that this covers all warnings that are useful with traditional
14548
@c =====================================================================
14550
@node Implementation Differences, , Debugging, gtroff Reference
14551
@section Implementation Differences
14552
@cindex implementation differences
14553
@cindex differences in implementation
14554
@cindex incompatibilities with @acronym{AT&T} @code{troff}
14555
@cindex compatibility mode
14556
@cindex mode, compatibility
14558
GNU @code{troff} has a number of features which cause incompatibilities
14559
with documents written with old versions of @code{troff}.
14562
@cindex names, long
14563
Long names cause some incompatibilities. @acronym{UNIX} @code{troff}
14570
@cindex @code{\*}, incompatibilities with @acronym{AT&T} @code{troff}
14571
@cindex @code{\n}, incompatibilities with @acronym{AT&T} @code{troff}
14573
as defining a string @samp{ab} with contents @samp{cd}. Normally, GNU
14574
@code{troff} interprets this as a call of a macro named @code{dsabcd}.
14575
Also @acronym{UNIX} @code{troff} interprets @code{\*[} or @code{\n[} as
14576
references to a string or number register called @samp{[}. In GNU
14577
@code{troff}, however, this is normally interpreted as the start of a
14578
long name. In compatibility mode GNU @code{troff} interprets long names
14579
in the traditional way (which means that they are not recognized as
14582
@DefreqList {cp, [@Var{n}]}
14583
@DefreqItem {do, cmd}
14584
@DefregListEnd {.C}
14585
If @var{n} is missing or non-zero, turn on compatibility mode;
14586
otherwise, turn it off.
14588
The read-only number register @code{.C} is@tie{}1 if compatibility mode
14589
is on, 0@tie{}otherwise.
14591
Compatibility mode can be also turned on with the @option{-C} command
14594
The @code{do} request turns off compatibility mode while executing its
14595
arguments as a @code{gtroff} command. However, it does not turn off
14596
compatibility mode while processing the macro itself. To do that, use
14597
the @code{de1} request (or manipulate the @code{.C} register manually).
14598
@xref{Writing Macros}.
14605
executes the @code{fam} request when compatibility mode is enabled.
14607
@code{gtroff} restores the previous compatibility setting before
14608
interpreting any files sourced by the @var{cmd}.
14611
@cindex input level in delimited arguments
14612
@cindex delimited arguments, incompatibilities with @acronym{AT&T} @code{troff}
14613
Two other features are controlled by @option{-C}. If not in
14614
compatibility mode, GNU @code{troff} preserves the input level in
14615
delimited arguments:
14623
In compatibility mode, the string @samp{72def'} is returned; without
14624
@option{-C} the resulting string is @samp{168} (assuming a TTY output
14627
@cindex @code{\f}, incompatibilities with @acronym{AT&T} @code{troff}
14628
@cindex @code{\H}, incompatibilities with @acronym{AT&T} @code{troff}
14629
@cindex @code{\s}, incompatibilities with @acronym{AT&T} @code{troff}
14630
@cindex @code{\S}, incompatibilities with @acronym{AT&T} @code{troff}
14631
Finally, the escapes @code{\f}, @code{\H}, @code{\m}, @code{\M},
14632
@code{\R}, @code{\s}, and @code{\S} are transparent for recognizing the
14633
beginning of a line only in compatibility mode (this is a rather obscure
14634
feature). For example, the code
14644
prints @samp{Hallo!} in bold face if in compatibility mode, and
14645
@samp{.xx} in bold face otherwise.
14647
@cindex @code{\A}, incompatibilities with @acronym{AT&T} @code{troff}
14648
@cindex @code{\|}, incompatibilities with @acronym{AT&T} @code{troff}
14649
@cindex @code{\^}, incompatibilities with @acronym{AT&T} @code{troff}
14650
@cindex @code{\&}, incompatibilities with @acronym{AT&T} @code{troff}
14651
@cindex @code{\@{}, incompatibilities with @acronym{AT&T} @code{troff}
14652
@cindex @code{\@}}, incompatibilities with @acronym{AT&T} @code{troff}
14653
@cindex @code{\@key{SP}}, incompatibilities with @acronym{AT&T} @code{troff}
14654
@cindex @code{\'}, incompatibilities with @acronym{AT&T} @code{troff}
14655
@cindex @code{\`}, incompatibilities with @acronym{AT&T} @code{troff}
14656
@cindex @code{\-}, incompatibilities with @acronym{AT&T} @code{troff}
14657
@cindex @code{\_}, incompatibilities with @acronym{AT&T} @code{troff}
14658
@cindex @code{\!}, incompatibilities with @acronym{AT&T} @code{troff}
14659
@cindex @code{\%}, incompatibilities with @acronym{AT&T} @code{troff}
14660
@cindex @code{\c}, incompatibilities with @acronym{AT&T} @code{troff}
14661
GNU @code{troff} does not allow the use of the escape sequences
14662
@code{\|}, @code{\^}, @code{\&}, @code{\@{}, @code{\@}},
14663
@code{\@key{SP}}, @code{\'}, @code{\`}, @code{\-}, @code{\_}, @code{\!},
14664
@code{\%}, and @code{\c} in names of strings, macros, diversions, number
14665
registers, fonts or environments; @acronym{UNIX} @code{troff} does. The
14666
@code{\A} escape sequence (@pxref{Identifiers}) may be helpful in
14667
avoiding use of these escape sequences in names.
14669
@cindex fractional point sizes
14670
@cindex fractional type sizes
14671
@cindex point sizes, fractional
14672
@cindex type sizes, fractional
14673
@cindex sizes, fractional
14674
@cindex @code{ps} request, incompatibilities with @acronym{AT&T} @code{troff}
14675
Fractional point sizes cause one noteworthy incompatibility. In
14676
@acronym{UNIX} @code{troff} the @code{ps} request ignores scale
14677
indicators and thus
14684
sets the point size to 10@tie{}points, whereas in GNU @code{troff} it
14685
sets the point size to 10@tie{}scaled points. @xref{Fractional Type
14686
Sizes}, for more information.
14688
@cindex @code{bd} request, incompatibilities with @acronym{AT&T} @code{troff}
14689
@cindex @code{cs} request, incompatibilities with @acronym{AT&T} @code{troff}
14690
@cindex @code{tr} request, incompatibilities with @acronym{AT&T} @code{troff}
14691
@cindex @code{fp} request, incompatibilities with @acronym{AT&T} @code{troff}
14692
@cindex input characters and output glyphs, compatibility with @acronym{AT&T} @code{troff}
14693
@cindex output glyphs, and input characters,compatibility with @acronym{AT&T} @code{troff}
14694
@cindex characters, input, and output glyphs, compatibility with @acronym{AT&T} @code{troff}
14695
@cindex glyphs, output, and input characters, compatibility with @acronym{AT&T} @code{troff}
14696
In GNU @code{troff} there is a fundamental difference between
14697
(unformatted) input characters and (formatted) output glyphs.
14698
Everything that affects how a glyph is output is stored with the glyph
14699
node; once a glyph node has been constructed it is unaffected by any
14700
subsequent requests that are executed, including @code{bd}, @code{cs},
14701
@code{tkf}, @code{tr}, or @code{fp} requests. Normally glyphs are
14702
constructed from input characters at the moment immediately before the
14703
glyph is added to the current output line. Macros, diversions and
14704
strings are all, in fact, the same type of object; they contain lists of
14705
input characters and glyph nodes in any combination. A glyph node does
14706
not behave like an input character for the purposes of macro processing;
14707
it does not inherit any of the special properties that the input
14708
character from which it was constructed might have had. For example,
14718
@cindex printing backslash (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
14719
@cindex backslash, printing (@code{\\}, @code{\e}, @code{\E}, @code{\[rs]})
14720
@cindex @code{\e}, incompatibilities with @acronym{AT&T} @code{troff}
14721
@cindex @code{\!}, incompatibilities with @acronym{AT&T} @code{troff}
14722
@cindex @code{\?}, incompatibilities with @acronym{AT&T} @code{troff}
14723
@cindex transparent output, incompatibilities with @acronym{AT&T} @code{troff}
14724
@cindex output, transparent, incompatibilities with @acronym{AT&T} @code{troff}
14726
prints @samp{\\} in GNU @code{troff}; each pair of input backslashes is
14727
turned into one output backslash and the resulting output backslashes
14728
are not interpreted as escape characters when they are reread.
14729
@acronym{UNIX} @code{troff} would interpret them as escape characters
14730
when they were reread and would end up printing one @samp{\}. The
14731
correct way to obtain a printable backslash is to use the @code{\e}
14732
escape sequence: This always prints a single instance of the current
14733
escape character, regardless of whether or not it is used in a
14734
diversion; it also works in both GNU @code{troff} and @acronym{UNIX}
14735
@code{troff}.@footnote{To be completely independent of the current
14736
escape character, use @code{\(rs} which represents a reverse solidus
14737
(backslash) glyph.} To store, for some reason, an escape sequence in a
14738
diversion that is interpreted when the diversion is reread, either use
14739
the traditional @code{\!} transparent output facility, or, if this is
14740
unsuitable, the new @code{\?} escape sequence.
14742
@xref{Diversions}, and @ref{Gtroff Internals}, for more information.
14746
@c =====================================================================
14747
@c =====================================================================
14749
@node Preprocessors, Output Devices, gtroff Reference, Top
14750
@chapter Preprocessors
14751
@cindex preprocessors
14753
This chapter describes all preprocessors that come with @code{groff} or
14754
which are freely available.
14769
@c =====================================================================
14771
@node geqn, gtbl, Preprocessors, Preprocessors
14772
@section @code{geqn}
14773
@cindex @code{eqn}, the program
14774
@cindex @code{geqn}, the program
14782
@c ---------------------------------------------------------------------
14784
@node Invoking geqn, , geqn, geqn
14785
@subsection Invoking @code{geqn}
14786
@cindex invoking @code{geqn}
14787
@cindex @code{geqn}, invoking
14792
@c =====================================================================
14794
@node gtbl, gpic, geqn, Preprocessors
14795
@section @code{gtbl}
14796
@cindex @code{tbl}, the program
14797
@cindex @code{gtbl}, the program
14805
@c ---------------------------------------------------------------------
14807
@node Invoking gtbl, , gtbl, gtbl
14808
@subsection Invoking @code{gtbl}
14809
@cindex invoking @code{gtbl}
14810
@cindex @code{gtbl}, invoking
14815
@c =====================================================================
14817
@node gpic, ggrn, gtbl, Preprocessors
14818
@section @code{gpic}
14819
@cindex @code{pic}, the program
14820
@cindex @code{gpic}, the program
14828
@c ---------------------------------------------------------------------
14830
@node Invoking gpic, , gpic, gpic
14831
@subsection Invoking @code{gpic}
14832
@cindex invoking @code{gpic}
14833
@cindex @code{gpic}, invoking
14838
@c =====================================================================
14840
@node ggrn, grap, gpic, Preprocessors
14841
@section @code{ggrn}
14842
@cindex @code{grn}, the program
14843
@cindex @code{ggrn}, the program
14851
@c ---------------------------------------------------------------------
14853
@node Invoking ggrn, , ggrn, ggrn
14854
@subsection Invoking @code{ggrn}
14855
@cindex invoking @code{ggrn}
14856
@cindex @code{ggrn}, invoking
14861
@c =====================================================================
14863
@node grap, gchem, ggrn, Preprocessors
14864
@section @code{grap}
14865
@cindex @code{grap}, the program
14867
A free implementation of @code{grap}, written by Ted Faber,
14868
is available as an extra package from the following address:
14871
@uref{http://www.lunabase.org/~faber/Vault/software/grap/}
14875
@c =====================================================================
14877
@node gchem, grefer, grap, Preprocessors
14878
@section @code{gchem}
14879
@cindex @code{chem}, the program
14880
@cindex @code{gchem}, the program
14888
@c ---------------------------------------------------------------------
14890
@node Invoking gchem, , gchem, gchem
14891
@subsection Invoking @code{gchem}
14892
@cindex invoking @code{gchem}
14893
@cindex @code{gchem}, invoking
14898
@c =====================================================================
14900
@node grefer, gsoelim, gchem, Preprocessors
14901
@section @code{grefer}
14902
@cindex @code{refer}, the program
14903
@cindex @code{grefer}, the program
14908
* Invoking grefer::
14911
@c ---------------------------------------------------------------------
14913
@node Invoking grefer, , grefer, grefer
14914
@subsection Invoking @code{grefer}
14915
@cindex invoking @code{grefer}
14916
@cindex @code{grefer}, invoking
14921
@c =====================================================================
14923
@node gsoelim, preconv, grefer, Preprocessors
14924
@section @code{gsoelim}
14925
@cindex @code{soelim}, the program
14926
@cindex @code{gsoelim}, the program
14931
* Invoking gsoelim::
14934
@c ---------------------------------------------------------------------
14936
@node Invoking gsoelim, , gsoelim, gsoelim
14937
@subsection Invoking @code{gsoelim}
14938
@cindex invoking @code{gsoelim}
14939
@cindex @code{gsoelim}, invoking
14944
@c =====================================================================
14946
@node preconv, , gsoelim, Preprocessors
14947
@section @code{preconv}
14948
@cindex @code{preconv}, the program
14953
* Invoking preconv::
14956
@c ---------------------------------------------------------------------
14958
@node Invoking preconv, , preconv, preconv
14959
@subsection Invoking @code{preconv}
14960
@cindex invoking @code{preconv}
14961
@cindex @code{preconv}, invoking
14966
@c =====================================================================
14967
@c =====================================================================
14969
@node Output Devices, File formats, Preprocessors, Top
14970
@chapter Output Devices
14971
@cindex output devices
14972
@cindex devices for output
14977
* Special Characters::
14989
@c =====================================================================
14991
@node Special Characters, grotty, Output Devices, Output Devices
14992
@section Special Characters
14993
@cindex special characters
14994
@cindex characters, special
15001
@c =====================================================================
15003
@node grotty, grops, Special Characters, Output Devices
15004
@section @code{grotty}
15005
@cindex @code{grotty}, the program
15007
The postprocessor @code{grotty} translates the output from GNU
15008
@code{troff} into a form suitable for typewriter-like devices. It is
15009
fully documented on its manual page, @cite{grotty(1)}.
15012
* Invoking grotty::
15015
@c ---------------------------------------------------------------------
15017
@node Invoking grotty, , grotty, grotty
15018
@subsection Invoking @code{grotty}
15019
@cindex invoking @code{grotty}
15020
@cindex @code{grotty}, invoking
15022
The postprocessor @command{grotty} accepts the following command-line
15027
Do not overstrike bold glyphs. Ignored if @option{-c} isn't used.
15030
Do not underline bold-italic glyphs. Ignored if @option{-c} isn't
15034
Use overprint and disable colours for printing on legacy Teletype
15035
printers (see below).
15038
Do not render lines (this is, ignore all @code{\D} escapes).
15041
Use form feed control characters in the output.
15044
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15045
search path for the font and device description files, given the
15046
target device @var{name}.
15049
Use horizontal tabs for sequences of 8 space characters.
15052
Request italic glyphs from the terminal. Ignored if @option{-c} is
15059
Highlight italic glyphs. Ignored if @option{-c} is active.
15062
Do not underline italic glyphs. Ignored if @option{-c} isn't used.
15065
Do not overstrike bold-italic glyphs. Ignored if @option{-c} isn't
15069
Print the version number.
15074
@cindex ISO 6249 SGR
15075
@cindex terminal control sequences
15076
@cindex control sequences, for terminals
15077
The @option{-c} mode for TTY output devices means that underlining is
15078
done by emitting sequences of @samp{_} and @samp{^H} (the backspace
15079
character) before the actual character. Literally, this is printing
15080
an underline character, then moving the caret back one character
15081
position, and printing the actual character at the same position as
15082
the underline character (similar to a typewriter). Usually, a modern
15083
terminal can't interpret this (and the original Teletype machines for
15084
which this sequence was appropriate are no longer in use). You need
15085
a pager program like @code{less} which translates this into
15086
ISO@tie{}6429 SGR sequences to control terminals.
15089
@c =====================================================================
15091
@node grops, gropdf, grotty, Output Devices
15092
@section @code{grops}
15093
@cindex @code{grops}, the program
15095
The postprocessor @command{grops} translates the output from GNU
15096
@command{troff} into a form suitable for Adobe @sc{PostScript}
15097
devices. It is fully documented on its manual page, @cite{grops(1)}.
15102
* Embedding PostScript::
15105
@c ---------------------------------------------------------------------
15107
@node Invoking grops, Embedding PostScript, grops, grops
15108
@subsection Invoking @code{grops}
15109
@cindex invoking @code{grops}
15110
@cindex @code{grops}, invoking
15112
The postprocessor @code{grops} accepts the following command-line
15116
@item -b@var{flags}
15117
Use backward compatibility settings given by @var{flags} as
15118
documented in the @cite{grops(1)} manual page. Overrides the command
15119
@option{broken} in the @file{DESC} file.
15122
Print @var{n} copies of each page.
15125
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15126
search path for the font, prologue and device description files,
15127
given the target device @var{name}, usually @strong{ps}.
15130
Tell the printer to guess the page length. Useful for printing
15131
vertically centered pages when the paper dimensions are determined at
15134
@item -I@var{path} @dots{}
15135
Consider the directory @file{@var{path}} for searching included files
15136
specified with relative paths. The current directory is searched as
15140
Use landscape orientation.
15145
@item -p@var{papersize}
15146
Set the page dimensions. Overrides the commands @option{papersize},
15147
@option{paperlength}, and @option{paperwidth} in the @file{DESC}
15148
file. See the @cite{groff_font(5)} manual page for details.
15150
@item -P@var{prologue}
15151
Use the @var{prologue} in the font path as the prologue instead of
15152
the default @file{prologue}. Overrides the environment variable
15153
@env{GROPS_PROLOGUE}.
15156
Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15157
default value @var{n} = 40.
15160
Print the version number.
15163
@c ---------------------------------------------------------------------
15165
@node Embedding PostScript, , Invoking grops, grops
15166
@subsection Embedding @sc{PostScript}
15167
@cindex embedding PostScript
15168
@cindex PostScript, embedding
15170
The escape sequence
15172
@code{\X'ps: import @var{file} @var{llx} @var{lly} @var{urx} @var{ury}
15173
@var{width} [@var{height}]'}
15176
places a rectangle of the specified @var{width} containing the
15177
@sc{PostScript} drawing from file @var{file} bound by the box from
15178
@var{llx} @var{lly} to @var{urx} @var{ury} (in @sc{PostScript}
15179
coordinates) at the insertion point. If @var{height} is not
15180
specified, the embedded drawing is scaled proportionally.
15182
@xref{Miscellaneous}, for the @code{psbb} request which automatically
15183
generates the bounding box.
15185
This escape sequence is used internally by the macro @code{PSPIC}
15186
(see the @cite{groff_tmac(5)} manual page).
15189
@c =====================================================================
15191
@node gropdf, grodvi, grops, Output Devices
15192
@section @code{gropdf}
15193
@cindex @code{gropdf}, the program
15195
The postprocessor @command{gropdf} translates the output from GNU
15196
@command{troff} into a form suitable for Adobe PDF devices. It is fully
15197
documented on its manual page, @cite{gropdf(1)}.
15200
* Invoking gropdf::
15204
@c ---------------------------------------------------------------------
15206
@node Invoking gropdf, Embedding PDF, gropdf, gropdf
15207
@subsection Invoking @code{gropdf}
15208
@cindex invoking @code{gropdf}
15209
@cindex @code{gropdf}, invoking
15211
The postprocessor @code{gropdf} accepts the following command-line
15216
Produce uncompressed PDFs which include debugging comments.
15219
This forces @code{gropdf} to embed all used fonts in the PDF,
15220
even if they are one of the 14 base Adobe fonts.
15223
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15224
search path for the font, prologue and device description files,
15225
given the target device @var{name}, usually @strong{pdf}.
15227
@item -y@var{foundry}
15228
This forces the use of a different font foundry.
15231
Use landscape orientation.
15233
@item -p@var{papersize}
15234
Set the page dimensions. Overrides the commands @option{papersize},
15235
@option{paperlength}, and @option{paperwidth} in the @file{DESC}
15236
file. See the @cite{groff_font(5)} manual page for details.
15239
Print the version number.
15242
Append a comment line to end of PDF showing statistics, i.e. number of
15243
pages in document. Ghostscript's @cite{ps2pdf(1)} complains about this
15244
line if it is included, but works anyway.
15246
@item -u@var{filename}
15247
@code{gropdf} normally includes a ToUnicode CMap with any font created
15248
using @file{text.enc} as the encoding file, this makes it easier to
15249
search for words which contain ligatures. You can include your own CMap
15250
by specifying a @var{filename} or have no CMap at all by omitting the
15254
@c ---------------------------------------------------------------------
15256
@node Embedding PDF, , Invoking gropdf, gropdf
15257
@subsection Embedding PDF
15258
@cindex embedding PDF
15259
@cindex PDF, embedding
15261
The escape sequence
15263
@code{\X'pdf: pdfpic @var{file} @var{alignment} @var{width} [@var{height}]
15264
[@var{linelength}]'}
15267
places a rectangle of the specified @var{width} containing the PDF
15268
drawing from file @var{file} of desired @var{width} and @var{height} (if
15269
@var{height} is missing or zero then it is scaled proportionally). If
15270
@var{alignment} is @code{-L} the drawing is left aligned. If it is
15271
@code{-C} or @code{-R} a @var{linelength} greater than the width of the
15272
drawing is required as well. If @var{width} is specified as zero then
15273
the width is scaled in proportion to the height.
15276
@c =====================================================================
15278
@node grodvi, grolj4, gropdf, Output Devices
15279
@section @code{grodvi}
15280
@cindex @code{grodvi}, the program
15282
The postprocessor @command{grodvi} translates the output from GNU
15283
@command{troff} into the @strong{DVI} output format compatible with
15284
the @strong{@TeX{}} document preparation system. It is fully
15285
documented on its manual page, @cite{grodvi(1)}.
15288
* Invoking grodvi::
15291
@c ---------------------------------------------------------------------
15293
@node Invoking grodvi, , grodvi, grodvi
15294
@subsection Invoking @code{grodvi}
15295
@cindex invoking @code{grodvi}
15296
@cindex @code{grodvi}, invoking
15298
The postprocessor @code{grodvi} accepts the following command-line
15303
Do not use @strong{tpic} specials to implement drawing commands.
15306
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15307
search path for the font and device description files, given the
15308
target device @var{name}, usually @strong{dvi}.
15311
Use landscape orientation.
15313
@item -p@var{papersize}
15314
Set the page dimensions. Overrides the commands @option{papersize},
15315
@option{paperlength}, and @option{paperwidth} in the @file{DESC}
15316
file. See @cite{groff_font(5)} manual page for details.
15319
Print the version number.
15322
Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15323
default value @var{n} = 40.
15327
@c =====================================================================
15329
@node grolj4, grolbp, grodvi, Output Devices
15330
@section @code{grolj4}
15331
@cindex @code{grolj4}, the program
15333
The postprocessor @command{grolj4} translates the output from GNU
15334
@command{troff} into the @strong{PCL5} output format suitable for
15335
printing on a @strong{HP LaserJet@tie{}4} printer. It is fully
15336
documented on its manual page, @cite{grolj4(1)}.
15339
* Invoking grolj4::
15342
@c ---------------------------------------------------------------------
15344
@node Invoking grolj4, , grolj4, grolj4
15345
@subsection Invoking @code{grolj4}
15346
@cindex invoking @code{grolj4}
15347
@cindex @code{grolj4}, invoking
15349
The postprocessor @code{grolj4} accepts the following command-line
15354
Print @var{n} copies of each page.
15357
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15358
search path for the font and device description files, given the
15359
target device @var{name}, usually @strong{lj4}.
15362
Use landscape orientation.
15365
Set the page dimensions. Valid values for @var{size} are:
15366
@code{letter}, @code{legal}, @code{executive}, @code{a4},
15367
@code{com10}, @code{monarch}, @code{c5}, @code{b5}, @code{d1}.
15370
Print the version number.
15373
Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15374
default value @var{n} = 40.
15377
The special drawing command @code{\D'R @var{dh} @var{dv}'} draws a
15378
horizontal rectangle from the current position to the position at
15379
offset (@var{dh},@var{dv}).
15382
@c =====================================================================
15384
@node grolbp, grohtml, grolj4, Output Devices
15385
@section @code{grolbp}
15386
@cindex @code{grolbp}, the program
15388
The postprocessor @command{grolbp} translates the output from GNU
15389
@command{troff} into the @strong{LBP} output format suitable for
15390
printing on @strong{Canon CAPSL} printers. It is fully documented on
15391
its manual page, @cite{grolbp(1)}.
15394
* Invoking grolbp::
15397
@c ---------------------------------------------------------------------
15399
@node Invoking grolbp, , grolbp, grolbp
15400
@subsection Invoking @code{grolbp}
15401
@cindex invoking @code{grolbp}
15402
@cindex @code{grolbp}, invoking
15404
The postprocessor @code{grolbp} accepts the following command-line
15409
Print @var{n} copies of each page.
15412
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15413
search path for the font, prologue and device description files,
15414
given the target device @var{name}, usually @strong{lbp}.
15417
Use landscape orientation.
15419
@item -o@var{orientation}
15420
Use the @var{orientation} specified: @code{portrait} or
15423
@item -p@var{papersize}
15424
Set the page dimensions. See @cite{groff_font(5)} manual page for
15428
Set the line thickness to @var{n}/1000@dmn{em}. Overrides the
15429
default value @var{n} = 40.
15432
Print the version number.
15435
Print command-line help.
15439
@c =====================================================================
15441
@node grohtml, gxditview, grolbp, Output Devices
15442
@section @code{grohtml}
15443
@cindex @code{grohtml}, the program
15445
The @code{grohtml} front end (which consists of a preprocessor,
15446
@code{pre-grohtml}, and a device driver, @code{post-grohtml}) translates
15447
the output of GNU @code{troff} to @acronym{HTML}. Users should always
15448
invoke @code{grohtml} via the @code{groff} command with a @code{\-Thtml}
15449
option. If no files are given, @code{grohtml} will read the standard
15450
input. A filename of @code{-} will also cause @code{grohtml} to read
15451
the standard input. @acronym{HTML} output is written to the standard
15452
output. When @code{grohtml} is run by @code{groff}, options can be
15453
passed to @code{grohtml} using @code{groff}'s @option{-P} option.
15455
@code{grohtml} invokes @code{groff} twice. In the first pass, pictures,
15456
equations, and tables are rendered using the @code{ps} device, and in
15457
the second pass @acronym{HTML} output is generated by the @code{html}
15460
@code{grohtml} always writes output in @code{UTF-8} encoding and has
15461
built-in entities for all non-composite unicode characters. In spite of
15462
this, @code{groff} may issue warnings about unknown special characters
15463
if they can't be found during the first pass. Such warnings can be
15464
safely ignored unless the special characters appear inside a table or
15465
equation, in which case glyphs for these characters must be defined for
15466
the @code{ps} device as well.
15468
This output device is fully documented on its manual page,
15472
* Invoking grohtml::
15473
* grohtml specific registers and strings::
15476
@c ---------------------------------------------------------------------
15478
@node Invoking grohtml, grohtml specific registers and strings, grohtml, grohtml
15479
@subsection Invoking @code{grohtml}
15480
@cindex invoking @code{grohtml}
15481
@cindex @code{grohtml}, invoking
15483
The postprocessor @code{grohtml} accepts the following command-line
15488
Use this number of @var{bits} (= 1, 2 or 4) for text antialiasing.
15489
Default: @var{bits} = 4.
15492
Do not use text antialiasing.
15495
Use white background.
15498
Store rendered images in the directory @file{@var{dir}}.
15501
Put the directory @file{@var{dir}/dev@var{name}} in front of the
15502
search path for the font, prologue and device description files,
15503
given the target device @var{name}, usually @strong{html}.
15506
Use this number of @var{bits} (= 1, 2 or 4) for antialiasing of
15507
drawings. Default: @var{bits} = 4.
15510
Do not use antialiasing for drawings.
15513
Use the @code{B} element for section headings.
15515
@item -i@var{resolution}
15516
Use the @var{resolution} for rendered images. Default:
15517
@var{resolution} = 100@dmn{dpi}.
15520
Set the images' @var{stem name}. Default: @var{stem} =
15521
@file{grohtml-@var{XXX}} (@var{XXX} is the process ID).
15524
Place each section in a separate file called
15525
@file{@var{stem}-@var{n}.html} (where @var{n} is a generated section
15529
Do not generate the table of contents.
15532
Generate simple fragment identifiers.
15534
@item -o@var{offset}
15535
Use vertical paddding @var{offset} for images.
15538
Display the page rendering progress to @code{stderr}.
15541
Do not use horizontal rules to separate headers and footers.
15544
Set the base font size, to be modified using the elements @code{BIG}
15547
@item -S@var{level}
15548
Generate separate files for sections at level @var{level}.
15551
Print the version number.
15554
Generate a validator button at the bottom.
15557
Generate a signature of groff after the validator button, if any.
15561
@c ---------------------------------------------------------------------
15563
@node grohtml specific registers and strings, , Invoking grohtml, grohtml
15564
@subsection @code{grohtml} specific registers and strings
15565
@cindex registers specific to @code{grohtml}
15566
@cindex strings specific to @code{grohtml}
15567
@cindex @code{grohtml}, registers and strings
15569
@DefmpregList {ps4html, grohtml}
15570
@DefstrListEnd {www-image-template, grohtml}
15571
The registers @code{ps4html} and @code{www-image-template} are defined
15572
by the @code{pre-grohtml} preprocessor. @code{pre-grohtml} reads in the
15573
@code{troff} input, marks up the inline equations and passes the result
15577
troff -Tps -rps4html=1 -dwww-image-template=@var{template}
15595
The @sc{PostScript} device is used to create all the image files (for
15596
@option{-Thtml}; if @option{-Txhtml} is used, all equations are passed
15597
to @code{geqn} to produce @acronym{MathML}, and the register
15598
@code{ps4html} enables the macro sets to ignore floating keeps, footers,
15601
The register @code{www-image-template} is set to the user specified
15602
template name or the default name.
15606
@c =====================================================================
15608
@node gxditview, , grohtml, Output Devices
15609
@section @code{gxditview}
15610
@cindex @code{gxditview}, the program
15615
* Invoking gxditview::
15618
@c ---------------------------------------------------------------------
15620
@node Invoking gxditview, , gxditview, gxditview
15621
@subsection Invoking @code{gxditview}
15622
@cindex invoking @code{gxditview}
15623
@cindex @code{gxditview}, invoking
15630
@c =====================================================================
15631
@c =====================================================================
15633
@node File formats, Installation, Output Devices, Top
15634
@chapter File formats
15635
@cindex file formats
15636
@cindex formats, file
15638
All files read and written by @code{gtroff} are text files. The
15639
following two sections describe their format.
15647
@c =====================================================================
15649
@node gtroff Output, Font Files, File formats, File formats
15650
@section @code{gtroff} Output
15651
@cindex @code{gtroff}, output
15652
@cindex output, @code{gtroff}
15654
This section describes the intermediate output format of GNU
15655
@code{troff}. This output is produced by a run of @code{gtroff} before
15656
it is fed into a device postprocessor program.
15658
As @code{groff} is a wrapper program around @code{gtroff} that
15659
automatically calls a postprocessor, this output does not show up
15660
normally. This is why it is called @dfn{intermediate}. @code{groff}
15661
provides the option @option{-Z} to inhibit postprocessing, such that the
15662
produced intermediate output is sent to standard output just like
15663
calling @code{gtroff} manually.
15665
@cindex troff output
15666
@cindex output, troff
15667
@cindex intermediate output
15668
@cindex output, intermediate
15669
Here, the term @dfn{troff output} describes what is output by
15670
@code{gtroff}, while @dfn{intermediate output} refers to the language
15671
that is accepted by the parser that prepares this output for the
15672
postprocessors. This parser is smarter on whitespace and implements
15673
obsolete elements for compatibility, otherwise both formats are the
15674
same.@footnote{The parser and postprocessor for intermediate output can
15675
be found in the file@*
15676
@file{@var{groff-source-dir}/src/libs/libdriver/input.cpp}.}
15678
The main purpose of the intermediate output concept is to facilitate the
15679
development of postprocessors by providing a common programming
15680
interface for all devices. It has a language of its own that is
15681
completely different from the @code{gtroff} language. While the
15682
@code{gtroff} language is a high-level programming language for text
15683
processing, the intermediate output language is a kind of low-level
15684
assembler language by specifying all positions on the page for writing
15687
The intermediate output produced by @code{gtroff} is fairly readable,
15688
while output from @acronym{AT&T} @code{troff} is rather hard to
15689
understand because of strange habits that are still supported, but not
15690
used any longer by @code{gtroff}.
15693
* Language Concepts::
15694
* Command Reference::
15695
* Intermediate Output Examples::
15696
* Output Language Compatibility::
15699
@c ---------------------------------------------------------------------
15701
@node Language Concepts, Command Reference, gtroff Output, gtroff Output
15702
@subsection Language Concepts
15704
During the run of @code{gtroff}, the input data is cracked down to the
15705
information on what has to be printed at what position on the intended
15706
device. So the language of the intermediate output format can be quite
15707
small. Its only elements are commands with and without arguments. In
15708
this section, the term @dfn{command} always refers to the intermediate
15709
output language, and never to the @code{gtroff} language used for
15710
document formatting. There are commands for positioning and text
15711
writing, for drawing, and for device controlling.
15719
@node Separation, Argument Units, Language Concepts, Language Concepts
15720
@subsubsection Separation
15722
@acronym{AT&T} @code{troff} output has strange requirements on
15723
whitespace. The @code{gtroff} output parser, however, is smart about
15724
whitespace by making it maximally optional. The whitespace characters,
15725
i.e., the tab, space, and newline characters, always have a syntactical
15726
meaning. They are never printable because spacing within the output is
15727
always done by positioning commands.
15729
Any sequence of space or tab characters is treated as a single
15730
@dfn{syntactical space}. It separates commands and arguments, but is
15731
only required when there would occur a clashing between the command code
15732
and the arguments without the space. Most often, this happens when
15733
variable-length command names, arguments, argument lists, or command
15734
clusters meet. Commands and arguments with a known, fixed length need
15735
not be separated by syntactical space.
15737
A line break is a syntactical element, too. Every command argument can
15738
be followed by whitespace, a comment, or a newline character. Thus a
15739
@dfn{syntactical line break} is defined to consist of optional
15740
syntactical space that is optionally followed by a comment, and a
15743
The normal commands, those for positioning and text, consist of a single
15744
letter taking a fixed number of arguments. For historical reasons, the
15745
parser allows to stack such commands on the same line, but fortunately,
15746
in @code{gtroff}'s intermediate output, every command with at least one
15747
argument is followed by a line break, thus providing excellent
15750
The other commands -- those for drawing and device controlling -- have a
15751
more complicated structure; some recognize long command names, and some
15752
take a variable number of arguments. So all @samp{D} and @samp{x}
15753
commands were designed to request a syntactical line break after their
15754
last argument. Only one command, @w{@samp{x X}}, has an argument that
15755
can stretch over several lines; all other commands must have all of
15756
their arguments on the same line as the command, i.e., the arguments may
15757
not be split by a line break.
15759
Empty lines (these are lines containing only space and/or a comment),
15760
can occur everywhere. They are just ignored.
15762
@node Argument Units, Document Parts, Separation, Language Concepts
15763
@subsubsection Argument Units
15765
Some commands take integer arguments that are assumed to represent
15766
values in a measurement unit, but the letter for the corresponding scale
15767
indicator is not written with the output command arguments. Most
15768
commands assume the scale indicator @samp{u}, the basic unit of the
15769
device, some use @samp{z}, the scaled point unit of the device, while
15770
others, such as the color commands, expect plain integers.
15772
Note that single characters can have the eighth bit set, as can the
15773
names of fonts and special characters. The names of characters and
15774
fonts can be of arbitrary length. A character that is to be printed is
15775
always in the current font.
15777
A string argument is always terminated by the next whitespace character
15778
(space, tab, or newline); an embedded @samp{#} character is regarded as
15779
part of the argument, not as the beginning of a comment command. An
15780
integer argument is already terminated by the next non-digit character,
15781
which then is regarded as the first character of the next argument or
15784
@node Document Parts, , Argument Units, Language Concepts
15785
@subsubsection Document Parts
15787
A correct intermediate output document consists of two parts, the
15788
@dfn{prologue} and the @dfn{body}.
15790
The task of the prologue is to set the general device parameters using
15791
three exactly specified commands. @code{gtroff}'s prologue is
15792
guaranteed to consist of the following three lines (in that order):
15796
x res @var{n} @var{h} @var{v}
15801
with the arguments set as outlined in @ref{Device Control Commands}.
15802
Note that the parser for the intermediate output format is able to
15803
swallow additional whitespace and comments as well even in the prologue.
15805
The body is the main section for processing the document data.
15806
Syntactically, it is a sequence of any commands different from the ones
15807
used in the prologue. Processing is terminated as soon as the first
15808
@w{@samp{x stop}} command is encountered; the last line of any
15809
@code{gtroff} intermediate output always contains such a command.
15811
Semantically, the body is page oriented. A new page is started by a
15812
@samp{p} command. Positioning, writing, and drawing commands are always
15813
done within the current page, so they cannot occur before the first
15814
@samp{p} command. Absolute positioning (by the @samp{H} and @samp{V}
15815
commands) is done relative to the current page; all other positioning is
15816
done relative to the current location within this page.
15818
@c ---------------------------------------------------------------------
15820
@node Command Reference, Intermediate Output Examples, Language Concepts, gtroff Output
15821
@subsection Command Reference
15823
This section describes all intermediate output commands, both from
15824
@acronym{AT&T} @code{troff} as well as the @code{gtroff} extensions.
15827
* Comment Command::
15828
* Simple Commands::
15829
* Graphics Commands::
15830
* Device Control Commands::
15831
* Obsolete Command::
15834
@node Comment Command, Simple Commands, Command Reference, Command Reference
15835
@subsubsection Comment Command
15838
@item #@var{anything}@angles{end of line}
15839
A comment. Ignore any characters from the @samp{#} character up to the
15840
next newline character.
15842
This command is the only possibility for commenting in the intermediate
15843
output. Each comment can be preceded by arbitrary syntactical space;
15844
every command can be terminated by a comment.
15847
@node Simple Commands, Graphics Commands, Comment Command, Command Reference
15848
@subsubsection Simple Commands
15850
The commands in this subsection have a command code consisting of a
15851
single character, taking a fixed number of arguments. Most of them are
15852
commands for positioning and text writing. These commands are smart
15853
about whitespace. Optionally, syntactical space can be inserted before,
15854
after, and between the command letter and its arguments. All of these
15855
commands are stackable, i.e., they can be preceded by other simple
15856
commands or followed by arbitrary other commands on the same line. A
15857
separating syntactical space is only necessary when two integer
15858
arguments would clash or if the preceding argument ends with a string
15863
.if (\n[@USE_ENV_STACK] == 1) \{\
15865
Open a new environment by copying the actual device configuration data
15866
to the environment stack.
15868
The current environment is setup by the device specification and
15869
manipulated by the setting commands.
15873
Close the actual environment (opened by a preceding
15875
and restore the previous environment from the environment
15876
stack as the actual device configuration data.
15878
\} \" endif @USE_ENV_STACK
15881
@item C @var{xxx}@angles{whitespace}
15882
Print a special character named @var{xxx}. The trailing syntactical
15883
space or line break is necessary to allow glyph names of arbitrary
15884
length. The glyph is printed at the current print position; the glyph's
15885
size is read from the font file. The print position is not changed.
15888
Print glyph@tie{}@var{g} at the current print
15889
position;@footnote{@samp{c} is actually a misnomer since it outputs a
15890
glyph.} the glyph's size is read from the font file. The print position
15894
Set font to font number@tie{}@var{n} (a non-negative integer).
15897
Move right to the absolute vertical position@tie{}@var{n} (a
15898
non-negative integer in basic units @samp{u} relative to left edge of
15902
Move @var{n} (a non-negative integer) basic units @samp{u} horizontally
15903
to the right. The original @acronym{UNIX} troff manual allows negative
15904
values for @var{n} also, but @code{gtroff} doesn't use this.
15906
@item m @var{color-scheme} @r{[}@var{component} @dots{}@r{]}
15907
Set the color for text (glyphs), line drawing, and the outline of
15908
graphic objects using different color schemes; the analoguous command
15909
for the filling color of graphic objects is @samp{DF}. The color
15910
components are specified as integer arguments between 0 and 65536. The
15911
number of color components and their meaning vary for the different
15912
color schemes. These commands are generated by @code{gtroff}'s escape
15913
sequence @code{\m}. No position changing. These commands are a
15914
@code{gtroff} extension.
15917
@item mc @var{cyan} @var{magenta} @var{yellow}
15918
Set color using the CMY color scheme, having the 3@tie{}color components
15919
@var{cyan}, @var{magenta}, and @var{yellow}.
15922
Set color to the default color value (black in most cases). No
15923
component arguments.
15925
@item mg @var{gray}
15926
Set color to the shade of gray given by the argument, an integer between
15927
0 (black) and 65536 (white).
15929
@item mk @var{cyan} @var{magenta} @var{yellow} @var{black}
15930
Set color using the CMYK color scheme, having the 4@tie{}color
15931
components @var{cyan}, @var{magenta}, @var{yellow}, and @var{black}.
15933
@item mr @var{red} @var{green} @var{blue}
15934
Set color using the RGB color scheme, having the 3@tie{}color components
15935
@var{red}, @var{green}, and @var{blue}.
15939
Print glyph with index@tie{}@var{n} (a non-negative integer) of the
15940
current font. This command is a @code{gtroff} extension.
15942
@item n @var{b} @var{a}
15943
Inform the device about a line break, but no positioning is done by this
15944
command. In @acronym{AT&T} @code{troff}, the integer arguments @var{b}
15945
and@tie{}@var{a} informed about the space before and after the current
15946
line to make the intermediate output more human readable without
15947
performing any action. In @code{groff}, they are just ignored, but they
15948
must be provided for compatibility reasons.
15951
Begin a new page in the outprint. The page number is set
15952
to@tie{}@var{n}. This page is completely independent of pages formerly
15953
processed even if those have the same page number. The vertical
15954
position on the outprint is automatically set to@tie{}0. All
15955
positioning, writing, and drawing is always done relative to a page, so
15956
a @samp{p} command must be issued before any of these commands.
15959
Set point size to @var{n}@tie{}scaled points (this is unit @samp{z}).
15960
@acronym{AT&T} @code{troff} used the unit points (@samp{p}) instead.
15961
@xref{Output Language Compatibility}.
15963
@item t @var{xxx}@angles{whitespace}
15964
@itemx t @var{xxx} @var{dummy-arg}@angles{whitespace}
15965
Print a word, i.e., a sequence of characters @var{xxx} representing
15966
output glyphs which names are single characters, terminated by a space
15967
character or a line break; an optional second integer argument is
15968
ignored (this allows the formatter to generate an even number of
15969
arguments). The first glyph should be printed at the current position,
15970
the current horizontal position should then be increased by the width of
15971
the first glyph, and so on for each glyph. The widths of the glyphs are
15972
read from the font file, scaled for the current point size, and rounded
15973
to a multiple of the horizontal resolution. Special characters cannot
15974
be printed using this command (use the @samp{C} command for special
15975
characters). This command is a @code{gtroff} extension; it is only used
15976
for devices whose @file{DESC} file contains the @code{tcommand} keyword
15977
(@pxref{DESC File Format}).
15979
@item u @var{n} @var{xxx}@angles{whitespace}
15980
Print word with track kerning. This is the same as the @samp{t} command
15981
except that after printing each glyph, the current horizontal position
15982
is increased by the sum of the width of that glyph and@tie{}@var{n} (an
15983
integer in basic units @samp{u}). This command is a @code{gtroff}
15984
extension; it is only used for devices whose @file{DESC} file contains
15985
the @code{tcommand} keyword (@pxref{DESC File Format}).
15988
Move down to the absolute vertical position@tie{}@var{n} (a non-negative
15989
integer in basic units @samp{u}) relative to upper edge of current page.
15992
Move @var{n}@tie{}basic units @samp{u} down (@var{n} is a non-negative
15993
integer). The original @acronym{UNIX} troff manual allows negative
15994
values for @var{n} also, but @code{gtroff} doesn't use this.
15997
Informs about a paddable white space to increase readability. The
15998
spacing itself must be performed explicitly by a move command.
16001
@node Graphics Commands, Device Control Commands, Simple Commands, Command Reference
16002
@subsubsection Graphics Commands
16004
Each graphics or drawing command in the intermediate output starts with
16005
the letter @samp{D}, followed by one or two characters that specify a
16006
subcommand; this is followed by a fixed or variable number of integer
16007
arguments that are separated by a single space character. A @samp{D}
16008
command may not be followed by another command on the same line (apart
16009
from a comment), so each @samp{D} command is terminated by a syntactical
16012
@code{gtroff} output follows the classical spacing rules (no space
16013
between command and subcommand, all arguments are preceded by a single
16014
space character), but the parser allows optional space between the
16015
command letters and makes the space before the first argument optional.
16016
As usual, each space can be any sequence of tab and space characters.
16018
Some graphics commands can take a variable number of arguments. In this
16019
case, they are integers representing a size measured in basic units
16020
@samp{u}. The arguments called @var{h1}, @var{h2}, @dots{}, @var{hn}
16021
stand for horizontal distances where positive means right, negative
16022
left. The arguments called @var{v1}, @var{v2}, @dots{}, @var{vn} stand
16023
for vertical distances where positive means down, negative up. All
16024
these distances are offsets relative to the current location.
16026
Each graphics command directly corresponds to a similar @code{gtroff}
16027
@code{\D} escape sequence. @xref{Drawing Requests}.
16029
Unknown @samp{D} commands are assumed to be device-specific. Its
16030
arguments are parsed as strings; the whole information is then sent to
16033
In the following command reference, the syntax element @angles{line
16034
break} means a syntactical line break as defined above.
16037
@item D~ @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
16038
Draw B-spline from current position to offset (@var{h1},@var{v1}), then
16039
to offset (@var{h2},@var{v2}), if given, etc.@: up to
16040
(@var{hn},@var{vn}). This command takes a variable number of argument
16041
pairs; the current position is moved to the terminal point of the drawn
16044
@item Da @var{h1} @var{v1} @var{h2} @var{v2}@angles{line break}
16045
Draw arc from current position to
16046
(@var{h1},@var{v1})@math{+}(@var{h2},@var{v2}) with center at
16047
(@var{h1},@var{v1}); then move the current position to the final point
16050
@item DC @var{d}@angles{line break}
16051
@itemx DC @var{d} @var{dummy-arg}@angles{line break}
16052
Draw a solid circle using the current fill color with
16053
diameter@tie{}@var{d} (integer in basic units @samp{u}) with leftmost
16054
point at the current position; then move the current position to the
16055
rightmost point of the circle. An optional second integer argument is
16056
ignored (this allows the formatter to generate an even number of
16057
arguments). This command is a @code{gtroff} extension.
16059
@item Dc @var{d}@angles{line break}
16060
Draw circle line with diameter@tie{}@var{d} (integer in basic units
16061
@samp{u}) with leftmost point at the current position; then move the
16062
current position to the rightmost point of the circle.
16064
@item DE @var{h} @var{v}@angles{line break}
16065
Draw a solid ellipse in the current fill color with a horizontal
16066
diameter of@tie{}@var{h} and a vertical diameter of@tie{}@var{v} (both
16067
integers in basic units @samp{u}) with the leftmost point at the current
16068
position; then move to the rightmost point of the ellipse. This command
16069
is a @code{gtroff} extension.
16071
@item De @var{h} @var{v}@angles{line break}
16072
Draw an outlined ellipse with a horizontal diameter of@tie{}@var{h} and
16073
a vertical diameter of@tie{}@var{v} (both integers in basic units
16074
@samp{u}) with the leftmost point at current position; then move to the
16075
rightmost point of the ellipse.
16077
@item DF @var{color-scheme} @r{[}@var{component} @dots{}@r{]}@angles{line break}
16078
Set fill color for solid drawing objects using different color schemes;
16079
the analoguous command for setting the color of text, line graphics, and
16080
the outline of graphic objects is @samp{m}. The color components are
16081
specified as integer arguments between 0 and 65536. The number of color
16082
components and their meaning vary for the different color schemes.
16083
These commands are generated by @code{gtroff}'s escape sequences
16084
@w{@code{\D'F @dots{}'}} and @code{\M} (with no other corresponding
16085
graphics commands). No position changing. This command is a
16086
@code{gtroff} extension.
16089
@item DFc @var{cyan} @var{magenta} @var{yellow}@angles{line break}
16090
Set fill color for solid drawing objects using the CMY color scheme,
16091
having the 3@tie{}color components @var{cyan}, @var{magenta}, and
16094
@item DFd@angles{line break}
16095
Set fill color for solid drawing objects to the default fill color value
16096
(black in most cases). No component arguments.
16098
@item DFg @var{gray}@angles{line break}
16099
Set fill color for solid drawing objects to the shade of gray given by
16100
the argument, an integer between 0 (black) and 65536 (white).
16102
@item DFk @var{cyan} @var{magenta} @var{yellow} @var{black}@angles{line break}
16103
Set fill color for solid drawing objects using the CMYK color scheme,
16104
having the 4@tie{}color components @var{cyan}, @var{magenta},
16105
@var{yellow}, and @var{black}.
16107
@item DFr @var{red} @var{green} @var{blue}@angles{line break}
16108
Set fill color for solid drawing objects using the RGB color scheme,
16109
having the 3@tie{}color components @var{red}, @var{green}, and
16113
@item Df @var{n}@angles{line break}
16114
The argument@tie{}@var{n} must be an integer in the range @math{-32767}
16118
@item @math{0 @LE{} @var{n} @LE{} 1000}
16119
Set the color for filling solid drawing objects to a shade of gray,
16120
where 0 corresponds to solid white, 1000 (the default) to solid black,
16121
and values in between to intermediate shades of gray; this is obsoleted
16122
by command @samp{DFg}.
16124
@item @math{@var{n} < 0} or @math{@var{n} > 1000}
16125
Set the filling color to the color that is currently being used for the
16126
text and the outline, see command @samp{m}. For example, the command
16135
sets all colors to blue.
16139
No position changing. This command is a @code{gtroff} extension.
16141
@item Dl @var{h} @var{v}@angles{line break}
16142
Draw line from current position to offset (@var{h},@var{v}) (integers in
16143
basic units @samp{u}); then set current position to the end of the drawn
16146
@item Dp @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
16147
Draw a polygon line from current position to offset (@var{h1},@var{v1}),
16148
from there to offset (@var{h2},@var{v2}), etc.@: up to offset
16149
(@var{hn},@var{vn}), and from there back to the starting position. For
16150
historical reasons, the position is changed by adding the sum of all
16151
arguments with odd index to the actual horizontal position and the even
16152
ones to the vertical position. Although this doesn't make sense it is
16153
kept for compatibility.
16155
As the polygon is closed, the end of drawing is the starting point, so
16156
the position doesn't change.
16158
This command is a @code{gtroff} extension.
16160
@item Dp @var{h1} @var{v1} @var{h2} @var{v2} @dots{} @var{hn} @var{vn}@angles{line break}
16161
Draw a solid polygon in the current fill color rather than an outlined
16162
polygon, using the same arguments and positioning as the corresponding
16165
No position changing.
16167
This command is a @code{gtroff} extension.
16169
@item Dt @var{n}@angles{line break}
16170
Set the current line thickness to@tie{}@var{n} (an integer in basic
16171
units @samp{u}) if @math{@var{n}>0}; if @math{@var{n}=0} select the
16172
smallest available line thickness; if @math{@var{n}<0} set the line
16173
thickness proportional to the point size (this is the default before the
16174
first @samp{Dt} command was specified). For historical reasons, the
16175
horizontal position is changed by adding the argument to the actual
16176
horizontal position, while the vertical position is not changed.
16177
Although this doesn't make sense it is kept for compatibility.
16179
No position changing.
16181
This command is a @code{gtroff} extension.
16184
@node Device Control Commands, Obsolete Command, Graphics Commands, Command Reference
16185
@subsubsection Device Control Commands
16187
Each device control command starts with the letter @samp{x}, followed by
16188
a space character (optional or arbitrary space or tab in @code{gtroff})
16189
and a subcommand letter or word; each argument (if any) must be preceded
16190
by a syntactical space. All @samp{x} commands are terminated by a
16191
syntactical line break; no device control command can be followed by
16192
another command on the same line (except a comment).
16194
The subcommand is basically a single letter, but to increase
16195
readability, it can be written as a word, i.e., an arbitrary sequence of
16196
characters terminated by the next tab, space, or newline character. All
16197
characters of the subcommand word but the first are simply ignored. For
16198
example, @code{gtroff} outputs the initialization command @w{@samp{x i}}
16199
as @w{@samp{x init}} and the resolution command @w{@samp{x r}} as
16202
In the following, the syntax element @angles{line break} means a
16203
syntactical line break (@pxref{Separation}).
16206
@item xF @var{name}@angles{line break}
16207
The @samp{F} stands for @var{Filename}.
16209
Use @var{name} as the intended name for the current file in error
16210
reports. This is useful for remembering the original file name when
16211
@code{gtroff} uses an internal piping mechanism. The input file is not
16212
changed by this command. This command is a @code{gtroff} extension.
16214
@item xf @var{n} @var{s}@angles{line break}
16215
The @samp{f} stands for @var{font}.
16217
Mount font position@tie{}@var{n} (a non-negative integer) with font
16218
named@tie{}@var{s} (a text word). @xref{Font Positions}.
16220
@item xH @var{n}@angles{line break}
16221
The @samp{H} stands for @var{Height}.
16223
Set glyph height to@tie{}@var{n} (a positive integer in scaled points
16224
@samp{z}). @acronym{AT&T} @code{troff} uses the unit points (@samp{p})
16225
instead. @xref{Output Language Compatibility}.
16227
@item xi@angles{line break}
16228
The @samp{i} stands for @var{init}.
16230
Initialize device. This is the third command of the prologue.
16232
@item xp@angles{line break}
16233
The @samp{p} stands for @var{pause}.
16235
Parsed but ignored. The original @acronym{UNIX} troff manual writes
16238
pause device, can be restarted
16241
@item xr @var{n} @var{h} @var{v}@angles{line break}
16242
The @samp{r} stands for @var{resolution}.
16244
Resolution is@tie{}@var{n}, while @var{h} is the minimal horizontal
16245
motion, and @var{v} the minimal vertical motion possible with this
16246
device; all arguments are positive integers in basic units @samp{u} per
16247
inch. This is the second command of the prologue.
16249
@item xS @var{n}@angles{line break}
16250
The @samp{S} stands for @var{Slant}.
16252
Set slant to@tie{}@var{n} (an integer in basic units @samp{u}).
16254
@item xs@angles{line break}
16255
The @samp{s} stands for @var{stop}.
16257
Terminates the processing of the current file; issued as the last
16258
command of any intermediate troff output.
16260
@item xt@angles{line break}
16261
The @samp{t} stands for @var{trailer}.
16263
Generate trailer information, if any. In @var{gtroff}, this is actually
16266
@item xT @var{xxx}@angles{line break}
16267
The @samp{T} stands for @var{Typesetter}.
16269
Set name of device to word @var{xxx}, a sequence of characters ended by
16270
the next white space character. The possible device names coincide with
16271
those from the @code{groff} @option{-T} option. This is the first
16272
command of the prologue.
16274
@item xu @var{n}@angles{line break}
16275
The @samp{u} stands for @var{underline}.
16277
Configure underlining of spaces. If @var{n} is@tie{}1, start
16278
underlining of spaces; if @var{n} is@tie{}0, stop underlining of spaces.
16279
This is needed for the @code{cu} request in nroff mode and is ignored
16280
otherwise. This command is a @code{gtroff} extension.
16282
@item xX @var{anything}@angles{line break}
16283
The @samp{x} stands for @var{X-escape}.
16285
Send string @var{anything} uninterpreted to the device. If the line
16286
following this command starts with a @samp{+} character this line is
16287
interpreted as a continuation line in the following sense. The @samp{+}
16288
is ignored, but a newline character is sent instead to the device, the
16289
rest of the line is sent uninterpreted. The same applies to all
16290
following lines until the first character of a line is not a @samp{+}
16291
character. This command is generated by the @code{gtroff} escape
16292
sequence @code{\X}. The line-continuing feature is a @code{gtroff}
16296
@node Obsolete Command, , Device Control Commands, Command Reference
16297
@subsubsection Obsolete Command
16298
In @acronym{AT&T} @code{troff} output, the writing of a single glyph is
16299
mostly done by a very strange command that combines a horizontal move
16300
and a single character giving the glyph name. It doesn't have a command
16301
code, but is represented by a 3-character argument consisting of exactly
16302
2@tie{}digits and a character.
16305
@item @var{dd}@var{g}
16306
Move right @var{dd} (exactly two decimal digits) basic units @samp{u},
16307
then print glyph@tie{}@var{g} (represented as a single character).
16309
In @code{gtroff}, arbitrary syntactical space around and within this
16310
command is allowed to be added. Only when a preceding command on the
16311
same line ends with an argument of variable length a separating space is
16312
obligatory. In @acronym{AT&T} @code{troff}, large clusters of these and
16313
other commands are used, mostly without spaces; this made such output
16317
For modern high-resolution devices, this command does not make sense
16318
because the width of the glyphs can become much larger than two decimal
16319
digits. In @code{gtroff}, this is only used for the devices @code{X75},
16320
@code{X75-12}, @code{X100}, and @code{X100-12}. For other devices, the
16321
commands @samp{t} and @samp{u} provide a better functionality.
16323
@c ---------------------------------------------------------------------
16325
@node Intermediate Output Examples, Output Language Compatibility, Command Reference, gtroff Output
16326
@subsection Intermediate Output Examples
16328
This section presents the intermediate output generated from the same
16329
input for three different devices. The input is the sentence @samp{hell
16330
world} fed into @code{gtroff} on the command line.
16333
@item High-resolution device @code{ps}
16335
This is the standard output of @code{gtroff} if no @option{-T} option is
16340
shell> echo "hell world" | groff -Z -T ps
16366
This output can be fed into @code{grops} to get its representation as a
16367
@sc{PostScript} file.
16369
@item Low-resolution device @code{latin1}
16371
This is similar to the high-resolution device except that the
16372
positioning is done at a minor scale. Some comments (lines starting
16373
with @samp{#}) were added for clarification; they were not generated by
16378
shell> echo "hell world" | groff -Z -T latin1
16391
# initial positioning on the page
16394
# write text `hell'
16396
# inform about space, and issue a horizontal jump
16398
# write text `world'
16400
# announce line break, but do nothing because ...
16403
# ... the end of the document has been reached
16411
This output can be fed into @code{grotty} to get a formatted text
16414
@item @acronym{AT&T} @code{troff} output
16415
Since a computer monitor has a very low resolution compared to modern
16416
printers the intermediate output for the X@tie{}Window devices can use
16417
the jump-and-write command with its 2-digit displacements.
16421
shell> echo "hell world" | groff -Z -T X100
16433
# write text with jump-and-write commands
16434
ch07e07l03lw06w11o07r05l03dh7
16444
This output can be fed into @code{xditview} or @code{gxditview} for
16445
displaying in@tie{}X.
16447
Due to the obsolete jump-and-write command, the text clusters in the
16448
@acronym{AT&T} @code{troff} output are almost unreadable.
16451
@c ---------------------------------------------------------------------
16453
@node Output Language Compatibility, , Intermediate Output Examples, gtroff Output
16454
@subsection Output Language Compatibility
16456
The intermediate output language of @acronym{AT&T} @code{troff} was
16457
first documented in the @acronym{UNIX} troff manual, with later
16458
additions documented in @cite{A Typesetter-indenpendent TROFF}, written
16459
by Brian Kernighan.
16461
The @code{gtroff} intermediate output format is compatible with this
16462
specification except for the following features.
16466
The classical quasi device independence is not yet implemented.
16469
The old hardware was very different from what we use today. So the
16470
@code{groff} devices are also fundamentally different from the ones
16471
in @acronym{AT&T} @code{troff}. For example, the @acronym{AT&T}
16472
@sc{PostScript} device is called @code{post} and has a resolution of
16473
only 720 units per inch, suitable for printers 20 years ago, while
16474
@code{groff}'s @code{ps} device has a resolution of 72000 units per
16475
inch. Maybe, by implementing some rescaling mechanism similar to the
16476
classical quasi device independence, @code{groff} could emulate
16477
@acronym{AT&T}'s @code{post} device.
16480
The B-spline command @samp{D~} is correctly handled by the intermediate
16481
output parser, but the drawing routines aren't implemented in some of
16482
the postprocessor programs.
16485
The argument of the commands @samp{s} and @w{@samp{x H}} has the
16486
implicit unit scaled point @samp{z} in @code{gtroff}, while
16487
@acronym{AT&T} @code{troff} has point (@samp{p}). This isn't an
16488
incompatibility but a compatible extension, for both units coincide for
16489
all devices without a @code{sizescale} parameter in the @file{DESC}
16490
file, including all postprocessors from @acronym{AT&T} and
16491
@code{groff}'s text devices. The few @code{groff} devices with a
16492
@code{sizescale} parameter either do not exist for @acronym{AT&T}
16493
@code{troff}, have a different name, or seem to have a different
16494
resolution. So conflicts are very unlikely.
16497
The position changing after the commands @samp{Dp}, @samp{DP}, and
16498
@samp{Dt} is illogical, but as old versions of @code{gtroff} used this
16499
feature it is kept for compatibility reasons.
16502
Temporarily, there existed some confusion on the positioning after the
16503
@samp{D} commands that are groff extensions. This has been clarified by
16504
establishing the classical rule for all @code{groff} drawing commands:
16508
The position after a graphic object has been drawn is at its end; for
16509
circles and ellipses, the `end' is at the right side.
16512
From this, the positionings specified for the drawing commands above
16513
follow quite naturally.
16520
@c =====================================================================
16522
@node Font Files, , gtroff Output, File formats
16523
@section Font Files
16525
@cindex files, font
16527
The @code{gtroff} font format is roughly a superset of the
16528
@code{ditroff} font format (as used in later versions of @acronym{AT&T}
16529
@code{troff} and its descendants). Unlike the @code{ditroff} font
16530
format, there is no associated binary format; all files are text
16531
files.@footnote{Plan@tie{}9 @code{troff} has also abandoned the binary
16532
format.} The font files for device @var{name} are stored in a directory
16533
@file{dev@var{name}}. There are two types of file: a device description
16534
file called @file{DESC} and for each font@tie{}@var{f} a font file
16535
called@tie{}@file{@var{f}}.
16538
* DESC File Format::
16539
* Font File Format::
16542
@c ---------------------------------------------------------------------
16544
@node DESC File Format, Font File Format, Font Files, Font Files
16545
@subsection @file{DESC} File Format
16546
@cindex @file{DESC} file, format
16547
@cindex font description file, format
16548
@cindex format of font description file
16549
@pindex DESC@r{ file format}
16551
The @file{DESC} file can contain the following types of line. Except
16552
for the @code{charset} keyword which must comes last (if at all), the
16553
order of the lines is not important. Later entries in the file,
16554
however, override previous values.
16559
This line and everything following in the file are ignored. It is
16560
allowed for the sake of backwards compatibility.
16562
@item family @var{fam}
16564
The default font family is @var{fam}.
16566
@item fonts @var{n} @var{F1} @var{F2} @var{F3} @dots{} @var{Fn}
16568
Fonts @var{F1} @dots{} @var{Fn} are mounted in the font positions
16569
@var{m}+1, @dots{}, @var{m}+@var{n} where @var{m} is the number of
16570
styles. This command may extend over more than one line. A font name
16571
of@tie{}0 means no font is mounted on the corresponding font position.
16575
@cindex horizontal resolution
16576
@cindex resolution, horizontal
16577
The horizontal resolution is @var{n}@tie{}machine units. All horizontal
16578
quantities are rounded to be multiples of this value.
16580
@item image_generator @var{string}
16581
@kindex image_generator
16582
@cindex PostScript, PNG image generation
16583
@cindex PNG image generation from PostScript
16584
Needed for @code{grohtml} only. It specifies the program to generate
16585
PNG images from @sc{PostScript} input. Under GNU/Linux this is
16586
usually @code{gs} but under other systems (notably cygwin) it might
16587
be set to another name.
16589
@item paperlength @var{n}
16590
@kindex paperlength
16591
The physical vertical dimension of the output medium in machine units.
16592
This isn't used by @code{troff} itself but by output devices.
16593
Deprecated. Use @code{papersize} instead.
16595
@item papersize @var{string} @dots{}
16597
Select a paper size. Valid values for @var{string} are the ISO paper
16598
types @code{A0}-@code{A7}, @code{B0}-@code{B7}, @code{C0}-@code{C7},
16599
@code{D0}-@code{D7}, @code{DL}, and the US paper types @code{letter},
16600
@code{legal}, @code{tabloid}, @code{ledger}, @code{statement},
16601
@code{executive}, @code{com10}, and @code{monarch}. Case is not
16602
significant for @var{string} if it holds predefined paper types.
16603
Alternatively, @var{string} can be a file name (e.g.@:
16604
@file{/etc/papersize}); if the file can be opened, @code{groff} reads
16605
the first line and tests for the above paper sizes. Finally,
16606
@var{string} can be a custom paper size in the format
16607
@code{@var{length},@var{width}} (no spaces before and after the comma).
16608
Both @var{length} and @var{width} must have a unit appended; valid
16609
values are @samp{i} for inches, @samp{C} for centimeters, @samp{p} for
16610
points, and @samp{P} for picas. Example: @code{12c,235p}. An argument
16611
which starts with a digit is always treated as a custom paper format.
16612
@code{papersize} sets both the vertical and horizontal dimension of the
16615
More than one argument can be specified; @code{groff} scans from left to
16616
right and uses the first valid paper specification.
16618
@item paperwidth @var{n}
16620
The physical horizontal dimension of the output medium in machine units.
16621
This isn't used by @code{troff} itself but by output devices.
16622
Deprecated. Use @code{papersize} instead.
16624
@item pass_filenames
16625
@kindex pass_filenames
16626
Tell @code{gtroff} to emit the name of the source file currently being
16627
processed. This is achieved by the intermediate output command
16628
@samp{F}. Currently, this is only used by the @code{grohtml} output
16631
@item postpro @var{program}
16633
Call @var{program} as a postprocessor. For example, the line
16640
in the file @file{devdvi/DESC} makes @code{groff} call @code{grodvi} if
16641
option @option{-Tdvi} is given (and @option{-Z} isn't used).
16643
@item prepro @var{program}
16645
Call @var{program} as a preprocessor. Currently, this keyword is used
16646
by @code{groff} with option @option{-Thtml} or @option{-Txhtml} only.
16648
@item print @var{program}
16650
Use @var{program} as a spooler program for printing. If omitted, the
16651
@option{-l} and @option{-L} options of @code{groff} are ignored.
16655
@cindex device resolution
16656
@cindex resolution, device
16657
There are @var{n}@tie{}machine units per inch.
16659
@item sizes @var{s1} @var{s2} @dots{} @var{sn} 0
16661
This means that the device has fonts at @var{s1}, @var{s2}, @dots{}
16662
@var{sn} scaled points. The list of sizes must be terminated by@tie{}0
16663
(this is digit zero). Each @var{si} can also be a range of sizes
16664
@var{m}-@var{n}. The list can extend over more than one line.
16666
@item sizescale @var{n}
16668
The scale factor for point sizes. By default this has a value
16669
of@tie{}1. One scaled point is equal to one point/@var{n}. The
16670
arguments to the @code{unitwidth} and @code{sizes} commands are given in
16671
scaled points. @xref{Fractional Type Sizes}, for more information.
16673
@item styles @var{S1} @var{S2} @dots{} @var{Sm}
16675
The first @var{m}@tie{}font positions are associated with styles
16676
@var{S1} @dots{} @var{Sm}.
16680
This means that the postprocessor can handle the @samp{t} and @samp{u}
16681
intermediate output commands.
16685
Indicate that the output device supports the complete Unicode
16686
repertoire. Useful only for devices which produce @emph{character
16687
entities} instead of glyphs.
16689
If @code{unicode} is present, no @code{charset} section is required in
16690
the font description files since the Unicode handling built into
16691
@code{groff} is used. However, if there are entries in a @code{charset}
16692
section, they either override the default mappings for those particular
16693
characters or add new mappings (normally for composite characters).
16695
This is used for @option{-Tutf8}, @option{-Thtml}, and @option{-Txhtml}.
16697
@item unitwidth @var{n}
16699
Quantities in the font files are given in machine units for fonts whose
16700
point size is @var{n}@tie{}scaled points.
16702
@item unscaled_charwidths
16703
@kindex unscaled_charwidths
16704
Make the font handling module always return unscaled character widths.
16705
Needed for the @code{grohtml} device.
16706
@item use_charnames_in_special
16707
@kindex use_charnames_in_special
16708
This command indicates that @code{gtroff} should encode special
16709
characters inside special commands. Currently, this is only used by the
16710
@code{grohtml} output device. @xref{Postprocessor Access}.
16714
@cindex vertical resolution
16715
@cindex resolution, vertical
16716
The vertical resolution is @var{n}@tie{}machine units. All vertical
16717
quantities are rounded to be multiples of this value.
16720
The @code{res}, @code{unitwidth}, @code{fonts}, and @code{sizes} lines
16721
are mandatory. Other commands are ignored by @code{gtroff} but may be
16722
used by postprocessors to store arbitrary information about the device
16723
in the @file{DESC} file.
16727
@kindex biggestfont
16728
Here a list of obsolete keywords which are recognized by @code{groff}
16729
but completely ignored: @code{spare1}, @code{spare2},
16730
@code{biggestfont}.
16732
@c ---------------------------------------------------------------------
16734
@node Font File Format, , DESC File Format, Font Files
16735
@subsection Font File Format
16736
@cindex font file, format
16737
@cindex font description file, format
16738
@cindex format of font files
16739
@cindex format of font description files
16741
A @dfn{font file}, also (and probably better) called a @dfn{font
16742
description file}, has two sections. The first section is a sequence of
16743
lines each containing a sequence of blank delimited words; the first
16744
word in the line is a key, and subsequent words give a value for that
16750
The name of the font is@tie{}@var{f}.
16752
@item spacewidth @var{n}
16754
The normal width of a space is@tie{}@var{n}.
16756
@item slant @var{n}
16758
The glyphs of the font have a slant of @var{n}@tie{}degrees. (Positive
16761
@item ligatures @var{lig1} @var{lig2} @dots{} @var{lign} [0]
16763
Glyphs @var{lig1}, @var{lig2}, @dots{}, @var{lign} are ligatures;
16764
possible ligatures are @samp{ff}, @samp{fi}, @samp{fl}, @samp{ffi} and
16765
@samp{ffl}. For backwards compatibility, the list of ligatures may be
16766
terminated with a@tie{}0. The list of ligatures may not extend over
16767
more than one line.
16770
@cindex special fonts
16772
The font is @dfn{special}; this means that when a glyph is requested
16773
that is not present in the current font, it is searched for in any
16774
special fonts that are mounted.
16777
Other commands are ignored by @code{gtroff} but may be used by
16778
postprocessors to store arbitrary information about the font in the font
16781
@cindex comments in font files
16782
@cindex font files, comments
16784
The first section can contain comments which start with the @samp{#}
16785
character and extend to the end of a line.
16787
The second section contains one or two subsections. It must contain a
16788
@code{charset} subsection and it may also contain a @code{kernpairs}
16789
subsection. These subsections can appear in any order. Each subsection
16790
starts with a word on a line by itself.
16793
The word @code{charset} starts the character set
16794
subsection.@footnote{This keyword is misnamed since it starts a list of
16795
ordered glyphs, not characters.} The @code{charset} line is followed by
16796
a sequence of lines. Each line gives information for one glyph. A line
16797
comprises a number of fields separated by blanks or tabs. The format is
16800
@var{name} @var{metrics} @var{type} @var{code} [@var{entity-name}]
16801
[@code{--} @var{comment}]
16804
@cindex 8-bit input
16805
@cindex input, 8-bit
16806
@cindex accessing unnamed glyphs with @code{\N}
16807
@cindex unnamed glyphs, accessing with @code{\N}
16808
@cindex characters, unnamed, accessing with @code{\N}
16809
@cindex glyphs, unnamed, accessing with @code{\N}
16812
@var{name} identifies the glyph name@footnote{The distinction between
16813
input, characters, and output, glyphs, is not clearly separated in the
16814
terminology of @code{groff}; for example, the @code{char} request should
16815
be called @code{glyph} since it defines an output entity.}: If
16816
@var{name} is a single character@tie{}@var{c} then it corresponds to the
16817
@code{gtroff} input character@tie{}@var{c}; if it is of the form
16818
@samp{\@var{c}} where @var{c} is a single character, then it corresponds
16819
to the special character @code{\[@var{c}]}; otherwise it corresponds to
16820
the special character @samp{\[@var{name}]}. If it is exactly two
16821
characters @var{xx} it can be entered as @samp{\(@var{xx}}. Note that
16822
single-letter special characters can't be accessed as @samp{\@var{c}};
16823
the only exception is @samp{\-} which is identical to @code{\[-]}.
16825
@code{gtroff} supports 8-bit input characters; however some utilities
16826
have difficulties with eight-bit characters. For this reason, there is
16827
a convention that the entity name @samp{char@var{n}} is equivalent to
16828
the single input character whose code is@tie{}@var{n}. For example,
16829
@samp{char163} would be equivalent to the character with code@tie{}163
16830
which is the pounds sterling sign in the ISO@tie{}@w{Latin-1} character
16831
set. You shouldn't use @samp{char@var{n}} entities in font description
16832
files since they are related to input, not output. Otherwise, you get
16833
hard-coded connections between input and output encoding which prevents
16834
use of different (input) character sets.
16836
The name @samp{---} is special and indicates that the glyph is unnamed;
16837
such glyphs can only be used by means of the @code{\N} escape sequence
16840
The @var{type} field gives the glyph type:
16844
the glyph has a descender, for example, @samp{p};
16847
the glyph has an ascender, for example, @samp{b};
16850
the glyph has both an ascender and a descender, for example, @samp{(}.
16853
The @var{code} field gives the code which the postprocessor uses to
16854
print the glyph. The glyph can also be input to @code{gtroff} using
16855
this code by means of the @code{\N} escape sequence. @var{code} can be
16856
any integer. If it starts with @samp{0} it is interpreted as octal; if
16857
it starts with @samp{0x} or @samp{0X} it is interpreted as hexadecimal.
16858
Note, however, that the @code{\N} escape sequence only accepts a decimal
16861
The @var{entity-name} field gives an @acronym{ASCII} string identifying
16862
the glyph which the postprocessor uses to print the @code{gtroff} glyph
16863
@var{name}. This field is optional and has been introduced so that the
16864
@code{grohtml} device driver can encode its character set. For example,
16865
the glyph @samp{\[Po]} is represented as @samp{£} in
16866
@acronym{HTML} 4.0.
16868
Anything on the line after the @var{entity-name} field resp.@: after
16869
@samp{--} is ignored.
16871
The @var{metrics} field has the form:
16875
@var{width}[@code{,}@var{height}[@code{,}@var{depth}[@code{,}@var{italic-correction}
16876
[@code{,}@var{left-italic-correction}[@code{,}@var{subscript-correction}]]]]]
16881
There must not be any spaces between these subfields (it has been split
16882
here into two lines for better legibility only). Missing subfields are
16883
assumed to be@tie{}0. The subfields are all decimal integers. Since
16884
there is no associated binary format, these values are not required to
16885
fit into a variable of type @samp{char} as they are in @code{ditroff}.
16886
The @var{width} subfield gives the width of the glyph. The @var{height}
16887
subfield gives the height of the glyph (upwards is positive); if a glyph
16888
does not extend above the baseline, it should be given a zero height,
16889
rather than a negative height. The @var{depth} subfield gives the depth
16890
of the glyph, that is, the distance from the baseline to the lowest
16891
point below the baseline to which the glyph extends (downwards is
16892
positive); if a glyph does not extend below the baseline, it should be
16893
given a zero depth, rather than a negative depth. The
16894
@var{italic-correction} subfield gives the amount of space that should
16895
be added after the glyph when it is immediately to be followed by a
16896
glyph from a roman font. The @var{left-italic-correction} subfield
16897
gives the amount of space that should be added before the glyph when it
16898
is immediately to be preceded by a glyph from a roman font. The
16899
@var{subscript-correction} gives the amount of space that should be
16900
added after a glyph before adding a subscript. This should be less than
16901
the italic correction.
16903
A line in the @code{charset} section can also have the format
16910
This indicates that @var{name} is just another name for the glyph
16911
mentioned in the preceding line.
16914
The word @code{kernpairs} starts the kernpairs section. This contains a
16915
sequence of lines of the form:
16918
@var{c1} @var{c2} @var{n}
16922
This means that when glyph @var{c1} appears next to glyph @var{c2} the
16923
space between them should be increased by@tie{}@var{n}. Most entries in
16924
the kernpairs section have a negative value for@tie{}@var{n}.
16928
@c =====================================================================
16929
@c =====================================================================
16931
@node Installation, Copying This Manual, File formats, Top
16932
@chapter Installation
16933
@cindex installation
16939
@c =====================================================================
16940
@c =====================================================================
16942
@node Copying This Manual, Request Index, Installation, Top
16943
@appendix Copying This Manual
16949
@c =====================================================================
16950
@c =====================================================================
16952
@node Request Index, Escape Index, Copying This Manual, Top
16953
@appendix Request Index
16955
Requests appear without the leading control character (normally either
16956
@samp{.} or @samp{'}).
16962
@c =====================================================================
16963
@c =====================================================================
16965
@node Escape Index, Operator Index, Request Index, Top
16966
@appendix Escape Index
16968
Any escape sequence @code{\@var{X}} with @var{X} not in the list below
16969
emits a warning, printing glyph @var{X}.
16975
@c =====================================================================
16976
@c =====================================================================
16978
@node Operator Index, Register Index, Escape Index, Top
16979
@appendix Operator Index
16985
@c =====================================================================
16986
@c =====================================================================
16988
@node Register Index, Macro Index, Operator Index, Top
16989
@appendix Register Index
16991
The macro package or program a specific register belongs to is appended in
16994
A register name@tie{}@code{x} consisting of exactly one character can be
16995
accessed as @samp{\nx}. A register name @code{xx} consisting of exactly
16996
two characters can be accessed as @samp{\n(xx}. Register names
16997
@code{xxx} of any length can be accessed as @samp{\n[xxx]}.
17003
@c =====================================================================
17004
@c =====================================================================
17006
@node Macro Index, String Index, Register Index, Top
17007
@appendix Macro Index
17009
The macro package a specific macro belongs to is appended in brackets.
17010
They appear without the leading control character (normally @samp{.}).
17016
@c =====================================================================
17017
@c =====================================================================
17019
@node String Index, Glyph Name Index, Macro Index, Top
17020
@appendix String Index
17022
The macro package or program a specific string belongs to is appended in
17025
A string name@tie{}@code{x} consisting of exactly one character can be
17026
accessed as @samp{\*x}. A string name @code{xx} consisting of exactly
17027
two characters can be accessed as @samp{\*(xx}. String names @code{xxx}
17028
of any length can be accessed as @samp{\*[xxx]}.
17035
@c =====================================================================
17036
@c =====================================================================
17038
@node Glyph Name Index, Font File Keyword Index, String Index, Top
17039
@appendix Glyph Name Index
17041
A glyph name @code{xx} consisting of exactly two characters can be
17042
accessed as @samp{\(xx}. Glyph names @code{xxx} of any length can be
17043
accessed as @samp{\[xxx]}.
17049
@c =====================================================================
17050
@c =====================================================================
17052
@node Font File Keyword Index, Program and File Index, Glyph Name Index, Top
17053
@appendix Font File Keyword Index
17059
@c =====================================================================
17060
@c =====================================================================
17062
@node Program and File Index, Concept Index, Font File Keyword Index, Top
17063
@appendix Program and File Index
17069
@c =====================================================================
17070
@c =====================================================================
17072
@node Concept Index, , Program and File Index, Top
17073
@appendix Concept Index
17080
@c Local Variables: