]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/groff/doc/groff-1
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / groff / doc / groff-1
1 This is groff, produced by makeinfo version 4.8 from ./groff.texinfo.
2
3    This manual documents GNU `troff' version 1.19.2.
4
5    Copyright (C) 1994-2000, 2001, 2002, 2003, 2004, 2005 Free Software
6 Foundation, Inc.
7
8      Permission is granted to copy, distribute and/or modify this
9      document under the terms of the GNU Free Documentation License,
10      Version 1.1 or any later version published by the Free Software
11      Foundation; with no Invariant Sections, with the Front-Cover texts
12      being `A GNU Manual," and with the Back-Cover Texts as in (a)
13      below.  A copy of the license is included in the section entitled
14      `GNU Free Documentation License."
15
16      (a) The FSF's Back-Cover Text is: `You have freedom to copy and
17      modify this GNU Manual, like GNU software.  Copies published by
18      the Free Software Foundation raise funds for GNU development."
19
20 INFO-DIR-SECTION Typesetting
21 START-INFO-DIR-ENTRY
22 * Groff: (groff).               The GNU troff document formatting system.
23 END-INFO-DIR-ENTRY
24
25 \1f
26 File: groff,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
27
28 GNU troff
29 *********
30
31 This manual documents GNU `troff' version 1.19.2.
32
33    Copyright (C) 1994-2000, 2001, 2002, 2003, 2004, 2005 Free Software
34 Foundation, Inc.
35
36      Permission is granted to copy, distribute and/or modify this
37      document under the terms of the GNU Free Documentation License,
38      Version 1.1 or any later version published by the Free Software
39      Foundation; with no Invariant Sections, with the Front-Cover texts
40      being `A GNU Manual," and with the Back-Cover Texts as in (a)
41      below.  A copy of the license is included in the section entitled
42      `GNU Free Documentation License."
43
44      (a) The FSF's Back-Cover Text is: `You have freedom to copy and
45      modify this GNU Manual, like GNU software.  Copies published by
46      the Free Software Foundation raise funds for GNU development."
47
48 * Menu:
49
50 * Introduction::
51 * Invoking groff::
52 * Tutorial for Macro Users::
53 * Macro Packages::
54 * gtroff Reference::
55 * Preprocessors::
56 * Output Devices::
57 * File formats::
58 * Installation::
59 * Copying This Manual::
60 * Request Index::
61 * Escape Index::
62 * Operator Index::
63 * Register Index::
64 * Macro Index::
65 * String Index::
66 * Glyph Name Index::
67 * Font File Keyword Index::
68 * Program and File Index::
69 * Concept Index::
70
71 \1f
72 File: groff,  Node: Introduction,  Next: Invoking groff,  Prev: Top,  Up: Top
73
74 1 Introduction
75 **************
76
77 GNU `troff' (or `groff') is a system for typesetting documents.
78 `troff' is very flexible and has been in existence (and use) for about
79 3 decades.  It is quite widespread and firmly entrenched in the UNIX
80 community.
81
82 * Menu:
83
84 * What Is groff?::
85 * History::
86 * groff Capabilities::
87 * Macro Package Intro::
88 * Preprocessor Intro::
89 * Output device intro::
90 * Credits::
91
92 \1f
93 File: groff,  Node: What Is groff?,  Next: History,  Prev: Introduction,  Up: Introduction
94
95 1.1 What Is `groff'?
96 ====================
97
98 `groff' belongs to an older generation of document preparation systems,
99 which operate more like compilers than the more recent interactive
100 WYSIWYG(1) (*note What Is groff?-Footnote-1::) systems.  `groff' and
101 its contemporary counterpart, TeX, both work using a "batch" paradigm:
102 The input (or "source") files are normal text files with embedded
103 formatting commands.  These files can then be processed by `groff' to
104 produce a typeset document on a variety of devices.
105
106    Likewise, `groff' should not be confused with a "word processor",
107 since that term connotes an integrated system that includes an editor
108 and a text formatter.  Also, many word processors follow the WYSIWYG
109 paradigm discussed earlier.
110
111    Although WYSIWYG systems may be easier to use, they have a number of
112 disadvantages compared to `troff':
113
114    * They must be used on a graphics display to work on a document.
115
116    * Most of the WYSIWYG systems are either non-free or are not very
117      portable.
118
119    * `troff' is firmly entrenched in all UNIX systems.
120
121    * It is difficult to have a wide range of capabilities available
122      within the confines of a GUI/window system.
123
124    * It is more difficult to make global changes to a document.
125
126      "GUIs normally make it simple to accomplish simple actions and
127      impossible to accomplish complex actions."  -Doug Gwyn (22/Jun/91
128      in `comp.unix.wizards')
129
130 \1f
131 File: groff,  Node: What Is groff?-Footnotes,  Up: What Is groff?
132
133    (1) What You See Is What You Get
134
135 \1f
136 File: groff,  Node: History,  Next: groff Capabilities,  Prev: What Is groff?,  Up: Introduction
137
138 1.2 History
139 ===========
140
141 `troff' can trace its origins back to a formatting program called
142 `runoff', written by J. E. Saltzer, which ran on MIT's CTSS operating
143 system in the mid-sixties.  This name came from the common phrase of
144 the time "I'll run off a document."  Bob Morris ported it to the 635
145 architecture and called the program `roff' (an abbreviation of
146 `runoff').  It was rewritten as `rf' for the PDP-7 (before having
147 UNIX), and at the same time (1969), Doug McIllroy rewrote an extended
148 and simplified version of `roff' in the BCPL programming language.
149
150    The first version of UNIX was developed on a PDP-7 which was sitting
151 around Bell Labs.  In 1971 the developers wanted to get a PDP-11 for
152 further work on the operating system.  In order to justify the cost for
153 this system, they proposed that they would implement a document
154 formatting system for the AT&T patents division.  This first formatting
155 program was a reimplementation of McIllroy's `roff', written by
156 J. F. Ossanna.
157
158    When they needed a more flexible language, a new version of `roff'
159 called `nroff' ("Newer `roff'") was written.  It had a much more
160 complicated syntax, but provided the basis for all future versions.
161 When they got a Graphic Systems CAT Phototypesetter, Ossanna wrote a
162 version of `nroff' that would drive it.  It was dubbed `troff', for
163 "typesetter `roff'", although many people have speculated that it
164 actually means "Times `roff'" because of the use of the Times font
165 family in `troff' by default.  As such, the name `troff' is pronounced
166 `t-roff' rather than `trough'.
167
168    With `troff' came `nroff' (they were actually the same program
169 except for some `#ifdef's), which was for producing output for line
170 printers and character terminals.  It understood everything `troff'
171 did, and ignored the commands which were not applicable (e.g. font
172 changes).
173
174    Since there are several things which cannot be done easily in
175 `troff', work on several preprocessors began.  These programs would
176 transform certain parts of a document into `troff', which made a very
177 natural use of pipes in UNIX.
178
179    The `eqn' preprocessor allowed mathematical formulæ to be specified
180 in a much simpler and more intuitive manner.  `tbl' is a preprocessor
181 for formatting tables.  The `refer' preprocessor (and the similar
182 program, `bib') processes citations in a document according to a
183 bibliographic database.
184
185    Unfortunately, Ossanna's `troff' was written in PDP-11 assembly
186 language and produced output specifically for the CAT phototypesetter.
187 He rewrote it in C, although it was now 7000 lines of uncommented code
188 and still dependent on the CAT.  As the CAT became less common, and was
189 no longer supported by the manufacturer, the need to make it support
190 other devices became a priority.  However, before this could be done,
191 Ossanna was killed in a car accident.
192
193    So, Brian Kernighan took on the task of rewriting `troff'.  The
194 newly rewritten version produced device independent code which was very
195 easy for postprocessors to read and translate to the appropriate
196 printer codes.  Also, this new version of `troff' (called `ditroff' for
197 "device independent `troff'") had several extensions, which included
198 drawing functions.
199
200    Due to the additional abilities of the new version of `troff',
201 several new preprocessors appeared.  The `pic' preprocessor provides a
202 wide range of drawing functions.  Likewise the `ideal' preprocessor did
203 the same, although via a much different paradigm.  The `grap'
204 preprocessor took specifications for graphs, but, unlike other
205 preprocessors, produced `pic' code.
206
207    James Clark began work on a GNU implementation of `ditroff' in
208 early 1989.  The first version, `groff' 0.3.1, was released June 1990.
209 `groff' included:
210
211    * A replacement for `ditroff' with many extensions.
212
213    * The `soelim', `pic', `tbl', and `eqn' preprocessors.
214
215    * Postprocessors for character devices, POSTSCRIPT, TeX DVI, and
216      X Windows.  GNU `troff' also eliminated the need for a separate
217      `nroff' program with a postprocessor which would produce ASCII
218      output.
219
220    * A version of the `me' macros and an implementation of the `man'
221      macros.
222
223    Also, a front-end was included which could construct the, sometimes
224 painfully long, pipelines required for all the post- and preprocessors.
225
226    Development of GNU `troff' progressed rapidly, and saw the additions
227 of a replacement for `refer', an implementation of the `ms' and `mm'
228 macros, and a program to deduce how to format a document (`grog').
229
230    It was declared a stable (i.e. non-beta) package with the release of
231 version 1.04 around November 1991.
232
233    Beginning in 1999, `groff' has new maintainers (the package was an
234 orphan for a few years).  As a result, new features and programs like
235 `grn', a preprocessor for gremlin images, and an output device to
236 produce HTML output have been added.
237
238 \1f
239 File: groff,  Node: groff Capabilities,  Next: Macro Package Intro,  Prev: History,  Up: Introduction
240
241 1.3 `groff' Capabilities
242 ========================
243
244 So what exactly is `groff' capable of doing?  `groff' provides a wide
245 range of low-level text formatting operations.  Using these, it is
246 possible to perform a wide range of formatting tasks, such as
247 footnotes, table of contents, multiple columns, etc.  Here's a list of
248 the most important operations supported by `groff':
249
250    * text filling, adjusting, and centering
251
252    * hyphenation
253
254    * page control
255
256    * font and glyph size control
257
258    * vertical spacing (e.g. double-spacing)
259
260    * line length and indenting
261
262    * macros, strings, diversions, and traps
263
264    * number registers
265
266    * tabs, leaders, and fields
267
268    * input and output conventions and character translation
269
270    * overstrike, bracket, line drawing, and zero-width functions
271
272    * local horizontal and vertical motions and the width function
273
274    * three-part titles
275
276    * output line numbering
277
278    * conditional acceptance of input
279
280    * environment switching
281
282    * insertions from the standard input
283
284    * input/output file switching
285
286    * output and error messages
287
288 \1f
289 File: groff,  Node: Macro Package Intro,  Next: Preprocessor Intro,  Prev: groff Capabilities,  Up: Introduction
290
291 1.4 Macro Packages
292 ==================
293
294 Since `groff' provides such low-level facilities, it can be quite
295 difficult to use by itself.  However, `groff' provides a "macro"
296 facility to specify how certain routine operations (e.g. starting
297 paragraphs, printing headers and footers, etc.)  should be done.  These
298 macros can be collected together into a "macro package".  There are a
299 number of macro packages available; the most common (and the ones
300 described in this manual) are `man', `mdoc', `me', `ms', and `mm'.
301
302 \1f
303 File: groff,  Node: Preprocessor Intro,  Next: Output device intro,  Prev: Macro Package Intro,  Up: Introduction
304
305 1.5 Preprocessors
306 =================
307
308 Although `groff' provides most functions needed to format a document,
309 some operations would be unwieldy (e.g. to draw pictures).  Therefore,
310 programs called "preprocessors" were written which understand their own
311 language and produce the necessary `groff' operations.  These
312 preprocessors are able to differentiate their own input from the rest
313 of the document via markers.
314
315    To use a preprocessor, UNIX pipes are used to feed the output from
316 the preprocessor into `groff'.  Any number of preprocessors may be used
317 on a given document; in this case, the preprocessors are linked
318 together into one pipeline.  However, with `groff', the user does not
319 need to construct the pipe, but only tell `groff' what preprocessors to
320 use.
321
322    `groff' currently has preprocessors for producing tables (`tbl'),
323 typesetting equations (`eqn'), drawing pictures (`pic' and `grn'), and
324 for processing bibliographies (`refer').  An associated program which
325 is useful when dealing with preprocessors is `soelim'.
326
327    A free implementation of `grap', a preprocessor for drawing graphs,
328 can be obtained as an extra package; `groff' can use `grap' also.
329
330    There are other preprocessors in existence, but, unfortunately, no
331 free implementations are available.  Among them are preprocessors for
332 drawing mathematical pictures (`ideal') and chemical structures
333 (`chem').
334
335 \1f
336 File: groff,  Node: Output device intro,  Next: Credits,  Prev: Preprocessor Intro,  Up: Introduction
337
338 1.6 Output Devices
339 ==================
340
341 `groff' actually produces device independent code which may be fed into
342 a postprocessor to produce output for a particular device.  Currently,
343 `groff' has postprocessors for POSTSCRIPT devices, character terminals,
344 X Windows (for previewing), TeX DVI format, HP LaserJet 4 and Canon LBP
345 printers (which use CAPSL), and HTML.
346
347 \1f
348 File: groff,  Node: Credits,  Prev: Output device intro,  Up: Introduction
349
350 1.7 Credits
351 ===========
352
353 Large portions of this manual were taken from existing documents, most
354 notably, the manual pages for the `groff' package by James Clark, and
355 Eric Allman's papers on the `me' macro package.
356
357    The section on the `man' macro package is partly based on Susan G.
358 Kleinmann's `groff_man' manual page written for the Debian GNU/Linux
359 system.
360
361    Larry Kollar contributed the section in the `ms' macro package.
362
363 \1f
364 File: groff,  Node: Invoking groff,  Next: Tutorial for Macro Users,  Prev: Introduction,  Up: Top
365
366 2 Invoking `groff'
367 ******************
368
369 This section focuses on how to invoke the `groff' front end.  This
370 front end takes care of the details of constructing the pipeline among
371 the preprocessors, `gtroff' and the postprocessor.
372
373    It has become a tradition that GNU programs get the prefix `g' to
374 distinguish it from its original counterparts provided by the host (see
375 *Note Environment::, for more details).  Thus, for example, `geqn' is
376 GNU `eqn'.  On operating systems like GNU/Linux or the Hurd, which
377 don't contain proprietary versions of `troff', and on
378 MS-DOS/MS-Windows, where `troff' and associated programs are not
379 available at all, this prefix is omitted since GNU `troff' is the only
380 used incarnation of `troff'.  Exception: `groff' is never replaced by
381 `roff'.
382
383    In this document, we consequently say `gtroff' when talking about
384 the GNU `troff' program.  All other implementations of `troff' are
385 called AT&T `troff' which is the common origin of all `troff' derivates
386 (with more or less compatible changes).  Similarly, we say `gpic',
387 `geqn', etc.
388
389 * Menu:
390
391 * Groff Options::
392 * Environment::
393 * Macro Directories::
394 * Font Directories::
395 * Paper Size::
396 * Invocation Examples::
397
398 \1f
399 File: groff,  Node: Groff Options,  Next: Environment,  Prev: Invoking groff,  Up: Invoking groff
400
401 2.1 Options
402 ===========
403
404 `groff' normally runs the `gtroff' program and a postprocessor
405 appropriate for the selected device.  The default device is `ps' (but
406 it can be changed when `groff' is configured and built).  It can
407 optionally preprocess with any of `gpic', `geqn', `gtbl', `ggrn',
408 `grap', `grefer', or `gsoelim'.
409
410    This section only documents options to the `groff' front end.  Many
411 of the arguments to `groff' are passed on to `gtroff', therefore those
412 are also included.  Arguments to pre- or postprocessors can be found in
413 *Note Invoking gpic::, *Note Invoking geqn::, *Note Invoking gtbl::,
414 *Note Invoking ggrn::, *Note Invoking grefer::, *Note Invoking
415 gsoelim::, *Note Invoking grotty::, *Note Invoking grops::, *Note
416 Invoking grohtml::, *Note Invoking grodvi::, *Note Invoking grolj4::,
417 *Note Invoking grolbp::, and *Note Invoking gxditview::.
418
419    The command line format for `groff' is:
420
421
422      groff [ -abceghilpstvzCEGNRSUVXZ ] [ -FDIR ] [ -mNAME ]
423            [ -TDEF ] [ -fFAM ] [ -wNAME ] [ -WNAME ]
424            [ -MDIR ] [ -dCS ] [ -rCN ] [ -nNUM ]
425            [ -oLIST ] [ -PARG ] [ -LARG ] [ -IDIR ]
426            [ FILES... ]
427
428    The command line format for `gtroff' is as follows.
429
430
431      gtroff [ -abcivzCERU ] [ -wNAME ] [ -WNAME ] [ -dCS ]
432             [ -fFAM ] [ -mNAME ] [ -nNUM ]
433             [ -oLIST ] [ -rCN ] [ -TNAME ]
434             [ -FDIR ] [ -MDIR ] [ FILES... ]
435
436 Obviously, many of the options to `groff' are actually passed on to
437 `gtroff'.
438
439    Options without an argument can be grouped behind a single `-'.  A
440 filename of `-' denotes the standard input.  It is possible to have
441 whitespace between an option and its parameter.
442
443    The `grog' command can be used to guess the correct `groff' command
444 to format a file.
445
446    Here's the description of the command-line options:
447
448 `-h'
449      Print a help message.
450
451 `-e'
452      Preprocess with `geqn'.
453
454 `-t'
455      Preprocess with `gtbl'.
456
457 `-g'
458      Preprocess with `ggrn'.
459
460 `-G'
461      Preprocess with `grap'.
462
463 `-p'
464      Preprocess with `gpic'.
465
466 `-s'
467      Preprocess with `gsoelim'.
468
469 `-c'
470      Suppress color output.
471
472 `-R'
473      Preprocess with `grefer'.  No mechanism is provided for passing
474      arguments to `grefer' because most `grefer' options have
475      equivalent commands which can be included in the file.  *Note
476      grefer::, for more details.
477
478      Note that `gtroff' also accepts a `-R' option, which is not
479      accessible via `groff'.  This option prevents the loading of the
480      `troffrc' and `troffrc-end' files.
481
482 `-v'
483      Make programs run by `groff' print out their version number.
484
485 `-V'
486      Print the pipeline on `stdout' instead of executing it.  If
487      specified more than once, print the pipeline on `stderr' and
488      execute it.
489
490 `-z'
491      Suppress output from `gtroff'.  Only error messages are printed.
492
493 `-Z'
494      Do not postprocess the output of `gtroff'.  Normally `groff'
495      automatically runs the appropriate postprocessor.
496
497 `-PARG'
498      Pass ARG to the postprocessor.  Each argument should be passed
499      with a separate `-P' option.  Note that `groff' does not prepend
500      `-' to ARG before passing it to the postprocessor.
501
502 `-l'
503      Send the output to a spooler for printing.  The command used for
504      this is specified by the `print' command in the device description
505      file (see *Note Font Files::, for more info).  If not present,
506      `-l' is ignored.
507
508 `-LARG'
509      Pass ARG to the spooler.  Each argument should be passed with a
510      separate `-L' option.  Note that `groff' does not prepend a `-' to
511      ARG before passing it to the postprocessor.  If the `print'
512      keyword in the device description file is missing, `-L' is ignored.
513
514 `-TDEV'
515      Prepare output for device DEV.  The default device is `ps', unless
516      changed when `groff' was configured and built.  The following are
517      the output devices currently available:
518
519     `ps'
520           For POSTSCRIPT printers and previewers.
521
522     `dvi'
523           For TeX DVI format.
524
525     `X75'
526           For a 75dpi X11 previewer.
527
528     `X75-12'
529           For a 75dpi X11 previewer with a 12pt base font in the
530           document.
531
532     `X100'
533           For a 100dpi X11 previewer.
534
535     `X100-12'
536           For a 100dpi X11 previewer with a 12pt base font in the
537           document.
538
539     `ascii'
540           For typewriter-like devices using the (7-bit) ASCII character
541           set.
542
543     `latin1'
544           For typewriter-like devices that support the Latin-1
545           (ISO 8859-1) character set.
546
547     `utf8'
548           For typewriter-like devices which use the Unicode (ISO 10646)
549           character set with UTF-8 encoding.
550
551     `cp1047'
552           For typewriter-like devices which use the EBCDIC encoding IBM
553           cp1047.
554
555     `lj4'
556           For HP LaserJet4-compatible (or other PCL5-compatible)
557           printers.
558
559     `lbp'
560           For Canon CAPSL printers (LBP-4 and LBP-8 series laser
561           printers).
562
563     `html'
564           To produce HTML output.  Note that the HTML driver consists
565           of two parts, a preprocessor (`pre-grohtml') and a
566           postprocessor (`post-grohtml').
567
568      The predefined `gtroff' string register `.T' contains the current
569      output device; the read-only number register `.T' is set to 1 if
570      this option is used (which is always true if `groff' is used to
571      call `gtroff').  *Note Built-in Registers::.
572
573      The postprocessor to be used for a device is specified by the
574      `postpro' command in the device description file.  (*Note Font
575      Files::, for more info.)  This can be overridden with the `-X'
576      option.
577
578 `-X'
579      Preview with `gxditview' instead of using the usual postprocessor.
580      This is unlikely to produce good results except with `-Tps'.
581
582      Note that this is not the same as using `-TX75' or `-TX100' to
583      view a document with `gxditview': The former uses the metrics of
584      the specified device, whereas the latter uses X-specific fonts and
585      metrics.
586
587 `-N'
588      Don't allow newlines with `eqn' delimiters.  This is the same as
589      the `-N' option in `geqn'.
590
591 `-S'
592      Safer mode.  Pass the `-S' option to `gpic' and disable the
593      `open', `opena', `pso', `sy', and `pi' requests.  For security
594      reasons, this is enabled by default.
595
596 `-U'
597      Unsafe mode.  This enables the `open', `opena', `pso', `sy', and
598      `pi' requests.
599
600 `-a'
601      Generate an ASCII approximation of the typeset output.  The
602      read-only register `.A' is then set to 1.  *Note Built-in
603      Registers::.  A typical example is
604
605
606           groff -a -man -Tdvi troff.man | less
607
608      which shows how lines are broken for the DVI device.  Note that
609      this option is rather useless today since graphic output devices
610      are available virtually everywhere.
611
612 `-b'
613      Print a backtrace with each warning or error message.  This
614      backtrace should help track down the cause of the error.  The line
615      numbers given in the backtrace may not always be correct: `gtroff'
616      can get confused by `as' or `am' requests while counting line
617      numbers.
618
619 `-i'
620      Read the standard input after all the named input files have been
621      processed.
622
623 `-wNAME'
624      Enable warning NAME.  Available warnings are described in *Note
625      Debugging::.  Multiple `-w' options are allowed.
626
627 `-WNAME'
628      Inhibit warning NAME.  Multiple `-W' options are allowed.
629
630 `-E'
631      Inhibit all error messages.
632
633 `-C'
634      Enable compatibility mode.  *Note Implementation Differences::,
635      for the list of incompatibilities between `groff' and AT&T `troff'.
636
637 `-dCS'
638 `-dNAME=S'
639      Define C or NAME to be a string S.  C must be a one-letter name;
640      NAME can be of arbitrary length.  All string assignments happen
641      before loading any macro file (including the start-up file).
642
643 `-fFAM'
644      Use FAM as the default font family.  *Note Font Families::.
645
646 `-mNAME'
647      Read in the file `NAME.tmac'.  Normally `groff' searches for this
648      in its macro directories.  If it isn't found, it tries `tmac.NAME'
649      (searching in the same directories).
650
651 `-nNUM'
652      Number the first page NUM.
653
654 `-oLIST'
655      Output only pages in LIST, which is a comma-separated list of page
656      ranges; `N' means print page N, `M-N' means print every page
657      between M and N, `-N' means print every page up to N, `N-' means
658      print every page beginning with N.  `gtroff' exits after printing
659      the last page in the list.  All the ranges are inclusive on both
660      ends.
661
662      Within `gtroff', this information can be extracted with the `.P'
663      register.  *Note Built-in Registers::.
664
665      If your document restarts page numbering at the beginning of each
666      chapter, then `gtroff' prints the specified page range for each
667      chapter.
668
669 `-rCN'
670 `-rNAME=N'
671      Set number register C or NAME to the value N.  C must be a
672      one-letter name; NAME can be of arbitrary length.  N can be any
673      `gtroff' numeric expression.  All register assignments happen
674      before loading any macro file (including the start-up file).
675
676 `-FDIR'
677      Search `DIR' for subdirectories `devNAME' (NAME is the name of the
678      device), for the `DESC' file, and for font files before looking in
679      the standard directories (*note Font Directories::).  This option
680      is passed to all pre- and postprocessors using the
681      `GROFF_FONT_PATH' environment variable.
682
683 `-MDIR'
684      Search directory `DIR' for macro files before the standard
685      directories (*note Macro Directories::).
686
687 `-IDIR'
688      This option may be used to specify a directory to search for files.
689      It is passed to the following programs:
690
691         * `gsoelim' (see *Note gsoelim:: for more details); it also
692           implies `groff''s `-s' option.
693
694         * `gtroff'; it is used to search files named in the `psbb' and
695           `so' requests.
696
697         * `grops'; it is used to search files named in the
698           `\X'ps: import' and `\X'ps: file' escapes.
699
700      The current directory is always searched first. This option may be
701      specified more than once; the directories will be searched in the
702      order specified. No directory search is performed for files
703      specified using an absolute path.
704
705 \1f
706 File: groff,  Node: Environment,  Next: Macro Directories,  Prev: Groff Options,  Up: Invoking groff
707
708 2.2 Environment
709 ===============
710
711 There are also several environment variables (of the operating system,
712 not within `gtroff') which can modify the behavior of `groff'.
713
714 `GROFF_COMMAND_PREFIX'
715      If this is set to X, then `groff' runs `Xtroff' instead of
716      `gtroff'.  This also applies to `tbl', `pic', `eqn', `grn',
717      `refer', and `soelim'.  It does not apply to `grops', `grodvi',
718      `grotty', `pre-grohtml', `post-grohtml', `grolj4', and `gxditview'.
719
720      The default command prefix is determined during the installation
721      process.  If a non-GNU troff system is found, prefix `g' is used,
722      none otherwise.
723
724 `GROFF_TMAC_PATH'
725      A colon-separated list of directories in which to search for macro
726      files (before the default directories are tried).  *Note Macro
727      Directories::.
728
729 `GROFF_TYPESETTER'
730      The default output device.
731
732 `GROFF_FONT_PATH'
733      A colon-separated list of directories in which to search for the
734      `dev'NAME directory (before the default directories are tried).
735      *Note Font Directories::.
736
737 `GROFF_BIN_PATH'
738      This search path, followed by `PATH', is used for commands executed
739      by `groff'.
740
741 `GROFF_TMPDIR'
742      The directory in which `groff' creates temporary files.  If this is
743      not set and `TMPDIR' is set, temporary files are created in that
744      directory.  Otherwise temporary files are created in a
745      system-dependent default directory (on Unix and GNU/Linux systems,
746      this is usually `/tmp').  `grops', `grefer', `pre-grohtml', and
747      `post-grohtml' can create temporary files in this directory.
748
749    Note that MS-DOS and MS-Windows ports of `groff' use semi-colons,
750 rather than colons, to separate the directories in the lists described
751 above.
752
753 \1f
754 File: groff,  Node: Macro Directories,  Next: Font Directories,  Prev: Environment,  Up: Invoking groff
755
756 2.3 Macro Directories
757 =====================
758
759 All macro file names must be named `NAME.tmac' or `tmac.NAME' to make
760 the `-mNAME' command line option work.  The `mso' request doesn't have
761 this restriction; any file name can be used, and `gtroff' won't try to
762 append or prepend the `tmac' string.
763
764    Macro files are kept in the "tmac directories", all of which
765 constitute the "tmac path".  The elements of the search path for macro
766 files are (in that order):
767
768    * The directories specified with `gtroff''s or `groff''s `-M'
769      command line option.
770
771    * The directories given in the `GROFF_TMAC_PATH' environment
772      variable.
773
774    * The current directory (only if in unsafe mode using the `-U'
775      command line switch).
776
777    * The home directory.
778
779    * A platform-dependent directory, a site-specific
780      (platform-independent) directory, and the main tmac directory; the
781      default locations are
782
783
784           /usr/local/lib/groff/site-tmac
785           /usr/local/share/groff/site-tmac
786           /usr/local/share/groff/1.18.2/tmac
787
788      assuming that the version of `groff' is 1.18.2, and the
789      installation prefix was `/usr/local'.  It is possible to fine-tune
790      those directories during the installation process.
791
792 \1f
793 File: groff,  Node: Font Directories,  Next: Paper Size,  Prev: Macro Directories,  Up: Invoking groff
794
795 2.4 Font Directories
796 ====================
797
798 Basically, there is no restriction how font files for `groff' are named
799 and how long font names are; however, to make the font family mechanism
800 work (*note Font Families::), fonts within a family should start with
801 the family name, followed by the shape.  For example, the Times family
802 uses `T' for the family name and `R', `B', `I', and `BI' to indicate
803 the shapes `roman', `bold', `italic', and `bold italic', respectively.
804 Thus the final font names are `TR', `TB', `TI', and `TBI'.
805
806    All font files are kept in the "font directories" which constitute
807 the "font path".  The file search functions will always append the
808 directory `dev'NAME, where NAME is the name of the output device.
809 Assuming, say, DVI output, and `/foo/bar' as a font directory, the font
810 files for `grodvi' must be in `/foo/bar/devdvi'.
811
812    The elements of the search path for font files are (in that order):
813
814    * The directories specified with `gtroff''s or `groff''s `-F'
815      command line option.  All device drivers and some preprocessors
816      also have this option.
817
818    * The directories given in the `GROFF_FONT_PATH' environment
819      variable.
820
821    * A site-specific directory and the main font directory; the default
822      locations are
823
824
825           /usr/local/share/groff/site-font
826           /usr/local/share/groff/1.18.2/font
827
828      assuming that the version of `groff' is 1.18.2, and the
829      installation prefix was `/usr/local'.  It is possible to fine-tune
830      those directories during the installation process.
831
832 \1f
833 File: groff,  Node: Paper Size,  Next: Invocation Examples,  Prev: Font Directories,  Up: Invoking groff
834
835 2.5 Paper Size
836 ==============
837
838 In groff, the page size for `gtroff' and for output devices are handled
839 separately.  *Note Page Layout::, for vertical manipulation of the page
840 size.  *Note Line Layout::, for horizontal changes.
841
842    A default paper size can be set in the device's `DESC' file.  Most
843 output devices also have a command line option `-p' to override the
844 default paper size and option `-l' to use landscape orientation.  *Note
845 DESC File Format::, for a description of the `papersize' keyword which
846 takes the same argument as `-p'.
847
848    A convenient shorthand to set a particular paper size for `gtroff'
849 is command line option `-dpaper=SIZE'.  This defines string `paper'
850 which is processed in file `papersize.tmac' (loaded in the start-up
851 file `troffrc' by default).  Possible values for SIZE are the same as
852 the predefined values for the `papersize' keyword (but only in
853 lowercase) except `a7'-`d7'.  An appended `l' (ell) character denotes
854 landscape orientation.
855
856    For example, use the following for PS output on A4 paper in landscape
857 orientation:
858
859
860      groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
861
862    Note that it is up to the particular macro package to respect default
863 page dimensions set in this way (most do).
864
865 \1f
866 File: groff,  Node: Invocation Examples,  Prev: Paper Size,  Up: Invoking groff
867
868 2.6 Invocation Examples
869 =======================
870
871 This section lists several common uses of `groff' and the corresponding
872 command lines.
873
874
875      groff file
876
877 This command processes `file' without a macro package or a
878 preprocessor.  The output device is the default, `ps', and the output
879 is sent to `stdout'.
880
881
882      groff -t -mandoc -Tascii file | less
883
884 This is basically what a call to the `man' program does.  `gtroff'
885 processes the manual page `file' with the `mandoc' macro file (which in
886 turn either calls the `man' or the `mdoc' macro package), using the
887 `tbl' preprocessor and the ASCII output device.  Finally, the `less'
888 pager displays the result.
889
890
891      groff -X -m me file
892
893 Preview `file' with `gxditview', using the `me' macro package.  Since
894 no `-T' option is specified, use the default device (`ps').  Note that
895 you can either say `-m me' or `-me'; the latter is an anachronism from
896 the early days of UNIX.(1) (*note Invocation Examples-Footnote-1::)
897
898
899      groff -man -rD1 -z file
900
901 Check `file' with the `man' macro package, forcing double-sided
902 printing - don't produce any output.
903
904 * Menu:
905
906 * grog::
907
908 \1f
909 File: groff,  Node: Invocation Examples-Footnotes,  Up: Invocation Examples
910
911    (1) The same is true for the other main macro packages that come
912 with `groff': `man', `mdoc', `ms', `mm', and `mandoc'.  This won't work
913 in general; for example, to load `trace.tmac', either `-mtrace' or
914 `-m trace' must be used.
915
916 \1f
917 File: groff,  Node: grog,  Prev: Invocation Examples,  Up: Invocation Examples
918
919 2.6.1 `grog'
920 ------------
921
922 `grog' reads files, guesses which of the `groff' preprocessors and/or
923 macro packages are required for formatting them, and prints the `groff'
924 command including those options on the standard output.  It generates
925 one or more of the options `-e', `-man', `-me', `-mm', `-mom', `-ms',
926 `-mdoc', `-mdoc-old', `-p', `-R', `-g', `-G', `-s', and `-t'.
927
928    A special file name `-' refers to the standard input.  Specifying no
929 files also means to read the standard input.  Any specified options are
930 included in the printed command.  No space is allowed between options
931 and their arguments.  The only options recognized are `-C' (which is
932 also passed on) to enable compatibility mode, and `-v' to print the
933 version number and exit.
934
935    For example,
936
937
938      grog -Tdvi paper.ms
939
940 guesses the appropriate command to print `paper.ms' and then prints it
941 to the command line after adding the `-Tdvi' option.  For direct
942 execution, enclose the call to `grog' in backquotes at the UNIX shell
943 prompt:
944
945
946      `grog -Tdvi paper.ms` > paper.dvi
947
948 As seen in the example, it is still necessary to redirect the output to
949 something meaningful (i.e. either a file or a pager program like
950 `less').
951
952 \1f
953 File: groff,  Node: Tutorial for Macro Users,  Next: Macro Packages,  Prev: Invoking groff,  Up: Top
954
955 3 Tutorial for Macro Users
956 **************************
957
958 Most users tend to use a macro package to format their papers.  This
959 means that the whole breadth of `groff' is not necessary for most
960 people.  This chapter covers the material needed to efficiently use a
961 macro package.
962
963 * Menu:
964
965 * Basics::
966 * Common Features::
967
968 \1f
969 File: groff,  Node: Basics,  Next: Common Features,  Prev: Tutorial for Macro Users,  Up: Tutorial for Macro Users
970
971 3.1 Basics
972 ==========
973
974 This section covers some of the basic concepts necessary to understand
975 how to use a macro package.(1) (*note Basics-Footnote-1::) References
976 are made throughout to more detailed information, if desired.
977
978    `gtroff' reads an input file prepared by the user and outputs a
979 formatted document suitable for publication or framing.  The input
980 consists of text, or words to be printed, and embedded commands
981 ("requests" and "escapes"), which tell `gtroff' how to format the
982 output.  For more detail on this, see *Note Embedded Commands::.
983
984    The word "argument" is used in this chapter to mean a word or number
985 which appears on the same line as a request, and which modifies the
986 meaning of that request.  For example, the request
987
988
989      .sp
990
991 spaces one line, but
992
993
994      .sp 4
995
996 spaces four lines.  The number 4 is an argument to the `sp' request
997 which says to space four lines instead of one.  Arguments are separated
998 from the request and from each other by spaces (_no_ tabs).  More
999 details on this can be found in *Note Request and Macro Arguments::.
1000
1001    The primary function of `gtroff' is to collect words from input
1002 lines, fill output lines with those words, justify the right-hand margin
1003 by inserting extra spaces in the line, and output the result.  For
1004 example, the input:
1005
1006
1007      Now is the time
1008      for all good men
1009      to come to the aid
1010      of their party.
1011      Four score and seven
1012      years ago, etc.
1013
1014 is read, packed onto output lines, and justified to produce:
1015
1016      Now is the time for all good men to come to the aid of their party.
1017      Four score and seven years ago, etc.
1018
1019    Sometimes a new output line should be started even though the current
1020 line is not yet full; for example, at the end of a paragraph.  To do
1021 this it is possible to cause a "break", which starts a new output line.
1022 Some requests cause a break automatically, as normally do blank input
1023 lines and input lines beginning with a space.
1024
1025    Not all input lines are text to be formatted.  Some input lines are
1026 requests which describe how to format the text.  Requests always have a
1027 period (`.') or an apostrophe (`'') as the first character of the input
1028 line.
1029
1030    The text formatter also does more complex things, such as
1031 automatically numbering pages, skipping over page boundaries, putting
1032 footnotes in the correct place, and so forth.
1033
1034    Here are a few hints for preparing text for input to `gtroff'.
1035
1036    * First, keep the input lines short.  Short input lines are easier to
1037      edit, and `gtroff' packs words onto longer lines anyhow.
1038
1039    * In keeping with this, it is helpful to begin a new line after every
1040      comma or phrase, since common corrections are to add or delete
1041      sentences or phrases.
1042
1043    * End each sentence with two spaces - or better, start each sentence
1044      on a new line.  `gtroff' recognizes characters that usually end a
1045      sentence, and inserts sentence space accordingly.
1046
1047    * Do not hyphenate words at the end of lines - `gtroff' is smart
1048      enough to hyphenate words as needed, but is not smart enough to
1049      take hyphens out and join a word back together.  Also, words such
1050      as "mother-in-law" should not be broken over a line, since then a
1051      space can occur where not wanted, such as "mother- in-law".
1052
1053    `gtroff' double-spaces output text automatically if you use the
1054 request `.ls 2'.  Reactivate single-spaced mode by typing `.ls 1'.(2)
1055 (*note Basics-Footnote-2::)
1056
1057    A number of requests allow to change the way the output looks,
1058 sometimes called the "layout" of the output page.  Most of these
1059 requests adjust the placing of "whitespace" (blank lines or spaces).
1060
1061    The `bp' request starts a new page, causing a line break.
1062
1063    The request `.sp N' leaves N lines of blank space.  N can be omitted
1064 (meaning skip a single line) or can be of the form Ni (for N inches) or
1065 Nc (for N centimeters).  For example, the input:
1066
1067
1068      .sp 1.5i
1069      My thoughts on the subject
1070      .sp
1071
1072 leaves one and a half inches of space, followed by the line "My
1073 thoughts on the subject", followed by a single blank line (more
1074 measurement units are available, see *Note Measurements::).
1075
1076    Text lines can be centered by using the `ce' request.  The line
1077 after `ce' is centered (horizontally) on the page.  To center more than
1078 one line, use `.ce N' (where N is the number of lines to center),
1079 followed by the N lines.  To center many lines without counting them,
1080 type:
1081
1082
1083      .ce 1000
1084      lines to center
1085      .ce 0
1086
1087 The `.ce 0' request tells `groff' to center zero more lines, in other
1088 words, stop centering.
1089
1090    All of these requests cause a break; that is, they always start a new
1091 line.  To start a new line without performing any other action, use
1092 `br'.
1093
1094 \1f
1095 File: groff,  Node: Basics-Footnotes,  Up: Basics
1096
1097    (1) This section is derived from `Writing Papers with nroff using
1098 -me' by Eric P. Allman.
1099
1100    (2) If you need finer granularity of the vertical space, use the
1101 `pvs' request (*note Changing Type Sizes::).
1102
1103 \1f
1104 File: groff,  Node: Common Features,  Prev: Basics,  Up: Tutorial for Macro Users
1105
1106 3.2 Common Features
1107 ===================
1108
1109 `gtroff' provides very low-level operations for formatting a document.
1110 There are many common routine operations which are done in all
1111 documents.  These common operations are written into "macros" and
1112 collected into a "macro package".
1113
1114    All macro packages provide certain common capabilities which fall
1115 into the following categories.
1116
1117 * Menu:
1118
1119 * Paragraphs::
1120 * Sections and Chapters::
1121 * Headers and Footers::
1122 * Page Layout Adjustment::
1123 * Displays::
1124 * Footnotes and Annotations::
1125 * Table of Contents::
1126 * Indices::
1127 * Paper Formats::
1128 * Multiple Columns::
1129 * Font and Size Changes::
1130 * Predefined Strings::
1131 * Preprocessor Support::
1132 * Configuration and Customization::
1133
1134 \1f
1135 File: groff,  Node: Paragraphs,  Next: Sections and Chapters,  Prev: Common Features,  Up: Common Features
1136
1137 3.2.1 Paragraphs
1138 ----------------
1139
1140 One of the most common and most used capability is starting a
1141 paragraph.  There are a number of different types of paragraphs, any of
1142 which can be initiated with macros supplied by the macro package.
1143 Normally, paragraphs start with a blank line and the first line
1144 indented, like the text in this manual.  There are also block style
1145 paragraphs, which omit the indentation:
1146
1147
1148      Some   men  look   at  constitutions   with  sanctimonious
1149      reverence, and deem them like the ark of the covenant, too
1150      sacred to be touched.
1151
1152 And there are also indented paragraphs which begin with a tag or label
1153 at the margin and the remaining text indented.
1154
1155
1156      one   This is  the first paragraph.  Notice  how the first
1157            line of  the resulting  paragraph lines up  with the
1158            other lines in the paragraph.
1159
1160
1161      longlabel
1162            This  paragraph   had  a  long   label.   The  first
1163            character of text on the first line does not line up
1164            with  the  text  on  second  and  subsequent  lines,
1165            although they line up with each other.
1166
1167    A variation of this is a bulleted list.
1168
1169
1170      .     Bulleted lists start with a bullet.   It is possible
1171            to use other glyphs instead of the bullet.  In nroff
1172            mode using the ASCII character set for output, a dot
1173            is used instead of a real bullet.
1174
1175 \1f
1176 File: groff,  Node: Sections and Chapters,  Next: Headers and Footers,  Prev: Paragraphs,  Up: Common Features
1177
1178 3.2.2 Sections and Chapters
1179 ---------------------------
1180
1181 Most macro packages supply some form of section headers.  The simplest
1182 kind is simply the heading on a line by itself in bold type.  Others
1183 supply automatically numbered section heading or different heading
1184 styles at different levels.  Some, more sophisticated, macro packages
1185 supply macros for starting chapters and appendices.
1186
1187 \1f
1188 File: groff,  Node: Headers and Footers,  Next: Page Layout Adjustment,  Prev: Sections and Chapters,  Up: Common Features
1189
1190 3.2.3 Headers and Footers
1191 -------------------------
1192
1193 Every macro package gives some way to manipulate the "headers" and
1194 "footers" (also called "titles") on each page.  This is text put at the
1195 top and bottom of each page, respectively, which contain data like the
1196 current page number, the current chapter title, and so on.  Its
1197 appearance is not affected by the running text.  Some packages allow
1198 for different ones on the even and odd pages (for material printed in a
1199 book form).
1200
1201    The titles are called "three-part titles", that is, there is a
1202 left-justified part, a centered part, and a right-justified part.  An
1203 automatically generated page number may be put in any of these fields
1204 with the `%' character (see *Note Page Layout::, for more details).
1205
1206 \1f
1207 File: groff,  Node: Page Layout Adjustment,  Next: Displays,  Prev: Headers and Footers,  Up: Common Features
1208
1209 3.2.4 Page Layout
1210 -----------------
1211
1212 Most macro packages let the user specify top and bottom margins and
1213 other details about the appearance of the printed pages.
1214
1215 \1f
1216 File: groff,  Node: Displays,  Next: Footnotes and Annotations,  Prev: Page Layout Adjustment,  Up: Common Features
1217
1218 3.2.5 Displays
1219 --------------
1220
1221 "Displays" are sections of text to be set off from the body of the
1222 paper.  Major quotes, tables, and figures are types of displays, as are
1223 all the examples used in this document.
1224
1225    "Major quotes" are quotes which are several lines long, and hence
1226 are set in from the rest of the text without quote marks around them.
1227
1228    A "list" is an indented, single-spaced, unfilled display.  Lists
1229 should be used when the material to be printed should not be filled and
1230 justified like normal text, such as columns of figures or the examples
1231 used in this paper.
1232
1233    A "keep" is a display of lines which are kept on a single page if
1234 possible.  An example for a keep might be a diagram.  Keeps differ from
1235 lists in that lists may be broken over a page boundary whereas keeps are
1236 not.
1237
1238    "Floating keeps" move relative to the text.  Hence, they are good for
1239 things which are referred to by name, such as "See figure 3".  A
1240 floating keep appears at the bottom of the current page if it fits;
1241 otherwise, it appears at the top of the next page.  Meanwhile, the
1242 surrounding text `flows' around the keep, thus leaving no blank areas.
1243
1244 \1f
1245 File: groff,  Node: Footnotes and Annotations,  Next: Table of Contents,  Prev: Displays,  Up: Common Features
1246
1247 3.2.6 Footnotes and Annotations
1248 -------------------------------
1249
1250 There are a number of requests to save text for later printing.
1251
1252    "Footnotes" are printed at the bottom of the current page.
1253
1254    "Delayed text" is very similar to a footnote except that it is
1255 printed when called for explicitly.  This allows a list of references to
1256 appear (for example) at the end of each chapter, as is the convention in
1257 some disciplines.
1258
1259    Most macro packages which supply this functionality also supply a
1260 means of automatically numbering either type of annotation.
1261
1262 \1f
1263 File: groff,  Node: Table of Contents,  Next: Indices,  Prev: Footnotes and Annotations,  Up: Common Features
1264
1265 3.2.7 Table of Contents
1266 -----------------------
1267
1268 "Tables of contents" are a type of delayed text having a tag (usually
1269 the page number) attached to each entry after a row of dots.  The table
1270 accumulates throughout the paper until printed, usually after the paper
1271 has ended.  Many macro packages provide the ability to have several
1272 tables of contents (e.g. a standard table of contents, a list of
1273 tables, etc).
1274
1275 \1f
1276 File: groff,  Node: Indices,  Next: Paper Formats,  Prev: Table of Contents,  Up: Common Features
1277
1278 3.2.8 Indices
1279 -------------
1280
1281 While some macro packages use the term "index", none actually provide
1282 that functionality.  The facilities they call indices are actually more
1283 appropriate for tables of contents.
1284
1285    To produce a real index in a document, external tools like the
1286 `makeindex' program are necessary.
1287
1288 \1f
1289 File: groff,  Node: Paper Formats,  Next: Multiple Columns,  Prev: Indices,  Up: Common Features
1290
1291 3.2.9 Paper Formats
1292 -------------------
1293
1294 Some macro packages provide stock formats for various kinds of
1295 documents.  Many of them provide a common format for the title and
1296 opening pages of a technical paper.  The `mm' macros in particular
1297 provide formats for letters and memoranda.
1298
1299 \1f
1300 File: groff,  Node: Multiple Columns,  Next: Font and Size Changes,  Prev: Paper Formats,  Up: Common Features
1301
1302 3.2.10 Multiple Columns
1303 -----------------------
1304
1305 Some macro packages (but not `man') provide the ability to have two or
1306 more columns on a page.
1307
1308 \1f
1309 File: groff,  Node: Font and Size Changes,  Next: Predefined Strings,  Prev: Multiple Columns,  Up: Common Features
1310
1311 3.2.11 Font and Size Changes
1312 ----------------------------
1313
1314 The built-in font and size functions are not always intuitive, so all
1315 macro packages provide macros to make these operations simpler.
1316
1317 \1f
1318 File: groff,  Node: Predefined Strings,  Next: Preprocessor Support,  Prev: Font and Size Changes,  Up: Common Features
1319
1320 3.2.12 Predefined Strings
1321 -------------------------
1322
1323 Most macro packages provide various predefined strings for a variety of
1324 uses; examples are sub- and superscripts, printable dates, quotes and
1325 various special characters.
1326
1327 \1f
1328 File: groff,  Node: Preprocessor Support,  Next: Configuration and Customization,  Prev: Predefined Strings,  Up: Common Features
1329
1330 3.2.13 Preprocessor Support
1331 ---------------------------
1332
1333 All macro packages provide support for various preprocessors and may
1334 extend their functionality.
1335
1336    For example, all macro packages mark tables (which are processed with
1337 `gtbl') by placing them between `TS' and `TE' macros.  The `ms' macro
1338 package has an option, `.TS H', that prints a caption at the top of a
1339 new page (when the table is too long to fit on a single page).
1340
1341 \1f
1342 File: groff,  Node: Configuration and Customization,  Prev: Preprocessor Support,  Up: Common Features
1343
1344 3.2.14 Configuration and Customization
1345 --------------------------------------
1346
1347 Some macro packages provide means of customizing many of the details of
1348 how the package behaves.  This ranges from setting the default type size
1349 to changing the appearance of section headers.
1350
1351 \1f
1352 File: groff,  Node: Macro Packages,  Next: gtroff Reference,  Prev: Tutorial for Macro Users,  Up: Top
1353
1354 4 Macro Packages
1355 ****************
1356
1357 This chapter documents the main macro packages that come with `groff'.
1358
1359    Different main macro packages can't be used at the same time; for
1360 example
1361
1362
1363      groff -m man foo.man -m ms bar.doc
1364
1365 doesn't work.  Note that option arguments are processed before
1366 non-option arguments; the above (failing) sample is thus reordered to
1367
1368
1369      groff -m man -m ms foo.man bar.doc
1370
1371 * Menu:
1372
1373 * man::
1374 * mdoc::
1375 * ms::
1376 * me::
1377 * mm::
1378
1379 \1f
1380 File: groff,  Node: man,  Next: mdoc,  Prev: Macro Packages,  Up: Macro Packages
1381
1382 4.1 `man'
1383 =========
1384
1385 This is the most popular and probably the most important macro package
1386 of `groff'.  It is easy to use, and a vast majority of manual pages are
1387 based on it.
1388
1389 * Menu:
1390
1391 * Man options::
1392 * Man usage::
1393 * Man font macros::
1394 * Miscellaneous man macros::
1395 * Predefined man strings::
1396 * Preprocessors in man pages::
1397 * Optional man extensions::
1398
1399 \1f
1400 File: groff,  Node: Man options,  Next: Man usage,  Prev: man,  Up: man
1401
1402 4.1.1 Options
1403 -------------
1404
1405 The command line format for using the `man' macros with `groff' is:
1406
1407
1408      groff -m man [ -rLL=LENGTH ] [ -rLT=LENGTH ] [ -rFT=DIST ]
1409            [ -rcR=1 ] [ -rC1 ] [ -rD1 ] [-rHY=FLAGS ]
1410            [ -rPNNN ] [ -rSXX ] [ -rXNNN ]
1411            [ -rIN=LENGTH ] [ -rSN=LENGTH ] [ FILES... ]
1412
1413 It is possible to use `-man' instead of `-m man'.
1414
1415 `-rcR=1'
1416      This option (the default if a TTY output device is used) creates a
1417      single, very long page instead of multiple pages.  Use `-rcR=0' to
1418      disable it.
1419
1420 `-rC1'
1421      If more than one manual page is given on the command line, number
1422      the pages continuously, rather than starting each at 1.
1423
1424 `-rD1'
1425      Double-sided printing.  Footers for even and odd pages are
1426      formatted differently.
1427
1428 `-rFT=DIST'
1429      Set the position of the footer text to DIST.  If positive, the
1430      distance is measured relative to the top of the page, otherwise it
1431      is relative to the bottom.  The default is -0.5i.
1432
1433 `-rHY=FLAGS'
1434      Set hyphenation flags.  Possible values are 1 to hyphenate without
1435      restrictions, 2  to not hyphenate the last word on a page, 4 to
1436      not hyphenate the last two characters of a word, and 8 to not
1437      hyphenate the first two characters of a word.  These values are
1438      additive; the default is 14.
1439
1440 `-rIN=LENGTH'
1441      Set the body text indentation to LENGTH.  If not specified, the
1442      indentation defaults to 7n (7 characters) in nroff mode and 7.2n
1443      otherwise.  For nroff, this value should always be an integer
1444      multiple of unit `n' to get consistent indentation.
1445
1446 `-rLL=LENGTH'
1447      Set line length to LENGTH.  If not specified, the line length is
1448      set to respect any value set by a prior `ll' request (which _must_
1449      be in effect when the `TH' macro is invoked), if this differs from
1450      the built-in default for the formatter; otherwise it defaults to
1451      78n in nroff mode (this is 78 characters per line) and 6.5i in
1452      troff mode.(1) (*note Man options-Footnote-1::)
1453
1454 `-rLT=LENGTH'
1455      Set title length to LENGTH.  If not specified, the title length
1456      defaults to the line length.
1457
1458 `-rPNNN'
1459      Page numbering starts with NNN rather than with 1.
1460
1461 `-rSXX'
1462      Use XX (which can be 10, 11, or 12pt) as the base document font
1463      size instead of the default value of 10pt.
1464
1465 `-rSN=LENGTH'
1466      Set the indentation for sub-subheadings to LENGTH.  If not
1467      specified, the indentation defaults to 3n.
1468
1469 `-rXNNN'
1470      After page NNN, number pages as NNNa, NNNb, NNNc, etc.  For
1471      example, the option `-rX2' produces the following page numbers: 1,
1472      2, 2a, 2b, 2c, etc.
1473
1474 \1f
1475 File: groff,  Node: Man options-Footnotes,  Up: Man options
1476
1477    (1) Note that the use of a `.ll LENGTH' request to initialize the
1478 line length, prior to use of the `TH' macro, is supported for backward
1479 compatibility with some versions of the `man' program.  _Always_ use the
1480 `-rLL=LENGTH' option, or an equivalent `.nr LL LENGTH' request, in
1481 preference to such a `.ll LENGTH' request.  In particular, note that in
1482 nroff mode, the request `.ll 65n', (with any LENGTH expression which
1483 evaluates equal to 65n, i.e., the formatter's default line length in
1484 nroff mode), will _not_ set the line length to 65n (it will be adjusted
1485 to the `man' macro package's default setting of 78n), whereas the use
1486 of the `-rLL=65n' option, or the `.nr LL 65n' request _will_ establish
1487 a line length of 65n.
1488
1489 \1f
1490 File: groff,  Node: Man usage,  Next: Man font macros,  Prev: Man options,  Up: man
1491
1492 4.1.2 Usage
1493 -----------
1494
1495 This section describes the available macros for manual pages.  For
1496 further customization, put additional macros and requests into the file
1497 `man.local' which is loaded immediately after the `man' package.
1498
1499  -- Macro: .TH title section [extra1 [extra2 [extra3]]]
1500      Set the title of the man page to TITLE and the section to SECTION,
1501      which must have a value between 1 and 8.  The value of SECTION may
1502      also have a string appended, e.g. `.pm', to indicate a specific
1503      subsection of the man pages.
1504
1505      Both TITLE and SECTION are positioned at the left and right in the
1506      header line (with SECTION in parentheses immediately appended to
1507      TITLE.  EXTRA1 is positioned in the middle of the footer line.
1508      EXTRA2 is positioned at the left in the footer line (or at the
1509      left on even pages and at the right on odd pages if double-sided
1510      printing is active).  EXTRA3 is centered in the header line.
1511
1512      For HTML output, headers and footers are completely suppressed.
1513
1514      Additionally, this macro starts a new page; the new line number
1515      is 1 again (except if the `-rC1' option is given on the command
1516      line) - this feature is intended only for formatting multiple man
1517      pages; a single man page should contain exactly one `TH' macro at
1518      the beginning of the file.
1519
1520  -- Macro: .SH [heading]
1521      Set up an unnumbered section heading sticking out to the left.
1522      Prints out all the text following `SH' up to the end of the line
1523      (or the text in the next line if there is no argument to `SH') in
1524      bold face (or the font specified by the string `HF'), one size
1525      larger than the base document size.  Additionally, the left margin
1526      and the indentation for the following text is reset to its default
1527      value.
1528
1529  -- Macro: .SS [heading]
1530      Set up an unnumbered (sub)section heading.  Prints out all the text
1531      following `SS' up to the end of the line (or the text in the next
1532      line if there is no argument to `SS') in bold face (or the font
1533      specified by the string `HF'), at the same size as the base
1534      document size.  Additionally, the left margin and the indentation
1535      for the following text is reset to its default value.
1536
1537  -- Macro: .TP [nnn]
1538      Set up an indented paragraph with label.  The indentation is set to
1539      NNN if that argument is supplied (the default unit is `n' if
1540      omitted), otherwise it is set to the previous indentation value
1541      specified with `TP', `IP', or `HP' (or to the default value if
1542      none of them have been used yet).
1543
1544      The first line of text following this macro is interpreted as a
1545      string to be printed flush-left, as it is appropriate for a label.
1546      It is not interpreted as part of a paragraph, so there is no
1547      attempt to fill the first line with text from the following input
1548      lines.  Nevertheless, if the label is not as wide as the
1549      indentation the paragraph starts at the same line (but indented),
1550      continuing on the following lines.  If the label is wider than the
1551      indentation the descriptive part of the paragraph begins on the
1552      line following the label, entirely indented.  Note that neither
1553      font shape nor font size of the label is set to a default value;
1554      on the other hand, the rest of the text has default font settings.
1555
1556  -- Macro: .LP
1557  -- Macro: .PP
1558  -- Macro: .P
1559      These macros are mutual aliases.  Any of them causes a line break
1560      at the current position, followed by a vertical space downwards by
1561      the amount specified by the `PD' macro.  The font size and shape
1562      are reset to the default value (10pt roman if no `-rS' option is
1563      given on the command line).  Finally, the current left margin and
1564      the indentation is restored.
1565
1566  -- Macro: .IP [designator [nnn]]
1567      Set up an indented paragraph, using DESIGNATOR as a tag to mark
1568      its beginning.  The indentation is set to NNN if that argument is
1569      supplied (default unit is `n'), otherwise it is set to the
1570      previous indentation value specified with `TP', `IP', or `HP' (or
1571      the default value if none of them have been used yet).  Font size
1572      and face of the paragraph (but not the designator) are reset to
1573      their default values.
1574
1575      To start an indented paragraph with a particular indentation but
1576      without a designator, use `""' (two double quotes) as the first
1577      argument of `IP'.
1578
1579      For example, to start a paragraph with bullets as the designator
1580      and 4 en indentation, write
1581
1582
1583           .IP \(bu 4
1584
1585
1586  -- Macro: .HP [nnn]
1587      Set up a paragraph with hanging left indentation.  The indentation
1588      is set to NNN if that argument is supplied (default unit is `n'),
1589      otherwise it is set to the previous indentation value specified
1590      with `TP', `IP', or `HP' (or the default value if non of them have
1591      been used yet).  Font size and face are reset to their default
1592      values.
1593
1594  -- Macro: .RS [nnn]
1595      Move the left margin to the right by the value NNN if specified
1596      (default unit is `n'); otherwise it is set to the previous
1597      indentation value specified with `TP', `IP', or `HP' (or to the
1598      default value if none of them have been used yet).  The
1599      indentation value is then set to the default.
1600
1601      Calls to the `RS' macro can be nested.
1602
1603  -- Macro: .RE [nnn]
1604      Move the left margin back to level NNN, restoring the previous left
1605      margin.  If no argument is given, it moves one level back.  The
1606      first level (i.e., no call to `RS' yet) has number 1, and each call
1607      to `RS' increases the level by 1.
1608
1609    To summarize, the following macros cause a line break with the
1610 insertion of vertical space (which amount can be changed with the `PD'
1611 macro): `SH', `SS', `TP', `LP' (`PP', `P'), `IP', and `HP'.
1612
1613    The macros `RS' and `RE' also cause a break but do not insert
1614 vertical space.
1615
1616    Finally, the macros `SH', `SS', `LP' (`PP', `P'), and `RS' reset the
1617 indentation to its default value.
1618
1619 \1f
1620 File: groff,  Node: Man font macros,  Next: Miscellaneous man macros,  Prev: Man usage,  Up: man
1621
1622 4.1.3 Macros to set fonts
1623 -------------------------
1624
1625 The standard font is roman; the default text size is 10 point.  If
1626 command line option `-rS=N' is given, use Npt as the default text size.
1627
1628  -- Macro: .SM [text]
1629      Set the text on the same line or the text on the next line in a
1630      font that is one point size smaller than the default font.
1631
1632  -- Macro: .SB [text]
1633      Set the text on the same line or the text on the next line in bold
1634      face font, one point size smaller than the default font.
1635
1636  -- Macro: .BI text
1637      Set its arguments alternately in bold face and italic, without a
1638      space between the arguments.  Thus,
1639
1640
1641           .BI this "word and" that
1642
1643      produces "thisword andthat" with "this" and "that" in bold face,
1644      and "word and" in italics.
1645
1646  -- Macro: .IB text
1647      Set its arguments alternately in italic and bold face, without a
1648      space between the arguments.
1649
1650  -- Macro: .RI text
1651      Set its arguments alternately in roman and italic, without a space
1652      between the arguments.
1653
1654  -- Macro: .IR text
1655      Set its arguments alternately in italic and roman, without a space
1656      between the arguments.
1657
1658  -- Macro: .BR text
1659      Set its arguments alternately in bold face and roman, without a
1660      space between the arguments.
1661
1662  -- Macro: .RB text
1663      Set its arguments alternately in roman and bold face, without a
1664      space between the arguments.
1665
1666  -- Macro: .B [text]
1667      Set TEXT in bold face.  If no text is present on the line where
1668      the macro is called, then the text of the next line appears in bold
1669      face.
1670
1671  -- Macro: .I [text]
1672      Set TEXT in italic.  If no text is present on the line where the
1673      macro is called, then the text of the next line appears in italic.
1674
1675 \1f
1676 File: groff,  Node: Miscellaneous man macros,  Next: Predefined man strings,  Prev: Man font macros,  Up: man
1677
1678 4.1.4 Miscellaneous macros
1679 --------------------------
1680
1681 The default indentation is 7.2n in troff mode and 7n in nroff mode
1682 except for `grohtml' which ignores indentation.
1683
1684  -- Macro: .DT
1685      Set tabs every 0.5 inches.  Since this macro is always executed
1686      during a call to the `TH' macro, it makes sense to call it only if
1687      the tab positions have been changed.
1688
1689  -- Macro: .PD [nnn]
1690      Adjust the empty space before a new paragraph (or section).  The
1691      optional argument gives the amount of space (default unit is `v');
1692      without parameter, the value is reset to its default value (1 line
1693      in nroff mode, 0.4v otherwise).
1694
1695      This affects the macros `SH', `SS', `TP', `LP' (as well as `PP'
1696      and `P'), `IP', and `HP'.
1697
1698    The following two macros are included for BSD compatibility.
1699
1700  -- Macro: .AT [system [release]]
1701      Alter the footer for use with AT&T manpages.  This command exists
1702      only for compatibility; don't use it.  The first argument SYSTEM
1703      can be:
1704
1705     `3'
1706           7th Edition (the default)
1707
1708     `4'
1709           System III
1710
1711     `5'
1712           System V
1713
1714      An optional second argument RELEASE to `AT' specifies the release
1715      number (such as "System V Release 3").
1716
1717  -- Macro: .UC [version]
1718      Alters the footer for use with BSD manpages.  This command exists
1719      only for compatibility; don't use it.  The argument can be:
1720
1721     `3'
1722           3rd Berkeley Distribution (the default)
1723
1724     `4'
1725           4th Berkeley Distribution
1726
1727     `5'
1728           4.2 Berkeley Distribution
1729
1730     `6'
1731           4.3 Berkeley Distribution
1732
1733     `7'
1734           4.4 Berkeley Distribution
1735
1736 \1f
1737 File: groff,  Node: Predefined man strings,  Next: Preprocessors in man pages,  Prev: Miscellaneous man macros,  Up: man
1738
1739 4.1.5 Predefined strings
1740 ------------------------
1741
1742 The following strings are defined:
1743
1744  -- String: \*[S]
1745      Switch back to the default font size.
1746
1747  -- String: \*[HF]
1748      The typeface used for headings.  The default is `B'.
1749
1750  -- String: \*[R]
1751      The `registered' sign.
1752
1753  -- String: \*[Tm]
1754      The `trademark' sign.
1755
1756  -- String: \*[lq]
1757  -- String: \*[rq]
1758      Left and right quote.  This is equal to `\(lq' and `\(rq',
1759      respectively.
1760
1761 \1f
1762 File: groff,  Node: Preprocessors in man pages,  Next: Optional man extensions,  Prev: Predefined man strings,  Up: man
1763
1764 4.1.6 Preprocessors in `man' pages
1765 ----------------------------------
1766
1767 If a preprocessor like `gtbl' or `geqn' is needed, it has become common
1768 usage to make the first line of the man page look like this:
1769
1770
1771      '\" WORD
1772
1773 Note the single space character after the double quote.  WORD consists
1774 of letters for the needed preprocessors: `e' for `geqn', `r' for
1775 `grefer', `t' for `gtbl'.  Modern implementations of the `man' program
1776 read this first line and automatically call the right preprocessor(s).
1777
1778 \1f
1779 File: groff,  Node: Optional man extensions,  Prev: Preprocessors in man pages,  Up: man
1780
1781 4.1.7 Optional `man' extensions
1782 -------------------------------
1783
1784 Use the file `man.local' for local extensions to the `man' macros or
1785 for style changes.
1786
1787 Custom headers and footers
1788 ..........................
1789
1790 In groff versions 1.18.2 and later, you can specify custom headers and
1791 footers by redefining the following macros in `man.local'.
1792
1793  -- Macro: .PT
1794      Control the content of the headers.  Normally, the header prints
1795      the command name and section number on either side, and the
1796      optional fifth argument to `TH' in the center.
1797
1798  -- Macro: .BT
1799      Control the content of the footers.  Normally, the footer prints
1800      the page number and the third and fourth arguments to `TH'.
1801
1802      Use the `FT' number register to specify the footer position.  The
1803      default is -0.5i.
1804
1805 Ultrix-specific man macros
1806 ..........................
1807
1808 The `groff' source distribution includes a file named `man.ultrix',
1809 containing macros compatible with the Ultrix variant of `man'.  Copy
1810 this file into `man.local' (or use the `mso' request to load it) to
1811 enable the following macros.
1812
1813  -- Macro: .CT key
1814      Print `<CTRL/KEY>'.
1815
1816  -- Macro: .CW
1817      Print subsequent text using the constant width (Courier) typeface.
1818
1819  -- Macro: .Ds
1820      Begin a non-filled display.
1821
1822  -- Macro: .De
1823      End a non-filled display started with `Ds'.
1824
1825  -- Macro: .EX [indent]
1826      Begins a non-filled display using the constant width (Courier)
1827      typeface.  Use the optional INDENT argument to indent the display.
1828
1829  -- Macro: .EE
1830      End a non-filled display started with `EX'.
1831
1832  -- Macro: .G [text]
1833      Sets TEXT in Helvetica.  If no text is present on the line where
1834      the macro is called, then the text of the next line appears in
1835      Helvetica.
1836
1837  -- Macro: .GL [text]
1838      Sets TEXT in Helvetica Oblique.  If no text is present on the line
1839      where the macro is called, then the text of the next line appears
1840      in Helvetica Oblique.
1841
1842  -- Macro: .HB [text]
1843      Sets TEXT in Helvetica Bold.  If no text is present on the line
1844      where the macro is called, then all text up to the next `HB'
1845      appears in Helvetica Bold.
1846
1847  -- Macro: .TB [text]
1848      Identical to `HB'.
1849
1850  -- Macro: .MS title sect [punct]
1851      Set a manpage reference in Ultrix format.  The TITLE is in Courier
1852      instead of italic.  Optional punctuation follows the section
1853      number without an intervening space.
1854
1855  -- Macro: .NT [`C'] [title]
1856      Begin a note.  Print the optional title, or the word "Note",
1857      centered on the page.  Text following the macro makes up the body
1858      of the note, and is indented on both sides.  If the first argument
1859      is `C', the body of the note is printed centered (the second
1860      argument replaces the word "Note" if specified).
1861
1862  -- Macro: .NE
1863      End a note begun with `NT'.
1864
1865  -- Macro: .PN path [punct]
1866      Set the path name in constant width (Courier), followed by
1867      optional punctuation.
1868
1869  -- Macro: .Pn [punct] path [punct]
1870      When called with two arguments, identical to `PN'.  When called
1871      with three arguments, set the second argument in constant width
1872      (Courier), bracketed by the first and third arguments in the
1873      current font.
1874
1875  -- Macro: .R
1876      Switch to roman font and turn off any underlining in effect.
1877
1878  -- Macro: .RN
1879      Print the string `<RETURN>'.
1880
1881  -- Macro: .VS [`4']
1882      Start printing a change bar in the margin if the number `4' is
1883      specified.  Otherwise, this macro does nothing.
1884
1885  -- Macro: .VE
1886      End printing the change bar begun by `VS'.
1887
1888 Simple example
1889 ..............
1890
1891 The following example `man.local' file alters the `SH' macro to add
1892 some extra vertical space before printing the heading.  Headings are
1893 printed in Helvetica Bold.
1894
1895
1896      .\" Make the heading fonts Helvetica
1897      .ds HF HB
1898      .
1899      .\" Put more whitespace in front of headings.
1900      .rn SH SH-orig
1901      .de SH
1902      .  if t .sp (u;\\n[PD]*2)
1903      .  SH-orig \\$*
1904      ..
1905
1906 \1f
1907 File: groff,  Node: mdoc,  Next: ms,  Prev: man,  Up: Macro Packages
1908
1909 4.2 `mdoc'
1910 ==========
1911
1912 See the `groff_mdoc(7)' man page (type `man groff_mdoc' at the command
1913 line).
1914
1915 \1f
1916 File: groff,  Node: ms,  Next: me,  Prev: mdoc,  Up: Macro Packages
1917
1918 4.3 `ms'
1919 ========
1920
1921 The `-ms' macros are suitable for reports, letters, books, user
1922 manuals, and so forth.  The package provides macros for cover pages,
1923 section headings, paragraphs, lists, footnotes, pagination, and a table
1924 of contents.
1925
1926 * Menu:
1927
1928 * ms Intro::
1929 * General ms Structure::
1930 * ms Document Control Registers::
1931 * ms Cover Page Macros::
1932 * ms Body Text::
1933 * ms Page Layout::
1934 * Differences from AT&T ms::
1935 * Naming Conventions::
1936
1937 \1f
1938 File: groff,  Node: ms Intro,  Next: General ms Structure,  Prev: ms,  Up: ms
1939
1940 4.3.1 Introduction to `ms'
1941 --------------------------
1942
1943 The original `-ms' macros were included with AT&T `troff' as well as
1944 the `man' macros.  While the `man' package is intended for brief
1945 documents that can be read on-line as well as printed, the `ms' macros
1946 are suitable for longer documents that are meant to be printed rather
1947 than read on-line.
1948
1949    The `ms' macro package included with `groff' is a complete,
1950 bottom-up re-implementation.  Several macros (specific to AT&T or
1951 Berkeley) are not included, while several new commands are.  *Note
1952 Differences from AT&T ms::, for more information.
1953
1954 \1f
1955 File: groff,  Node: General ms Structure,  Next: ms Document Control Registers,  Prev: ms Intro,  Up: ms
1956
1957 4.3.2 General structure of an `ms' document
1958 -------------------------------------------
1959
1960 The `ms' macro package expects a certain amount of structure, but not
1961 as much as packages such as `man' or `mdoc'.
1962
1963    The simplest documents can begin with a paragraph macro (such as
1964 `LP' or `PP'), and consist of text separated by paragraph macros or
1965 even blank lines.  Longer documents have a structure as follows:
1966
1967 *Document type*
1968      If you invoke the `RP' (report) macro on the first line of the
1969      document, `groff' prints the cover page information on its own
1970      page; otherwise it prints the information on the first page with
1971      your document text immediately following.  Other document formats
1972      found in AT&T `troff' are specific to AT&T or Berkeley, and are
1973      not supported in `groff'.
1974
1975 *Format and layout*
1976      By setting number registers, you can change your document's type
1977      (font and size), margins, spacing, headers and footers, and
1978      footnotes.  *Note ms Document Control Registers::, for more
1979      details.
1980
1981 *Cover page*
1982      A cover page consists of a title, the author's name and
1983      institution, an abstract, and the date.(1) (*note General ms
1984      Structure-Footnote-1::)  *Note ms Cover Page Macros::, for more
1985      details.
1986
1987 *Body*
1988      Following the cover page is your document.  You can use the `ms'
1989      macros to write reports, letters, books, and so forth.  The
1990      package is designed for structured documents, consisting of
1991      paragraphs interspersed with headings and augmented by lists,
1992      footnotes, tables, and other common constructs.  *Note ms Body
1993      Text::, for more details.
1994
1995 *Table of contents*
1996      Longer documents usually include a table of contents, which you can
1997      invoke by placing the `TC' macro at the end of your document.  The
1998      `ms' macros have minimal indexing facilities, consisting of the
1999      `IX' macro, which prints an entry on standard error.  Printing the
2000      table of contents at the end is necessary since `groff' is a
2001      single-pass text formatter, thus it cannot determine the page
2002      number of each section until that section has actually been set
2003      and printed.  Since `ms' output is intended for hardcopy, you can
2004      manually relocate the pages containing the table of contents
2005      between the cover page and the body text after printing.
2006
2007 \1f
2008 File: groff,  Node: General ms Structure-Footnotes,  Up: General ms Structure
2009
2010    (1) Actually, only the title is required.
2011
2012 \1f
2013 File: groff,  Node: ms Document Control Registers,  Next: ms Cover Page Macros,  Prev: General ms Structure,  Up: ms
2014
2015 4.3.3 Document control registers
2016 --------------------------------
2017
2018 The following is a list of document control number registers.  For the
2019 sake of consistency, set registers related to margins at the beginning
2020 of your document, or just after the `RP' macro.  You can set other
2021 registers later in your document, but you should keep them together at
2022 the beginning to make them easy to find and edit as necessary.
2023
2024 Margin Settings
2025 ...............
2026
2027  -- Register: \n[PO]
2028      Defines the page offset (i.e., the left margin).  There is no
2029      explicit right margin setting; the combination of the `PO' and `LL'
2030      registers implicitly define the right margin width.
2031
2032      Effective: next page.
2033
2034      Default value: 1i.
2035
2036  -- Register: \n[LL]
2037      Defines the line length (i.e., the width of the body text).
2038
2039      Effective: next paragraph.
2040
2041      Default: 6i.
2042
2043  -- Register: \n[LT]
2044      Defines the title length (i.e., the header and footer width).  This
2045      is usually the same as `LL', but not necessarily.
2046
2047      Effective: next paragraph.
2048
2049      Default: 6i.
2050
2051  -- Register: \n[HM]
2052      Defines the header margin height at the top of the page.
2053
2054      Effective: next page.
2055
2056      Default: 1i.
2057
2058  -- Register: \n[FM]
2059      Defines the footer margin height at the bottom of the page.
2060
2061      Effective: next page.
2062
2063      Default: 1i.
2064
2065 Text Settings
2066 .............
2067
2068  -- Register: \n[PS]
2069      Defines the point size of the body text.  If the value is larger
2070      than or equal to 1000, divide it by 1000 to get a fractional point
2071      size.  For example, `.nr PS 10250' sets the document's point size
2072      to 10.25p.
2073
2074      Effective: next paragraph.
2075
2076      Default: 10p.
2077
2078  -- Register: \n[VS]
2079      Defines the space between lines (line height plus leading).  If the
2080      value is larger than or equal to 1000, divide it by 1000 to get a
2081      fractional point size.  Due to backwards compatibility, `VS' must
2082      be smaller than 40000 (this is 40.0p).
2083
2084      Effective: next paragraph.
2085
2086      Default: 12p.
2087
2088  -- Register: \n[PSINCR]
2089      Defines an increment in point size, which will be applied to
2090      section headings at nesting levels below the value specified in
2091      `GROWPS'.  The value of `PSINCR' should be specified in points,
2092      with the p scaling factor, and may include a fractional component;
2093      for example, `.nr PSINCR 1.5p' sets a point size increment of 1.5p.
2094
2095      Effective: next section heading.
2096
2097      Default: 1p.
2098
2099  -- Register: \n[GROWPS]
2100      Defines the heading level below which the point size increment set
2101      by `PSINCR' becomes effective.  Section headings at and above the
2102      level specified by `GROWPS' will be printed at the point size set
2103      by `PS'; for each level below the value of `GROWPS', the point
2104      size will be increased in steps equal to the value of `PSINCR'.
2105      Setting `GROWPS' to any value less than 2 disables the incremental
2106      heading size feature.
2107
2108      Effective: next section heading.
2109
2110      Default: 0.
2111
2112  -- Register: \n[HY]
2113      Defines the hyphenation level.  `HY' sets safely the value of the
2114      low-level `hy' register.  Setting the value of `HY' to 0 is
2115      equivalent to using the `nh' request.
2116
2117      Effective: next paragraph.
2118
2119      Default: 14.
2120
2121  -- Register: \n[FAM]
2122      Defines the font family used to typeset the document.
2123
2124      Effective: next paragraph.
2125
2126      Default: as defined in the output device.
2127
2128 Paragraph Settings
2129 ..................
2130
2131  -- Register: \n[PI]
2132      Defines the initial indentation of a (`PP' macro) paragraph.
2133
2134      Effective: next paragraph.
2135
2136      Default: 5n.
2137
2138  -- Register: \n[PD]
2139      Defines the space between paragraphs.
2140
2141      Effective: next paragraph.
2142
2143      Default: 0.3v.
2144
2145  -- Register: \n[QI]
2146      Defines the indentation on both sides of a quoted (`QP' macro)
2147      paragraph.
2148
2149      Effective: next paragraph.
2150
2151      Default: 5n.
2152
2153  -- Register: \n[PORPHANS]
2154      Defines the minimum number of initial lines of any paragraph which
2155      should be kept together, to avoid orphan lines at the bottom of a
2156      page.  If a new paragraph is started close to the bottom of a page,
2157      and there is insufficient space to accommodate `PORPHANS' lines
2158      before an automatic page break, then the page break will be forced,
2159      before the start of the paragraph.
2160
2161      Effective: next paragraph.
2162
2163      Default: 1.
2164
2165  -- Register: \n[HORPHANS]
2166      Defines the minimum number of lines of the following paragraph
2167      which should be kept together with any section heading introduced
2168      by the `NH' or `SH' macros.  If a section heading is placed close
2169      to the bottom of a page, and there is insufficient space to
2170      accommodate both the heading and at least `HORPHANS' lines of the
2171      following paragraph, before an automatic page break, then the page
2172      break will be forced before the heading.
2173
2174      Effective: next paragraph.
2175
2176      Default: 1.
2177
2178 Footnote Settings
2179 .................
2180
2181  -- Register: \n[FL]
2182      Defines the length of a footnote.
2183
2184      Effective: next footnote.
2185
2186      Default: `\n[LL]' * 5 / 6.
2187
2188  -- Register: \n[FI]
2189      Defines the footnote indentation.
2190
2191      Effective: next footnote.
2192
2193      Default: 2n.
2194
2195  -- Register: \n[FF]
2196      The footnote format:
2197     `0'
2198           Print the footnote number as a superscript; indent the
2199           footnote (default).
2200
2201     `1'
2202           Print the number followed by a period (like 1.) and indent the
2203           footnote.
2204
2205     `2'
2206           Like 1, without an indentation.
2207
2208     `3'
2209           Like 1, but print the footnote number as a hanging paragraph.
2210
2211      Effective: next footnote.
2212
2213      Default: 0.
2214
2215  -- Register: \n[FPS]
2216      Defines the footnote point size.  If the value is larger than or
2217      equal to 1000, divide it by 1000 to get a fractional point size.
2218
2219      Effective: next footnote.
2220
2221      Default: `\n[PS]' - 2.
2222
2223  -- Register: \n[FVS]
2224      Defines the footnote vertical spacing.  If the value is larger
2225      than or equal to 1000, divide it by 1000 to get a fractional point
2226      size.
2227
2228      Effective: next footnote.
2229
2230      Default: `\n[FPS]' + 2.
2231
2232  -- Register: \n[FPD]
2233      Defines the footnote paragraph spacing.
2234
2235      Effective: next footnote.
2236
2237      Default: `\n[PD]' / 2.
2238
2239 Miscellaneous Number Registers
2240 ..............................
2241
2242  -- Register: \n[MINGW]
2243      Defines the minimum width between columns in a multi-column
2244      document.
2245
2246      Effective: next page.
2247
2248      Default: 2n.
2249
2250 \1f
2251 File: groff,  Node: ms Cover Page Macros,  Next: ms Body Text,  Prev: ms Document Control Registers,  Up: ms
2252
2253 4.3.4 Cover page macros
2254 -----------------------
2255
2256 Use the following macros to create a cover page for your document in
2257 the order shown.
2258
2259  -- Macro: .RP [`no']
2260      Specifies the report format for your document.  The report format
2261      creates a separate cover page.  The default action (no `RP' macro)
2262      is to print a subset of the cover page on page 1 of your document.
2263
2264      If you use the word `no' as an optional argument, `groff' prints a
2265      title page but does not repeat any of the title page information
2266      (title, author, abstract, etc.) on page 1 of the document.
2267
2268  -- Macro: .P1
2269      (P-one) Prints the header on page 1.  The default is to suppress
2270      the header.
2271
2272  -- Macro: .DA [...]
2273      (optional) Prints the current date, or the arguments to the macro
2274      if any, on the title page (if specified) and in the footers.  This
2275      is the default for `nroff'.
2276
2277  -- Macro: .ND [...]
2278      (optional) Prints the current date, or the arguments to the macro
2279      if any, on the title page (if specified) but not in the footers.
2280      This is the default for `troff'.
2281
2282  -- Macro: .TL
2283      Specifies the document title.  `groff' collects text following the
2284      `TL' macro into the title, until reaching the author name or
2285      abstract.
2286
2287  -- Macro: .AU
2288      Specifies the author's name, which appears on the line (or lines)
2289      immediately following.  You can specify multiple authors as
2290      follows:
2291
2292
2293           .AU
2294           John Doe
2295           .AI
2296           University of West Bumblefuzz
2297           .AU
2298           Martha Buck
2299           .AI
2300           Monolithic Corporation
2301
2302           ...
2303
2304
2305  -- Macro: .AI
2306      Specifies the author's institution.  You can specify multiple
2307      institutions in the same way that you specify multiple authors.
2308
2309  -- Macro: .AB [`no']
2310      Begins the abstract.  The default is to print the word ABSTRACT,
2311      centered and in italics, above the text of the abstract.  The word
2312      `no' as an optional argument suppresses this heading.
2313
2314  -- Macro: .AE
2315      Ends the abstract.
2316
2317    The following is example mark-up for a title page.  
2318
2319
2320      .RP
2321      .TL
2322      The Inevitability of Code Bloat
2323      in Commercial and Free Software
2324      .AU
2325      J. Random Luser
2326      .AI
2327      University of West Bumblefuzz
2328      .AB
2329      This report examines the long-term growth
2330      of the code bases in two large, popular software
2331      packages; the free Emacs and the commercial
2332      Microsoft Word.
2333      While differences appear in the type or order
2334      of features added, due to the different
2335      methodologies used, the results are the same
2336      in the end.
2337      .PP
2338      The free software approach is shown to be
2339      superior in that while free software can
2340      become as bloated as commercial offerings,
2341      free software tends to have fewer serious
2342      bugs and the added features are in line with
2343      user demand.
2344      .AE
2345
2346      ... the rest of the paper follows ...
2347
2348 \1f
2349 File: groff,  Node: ms Body Text,  Next: ms Page Layout,  Prev: ms Cover Page Macros,  Up: ms
2350
2351 4.3.5 Body text
2352 ---------------
2353
2354 This section describes macros used to mark up the body of your
2355 document.  Examples include paragraphs, sections, and other groups.
2356
2357 * Menu:
2358
2359 * Paragraphs in ms::
2360 * Headings in ms::
2361 * Highlighting in ms::
2362 * Lists in ms::
2363 * Indentation values in ms::
2364 * Tabstops in ms::
2365 * ms Displays and Keeps::
2366 * ms Insertions::
2367 * Example multi-page table::
2368 * ms Footnotes::
2369
2370 \1f
2371 File: groff,  Node: Paragraphs in ms,  Next: Headings in ms,  Prev: ms Body Text,  Up: ms Body Text
2372
2373 4.3.5.1 Paragraphs
2374 ..................
2375
2376 The following paragraph types are available.
2377
2378  -- Macro: .PP
2379  -- Macro: .LP
2380      Sets a paragraph with an initial indentation.
2381
2382  -- Macro: .QP
2383      Sets a paragraph that is indented at both left and right margins.
2384      The effect is identical to the HTML `<BLOCKQUOTE>' element.  The
2385      next paragraph or heading returns margins to normal.
2386
2387  -- Macro: .XP
2388      Sets a paragraph whose lines are indented, except for the first
2389      line.  This is a Berkeley extension.
2390
2391    The following markup uses all four paragraph macros.
2392
2393
2394      .NH 2
2395      Cases used in the study
2396      .LP
2397      The following software and versions were
2398      considered for this report.
2399      .PP
2400      For commercial software, we chose
2401      .B "Microsoft Word for Windows" ,
2402      starting with version 1.0 through the
2403      current version (Word 2000).
2404      .PP
2405      For free software, we chose
2406      .B Emacs ,
2407      from its first appearance as a standalone
2408      editor through the current version (v20).
2409      See [Bloggs 2002] for details.
2410      .QP
2411      Franklin's Law applied to software:
2412      software expands to outgrow both
2413      RAM and disk space over time.
2414      .LP
2415      Bibliography:
2416      .XP
2417      Bloggs, Joseph R.,
2418      .I "Everyone's a Critic" ,
2419      Underground Press, March 2002.
2420      A definitive work that answers all questions
2421      and criticisms about the quality and usability of
2422      free software.
2423
2424    The `PORPHANS' register (*note ms Document Control Registers::)
2425 operates in conjunction with each of these macros, to inhibit the
2426 printing of orphan lines at the bottom of any page.
2427
2428 \1f
2429 File: groff,  Node: Headings in ms,  Next: Highlighting in ms,  Prev: Paragraphs in ms,  Up: ms Body Text
2430
2431 4.3.5.2 Headings
2432 ................
2433
2434 Use headings to create a hierarchical structure for your document.  The
2435 `ms' macros print headings in *bold*, using the same font family and
2436 point size as the body text.
2437
2438    The following describes the heading macros:
2439
2440  -- Macro: .NH curr-level
2441  -- Macro: .NH S level0 ...
2442      Numbered heading.  The argument is either a numeric argument to
2443      indicate the level of the heading, or the letter `S' followed by
2444      numeric arguments to set the heading level explicitly.
2445
2446      If you specify heading levels out of sequence, such as invoking
2447      `.NH 3' after `.NH 1', `groff' prints a warning on standard error.
2448
2449  -- String: \*[SN]
2450  -- String: \*[SN-DOT]
2451  -- String: \*[SN-NO-DOT]
2452      After invocation of `NH', the assigned section number is made
2453      available in the strings `SN-DOT' (exactly as it appears in the
2454      printed section heading) and `SN-NO-DOT' (with the final period
2455      omitted).  The string `SN' is also defined, as an alias for
2456      `SN-DOT'; if preferred, you may redefine it as an alias for
2457      `SN-NO-DOT', by including the initialization
2458
2459
2460           .ds SN-NO-DOT
2461           .als SN SN-NO-DOT
2462
2463      *before* your first use of `NH', or simply
2464
2465
2466           .als SN SN-NO-DOT
2467
2468      *after* your first use of `NH'.
2469
2470  -- Macro: .SH [match-level]
2471      Unnumbered subheading.
2472
2473      The optional MATCH-LEVEL argument is a GNU extension.  It is a
2474      number indicating the level of the heading, in a manner analogous
2475      to the CURR-LEVEL argument to `.NH'.  Its purpose is to match the
2476      point size, at which the heading is printed, to the size of a
2477      numbered heading at the same level, when the `GROWPS' and `PSINCR'
2478      heading size adjustment mechanism is in effect.  *Note ms Document
2479      Control Registers::.
2480
2481    The `HORPHANS' register (*note ms Document Control Registers::)
2482 operates in conjunction with the `NH' and `SH' macros, to inhibit the
2483 printing of orphaned section headings at the bottom of any page.
2484
2485 \1f
2486 File: groff,  Node: Highlighting in ms,  Next: Lists in ms,  Prev: Headings in ms,  Up: ms Body Text
2487
2488 4.3.5.3 Highlighting
2489 ....................
2490
2491 The `ms' macros provide a variety of methods to highlight or emphasize
2492 text:
2493
2494  -- Macro: .B [txt [post [pre]]]
2495      Sets its first argument in *bold type*.  If you specify a second
2496      argument, `groff' prints it in the previous font after the bold
2497      text, with no intervening space (this allows you to set
2498      punctuation after the highlighted text without highlighting the
2499      punctuation).  Similarly, it prints the third argument (if any) in
2500      the previous font *before* the first argument.  For example,
2501
2502
2503           .B foo ) (
2504
2505      prints (*foo*).
2506
2507      If you give this macro no arguments, `groff' prints all text
2508      following in bold until the next highlighting, paragraph, or
2509      heading macro.
2510
2511  -- Macro: .R [txt [post [pre]]]
2512      Sets its first argument in roman (or regular) type.  It operates
2513      similarly to the `B' macro otherwise.
2514
2515  -- Macro: .I [txt [post [pre]]]
2516      Sets its first argument in _italic type_.  It operates similarly
2517      to the `B' macro otherwise.
2518
2519  -- Macro: .CW [txt [post [pre]]]
2520      Sets its first argument in a `constant width face'.  It operates
2521      similarly to the `B' macro otherwise.
2522
2523  -- Macro: .BI [txt [post [pre]]]
2524      Sets its first argument in bold italic type.  It operates
2525      similarly to the `B' macro otherwise.
2526
2527  -- Macro: .BX [txt]
2528      Prints its argument and draws a box around it.  If you want to box
2529      a string that contains spaces, use a digit-width space (`\0').
2530
2531  -- Macro: .UL [txt [post]]
2532      Prints its first argument with an underline.  If you specify a
2533      second argument, `groff' prints it in the previous font after the
2534      underlined text, with no intervening space.
2535
2536  -- Macro: .LG
2537      Prints all text following in larger type (two points larger than
2538      the current point size) until the next font size, highlighting,
2539      paragraph, or heading macro.  You can specify this macro multiple
2540      times to enlarge the point size as needed.
2541
2542  -- Macro: .SM
2543      Prints all text following in smaller type (two points smaller than
2544      the current point size) until the next type size, highlighting,
2545      paragraph, or heading macro.  You can specify this macro multiple
2546      times to reduce the point size as needed.
2547
2548  -- Macro: .NL
2549      Prints all text following in the normal point size (that is, the
2550      value of the `PS' register).
2551
2552  -- String: \*[{]
2553  -- String: \*[}]
2554      Text enclosed with `\*{' and `\*}' is printed as a superscript.
2555
2556 \1f
2557 File: groff,  Node: Lists in ms,  Next: Indentation values in ms,  Prev: Highlighting in ms,  Up: ms Body Text
2558
2559 4.3.5.4 Lists
2560 .............
2561
2562 The `IP' macro handles duties for all lists.
2563
2564  -- Macro: .IP [marker [width]]
2565      The MARKER is usually a bullet glyph (`\[bu]') for unordered
2566      lists, a number (or auto-incrementing number register) for
2567      numbered lists, or a word or phrase for indented (glossary-style)
2568      lists.
2569
2570      The WIDTH specifies the indentation for the body of each list
2571      item; its default unit is `n'.  Once specified, the indentation
2572      remains the same for all list items in the document until specified
2573      again.
2574
2575      The `PORPHANS' register (*note ms Document Control Registers::)
2576      operates in conjunction with the `IP' macro, to inhibit the
2577      printing of orphaned list markers at the bottom of any page.
2578
2579    The following is an example of a bulleted list.  
2580
2581
2582      A bulleted list:
2583      .IP \[bu] 2
2584      lawyers
2585      .IP \[bu]
2586      guns
2587      .IP \[bu]
2588      money
2589
2590    Produces:
2591
2592
2593      A bulleted list:
2594
2595      o lawyers
2596
2597      o guns
2598
2599      o money
2600
2601    The following is an example of a numbered list.  
2602
2603
2604      .nr step 1 1
2605      A numbered list:
2606      .IP \n[step] 3
2607      lawyers
2608      .IP \n+[step]
2609      guns
2610      .IP \n+[step]
2611      money
2612
2613    Produces:
2614
2615
2616      A numbered list:
2617
2618      1. lawyers
2619
2620      2. guns
2621
2622      3. money
2623
2624    Note the use of the auto-incrementing number register in this
2625 example.
2626
2627    The following is an example of a glossary-style list.  
2628
2629
2630      A glossary-style list:
2631      .IP lawyers 0.4i
2632      Two or more attorneys.
2633      .IP guns
2634      Firearms, preferably
2635      large-caliber.
2636      .IP money
2637      Gotta pay for those
2638      lawyers and guns!
2639
2640    Produces:
2641
2642
2643      A glossary-style list:
2644
2645      lawyers
2646            Two or more attorneys.
2647
2648      guns  Firearms, preferably large-caliber.
2649
2650      money
2651            Gotta pay for those lawyers and guns!
2652
2653    In the last example, the `IP' macro places the definition on the
2654 same line as the term if it has enough space; otherwise, it breaks to
2655 the next line and starts the definition below the term.  This may or
2656 may not be the effect you want, especially if some of the definitions
2657 break and some do not.  The following examples show two possible ways
2658 to force a break.
2659
2660    The first workaround uses the `br' request to force a break after
2661 printing the term or label.
2662
2663
2664      A glossary-style list:
2665      .IP lawyers 0.4i
2666      Two or more attorneys.
2667      .IP guns
2668      .br
2669      Firearms, preferably large-caliber.
2670      .IP money
2671      Gotta pay for those lawyers and guns!
2672
2673    The second workaround uses the `\p' escape to force the break.  Note
2674 the space following the escape; this is important.  If you omit the
2675 space, `groff' prints the first word on the same line as the term or
2676 label (if it fits) *then* breaks the line.
2677
2678
2679      A glossary-style list:
2680      .IP lawyers 0.4i
2681      Two or more attorneys.
2682      .IP guns
2683      \p Firearms, preferably large-caliber.
2684      .IP money
2685      Gotta pay for those lawyers and guns!
2686
2687    To set nested lists, use the `RS' and `RE' macros.  *Note
2688 Indentation values in ms::, for more information.  
2689
2690    For example:
2691
2692
2693      .IP \[bu] 2
2694      Lawyers:
2695      .RS
2696      .IP \[bu]
2697      Dewey,
2698      .IP \[bu]
2699      Cheatham,
2700      .IP \[bu]
2701      and Howe.
2702      .RE
2703      .IP \[bu]
2704      Guns
2705
2706    Produces:
2707
2708
2709      o Lawyers:
2710
2711        o  Dewey,
2712
2713        o  Cheatham,
2714
2715        o  and Howe.
2716
2717      o Guns
2718
2719 \1f
2720 File: groff,  Node: Indentation values in ms,  Next: Tabstops in ms,  Prev: Lists in ms,  Up: ms Body Text
2721
2722 4.3.5.5 Indentation values
2723 ..........................
2724
2725 In many situations, you may need to indentation a section of text while
2726 still wrapping and filling.  *Note Lists in ms::, for an example of
2727 nested lists.
2728
2729  -- Macro: .RS
2730  -- Macro: .RE
2731      These macros begin and end an indented section.  The `PI' register
2732      controls the amount of indentation, allowing the indented text to
2733      line up under hanging and indented paragraphs.
2734
2735    *Note ms Displays and Keeps::, for macros to indentation and turn off
2736 filling.
2737
2738 \1f
2739 File: groff,  Node: Tabstops in ms,  Next: ms Displays and Keeps,  Prev: Indentation values in ms,  Up: ms Body Text
2740
2741 4.3.5.6 Tab Stops
2742 .................
2743
2744 Use the `ta' request to define tab stops as needed.  *Note Tabs and
2745 Fields::.
2746
2747  -- Macro: .TA
2748      Use this macro to reset the tab stops to the default for `ms'
2749      (every 5n).  You can redefine the `TA' macro to create a different
2750      set of default tab stops.
2751
2752 \1f
2753 File: groff,  Node: ms Displays and Keeps,  Next: ms Insertions,  Prev: Tabstops in ms,  Up: ms Body Text
2754
2755 4.3.5.7 Displays and keeps
2756 ..........................
2757
2758 Use displays to show text-based examples or figures (such as code
2759 listings).
2760
2761    Displays turn off filling, so lines of code are displayed as-is
2762 without inserting `br' requests in between each line.  Displays can be
2763 "kept" on a single page, or allowed to break across pages.
2764
2765  -- Macro: .DS L
2766  -- Macro: .LD
2767  -- Macro: .DE
2768      Left-justified display.  The `.DS L' call generates a page break,
2769      if necessary, to keep the entire display on one page.  The `LD'
2770      macro allows the display to break across pages.  The `DE' macro
2771      ends the display.
2772
2773  -- Macro: .DS I
2774  -- Macro: .ID
2775  -- Macro: .DE
2776      Indents the display as defined by the `DI' register.  The `.DS I'
2777      call generates a page break, if necessary, to keep the entire
2778      display on one page.  The `ID' macro allows the display to break
2779      across pages.  The `DE' macro ends the display.
2780
2781  -- Macro: .DS B
2782  -- Macro: .BD
2783  -- Macro: .DE
2784      Sets a block-centered display: the entire display is
2785      left-justified, but indented so that the longest line in the
2786      display is centered on the page.  The `.DS B' call generates a
2787      page break, if necessary, to keep the entire display on one page.
2788      The `BD' macro allows the display to break across pages.  The `DE'
2789      macro ends the display.
2790
2791  -- Macro: .DS C
2792  -- Macro: .CD
2793  -- Macro: .DE
2794      Sets a centered display: each line in the display is centered.  The
2795      `.DS C' call generates a page break, if necessary, to keep the
2796      entire display on one page.  The `CD' macro allows the display to
2797      break across pages.  The `DE' macro ends the display.
2798
2799  -- Macro: .DS R
2800  -- Macro: .RD
2801  -- Macro: .DE
2802      Right-justifies each line in the display.  The `.DS R' call
2803      generates a page break, if necessary, to keep the entire display on
2804      one page.  The `RD' macro allows the display to break across
2805      pages.  The `DE' macro ends the display.
2806
2807  -- Macro: .Ds
2808  -- Macro: .De
2809      These two macros were formerly provided as aliases for `DS' and
2810      `DE', respectively.  They have been removed, and should no longer
2811      be used.  The original implementations of `DS' and `DE' are
2812      retained, and should be used instead.  X11 documents which actually
2813      use `Ds' and `De' always load a specific macro file from the X11
2814      distribution (`macros.t') which provides proper definitions for
2815      the two macros.
2816
2817    On occasion, you may want to "keep" other text together on a page.
2818 For example, you may want to keep two paragraphs together, or a
2819 paragraph that refers to a table (or list, or other item) immediately
2820 following.  The `ms' macros provide the `KS' and `KE' macros for this
2821 purpose.
2822
2823  -- Macro: .KS
2824  -- Macro: .KE
2825      The `KS' macro begins a block of text to be kept on a single page,
2826      and the `KE' macro ends the block.
2827
2828  -- Macro: .KF
2829  -- Macro: .KE
2830      Specifies a "floating keep"; if the keep cannot fit on the current
2831      page, `groff' holds the contents of the keep and allows text
2832      following the keep (in the source file) to fill in the remainder of
2833      the current page.  When the page breaks, whether by an explicit
2834      `bp' request or by reaching the end of the page, `groff' prints
2835      the floating keep at the top of the new page.  This is useful for
2836      printing large graphics or tables that do not need to appear
2837      exactly where specified.
2838
2839    You can also use the `ne' request to force a page break if there is
2840 not enough vertical space remaining on the page.
2841
2842    Use the following macros to draw a box around a section of text (such
2843 as a display).
2844
2845  -- Macro: .B1
2846  -- Macro: .B2
2847      Marks the beginning and ending of text that is to have a box drawn
2848      around it.  The `B1' macro begins the box; the `B2' macro ends it.
2849      Text in the box is automatically placed in a diversion (keep).
2850
2851 \1f
2852 File: groff,  Node: ms Insertions,  Next: Example multi-page table,  Prev: ms Displays and Keeps,  Up: ms Body Text
2853
2854 4.3.5.8 Tables, figures, equations, and references
2855 ..................................................
2856
2857 The `ms' macros support the standard `groff' preprocessors: `tbl',
2858 `pic', `eqn', and `refer'.  You mark text meant for preprocessors by
2859 enclosing it in pairs of tags as follows.
2860
2861  -- Macro: .TS [`H']
2862  -- Macro: .TE
2863      Denotes a table, to be processed by the `tbl' preprocessor.  The
2864      optional argument `H' to `TS' instructs `groff' to create a
2865      running header with the information up to the `TH' macro.  `groff'
2866      prints the header at the beginning of the table; if the table runs
2867      onto another page, `groff' prints the header on the next page as
2868      well.
2869
2870  -- Macro: .PS
2871  -- Macro: .PE
2872      Denotes a graphic, to be processed by the `pic' preprocessor.  You
2873      can create a `pic' file by hand, using the AT&T `pic' manual
2874      available on the Web as a reference, or by using a graphics
2875      program such as `xfig'.
2876
2877  -- Macro: .EQ [align]
2878  -- Macro: .EN
2879      Denotes an equation, to be processed by the `eqn' preprocessor.
2880      The optional ALIGN argument can be `C', `L', or `I' to center (the
2881      default), left-justify, or indent the equation.
2882
2883  -- Macro: .[
2884  -- Macro: .]
2885      Denotes a reference, to be processed by the `refer' preprocessor.
2886      The GNU `refer(1)' man page provides a comprehensive reference to
2887      the preprocessor and the format of the bibliographic database.
2888
2889 * Menu:
2890
2891 * Example multi-page table::
2892
2893 \1f
2894 File: groff,  Node: Example multi-page table,  Next: ms Footnotes,  Prev: ms Insertions,  Up: ms Body Text
2895
2896 4.3.5.9 An example multi-page table
2897 ...................................
2898
2899 The following is an example of how to set up a table that may print
2900 across two or more pages.
2901
2902
2903      .TS H
2904      allbox expand;
2905      cb | cb .
2906      Text      ...of heading...
2907      _
2908      .TH
2909      .T&
2910      l | l .
2911      ... the rest of the table follows...
2912      .CW
2913      .TE
2914
2915 \1f
2916 File: groff,  Node: ms Footnotes,  Prev: Example multi-page table,  Up: ms Body Text
2917
2918 4.3.5.10 Footnotes
2919 ..................
2920
2921 The `ms' macro package has a flexible footnote system.  You can specify
2922 either numbered footnotes or symbolic footnotes (that is, using a
2923 marker such as a dagger symbol).
2924
2925  -- String: \*[*]
2926      Specifies the location of a numbered footnote marker in the text.
2927
2928  -- Macro: .FS
2929  -- Macro: .FE
2930      Specifies the text of the footnote.  The default action is to
2931      create a numbered footnote; you can create a symbolic footnote by
2932      specifying a "mark" glyph (such as `\[dg]' for the dagger glyph)
2933      in the body text and as an argument to the `FS' macro, followed by
2934      the text of the footnote and the `FE' macro.
2935
2936    You can control how `groff' prints footnote numbers by changing the
2937 value of the `FF' register.  *Note ms Document Control Registers::.
2938
2939    Footnotes can be safely used within keeps and displays, but you
2940 should avoid using numbered footnotes within floating keeps.  You can
2941 set a second `\**' marker between a `\**' and its corresponding `.FS'
2942 entry; as long as each `FS' macro occurs _after_ the corresponding
2943 `\**' and the occurrences of `.FS' are in the same order as the
2944 corresponding occurrences of `\**'.
2945
2946 \1f
2947 File: groff,  Node: ms Page Layout,  Next: Differences from AT&T ms,  Prev: ms Body Text,  Up: ms
2948
2949 4.3.6 Page layout
2950 -----------------
2951
2952 The default output from the `ms' macros provides a minimalist page
2953 layout: it prints a single column, with the page number centered at the
2954 top of each page.  It prints no footers.
2955
2956    You can change the layout by setting the proper number registers and
2957 strings.
2958
2959 * Menu:
2960
2961 * ms Headers and Footers::
2962 * ms Margins::
2963 * ms Multiple Columns::
2964 * ms TOC::
2965 * ms Strings and Special Characters::
2966
2967 \1f
2968 File: groff,  Node: ms Headers and Footers,  Next: ms Margins,  Prev: ms Page Layout,  Up: ms Page Layout
2969
2970 4.3.6.1 Headers and footers
2971 ...........................
2972
2973 For documents that do not distinguish between odd and even pages, set
2974 the following strings:
2975
2976  -- String: \*[LH]
2977  -- String: \*[CH]
2978  -- String: \*[RH]
2979      Sets the left, center, and right headers.
2980
2981  -- String: \*[LF]
2982  -- String: \*[CF]
2983  -- String: \*[RF]
2984      Sets the left, center, and right footers.
2985
2986    For documents that need different information printed in the even and
2987 odd pages, use the following macros:
2988
2989  -- Macro: .OH 'left'center'right'
2990  -- Macro: .EH 'left'center'right'
2991  -- Macro: .OF 'left'center'right'
2992  -- Macro: .EF 'left'center'right'
2993      The `OH' and `EH' macros define headers for the odd and even
2994      pages; the `OF' and `EF' macros define footers for the odd and
2995      even pages.  This is more flexible than defining the individual
2996      strings.
2997
2998      You can replace the quote (`'') marks with any character not
2999      appearing in the header or footer text.
3000
3001 \1f
3002 File: groff,  Node: ms Margins,  Next: ms Multiple Columns,  Prev: ms Headers and Footers,  Up: ms Page Layout
3003
3004 4.3.6.2 Margins
3005 ...............
3006
3007 You control margins using a set of number registers.  *Note ms Document
3008 Control Registers::, for details.
3009
3010 \1f
3011 File: groff,  Node: ms Multiple Columns,  Next: ms TOC,  Prev: ms Margins,  Up: ms Page Layout
3012
3013 4.3.6.3 Multiple columns
3014 ........................
3015
3016 The `ms' macros can set text in as many columns as will reasonably fit
3017 on the page.  The following macros are available; all of them force a
3018 page break if a multi-column mode is already set.  However, if the
3019 current mode is single-column, starting a multi-column mode does _not_
3020 force a page break.
3021
3022  -- Macro: .1C
3023      Single-column mode.
3024
3025  -- Macro: .2C
3026      Two-column mode.
3027
3028  -- Macro: .MC [width [gutter]]
3029      Multi-column mode.  If you specify no arguments, it is equivalent
3030      to the `2C' macro.  Otherwise, WIDTH is the width of each column
3031      and GUTTER is the space between columns.  The `MINGW' number
3032      register controls the default gutter width.
3033
3034 \1f
3035 File: groff,  Node: ms TOC,  Next: ms Strings and Special Characters,  Prev: ms Multiple Columns,  Up: ms Page Layout
3036
3037 4.3.6.4 Creating a table of contents
3038 ....................................
3039
3040 The facilities in the `ms' macro package for creating a table of
3041 contents are semi-automated at best.  Assuming that you want the table
3042 of contents to consist of the document's headings, you need to repeat
3043 those headings wrapped in `XS' and `XE' macros.
3044
3045  -- Macro: .XS [page]
3046  -- Macro: .XA [page]
3047  -- Macro: .XE
3048      These macros define a table of contents or an individual entry in
3049      the table of contents, depending on their use.  The macros are very
3050      simple; they cannot indent a heading based on its level.  The
3051      easiest way to work around this is to add tabs to the table of
3052      contents string.  The following is an example:
3053
3054
3055           .NH 1
3056           Introduction
3057           .XS
3058           Introduction
3059           .XE
3060           .LP
3061           ...
3062           .CW
3063           .NH 2
3064           Methodology
3065           .XS
3066           Methodology
3067           .XE
3068           .LP
3069           ...
3070
3071      You can manually create a table of contents by beginning with the
3072      `XS' macro for the first entry, specifying the page number for
3073      that entry as the argument to `XS'.  Add subsequent entries using
3074      the `XA' macro, specifying the page number for that entry as the
3075      argument to `XA'.  The following is an example:
3076
3077
3078           .XS 1
3079           Introduction
3080           .XA 2
3081           A Brief History of the Universe
3082           .XA 729
3083           Details of Galactic Formation
3084           ...
3085           .XE
3086
3087
3088  -- Macro: .TC [`no']
3089      Prints the table of contents on a new page, setting the page number
3090      to *i* (Roman lowercase numeral one).  You should usually place
3091      this macro at the end of the file, since `groff' is a single-pass
3092      formatter and can only print what has been collected up to the
3093      point that the `TC' macro appears.
3094
3095      The optional argument `no' suppresses printing the title specified
3096      by the string register `TOC'.
3097
3098  -- Macro: .PX [`no']
3099      Prints the table of contents on a new page, using the current page
3100      numbering sequence.  Use this macro to print a manually-generated
3101      table of contents at the beginning of your document.
3102
3103      The optional argument `no' suppresses printing the title specified
3104      by the string register `TOC'.
3105
3106    The `Groff and Friends HOWTO' includes a `sed' script that
3107 automatically inserts `XS' and `XE' macro entries after each heading in
3108 a document.
3109
3110    Altering the `NH' macro to automatically build the table of contents
3111 is perhaps initially more difficult, but would save a great deal of
3112 time in the long run if you use `ms' regularly.
3113
3114 \1f
3115 File: groff,  Node: ms Strings and Special Characters,  Prev: ms TOC,  Up: ms Page Layout
3116
3117 4.3.6.5 Strings and Special Characters
3118 ......................................
3119
3120 The `ms' macros provide the following predefined strings.  You can
3121 change the string definitions to help in creating documents in
3122 languages other than English.
3123
3124  -- String: \*[REFERENCES]
3125      Contains the string printed at the beginning of the references
3126      (bibliography) page.  The default is `References'.
3127
3128  -- String: \*[ABSTRACT]
3129      Contains the string printed at the beginning of the abstract.  The
3130      default is `ABSTRACT'.
3131
3132  -- String: \*[TOC]
3133      Contains the string printed at the beginning of the table of
3134      contents.
3135
3136  -- String: \*[MONTH1]
3137  -- String: \*[MONTH2]
3138  -- String: \*[MONTH3]
3139  -- String: \*[MONTH4]
3140  -- String: \*[MONTH5]
3141  -- String: \*[MONTH6]
3142  -- String: \*[MONTH7]
3143  -- String: \*[MONTH8]
3144  -- String: \*[MONTH9]
3145  -- String: \*[MONTH10]
3146  -- String: \*[MONTH11]
3147  -- String: \*[MONTH12]
3148      Prints the full name of the month in dates.  The default is
3149      `January', `February', etc.
3150
3151    The following special characters are available(1) (*note ms Strings
3152 and Special Characters-Footnote-1::):
3153
3154  -- String: \*[-]
3155      Prints an em dash.
3156
3157  -- String: \*[Q]
3158  -- String: \*[U]
3159      Prints typographer's quotes in troff, and plain quotes in nroff.
3160      `\*Q' is the left quote and `\*U' is the right quote.
3161
3162    Improved accent marks are available in the `ms' macros.
3163
3164  -- Macro: .AM
3165      Specify this macro at the beginning of your document to enable
3166      extended accent marks and special characters.  This is a Berkeley
3167      extension.
3168
3169      To use the accent marks, place them *after* the character being
3170      accented.
3171
3172      Note that groff's native support for accents is superior to the
3173      following definitions.
3174
3175    The following accent marks are available after invoking the `AM'
3176 macro:
3177
3178  -- String: \*[']
3179      Acute accent.
3180
3181  -- String: \*[`]
3182      Grave accent.
3183
3184  -- String: \*[^]
3185      Circumflex.
3186
3187  -- String: \*[,]
3188      Cedilla.
3189
3190  -- String: \*[~]
3191      Tilde.
3192
3193  -- String: \*[:]
3194      Umlaut.
3195
3196  -- String: \*[v]
3197      Hacek.
3198
3199  -- String: \*[_]
3200      Macron (overbar).
3201
3202  -- String: \*[.]
3203      Underdot.
3204
3205  -- String: \*[o]
3206      Ring above.
3207
3208    The following are standalone characters available after invoking the
3209 `AM' macro:
3210
3211  -- String: \*[?]
3212      Upside-down question mark.
3213
3214  -- String: \*[!]
3215      Upside-down exclamation point.
3216
3217  -- String: \*[8]
3218      German Ăź ligature.
3219
3220  -- String: \*[3]
3221      Yogh.
3222
3223  -- String: \*[Th]
3224      Uppercase thorn.
3225
3226  -- String: \*[th]
3227      Lowercase thorn.
3228
3229  -- String: \*[D-]
3230      Uppercase eth.
3231
3232  -- String: \*[d-]
3233      Lowercase eth.
3234
3235  -- String: \*[q]
3236      Hooked o.
3237
3238  -- String: \*[ae]
3239      Lowercase Ă¦ ligature.
3240
3241  -- String: \*[Ae]
3242      Uppercase Ă† ligature.
3243
3244 \1f
3245 File: groff,  Node: ms Strings and Special Characters-Footnotes,  Up: ms Strings and Special Characters
3246
3247    (1) For an explanation what special characters are see *Note Special
3248 Characters::.
3249
3250 \1f
3251 File: groff,  Node: Differences from AT&T ms,  Next: Naming Conventions,  Prev: ms Page Layout,  Up: ms
3252
3253 4.3.7 Differences from AT&T `ms'
3254 --------------------------------
3255
3256 This section lists the (minor) differences between the `groff -ms'
3257 macros and AT&T `troff -ms' macros.
3258
3259    * The internals of `groff -ms' differ from the internals of AT&T
3260      `troff -ms'.  Documents that depend upon implementation details of
3261      AT&T `troff -ms' may not format properly with `groff -ms'.
3262
3263    * The general error-handling policy of `groff -ms' is to detect and
3264      report errors, rather than silently to ignore them.
3265
3266    * `groff -ms' does not work in compatibility mode (this is, with the
3267      `-C' option).
3268
3269    * There is no special support for typewriter-like devices.
3270
3271    * `groff -ms' does not provide cut marks.
3272
3273    * Multiple line spacing is not supported.  Use a larger vertical
3274      spacing instead.
3275
3276    * Some UNIX `ms' documentation says that the `CW' and `GW' number
3277      registers can be used to control the column width and gutter
3278      width, respectively.  These number registers are not used in
3279      `groff -ms'.
3280
3281    * Macros that cause a reset (paragraphs, headings, etc.) may change
3282      the indentation.  Macros that change the indentation do not
3283      increment or decrement the indentation, but rather set it
3284      absolutely.  This can cause problems for documents that define
3285      additional macros of their own.  The solution is to use not the
3286      `in' request but instead the `RS' and `RE' macros.
3287
3288    * To make `groff -ms' use the default page offset (which also
3289      specifies the left margin), the `PO' register must stay undefined
3290      until the first `-ms' macro is evaluated.  This implies that `PO'
3291      should not be used early in the document, unless it is changed
3292      also: Remember that accessing an undefined register automatically
3293      defines it.
3294
3295  -- Register: \n[GS]
3296      This number register is set to 1 by the `groff -ms' macros, but it
3297      is not used by the `AT&T' `troff -ms' macros.  Documents that need
3298      to determine whether they are being formatted with `AT&T' `troff
3299      -ms' or `groff -ms' should use this number register.
3300
3301 * Menu:
3302
3303 * Missing ms Macros::
3304 * Additional ms Macros::
3305
3306 \1f
3307 File: groff,  Node: Missing ms Macros,  Next: Additional ms Macros,  Prev: Differences from AT&T ms,  Up: Differences from AT&T ms
3308
3309 4.3.7.1 `troff' macros not appearing in `groff'
3310 ...............................................
3311
3312 Macros missing from `groff -ms' are cover page macros specific to Bell
3313 Labs and Berkeley.  The macros known to be missing are:
3314
3315 `.TM'
3316      Technical memorandum; a cover sheet style
3317
3318 `.IM'
3319      Internal memorandum; a cover sheet style
3320
3321 `.MR'
3322      Memo for record; a cover sheet style
3323
3324 `.MF'
3325      Memo for file; a cover sheet style
3326
3327 `.EG'
3328      Engineer's notes; a cover sheet style
3329
3330 `.TR'
3331      Computing Science Tech Report; a cover sheet style
3332
3333 `.OK'
3334      Other keywords
3335
3336 `.CS'
3337      Cover sheet information
3338
3339 `.MH'
3340      A cover sheet macro
3341
3342 \1f
3343 File: groff,  Node: Additional ms Macros,  Prev: Missing ms Macros,  Up: Differences from AT&T ms
3344
3345 4.3.7.2 `groff' macros not appearing in AT&T `troff'
3346 ....................................................
3347
3348 The `groff -ms' macros have a few minor extensions compared to the AT&T
3349 `troff -ms' macros.
3350
3351  -- Macro: .AM
3352      Improved accent marks.  *Note ms Strings and Special Characters::,
3353      for details.
3354
3355  -- Macro: .DS I
3356      Indented display.  The default behavior of AT&T `troff -ms' was to
3357      indent; the `groff' default prints displays flush left with the
3358      body text.
3359
3360  -- Macro: .CW
3361      Print text in `constant width' (Courier) font.
3362
3363  -- Macro: .IX
3364      Indexing term (printed on standard error).  You can write a script
3365      to capture and process an index generated in this manner.
3366
3367    The following additional number registers appear in `groff -ms':
3368
3369  -- Register: \n[MINGW]
3370      Specifies a minimum space between columns (for multi-column
3371      output); this takes the place of the `GW' register that was
3372      documented but apparently not implemented in AT&T `troff'.
3373
3374    Several new string registers are available as well.  You can change
3375 these to handle (for example) the local language.  *Note ms Strings and
3376 Special Characters::, for details.
3377
3378 \1f
3379 File: groff,  Node: Naming Conventions,  Prev: Differences from AT&T ms,  Up: ms
3380
3381 4.3.8 Naming Conventions
3382 ------------------------
3383
3384 The following conventions are used for names of macros, strings and
3385 number registers.  External names available to documents that use the
3386 `groff -ms' macros contain only uppercase letters and digits.
3387
3388    Internally the macros are divided into modules; naming conventions
3389 are as follows:
3390
3391    * Names used only within one module are of the form MODULE`*'NAME.
3392
3393    * Names used outside the module in which they are defined are of the
3394      form MODULE`@'NAME.
3395
3396    * Names associated with a particular environment are of the form
3397      ENVIRONMENT`:'NAME; these are used only within the `par' module.
3398
3399    * NAME does not have a module prefix.
3400
3401    * Constructed names used to implement arrays are of the form
3402      ARRAY`!'INDEX.
3403
3404    Thus the groff ms macros reserve the following names:
3405
3406    * Names containing the characters `*', `@', and `:'.
3407
3408    * Names containing only uppercase letters and digits.
3409
3410 \1f
3411 File: groff,  Node: me,  Next: mm,  Prev: ms,  Up: Macro Packages
3412
3413 4.4 `me'
3414 ========
3415
3416 See the `meintro.me' and `meref.me' documents in groff's `doc'
3417 directory.
3418
3419 \1f
3420 File: groff,  Node: mm,  Prev: me,  Up: Macro Packages
3421
3422 4.5 `mm'
3423 ========
3424
3425 See the `groff_mm(7)' man page (type `man groff_mm' at the command
3426 line).
3427
3428 \1f
3429 File: groff,  Node: gtroff Reference,  Next: Preprocessors,  Prev: Macro Packages,  Up: Top
3430
3431 5 `gtroff' Reference
3432 ********************
3433
3434 This chapter covers *all* of the facilities of `gtroff'.  Users of
3435 macro packages may skip it if not interested in details.
3436
3437 * Menu:
3438
3439 * Text::
3440 * Measurements::
3441 * Expressions::
3442 * Identifiers::
3443 * Embedded Commands::
3444 * Registers::
3445 * Manipulating Filling and Adjusting::
3446 * Manipulating Hyphenation::
3447 * Manipulating Spacing::
3448 * Tabs and Fields::
3449 * Character Translations::
3450 * Troff and Nroff Mode::
3451 * Line Layout::
3452 * Line Control::
3453 * Page Layout::
3454 * Page Control::
3455 * Fonts and Symbols::
3456 * Sizes::
3457 * Strings::
3458 * Conditionals and Loops::
3459 * Writing Macros::
3460 * Page Motions::
3461 * Drawing Requests::
3462 * Traps::
3463 * Diversions::
3464 * Environments::
3465 * Suppressing output::
3466 * Colors::
3467 * I/O::
3468 * Postprocessor Access::
3469 * Miscellaneous::
3470 * Gtroff Internals::
3471 * Debugging::
3472 * Implementation Differences::
3473
3474 \1f
3475 File: groff,  Node: Text,  Next: Measurements,  Prev: gtroff Reference,  Up: gtroff Reference
3476
3477 5.1 Text
3478 ========
3479
3480 `gtroff' input files contain text with control commands interspersed
3481 throughout.  But, even without control codes, `gtroff' still does
3482 several things with the input text:
3483
3484    * filling and adjusting
3485
3486    * adding additional space after sentences
3487
3488    * hyphenating
3489
3490    * inserting implicit line breaks
3491
3492 * Menu:
3493
3494 * Filling and Adjusting::
3495 * Hyphenation::
3496 * Sentences::
3497 * Tab Stops::
3498 * Implicit Line Breaks::
3499 * Input Conventions::
3500 * Input Encodings::
3501
3502 \1f
3503 File: groff,  Node: Filling and Adjusting,  Next: Hyphenation,  Prev: Text,  Up: Text
3504
3505 5.1.1 Filling and Adjusting
3506 ---------------------------
3507
3508 When `gtroff' reads text, it collects words from the input and fits as
3509 many of them together on one output line as it can.  This is known as
3510 "filling".
3511
3512    Once `gtroff' has a "filled" line, it tries to "adjust" it.  This
3513 means it widens the spacing between words until the text reaches the
3514 right margin (in the default adjustment mode).  Extra spaces between
3515 words are preserved, but spaces at the end of lines are ignored.
3516 Spaces at the front of a line cause a "break" (breaks are explained in
3517 *Note Implicit Line Breaks::).
3518
3519    *Note Manipulating Filling and Adjusting::.
3520
3521 \1f
3522 File: groff,  Node: Hyphenation,  Next: Sentences,  Prev: Filling and Adjusting,  Up: Text
3523
3524 5.1.2 Hyphenation
3525 -----------------
3526
3527 Since the odds are not great for finding a set of words, for every
3528 output line, which fit nicely on a line without inserting excessive
3529 amounts of space between words, `gtroff' hyphenates words so that it
3530 can justify lines without inserting too much space between words.  It
3531 uses an internal hyphenation algorithm (a simplified version of the
3532 algorithm used within TeX) to indicate which words can be hyphenated
3533 and how to do so.  When a word is hyphenated, the first part of the
3534 word is added to the current filled line being output (with an attached
3535 hyphen), and the other portion is added to the next line to be filled.
3536
3537    *Note Manipulating Hyphenation::.
3538
3539 \1f
3540 File: groff,  Node: Sentences,  Next: Tab Stops,  Prev: Hyphenation,  Up: Text
3541
3542 5.1.3 Sentences
3543 ---------------
3544
3545 Although it is often debated, some typesetting rules say there should be
3546 different amounts of space after various punctuation marks.  For
3547 example, the `Chicago typsetting manual' says that a period at the end
3548 of a sentence should have twice as much space following it as would a
3549 comma or a period as part of an abbreviation.
3550
3551    `gtroff' does this by flagging certain characters (normally `!',
3552 `?', and `.') as "end-of-sentence" characters.  When `gtroff'
3553 encounters one of these characters at the end of a line, it appends a
3554 normal space followed by a "sentence space" in the formatted output.
3555 (This justifies one of the conventions mentioned in *Note Input
3556 Conventions::.)
3557
3558    In addition, the following characters and symbols are treated
3559 transparently while handling end-of-sentence characters: `"', `'', `)',
3560 `]', `*', `\[dg]', and `\[rq]'.
3561
3562    See the `cflags' request in *Note Using Symbols::, for more details.
3563
3564    To prevent the insertion of extra space after an end-of-sentence
3565 character (at the end of a line), append `\&'.
3566
3567 \1f
3568 File: groff,  Node: Tab Stops,  Next: Implicit Line Breaks,  Prev: Sentences,  Up: Text
3569
3570 5.1.4 Tab Stops
3571 ---------------
3572
3573 `gtroff' translates "tabulator characters", also called "tabs"
3574 (normally code point ASCII `0x09' or EBCDIC `0x05'), in the input into
3575 movements to the next tabulator stop.  These tab stops are initially
3576 located every half inch across the page.  Using this, simple tables can
3577 be made easily.  However, it can often be deceptive as the appearance
3578 (and width) of the text on a terminal and the results from `gtroff' can
3579 vary greatly.
3580
3581    Also, a possible sticking point is that lines beginning with tab
3582 characters are still filled, again producing unexpected results.  For
3583 example, the following input
3584
3585            1          2          3
3586                       4          5
3587
3588 produces
3589
3590            1          2          3                     4          5
3591
3592    *Note Tabs and Fields::.
3593
3594 \1f
3595 File: groff,  Node: Implicit Line Breaks,  Next: Input Conventions,  Prev: Tab Stops,  Up: Text
3596
3597 5.1.5 Implicit Line Breaks
3598 --------------------------
3599
3600 An important concept in `gtroff' is the "break".  When a break occurs,
3601 `gtroff' outputs the partially filled line (unjustified), and resumes
3602 collecting and filling text on the next output line.
3603
3604    There are several ways to cause a break in `gtroff'.  A blank line
3605 not only causes a break, but it also outputs a one-line vertical space
3606 (effectively a blank line).  Note that this behaviour can be modified
3607 with the blank line macro request `blm'.  *Note Blank Line Traps::.
3608
3609    A line that begins with a space causes a break and the space is
3610 output at the beginning of the next line.  Note that this space isn't
3611 adjusted, even in fill mode.
3612
3613    The end of file also causes a break - otherwise the last line of the
3614 document may vanish!
3615
3616    Certain requests also cause breaks, implicitly or explicitly.  This
3617 is discussed in *Note Manipulating Filling and Adjusting::.
3618
3619 \1f
3620 File: groff,  Node: Input Conventions,  Next: Input Encodings,  Prev: Implicit Line Breaks,  Up: Text
3621
3622 5.1.6 Input Conventions
3623 -----------------------
3624
3625 Since `gtroff' does filling automatically, it is traditional in `groff'
3626 not to try and type things in as nicely formatted paragraphs.  These
3627 are some conventions commonly used when typing `gtroff' text:
3628
3629    * Break lines after punctuation, particularly at the end of a
3630      sentence and in other logical places.  Keep separate phrases on
3631      lines by themselves, as entire phrases are often added or deleted
3632      when editing.
3633
3634    * Try to keep lines less than 40-60 characters, to allow space for
3635      inserting more text.
3636
3637    * Do not try to do any formatting in a WYSIWYG manner (i.e., don't
3638      try using spaces to get proper indentation).
3639
3640 \1f
3641 File: groff,  Node: Input Encodings,  Prev: Input Conventions,  Up: Text
3642
3643 5.1.7 Input Encodings
3644 ---------------------
3645
3646 Currently, the following input encodings are available.
3647
3648 cp1047
3649      This input encoding works only on EBCDIC platforms (and vice
3650      versa, the other input encodings don't work with EBCDIC); the file
3651      `cp1047.tmac' is by default loaded at start-up.
3652
3653 latin-1
3654      This is the default input encoding on non-EBCDIC platforms; the
3655      file `latin1.tmac' is loaded at start-up.
3656
3657 latin-2
3658      To use this encoding, either say `.mso latin2.tmac' at the very
3659      beginning of your document or use `-mlatin2' as a command line
3660      argument for `groff'.
3661
3662 latin-9 (latin-0)
3663      This encoding is intended (at least in Europe) to replace latin-1
3664      encoding.  The main difference to latin-1 is that latin-9 contains
3665      the Euro character.  To use this encoding, either say
3666      `.mso latin9.tmac' at the very beginning of your document or use
3667      `-mlatin9' as a command line argument for `groff'.
3668
3669    Note that it can happen that some input encoding characters are not
3670 available for a particular output device.  For example, saying
3671
3672
3673      groff -Tlatin1 -mlatin9 ...
3674
3675 will fail if you use the Euro character in the input.  Usually, this
3676 limitation is present only for devices which have a limited set of
3677 output glyphs (e.g. `-Tascii' and `-Tlatin1'); for other devices it is
3678 usually sufficient to install proper fonts which contain the necessary
3679 glyphs.
3680
3681    Due to the importance of the Euro glyph in Europe, the groff package
3682 now comes with a POSTSCRIPT font called `freeeuro.pfa' which provides
3683 various glyph shapes for the Euro.  With other words, latin-9 encoding
3684 is supported for the `-Tps' device out of the box (latin-2 isn't).
3685
3686    By its very nature, `-Tutf8' supports all input encodings; `-Tdvi'
3687 has support for both latin-2 and latin-9 if the command line `-mec' is
3688 used also to load the file `ec.tmac' (which flips to the EC fonts).
3689
3690 \1f
3691 File: groff,  Node: Measurements,  Next: Expressions,  Prev: Text,  Up: gtroff Reference
3692
3693 5.2 Measurements
3694 ================
3695
3696 `gtroff' (like many other programs) requires numeric parameters to
3697 specify various measurements.  Most numeric parameters(1) (*note
3698 Measurements-Footnote-1::) may have a "measurement unit" attached.
3699 These units are specified as a single character which immediately
3700 follows the number or expression.  Each of these units are understood,
3701 by `gtroff', to be a multiple of its "basic unit".  So, whenever a
3702 different measurement unit is specified `gtroff' converts this into its
3703 "basic units".  This basic unit, represented by a `u', is a device
3704 dependent measurement which is quite small, ranging from 1/75th to
3705 1/72000th of an inch.  The values may be given as fractional numbers;
3706 however, fractional basic units are always rounded to integers.
3707
3708    Some of the measurement units are completely independent of any of
3709 the current settings (e.g. type size) of `gtroff'.
3710
3711 `i'
3712      Inches.  An antiquated measurement unit still in use in certain
3713      backwards countries with incredibly low-cost computer equipment.
3714      One inch is equal to 2.54cm.
3715
3716 `c'
3717      Centimeters.  One centimeter is equal to 0.3937in.
3718
3719 `p'
3720      Points.  This is a typesetter's measurement used for measure type
3721      size.  It is 72 points to an inch.
3722
3723 `P'
3724      Pica.  Another typesetting measurement.  6 Picas to an inch (and
3725      12 points to a pica).
3726
3727 `s'
3728 `z'
3729      *Note Fractional Type Sizes::, for a discussion of these units.
3730
3731 `f'
3732      Fractions. Value is 65536.  *Note Colors::, for usage.
3733
3734    The other measurements understood by `gtroff' depend on settings
3735 currently in effect in `gtroff'.  These are very useful for specifying
3736 measurements which should look proper with any size of text.
3737
3738 `m'
3739      Ems.  This unit is equal to the current font size in points.  So
3740      called because it is _approximately_ the width of the letter `m'
3741      in the current font.
3742
3743 `n'
3744      Ens.  In `groff', this is half of an em.
3745
3746 `v'
3747      Vertical space.  This is equivalent to the current line spacing.
3748      *Note Sizes::, for more information about this.
3749
3750 `M'
3751      100ths of an em.
3752
3753 * Menu:
3754
3755 * Default Units::
3756
3757 \1f
3758 File: groff,  Node: Measurements-Footnotes,  Up: Measurements
3759
3760    (1) those that specify vertical or horizontal motion or a type size
3761
3762 \1f
3763 File: groff,  Node: Default Units,  Prev: Measurements,  Up: Measurements
3764
3765 5.2.1 Default Units
3766 -------------------
3767
3768 Many requests take a default unit.  While this can be helpful at times,
3769 it can cause strange errors in some expressions.  For example, the line
3770 length request expects em units.  Here are several attempts to get a
3771 line length of 3.5 inches and their results:
3772
3773
3774      3.5i      =>   3.5i
3775      7/2       =>   0i
3776      7/2i      =>   0i
3777      (7 / 2)u  =>   0i
3778      7i/2      =>   0.1i
3779      7i/2u     =>   3.5i
3780
3781 Everything is converted to basic units first.  In the above example it
3782 is assumed that 1i equals 240u, and 1m equals 10p (thus 1m equals 33u).
3783 The value 7i/2 is first handled as 7i/2m, then converted to 1680u/66u
3784 which is 25u, and this is approximately 0.1i.  As can be seen, a
3785 scaling indicator after a closing parenthesis is simply ignored.
3786
3787    Thus, the safest way to specify measurements is to always attach a
3788 scaling indicator.  If you want to multiply or divide by a certain
3789 scalar value, use `u' as the unit for that value.
3790
3791 \1f
3792 File: groff,  Node: Expressions,  Next: Identifiers,  Prev: Measurements,  Up: gtroff Reference
3793
3794 5.3 Expressions
3795 ===============
3796
3797 `gtroff' has most arithmetic operators common to other languages:
3798
3799    * Arithmetic: `+' (addition), `-' (subtraction), `/' (division), `*'
3800      (multiplication), `%' (modulo).
3801
3802      `gtroff' only provides integer arithmetic.  The internal type used
3803      for computing results is `int', which is usually a 32bit signed
3804      integer.
3805
3806    * Comparison: `<' (less than), `>' (greater than), `<=' (less than
3807      or equal), `>=' (greater than or equal), `=' (equal), `==' (the
3808      same as `=').
3809
3810    * Logical: `&' (logical and), `:' (logical or).
3811
3812    * Unary operators: `-' (negating, i.e. changing the sign), `+' (just
3813      for completeness; does nothing in expressions), `!' (logical not;
3814      this works only within `if' and `while' requests).  See below for
3815      the use of unary operators in motion requests.
3816
3817    * Extrema: `>?' (maximum), `<?' (minimum).
3818
3819      Example:
3820
3821
3822           .nr x 5
3823           .nr y 3
3824           .nr z (\n[x] >? \n[y])
3825
3826      The register `z' now contains 5.
3827
3828    * Scaling: `(C;E)'.  Evaluate E using C as the default scaling
3829      indicator.  If C is missing, ignore scaling indicators in the
3830      evaluation of E.
3831
3832    Parentheses may be used as in any other language.  However, in
3833 `gtroff' they are necessary to ensure order of evaluation.  `gtroff'
3834 has no operator precedence; expressions are evaluated left to right.
3835 This means that `gtroff' evaluates `3+5*4' as if it were parenthesized
3836 like `(3+5)*4', not as `3+(5*4)', as might be expected.
3837
3838    For many requests which cause a motion on the page, the unary
3839 operators `+' and `-' work differently if leading an expression.  They
3840 then indicate a motion relative to the current position (down or up,
3841 respectively).
3842
3843    Similarly, a leading `|' operator indicates an absolute position.
3844 For vertical movements, it specifies the distance from the top of the
3845 page; for horizontal movements, it gives the distance from the beginning
3846 of the _input_ line.
3847
3848    `+' and `-' are also treated differently by the following requests
3849 and escapes: `bp', `in', `ll', `lt', `nm', `nr', `pl', `pn', `po', `ps',
3850 `pvs', `rt', `ti', `\H', `\R', and `\s'.  Here, leading plus and minus
3851 signs indicate increments and decrements.
3852
3853    *Note Setting Registers::, for some examples.
3854
3855  -- Escape: \B'anything'
3856      Return 1 if ANYTHING is a valid numeric expression; or 0 if
3857      ANYTHING is empty or not a valid numeric expression.
3858
3859    Due to the way arguments are parsed, spaces are not allowed in
3860 expressions, unless the entire expression is surrounded by parentheses.
3861
3862    *Note Request and Macro Arguments::, and *Note Conditionals and
3863 Loops::.
3864
3865 \1f
3866 File: groff,  Node: Identifiers,  Next: Embedded Commands,  Prev: Expressions,  Up: gtroff Reference
3867
3868 5.4 Identifiers
3869 ===============
3870
3871 Like any other language, `gtroff' has rules for properly formed
3872 "identifiers".  In `gtroff', an identifier can be made up of almost any
3873 printable character, with the exception of the following characters:
3874
3875    * Whitespace characters (spaces, tabs, and newlines).
3876
3877    * Backspace (ASCII `0x08' or EBCDIC `0x16') and character code
3878      `0x01'.
3879
3880    * The following input characters are invalid and are ignored if
3881      `groff' runs on a machine based on ASCII, causing a warning
3882      message of type `input' (see *Note Debugging::, for more details):
3883      `0x00', `0x0B', `0x0D'-`0x1F', `0x80'-`0x9F'.
3884
3885      And here are the invalid input characters if `groff' runs on an
3886      EBCDIC host: `0x00', `0x08', `0x09', `0x0B', `0x0D'-`0x14',
3887      `0x17'-`0x1F', `0x30'-`0x3F'.
3888
3889      Currently, some of these reserved codepoints are used internally,
3890      thus making it non-trivial to extend `gtroff' to cover Unicode or
3891      other character sets and encodings which use characters of these
3892      ranges.
3893
3894      Note that invalid characters are removed before parsing; an
3895      identifier `foo', followed by an invalid character, followed by
3896      `bar' is treated as `foobar'.
3897
3898    For example, any of the following is valid.
3899
3900
3901      br
3902      PP
3903      (l
3904      end-list
3905      @_
3906
3907 Note that identifiers longer than two characters with a closing bracket
3908 (`]') in its name can't be accessed with escape sequences which expect
3909 an identifier as a parameter.  For example, `\[foo]]' accesses the
3910 glyph `foo', followed by `]', whereas `\C'foo]'' really asks for glyph
3911 `foo]'.
3912
3913    To avoid problems with the `refer' preprocessor, macro names should
3914 not start with `[' or `]'.  Due to backwards compatibility, everything
3915 after `.[' and `.]' is handled as a special argument to `refer'.  For
3916 example, `.[foo' makes `refer' to start a reference, using `foo' as a
3917 parameter.
3918
3919  -- Escape: \A'ident'
3920      Test whether an identifier IDENT is valid in `gtroff'.  It expands
3921      to the character 1 or 0 according to whether its argument (usually
3922      delimited by quotes) is or is not acceptable as the name of a
3923      string, macro, diversion, number register, environment, or font.
3924      It returns 0 if no argument is given.  This is useful for looking
3925      up user input in some sort of associative table.
3926
3927
3928           \A'end-list'
3929               => 1
3930
3931
3932    *Note Escapes::, for details on parameter delimiting characters.
3933
3934    Identifiers in `gtroff' can be any length, but, in some contexts,
3935 `gtroff' needs to be told where identifiers end and text begins (and in
3936 different ways depending on their length):
3937
3938    * Single character.
3939
3940    * Two characters.  Must be prefixed with `(' in some situations.
3941
3942    * Arbitrary length (`gtroff' only).  Must be bracketed with `['
3943      and `]' in some situations.  Any length identifier can be put in
3944      brackets.
3945
3946    Unlike many other programming languages, undefined identifiers are
3947 silently ignored or expanded to nothing.  When `gtroff' finds an
3948 undefined identifier, it emits a warning, doing the following:
3949
3950    * If the identifier is a string, macro, or diversion, `gtroff'
3951      defines it as empty.
3952
3953    * If the identifier is a number register, `gtroff' defines it with a
3954      value of 0.
3955
3956    *Note Warnings::., *Note Interpolating Registers::, and *Note
3957 Strings::.
3958
3959    Note that macros, strings, and diversions share the same name space.
3960
3961
3962      .de xxx
3963      .  nop foo
3964      ..
3965      .
3966      .di xxx
3967      bar
3968      .br
3969      .di
3970      .
3971      .xxx
3972          => bar
3973
3974 As can be seen in the previous example, `gtroff' reuses the identifier
3975 `xxx', changing it from a macro to a diversion.  No warning is emitted!
3976 The contents of the first macro definition is lost.
3977
3978    *Note Interpolating Registers::, and *Note Strings::.
3979
3980 \1f
3981 File: groff,  Node: Embedded Commands,  Next: Registers,  Prev: Identifiers,  Up: gtroff Reference
3982
3983 5.5 Embedded Commands
3984 =====================
3985
3986 Most documents need more functionality beyond filling, adjusting and
3987 implicit line breaking.  In order to gain further functionality,
3988 `gtroff' allows commands to be embedded into the text, in two ways.
3989
3990    The first is a "request" which takes up an entire line, and does
3991 some large-scale operation (e.g. break lines, start new pages).
3992
3993    The other is an "escape" which can be usually embedded anywhere in
3994 the text; most requests can accept it even as an argument.  Escapes
3995 generally do more minor operations like sub- and superscripts, print a
3996 symbol, etc.
3997
3998 * Menu:
3999
4000 * Requests::
4001 * Macros::
4002 * Escapes::
4003
4004 \1f
4005 File: groff,  Node: Requests,  Next: Macros,  Prev: Embedded Commands,  Up: Embedded Commands
4006
4007 5.5.1 Requests
4008 --------------
4009
4010 A request line begins with a control character, which is either a single
4011 quote (`'', the "no-break control character") or a period (`.', the
4012 normal "control character").  These can be changed; see *Note Character
4013 Translations::, for details.  After this there may be optional tabs or
4014 spaces followed by an identifier which is the name of the request.
4015 This may be followed by any number of space-separated arguments (_no_
4016 tabs here).
4017
4018    Since a control character followed by whitespace only is ignored, it
4019 is common practice to use this feature for structuring the source code
4020 of documents or macro packages.
4021
4022
4023      .de foo
4024      .  tm This is foo.
4025      ..
4026      .
4027      .
4028      .de bar
4029      .  tm This is bar.
4030      ..
4031
4032    Another possibility is to use the blank line macro request `blm' by
4033 assigning an empty macro to it.
4034
4035
4036      .de do-nothing
4037      ..
4038      .blm do-nothing  \" activate blank line macro
4039
4040      .de foo
4041      .  tm This is foo.
4042      ..
4043
4044
4045      .de bar
4046      .  tm This is bar.
4047      ..
4048
4049      .blm             \" deactivate blank line macro
4050
4051    *Note Blank Line Traps::.
4052
4053    To begin a line with a control character without it being
4054 interpreted, precede it with `\&'.  This represents a zero width space,
4055 which means it does not affect the output.
4056
4057    In most cases the period is used as a control character.  Several
4058 requests cause a break implicitly; using the single quote control
4059 character prevents this.
4060
4061 * Menu:
4062
4063 * Request and Macro Arguments::
4064
4065 \1f
4066 File: groff,  Node: Request and Macro Arguments,  Prev: Requests,  Up: Requests
4067
4068 5.5.1.1 Request and Macro Arguments
4069 ...................................
4070
4071 Arguments to requests and macros are processed much like the shell: The
4072 line is split into arguments according to spaces.(1) (*note Request and
4073 Macro Arguments-Footnote-1::)
4074
4075    An argument to a macro which is intended to contain spaces can
4076 either be enclosed in double quotes, or have the spaces "escaped" with
4077 backslashes.  This is _not_ true for requests.
4078
4079    Here are a few examples for a hypothetical macro `uh':
4080
4081
4082      .uh The Mouse Problem
4083      .uh "The Mouse Problem"
4084      .uh The\ Mouse\ Problem
4085
4086 The first line is the `uh' macro being called with 3 arguments, `The',
4087 `Mouse', and `Problem'.  The latter two have the same effect of calling
4088 the `uh' macro with one argument, `The Mouse Problem'.(2) (*note
4089 Request and Macro Arguments-Footnote-2::)
4090
4091    A double quote which isn't preceded by a space doesn't start a macro
4092 argument.  If not closing a string, it is printed literally.
4093
4094    For example,
4095
4096
4097      .xxx a" "b c" "de"fg"
4098
4099 has the arguments `a"', `b c', `de', and `fg"'.  Don't rely on this
4100 obscure behaviour!
4101
4102    There are two possibilities to get a double quote reliably.
4103
4104    * Enclose the whole argument with double quotes and use two
4105      consecutive double quotes to represent a single one.  This
4106      traditional solution has the disadvantage that double quotes don't
4107      survive argument expansion again if called in compatibility mode
4108      (using the `-C' option of `groff'):
4109
4110
4111           .de xx
4112           .  tm xx: `\\$1' `\\$2' `\\$3'
4113           .
4114           .  yy "\\$1" "\\$2" "\\$3"
4115           ..
4116           .de yy
4117           .  tm yy: `\\$1' `\\$2' `\\$3'
4118           ..
4119           .xx A "test with ""quotes""" .
4120               => xx: `A' `test with "quotes"' `.'
4121               => yy: `A' `test with ' `quotes""'
4122
4123      If not in compatibility mode, you get the expected result
4124
4125
4126           xx: `A' `test with "quotes"' `.'
4127           yy: `A' `test with "quotes"' `.'
4128
4129      since `gtroff' preserves the input level.
4130
4131    * Use the double quote glyph `\(dq'.  This works with and without
4132      compatibility mode enabled since `gtroff' doesn't convert `\(dq'
4133      back to a double quote input character.
4134
4135      Not that this method won't work with UNIX `troff' in general since
4136      the glyph `dq' isn't defined normally.
4137
4138    Double quotes in the `ds' request are handled differently.  *Note
4139 Strings::, for more details.
4140
4141 \1f
4142 File: groff,  Node: Request and Macro Arguments-Footnotes,  Up: Request and Macro Arguments
4143
4144    (1) Plan 9's `troff' implementation also allows tabs for argument
4145 separation - `gtroff' intentionally doesn't support this.
4146
4147    (2) The last solution, i.e., using escaped spaces, is "classical" in
4148 the sense that it can be found in most `troff' documents.
4149 Nevertheless, it is not optimal in all situations, since `\ ' inserts a
4150 fixed-width, non-breaking space character which can't stretch.
4151 `gtroff' provides a different command `\~' to insert a stretchable,
4152 non-breaking space.
4153
4154 \1f
4155 File: groff,  Node: Macros,  Next: Escapes,  Prev: Requests,  Up: Embedded Commands
4156
4157 5.5.2 Macros
4158 ------------
4159
4160 `gtroff' has a "macro" facility for defining a series of lines which
4161 can be invoked by name.  They are called in the same manner as requests
4162 - arguments also may be passed basically in the same manner.
4163
4164    *Note Writing Macros::, and *Note Request and Macro Arguments::.
4165
4166 \1f
4167 File: groff,  Node: Escapes,  Prev: Macros,  Up: Embedded Commands
4168
4169 5.5.3 Escapes
4170 -------------
4171
4172 Escapes may occur anywhere in the input to `gtroff'.  They usually
4173 begin with a backslash and are followed by a single character which
4174 indicates the function to be performed.  The escape character can be
4175 changed; see *Note Character Translations::.
4176
4177    Escape sequences which require an identifier as a parameter accept
4178 three possible syntax forms.
4179
4180    * The next single character is the identifier.
4181
4182    * If this single character is an opening parenthesis, take the
4183      following two characters as the identifier.  Note that there is no
4184      closing parenthesis after the identifier.
4185
4186    * If this single character is an opening bracket, take all characters
4187      until a closing bracket as the identifier.
4188
4189 Examples:
4190
4191
4192      \fB
4193      \n(XX
4194      \*[TeX]
4195
4196    Other escapes may require several arguments and/or some special
4197 format.  In such cases the argument is traditionally enclosed in single
4198 quotes (and quotes are always used in this manual for the definitions
4199 of escape sequences).  The enclosed text is then processed according to
4200 what that escape expects.  Example:
4201
4202
4203      \l'1.5i\(bu'
4204
4205    Note that the quote character can be replaced with any other
4206 character which does not occur in the argument (even a newline or a
4207 space character) in the following escapes: `\o', `\b', and `\X'.  This
4208 makes e.g.
4209
4210
4211      A caf
4212      \o
4213      e\'
4214
4215
4216      in Paris
4217        => A cafĂ© in Paris
4218
4219 possible, but it is better not to use this feature to avoid confusion.
4220
4221    The following escapes sequences (which are handled similarly to
4222 characters since they don't take a parameter) are also allowed as
4223 delimiters: `\%', `\ ', `\|', `\^', `\{', `\}', `\'', `\`', `\-', `\_',
4224 `\!', `\?', `\@', `\)', `\/', `\,', `\&', `\:', `\~', `\0', `\a', `\c',
4225 `\d', `\e', `\E', `\p', `\r', `\t', and `\u'.  Again, don't use these
4226 if possible.
4227
4228    No newline characters as delimiters are allowed in the following
4229 escapes: `\A', `\B', `\Z', `\C', and `\w'.
4230
4231    Finally, the escapes `\D', `\h', `\H', `\l', `\L', `\N', `\R', `\s',
4232 `\S', `\v', and `\x' can't use the following characters as delimiters:
4233
4234    * The digits `0'-`9'.
4235
4236    * The (single-character) operators `+-/*%<>=&:().'.
4237
4238    * The space, tab, and newline characters.
4239
4240    * All escape sequences except `\%', `\:', `\{', `\}', `\'', `\`',
4241      `\-', `\_', `\!', `\@', `\/', `\c', `\e', and `\p'.
4242
4243    To have a backslash (actually, the current escape character) appear
4244 in the output several escapes are defined: `\\', `\e' or `\E'.  These
4245 are very similar, and only differ with respect to being used in macros
4246 or diversions.  *Note Character Translations::, for an exact
4247 description of those escapes.
4248
4249    *Note Implementation Differences::, *Note Copy-in Mode::, and *Note
4250 Diversions::, *Note Identifiers::, for more information.
4251
4252 * Menu:
4253
4254 * Comments::
4255
4256 \1f
4257 File: groff,  Node: Comments,  Prev: Escapes,  Up: Escapes
4258
4259 5.5.3.1 Comments
4260 ................
4261
4262 Probably one of the most(1) (*note Comments-Footnote-1::) common forms
4263 of escapes is the comment.
4264
4265  -- Escape: \"
4266      Start a comment.  Everything to the end of the input line is
4267      ignored.
4268
4269      This may sound simple, but it can be tricky to keep the comments
4270      from interfering with the appearance of the final output.
4271
4272      If the escape is to the right of some text or a request, that
4273      portion of the line is ignored, but the space leading up to it is
4274      noticed by `gtroff'.  This only affects the `ds' and `as' request
4275      and its variants.
4276
4277      One possibly irritating idiosyncracy is that tabs must not be used
4278      to line up comments.  Tabs are not treated as whitespace between
4279      the request and macro arguments.
4280
4281      A comment on a line by itself is treated as a blank line, because
4282      after eliminating the comment, that is all that remains:
4283
4284
4285           Test
4286           \" comment
4287           Test
4288
4289      produces
4290
4291
4292           Test
4293
4294           Test
4295
4296      To avoid this, it is common to start the line with `.\"' which
4297      causes the line to be treated as an undefined request and thus
4298      ignored completely.
4299
4300      Another commenting scheme seen sometimes is three consecutive
4301      single quotes (`'''') at the beginning of a line.  This works, but
4302      `gtroff' gives a warning about an undefined macro (namely `'''),
4303      which is harmless, but irritating.
4304
4305  -- Escape: \#
4306      To avoid all this, `gtroff' has a new comment mechanism using the
4307      `\#' escape.  This escape works the same as `\"' except that the
4308      newline is also ignored:
4309
4310
4311           Test
4312           \# comment
4313           Test
4314
4315      produces
4316
4317
4318           Test Test
4319
4320      as expected.
4321
4322  -- Request: .ig [end]
4323      Ignore all input until `gtroff' encounters the macro named `.'END
4324      on a line by itself (or `..' if END is not specified).  This is
4325      useful for commenting out large blocks of text:
4326
4327
4328           text text text...
4329           .ig
4330           This is part of a large block
4331           of text that has been
4332           temporarily(?) commented out.
4333
4334           We can restore it simply by removing
4335           the .ig request and the ".." at the
4336           end of the block.
4337           ..
4338           More text text text...
4339
4340      produces
4341
4342
4343           text text text...  More text text text...
4344
4345      Note that the commented-out block of text does not cause a break.
4346
4347      The input is read in copy-mode; auto-incremented registers _are_
4348      affected (*note Auto-increment::).
4349
4350 \1f
4351 File: groff,  Node: Comments-Footnotes,  Up: Comments
4352
4353    (1) Unfortunately, this is a lie.  But hopefully future `gtroff'
4354 hackers will believe it `:-)'
4355
4356 \1f
4357 File: groff,  Node: Registers,  Next: Manipulating Filling and Adjusting,  Prev: Embedded Commands,  Up: gtroff Reference
4358
4359 5.6 Registers
4360 =============
4361
4362 Numeric variables in `gtroff' are called "registers".  There are a
4363 number of built-in registers, supplying anything from the date to
4364 details of formatting parameters.
4365
4366    *Note Identifiers::, for details on register identifiers.
4367
4368 * Menu:
4369
4370 * Setting Registers::
4371 * Interpolating Registers::
4372 * Auto-increment::
4373 * Assigning Formats::
4374 * Built-in Registers::
4375
4376 \1f
4377 File: groff,  Node: Setting Registers,  Next: Interpolating Registers,  Prev: Registers,  Up: Registers
4378
4379 5.6.1 Setting Registers
4380 -----------------------
4381
4382 Define or set registers using the `nr' request or the `\R' escape.
4383
4384  -- Request: .nr ident value
4385  -- Escape: \R'ident value'
4386      Set number register IDENT to VALUE.  If IDENT doesn't exist,
4387      `gtroff' creates it.
4388
4389      The argument to `\R' usually has to be enclosed in quotes.  *Note
4390      Escapes::, for details on parameter delimiting characters.
4391
4392      The `\R' escape doesn't produce an input token in `gtroff'; with
4393      other words, it vanishes completely after `gtroff' has processed
4394      it.
4395
4396    For example, the following two lines are equivalent:
4397
4398
4399      .nr a (((17 + (3 * 4))) % 4)
4400      \R'a (((17 + (3 * 4))) % 4)'
4401          => 1
4402
4403    Both `nr' and `\R' have two additional special forms to increment or
4404 decrement a register.
4405
4406  -- Request: .nr ident +value
4407  -- Request: .nr ident -value
4408  -- Escape: \R'ident +value'
4409  -- Escape: \R'ident -value'
4410      Increment (decrement) register IDENT by VALUE.
4411
4412
4413           .nr a 1
4414           .nr a +1
4415           \na
4416               => 2
4417
4418      To assign the negated value of a register to another register,
4419      some care must be taken to get the desired result:
4420
4421
4422           .nr a 7
4423           .nr b 3
4424           .nr a -\nb
4425           \na
4426               => 4
4427           .nr a (-\nb)
4428           \na
4429               => -3
4430
4431      The surrounding parentheses prevent the interpretation of the
4432      minus sign as a decrementing operator.  An alternative is to start
4433      the assignment with a `0':
4434
4435
4436           .nr a 7
4437           .nr b -3
4438           .nr a \nb
4439           \na
4440               => 4
4441           .nr a 0\nb
4442           \na
4443               => -3
4444
4445
4446  -- Request: .rr ident
4447      Remove number register IDENT.  If IDENT doesn't exist, the request
4448      is ignored.
4449
4450  -- Request: .rnn ident1 ident2
4451      Rename number register IDENT1 to IDENT2.  If either IDENT1 or
4452      IDENT2 doesn't exist, the request is ignored.
4453
4454  -- Request: .aln ident1 ident2
4455      Create an alias IDENT1 for a number register IDENT2.  The new name
4456      and the old name are exactly equivalent.  If IDENT1 is undefined,
4457      a warning of type `reg' is generated, and the request is ignored.
4458      *Note Debugging::, for information about warnings.
4459
4460 \1f
4461 File: groff,  Node: Interpolating Registers,  Next: Auto-increment,  Prev: Setting Registers,  Up: Registers
4462
4463 5.6.2 Interpolating Registers
4464 -----------------------------
4465
4466 Numeric registers can be accessed via the `\n' escape.
4467
4468  -- Escape: \ni
4469  -- Escape: \n(id
4470  -- Escape: \n[ident]
4471      Interpolate number register with name IDENT (one-character name I,
4472      two-character name ID).  This means that the value of the register
4473      is expanded in-place while `gtroff' is parsing the input line.
4474      Nested assignments (also called indirect assignments) are possible.
4475
4476
4477           .nr a 5
4478           .nr as \na+\na
4479           \n(as
4480               => 10
4481
4482
4483           .nr a1 5
4484           .nr ab 6
4485           .ds str b
4486           .ds num 1
4487           \n[a\n[num]]
4488               => 5
4489           \n[a\*[str]]
4490               => 6
4491
4492
4493 \1f
4494 File: groff,  Node: Auto-increment,  Next: Assigning Formats,  Prev: Interpolating Registers,  Up: Registers
4495
4496 5.6.3 Auto-increment
4497 --------------------
4498
4499 Number registers can also be auto-incremented and auto-decremented.
4500 The increment or decrement value can be specified with a third argument
4501 to the `nr' request or `\R' escape.
4502
4503  -- Request: .nr ident value incr
4504      Set number register IDENT to VALUE; the increment for
4505      auto-incrementing is set to INCR.  Note that the `\R' escape
4506      doesn't support this notation.
4507
4508    To activate auto-incrementing, the escape `\n' has a special syntax
4509 form.
4510
4511  -- Escape: \n+i
4512  -- Escape: \n-i
4513  -- Escape: \n(+id
4514  -- Escape: \n(-id
4515  -- Escape: \n+(id
4516  -- Escape: \n-(id
4517  -- Escape: \n[+ident]
4518  -- Escape: \n[-ident]
4519  -- Escape: \n+[ident]
4520  -- Escape: \n-[ident]
4521      Before interpolating, increment or decrement IDENT (one-character
4522      name I, two-character name ID) by the auto-increment value as
4523      specified with the `nr' request (or the `\R' escape).  If no
4524      auto-increment value has been specified, these syntax forms are
4525      identical to `\n'.
4526
4527    For example,
4528
4529
4530      .nr a 0 1
4531      .nr xx 0 5
4532      .nr foo 0 -2
4533      \n+a, \n+a, \n+a, \n+a, \n+a
4534      .br
4535      \n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
4536      .br
4537      \n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
4538
4539 produces
4540
4541
4542      1, 2, 3, 4, 5
4543      -5, -10, -15, -20, -25
4544      -2, -4, -6, -8, -10
4545
4546    To change the increment value without changing the value of a
4547 register (A in the example), the following can be used:
4548
4549
4550      .nr a \na 10
4551
4552 \1f
4553 File: groff,  Node: Assigning Formats,  Next: Built-in Registers,  Prev: Auto-increment,  Up: Registers
4554
4555 5.6.4 Assigning Formats
4556 -----------------------
4557
4558 When a register is used in the text of an input file (as opposed to
4559 part of an expression), it is textually replaced (or interpolated) with
4560 a representation of that number.  This output format can be changed to
4561 a variety of formats (numbers, Roman numerals, etc.).  This is done
4562 using the `af' request.
4563
4564  -- Request: .af ident format
4565      Change the output format of a number register.  The first argument
4566      IDENT is the name of the number register to be changed, and the
4567      second argument FORMAT is the output format.  The following output
4568      formats are available:
4569
4570     `1'
4571           Decimal arabic numbers.  This is the default format: 0, 1, 2,
4572           3, ....
4573
4574     `0...0'
4575           Decimal numbers with as many digits as specified.  So, `00'
4576           would result in printing numbers as 01, 02, 03, ....
4577
4578           In fact, any digit instead of zero will do; `gtroff' only
4579           counts how many digits are specified.  As a consequence,
4580           `af''s default format `1' could be specified as `0' also (and
4581           exactly this is returned by the `\g' escape, see below).
4582
4583     `I'
4584           Upper-case Roman numerals: 0, I, II, III, IV, ....
4585
4586     `i'
4587           Lower-case Roman numerals: 0, i, ii, iii, iv, ....
4588
4589     `A'
4590           Upper-case letters: 0, A, B, C, ..., Z, AA, AB, ....
4591
4592     `a'
4593           Lower-case letters: 0, a, b, c, ..., z, aa, ab, ....
4594
4595      Omitting the number register format causes a warning of type
4596      `missing'.  *Note Debugging::, for more details.  Specifying a
4597      nonexistent format causes an error.
4598
4599      The following example produces `10, X, j, 010':
4600
4601
4602           .nr a 10
4603           .af a 1           \" the default format
4604           \na,
4605           .af a I
4606           \na,
4607           .af a a
4608           \na,
4609           .af a 001
4610           \na
4611
4612      The largest number representable for the `i' and `I' formats is
4613      39999 (or -39999); UNIX `troff' uses `z' and `w' to represent
4614      10000 and 5000 in Roman numerals, and so does `gtroff'.
4615      Currently, the correct glyphs of Roman numeral five thousand and
4616      Roman numeral ten thousand (Unicode code points `U+2182' and
4617      `U+2181', respectively) are not available.
4618
4619      If IDENT doesn't exist, it is created.
4620
4621      Changing the output format of a read-only register causes an
4622      error.  It is necessary to first copy the register's value to a
4623      writeable register, then apply the `af' request to this other
4624      register.
4625
4626  -- Escape: \gi
4627  -- Escape: \g(id
4628  -- Escape: \g[ident]
4629      Return the current format of the specified register IDENT
4630      (one-character name I, two-character name ID).  For example, `\ga'
4631      after the previous example would produce the string `000'.  If the
4632      register hasn't been defined yet, nothing is returned.
4633
4634 \1f
4635 File: groff,  Node: Built-in Registers,  Prev: Assigning Formats,  Up: Registers
4636
4637 5.6.5 Built-in Registers
4638 ------------------------
4639
4640 The following lists some built-in registers which are not described
4641 elsewhere in this manual.  Any register which begins with a `.' is
4642 read-only.  A complete listing of all built-in registers can be found in
4643 *Note Register Index::.
4644
4645 `\n[.F]'
4646      This string-valued register returns the current input file name.
4647
4648 `\n[.H]'
4649      Horizontal resolution in basic units.
4650
4651 `\n[.U]'
4652      If `gtroff' is called with the `-U' command line option, the
4653      number register `.U' is set to 1, and zero otherwise.  *Note Groff
4654      Options::.
4655
4656 `\n[.V]'
4657      Vertical resolution in basic units.
4658
4659 `\n[seconds]'
4660      The number of seconds after the minute, normally in the range 0
4661      to 59, but can be up to 61 to allow for leap seconds.  Initialized
4662      at start-up of `gtroff'.
4663
4664 `\n[minutes]'
4665      The number of minutes after the hour, in the range 0 to 59.
4666      Initialized at start-up of `gtroff'.
4667
4668 `\n[hours]'
4669      The number of hours past midnight, in the range 0 to 23.
4670      Initialized at start-up of `gtroff'.
4671
4672 `\n[dw]'
4673      Day of the week (1-7).
4674
4675 `\n[dy]'
4676      Day of the month (1-31).
4677
4678 `\n[mo]'
4679      Current month (1-12).
4680
4681 `\n[year]'
4682      The current year.
4683
4684 `\n[yr]'
4685      The current year minus 1900.  Unfortunately, the documentation of
4686      UNIX Version 7's `troff' had a year 2000 bug: It incorrectly
4687      claimed that `yr' contains the last two digits of the year.  That
4688      claim has never been true of either AT&T `troff' or GNU `troff'.
4689      Old `troff' input that looks like this:
4690
4691
4692           '\" The following line stopped working after 1999
4693           This document was formatted in 19\n(yr.
4694
4695      can be corrected as follows:
4696
4697
4698           This document was formatted in \n[year].
4699
4700      or, to be portable to older `troff' versions, as follows:
4701
4702
4703           .nr y4 1900+\n(yr
4704           This document was formatted in \n(y4.
4705
4706 `\n[.c]'
4707 `\n[c.]'
4708      The current _input_ line number.  Register `.c' is read-only,
4709      whereas `c.' (a `gtroff' extension) is writable also, affecting
4710      both `.c' and `c.'.
4711
4712 `\n[ln]'
4713      The current _output_ line number after a call to the `nm' request
4714      to activate line numbering.
4715
4716      *Note Miscellaneous::, for more information about line numbering.
4717
4718 `\n[.x]'
4719      The major version number.  For example, if the version number is
4720      1.03 then `.x' contains `1'.
4721
4722 `\n[.y]'
4723      The minor version number.  For example, if the version number is
4724      1.03 then `.y' contains `03'.
4725
4726 `\n[.Y]'
4727      The revision number of `groff'.
4728
4729 `\n[$$]'
4730      The process ID of `gtroff'.
4731
4732 `\n[.g]'
4733      Always 1.  Macros should use this to determine whether they are
4734      running under GNU `troff'.
4735
4736 `\n[.A]'
4737      If the command line option `-a' is used to produce an ASCII
4738      approximation of the output, this is set to 1, zero otherwise.
4739      *Note Groff Options::.
4740
4741 `\n[.P]'
4742      This register is set to 1 (and to 0 otherwise) if the current page
4743      is actually being printed, i.e., if the `-o' option is being used
4744      to only print selected pages.  *Note Groff Options::, for more
4745      information.
4746
4747 `\n[.T]'
4748      If `gtroff' is called with the `-T' command line option, the
4749      number register `.T' is set to 1, and zero otherwise.  *Note Groff
4750      Options::.
4751
4752 `\*[.T]'
4753      A single read-write string register which contains the current
4754      output device (for example, `latin1' or `ps').  This is the only
4755      string register defined by `gtroff'.
4756
4757 \1f
4758 File: groff,  Node: Manipulating Filling and Adjusting,  Next: Manipulating Hyphenation,  Prev: Registers,  Up: gtroff Reference
4759
4760 5.7 Manipulating Filling and Adjusting
4761 ======================================
4762
4763 Various ways of causing "breaks" were given in *Note Implicit Line
4764 Breaks::.  The `br' request likewise causes a break.  Several other
4765 requests also cause breaks, but implicitly.  These are `bp', `ce',
4766 `cf', `fi', `fl', `in', `nf', `rj', `sp', `ti', and `trf'.
4767
4768  -- Request: .br
4769      Break the current line, i.e., the input collected so far is emitted
4770      without adjustment.
4771
4772      If the no-break control character is used, `gtroff' suppresses the
4773      break:
4774
4775
4776           a
4777           'br
4778           b
4779               => a b
4780
4781
4782    Initially, `gtroff' fills and adjusts text to both margins.  Filling
4783 can be disabled via the `nf' request and re-enabled with the `fi'
4784 request.
4785
4786  -- Request: .fi
4787  -- Register: \n[.u]
4788      Activate fill mode (which is the default).  This request implicitly
4789      enables adjusting; it also inserts a break in the text currently
4790      being filled.  The read-only number register `.u' is set to 1.
4791
4792      The fill mode status is associated with the current environment
4793      (*note Environments::).
4794
4795      See *Note Line Control::, for interaction with the `\c' escape.
4796
4797  -- Request: .nf
4798      Activate no-fill mode.  Input lines are output as-is, retaining
4799      line breaks and ignoring the current line length.  This command
4800      implicitly disables adjusting; it also causes a break.  The number
4801      register `.u' is set to 0.
4802
4803      The fill mode status is associated with the current environment
4804      (*note Environments::).
4805
4806      See *Note Line Control::, for interaction with the `\c' escape.
4807
4808  -- Request: .ad [mode]
4809  -- Register: \n[.j]
4810      Set adjusting mode.
4811
4812      Activation and deactivation of adjusting is done implicitly with
4813      calls to the `fi' or `nf' requests.
4814
4815      MODE can have one of the following values:
4816
4817     `l'
4818           Adjust text to the left margin.  This produces what is
4819           traditionally called ragged-right text.
4820
4821     `r'
4822           Adjust text to the right margin, producing ragged-left text.
4823
4824     `c'
4825           Center filled text.  This is different to the `ce' request
4826           which only centers text without filling.
4827
4828     `b'
4829     `n'
4830           Justify to both margins.  This is the default used by
4831           `gtroff'.
4832
4833      Finally, MODE can be the numeric argument returned by the `.j'
4834      register.
4835
4836      With no argument, `gtroff' adjusts lines in the same way it did
4837      before adjusting was deactivated (with a call to `na', for
4838      example).
4839
4840
4841           text
4842           .ad r
4843           .nr ad \n[.j]
4844           text
4845           .ad c
4846           text
4847           .na
4848           text
4849           .ad         \" back to centering
4850           text
4851           .ad \n[ad]  \" back to right justifying
4852
4853      The current adjustment mode is available in the read-only number
4854      register `.j'; it can be stored and subsequently used to set
4855      adjustment.
4856
4857      The adjustment mode status is associated with the current
4858      environment (*note Environments::).
4859
4860  -- Request: .na
4861      Disable adjusting.  This request won't change the current
4862      adjustment mode: A subsequent call to `ad' uses the previous
4863      adjustment setting.
4864
4865      The adjustment mode status is associated with the current
4866      environment (*note Environments::).
4867
4868  -- Request: .brp
4869  -- Escape: \p
4870      Adjust the current line and cause a break.
4871
4872      In most cases this produces very ugly results since `gtroff'
4873      doesn't have a sophisticated paragraph building algorithm (as TeX
4874      have, for example); instead, `gtroff' fills and adjusts a paragraph
4875      line by line:
4876
4877
4878             This is an uninteresting sentence.
4879             This is an uninteresting sentence.\p
4880             This is an uninteresting sentence.
4881
4882      is formatted as
4883
4884
4885             This is  an uninteresting  sentence.   This  is an
4886             uninteresting                            sentence.
4887             This is an uninteresting sentence.
4888
4889
4890  -- Request: .ss word_space_size [sentence_space_size]
4891  -- Register: \n[.ss]
4892  -- Register: \n[.sss]
4893      Change the size of a space between words.  It takes its units as
4894      one twelfth of the space width parameter for the current font.
4895      Initially both the WORD_SPACE_SIZE and SENTENCE_SPACE_SIZE are 12.
4896      In fill mode, the values specify the minimum distance.
4897
4898      If two arguments are given to the `ss' request, the second
4899      argument sets the sentence space size.  If the second argument is
4900      not given, sentence space size is set to WORD_SPACE_SIZE.  The
4901      sentence space size is used in two circumstances: If the end of a
4902      sentence occurs at the end of a line in fill mode, then both an
4903      inter-word space and a sentence space are added; if two spaces
4904      follow the end of a sentence in the middle of a line, then the
4905      second space is a sentence space.  If a second argument is never
4906      given to the `ss' request, the behaviour of UNIX `troff' is the
4907      same as that exhibited by GNU `troff'.  In GNU `troff', as in UNIX
4908      `troff', a sentence should always be followed by either a newline
4909      or two spaces.
4910
4911      The read-only number registers `.ss' and `.sss' hold the values of
4912      the parameters set by the first and second arguments of the `ss'
4913      request.
4914
4915      The word space and sentence space values are associated with the
4916      current environment (*note Environments::).
4917
4918      Contrary to AT&T `troff', this request is _not_ ignored if a TTY
4919      output device is used; the given values are then rounded down to a
4920      multiple of 12 (*note Implementation Differences::).
4921
4922      The request is ignored if there is no parameter.
4923
4924      Another useful application of the `ss' request is to insert
4925      discardable horizontal space, i.e., space which is discarded at a
4926      line break.  For example, paragraph-style footnotes could be
4927      separated this way:
4928
4929
4930           .ll 4.5i
4931           1.\ This is the first footnote.\c
4932           .ss 48
4933           .nop
4934           .ss 12
4935           2.\ This is the second footnote.
4936
4937      The result:
4938
4939
4940           1. This is the first footnote.        2. This
4941           is the second footnote.
4942
4943      Note that the `\h' escape produces unbreakable space.
4944
4945  -- Request: .ce [nnn]
4946  -- Register: \n[.ce]
4947      Center text.  While the `.ad c' request also centers text, it
4948      fills the text as well.  `ce' does not fill the text it affects.
4949      This request causes a break.  The number of lines still to be
4950      centered is associated with the current environment (*note
4951      Environments::).
4952
4953      The following example demonstrates the differences.  Here the
4954      input:
4955
4956
4957           .ll 4i
4958           .ce 1000
4959           This is a small text fragment which shows the differences
4960           between the `.ce' and the `.ad c' request.
4961           .ce 0
4962
4963           .ad c
4964           This is a small text fragment which shows the differences
4965           between the `.ce' and the `.ad c' request.
4966
4967      And here the result:
4968
4969
4970             This is a small text fragment which
4971                    shows the differences
4972           between the `.ce' and the `.ad c' request.
4973
4974             This is a small text fragment which
4975           shows the differences between the `.ce'
4976                   and the `.ad c' request.
4977
4978      With no arguments, `ce' centers the next line of text.  NNN
4979      specifies the number of lines to be centered.  If the argument is
4980      zero or negative, centering is disabled.
4981
4982      The basic length for centering text is the line length (as set
4983      with the `ll' request) minus the indentation (as set with the `in'
4984      request).  Temporary indentation is ignored.
4985
4986      As can be seen in the previous example, it is a common idiom to
4987      turn on centering for a large number of lines, and to turn off
4988      centering after text to be centered.  This is useful for any
4989      request which takes a number of lines as an argument.
4990
4991      The `.ce' read-only number register contains the number of lines
4992      remaining to be centered, as set by the `ce' request.
4993
4994  -- Request: .rj [nnn]
4995  -- Register: \n[.rj]
4996      Justify unfilled text to the right margin.  Arguments are
4997      identical to the `ce' request.  The `.rj' read-only number
4998      register is the number of lines to be right-justified as set by
4999      the `rj' request.  This request causes a break.  The number of
5000      lines still to be right-justified is associated with the current
5001      environment (*note Environments::).
5002
5003 \1f
5004 File: groff,  Node: Manipulating Hyphenation,  Next: Manipulating Spacing,  Prev: Manipulating Filling and Adjusting,  Up: gtroff Reference
5005
5006 5.8 Manipulating Hyphenation
5007 ============================
5008
5009 Here a description of requests which influence hyphenation.
5010
5011  -- Request: .hy [mode]
5012  -- Register: \n[.hy]
5013      Enable hyphenation.  The request has an optional numeric argument,
5014      MODE, to restrict hyphenation if necessary:
5015
5016     `1'
5017           The default argument if MODE is omitted.  Hyphenate without
5018           restrictions.  This is also the start-up value of `gtroff'.
5019
5020     `2'
5021           Do not hyphenate the last word on a page or column.
5022
5023     `4'
5024           Do not hyphenate the last two characters of a word.
5025
5026     `8'
5027           Do not hyphenate the first two characters of a word.
5028
5029      Values in the previous table are additive.  For example, the
5030      value 12 causes `gtroff' to neither hyphenate the last two nor the
5031      first two characters of a word.
5032
5033      The current hyphenation restrictions can be found in the read-only
5034      number register `.hy'.
5035
5036      The hyphenation mode is associated with the current environment
5037      (*note Environments::).
5038
5039  -- Request: .nh
5040      Disable hyphenation (i.e., set the hyphenation mode to zero).  Note
5041      that the hyphenation mode of the last call to `hy' is not
5042      remembered.
5043
5044      The hyphenation mode is associated with the current environment
5045      (*note Environments::).
5046
5047  -- Request: .hlm [nnn]
5048  -- Register: \n[.hlm]
5049  -- Register: \n[.hlc]
5050      Set the maximum number of consecutive hyphenated lines to NNN.  If
5051      this number is negative, there is no maximum.  The default value
5052      is -1 if NNN is omitted.  This value is associated with the
5053      current environment (*note Environments::).  Only lines output
5054      from a given environment count towards the maximum associated with
5055      that environment.  Hyphens resulting from `\%' are counted;
5056      explicit hyphens are not.
5057
5058      The current setting of `hlm' is available in the `.hlm' read-only
5059      number register.  Also the number of immediately preceding
5060      consecutive hyphenated lines are available in the read-only number
5061      register `.hlc'.
5062
5063  -- Request: .hw word1 word2 ...
5064      Define how WORD1, WORD2, etc. are to be hyphenated.  The words
5065      must be given with hyphens at the hyphenation points.  For example:
5066
5067
5068           .hw in-sa-lub-rious
5069
5070      Besides the space character, any character whose hyphenation code
5071      value is zero can be used to separate the arguments of `hw' (see
5072      the documentation for the `hcode' request below for more
5073      information).  In addition, this request can be used more than
5074      once.
5075
5076      Hyphenation exceptions specified with the `hw' request are
5077      associated with the current hyphenation language; it causes an
5078      error if there is no current hyphenation language.
5079
5080      This request is ignored if there is no parameter.
5081
5082      In old versions of `troff' there was a limited amount of space to
5083      store such information; fortunately, with `gtroff', this is no
5084      longer a restriction.
5085
5086  -- Escape: \%
5087  -- Escape: \:
5088      To tell `gtroff' how to hyphenate words on the fly, use the `\%'
5089      escape, also known as the "hyphenation character".  Preceding a
5090      word with this character prevents it from being hyphenated;
5091      putting it inside a word indicates to `gtroff' that the word may
5092      be hyphenated at that point.  Note that this mechanism only
5093      affects that one occurrence of the word; to change the hyphenation
5094      of a word for the entire document, use the `hw' request.
5095
5096      The `\:' escape inserts a zero-width break point (that is, the
5097      word breaks but without adding a hyphen).
5098
5099
5100           ... check the /var/log/\:httpd/\:access_log file ...
5101
5102      Note that `\X' and `\Y' start a word, that is, the `\%' escape in
5103      (say) `\X'...'\%foobar' and `\Y'...'\%foobar' no longer prevents
5104      hyphenation but inserts a hyphenation point at the beginning of
5105      `foobar'; most likely this isn't what you want to do.
5106
5107  -- Request: .hc [char]
5108      Change the hyphenation character to CHAR.  This character then
5109      works the same as the `\%' escape, and thus, no longer appears in
5110      the output.  Without an argument, `hc' resets the hyphenation
5111      character to be `\%' (the default) only.
5112
5113      The hyphenation character is associated with the current
5114      environment (*note Environments::).
5115
5116  -- Request: .hpf pattern_file
5117  -- Request: .hpfa pattern_file
5118  -- Request: .hpfcode a b [c d ...]
5119      Read in a file of hyphenation patterns.  This file is searched for
5120      in the same way as `NAME.tmac' (or `tmac.NAME') is searched for if
5121      the `-mNAME' option is specified.
5122
5123      It should have the same format as (simple) TeX patterns files.
5124      More specifically, the following scanning rules are implemented.
5125
5126         * A percent sign starts a comment (up to the end of the line)
5127           even if preceded by a backslash.
5128
5129         * No support for `digraphs' like `\$'.
5130
5131         * `^^XX' (X is 0-9 or a-f) and `^^X' (character code of X in
5132           the range 0-127) are recognized; other use of `^' causes an
5133           error.
5134
5135         * No macro expansion.
5136
5137         * `hpf' checks for the expression `\patterns{...}' (possibly
5138           with whitespace before and after the braces).  Everything
5139           between the braces is taken as hyphenation patterns.
5140           Consequently, `{' and `}' are not allowed in patterns.
5141
5142         * Similarly, `\hyphenation{...}' gives a list of hyphenation
5143           exceptions.
5144
5145         * `\endinput' is recognized also.
5146
5147         * For backwards compatibility, if `\patterns' is missing, the
5148           whole file is treated as a list of hyphenation patterns (only
5149           recognizing the `%' character as the start of a comment).
5150
5151      If no `hpf' request is specified (either in the document or in a
5152      macro package), `gtroff' won't hyphenate at all.
5153
5154      The `hpfa' request appends a file of patterns to the current list.
5155
5156      The `hpfcode' request defines mapping values for character codes in
5157      hyphenation patterns.  `hpf' or `hpfa' then apply the mapping
5158      (after reading the patterns) before replacing or appending them to
5159      the current list of patterns.  Its arguments are pairs of
5160      character codes - integers from 0 to 255.  The request maps
5161      character code A to code B, code C to code D, and so on.  You can
5162      use character codes which would be invalid otherwise.
5163
5164      The set of hyphenation patterns is associated with the current
5165      language set by the `hla' request.  The `hpf' request is usually
5166      invoked by the `troffrc' or `troffrc-end' file; by default,
5167      `troffrc' loads hyphenation patterns and exceptions for American
5168      English (in files `hyphen.us' and `hyphenex.us').
5169
5170      A second call to `hpf' (for the same language) will replace the
5171      hyphenation patterns with the new ones.
5172
5173      Invoking `hpf' causes an error if there is no current hyphenation
5174      language.
5175
5176  -- Request: .hcode c1 code1 [c2 code2 ...]
5177      Set the hyphenation code of character C1 to CODE1, that of C2 to
5178      CODE2, etc.  A hyphenation code must be a single input character
5179      (not a special character) other than a digit or a space.
5180
5181      To make hyphenation work, hyphenation codes must be set up.  At
5182      start-up, groff only assigns hyphenation codes to the letters
5183      `a'-`z' (mapped to themselves) and to the letters `A'-`Z' (mapped
5184      to `a'-`z'); all other hyphenation codes are set to zero.
5185      Normally, hyphenation patterns contain only lowercase letters
5186      which should be applied regardless of case.  With other words, the
5187      words `FOO' and `Foo' should be hyphenated exactly the same way as
5188      the word `foo' is hyphenated, and this is what `hcode' is good
5189      for.  Words which contain other letters won't be hyphenated
5190      properly if the corresponding hyphenation patterns actually do
5191      contain them.  For example, the following `hcode' requests are
5192      necessary to assign hyphenation codes to the letters `ÄäÖöÜüß'
5193      (this is needed for German):
5194
5195
5196           .hcode Ă¤ Ă¤  Ă„ Ă¤
5197           .hcode Ă¶ Ă¶  Ă– Ă¶
5198           .hcode ĂĽ ĂĽ  Ăś ĂĽ
5199           .hcode Ăź Ăź
5200
5201      Without those assignments, groff treats German words like
5202      `Kindergärten' (the plural form of `kindergarten') as two
5203      substrings `kinderg' and `rten' because the hyphenation code of
5204      the umlaut a is zero by default.  There is a German hyphenation
5205      pattern which covers `kinder', so groff finds the hyphenation
5206      `kin-der'.  The other two hyphenation points (`kin-der-gär-ten')
5207      are missed.
5208
5209      This request is ignored if it has no parameter.
5210
5211  -- Request: .hym [length]
5212  -- Register: \n[.hym]
5213      Set the (right) hyphenation margin to LENGTH.  If the current
5214      adjustment mode is not `b' or `n', the line is not hyphenated if
5215      it is shorter than LENGTH.  Without an argument, the hyphenation
5216      margin is reset to its default value, which is 0.  The default
5217      scaling indicator for this request is `m'.  The hyphenation margin
5218      is associated with the current environment (*note Environments::).
5219
5220      A negative argument resets the hyphenation margin to zero, emitting
5221      a warning of type `range'.
5222
5223      The current hyphenation margin is available in the `.hym' read-only
5224      number register.
5225
5226  -- Request: .hys [hyphenation_space]
5227  -- Register: \n[.hys]
5228      Set the hyphenation space to HYPHENATION_SPACE.  If the current
5229      adjustment mode is `b' or `n', don't hyphenate the line if it can
5230      be justified by adding no more than HYPHENATION_SPACE extra space
5231      to each word space.  Without argument, the hyphenation space is
5232      set to its default value, which is 0.  The default scaling
5233      indicator for this request is `m'.  The hyphenation space is
5234      associated with the current environment (*note Environments::).
5235
5236      A negative argument resets the hyphenation space to zero, emitting
5237      a warning of type `range'.
5238
5239      The current hyphenation space is available in the `.hys' read-only
5240      number register.
5241
5242  -- Request: .shc [glyph]
5243      Set the "soft hyphen character" to GLYPH.(1) (*note Manipulating
5244      Hyphenation-Footnote-1::)  If the argument is omitted, the soft
5245      hyphen character is set to the default glyph `\(hy' (this is the
5246      start-up value of `gtroff' also).  The soft hyphen character is
5247      the glyph that is inserted when a word is hyphenated at a line
5248      break.  If the soft hyphen character does not exist in the font of
5249      the character immediately preceding a potential break point, then
5250      the line is not broken at that point.  Neither definitions
5251      (specified with the `char' request) nor translations (specified
5252      with the `tr' request) are considered when finding the soft hyphen
5253      character.
5254
5255  -- Request: .hla language
5256  -- Register: \n[.hla]
5257      Set the current hyphenation language to the string LANGUAGE.
5258      Hyphenation exceptions specified with the `hw' request and
5259      hyphenation patterns specified with the `hpf' and `hpfa' requests
5260      are both associated with the current hyphenation language.  The
5261      `hla' request is usually invoked by the `troffrc' or the
5262      `troffrc-end' files; `troffrc' sets the default language to `us'.
5263
5264      The current hyphenation language is available as a string in the
5265      read-only number register `.hla'.
5266
5267
5268           .ds curr_language \n[.hla]
5269           \*[curr_language]
5270               => us
5271
5272
5273 \1f
5274 File: groff,  Node: Manipulating Hyphenation-Footnotes,  Up: Manipulating Hyphenation
5275
5276    (1) "Soft hyphen character" is a misnomer since it is an output
5277 glyph.
5278
5279 \1f
5280 File: groff,  Node: Manipulating Spacing,  Next: Tabs and Fields,  Prev: Manipulating Hyphenation,  Up: gtroff Reference
5281
5282 5.9 Manipulating Spacing
5283 ========================
5284
5285  -- Request: .sp [distance]
5286      Space downwards DISTANCE.  With no argument it advances 1 line.  A
5287      negative argument causes `gtroff' to move up the page the
5288      specified distance.  If the argument is preceded by a `|' then
5289      `gtroff' moves that distance from the top of the page.  This
5290      request causes a line break.  The default scaling indicator is `v'.
5291
5292      If a vertical trap is sprung during execution of `sp', the amount
5293      of vertical space after the trap is discarded.  For example, this
5294
5295
5296           .de xxx
5297           ..
5298           .
5299           .wh 0 xxx
5300           .
5301           .pl 5v
5302           foo
5303           .sp 2
5304           bar
5305           .sp 50
5306           baz
5307
5308      results in
5309
5310
5311           foo
5312
5313
5314           bar
5315
5316           baz
5317
5318      The amount of discarded space is available in the number register
5319      `.trunc'.
5320
5321      To protect `sp' against vertical traps, use the `vpt' request:
5322
5323
5324           .vpt 0
5325           .sp -3
5326           .vpt 1
5327
5328
5329  -- Request: .ls [nnn]
5330  -- Register: \n[.L]
5331      Output NNN-1 blank lines after each line of text.  With no
5332      argument, `gtroff' uses the previous value before the last `ls'
5333      call.
5334
5335
5336           .ls 2    \" This causes double-spaced output
5337           .ls 3    \" This causes triple-spaced output
5338           .ls      \" Again double-spaced
5339
5340      The line spacing is associated with the current environment (*note
5341      Environments::).
5342
5343      The read-only number register `.L' contains the current line
5344      spacing setting.
5345
5346    *Note Changing Type Sizes::, for the requests `vs' and `pvs' as
5347 alternatives to `ls'.
5348
5349  -- Escape: \x'spacing'
5350  -- Register: \n[.a]
5351      Sometimes, extra vertical spacing is only needed occasionally, e.g.
5352      to allow space for a tall construct (like an equation).  The `\x'
5353      escape does this.  The escape is given a numerical argument,
5354      usually enclosed in quotes (like `\x'3p''); the default scaling
5355      indicator is `v'.  If this number is positive extra vertical space
5356      is inserted below the current line.  A negative number adds space
5357      above.  If this escape is used multiple times on the same line,
5358      the maximum of the values is used.
5359
5360      *Note Escapes::, for details on parameter delimiting characters.
5361
5362      The `.a' read-only number register contains the most recent
5363      (nonnegative) extra vertical line space.
5364
5365      Using `\x' can be necessary in combination with the `\b' escape,
5366      as the following example shows.
5367
5368
5369           This is a test with the \[rs]b escape.
5370           .br
5371           This is a test with the \[rs]b escape.
5372           .br
5373           This is a test with \b'xyz'\x'-1m'\x'1m'.
5374           .br
5375           This is a test with the \[rs]b escape.
5376           .br
5377           This is a test with the \[rs]b escape.
5378
5379      produces
5380
5381
5382           This is a test with the \b escape.
5383           This is a test with the \b escape.
5384                               x
5385           This is a test with y.
5386                               z
5387           This is a test with the \b escape.
5388           This is a test with the \b escape.
5389
5390
5391  -- Request: .ns
5392  -- Request: .rs
5393  -- Register: \n[.ns]
5394      Enable "no-space mode".  In this mode, spacing (either via `sp' or
5395      via blank lines) is disabled.  The `bp' request to advance to the
5396      next page is also disabled, except if it is accompanied by a page
5397      number (see *Note Page Control::, for more information).  This
5398      mode ends when actual text is output or the `rs' request is
5399      encountered which ends no-space mode.  The read-only number
5400      register `.ns' is set to 1 as long as no-space mode is active.
5401
5402      This request is useful for macros that conditionally insert
5403      vertical space before the text starts (for example, a paragraph
5404      macro could insert some space except when it is the first
5405      paragraph after a section header).
5406
5407 \1f
5408 File: groff,  Node: Tabs and Fields,  Next: Character Translations,  Prev: Manipulating Spacing,  Up: gtroff Reference
5409
5410 5.10 Tabs and Fields
5411 ====================
5412
5413 A tab character (ASCII char 9, EBCDIC char 5) causes a horizontal
5414 movement to the next tab stop (much like it did on a typewriter).
5415
5416  -- Escape: \t
5417      This escape is a non-interpreted tab character.  In copy mode
5418      (*note Copy-in Mode::), `\t' is the same as a real tab character.
5419
5420  -- Request: .ta [n1 n2 ... nn T r1 r2 ... rn]
5421  -- Register: \n[.tabs]
5422      Change tab stop positions.  This request takes a series of tab
5423      specifiers as arguments (optionally divided into two groups with
5424      the letter `T') which indicate where each tab stop is to be
5425      (overriding any previous settings).
5426
5427      Tab stops can be specified absolutely, i.e., as the distance from
5428      the left margin.  For example, the following sets 6 tab stops every
5429      one inch.
5430
5431
5432           .ta 1i 2i 3i 4i 5i 6i
5433
5434      Tab stops can also be specified using a leading `+' which means
5435      that the specified tab stop is set relative to the previous tab
5436      stop.  For example, the following is equivalent to the previous
5437      example.
5438
5439
5440           .ta 1i +1i +1i +1i +1i +1i
5441
5442      `gtroff' supports an extended syntax to specify repeat values after
5443      the `T' mark (these values are always taken as relative) - this is
5444      the usual way to specify tabs set at equal intervals.  The
5445      following is, yet again, the same as the previous examples.  It
5446      does even more since it defines an infinite number of tab stops
5447      separated by one inch.
5448
5449
5450           .ta T 1i
5451
5452      Now we are ready to interpret the full syntax given at the
5453      beginning: Set tabs at positions N1, N2, ..., NN and then set tabs
5454      at NN+R1, NN+R2, ..., NN+RN and then at NN+RN+R1, NN+RN+R2, ...,
5455      NN+RN+RN, and so on.
5456
5457      Example: `4c +6c T 3c 5c 2c' is equivalent to `4c 10c 13c 18c 20c
5458      23c 28c 30c ...'.
5459
5460      The material in each tab column (i.e., the column between two tab
5461      stops) may be justified to the right or left or centered in the
5462      column.  This is specified by appending `R', `L', or `C' to the tab
5463      specifier.  The default justification is `L'.  Example:
5464
5465
5466           .ta 1i 2iC 3iR
5467
5468      Some notes:
5469
5470         * The default unit of the `ta' request is `m'.
5471
5472         * A tab stop is converted into a non-breakable horizontal
5473           movement which can be neither stretched nor squeezed.  For
5474           example,
5475
5476
5477                .ds foo a\tb\tc
5478                .ta T 5i
5479                \*[foo]
5480
5481           creates a single line which is a bit longer than 10 inches (a
5482           string is used to show exactly where the tab characters are).
5483           Now consider the following:
5484
5485
5486                .ds bar a\tb b\tc
5487                .ta T 5i
5488                \*[bar]
5489
5490           `gtroff' first converts the tab stops of the line into
5491           unbreakable horizontal movements, then splits the line after
5492           the second `b' (assuming a sufficiently short line length).
5493           Usually, this isn't what the user wants.
5494
5495         * Superfluous tabs (i.e., tab characters which do not
5496           correspond to a tab stop) are ignored except the first one
5497           which delimits the characters belonging to the last tab stop
5498           for right-justifying or centering.  Consider the following
5499           example
5500
5501
5502                .ds Z   foo\tbar\tfoo
5503                .ds ZZ  foo\tbar\tfoobar
5504                .ds ZZZ foo\tbar\tfoo\tbar
5505                .ta 2i 4iR
5506                \*[Z]
5507                .br
5508                \*[ZZ]
5509                .br
5510                \*[ZZZ]
5511                .br
5512
5513           which produces the following output:
5514
5515
5516                foo                 bar              foo
5517                foo                 bar           foobar
5518                foo                 bar              foobar
5519
5520           The first line right-justifies the second `foo' relative to
5521           the tab stop.  The second line right-justifies `foobar'.  The
5522           third line finally right-justifies only `foo' because of the
5523           additional tab character which marks the end of the string
5524           belonging to the last defined tab stop.
5525
5526         * Tab stops are associated with the current environment (*note
5527           Environments::).
5528
5529         * Calling `ta' without an argument removes all tab stops.
5530
5531         * The start-up value of `gtroff' is `T 0.8i'.
5532
5533      The read-only number register `.tabs' contains a string
5534      representation of the current tab settings suitable for use as an
5535      argument to the `ta' request.
5536
5537
5538           .ds tab-string \n[.tabs]
5539           \*[tab-string]
5540               => T120u
5541
5542      The `troff' version of the Plan 9 operating system uses register
5543      `.S' for the same purpose.
5544
5545  -- Request: .tc [fill-glyph]
5546      Normally `gtroff' fills the space to the next tab stop with
5547      whitespace.  This can be changed with the `tc' request.  With no
5548      argument `gtroff' reverts to using whitespace, which is the
5549      default.  The value of this "tab repetition character" is
5550      associated with the current environment (*note Environments::).(1)
5551      (*note Tabs and Fields-Footnote-1::)
5552
5553  -- Request: .linetabs n
5554  -- Register: \n[.linetabs]
5555      If N is missing or not zero, enable "line-tabs" mode, or disable
5556      it otherwise (the default).  In line-tabs mode, `gtroff' computes
5557      tab distances relative to the (current) output line instead of the
5558      input line.
5559
5560      For example, the following code:
5561
5562
5563           .ds x a\t\c
5564           .ds y b\t\c
5565           .ds z c
5566           .ta 1i 3i
5567           \*x
5568           \*y
5569           \*z
5570
5571      in normal mode, results in the output
5572
5573
5574           a         b         c
5575
5576      in line-tabs mode, the same code outputs
5577
5578
5579           a         b                   c
5580
5581      Line-tabs mode is associated with the current environment.  The
5582      read-only register `.linetabs' is set to 1 if in line-tabs mode,
5583      and 0 in normal mode.
5584
5585 * Menu:
5586
5587 * Leaders::
5588 * Fields::
5589
5590 \1f
5591 File: groff,  Node: Tabs and Fields-Footnotes,  Up: Tabs and Fields
5592
5593    (1) "Tab repetition character" is a misnomer since it is an output
5594 glyph.
5595
5596 \1f
5597 File: groff,  Node: Leaders,  Next: Fields,  Prev: Tabs and Fields,  Up: Tabs and Fields
5598
5599 5.10.1 Leaders
5600 --------------
5601
5602 Sometimes it may may be desirable to use the `tc' request to fill a
5603 particular tab stop with a given glyph (for example dots in a table of
5604 contents), but also normal tab stops on the rest of the line.  For this
5605 `gtroff' provides an alternate tab mechanism, called "leaders" which
5606 does just that.
5607
5608    A leader character (character code 1) behaves similarly to a tab
5609 character: It moves to the next tab stop.  The only difference is that
5610 for this movement, the fill glyph defaults to a period character and
5611 not to space.
5612
5613  -- Escape: \a
5614      This escape is a non-interpreted leader character.  In copy mode
5615      (*note Copy-in Mode::), `\a' is the same as a real leader
5616      character.
5617
5618  -- Request: .lc [fill-glyph]
5619      Declare the "leader repetition character".(1) (*note
5620      Leaders-Footnote-1::) Without an argument, leaders act the same as
5621      tabs (i.e., using whitespace for filling).  `gtroff''s start-up
5622      value is a dot (`.').  The value of the leader repetition
5623      character is associated with the current environment (*note
5624      Environments::).
5625
5626    For a table of contents, to name an example, tab stops may be
5627 defined so that the section number is one tab stop, the title is the
5628 second with the remaining space being filled with a line of dots, and
5629 then the page number slightly separated from the dots.
5630
5631
5632      .ds entry 1.1\tFoo\a\t12
5633      .lc .
5634      .ta 1i 5i +.25i
5635      \*[entry]
5636
5637 This produces
5638
5639
5640      1.1  Foo..........................................  12
5641
5642 \1f
5643 File: groff,  Node: Leaders-Footnotes,  Up: Leaders
5644
5645    (1) "Leader repetition character" is a misnomer since it is an
5646 output glyph.
5647
5648 \1f
5649 File: groff,  Node: Fields,  Prev: Leaders,  Up: Tabs and Fields
5650
5651 5.10.2 Fields
5652 -------------
5653
5654 "Fields" are a more general way of laying out tabular data.  A field is
5655 defined as the data between a pair of "delimiting characters".  It
5656 contains substrings which are separated by "padding characters".  The
5657 width of a field is the distance on the _input_ line from the position
5658 where the field starts to the next tab stop.  A padding character
5659 inserts stretchable space similar to TeX's `\hss' command (thus it can
5660 even be negative) to make the sum of all substring lengths plus the
5661 stretchable space equal to the field width.  If more than one padding
5662 character is inserted, the available space is evenly distributed among
5663 them.
5664
5665  -- Request: .fc [delim-char [padding-char]]
5666      Define a delimiting and a padding character for fields.  If the
5667      latter is missing, the padding character defaults to a space
5668      character.  If there is no argument at all, the field mechanism is
5669      disabled (which is the default).  Note that contrary to e.g. the
5670      tab repetition character, delimiting and padding characters are
5671      _not_ associated to the current environment (*note Environments::).
5672
5673      Example:
5674
5675
5676           .fc # ^
5677           .ta T 3i
5678           #foo^bar^smurf#
5679           .br
5680           #foo^^bar^smurf#
5681
5682      and here the result:
5683
5684
5685           foo         bar          smurf
5686           foo            bar       smurf
5687
5688
5689 \1f
5690 File: groff,  Node: Character Translations,  Next: Troff and Nroff Mode,  Prev: Tabs and Fields,  Up: gtroff Reference
5691
5692 5.11 Character Translations
5693 ===========================
5694
5695 The control character (`.') and the no-break control character (`'')
5696 can be changed with the `cc' and `c2' requests, respectively.
5697
5698  -- Request: .cc [c]
5699      Set the control character to C.  With no argument the default
5700      control character `.' is restored.  The value of the control
5701      character is associated with the current environment (*note
5702      Environments::).
5703
5704  -- Request: .c2 [c]
5705      Set the no-break control character to C.  With no argument the
5706      default control character `'' is restored.  The value of the
5707      no-break control character is associated with the current
5708      environment (*note Environments::).
5709
5710  -- Request: .eo
5711      Disable the escape mechanism completely.  After executing this
5712      request, the backslash character `\' no longer starts an escape
5713      sequence.
5714
5715      This request can be very helpful in writing macros since it is not
5716      necessary then to double the escape character.  Here an example:
5717
5718
5719           .\" This is a simplified version of the
5720           .\" .BR request from the man macro package
5721           .eo
5722           .de BR
5723           .  ds result \&
5724           .  while (\n[.$] >= 2) \{\
5725           .    as result \fB\$1\fR\$2
5726           .    shift 2
5727           .  \}
5728           .  if \n[.$] .as result \fB\$1
5729           \*[result]
5730           .  ft R
5731           ..
5732           .ec
5733
5734
5735  -- Request: .ec [c]
5736      Set the escape character to C.  With no argument the default
5737      escape character `\' is restored.  It can be also used to
5738      re-enable the escape mechanism after an `eo' request.
5739
5740      Note that changing the escape character globally will likely break
5741      macro packages since `gtroff' has no mechanism to `intern' macros,
5742      i.e., to convert a macro definition into an internal form which is
5743      independent of its representation (TeX has this mechanism).  If a
5744      macro is called, it is executed literally.
5745
5746  -- Request: .ecs
5747  -- Request: .ecr
5748      The `ecs' request saves the current escape character in an
5749      internal register.  Use this request in combination with the `ec'
5750      request to temporarily change the escape character.
5751
5752      The `ecr' request restores the escape character saved with `ecs'.
5753      Without a previous call to `ecs', this request sets the escape
5754      character to `\'.
5755
5756  -- Escape: \\
5757  -- Escape: \e
5758  -- Escape: \E
5759      Print the current escape character (which is the backslash
5760      character `\' by default).
5761
5762      `\\' is a `delayed' backslash; more precisely, it is the default
5763      escape character followed by a backslash, which no longer has
5764      special meaning due to the leading escape character.  It is _not_
5765      an escape sequence in the usual sense!  In any unknown escape
5766      sequence `\X' the escape character is ignored and X is printed.
5767      But if X is equal to the current escape character, no warning is
5768      emitted.
5769
5770      As a consequence, only at top-level or in a diversion a backslash
5771      glyph is printed; in copy-in mode, it expands to a single
5772      backslash which then combines with the following character to an
5773      escape sequence.
5774
5775      The `\E' escape differs from `\e' by printing an escape character
5776      that is not interpreted in copy mode.  Use this to define strings
5777      with escapes that work when used in copy mode (for example, as a
5778      macro argument).  The following example defines strings to begin
5779      and end a superscript:
5780
5781
5782           .ds { \v'-.3m'\s'\En[.s]*60/100'
5783           .ds } \s0\v'.3m'
5784
5785      Another example to demonstrate the differences between the various
5786      escape sequences, using a strange escape character, `-'.
5787
5788
5789           .ec -
5790           .de xxx
5791           --A'123'
5792           ..
5793           .xxx
5794               => -A'foo'
5795
5796      The result is surprising for most users, expecting `1' since `foo'
5797      is a valid identifier.  What has happened?  As mentioned above,
5798      the leading escape character makes the following character
5799      ordinary.  Written with the default escape character the sequence
5800      `--' becomes `\-' - this is the minus sign.
5801
5802      If the escape character followed by itself is a valid escape
5803      sequence, only `\E' yields the expected result:
5804
5805
5806           .ec -
5807           .de xxx
5808           -EA'123'
5809           ..
5810           .xxx
5811               => 1
5812
5813
5814  -- Escape: \.
5815      Similar to `\\', the sequence `\.' isn't a real escape sequence.
5816      As before, a warning message is suppressed if the escape character
5817      is followed by a dot, and the dot itself is printed.
5818
5819
5820           .de foo
5821           .  nop foo
5822           .
5823           .  de bar
5824           .    nop bar
5825           \\..
5826           .
5827           ..
5828           .foo
5829           .bar
5830               => foo bar
5831
5832      The first backslash is consumed while the macro is read, and the
5833      second is swallowed while exexuting macro `foo'.
5834
5835    A "translation" is a mapping of an input character to an output
5836 glyph.  The mapping occurs at output time, i.e., the input character
5837 gets assigned the metric information of the mapped output character
5838 right before input tokens are converted to nodes (*note Gtroff
5839 Internals::, for more on this process).
5840
5841  -- Request: .tr abcd...
5842  -- Request: .trin abcd...
5843      Translate character A to glyph B, character C to glyph D, etc.  If
5844      there is an odd number of arguments, the last one is translated to
5845      an unstretchable space (`\ ').
5846
5847      The `trin' request is identical to `tr', but when you unformat a
5848      diversion with `asciify' it ignores the translation.  *Note
5849      Diversions::, for details about the `asciify' request.
5850
5851      Some notes:
5852
5853         * Special characters (`\(XX', `\[XXX]', `\C'XXX'', `\'', `\`',
5854           `\-', `\_'), glyphs defined with the `char' request, and
5855           numbered glyphs (`\N'XXX'') can be translated also.
5856
5857         * The `\e' escape can be translated also.
5858
5859         * Characters can be mapped onto the `\%' and `\~' escapes (but
5860           `\%' and `\~' can't be mapped onto another glyph).
5861
5862         * The following characters can't be translated: space (with one
5863           exception, see below), backspace, newline, leader (and `\a'),
5864           tab (and `\t').
5865
5866         * Translations are not considered for finding the soft hyphen
5867           character set with the `shc' request.
5868
5869         * The pair `C\&' (this is an arbitrary character C followed by
5870           the zero width space character) maps this character to
5871           nothing.
5872
5873
5874                .tr a\&
5875                foo bar
5876                    => foo br
5877
5878           It is even possible to map the space character to nothing:
5879
5880
5881                .tr aa \&
5882                foo bar
5883                    => foobar
5884
5885           As shown in the example, the space character can't be the
5886           first character/glyph pair as an argument of `tr'.
5887           Additionally, it is not possible to map the space character
5888           to any other glyph; requests like `.tr aa x' undo `.tr aa \&'
5889           instead.
5890
5891           If justification is active, lines are justified in spite of
5892           the `empty' space character (but there is no minimal
5893           distance, i.e. the space character, between words).
5894
5895         * After an output glyph has been constructed (this happens at
5896           the moment immediately before the glyph is appended to an
5897           output glyph list, either by direct output, in a macro,
5898           diversion, or string), it is no longer affected by `tr'.
5899
5900         * Translating character to glyphs where one of them or both are
5901           undefined is possible also; `tr' does not check whether the
5902           entities in its argument do exist.
5903
5904           *Note Gtroff Internals::.
5905
5906         * `troff' no longer has a hard-coded dependency on Latin-1; all
5907           `charXXX' entities have been removed from the font
5908           description files.  This has a notable consequence which
5909           shows up in warnings like `can't find character with input
5910           code XXX' if the `tr' request isn't handled properly.
5911
5912           Consider the following translation:
5913
5914
5915                .tr Ă©Ă‰
5916
5917           This maps input character `Ă©' onto glyph `É', which is
5918           identical to glyph `char201'.  But this glyph intentionally
5919           doesn't exist!  Instead, `\[char201]' is treated as an input
5920           character entity and is by default mapped onto `\['E]', and
5921           `gtroff' doesn't handle translations of translations.
5922
5923           The right way to write the above translation is
5924
5925
5926                .tr Ă©\['E]
5927
5928           With other words, the first argument of `tr' should be an
5929           input character or entity, and the second one a glyph entity.
5930
5931         * Without an argument, the `tr' request is ignored.
5932
5933  -- Request: .trnt abcd...
5934      `trnt' is the same as the `tr' request except that the
5935      translations do not apply to text that is transparently throughput
5936      into a diversion with `\!'.  *Note Diversions::, for more
5937      information.
5938
5939      For example,
5940
5941
5942           .tr ab
5943           .di x
5944           \!.tm a
5945           .di
5946           .x
5947
5948      prints `b' to the standard error stream; if `trnt' is used instead
5949      of `tr' it prints `a'.
5950
5951 \1f
5952 File: groff,  Node: Troff and Nroff Mode,  Next: Line Layout,  Prev: Character Translations,  Up: gtroff Reference
5953
5954 5.12 Troff and Nroff Mode
5955 =========================
5956
5957 Originally, `nroff' and `troff' were two separate programs, the former
5958 for TTY output, the latter for everything else.  With GNU `troff', both
5959 programs are merged into one executable, sending its output to a device
5960 driver (`grotty' for TTY devices, `grops' for POSTSCRIPT, etc.) which
5961 interprets the intermediate output of `gtroff'.  For UNIX `troff' it
5962 makes sense to talk about "Nroff mode" and "Troff mode" since the
5963 differences are hardcoded.  For GNU `troff', this distinction is not
5964 appropriate because `gtroff' simply takes the information given in the
5965 font files for a particular device without handling requests specially
5966 if a TTY output device is used.
5967
5968    Usually, a macro package can be used with all output devices.
5969 Nevertheless, it is sometimes necessary to make a distinction between
5970 TTY and non-TTY devices: `gtroff' provides two built-in conditions `n'
5971 and `t' for the `if', `ie', and `while' requests to decide whether
5972 `gtroff' shall behave like `nroff' or like `troff'.
5973
5974  -- Request: .troff
5975      Make the `t' built-in condition true (and the `n' built-in
5976      condition false) for `if', `ie', and `while' conditional requests.
5977      This is the default if `gtroff' (_not_ `groff') is started with
5978      the `-R' switch to avoid loading of the start-up files `troffrc'
5979      and `troffrc-end'.  Without `-R', `gtroff' stays in troff mode if
5980      the output device is not a TTY (e.g. `ps').
5981
5982  -- Request: .nroff
5983      Make the `n' built-in condition true (and the `t' built-in
5984      condition false) for `if', `ie', and `while' conditional requests.
5985      This is the default if `gtroff' uses a TTY output device; the
5986      code for switching to nroff mode is in the file `tty.tmac' which
5987      is loaded by the start-up file `troffrc'.
5988
5989    *Note Conditionals and Loops::, for more details on built-in
5990 conditions.
5991
5992 \1f
5993 File: groff,  Node: Line Layout,  Next: Line Control,  Prev: Troff and Nroff Mode,  Up: gtroff Reference
5994
5995 5.13 Line Layout
5996 ================
5997
5998 The following drawing shows the dimensions which `gtroff' uses for
5999 placing a line of output onto the page.  They are labeled with the
6000 request which manipulates each dimension.
6001
6002
6003                      -->| in |<--
6004                         |<-----------ll------------>|
6005                    +----+----+----------------------+----+
6006                    |    :    :                      :    |
6007                    +----+----+----------------------+----+
6008                 -->| po |<--
6009                    |<--------paper width---------------->|
6010
6011 These dimensions are:
6012
6013 `po'
6014      "Page offset" - this is the leftmost position of text on the final
6015      output, defining the "left margin".
6016
6017 `in'
6018      "Indentation" - this is the distance from the left margin where
6019      text is printed.
6020
6021 `ll'
6022      "Line length" - this is the distance from the left margin to right
6023      margin.
6024
6025    A simple demonstration:
6026
6027
6028      .ll 3i
6029      This is text without indentation.
6030      The line length has been set to 3\~inch.
6031      .in +.5i
6032      .ll -.5i
6033      Now the left and right margins are both increased.
6034      .in
6035      .ll
6036      Calling .in and .ll without parameters restore
6037      the previous values.
6038
6039    Result:
6040
6041
6042      This  is text without indenta-
6043      tion.   The  line  length  has
6044      been set to 3 inch.
6045           Now   the  left  and
6046           right  margins   are
6047           both increased.
6048      Calling  .in  and  .ll without
6049      parameters restore the  previ-
6050      ous values.
6051
6052  -- Request: .po [offset]
6053  -- Request: .po +offset
6054  -- Request: .po -offset
6055  -- Register: \n[.o]
6056      Set horizontal page offset to OFFSET (or increment or decrement
6057      the current value by OFFSET).  Note that this request does not
6058      cause a break, so changing the page offset in the middle of text
6059      being filled may not yield the expected result.  The initial value
6060      is 1i.  For TTY output devices, it is set to 0 in the startup file
6061      `troffrc'; the default scaling indicator is `m' (and not `v' as
6062      incorrectly documented in the original UNIX troff manual).
6063
6064      The current page offset can be found in the read-only number
6065      register `.o'.
6066
6067      If `po' is called without an argument, the page offset is reset to
6068      the previous value before the last call to `po'.
6069
6070
6071           .po 3i
6072           \n[.o]
6073               => 720
6074           .po -1i
6075           \n[.o]
6076               => 480
6077           .po
6078           \n[.o]
6079               => 720
6080
6081
6082  -- Request: .in [indent]
6083  -- Request: .in +indent
6084  -- Request: .in -indent
6085  -- Register: \n[.i]
6086      Set indentation to INDENT (or increment or decrement the current
6087      value by INDENT).  This request causes a break.  Initially, there
6088      is no indentation.
6089
6090      If `in' is called without an argument, the indentation is reset to
6091      the previous value before the last call to `in'.  The default
6092      scaling indicator is `m'.
6093
6094      The indentation is associated with the current environment (*note
6095      Environments::).
6096
6097      If a negative indentation value is specified (which is not
6098      allowed), `gtroff' emits a warning of type `range' and sets the
6099      indentation to zero.
6100
6101      The effect of `in' is delayed until a partially collected line (if
6102      it exists) is output.  A temporary indentation value is reset to
6103      zero also.
6104
6105      The current indentation (as set by `in') can be found in the
6106      read-only number register `.i'.
6107
6108  -- Request: .ti offset
6109  -- Request: .ti +offset
6110  -- Request: .ti -offset
6111  -- Register: \n[.in]
6112      Temporarily indent the next output line by OFFSET.  If an
6113      increment or decrement value is specified, adjust the temporary
6114      indentation relative to the value set by the `in' request.
6115
6116      This request causes a break; its value is associated with the
6117      current environment (*note Environments::).  The default scaling
6118      indicator is `m'.  A call of `ti' without an argument is ignored.
6119
6120      If the total indentation value is negative (which is not allowed),
6121      `gtroff' emits a warning of type `range' and sets the temporary
6122      indentation to zero.  `Total indentation' is either OFFSET if
6123      specified as an absolute value, or the temporary plus normal
6124      indentation, if OFFSET is given as a relative value.
6125
6126      The effect of `ti' is delayed until a partially collected line (if
6127      it exists) is output.
6128
6129      The read-only number register `.in' is the indentation that applies
6130      to the current output line.
6131
6132      The difference between `.i' and `.in' is that the latter takes
6133      into account whether a partially collected line still uses the old
6134      indentation value or a temporary indentation value is active.
6135
6136  -- Request: .ll [length]
6137  -- Request: .ll +length
6138  -- Request: .ll -length
6139  -- Register: \n[.l]
6140  -- Register: \n[.ll]
6141      Set the line length to LENGTH (or increment or decrement the
6142      current value by LENGTH).  Initially, the line length is set to
6143      6.5i.  The effect of `ll' is delayed until a partially collected
6144      line (if it exists) is output.  The default scaling indicator is
6145      `m'.
6146
6147      If `ll' is called without an argument, the line length is reset to
6148      the previous value before the last call to `ll'.  If a negative
6149      line length is specified (which is not allowed), `gtroff' emits a
6150      warning of type `range' and sets the line length to zero.
6151
6152      The line length is associated with the current environment (*note
6153      Environments::).
6154
6155      The current line length (as set by `ll') can be found in the
6156      read-only number register `.l'.  The read-only number register
6157      `.ll' is the line length that applies to the current output line.
6158
6159      Similar to `.i' and `.in', the difference between `.l' and `.ll'
6160      is that the latter takes into account whether a partially
6161      collected line still uses the old line length value.
6162
6163 \1f
6164 File: groff,  Node: Line Control,  Next: Page Layout,  Prev: Line Layout,  Up: gtroff Reference
6165
6166 5.14 Line Control
6167 =================
6168
6169 It is important to understand how `gtroff' handles input and output
6170 lines.
6171
6172    Many escapes use positioning relative to the input line.  For
6173 example, this
6174
6175
6176      This is a \h'|1.2i'test.
6177
6178      This is a
6179      \h'|1.2i'test.
6180
6181 produces
6182
6183
6184      This is a   test.
6185
6186      This is a             test.
6187
6188    The main usage of this feature is to define macros which act exactly
6189 at the place where called.
6190
6191
6192      .\" A simple macro to underline a word
6193      .de underline
6194      .  nop \\$1\l'|0\[ul]'
6195      ..
6196
6197 In the above example, `|0' specifies a negative distance from the
6198 current position (at the end of the just emitted argument `\$1') back
6199 to the beginning of the input line.  Thus, the `\l' escape draws a line
6200 from right to left.
6201
6202    `gtroff' makes a difference between input and output line
6203 continuation; the latter is also called "interrupting" a line.
6204
6205  -- Escape: \<RET>
6206  -- Escape: \c
6207  -- Register: \n[.int]
6208      Continue a line.  `\<RET>' (this is a backslash at the end of a
6209      line immediately followed by a newline) works on the input level,
6210      suppressing the effects of the following newline in the input.
6211
6212
6213           This is a \
6214           .test
6215               => This is a .test
6216
6217      The `|' operator is also affected.
6218
6219      `\c' works on the output level.  Anything after this escape on the
6220      same line is ignored, except `\R' which works as usual.  Anything
6221      before `\c' on the same line will be appended to the current
6222      partial output line.  The next non-command line after an
6223      interrupted line counts as a new input line.
6224
6225      The visual results depend on whether no-fill mode is active.
6226
6227         * If no-fill mode is active (using the `nf' request), the next
6228           input text line after `\c' will be handled as a continuation
6229           of the same input text line.
6230
6231
6232                .nf
6233                This is a \c
6234                test.
6235                    => This is a test.
6236
6237         * If fill mode is active (using the `fi' request), a word
6238           interrupted with `\c' will be continued with the text on the
6239           next input text line, without an intervening space.
6240
6241
6242                This is a te\c
6243                st.
6244                    => This is a test.
6245
6246
6247      Note that an intervening control line which causes a break is
6248      stronger than `\c', flushing out the current partial line in the
6249      usual way.
6250
6251      The `.int' register contains a positive value if the last output
6252      line was interrupted with `\c'; this is associated with the
6253      current environment (*note Environments::).
6254
6255 \1f
6256 File: groff,  Node: Page Layout,  Next: Page Control,  Prev: Line Control,  Up: gtroff Reference
6257
6258 5.15 Page Layout
6259 ================
6260
6261 `gtroff' provides some very primitive operations for controlling page
6262 layout.
6263
6264  -- Request: .pl [length]
6265  -- Request: .pl +length
6266  -- Request: .pl -length
6267  -- Register: \n[.p]
6268      Set the "page length" to LENGTH (or increment or decrement the
6269      current value by LENGTH).  This is the length of the physical
6270      output page.  The default scaling indicator is `v'.
6271
6272      The current setting can be found in the read-only number register
6273      `.p'.
6274
6275      Note that this only specifies the size of the page, not the top and
6276      bottom margins.  Those are not set by `gtroff' directly.  *Note
6277      Traps::, for further information on how to do this.
6278
6279      Negative `pl' values are possible also, but not very useful: No
6280      trap is sprung, and each line is output on a single page (thus
6281      suppressing all vertical spacing).
6282
6283      If no argument or an invalid argument is given, `pl' sets the page
6284      length to 11i.
6285
6286    `gtroff' provides several operations which help in setting up top
6287 and bottom titles (or headers and footers).
6288
6289  -- Request: .tl 'left'center'right'
6290      Print a "title line".  It consists of three parts: a left
6291      justified portion, a centered portion, and a right justified
6292      portion.  The argument separator `'' can be replaced with any
6293      character not occurring in the title line.  The `%' character is
6294      replaced with the current page number.  This character can be
6295      changed with the `pc' request (see below).
6296
6297      Without argument, `tl' is ignored.
6298
6299      Some notes:
6300
6301         * A title line is not restricted to the top or bottom of a page.
6302
6303         * `tl' prints the title line immediately, ignoring a partially
6304           filled line (which stays untouched).
6305
6306         * It is not an error to omit closing delimiters.  For example,
6307           `.tl /foo' is equivalent to `.tl /foo///': It prints a title
6308           line with the left justified word `foo'; the centered and
6309           right justfied parts are empty.
6310
6311         * `tl' accepts the same parameter delimiting characters as the
6312           `\A' escape; see *Note Escapes::.
6313
6314  -- Request: .lt [length]
6315  -- Request: .lt +length
6316  -- Request: .lt -length
6317  -- Register: \n[.lt]
6318      The title line is printed using its own line length, which is
6319      specified (or incremented or decremented) with the `lt' request.
6320      Initially, the title line length is set to 6.5i.  If a negative
6321      line length is specified (which is not allowed), `gtroff' emits a
6322      warning of type `range' and sets the title line length to zero.
6323      The default scaling indicator is `m'.  If `lt' is called without
6324      an argument, the title length is reset to the previous value
6325      before the last call to `lt'.
6326
6327      The current setting of this is available in the `.lt' read-only
6328      number register; it is associated with the current environment
6329      (*note Environments::).
6330
6331  -- Request: .pn page
6332  -- Request: .pn +page
6333  -- Request: .pn -page
6334  -- Register: \n[.pn]
6335      Change (increase or decrease) the page number of the _next_ page.
6336      The only argument is the page number; the request is ignored
6337      without a parameter.
6338
6339      The read-only number register `.pn' contains the number of the next
6340      page: either the value set by a `pn' request, or the number of the
6341      current page plus 1.
6342
6343  -- Request: .pc [char]
6344      Change the page number character (used by the `tl' request) to a
6345      different character.  With no argument, this mechanism is disabled.
6346      Note that this doesn't affect the number register `%'.
6347
6348    *Note Traps::.
6349
6350 \1f
6351 File: groff,  Node: Page Control,  Next: Fonts and Symbols,  Prev: Page Layout,  Up: gtroff Reference
6352
6353 5.16 Page Control
6354 =================
6355
6356  -- Request: .bp [page]
6357  -- Request: .bp +page
6358  -- Request: .bp -page
6359  -- Register: \n[%]
6360      Stop processing the current page and move to the next page.  This
6361      request causes a break.  It can also take an argument to set
6362      (increase, decrease) the page number of the next page (which
6363      actually becomes the current page after `bp' has finished).  The
6364      difference between `bp' and `pn' is that `pn' does not cause a
6365      break or actually eject a page.  *Note Page Layout::.
6366
6367
6368           .de newpage                         \" define macro
6369           'bp                                 \" begin page
6370           'sp .5i                             \" vertical space
6371           .tl 'left top'center top'right top' \" title
6372           'sp .3i                             \" vertical space
6373           ..                                  \" end macro
6374
6375      `bp' has no effect if not called within the top-level diversion
6376      (*note Diversions::).
6377
6378      The read-write register `%' holds the current page number.
6379
6380      The number register `.pe' is set to 1 while `bp' is active.  *Note
6381      Page Location Traps::.
6382
6383  -- Request: .ne [space]
6384      It is often necessary to force a certain amount of space before a
6385      new page occurs.  This is most useful to make sure that there is
6386      not a single "orphan" line left at the bottom of a page.  The `ne'
6387      request ensures that there is a certain distance, specified by the
6388      first argument, before the next page is triggered (see *Note
6389      Traps::, for further information).  The default scaling indicator
6390      for `ne' is `v'; the default value of SPACE is 1v if no argument
6391      is given.
6392
6393      For example, to make sure that no fewer than 2 lines get orphaned,
6394      do the following before each paragraph:
6395
6396
6397           .ne 2
6398           text text text
6399
6400      `ne' will then automatically cause a page break if there is space
6401      for one line only.
6402
6403  -- Request: .sv [space]
6404  -- Request: .os
6405      `sv' is similar to the `ne' request; it reserves the specified
6406      amount of vertical space.  If the desired amount of space exists
6407      before the next trap (or the bottom page boundary if no trap is
6408      set), the space is output immediately (ignoring a partially filled
6409      line which stays untouched).  If there is not enough space, it is
6410      stored for later output via the `os' request.  The default value
6411      is 1v if no argument is given; the default scaling indicator is
6412      `v'.
6413
6414      Both `sv' and `os' ignore no-space mode.  While the `sv' request
6415      allows negative values for SPACE, `os' will ignore them.
6416
6417  -- Register: \n[nl]
6418      This register contains the current vertical position.  If the
6419      vertical position is zero and the top of page transition hasn't
6420      happened yet, `nl' is set to negative value.  `gtroff' itself does
6421      this at the very beginning of a document before anything has been
6422      printed, but the main usage is to plant a header trap on a page if
6423      this page has already started.
6424
6425      Consider the following:
6426
6427
6428           .de xxx
6429           .  sp
6430           .  tl ''Header''
6431           .  sp
6432           ..
6433           .
6434           First page.
6435           .bp
6436           .wh 0 xxx
6437           .nr nl (-1)
6438           Second page.
6439
6440      Result:
6441
6442
6443           First page.
6444
6445           ...
6446
6447                                        Header
6448
6449           Second page.
6450
6451           ...
6452
6453      Without resetting `nl' to a negative value, the just planted trap
6454      would be active beginning with the _next_ page, not the current
6455      one.
6456
6457      *Note Diversions::, for a comparison with the `.h' and `.d'
6458      registers.
6459
6460 \1f
6461 File: groff,  Node: Fonts and Symbols,  Next: Sizes,  Prev: Page Control,  Up: gtroff Reference
6462
6463 5.17 Fonts and Symbols
6464 ======================
6465
6466 `gtroff' can switch fonts at any point in the text.
6467
6468    The basic set of fonts is `R', `I', `B', and `BI'.  These are Times
6469 Roman, Italic, Bold, and Bold Italic.  For non-TTY devices, there is
6470 also at least one symbol font which contains various special symbols
6471 (Greek, mathematics).
6472
6473 * Menu:
6474
6475 * Changing Fonts::
6476 * Font Families::
6477 * Font Positions::
6478 * Using Symbols::
6479 * Special Fonts::
6480 * Artificial Fonts::
6481 * Ligatures and Kerning::
6482
6483 \1f
6484 File: groff,  Node: Changing Fonts,  Next: Font Families,  Prev: Fonts and Symbols,  Up: Fonts and Symbols
6485
6486 5.17.1 Changing Fonts
6487 ---------------------
6488
6489  -- Request: .ft [font]
6490  -- Escape: \ff
6491  -- Escape: \f(fn
6492  -- Escape: \f[font]
6493  -- Register: \n[.sty]
6494      The `ft' request and the `\f' escape change the current font to
6495      FONT (one-character name F, two-character name FN).
6496
6497      If FONT is a style name (as set with the `sty' request or with the
6498      `styles' command in the `DESC' file), use it within the current
6499      font family (as set with the `fam' request, `\F' escape, or with
6500      the `family' command in the `DESC' file).
6501
6502      With no argument or using `P' as an argument, `.ft' switches to
6503      the previous font.  Use `\f[]' to do this with the escape.  The
6504      old syntax forms `\fP' or `\f[P]' are also supported.
6505
6506      Fonts are generally specified as upper-case strings, which are
6507      usually 1 to 4 characters representing an abbreviation or acronym
6508      of the font name.  This is no limitation, just a convention.
6509
6510      The example below produces two identical lines.
6511
6512
6513           eggs, bacon,
6514           .ft B
6515           spam
6516           .ft
6517           and sausage.
6518
6519           eggs, bacon, \fBspam\fP and sausage.
6520
6521      Note that `\f' doesn't produce an input token in `gtroff'.  As a
6522      consequence, it can be used in requests like `mc' (which expects a
6523      single character as an argument) to change the font on the fly:
6524
6525
6526           .mc \f[I]x\f[]
6527
6528      The current style name is available in the read-only number
6529      register `.sty' (this is a string-valued register); if the current
6530      font isn't a style, the empty string is returned.  It is
6531      associated with the current environment.
6532
6533      *Note Font Positions::, for an alternative syntax.
6534
6535  -- Request: .ftr f [g]
6536      Translate font F to font G.  Whenever a font named F is referred
6537      to in a `\f' escape sequence, in the `F' and `S' conditional
6538      operators, or in the `ft', `ul', `bd', `cs', `tkf', `special',
6539      `fspecial', `fp', or `sty' requests, font G is used.  If G is
6540      missing or equal to F the translation is undone.
6541
6542 \1f
6543 File: groff,  Node: Font Families,  Next: Font Positions,  Prev: Changing Fonts,  Up: Fonts and Symbols
6544
6545 5.17.2 Font Families
6546 --------------------
6547
6548 Due to the variety of fonts available, `gtroff' has added the concept
6549 of "font families" and "font styles".  The fonts are specified as the
6550 concatenation of the font family and style.  Specifying a font without
6551 the family part causes `gtroff' to use that style of the current family.
6552
6553    Currently, fonts for the devices `-Tps', `-Tdvi', `-Tlj4', `-Tlbp',
6554 and the X11 fonts are set up to this mechanism.  By default, `gtroff'
6555 uses the Times family with the four styles `R', `I', `B', and `BI'.
6556
6557    This way, it is possible to use the basic four fonts and to select a
6558 different font family on the command line (*note Groff Options::).
6559
6560  -- Request: .fam [family]
6561  -- Register: \n[.fam]
6562  -- Escape: \Ff
6563  -- Escape: \F(fm
6564  -- Escape: \F[family]
6565  -- Register: \n[.fn]
6566      Switch font family to FAMILY (one-character name F, two-character
6567      name FM).  If no argument is given, switch back to the previous
6568      font family.  Use `\F[]' to do this with the escape.  Note that
6569      `\FP' doesn't work; it selects font family `P' instead.
6570
6571      The value at start-up is `T'.  The current font family is
6572      available in the read-only number register `.fam' (this is a
6573      string-valued register); it is associated with the current
6574      environment.
6575
6576
6577           spam,
6578           .fam H    \" helvetica family
6579           spam,     \" used font is family H + style R = HR
6580           .ft B     \" family H + style B = font HB
6581           spam,
6582           .fam T    \" times family
6583           spam,     \" used font is family T + style B = TB
6584           .ft AR    \" font AR (not a style)
6585           baked beans,
6586           .ft R     \" family T + style R = font TR
6587           and spam.
6588
6589      Note that `\F' doesn't produce an input token in `gtroff'.  As a
6590      consequence, it can be used in requests like `mc' (which expects a
6591      single character as an argument) to change the font family on the
6592      fly:
6593
6594
6595           .mc \F[P]x\F[]
6596
6597      The `.fn' register contains the current "real font name" of the
6598      current font.  This is a string-valued register.  If the current
6599      font is a style, the value of `\n[.fn]' is the proper
6600      concatenation of family and style name.
6601
6602  -- Request: .sty n style
6603      Associate STYLE with font position N.  A font position can be
6604      associated either with a font or with a style.  The current font
6605      is the index of a font position and so is also either a font or a
6606      style.  If it is a style, the font that is actually used is the
6607      font which name is the concatenation of the name of the current
6608      family and the name of the current style.  For example, if the
6609      current font is 1 and font position 1 is associated with style `R'
6610      and the current font family is `T', then font `TR' will be used.
6611      If the current font is not a style, then the current family is
6612      ignored.  If the requests `cs', `bd', `tkf', `uf', or `fspecial'
6613      are applied to a style, they will instead be applied to the member
6614      of the current family corresponding to that style.
6615
6616      N must be a non-negative integer value.
6617
6618      The default family can be set with the `-f' option (*note Groff
6619      Options::).  The `styles' command in the `DESC' file controls
6620      which font positions (if any) are initially associated with styles
6621      rather than fonts.  For example, the default setting for
6622      POSTSCRIPT fonts
6623
6624
6625           styles R I B BI
6626
6627      is equivalent to
6628
6629
6630           .sty 1 R
6631           .sty 2 I
6632           .sty 3 B
6633           .sty 4 BI
6634
6635      `fam' and `\F' always check whether the current font position is
6636      valid; this can give surprising results if the current font
6637      position is associated with a style.
6638
6639      In the following example, we want to access the POSTSCRIPT font
6640      `FooBar' from the font family `Foo':
6641
6642
6643           .sty \n[.fp] Bar
6644           .fam Foo
6645               => warning: can't find font `FooR'
6646
6647      The default font position at start-up is 1; for the POSTSCRIPT
6648      device, this is associated with style `R', so `gtroff' tries to
6649      open `FooR'.
6650
6651      A solution to this problem is to use a dummy font like the
6652      following:
6653
6654
6655           .fp 0 dummy TR    \" set up dummy font at position 0
6656           .sty \n[.fp] Bar  \" register style `Bar'
6657           .ft 0             \" switch to font at position 0
6658           .fam Foo          \" activate family `Foo'
6659           .ft Bar           \" switch to font `FooBar'
6660
6661      *Note Font Positions::.
6662
6663 \1f
6664 File: groff,  Node: Font Positions,  Next: Using Symbols,  Prev: Font Families,  Up: Fonts and Symbols
6665
6666 5.17.3 Font Positions
6667 ---------------------
6668
6669 For the sake of old phototypesetters and compatibility with old versions
6670 of `troff', `gtroff' has the concept of font "positions", on which
6671 various fonts are mounted.
6672
6673  -- Request: .fp pos font [external-name]
6674  -- Register: \n[.f]
6675  -- Register: \n[.fp]
6676      Mount font FONT at position POS (which must be a non-negative
6677      integer).  This numeric position can then be referred to with font
6678      changing commands.  When `gtroff' starts it is using font
6679      position 1 (which must exist; position 0 is unused usually at
6680      start-up).
6681
6682      The current font in use, as a font position, is available in the
6683      read-only number register `.f'.  This can be useful to remember the
6684      current font for later recall.  It is associated with the current
6685      environment (*note Environments::).
6686
6687
6688           .nr save-font \n[.f]
6689           .ft B
6690           ... text text text ...
6691           .ft \n[save-font]
6692
6693      The number of the next free font position is available in the
6694      read-only number register `.fp'.  This is useful when mounting a
6695      new font, like so:
6696
6697
6698           .fp \n[.fp] NEATOFONT
6699
6700      Fonts not listed in the `DESC' file are automatically mounted on
6701      the next available font position when they are referenced.  If a
6702      font is to be mounted explicitly with the `fp' request on an unused
6703      font position, it should be mounted on the first unused font
6704      position, which can be found in the `.fp' register.  Although
6705      `gtroff' does not enforce this strictly, it is not allowed to
6706      mount a font at a position whose number is much greater (approx.
6707      1000 positions) than that of any currently used position.
6708
6709      The `fp' request has an optional third argument.  This argument
6710      gives the external name of the font, which is used for finding the
6711      font description file.  The second argument gives the internal
6712      name of the font which is used to refer to the font in `gtroff'
6713      after it has been mounted.  If there is no third argument then the
6714      internal name is used as the external name.  This feature makes it
6715      possible to use fonts with long names in compatibility mode.
6716
6717    Both the `ft' request and the `\f' escape have alternative syntax
6718 forms to access font positions.
6719
6720  -- Request: .ft nnn
6721  -- Escape: \fn
6722  -- Escape: \f(nn
6723  -- Escape: \f[nnn]
6724      Change the current font position to NNN (one-digit position N,
6725      two-digit position NN), which must be a non-negative integer.
6726
6727      If NNN is associated with a style (as set with the `sty' request
6728      or with the `styles' command in the `DESC' file), use it within
6729      the current font family (as set with the `fam' request, the `\F'
6730      escape, or with the `family' command in the `DESC' file).
6731
6732
6733           this is font 1
6734           .ft 2
6735           this is font 2
6736           .ft                   \" switch back to font 1
6737           .ft 3
6738           this is font 3
6739           .ft
6740           this is font 1 again
6741
6742      *Note Changing Fonts::, for the standard syntax form.
6743
6744 \1f
6745 File: groff,  Node: Using Symbols,  Next: Special Fonts,  Prev: Font Positions,  Up: Fonts and Symbols
6746
6747 5.17.4 Using Symbols
6748 --------------------
6749
6750 A "glyph" is a graphical representation of a "character".  While a
6751 character is an abstract entity containing semantic information, a
6752 glyph is something which can be actually seen on screen or paper.  It
6753 is possible that a character has multiple glyph representation forms
6754 (for example, the character `A' can be either written in a roman or an
6755 italic font, yielding two different glyphs); sometimes more than one
6756 character maps to a single glyph (this is a "ligature" - the most
6757 common is `fi').
6758
6759    A "symbol" is simply a named glyph.  Within `gtroff', all glyph
6760 names of a particular font are defined in its font file.  If the user
6761 requests a glyph not available in this font, `gtroff' looks up an
6762 ordered list of "special fonts".  By default, the POSTSCRIPT output
6763 device supports the two special fonts `SS' (slanted symbols) and `S'
6764 (symbols) (the former is looked up before the latter).  Other output
6765 devices use different names for special fonts.  Fonts mounted with the
6766 `fonts' keyword in the `DESC' file are globally available.  To install
6767 additional special fonts locally (i.e. for a particular font), use the
6768 `fspecial' request.
6769
6770    Here the exact rules how `gtroff' searches a given symbol:
6771
6772    * If the symbol has been defined with the `char' request, use it.
6773      This hides a symbol with the same name in the current font.
6774
6775    * Check the current font.
6776
6777    * If the symbol has been defined with the `fchar' request, use it.
6778
6779    * Check whether the current font has a font-specific list of special
6780      fonts; test all fonts in the order of appearance in the last
6781      `fspecial' call if appropriate.
6782
6783    * If the symbol has been defined with the `fschar' request for the
6784      current font, use it.
6785
6786    * Check all fonts in the order of appearance in the last `special'
6787      call.
6788
6789    * If the symbol has been defined with the `schar' request, use it.
6790
6791    * As a last resort, consult all fonts loaded up to now for special
6792      fonts and check them, starting with the lowest font number.  Note
6793      that this can sometimes lead to surprising results since the
6794      `fonts' line in the `DESC' file often contains empty positions
6795      which are filled later on.  For example, consider the following:
6796
6797
6798           fonts 3 0 0 FOO
6799
6800      This mounts font `foo' at font position 3.  We assume that `FOO'
6801      is a special font, containing glyph `foo', and that no font has
6802      been loaded yet.  The line
6803
6804
6805           .fspecial BAR BAZ
6806
6807      makes font `BAZ' special only if font `BAR' is active.  We further
6808      assume that `BAZ' is really a special font, i.e., the font
6809      description file contains the `special' keyword, and that it also
6810      contains glyph `foo' with a special shape fitting to font `BAR'.
6811      After executing `fspecial', font `BAR' is loaded at font
6812      position 1, and `BAZ' at position 2.
6813
6814      We now switch to a new font `XXX', trying to access glyph `foo'
6815      which is assumed to be missing.  There are neither font-specific
6816      special fonts for `XXX' nor any other fonts made special with the
6817      `special' request, so `gtroff' starts the search for special fonts
6818      in the list of already mounted fonts, with increasing font
6819      positions.  Consequently, it finds `BAZ' before `FOO' even for
6820      `XXX' which is not the intended behaviour.
6821
6822    *Note Font Files::, and *Note Special Fonts::, for more details.
6823
6824    The list of available symbols is device dependent; see the
6825 `groff_char(7)' man page for a complete list of all glyphs.  For
6826 example, say
6827
6828
6829      man -Tdvi groff_char > groff_char.dvi
6830
6831 for a list using the default DVI fonts (not all versions of the `man'
6832 program support the `-T' option).  If you want to use an additional
6833 macro package to change the used fonts, `groff' must be called directly:
6834
6835
6836      groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
6837
6838    Glyph names not listed in groff_char(7) are derived algorithmically,
6839 using a simplified version of the Adobe Glyph List (AGL) algorithm
6840 which is described in
6841 `http://partners.adobe.com/asn/tech/type/unicodegn.jsp'.  The (frozen)
6842 set of glyph names which can't be derived algorithmically is called
6843 "groff glyph list (GGL)".
6844
6845    * A glyph for Unicode character U+XXXX[X[X]] which is not a
6846      composite character will be named `uXXXX[X[X]]'.  X must be an
6847      uppercase hexadecimal digit.  Examples: `u1234', `u008E',
6848      `u12DB8'.  The largest Unicode value is 0x10FFFF.  There must be at
6849      least four `X' digits; if necessary, add leading zeroes (after the
6850      `u').  No zero padding is allowed for character codes greater than
6851      0xFFFF.  Surrogates (i.e., Unicode values greater than 0xFFFF
6852      represented with character codes from the surrogate area
6853      U+D800-U+DFFF) are not allowed too.
6854
6855    * A glyph representing more than a single input character will be
6856      named
6857
6858           `u' COMPONENT1 `_' COMPONENT2 `_' COMPONENT3 ...
6859
6860      Example: `u0045_0302_0301'.
6861
6862      For simplicity, all Unicode characters which are composites must be
6863      decomposed maximally (this is normalization form D in the Unicode
6864      standard); for example, `u00CA_0301' is not a valid glyph name
6865      since U+00CA (LATIN CAPITAL LETTER E WITH CIRCUMFLEX) can be
6866      further decomposed into U+0045 (LATIN CAPITAL LETTER E) and U+0302
6867      (COMBINING CIRCUMFLEX ACCENT).  `u0045_0302_0301' is thus the
6868      glyph name for U+1EBE, LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND
6869      ACUTE.
6870
6871    * groff maintains a table to decompose all algorithmically derived
6872      glyph names which are composites itself.  For example, `u0100'
6873      (LATIN LETTER A WITH MACRON) will be automatically decomposed into
6874      `u0041_0304'.  Additionally, a glyph name of the GGL is preferred
6875      to an algorithmically derived glyph name; groff also automatically
6876      does the mapping.  Example: The glyph `u0045_0302' will be mapped
6877      to `^E'.
6878
6879    * glyph names of the GGL can't be used in composite glyph names; for
6880      example, `^E_u0301' is invalid.
6881
6882  -- Escape: \(nm
6883  -- Escape: \[name]
6884  -- Escape: \[component1 component2 ...]
6885      Insert a symbol NAME (two-character name NM) or a composite glyph
6886      with component glyphs COMPONENT1, COMPONENT2, .... There is no
6887      special syntax for one-character names - the natural form `\N'
6888      would collide with escapes.(1) (*note Using Symbols-Footnote-1::)
6889
6890      If NAME is undefined, a warning of type `char' is generated, and
6891      the escape is ignored.  *Note Debugging::, for information about
6892      warnings.
6893
6894      groff resolves `\[...]' with more than a single component as
6895      follows:
6896
6897         * Any component which is found in the GGL will be converted to
6898           the `uXXXX' form.
6899
6900         * Any component `uXXXX' which is found in the list of
6901           decomposable glyphs will be decomposed.
6902
6903         * The resulting elements are then concatenated with `_'
6904           inbetween, dropping the leading `u' in all elements but the
6905           first.
6906
6907      No check for the existence of any component (similar to `tr'
6908      request) will be done.
6909
6910      Examples:
6911
6912     `\[A ho]'
6913           `A' maps to `u0041', `ho' maps to `u02DB', thus the final
6914           glyph name would be `u0041_02DB'.  Note this is not the
6915           expected result: The ogonek glyph `ho' is a spacing ogonek,
6916           but for a proper composite a non-spacing ogonek (U+0328) is
6917           necessary.  Looking into the file `composite.tmac' one can
6918           find `.composite ho u0328' which changes the mapping of `ho'
6919           while a composite glyph name is constructed, causing the
6920           final glyph name to be `u0041_0328'.
6921
6922     `\[^E u0301]'
6923     `\[^E aa]'
6924     `\[E a^ aa]'
6925     `\[E ^ ']'
6926           `^E' maps to `u0045_0302', thus the final glyph name is
6927           `u0045_0302_0301' in all forms (assuming proper calls of the
6928           `composite' request).
6929
6930      It is not possible to define glyphs with names like `A ho' within
6931      a groff font file.  This is not really a limitation; instead, you
6932      have to define `u0041_0328'.
6933
6934  -- Escape: \C'xxx'
6935      Typeset the glyph named XXX.(2) (*note Using Symbols-Footnote-2::)
6936      Normally it is more convenient to use `\[XXX]', but `\C' has the
6937      advantage that it is compatible with newer versions of AT&T
6938      `troff' and is available in compatibility mode.
6939
6940  -- Request: .composite from to
6941      Map glyph name FROM to glyph name TO if it is used in `\[...]'
6942      with more than one component.  See above for examples.
6943
6944      This mapping is based on glyph names only; no check for the
6945      existence of either glyph is done.
6946
6947      A set of default mappings for many accents can be found in the file
6948      `composite.tmac' which is loaded at start-up.
6949
6950  -- Escape: \N'n'
6951      Typeset the glyph with code N in the current font (`n' is *not*
6952      the input character code).  The number N can be any non-negative
6953      decimal integer.  Most devices only have glyphs with codes between
6954      0 and 255; the Unicode output device uses codes in the range
6955      0-65535.  If the current font does not contain a glyph with that
6956      code, special fonts are _not_ searched.  The `\N' escape sequence
6957      can be conveniently used in conjunction with the `char' request:
6958
6959
6960           .char \[phone] \f[ZD]\N'37'
6961
6962      The code of each glyph is given in the fourth column in the font
6963      description file after the `charset' command.  It is possible to
6964      include unnamed glyphs in the font description file by using a
6965      name of `---'; the `\N' escape sequence is the only way to use
6966      these.
6967
6968      No kerning is applied to glyphs accessed with `\N'.
6969
6970    Some escape sequences directly map onto special glyphs.
6971
6972  -- Escape: \'
6973      This is a backslash followed by the apostrophe character, ASCII
6974      character `0x27' (EBCDIC character `0x7D').  The same as `\[aa]',
6975      the acute accent.
6976
6977  -- Escape: \`
6978      This is a backslash followed by ASCII character `0x60' (EBCDIC
6979      character `0x79' usually).  The same as `\[ga]', the grave accent.
6980
6981  -- Escape: \-
6982      This is the same as `\[-]', the minus sign in the current font.
6983
6984  -- Request: .cflags n c1 c2 ...
6985      Input characters and symbols have certain properties associated
6986      with it.(3) (*note Using Symbols-Footnote-3::)  These properties
6987      can be modified with the `cflags' request.  The first argument is
6988      the sum of the desired flags and the remaining arguments are the
6989      characters or symbols to have those properties.  It is possible to
6990      omit the spaces between the characters or symbols.
6991
6992     `1'
6993           The character ends sentences (initially characters `.?!' have
6994           this property).
6995
6996     `2'
6997           Lines can be broken before the character (initially no
6998           characters have this property).
6999
7000     `4'
7001           Lines can be broken after the character (initially the
7002           character `-' and the symbols `\[hy]' and `\[em]' have this
7003           property).
7004
7005     `8'
7006           The character overlaps horizontally if used as a horizontal
7007           line building element.  Initially the symbols `\[ul]',
7008           `\[rn]', `\[ru]', `\[radicalex]', and `\[sqrtex]' have this
7009           property.
7010
7011     `16'
7012           The character overlaps vertically if used as vertical line
7013           building element.  Initially symbol `\[br]' has this property.
7014
7015     `32'
7016           An end-of-sentence character followed by any number of
7017           characters with this property is treated as the end of a
7018           sentence if followed by a newline or two spaces; in other
7019           words the character is "transparent" for the purposes of
7020           end-of-sentence recognition - this is the same as having a
7021           zero space factor in TeX (initially characters `"')]*' and
7022           the symbols `\[dg]' and `\[rq]' have this property).
7023
7024  -- Request: .char g [string]
7025  -- Request: .fchar g [string]
7026  -- Request: .fschar f g [string]
7027  -- Request: .schar g [string]
7028      Define a new glyph G to be STRING (which can be empty).(4) (*note
7029      Using Symbols-Footnote-4::)  Every time glyph G needs to be
7030      printed, STRING is processed in a temporary environment and the
7031      result is wrapped up into a single object.  Compatibility mode is
7032      turned off and the escape character is set to `\' while STRING is
7033      being processed.  Any emboldening, constant spacing or track
7034      kerning is applied to this object rather than to individual
7035      characters in STRING.
7036
7037      A glyph defined by these requests can be used just like a normal
7038      glyph provided by the output device.  In particular, other
7039      characters can be translated to it with the `tr' or `trin'
7040      requests; it can be made the leader character by the `lc' request;
7041      repeated patterns can be drawn with the glyph using the `\l' and
7042      `\L' escape sequences; words containing the glyph can be
7043      hyphenated correctly if the `hcode' request is used to give the
7044      glyph's symbol a hyphenation code.
7045
7046      There is a special anti-recursion feature: Use of `g' within the
7047      glyph's definition is handled like normal characters and symbols
7048      not defined with `char'.
7049
7050      Note that the `tr' and `trin' requests take precedence if `char'
7051      accesses the same symbol.
7052
7053
7054           .tr XY
7055           X
7056               => Y
7057           .char X Z
7058           X
7059               => Y
7060           .tr XX
7061           X
7062               => Z
7063
7064      The `fchar' request defines a fallback glyph: `gtroff' only checks
7065      for glyphs defined with `fchar' if it cannot find the glyph in the
7066      current font.  `gtroff' carries out this test before checking
7067      special fonts.
7068
7069      `fschar' defines a fallback glyph for font F: `gtroff' checks for
7070      glyphs defined with `fschar' after the list of fonts declared as
7071      font-specific special fonts with the `fspecial' request, but
7072      before the list of fonts declared as global special fonts with the
7073      `special' request.
7074
7075      Finally, the `schar' request defines a global fallback glyph:
7076      `gtroff' checks for glyphs defined with `schar' after the list of
7077      fonts declared as global special fonts with the `special' request,
7078      but before the already mounted special fonts.
7079
7080      *Note Using Symbols::, for a detailed description of the glyph
7081      searching mechanism in `gtroff'.
7082
7083  -- Request: .rchar c1 c2 ...
7084  -- Request: .rfschar f c1 c2 ...
7085      Remove the definitions of glyphs C1, C2, ....  This undoes the
7086      effect of a `char', `fchar', or `schar' request.
7087
7088      It is possible to omit the whitespace between arguments.
7089
7090      The request `rfschar' removes glyph definitions defined with
7091      `fschar' for glyph f.
7092
7093    *Note Special Characters::.
7094
7095 \1f
7096 File: groff,  Node: Using Symbols-Footnotes,  Up: Using Symbols
7097
7098    (1) Note that a one-character symbol is not the same as an input
7099 character, i.e., the character `a' is not the same as `\[a]'.  By
7100 default, `groff' defines only a single one-character symbol, `\[-]'; it
7101 is usually accessed as `\-'.  On the other hand, `gtroff' has the
7102 special feature that `\[charXXX]' is the same as the input character
7103 with character code XXX.  For example, `\[char97]' is identical to the
7104 letter `a' if ASCII encoding is active.
7105
7106    (2) `\C' is actually a misnomer since it accesses an output glyph.
7107
7108    (3) Note that the output glyphs themselves don't have such
7109 properties.  For `gtroff', a glyph is a numbered box with a given
7110 width, depth, and height, nothing else.  All manipulations with the
7111 `cflags' request work on the input level.
7112
7113    (4) `char' is a misnomer since an output glyph is defined.
7114
7115 \1f
7116 File: groff,  Node: Special Fonts,  Next: Artificial Fonts,  Prev: Using Symbols,  Up: Fonts and Symbols
7117
7118 5.17.5 Special Fonts
7119 --------------------
7120
7121 Special fonts are those that `gtroff' searches when it cannot find the
7122 requested glyph in the current font.  The Symbol font is usually a
7123 special font.
7124
7125    `gtroff' provides the following two requests to add more special
7126 fonts.  *Note Using Symbols::, for a detailed description of the glyph
7127 searching mechanism in `gtroff'.
7128
7129    Usually, only non-TTY devices have special fonts.
7130
7131  -- Request: .special [s1 s2 ...]
7132  -- Request: .fspecial f [s1 s2 ...]
7133      Use the `special' request to define special fonts.  Initially, this
7134      list is empty.
7135
7136      Use the `fspecial' request to designate special fonts only when
7137      font F is active.  Initially, this list is empty.
7138
7139      Previous calls to `special' or `fspecial' are overwritten; without
7140      arguments, the particular list of special fonts is set to empty.
7141      Special fonts are searched in the order they appear as arguments.
7142
7143      All fonts which appear in a call to `special' or `fspecial' are
7144      loaded.
7145
7146      *Note Using Symbols::, for the exact search order of glyphs.
7147
7148 \1f
7149 File: groff,  Node: Artificial Fonts,  Next: Ligatures and Kerning,  Prev: Special Fonts,  Up: Fonts and Symbols
7150
7151 5.17.6 Artificial Fonts
7152 -----------------------
7153
7154 There are a number of requests and escapes for artificially creating
7155 fonts.  These are largely vestiges of the days when output devices did
7156 not have a wide variety of fonts, and when `nroff' and `troff' were
7157 separate programs.  Most of them are no longer necessary in GNU
7158 `troff'.  Nevertheless, they are supported.
7159
7160  -- Escape: \H'height'
7161  -- Escape: \H'+height'
7162  -- Escape: \H'-height'
7163  -- Register: \n[.height]
7164      Change (increment, decrement) the height of the current font, but
7165      not the width.  If HEIGHT is zero, restore the original height.
7166      Default scaling indicator is `z'.
7167
7168      The read-only number register `.height' contains the font height as
7169      set by `\H'.
7170
7171      Currently, only the `-Tps' device supports this feature.
7172
7173      Note that `\H' doesn't produce an input token in `gtroff'.  As a
7174      consequence, it can be used in requests like `mc' (which expects a
7175      single character as an argument) to change the font on the fly:
7176
7177
7178           .mc \H'+5z'x\H'0'
7179
7180      In compatibility mode, `gtroff' behaves differently:  If an
7181      increment or decrement is used, it is always taken relative to the
7182      current point size and not relative to the previously selected font
7183      height.  Thus,
7184
7185
7186           .cp 1
7187           \H'+5'test \H'+5'test
7188
7189      prints the word `test' twice with the same font height (five
7190      points larger than the current font size).
7191
7192  -- Escape: \S'slant'
7193  -- Register: \n[.slant]
7194      Slant the current font by SLANT degrees.  Positive values slant to
7195      the right.  Only integer values are possible.
7196
7197      The read-only number register `.slant' contains the font slant as
7198      set by `\S'.
7199
7200      Currently, only the `-Tps' device supports this feature.
7201
7202      Note that `\S' doesn't produce an input token in `gtroff'.  As a
7203      consequence, it can be used in requests like `mc' (which expects a
7204      single character as an argument) to change the font on the fly:
7205
7206
7207           .mc \S'20'x\S'0'
7208
7209      This request is incorrectly documented in the original UNIX troff
7210      manual; the slant is always set to an absolute value.
7211
7212  -- Request: .ul [lines]
7213      The `ul' request normally underlines subsequent lines if a TTY
7214      output device is used.  Otherwise, the lines are printed in italics
7215      (only the term `underlined' is used in the following).  The single
7216      argument is the number of input lines to be underlined; with no
7217      argument, the next line is underlined.  If LINES is zero or
7218      negative, stop the effects of `ul' (if it was active).  Requests
7219      and empty lines do not count for computing the number of underlined
7220      input lines, even if they produce some output like `tl'.  Lines
7221      inserted by macros (e.g. invoked by a trap) do count.
7222
7223      At the beginning of `ul', the current font is stored and the
7224      underline font is activated.  Within the span of a `ul' request,
7225      it is possible to change fonts, but after the last line affected by
7226      `ul' the saved font is restored.
7227
7228      This number of lines still to be underlined is associated with the
7229      current environment (*note Environments::).  The underline font
7230      can be changed with the `uf' request.
7231
7232      The `ul' request does not underline spaces.
7233
7234  -- Request: .cu [lines]
7235      The `cu' request is similar to `ul' but underlines spaces as well
7236      (if a TTY output device is used).
7237
7238  -- Request: .uf font
7239      Set the underline font (globally) used by `ul' and `cu'.  By
7240      default, this is the font at position 2.  FONT can be either a
7241      non-negative font position or the name of a font.
7242
7243  -- Request: .bd font [offset]
7244  -- Request: .bd font1 font2 [offset]
7245  -- Register: \n[.b]
7246      Artificially create a bold font by printing each glyph twice,
7247      slightly offset.
7248
7249      Two syntax forms are available.
7250
7251         * Imitate a bold font unconditionally.  The first argument
7252           specifies the font to embolden, and the second is the number
7253           of basic units, minus one, by which the two glyphs are
7254           offset.  If the second argument is missing, emboldening is
7255           turned off.
7256
7257           FONT can be either a non-negative font position or the name
7258           of a font.
7259
7260           OFFSET is available in the `.b' read-only register if a
7261           special font is active; in the `bd' request, its default unit
7262           is `u'.
7263
7264         * Imitate a bold form conditionally.  Embolden FONT1 by OFFSET
7265           only if font FONT2 is the current font.  This command can be
7266           issued repeatedly to set up different emboldening values for
7267           different current fonts.  If the second argument is missing,
7268           emboldening is turned off for this particular current font.
7269
7270           This affects special fonts only (either set up with the
7271           `special' command in font files or with the `fspecial'
7272           request).
7273
7274  -- Request: .cs font [width [em-size]]
7275      Switch to and from "constant glyph space mode".  If activated, the
7276      width of every glyph is WIDTH/36 ems.  The em size is given
7277      absolutely by EM-SIZE; if this argument is missing, the em value
7278      is taken from the current font size (as set with the `ps' request)
7279      when the font is effectively in use.  Without second and third
7280      argument, constant glyph space mode is deactivated.
7281
7282      Default scaling indicator for EM-SIZE is `z'; WIDTH is an integer.
7283
7284 \1f
7285 File: groff,  Node: Ligatures and Kerning,  Prev: Artificial Fonts,  Up: Fonts and Symbols
7286
7287 5.17.7 Ligatures and Kerning
7288 ----------------------------
7289
7290 Ligatures are groups of characters that are run together, i.e, producing
7291 a single glyph.  For example, the letters `f' and `i' can form a
7292 ligature `fi' as in the word `file'.  This produces a cleaner look
7293 (albeit subtle) to the printed output.  Usually, ligatures are not
7294 available in fonts for TTY output devices.
7295
7296    Most POSTSCRIPT fonts support the fi and fl ligatures.  The C/A/T
7297 typesetter that was the target of AT&T `troff' also supported `ff',
7298 `ffi', and `ffl' ligatures.  Advanced typesetters or `expert' fonts may
7299 include ligatures for `ft' and `ct', although GNU `troff' does not
7300 support these (yet).
7301
7302    Only the current font is checked for ligatures and kerns; neither
7303 special fonts nor entities defined with the `char' request (and its
7304 siblings) are taken into account.
7305
7306  -- Request: .lg [flag]
7307  -- Register: \n[.lg]
7308      Switch the ligature mechanism on or off; if the parameter is
7309      non-zero or missing, ligatures are enabled, otherwise disabled.
7310      Default is on.  The current ligature mode can be found in the
7311      read-only number register `.lg' (set to 1 or 2 if ligatures are
7312      enabled, 0 otherwise).
7313
7314      Setting the ligature mode to 2 enables the two-character ligatures
7315      (fi, fl, and ff) and disables the three-character ligatures (ffi
7316      and ffl).
7317
7318    "Pairwise kerning" is another subtle typesetting mechanism that
7319 modifies the distance between a glyph pair to improve readability.  In
7320 most cases (but not always) the distance is decreased.  Typewriter-like
7321 fonts and fonts for terminals where all glyphs have the same width
7322 don't use kerning.
7323
7324  -- Request: .kern [flag]
7325  -- Register: \n[.kern]
7326      Switch kerning on or off.  If the parameter is non-zero or missing,
7327      enable pairwise kerning, otherwise disable it.  The read-only
7328      number register `.kern' is set to 1 if pairwise kerning is enabled,
7329      0 otherwise.
7330
7331      If the font description file contains pairwise kerning information,
7332      glyphs from that font are kerned.  Kerning between two glyphs can
7333      be inhibited by placing `\&' between them: `V\&A'.
7334
7335      *Note Font File Format::.
7336
7337    "Track kerning" expands or reduces the space between glyphs.  This
7338 can be handy, for example, if you need to squeeze a long word onto a
7339 single line or spread some text to fill a narrow column.  It must be
7340 used with great care since it is usually considered bad typography if
7341 the reader notices the effect.
7342
7343  -- Request: .tkf f s1 n1 s2 n2
7344      Enable track kerning for font F.  If the current font is F the
7345      width of every glyph is increased by an amount between N1 and N2
7346      (N1, N2 can be negative); if the current point size is less than
7347      or equal to S1 the width is increased by N1; if it is greater than
7348      or equal to S2 the width is increased by N2; if the point size is
7349      greater than or equal to S1 and less than or equal to S2 the
7350      increase in width is a linear function of the point size.
7351
7352      The default scaling indicator is `z' for S1 and S2, `p' for N1 and
7353      N2.
7354
7355      Note that the track kerning amount is added even to the rightmost
7356      glyph in a line; for large values it is thus recommended to
7357      increase the line length by the same amount to compensate it.
7358
7359    Sometimes, when typesetting letters of different fonts, more or less
7360 space at such boundaries are needed.  There are two escapes to help
7361 with this.
7362
7363  -- Escape: \/
7364      Increase the width of the preceding glyph so that the spacing
7365      between that glyph and the following glyph is correct if the
7366      following glyph is a roman glyph.  For example, if an italic `f'
7367      is immediately followed by a roman right parenthesis, then in many
7368      fonts the top right portion of the `f' overlaps the top left of
7369      the right parenthesis.  Use this escape sequence whenever an
7370      italic glyph is immediately followed by a roman glyph without any
7371      intervening space.  This small amount of space is also called
7372      "italic correction".
7373
7374
7375  -- Escape: \,
7376      Modify the spacing of the following glyph so that the spacing
7377      between that glyph and the preceding glyph is correct if the
7378      preceding glyph is a roman glyph.  Use this escape sequence
7379      whenever a roman glyph is immediately followed by an italic glyph
7380      without any intervening space.  In analogy to above, this space
7381      could be called "left italic correction", but this term isn't used
7382      widely.
7383
7384
7385  -- Escape: \&
7386      Insert a zero-width character, which is invisible.  Its intended
7387      use is to stop interaction of a character with its surrounding.
7388
7389         * It prevents the insertion of extra space after an
7390           end-of-sentence character.
7391
7392
7393                Test.
7394                Test.
7395                    => Test.  Test.
7396                Test.\&
7397                Test.
7398                    => Test. Test.
7399
7400         * It prevents interpretation of a control character at the
7401           beginning of an input line.
7402
7403
7404                .Test
7405                    => warning: `Test' not defined
7406                \&.Test
7407                    => .Test
7408
7409         * It prevents kerning between two glyphs.
7410
7411         * It is needed to map an arbitrary character to nothing in the
7412           `tr' request (*note Character Translations::).
7413
7414  -- Escape: \)
7415      This escape is similar to `\&' except that it behaves like a
7416      character declared with the `cflags' request to be transparent for
7417      the purposes of an end-of-sentence character.
7418
7419      Its main usage is in macro definitions to protect against arguments
7420      starting with a control character.
7421
7422
7423           .de xxx
7424           \)\\$1
7425           ..
7426           .de yyy
7427           \&\\$1
7428           ..
7429           This is a test.\c
7430           .xxx '
7431           This is a test.
7432               =>This is a test.'  This is a test.
7433           This is a test.\c
7434           .yyy '
7435           This is a test.
7436               =>This is a test.' This is a test.
7437
7438
7439 \1f
7440 File: groff,  Node: Sizes,  Next: Strings,  Prev: Fonts and Symbols,  Up: gtroff Reference
7441
7442 5.18 Sizes
7443 ==========
7444
7445 `gtroff' uses two dimensions with each line of text, type size and
7446 vertical spacing.  The "type size" is approximately the height of the
7447 tallest glyph.(1) (*note Sizes-Footnote-1::)  "Vertical spacing" is the
7448 amount of space `gtroff' allows for a line of text; normally, this is
7449 about 20% larger than the current type size.  Ratios smaller than this
7450 can result in hard-to-read text; larger than this, it spreads the text
7451 out more vertically (useful for term papers).  By default, `gtroff'
7452 uses 10 point type on 12 point spacing.
7453
7454    The difference between type size and vertical spacing is known, by
7455 typesetters, as "leading" (this is pronounced `ledding').
7456
7457 * Menu:
7458
7459 * Changing Type Sizes::
7460 * Fractional Type Sizes::
7461
7462 \1f
7463 File: groff,  Node: Sizes-Footnotes,  Up: Sizes
7464
7465    (1) This is usually the parenthesis.  Note that in most cases the
7466 real dimensions of the glyphs in a font are _not_ related to its type
7467 size!  For example, the standard POSTSCRIPT font families `Times
7468 Roman', `Helvetica', and `Courier' can't be used together at 10pt; to
7469 get acceptable output, the size of `Helvetica' has to be reduced by one
7470 point, and the size of `Courier' must be increased by one point.
7471
7472 \1f
7473 File: groff,  Node: Changing Type Sizes,  Next: Fractional Type Sizes,  Prev: Sizes,  Up: Sizes
7474
7475 5.18.1 Changing Type Sizes
7476 --------------------------
7477
7478  -- Request: .ps [size]
7479  -- Request: .ps +size
7480  -- Request: .ps -size
7481  -- Escape: \ssize
7482  -- Register: \n[.s]
7483      Use the `ps' request or the `\s' escape to change (increase,
7484      decrease) the type size (in points).  Specify SIZE as either an
7485      absolute point size, or as a relative change from the current size.
7486      The size 0, or no argument, goes back to the previous size.
7487
7488      Default scaling indicator of `size' is `z'.  If `size' is zero or
7489      negative, it is set to 1u.
7490
7491      The read-only number register `.s' returns the point size in
7492      points as a decimal fraction.  This is a string.  To get the point
7493      size in scaled points, use the `.ps' register instead.
7494
7495      `.s' is associated with the current environment (*note
7496      Environments::).
7497
7498
7499           snap, snap,
7500           .ps +2
7501           grin, grin,
7502           .ps +2
7503           wink, wink, \s+2nudge, nudge,\s+8 say no more!
7504           .ps 10
7505
7506      The `\s' escape may be called in a variety of ways.  Much like
7507      other escapes there must be a way to determine where the argument
7508      ends and the text begins.  Any of the following forms are valid:
7509
7510     `\sN'
7511           Set the point size to N points.  N must be either 0 or in the
7512           range 4 to 39.
7513
7514     `\s+N'
7515     `\s-N'
7516           Increase or decrease the point size by N points.  N must be
7517           exactly one digit.
7518
7519     `\s(NN'
7520           Set the point size to NN points.  NN must be exactly two
7521           digits.
7522
7523     `\s+(NN'
7524     `\s-(NN'
7525     `\s(+NN'
7526     `\s(-NN'
7527           Increase or decrease the point size by NN points.  NN must be
7528           exactly two digits.
7529
7530      Note that `\s' doesn't produce an input token in `gtroff'.  As a
7531      consequence, it can be used in requests like `mc' (which expects a
7532      single character as an argument) to change the font on the fly:
7533
7534
7535           .mc \s[20]x\s[0]
7536
7537      *Note Fractional Type Sizes::, for yet another syntactical form of
7538      using the `\s' escape.
7539
7540  -- Request: .sizes s1 s2 ... sn [0]
7541      Some devices may only have certain permissible sizes, in which case
7542      `gtroff' rounds to the nearest permissible size.  The `DESC' file
7543      specifies which sizes are permissible for the device.
7544
7545      Use the `sizes' request to change the permissible sizes for the
7546      current output device.  Arguments are in scaled points; the
7547      `sizescale' line in the `DESC' file for the output device provides
7548      the scaling factor.  For example, if the scaling factor is 1000,
7549      then the value 12000 is 12 points.
7550
7551      Each argument can be a single point size (such as `12000'), or a
7552      range of sizes (such as `4000-72000').  You can optionally end the
7553      list with a zero.
7554
7555  -- Request: .vs [space]
7556  -- Request: .vs +space
7557  -- Request: .vs -space
7558  -- Register: \n[.v]
7559      Change (increase, decrease) the vertical spacing by SPACE.  The
7560      default scaling indicator is `p'.
7561
7562      If `vs' is called without an argument, the vertical spacing is
7563      reset to the previous value before the last call to `vs'.
7564
7565      `gtroff' creates a warning of type `range' if SPACE is negative;
7566      the vertical spacing is then set to smallest positive value, the
7567      vertical resolution (as given in the `.V' register).
7568
7569      Note that `.vs 0' isn't saved in a diversion since it doesn't
7570      result in a vertical motion.  You explicitly have to repeat this
7571      command before inserting the diversion.
7572
7573      The read-only number register `.v' contains the current vertical
7574      spacing; it is associated with the current environment (*note
7575      Environments::).
7576
7577    The effective vertical line spacing consists of four components.
7578 Breaking a line causes the following actions (in the given order).
7579
7580    * Move the current point vertically by the "extra pre-vertical line
7581      space".  This is the minimum value of all `\x' escapes with a
7582      negative argument in the current output line.
7583
7584    * Move the current point vertically by the vertical line spacing as
7585      set with the `vs' request.
7586
7587    * Output the current line.
7588
7589    * Move the current point vertically by the "extra post-vertical line
7590      space".  This is the maximum value of all `\x' escapes with a
7591      positive argument in the line which has just been output.
7592
7593    * Move the current point vertically by the "post-vertical line
7594      spacing" as set with the `pvs' request.
7595
7596    It is usually better to use `vs' or `pvs' instead of `ls' to produce
7597 double-spaced documents: `vs' and `pvs' have a finer granularity for
7598 the inserted vertical space compared to `ls'; furthermore, certain
7599 preprocessors assume single-spacing.
7600
7601    *Note Manipulating Spacing::, for more details on the `\x' escape
7602 and the `ls' request.
7603
7604  -- Request: .pvs [space]
7605  -- Request: .pvs +space
7606  -- Request: .pvs -space
7607  -- Register: \n[.pvs]
7608      Change (increase, decrease) the post-vertical spacing by SPACE.
7609      The default scaling indicator is `p'.
7610
7611      If `pvs' is called without an argument, the post-vertical spacing
7612      is reset to the previous value before the last call to `pvs'.
7613
7614      `gtroff' creates a warning of type `range' if SPACE is zero or
7615      negative; the vertical spacing is then set to zero.
7616
7617      The read-only number register `.pvs' contains the current
7618      post-vertical spacing; it is associated with the current
7619      environment (*note Environments::).
7620
7621 \1f
7622 File: groff,  Node: Fractional Type Sizes,  Prev: Changing Type Sizes,  Up: Sizes
7623
7624 5.18.2 Fractional Type Sizes
7625 ----------------------------
7626
7627 A "scaled point" is equal to 1/SIZESCALE points, where SIZESCALE is
7628 specified in the `DESC' file (1 by default).  There is a new scale
7629 indicator `z' which has the effect of multiplying by SIZESCALE.
7630 Requests and escape sequences in `gtroff' interpret arguments that
7631 represent a point size as being in units of scaled points, but they
7632 evaluate each such argument using a default scale indicator of `z'.
7633 Arguments treated in this way are the argument to the `ps' request, the
7634 third argument to the `cs' request, the second and fourth arguments to
7635 the `tkf' request, the argument to the `\H' escape sequence, and those
7636 variants of the `\s' escape sequence that take a numeric expression as
7637 their argument (see below).
7638
7639    For example, suppose SIZESCALE is 1000; then a scaled point is
7640 equivalent to a millipoint; the request `.ps 10.25' is equivalent to
7641 `.ps 10.25z' and thus sets the point size to 10250 scaled points, which
7642 is equal to 10.25 points.
7643
7644    `gtroff' disallows the use of the `z' scale indicator in instances
7645 where it would make no sense, such as a numeric expression whose
7646 default scale indicator was neither `u' nor `z'.  Similarly it would
7647 make no sense to use a scaling indicator other than `z' or `u' in a
7648 numeric expression whose default scale indicator was `z', and so
7649 `gtroff' disallows this as well.
7650
7651    There is also new scale indicator `s' which multiplies by the number
7652 of units in a scaled point.  So, for example, `\n[.ps]s' is equal to
7653 `1m'.  Be sure not to confuse the `s' and `z' scale indicators.
7654
7655  -- Register: \n[.ps]
7656      A read-only number register returning the point size in scaled
7657      points.
7658
7659      `.ps' is associated with the current environment (*note
7660      Environments::).
7661
7662  -- Register: \n[.psr]
7663  -- Register: \n[.sr]
7664      The last-requested point size in scaled points is contained in the
7665      `.psr' read-only number register.  The last requested point size
7666      in points as a decimal fraction can be found in `.sr'.  This is a
7667      string-valued read-only number register.
7668
7669      Note that the requested point sizes are device-independent, whereas
7670      the values returned by the `.ps' and `.s' registers are not.  For
7671      example, if a point size of 11pt is requested, and a `sizes'
7672      request (or a `sizescale' line in a `DESC' file) specifies 10.95pt
7673      instead, this value is actually used.
7674
7675      Both registers are associated with the current environment (*note
7676      Environments::).
7677
7678    The `\s' escape has the following syntax for working with fractional
7679 type sizes:
7680
7681 `\s[N]'
7682 `\s'N''
7683      Set the point size to N scaled points; N is a numeric expression
7684      with a default scale indicator of `z'.
7685
7686 `\s[+N]'
7687 `\s[-N]'
7688 `\s+[N]'
7689 `\s-[N]'
7690 `\s'+N''
7691 `\s'-N''
7692 `\s+'N''
7693 `\s-'N''
7694      Increase or or decrease the point size by N scaled points; N is a
7695      numeric expression with a default scale indicator of `z'.
7696
7697    *Note Font Files::.
7698
7699 \1f
7700 File: groff,  Node: Strings,  Next: Conditionals and Loops,  Prev: Sizes,  Up: gtroff Reference
7701
7702 5.19 Strings
7703 ============
7704
7705 `gtroff' has string variables, which are entirely for user convenience
7706 (i.e. there are no built-in strings exept `.T', but even this is a
7707 read-write string variable).
7708
7709  -- Request: .ds name [string]
7710  -- Request: .ds1 name [string]
7711  -- Escape: \*n
7712  -- Escape: \*(nm
7713  -- Escape: \*[name arg1 arg2 ...]
7714      Define and access a string variable NAME (one-character name N,
7715      two-character name NM).  If NAME already exists, `ds' overwrites
7716      the previous definition.  Only the syntax form using brackets can
7717      take arguments which are handled identically to macro arguments;
7718      the single exception is that a closing bracket as an argument must
7719      be enclosed in double quotes.  *Note Request and Macro
7720      Arguments::, and *Note Parameters::.
7721
7722      Example:
7723
7724
7725           .ds foo a \\$1 test
7726           .
7727           This is \*[foo nice].
7728               => This is a nice test.
7729
7730      The `\*' escape "interpolates" (expands in-place) a
7731      previously-defined string variable.  To be more precise, the stored
7732      string is pushed onto the input stack which is then parsed by
7733      `gtroff'.  Similar to number registers, it is possible to nest
7734      strings, i.e. string variables can be called within string
7735      variables.
7736
7737      If the string named by the `\*' escape does not exist, it is
7738      defined as empty, and a warning of type `mac' is emitted (see
7739      *Note Debugging::, for more details).
7740
7741      *Caution:* Unlike other requests, the second argument to the `ds'
7742      request takes up the entire line including trailing spaces.  This
7743      means that comments on a line with such a request can introduce
7744      unwanted space into a string.
7745
7746
7747           .ds UX \s-1UNIX\s0\u\s-3tm\s0\d \" UNIX trademark
7748
7749      Instead the comment should be put on another line or have the
7750      comment escape adjacent with the end of the string.
7751
7752
7753           .ds UX \s-1UNIX\s0\u\s-3tm\s0\d\"  UNIX trademark
7754
7755      To produce leading space the string can be started with a double
7756      quote.  No trailing quote is needed; in fact, any trailing quote is
7757      included in your string.
7758
7759
7760           .ds sign "           Yours in a white wine sauce,
7761
7762      Strings are not limited to a single line of text.  A string can
7763      span several lines by escaping the newlines with a backslash.  The
7764      resulting string is stored _without_ the newlines.
7765
7766
7767           .ds foo lots and lots \
7768           of text are on these \
7769           next several lines
7770
7771      It is not possible to have real newlines in a string.  To put a
7772      single double quote character into a string, use two consecutive
7773      double quote characters.
7774
7775      The `ds1' request turns off compatibility mode while interpreting
7776      a string.  To be more precise, a "compatibility save" input token
7777      is inserted at the beginning of  the string, and a "compatibility
7778      restore" input token at the end.
7779
7780
7781           .nr xxx 12345
7782           .ds aa The value of xxx is \\n[xxx].
7783           .ds1 bb The value of xxx ix \\n[xxx].
7784           .
7785           .cp 1
7786           .
7787           \*(aa
7788               => warning: number register `[' not defined
7789               => The value of xxx is 0xxx].
7790           \*(bb
7791               => The value of xxx ix 12345.
7792
7793      Strings, macros, and diversions (and boxes) share the same name
7794      space.  Internally, even the same mechanism is used to store them.
7795      This has some interesting consequences.  For example, it is
7796      possible to call a macro with string syntax and vice versa.
7797
7798
7799           .de xxx
7800           a funny test.
7801           ..
7802           This is \*[xxx]
7803               => This is a funny test.
7804
7805           .ds yyy a funny test
7806           This is
7807           .yyy
7808               => This is a funny test.
7809
7810      Diversions and boxes can be also called with string syntax.
7811
7812      Another consequence is that you can copy one-line diversions or
7813      boxes to a string.
7814
7815
7816           .di xxx
7817           a \fItest\fR
7818           .br
7819           .di
7820           .ds yyy This is \*[xxx]\c
7821           \*[yyy].
7822               => This is a test.
7823
7824      As the previous example shows, it is possible to store formatted
7825      output in strings.  The `\c' escape prevents the insertion of an
7826      additional blank line in the output.
7827
7828      Copying diversions longer than a single output line produces
7829      unexpected results.
7830
7831
7832           .di xxx
7833           a funny
7834           .br
7835           test
7836           .br
7837           .di
7838           .ds yyy This is \*[xxx]\c
7839           \*[yyy].
7840               => test This is a funny.
7841
7842      Usually, it is not predictable whether a diversion contains one or
7843      more output lines, so this mechanism should be avoided.  With UNIX
7844      `troff', this was the only solution to strip off a final newline
7845      from a diversion.  Another disadvantage is that the spaces in the
7846      copied string are already formatted, making them unstretchable.
7847      This can cause ugly results.
7848
7849      A clean solution to this problem is available in GNU `troff',
7850      using the requests `chop' to remove the final newline of a
7851      diversion, and `unformat' to make the horizontal spaces
7852      stretchable again.
7853
7854
7855           .box xxx
7856           a funny
7857           .br
7858           test
7859           .br
7860           .box
7861           .chop xxx
7862           .unformat xxx
7863           This is \*[xxx].
7864               => This is a funny test.
7865
7866      *Note Gtroff Internals::, for more information.
7867
7868  -- Request: .as name [string]
7869  -- Request: .as1 name [string]
7870      The `as' request is similar to `ds' but appends STRING to the
7871      string stored as NAME instead of redefining it.  If NAME doesn't
7872      exist yet, it is created.
7873
7874
7875           .as sign " with shallots, onions and garlic,
7876
7877      The `as1' request is similar to `as', but compatibility mode is
7878      switched off while the appended string is interpreted.  To be more
7879      precise, a "compatibility save" input token is inserted at the
7880      beginning of the appended string, and a "compatibility restore"
7881      input token at the end.
7882
7883    Rudimentary string manipulation routines are given with the next two
7884 requests.
7885
7886  -- Request: .substring str n1 [n2]
7887      Replace the string named STR with the substring defined by the
7888      indices N1 and N2.  The first character in the string has index 0.
7889      If N2 is omitted, it is taken to be equal to the string's length.
7890      If the index value N1 or N2 is negative, it is counted from the
7891      end of the string, going backwards: The last character has
7892      index -1, the character before the last character has index -2,
7893      etc.
7894
7895
7896           .ds xxx abcdefgh
7897           .substring xxx 1 -4
7898           \*[xxx]
7899               => bcde
7900
7901
7902  -- Request: .length reg str
7903      Compute the number of characters of STR and return it in the
7904      number register REG.  If REG doesn't exist, it is created.  `str'
7905      is read in copy mode.
7906
7907
7908           .ds xxx abcd\h'3i'efgh
7909           .length yyy \*[xxx]
7910           \n[yyy]
7911               => 14
7912
7913
7914  -- Request: .rn xx yy
7915      Rename the request, macro, diversion, or string XX to YY.
7916
7917  -- Request: .rm xx
7918      Remove the request, macro, diversion, or string XX.  `gtroff'
7919      treats subsequent invocations as if the object had never been
7920      defined.
7921
7922  -- Request: .als new old
7923      Create an alias named NEW for the request, string, macro, or
7924      diversion object named OLD.  The new name and the old name are
7925      exactly equivalent (it is similar to a hard rather than a soft
7926      link). If OLD is undefined, `gtroff' generates a warning of type
7927      `mac' and ignores the request.
7928
7929  -- Request: .chop xx
7930      Remove (chop) the last character from the macro, string, or
7931      diversion named XX.  This is useful for removing the newline from
7932      the end of diversions that are to be interpolated as strings.
7933      This command can be used repeatedly; see *Note Gtroff Internals::,
7934      for details on nodes inserted additionally by `gtroff'.
7935
7936    *Note Identifiers::, and *Note Comments::.
7937
7938 \1f
7939 File: groff,  Node: Conditionals and Loops,  Next: Writing Macros,  Prev: Strings,  Up: gtroff Reference
7940
7941 5.20 Conditionals and Loops
7942 ===========================
7943
7944 * Menu:
7945
7946 * Operators in Conditionals::
7947 * if-else::
7948 * while::
7949
7950 \1f
7951 File: groff,  Node: Operators in Conditionals,  Next: if-else,  Prev: Conditionals and Loops,  Up: Conditionals and Loops
7952
7953 5.20.1 Operators in Conditionals
7954 --------------------------------
7955
7956 In `if' and `while' requests, there are several more operators
7957 available:
7958
7959 `e'
7960 `o'
7961      True if the current page is even or odd numbered (respectively).
7962
7963 `n'
7964      True if the document is being processed in nroff mode (i.e., the
7965      `.nroff' command has been issued).
7966
7967 `t'
7968      True if the document is being processed in troff mode (i.e., the
7969      `.troff' command has been issued).
7970
7971 `v'
7972      Always false.  This condition is for compatibility with other
7973      `troff' versions only (identifying a `-Tversatec' device).
7974
7975 `'XXX'YYY''
7976      True if the string XXX is equal to the string YYY.  Other
7977      characters can be used in place of the single quotes; the same set
7978      of delimiters as for the `\D' escape is used (*note Escapes::).
7979      `gtroff' formats the strings before being compared:
7980
7981
7982           .ie "|"\fR|\fP" \
7983           true
7984           .el \
7985           false
7986               => true
7987
7988      The resulting motions, glyph sizes, and fonts have to match,(1)
7989      (*note Operators in Conditionals-Footnote-1::) and not the
7990      individual motion, size, and font requests.  In the previous
7991      example, `|' and `\fR|\fP' both result in a roman `|' glyph with
7992      the same point size and at the same location on the page, so the
7993      strings are equal.  If `.ft I' had been added before the `.ie',
7994      the result would be "false" because (the first) `|' produces an
7995      italic `|' rather than a roman one.
7996
7997 `r XXX'
7998      True if there is a number register named XXX.
7999
8000 `d XXX'
8001      True if there is a string, macro, diversion, or request named XXX.
8002
8003 `m XXX'
8004      True if there is a color named XXX.
8005
8006 `c G'
8007      True if there is a glyph G available(2) (*note Operators in
8008      Conditionals-Footnote-2::); G is either an ASCII character or a
8009      special character (`\(GG' or `\[GGG]'); the condition is also true
8010      if G has been defined by the `char' request.
8011
8012 `F FONT'
8013      True if a font named FONT exists.  FONT is handled as if it was
8014      opened with the `ft' request (this is, font translation and styles
8015      are applied), without actually mounting it.
8016
8017      This test doesn't load the complete font but only its header to
8018      verify its validity.
8019
8020 `S STYLE'
8021      True if style STYLE has been registered.  Font translation is
8022      applied.
8023
8024    Note that these operators can't be combined with other operators like
8025 `:' or `&'; only a leading `!' (without whitespace between the
8026 exclamation mark and the operator) can be used to negate the result.
8027
8028
8029      .nr xxx 1
8030      .ie !r xxx \
8031      true
8032      .el \
8033      false
8034          => false
8035
8036    A whitespace after `!' always evaluates to zero (this bizarre
8037 behaviour is due to compatibility with UNIX `troff').
8038
8039
8040      .nr xxx 1
8041      .ie ! r xxx \
8042      true
8043      .el \
8044      false
8045          => r xxx true
8046
8047    It is possible to omit the whitespace before the argument to the
8048 `r', `d', and `c' operators.
8049
8050    *Note Expressions::.
8051
8052 \1f
8053 File: groff,  Node: Operators in Conditionals-Footnotes,  Up: Operators in Conditionals
8054
8055    (1) The created output nodes must be identical.  *Note Gtroff
8056 Internals::.
8057
8058    (2) The name of this conditional operator is a misnomer since it
8059 tests names of output glyphs.
8060
8061 \1f
8062 File: groff,  Node: if-else,  Next: while,  Prev: Operators in Conditionals,  Up: Conditionals and Loops
8063
8064 5.20.2 if-else
8065 --------------
8066
8067 `gtroff' has if-then-else constructs like other languages, although the
8068 formatting can be painful.
8069
8070  -- Request: .if expr anything
8071      Evaluate the expression EXPR, and executes ANYTHING (the remainder
8072      of the line) if EXPR evaluates to a value greater than zero
8073      (true).  ANYTHING is interpreted as though it was on a line by
8074      itself (except that leading spaces are swallowed).  *Note
8075      Expressions::, for more info.
8076
8077
8078           .nr xxx 1
8079           .nr yyy 2
8080           .if ((\n[xxx] == 1) & (\n[yyy] == 2)) true
8081               => true
8082
8083
8084  -- Request: .nop anything
8085      Executes ANYTHING.  This is similar to `.if 1'.
8086
8087  -- Request: .ie expr anything
8088  -- Request: .el anything
8089      Use the `ie' and `el' requests to write an if-then-else.  The
8090      first request is the `if' part and the latter is the `else' part.
8091
8092
8093           .ie n .ls 2 \" double-spacing in nroff
8094           .el   .ls 1 \" single-spacing in troff
8095
8096
8097  -- Escape: \{
8098  -- Escape: \}
8099      In many cases, an if (or if-else) construct needs to execute more
8100      than one request.  This can be done using the `\{' and `\}'
8101      escapes.  The following example shows the possible ways to use
8102      these escapes (note the position of the opening and closing
8103      braces).
8104
8105
8106           .ie t \{\
8107           .    ds lq ``
8108           .    ds rq ''
8109           .\}
8110           .el \
8111           .\{\
8112           .    ds lq "
8113           .    ds rq "\}
8114
8115
8116    *Note Expressions::.
8117
8118 \1f
8119 File: groff,  Node: while,  Prev: if-else,  Up: Conditionals and Loops
8120
8121 5.20.3 while
8122 ------------
8123
8124 `gtroff' provides a looping construct using the `while' request, which
8125 is used much like the `if' (and related) requests.
8126
8127  -- Request: .while expr anything
8128      Evaluate the expression EXPR, and repeatedly execute ANYTHING (the
8129      remainder of the line) until EXPR evaluates to 0.
8130
8131
8132           .nr a 0 1
8133           .while (\na < 9) \{\
8134           \n+a,
8135           .\}
8136           \n+a
8137               => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
8138
8139      Some remarks.
8140
8141         * The body of a `while' request is treated like the body of a
8142           `de' request: `gtroff' temporarily stores it in a macro which
8143           is deleted after the loop has been exited.  It can
8144           considerably slow down a macro if the body of the `while'
8145           request (within the macro) is large.  Each time the macro is
8146           executed, the `while' body is parsed and stored again as a
8147           temporary macro.
8148
8149
8150                .de xxx
8151                .  nr num 10
8152                .  while (\\n[num] > 0) \{\
8153                .    \" many lines of code
8154                .    nr num -1
8155                .  \}
8156                ..
8157
8158           The traditional and ofter better solution (UNIX `troff'
8159           doesn't have the `while' request) is to use a recursive macro
8160           instead which is parsed only once during its definition.
8161
8162
8163                .de yyy
8164                .  if (\\n[num] > 0) \{\
8165                .    \" many lines of code
8166                .    nr num -1
8167                .    yyy
8168                .  \}
8169                ..
8170                .
8171                .de xxx
8172                .  nr num 10
8173                .  yyy
8174                ..
8175
8176           Note that the number of available recursion levels is set
8177           to 1000 (this is a compile-time constant value of `gtroff').
8178
8179         * The closing brace of a `while' body must end a line.
8180
8181
8182                .if 1 \{\
8183                .  nr a 0 1
8184                .  while (\n[a] < 10) \{\
8185                .    nop \n+[a]
8186                .\}\}
8187                    => unbalanced \{ \}
8188
8189
8190  -- Request: .break
8191      Break out of a `while' loop.  Be sure not to confuse this with the
8192      `br' request (causing a line break).
8193
8194  -- Request: .continue
8195      Finish the current iteration of a `while' loop, immediately
8196      restarting the next iteration.
8197
8198    *Note Expressions::.
8199
8200 \1f
8201 File: groff,  Node: Writing Macros,  Next: Page Motions,  Prev: Conditionals and Loops,  Up: gtroff Reference
8202
8203 5.21 Writing Macros
8204 ===================
8205
8206 A "macro" is a collection of text and embedded commands which can be
8207 invoked multiple times.  Use macros to define common operations.
8208
8209  -- Request: .de name [end]
8210  -- Request: .de1 name [end]
8211  -- Request: .dei name [end]
8212  -- Request: .dei1 name [end]
8213      Define a new macro named NAME.  `gtroff' copies subsequent lines
8214      (starting with the next one) into an internal buffer until it
8215      encounters the line `..' (two dots).  The optional second argument
8216      to `de' changes this to a macro to `.END'.
8217
8218      There can be whitespace after the first dot in the line containing
8219      the ending token (either `.' or macro `END').
8220
8221      Here a small example macro called `P' which causes a break and
8222      inserts some vertical space.  It could be used to separate
8223      paragraphs.
8224
8225
8226           .de P
8227           .  br
8228           .  sp .8v
8229           ..
8230
8231      The following example defines a macro within another.  Remember
8232      that expansion must be protected twice; once for reading the macro
8233      and once for executing.
8234
8235
8236           \# a dummy macro to avoid a warning
8237           .de end
8238           ..
8239           .
8240           .de foo
8241           .  de bar end
8242           .    nop \f[B]Hallo \\\\$1!\f[]
8243           .  end
8244           ..
8245           .
8246           .foo
8247           .bar Joe
8248               => Hallo Joe!
8249
8250      Since `\f' has no expansion, it isn't necessary to protect its
8251      backslash.  Had we defined another macro within `bar' which takes
8252      a parameter, eight backslashes would be necessary before `$1'.
8253
8254      The `de1' request turns off compatibility mode while executing the
8255      macro.  On entry, the current compatibility mode is saved and
8256      restored at exit.
8257
8258
8259           .nr xxx 12345
8260           .
8261           .de aa
8262           The value of xxx is \\n[xxx].
8263           ..
8264           .de1 bb
8265           The value of xxx ix \\n[xxx].
8266           ..
8267           .
8268           .cp 1
8269           .
8270           .aa
8271               => warning: number register `[' not defined
8272               => The value of xxx is 0xxx].
8273           .bb
8274               => The value of xxx ix 12345.
8275
8276      The `dei' request defines a macro indirectly.  That is, it expands
8277      strings whose names are NAME or END before performing the append.
8278
8279      This:
8280
8281
8282           .ds xx aa
8283           .ds yy bb
8284           .dei xx yy
8285
8286      is equivalent to:
8287
8288
8289           .de aa bb
8290
8291      The `dei1' request is similar to `dei' but with compatibility mode
8292      switched off during execution of the defined macro.
8293
8294      If compatibility mode is on, `de' (and `dei') behave similar to
8295      `de1' (and `dei1'): A `compatibility save' token is inserted at
8296      the beginning, and a `compatibility restore' token at the end, with
8297      compatibility mode switched on during execution.  *Note Gtroff
8298      Internals::, for more information on switching compatibility mode
8299      on and off in a single document.
8300
8301      Using `trace.tmac', you can trace calls to `de' and `de1'.
8302
8303      Note that macro identifiers are shared with identifiers for
8304      strings and diversions.
8305
8306  -- Request: .am name [end]
8307  -- Request: .am1 name [end]
8308  -- Request: .ami name [end]
8309  -- Request: .ami1 name [end]
8310      Works similarly to `de' except it appends onto the macro named
8311      NAME.  So, to make the previously defined `P' macro actually do
8312      indented instead of block paragraphs, add the necessary code to the
8313      existing macro like this:
8314
8315
8316           .am P
8317           .ti +5n
8318           ..
8319
8320      The `am1' request turns off compatibility mode while executing the
8321      appended macro piece.  To be more precise, a "compatibility save"
8322      input token is inserted at the beginning of the appended code, and
8323      a "compatibility restore" input token at the end.
8324
8325      The `ami' request appends indirectly, meaning that `gtroff'
8326      expands strings whose names are NAME or END before performing the
8327      append.
8328
8329      The `ami1' request is similar to `ami' but compatibility mode is
8330      switched off during execution of the defined macro.
8331
8332      Using `trace.tmac', you can trace calls to `am' and `am1'.
8333
8334    *Note Strings::, for the `als' request to rename a macro.
8335
8336    The `de', `am', `di', `da', `ds', and `as' requests (together with
8337 its variants) only create a new object if the name of the macro,
8338 diversion or string diversion is currently undefined or if it is
8339 defined to be a request; normally they modify the value of an existing
8340 object.
8341
8342  -- Request: .return [anything]
8343      Exit a macro, immediately returning to the caller.
8344
8345      If called with an argument, exit twice, namely the current macro
8346      and the macro one level higher.  This is used to define a wrapper
8347      macro for `return' in `trace.tmac'.
8348
8349 * Menu:
8350
8351 * Copy-in Mode::
8352 * Parameters::
8353
8354 \1f
8355 File: groff,  Node: Copy-in Mode,  Next: Parameters,  Prev: Writing Macros,  Up: Writing Macros
8356
8357 5.21.1 Copy-in Mode
8358 -------------------
8359
8360 When `gtroff' reads in the text for a macro, string, or diversion, it
8361 copies the text (including request lines, but excluding escapes) into
8362 an internal buffer.  Escapes are converted into an internal form,
8363 except for `\n', `\$', `\*', `\\' and `\<RET>' which are evaluated and
8364 inserted into the text where the escape was located.  This is known as
8365 "copy-in" mode or "copy" mode.
8366
8367    What this means is that you can specify when these escapes are to be
8368 evaluated (either at copy-in time or at the time of use) by insulating
8369 the escapes with an extra backslash.  Compare this to the `\def' and
8370 `\edef' commands in TeX.
8371
8372    The following example prints the numbers 20 and 10:
8373
8374
8375      .nr x 20
8376      .de y
8377      .nr x 10
8378      \&\nx
8379      \&\\nx
8380      ..
8381      .y
8382
8383 \1f
8384 File: groff,  Node: Parameters,  Prev: Copy-in Mode,  Up: Writing Macros
8385
8386 5.21.2 Parameters
8387 -----------------
8388
8389 The arguments to a macro or string can be examined using a variety of
8390 escapes.
8391
8392  -- Register: \n[.$]
8393      The number of arguments passed to a macro or string.  This is a
8394      read-only number register.
8395
8396      Note that the `shift' request can change its value.
8397
8398    Any individual argument can be retrieved with one of the following
8399 escapes:
8400
8401  -- Escape: \$n
8402  -- Escape: \$(nn
8403  -- Escape: \$[nnn]
8404      Retrieve the Nth, NNth or NNNth argument.  As usual, the first
8405      form only accepts a single number (larger than zero), the second a
8406      two-digit number (larger or equal to 10), and the third any
8407      positive integer value (larger than zero).  Macros and strings can
8408      have an unlimited number of arguments.  Note that due to copy-in
8409      mode, use two backslashes on these in actual use to prevent
8410      interpolation until the macro is actually invoked.
8411
8412  -- Request: .shift [n]
8413      Shift the arguments 1 position, or as many positions as specified
8414      by its argument.  After executing this request, argument I becomes
8415      argument I-N; arguments 1 to N are no longer available.  Shifting
8416      by negative amounts is currently undefined.
8417
8418      The register `.$' is adjusted accordingly.
8419
8420  -- Escape: \$*
8421  -- Escape: \$@
8422      In some cases it is convenient to use all of the arguments at once
8423      (for example, to pass the arguments along to another macro).  The
8424      `\$*' escape concatenates all the arguments separated by spaces.  A
8425      similar escape is `\$@', which concatenates all the arguments with
8426      each surrounded by double quotes, and separated by spaces.  If not
8427      in compatibility mode, the input level of double quotes is
8428      preserved (see *Note Request and Macro Arguments::).
8429
8430  -- Escape: \$0
8431      The name used to invoke the current macro.  The `als' request can
8432      make a macro have more than one name.
8433
8434
8435           .de generic-macro
8436           .  ...
8437           .  if \\n[error] \{\
8438           .    tm \\$0: Houston, we have a problem.
8439           .    return
8440           .  \}
8441           ..
8442           .
8443           .als foo generic-macro
8444           .als bar generic-macro
8445
8446
8447    *Note Request and Macro Arguments::.
8448
8449 \1f
8450 File: groff,  Node: Page Motions,  Next: Drawing Requests,  Prev: Writing Macros,  Up: gtroff Reference
8451
8452 5.22 Page Motions
8453 =================
8454
8455 *Note Manipulating Spacing::, for a discussion of the main request for
8456 vertical motion, `sp'.
8457
8458  -- Request: .mk [reg]
8459  -- Request: .rt [dist]
8460      The request `mk' can be used to mark a location on a page, for
8461      movement to later.  This request takes a register name as an
8462      argument in which to store the current page location.  With no
8463      argument it stores the location in an internal register.  The
8464      results of this can be used later by the `rt' or the `sp' request
8465      (or the `\v' escape).
8466
8467      The `rt' request returns _upwards_ to the location marked with the
8468      last `mk' request.  If used with an argument, return to a position
8469      which distance from the top of the page is DIST (no previous call
8470      to `mk' is necessary in this case).  Default scaling indicator is
8471      `v'.
8472
8473      Here a primitive solution for a two-column macro.
8474
8475
8476           .nr column-length 1.5i
8477           .nr column-gap 4m
8478           .nr bottom-margin 1m
8479           .
8480
8481
8482           .de 2c
8483           .  br
8484           .  mk
8485           .  ll \\n[column-length]u
8486           .  wh -\\n[bottom-margin]u 2c-trap
8487           .  nr right-side 0
8488           ..
8489           .
8490
8491
8492           .de 2c-trap
8493           .  ie \\n[right-side] \{\
8494           .    nr right-side 0
8495           .    po -(\\n[column-length]u + \\n[column-gap]u)
8496           .    \" remove trap
8497           .    wh -\\n[bottom-margin]u
8498           .  \}
8499           .  el \{\
8500           .    \" switch to right side
8501           .    nr right-side 1
8502           .    po +(\\n[column-length]u + \\n[column-gap]u)
8503           .    rt
8504           .  \}
8505           ..
8506           .
8507
8508
8509           .pl 1.5i
8510           .ll 4i
8511           This is a small test which shows how the
8512           rt request works in combination with mk.
8513
8514           .2c
8515           Starting here, text is typeset in two columns.
8516           Note that this implementation isn't robust
8517           and thus not suited for a real two-column
8518           macro.
8519
8520      Result:
8521
8522
8523           This is a small test which shows how the
8524           rt request works in combination with mk.
8525
8526           Starting  here,    isn't    robust
8527           text is typeset    and   thus  not
8528           in two columns.    suited  for   a
8529           Note that  this    real two-column
8530           implementation     macro.
8531
8532
8533    The following escapes give fine control of movements about the page.
8534
8535  -- Escape: \v'e'
8536      Move vertically, usually from the current location on the page (if
8537      no absolute position operator `|' is used).  The argument E
8538      specifies the distance to move; positive is downwards and negative
8539      upwards.  The default scaling indicator for this escape is `v'.
8540      Beware, however, that `gtroff' continues text processing at the
8541      point where the motion ends, so you should always balance motions
8542      to avoid interference with text processing.
8543
8544      `\v' doesn't trigger a trap.  This can be quite useful; for
8545      example, consider a page bottom trap macro which prints a marker
8546      in the margin to indicate continuation of a footnote or something
8547      similar.
8548
8549    There are some special-case escapes for vertical motion.
8550
8551  -- Escape: \r
8552      Move upwards 1v.
8553
8554  -- Escape: \u
8555      Move upwards .5v.
8556
8557  -- Escape: \d
8558      Move down .5v.
8559
8560  -- Escape: \h'e'
8561      Move horizontally, usually from the current location (if no
8562      absolute position operator `|' is used).  The expression E
8563      indicates how far to move: positive is rightwards and negative
8564      leftwards.  The default scaling indicator for this escape is `m'.
8565
8566      This horizontal space is not discarded at the end of a line.  To
8567      insert discardable space of a certain length use the `ss' request.
8568
8569    There are a number of special-case escapes for horizontal motion.
8570
8571  -- Escape: \<SP>
8572      An unbreakable and unpaddable (i.e. not expanded during filling)
8573      space.  (Note: This is a backslash followed by a space.)
8574
8575  -- Escape: \~
8576      An unbreakable space that stretches like a normal inter-word space
8577      when a line is adjusted.
8578
8579  -- Escape: \|
8580      A 1/6th em space.  Ignored for TTY output devices (rounded to
8581      zero).
8582
8583  -- Escape: \^
8584      A 1/12th em space.  Ignored for TTY output devices (rounded to
8585      zero).
8586
8587  -- Escape: \0
8588      A space the size of a digit.
8589
8590    The following string sets the TeX logo:
8591
8592
8593      .ds TeX T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
8594
8595  -- Escape: \w'text'
8596  -- Register: \n[st]
8597  -- Register: \n[sb]
8598  -- Register: \n[rst]
8599  -- Register: \n[rsb]
8600  -- Register: \n[ct]
8601  -- Register: \n[ssc]
8602  -- Register: \n[skw]
8603      Return the width of the specified TEXT in basic units.  This
8604      allows horizontal movement based on the width of some arbitrary
8605      text (e.g. given as an argument to a macro).
8606
8607
8608           The length of the string `abc' is \w'abc'u.
8609               => The length of the string `abc' is 72u.
8610
8611      Font changes may occur in TEXT which don't affect current settings.
8612
8613      After use, `\w' sets several registers:
8614
8615     `st'
8616     `sb'
8617           The highest and lowest point of the baseline, respectively,
8618           in TEXT.
8619
8620     `rst'
8621     `rsb'
8622           Like the `st' and `sb' registers, but takes account of the
8623           heights and depths of glyphs.  With other words, this gives
8624           the highest and lowest point of TEXT.  Values below the
8625           baseline are negative.
8626
8627     `ct'
8628           Defines the kinds of glyphs occurring in TEXT:
8629
8630          0
8631                only short glyphs, no descenders or tall glyphs.
8632
8633          1
8634                at least one descender.
8635
8636          2
8637                at least one tall glyph.
8638
8639          3
8640                at least one each of a descender and a tall glyph.
8641
8642     `ssc'
8643           The amount of horizontal space (possibly negative) that
8644           should be added to the last glyph before a subscript.
8645
8646     `skw'
8647           How far to right of the center of the last glyph in the `\w'
8648           argument, the center of an accent from a roman font should be
8649           placed over that glyph.
8650
8651  -- Escape: \kp
8652  -- Escape: \k(ps
8653  -- Escape: \k[position]
8654      Store the current horizontal position in the _input_ line in
8655      number register with name POSITION (one-character name P,
8656      two-character name PS).  Use this, for example, to return to the
8657      beginning of a string for highlighting or other decoration.
8658
8659  -- Register: \n[hp]
8660      The current horizontal position at the input line.
8661
8662  -- Register: \n[.k]
8663      A read-only number register containing the current horizontal
8664      output position (relative to the current indentation).
8665
8666  -- Escape: \o'abc'
8667      Overstrike glyphs A, B, C, ...; the glyphs are centered, and the
8668      resulting spacing is the largest width of the affected glyphs.
8669
8670  -- Escape: \zg
8671      Print glyph G with zero width, i.e., without spacing.  Use this to
8672      overstrike glyphs left-aligned.
8673
8674  -- Escape: \Z'anything'
8675      Print ANYTHING, then restore the horizontal and vertical position.
8676      The argument may not contain tabs or leaders.
8677
8678      The following is an example of a strike-through macro:
8679
8680
8681           .de ST
8682           .nr ww \w'\\$1'
8683           \Z@\v'-.25m'\l'\\n[ww]u'@\\$1
8684           ..
8685           .
8686           This is
8687           .ST "a test"
8688           an actual emergency!
8689
8690
8691
8692 \1f
8693 Local Variables:
8694 coding: iso-8859-1
8695 End: