1 This is groff, produced by makeinfo version 4.8 from ./groff.texinfo.
3 This manual documents GNU `troff' version 1.19.2.
5 Copyright (C) 1994-2000, 2001, 2002, 2003, 2004, 2005 Free Software
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."
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."
20 INFO-DIR-SECTION Typesetting
22 * Groff: (groff). The GNU troff document formatting system.
26 File: groff, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
31 This manual documents GNU `troff' version 1.19.2.
33 Copyright (C) 1994-2000, 2001, 2002, 2003, 2004, 2005 Free Software
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."
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."
52 * Tutorial for Macro Users::
59 * Copying This Manual::
67 * Font File Keyword Index::
68 * Program and File Index::
72 File: groff, Node: Introduction, Next: Invoking groff, Prev: Top, Up: Top
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
86 * groff Capabilities::
87 * Macro Package Intro::
88 * Preprocessor Intro::
89 * Output device intro::
93 File: groff, Node: What Is groff?, Next: History, Prev: Introduction, Up: Introduction
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.
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.
111 Although WYSIWYG systems may be easier to use, they have a number of
112 disadvantages compared to `troff':
114 * They must be used on a graphics display to work on a document.
116 * Most of the WYSIWYG systems are either non-free or are not very
119 * `troff' is firmly entrenched in all UNIX systems.
121 * It is difficult to have a wide range of capabilities available
122 within the confines of a GUI/window system.
124 * It is more difficult to make global changes to a document.
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')
131 File: groff, Node: What Is groff?-Footnotes, Up: What Is groff?
133 (1) What You See Is What You Get
136 File: groff, Node: History, Next: groff Capabilities, Prev: What Is groff?, Up: Introduction
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.
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
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'.
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
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.
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.
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.
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
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.
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.
211 * A replacement for `ditroff' with many extensions.
213 * The `soelim', `pic', `tbl', and `eqn' preprocessors.
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
220 * A version of the `me' macros and an implementation of the `man'
223 Also, a front-end was included which could construct the, sometimes
224 painfully long, pipelines required for all the post- and preprocessors.
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').
230 It was declared a stable (i.e. non-beta) package with the release of
231 version 1.04 around November 1991.
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.
239 File: groff, Node: groff Capabilities, Next: Macro Package Intro, Prev: History, Up: Introduction
241 1.3 `groff' Capabilities
242 ========================
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':
250 * text filling, adjusting, and centering
256 * font and glyph size control
258 * vertical spacing (e.g. double-spacing)
260 * line length and indenting
262 * macros, strings, diversions, and traps
266 * tabs, leaders, and fields
268 * input and output conventions and character translation
270 * overstrike, bracket, line drawing, and zero-width functions
272 * local horizontal and vertical motions and the width function
276 * output line numbering
278 * conditional acceptance of input
280 * environment switching
282 * insertions from the standard input
284 * input/output file switching
286 * output and error messages
289 File: groff, Node: Macro Package Intro, Next: Preprocessor Intro, Prev: groff Capabilities, Up: Introduction
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'.
303 File: groff, Node: Preprocessor Intro, Next: Output device intro, Prev: Macro Package Intro, Up: Introduction
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.
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
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'.
327 A free implementation of `grap', a preprocessor for drawing graphs,
328 can be obtained as an extra package; `groff' can use `grap' also.
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
336 File: groff, Node: Output device intro, Next: Credits, Prev: Preprocessor Intro, Up: Introduction
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.
348 File: groff, Node: Credits, Prev: Output device intro, Up: Introduction
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.
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
361 Larry Kollar contributed the section in the `ms' macro package.
364 File: groff, Node: Invoking groff, Next: Tutorial for Macro Users, Prev: Introduction, Up: Top
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.
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
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',
393 * Macro Directories::
396 * Invocation Examples::
399 File: groff, Node: Groff Options, Next: Environment, Prev: Invoking groff, Up: Invoking groff
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'.
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::.
419 The command line format for `groff' is:
422 groff [ -abceghilpstvzCEGNRSUVXZ ] [ -FDIR ] [ -mNAME ]
423 [ -TDEF ] [ -fFAM ] [ -wNAME ] [ -WNAME ]
424 [ -MDIR ] [ -dCS ] [ -rCN ] [ -nNUM ]
425 [ -oLIST ] [ -PARG ] [ -LARG ] [ -IDIR ]
428 The command line format for `gtroff' is as follows.
431 gtroff [ -abcivzCERU ] [ -wNAME ] [ -WNAME ] [ -dCS ]
432 [ -fFAM ] [ -mNAME ] [ -nNUM ]
433 [ -oLIST ] [ -rCN ] [ -TNAME ]
434 [ -FDIR ] [ -MDIR ] [ FILES... ]
436 Obviously, many of the options to `groff' are actually passed on to
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.
443 The `grog' command can be used to guess the correct `groff' command
446 Here's the description of the command-line options:
449 Print a help message.
452 Preprocess with `geqn'.
455 Preprocess with `gtbl'.
458 Preprocess with `ggrn'.
461 Preprocess with `grap'.
464 Preprocess with `gpic'.
467 Preprocess with `gsoelim'.
470 Suppress color output.
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.
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.
483 Make programs run by `groff' print out their version number.
486 Print the pipeline on `stdout' instead of executing it. If
487 specified more than once, print the pipeline on `stderr' and
491 Suppress output from `gtroff'. Only error messages are printed.
494 Do not postprocess the output of `gtroff'. Normally `groff'
495 automatically runs the appropriate postprocessor.
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.
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,
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.
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:
520 For POSTSCRIPT printers and previewers.
526 For a 75dpi X11 previewer.
529 For a 75dpi X11 previewer with a 12pt base font in the
533 For a 100dpi X11 previewer.
536 For a 100dpi X11 previewer with a 12pt base font in the
540 For typewriter-like devices using the (7-bit) ASCII character
544 For typewriter-like devices that support the Latin-1
545 (ISO 8859-1) character set.
548 For typewriter-like devices which use the Unicode (ISO 10646)
549 character set with UTF-8 encoding.
552 For typewriter-like devices which use the EBCDIC encoding IBM
556 For HP LaserJet4-compatible (or other PCL5-compatible)
560 For Canon CAPSL printers (LBP-4 and LBP-8 series laser
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').
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::.
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'
579 Preview with `gxditview' instead of using the usual postprocessor.
580 This is unlikely to produce good results except with `-Tps'.
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
588 Don't allow newlines with `eqn' delimiters. This is the same as
589 the `-N' option in `geqn'.
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.
597 Unsafe mode. This enables the `open', `opena', `pso', `sy', and
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
606 groff -a -man -Tdvi troff.man | less
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.
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
620 Read the standard input after all the named input files have been
624 Enable warning NAME. Available warnings are described in *Note
625 Debugging::. Multiple `-w' options are allowed.
628 Inhibit warning NAME. Multiple `-W' options are allowed.
631 Inhibit all error messages.
634 Enable compatibility mode. *Note Implementation Differences::,
635 for the list of incompatibilities between `groff' and AT&T `troff'.
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).
644 Use FAM as the default font family. *Note Font Families::.
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).
652 Number the first page NUM.
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
662 Within `gtroff', this information can be extracted with the `.P'
663 register. *Note Built-in Registers::.
665 If your document restarts page numbering at the beginning of each
666 chapter, then `gtroff' prints the specified page range for each
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).
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.
684 Search directory `DIR' for macro files before the standard
685 directories (*note Macro Directories::).
688 This option may be used to specify a directory to search for files.
689 It is passed to the following programs:
691 * `gsoelim' (see *Note gsoelim:: for more details); it also
692 implies `groff''s `-s' option.
694 * `gtroff'; it is used to search files named in the `psbb' and
697 * `grops'; it is used to search files named in the
698 `\X'ps: import' and `\X'ps: file' escapes.
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.
706 File: groff, Node: Environment, Next: Macro Directories, Prev: Groff Options, Up: Invoking groff
711 There are also several environment variables (of the operating system,
712 not within `gtroff') which can modify the behavior of `groff'.
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'.
720 The default command prefix is determined during the installation
721 process. If a non-GNU troff system is found, prefix `g' is used,
725 A colon-separated list of directories in which to search for macro
726 files (before the default directories are tried). *Note Macro
730 The default output device.
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::.
738 This search path, followed by `PATH', is used for commands executed
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.
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
754 File: groff, Node: Macro Directories, Next: Font Directories, Prev: Environment, Up: Invoking groff
756 2.3 Macro Directories
757 =====================
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.
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):
768 * The directories specified with `gtroff''s or `groff''s `-M'
771 * The directories given in the `GROFF_TMAC_PATH' environment
774 * The current directory (only if in unsafe mode using the `-U'
775 command line switch).
777 * The home directory.
779 * A platform-dependent directory, a site-specific
780 (platform-independent) directory, and the main tmac directory; the
781 default locations are
784 /usr/local/lib/groff/site-tmac
785 /usr/local/share/groff/site-tmac
786 /usr/local/share/groff/1.18.2/tmac
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.
793 File: groff, Node: Font Directories, Next: Paper Size, Prev: Macro Directories, Up: Invoking groff
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'.
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'.
812 The elements of the search path for font files are (in that order):
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.
818 * The directories given in the `GROFF_FONT_PATH' environment
821 * A site-specific directory and the main font directory; the default
825 /usr/local/share/groff/site-font
826 /usr/local/share/groff/1.18.2/font
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.
833 File: groff, Node: Paper Size, Next: Invocation Examples, Prev: Font Directories, Up: Invoking groff
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.
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'.
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.
856 For example, use the following for PS output on A4 paper in landscape
860 groff -Tps -dpaper=a4l -P-pa4 -P-l -ms foo.ms > foo.ps
862 Note that it is up to the particular macro package to respect default
863 page dimensions set in this way (most do).
866 File: groff, Node: Invocation Examples, Prev: Paper Size, Up: Invoking groff
868 2.6 Invocation Examples
869 =======================
871 This section lists several common uses of `groff' and the corresponding
877 This command processes `file' without a macro package or a
878 preprocessor. The output device is the default, `ps', and the output
882 groff -t -mandoc -Tascii file | less
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.
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::)
899 groff -man -rD1 -z file
901 Check `file' with the `man' macro package, forcing double-sided
902 printing - don't produce any output.
909 File: groff, Node: Invocation Examples-Footnotes, Up: Invocation Examples
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.
917 File: groff, Node: grog, Prev: Invocation Examples, Up: Invocation Examples
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'.
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.
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
946 `grog -Tdvi paper.ms` > paper.dvi
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
953 File: groff, Node: Tutorial for Macro Users, Next: Macro Packages, Prev: Invoking groff, Up: Top
955 3 Tutorial for Macro Users
956 **************************
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
969 File: groff, Node: Basics, Next: Common Features, Prev: Tutorial for Macro Users, Up: Tutorial for Macro Users
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.
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::.
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
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::.
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
1011 Four score and seven
1014 is read, packed onto output lines, and justified to produce:
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.
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.
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
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.
1034 Here are a few hints for preparing text for input to `gtroff'.
1036 * First, keep the input lines short. Short input lines are easier to
1037 edit, and `gtroff' packs words onto longer lines anyhow.
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.
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.
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".
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::)
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).
1061 The `bp' request starts a new page, causing a line break.
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:
1069 My thoughts on the subject
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::).
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,
1087 The `.ce 0' request tells `groff' to center zero more lines, in other
1088 words, stop centering.
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
1095 File: groff, Node: Basics-Footnotes, Up: Basics
1097 (1) This section is derived from `Writing Papers with nroff using
1098 -me' by Eric P. Allman.
1100 (2) If you need finer granularity of the vertical space, use the
1101 `pvs' request (*note Changing Type Sizes::).
1104 File: groff, Node: Common Features, Prev: Basics, Up: Tutorial for Macro Users
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".
1114 All macro packages provide certain common capabilities which fall
1115 into the following categories.
1120 * Sections and Chapters::
1121 * Headers and Footers::
1122 * Page Layout Adjustment::
1124 * Footnotes and Annotations::
1125 * Table of Contents::
1128 * Multiple Columns::
1129 * Font and Size Changes::
1130 * Predefined Strings::
1131 * Preprocessor Support::
1132 * Configuration and Customization::
1135 File: groff, Node: Paragraphs, Next: Sections and Chapters, Prev: Common Features, Up: Common Features
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:
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.
1152 And there are also indented paragraphs which begin with a tag or label
1153 at the margin and the remaining text indented.
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.
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.
1167 A variation of this is a bulleted list.
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.
1176 File: groff, Node: Sections and Chapters, Next: Headers and Footers, Prev: Paragraphs, Up: Common Features
1178 3.2.2 Sections and Chapters
1179 ---------------------------
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.
1188 File: groff, Node: Headers and Footers, Next: Page Layout Adjustment, Prev: Sections and Chapters, Up: Common Features
1190 3.2.3 Headers and Footers
1191 -------------------------
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
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).
1207 File: groff, Node: Page Layout Adjustment, Next: Displays, Prev: Headers and Footers, Up: Common Features
1212 Most macro packages let the user specify top and bottom margins and
1213 other details about the appearance of the printed pages.
1216 File: groff, Node: Displays, Next: Footnotes and Annotations, Prev: Page Layout Adjustment, Up: Common Features
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.
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.
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
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
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.
1245 File: groff, Node: Footnotes and Annotations, Next: Table of Contents, Prev: Displays, Up: Common Features
1247 3.2.6 Footnotes and Annotations
1248 -------------------------------
1250 There are a number of requests to save text for later printing.
1252 "Footnotes" are printed at the bottom of the current page.
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
1259 Most macro packages which supply this functionality also supply a
1260 means of automatically numbering either type of annotation.
1263 File: groff, Node: Table of Contents, Next: Indices, Prev: Footnotes and Annotations, Up: Common Features
1265 3.2.7 Table of Contents
1266 -----------------------
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
1276 File: groff, Node: Indices, Next: Paper Formats, Prev: Table of Contents, Up: Common Features
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.
1285 To produce a real index in a document, external tools like the
1286 `makeindex' program are necessary.
1289 File: groff, Node: Paper Formats, Next: Multiple Columns, Prev: Indices, Up: Common Features
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.
1300 File: groff, Node: Multiple Columns, Next: Font and Size Changes, Prev: Paper Formats, Up: Common Features
1302 3.2.10 Multiple Columns
1303 -----------------------
1305 Some macro packages (but not `man') provide the ability to have two or
1306 more columns on a page.
1309 File: groff, Node: Font and Size Changes, Next: Predefined Strings, Prev: Multiple Columns, Up: Common Features
1311 3.2.11 Font and Size Changes
1312 ----------------------------
1314 The built-in font and size functions are not always intuitive, so all
1315 macro packages provide macros to make these operations simpler.
1318 File: groff, Node: Predefined Strings, Next: Preprocessor Support, Prev: Font and Size Changes, Up: Common Features
1320 3.2.12 Predefined Strings
1321 -------------------------
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.
1328 File: groff, Node: Preprocessor Support, Next: Configuration and Customization, Prev: Predefined Strings, Up: Common Features
1330 3.2.13 Preprocessor Support
1331 ---------------------------
1333 All macro packages provide support for various preprocessors and may
1334 extend their functionality.
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).
1342 File: groff, Node: Configuration and Customization, Prev: Preprocessor Support, Up: Common Features
1344 3.2.14 Configuration and Customization
1345 --------------------------------------
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.
1352 File: groff, Node: Macro Packages, Next: gtroff Reference, Prev: Tutorial for Macro Users, Up: Top
1357 This chapter documents the main macro packages that come with `groff'.
1359 Different main macro packages can't be used at the same time; for
1363 groff -m man foo.man -m ms bar.doc
1365 doesn't work. Note that option arguments are processed before
1366 non-option arguments; the above (failing) sample is thus reordered to
1369 groff -m man -m ms foo.man bar.doc
1380 File: groff, Node: man, Next: mdoc, Prev: Macro Packages, Up: Macro Packages
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
1394 * Miscellaneous man macros::
1395 * Predefined man strings::
1396 * Preprocessors in man pages::
1397 * Optional man extensions::
1400 File: groff, Node: Man options, Next: Man usage, Prev: man, Up: man
1405 The command line format for using the `man' macros with `groff' is:
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... ]
1413 It is possible to use `-man' instead of `-m man'.
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
1421 If more than one manual page is given on the command line, number
1422 the pages continuously, rather than starting each at 1.
1425 Double-sided printing. Footers for even and odd pages are
1426 formatted differently.
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.
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.
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.
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::)
1455 Set title length to LENGTH. If not specified, the title length
1456 defaults to the line length.
1459 Page numbering starts with NNN rather than with 1.
1462 Use XX (which can be 10, 11, or 12pt) as the base document font
1463 size instead of the default value of 10pt.
1466 Set the indentation for sub-subheadings to LENGTH. If not
1467 specified, the indentation defaults to 3n.
1470 After page NNN, number pages as NNNa, NNNb, NNNc, etc. For
1471 example, the option `-rX2' produces the following page numbers: 1,
1475 File: groff, Node: Man options-Footnotes, Up: Man options
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.
1490 File: groff, Node: Man usage, Next: Man font macros, Prev: Man options, Up: man
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.
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.
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.
1512 For HTML output, headers and footers are completely suppressed.
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.
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
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.
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).
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.
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.
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.
1575 To start an indented paragraph with a particular indentation but
1576 without a designator, use `""' (two double quotes) as the first
1579 For example, to start a paragraph with bullets as the designator
1580 and 4 en indentation, write
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
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.
1601 Calls to the `RS' macro can be nested.
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.
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'.
1613 The macros `RS' and `RE' also cause a break but do not insert
1616 Finally, the macros `SH', `SS', `LP' (`PP', `P'), and `RS' reset the
1617 indentation to its default value.
1620 File: groff, Node: Man font macros, Next: Miscellaneous man macros, Prev: Man usage, Up: man
1622 4.1.3 Macros to set fonts
1623 -------------------------
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.
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.
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.
1637 Set its arguments alternately in bold face and italic, without a
1638 space between the arguments. Thus,
1641 .BI this "word and" that
1643 produces "thisword andthat" with "this" and "that" in bold face,
1644 and "word and" in italics.
1647 Set its arguments alternately in italic and bold face, without a
1648 space between the arguments.
1651 Set its arguments alternately in roman and italic, without a space
1652 between the arguments.
1655 Set its arguments alternately in italic and roman, without a space
1656 between the arguments.
1659 Set its arguments alternately in bold face and roman, without a
1660 space between the arguments.
1663 Set its arguments alternately in roman and bold face, without a
1664 space between the arguments.
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
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.
1676 File: groff, Node: Miscellaneous man macros, Next: Predefined man strings, Prev: Man font macros, Up: man
1678 4.1.4 Miscellaneous macros
1679 --------------------------
1681 The default indentation is 7.2n in troff mode and 7n in nroff mode
1682 except for `grohtml' which ignores indentation.
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.
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).
1695 This affects the macros `SH', `SS', `TP', `LP' (as well as `PP'
1696 and `P'), `IP', and `HP'.
1698 The following two macros are included for BSD compatibility.
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
1706 7th Edition (the default)
1714 An optional second argument RELEASE to `AT' specifies the release
1715 number (such as "System V Release 3").
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:
1722 3rd Berkeley Distribution (the default)
1725 4th Berkeley Distribution
1728 4.2 Berkeley Distribution
1731 4.3 Berkeley Distribution
1734 4.4 Berkeley Distribution
1737 File: groff, Node: Predefined man strings, Next: Preprocessors in man pages, Prev: Miscellaneous man macros, Up: man
1739 4.1.5 Predefined strings
1740 ------------------------
1742 The following strings are defined:
1745 Switch back to the default font size.
1748 The typeface used for headings. The default is `B'.
1751 The `registered' sign.
1754 The `trademark' sign.
1758 Left and right quote. This is equal to `\(lq' and `\(rq',
1762 File: groff, Node: Preprocessors in man pages, Next: Optional man extensions, Prev: Predefined man strings, Up: man
1764 4.1.6 Preprocessors in `man' pages
1765 ----------------------------------
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:
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).
1779 File: groff, Node: Optional man extensions, Prev: Preprocessors in man pages, Up: man
1781 4.1.7 Optional `man' extensions
1782 -------------------------------
1784 Use the file `man.local' for local extensions to the `man' macros or
1787 Custom headers and footers
1788 ..........................
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'.
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.
1799 Control the content of the footers. Normally, the footer prints
1800 the page number and the third and fourth arguments to `TH'.
1802 Use the `FT' number register to specify the footer position. The
1805 Ultrix-specific man macros
1806 ..........................
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.
1817 Print subsequent text using the constant width (Courier) typeface.
1820 Begin a non-filled display.
1823 End a non-filled display started with `Ds'.
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.
1830 End a non-filled display started with `EX'.
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
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.
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.
1847 -- Macro: .TB [text]
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.
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).
1863 End a note begun with `NT'.
1865 -- Macro: .PN path [punct]
1866 Set the path name in constant width (Courier), followed by
1867 optional punctuation.
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
1876 Switch to roman font and turn off any underlining in effect.
1879 Print the string `<RETURN>'.
1882 Start printing a change bar in the margin if the number `4' is
1883 specified. Otherwise, this macro does nothing.
1886 End printing the change bar begun by `VS'.
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.
1896 .\" Make the heading fonts Helvetica
1899 .\" Put more whitespace in front of headings.
1902 . if t .sp (u;\\n[PD]*2)
1907 File: groff, Node: mdoc, Next: ms, Prev: man, Up: Macro Packages
1912 See the `groff_mdoc(7)' man page (type `man groff_mdoc' at the command
1916 File: groff, Node: ms, Next: me, Prev: mdoc, Up: Macro Packages
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
1929 * General ms Structure::
1930 * ms Document Control Registers::
1931 * ms Cover Page Macros::
1934 * Differences from AT&T ms::
1935 * Naming Conventions::
1938 File: groff, Node: ms Intro, Next: General ms Structure, Prev: ms, Up: ms
1940 4.3.1 Introduction to `ms'
1941 --------------------------
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
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.
1955 File: groff, Node: General ms Structure, Next: ms Document Control Registers, Prev: ms Intro, Up: ms
1957 4.3.2 General structure of an `ms' document
1958 -------------------------------------------
1960 The `ms' macro package expects a certain amount of structure, but not
1961 as much as packages such as `man' or `mdoc'.
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:
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'.
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
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
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.
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.
2008 File: groff, Node: General ms Structure-Footnotes, Up: General ms Structure
2010 (1) Actually, only the title is required.
2013 File: groff, Node: ms Document Control Registers, Next: ms Cover Page Macros, Prev: General ms Structure, Up: ms
2015 4.3.3 Document control registers
2016 --------------------------------
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.
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.
2032 Effective: next page.
2037 Defines the line length (i.e., the width of the body text).
2039 Effective: next paragraph.
2044 Defines the title length (i.e., the header and footer width). This
2045 is usually the same as `LL', but not necessarily.
2047 Effective: next paragraph.
2052 Defines the header margin height at the top of the page.
2054 Effective: next page.
2059 Defines the footer margin height at the bottom of the page.
2061 Effective: next page.
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
2074 Effective: next paragraph.
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).
2084 Effective: next paragraph.
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.
2095 Effective: next section heading.
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.
2108 Effective: next section heading.
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.
2117 Effective: next paragraph.
2121 -- Register: \n[FAM]
2122 Defines the font family used to typeset the document.
2124 Effective: next paragraph.
2126 Default: as defined in the output device.
2132 Defines the initial indentation of a (`PP' macro) paragraph.
2134 Effective: next paragraph.
2139 Defines the space between paragraphs.
2141 Effective: next paragraph.
2146 Defines the indentation on both sides of a quoted (`QP' macro)
2149 Effective: next paragraph.
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.
2161 Effective: next paragraph.
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.
2174 Effective: next paragraph.
2182 Defines the length of a footnote.
2184 Effective: next footnote.
2186 Default: `\n[LL]' * 5 / 6.
2189 Defines the footnote indentation.
2191 Effective: next footnote.
2196 The footnote format:
2198 Print the footnote number as a superscript; indent the
2202 Print the number followed by a period (like 1.) and indent the
2206 Like 1, without an indentation.
2209 Like 1, but print the footnote number as a hanging paragraph.
2211 Effective: next footnote.
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.
2219 Effective: next footnote.
2221 Default: `\n[PS]' - 2.
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
2228 Effective: next footnote.
2230 Default: `\n[FPS]' + 2.
2232 -- Register: \n[FPD]
2233 Defines the footnote paragraph spacing.
2235 Effective: next footnote.
2237 Default: `\n[PD]' / 2.
2239 Miscellaneous Number Registers
2240 ..............................
2242 -- Register: \n[MINGW]
2243 Defines the minimum width between columns in a multi-column
2246 Effective: next page.
2251 File: groff, Node: ms Cover Page Macros, Next: ms Body Text, Prev: ms Document Control Registers, Up: ms
2253 4.3.4 Cover page macros
2254 -----------------------
2256 Use the following macros to create a cover page for your document in
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.
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.
2269 (P-one) Prints the header on page 1. The default is to suppress
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'.
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'.
2283 Specifies the document title. `groff' collects text following the
2284 `TL' macro into the title, until reaching the author name or
2288 Specifies the author's name, which appears on the line (or lines)
2289 immediately following. You can specify multiple authors as
2296 University of West Bumblefuzz
2300 Monolithic Corporation
2306 Specifies the author's institution. You can specify multiple
2307 institutions in the same way that you specify multiple authors.
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.
2317 The following is example mark-up for a title page.
2322 The Inevitability of Code Bloat
2323 in Commercial and Free Software
2327 University of West Bumblefuzz
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
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
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
2346 ... the rest of the paper follows ...
2349 File: groff, Node: ms Body Text, Next: ms Page Layout, Prev: ms Cover Page Macros, Up: ms
2354 This section describes macros used to mark up the body of your
2355 document. Examples include paragraphs, sections, and other groups.
2359 * Paragraphs in ms::
2361 * Highlighting in ms::
2363 * Indentation values in ms::
2365 * ms Displays and Keeps::
2367 * Example multi-page table::
2371 File: groff, Node: Paragraphs in ms, Next: Headings in ms, Prev: ms Body Text, Up: ms Body Text
2376 The following paragraph types are available.
2380 Sets a paragraph with an initial indentation.
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.
2388 Sets a paragraph whose lines are indented, except for the first
2389 line. This is a Berkeley extension.
2391 The following markup uses all four paragraph macros.
2395 Cases used in the study
2397 The following software and versions were
2398 considered for this report.
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).
2405 For free software, we chose
2407 from its first appearance as a standalone
2408 editor through the current version (v20).
2409 See [Bloggs 2002] for details.
2411 Franklin's Law applied to software:
2412 software expands to outgrow both
2413 RAM and disk space over time.
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
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.
2429 File: groff, Node: Headings in ms, Next: Highlighting in ms, Prev: Paragraphs in ms, Up: ms Body Text
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.
2438 The following describes the heading macros:
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.
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.
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
2463 *before* your first use of `NH', or simply
2468 *after* your first use of `NH'.
2470 -- Macro: .SH [match-level]
2471 Unnumbered subheading.
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::.
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.
2486 File: groff, Node: Highlighting in ms, Next: Lists in ms, Prev: Headings in ms, Up: ms Body Text
2488 4.3.5.3 Highlighting
2489 ....................
2491 The `ms' macros provide a variety of methods to highlight or emphasize
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,
2507 If you give this macro no arguments, `groff' prints all text
2508 following in bold until the next highlighting, paragraph, or
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.
2515 -- Macro: .I [txt [post [pre]]]
2516 Sets its first argument in _italic type_. It operates similarly
2517 to the `B' macro otherwise.
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.
2523 -- Macro: .BI [txt [post [pre]]]
2524 Sets its first argument in bold italic type. It operates
2525 similarly to the `B' macro otherwise.
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').
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.
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.
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.
2549 Prints all text following in the normal point size (that is, the
2550 value of the `PS' register).
2554 Text enclosed with `\*{' and `\*}' is printed as a superscript.
2557 File: groff, Node: Lists in ms, Next: Indentation values in ms, Prev: Highlighting in ms, Up: ms Body Text
2562 The `IP' macro handles duties for all lists.
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)
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
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.
2579 The following is an example of a bulleted list.
2601 The following is an example of a numbered list.
2624 Note the use of the auto-incrementing number register in this
2627 The following is an example of a glossary-style list.
2630 A glossary-style list:
2632 Two or more attorneys.
2634 Firearms, preferably
2643 A glossary-style list:
2646 Two or more attorneys.
2648 guns Firearms, preferably large-caliber.
2651 Gotta pay for those lawyers and guns!
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
2660 The first workaround uses the `br' request to force a break after
2661 printing the term or label.
2664 A glossary-style list:
2666 Two or more attorneys.
2669 Firearms, preferably large-caliber.
2671 Gotta pay for those lawyers and guns!
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.
2679 A glossary-style list:
2681 Two or more attorneys.
2683 \p Firearms, preferably large-caliber.
2685 Gotta pay for those lawyers and guns!
2687 To set nested lists, use the `RS' and `RE' macros. *Note
2688 Indentation values in ms::, for more information.
2720 File: groff, Node: Indentation values in ms, Next: Tabstops in ms, Prev: Lists in ms, Up: ms Body Text
2722 4.3.5.5 Indentation values
2723 ..........................
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
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.
2735 *Note ms Displays and Keeps::, for macros to indentation and turn off
2739 File: groff, Node: Tabstops in ms, Next: ms Displays and Keeps, Prev: Indentation values in ms, Up: ms Body Text
2744 Use the `ta' request to define tab stops as needed. *Note Tabs and
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.
2753 File: groff, Node: ms Displays and Keeps, Next: ms Insertions, Prev: Tabstops in ms, Up: ms Body Text
2755 4.3.5.7 Displays and keeps
2756 ..........................
2758 Use displays to show text-based examples or figures (such as code
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.
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
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.
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.
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.
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.
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
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
2825 The `KS' macro begins a block of text to be kept on a single page,
2826 and the `KE' macro ends the block.
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.
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.
2842 Use the following macros to draw a box around a section of text (such
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).
2852 File: groff, Node: ms Insertions, Next: Example multi-page table, Prev: ms Displays and Keeps, Up: ms Body Text
2854 4.3.5.8 Tables, figures, equations, and references
2855 ..................................................
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.
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
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'.
2877 -- Macro: .EQ [align]
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.
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.
2891 * Example multi-page table::
2894 File: groff, Node: Example multi-page table, Next: ms Footnotes, Prev: ms Insertions, Up: ms Body Text
2896 4.3.5.9 An example multi-page table
2897 ...................................
2899 The following is an example of how to set up a table that may print
2900 across two or more pages.
2906 Text ...of heading...
2911 ... the rest of the table follows...
2916 File: groff, Node: ms Footnotes, Prev: Example multi-page table, Up: ms Body Text
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).
2926 Specifies the location of a numbered footnote marker in the text.
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.
2936 You can control how `groff' prints footnote numbers by changing the
2937 value of the `FF' register. *Note ms Document Control Registers::.
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 `\**'.
2947 File: groff, Node: ms Page Layout, Next: Differences from AT&T ms, Prev: ms Body Text, Up: ms
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.
2956 You can change the layout by setting the proper number registers and
2961 * ms Headers and Footers::
2963 * ms Multiple Columns::
2965 * ms Strings and Special Characters::
2968 File: groff, Node: ms Headers and Footers, Next: ms Margins, Prev: ms Page Layout, Up: ms Page Layout
2970 4.3.6.1 Headers and footers
2971 ...........................
2973 For documents that do not distinguish between odd and even pages, set
2974 the following strings:
2979 Sets the left, center, and right headers.
2984 Sets the left, center, and right footers.
2986 For documents that need different information printed in the even and
2987 odd pages, use the following macros:
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
2998 You can replace the quote (`'') marks with any character not
2999 appearing in the header or footer text.
3002 File: groff, Node: ms Margins, Next: ms Multiple Columns, Prev: ms Headers and Footers, Up: ms Page Layout
3007 You control margins using a set of number registers. *Note ms Document
3008 Control Registers::, for details.
3011 File: groff, Node: ms Multiple Columns, Next: ms TOC, Prev: ms Margins, Up: ms Page Layout
3013 4.3.6.3 Multiple columns
3014 ........................
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_
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.
3035 File: groff, Node: ms TOC, Next: ms Strings and Special Characters, Prev: ms Multiple Columns, Up: ms Page Layout
3037 4.3.6.4 Creating a table of contents
3038 ....................................
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.
3045 -- Macro: .XS [page]
3046 -- Macro: .XA [page]
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:
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:
3081 A Brief History of the Universe
3083 Details of Galactic Formation
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.
3095 The optional argument `no' suppresses printing the title specified
3096 by the string register `TOC'.
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.
3103 The optional argument `no' suppresses printing the title specified
3104 by the string register `TOC'.
3106 The `Groff and Friends HOWTO' includes a `sed' script that
3107 automatically inserts `XS' and `XE' macro entries after each heading in
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.
3115 File: groff, Node: ms Strings and Special Characters, Prev: ms TOC, Up: ms Page Layout
3117 4.3.6.5 Strings and Special Characters
3118 ......................................
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.
3124 -- String: \*[REFERENCES]
3125 Contains the string printed at the beginning of the references
3126 (bibliography) page. The default is `References'.
3128 -- String: \*[ABSTRACT]
3129 Contains the string printed at the beginning of the abstract. The
3130 default is `ABSTRACT'.
3133 Contains the string printed at the beginning of the table of
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.
3151 The following special characters are available(1) (*note ms Strings
3152 and Special Characters-Footnote-1::):
3159 Prints typographer's quotes in troff, and plain quotes in nroff.
3160 `\*Q' is the left quote and `\*U' is the right quote.
3162 Improved accent marks are available in the `ms' macros.
3165 Specify this macro at the beginning of your document to enable
3166 extended accent marks and special characters. This is a Berkeley
3169 To use the accent marks, place them *after* the character being
3172 Note that groff's native support for accents is superior to the
3173 following definitions.
3175 The following accent marks are available after invoking the `AM'
3208 The following are standalone characters available after invoking the
3212 Upside-down question mark.
3215 Upside-down exclamation point.
3239 Lowercase æ ligature.
3242 Uppercase Æ ligature.
3245 File: groff, Node: ms Strings and Special Characters-Footnotes, Up: ms Strings and Special Characters
3247 (1) For an explanation what special characters are see *Note Special
3251 File: groff, Node: Differences from AT&T ms, Next: Naming Conventions, Prev: ms Page Layout, Up: ms
3253 4.3.7 Differences from AT&T `ms'
3254 --------------------------------
3256 This section lists the (minor) differences between the `groff -ms'
3257 macros and AT&T `troff -ms' macros.
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'.
3263 * The general error-handling policy of `groff -ms' is to detect and
3264 report errors, rather than silently to ignore them.
3266 * `groff -ms' does not work in compatibility mode (this is, with the
3269 * There is no special support for typewriter-like devices.
3271 * `groff -ms' does not provide cut marks.
3273 * Multiple line spacing is not supported. Use a larger vertical
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
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.
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
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.
3303 * Missing ms Macros::
3304 * Additional ms Macros::
3307 File: groff, Node: Missing ms Macros, Next: Additional ms Macros, Prev: Differences from AT&T ms, Up: Differences from AT&T ms
3309 4.3.7.1 `troff' macros not appearing in `groff'
3310 ...............................................
3312 Macros missing from `groff -ms' are cover page macros specific to Bell
3313 Labs and Berkeley. The macros known to be missing are:
3316 Technical memorandum; a cover sheet style
3319 Internal memorandum; a cover sheet style
3322 Memo for record; a cover sheet style
3325 Memo for file; a cover sheet style
3328 Engineer's notes; a cover sheet style
3331 Computing Science Tech Report; a cover sheet style
3337 Cover sheet information
3343 File: groff, Node: Additional ms Macros, Prev: Missing ms Macros, Up: Differences from AT&T ms
3345 4.3.7.2 `groff' macros not appearing in AT&T `troff'
3346 ....................................................
3348 The `groff -ms' macros have a few minor extensions compared to the AT&T
3352 Improved accent marks. *Note ms Strings and Special Characters::,
3356 Indented display. The default behavior of AT&T `troff -ms' was to
3357 indent; the `groff' default prints displays flush left with the
3361 Print text in `constant width' (Courier) font.
3364 Indexing term (printed on standard error). You can write a script
3365 to capture and process an index generated in this manner.
3367 The following additional number registers appear in `groff -ms':
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'.
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.
3379 File: groff, Node: Naming Conventions, Prev: Differences from AT&T ms, Up: ms
3381 4.3.8 Naming Conventions
3382 ------------------------
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.
3388 Internally the macros are divided into modules; naming conventions
3391 * Names used only within one module are of the form MODULE`*'NAME.
3393 * Names used outside the module in which they are defined are of the
3396 * Names associated with a particular environment are of the form
3397 ENVIRONMENT`:'NAME; these are used only within the `par' module.
3399 * NAME does not have a module prefix.
3401 * Constructed names used to implement arrays are of the form
3404 Thus the groff ms macros reserve the following names:
3406 * Names containing the characters `*', `@', and `:'.
3408 * Names containing only uppercase letters and digits.
3411 File: groff, Node: me, Next: mm, Prev: ms, Up: Macro Packages
3416 See the `meintro.me' and `meref.me' documents in groff's `doc'
3420 File: groff, Node: mm, Prev: me, Up: Macro Packages
3425 See the `groff_mm(7)' man page (type `man groff_mm' at the command
3429 File: groff, Node: gtroff Reference, Next: Preprocessors, Prev: Macro Packages, Up: Top
3431 5 `gtroff' Reference
3432 ********************
3434 This chapter covers *all* of the facilities of `gtroff'. Users of
3435 macro packages may skip it if not interested in details.
3443 * Embedded Commands::
3445 * Manipulating Filling and Adjusting::
3446 * Manipulating Hyphenation::
3447 * Manipulating Spacing::
3449 * Character Translations::
3450 * Troff and Nroff Mode::
3455 * Fonts and Symbols::
3458 * Conditionals and Loops::
3461 * Drawing Requests::
3465 * Suppressing output::
3468 * Postprocessor Access::
3470 * Gtroff Internals::
3472 * Implementation Differences::
3475 File: groff, Node: Text, Next: Measurements, Prev: gtroff Reference, Up: gtroff Reference
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:
3484 * filling and adjusting
3486 * adding additional space after sentences
3490 * inserting implicit line breaks
3494 * Filling and Adjusting::
3498 * Implicit Line Breaks::
3499 * Input Conventions::
3503 File: groff, Node: Filling and Adjusting, Next: Hyphenation, Prev: Text, Up: Text
3505 5.1.1 Filling and Adjusting
3506 ---------------------------
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
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::).
3519 *Note Manipulating Filling and Adjusting::.
3522 File: groff, Node: Hyphenation, Next: Sentences, Prev: Filling and Adjusting, Up: Text
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.
3537 *Note Manipulating Hyphenation::.
3540 File: groff, Node: Sentences, Next: Tab Stops, Prev: Hyphenation, Up: Text
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.
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
3558 In addition, the following characters and symbols are treated
3559 transparently while handling end-of-sentence characters: `"', `'', `)',
3560 `]', `*', `\[dg]', and `\[rq]'.
3562 See the `cflags' request in *Note Using Symbols::, for more details.
3564 To prevent the insertion of extra space after an end-of-sentence
3565 character (at the end of a line), append `\&'.
3568 File: groff, Node: Tab Stops, Next: Implicit Line Breaks, Prev: Sentences, Up: Text
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
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
3592 *Note Tabs and Fields::.
3595 File: groff, Node: Implicit Line Breaks, Next: Input Conventions, Prev: Tab Stops, Up: Text
3597 5.1.5 Implicit Line Breaks
3598 --------------------------
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.
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::.
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.
3613 The end of file also causes a break - otherwise the last line of the
3614 document may vanish!
3616 Certain requests also cause breaks, implicitly or explicitly. This
3617 is discussed in *Note Manipulating Filling and Adjusting::.
3620 File: groff, Node: Input Conventions, Next: Input Encodings, Prev: Implicit Line Breaks, Up: Text
3622 5.1.6 Input Conventions
3623 -----------------------
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:
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
3634 * Try to keep lines less than 40-60 characters, to allow space for
3635 inserting more text.
3637 * Do not try to do any formatting in a WYSIWYG manner (i.e., don't
3638 try using spaces to get proper indentation).
3641 File: groff, Node: Input Encodings, Prev: Input Conventions, Up: Text
3643 5.1.7 Input Encodings
3644 ---------------------
3646 Currently, the following input encodings are available.
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.
3654 This is the default input encoding on non-EBCDIC platforms; the
3655 file `latin1.tmac' is loaded at start-up.
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'.
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'.
3669 Note that it can happen that some input encoding characters are not
3670 available for a particular output device. For example, saying
3673 groff -Tlatin1 -mlatin9 ...
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
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).
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).
3691 File: groff, Node: Measurements, Next: Expressions, Prev: Text, Up: gtroff Reference
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.
3708 Some of the measurement units are completely independent of any of
3709 the current settings (e.g. type size) of `gtroff'.
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.
3717 Centimeters. One centimeter is equal to 0.3937in.
3720 Points. This is a typesetter's measurement used for measure type
3721 size. It is 72 points to an inch.
3724 Pica. Another typesetting measurement. 6 Picas to an inch (and
3725 12 points to a pica).
3729 *Note Fractional Type Sizes::, for a discussion of these units.
3732 Fractions. Value is 65536. *Note Colors::, for usage.
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.
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.
3744 Ens. In `groff', this is half of an em.
3747 Vertical space. This is equivalent to the current line spacing.
3748 *Note Sizes::, for more information about this.
3758 File: groff, Node: Measurements-Footnotes, Up: Measurements
3760 (1) those that specify vertical or horizontal motion or a type size
3763 File: groff, Node: Default Units, Prev: Measurements, Up: Measurements
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:
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.
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.
3792 File: groff, Node: Expressions, Next: Identifiers, Prev: Measurements, Up: gtroff Reference
3797 `gtroff' has most arithmetic operators common to other languages:
3799 * Arithmetic: `+' (addition), `-' (subtraction), `/' (division), `*'
3800 (multiplication), `%' (modulo).
3802 `gtroff' only provides integer arithmetic. The internal type used
3803 for computing results is `int', which is usually a 32bit signed
3806 * Comparison: `<' (less than), `>' (greater than), `<=' (less than
3807 or equal), `>=' (greater than or equal), `=' (equal), `==' (the
3810 * Logical: `&' (logical and), `:' (logical or).
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.
3817 * Extrema: `>?' (maximum), `<?' (minimum).
3824 .nr z (\n[x] >? \n[y])
3826 The register `z' now contains 5.
3828 * Scaling: `(C;E)'. Evaluate E using C as the default scaling
3829 indicator. If C is missing, ignore scaling indicators in the
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.
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,
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.
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.
3853 *Note Setting Registers::, for some examples.
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.
3859 Due to the way arguments are parsed, spaces are not allowed in
3860 expressions, unless the entire expression is surrounded by parentheses.
3862 *Note Request and Macro Arguments::, and *Note Conditionals and
3866 File: groff, Node: Identifiers, Next: Embedded Commands, Prev: Expressions, Up: gtroff Reference
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:
3875 * Whitespace characters (spaces, tabs, and newlines).
3877 * Backspace (ASCII `0x08' or EBCDIC `0x16') and character code
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'.
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'.
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
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'.
3898 For example, any of the following is valid.
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
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
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.
3932 *Note Escapes::, for details on parameter delimiting characters.
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):
3940 * Two characters. Must be prefixed with `(' in some situations.
3942 * Arbitrary length (`gtroff' only). Must be bracketed with `['
3943 and `]' in some situations. Any length identifier can be put in
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:
3950 * If the identifier is a string, macro, or diversion, `gtroff'
3951 defines it as empty.
3953 * If the identifier is a number register, `gtroff' defines it with a
3956 *Note Warnings::., *Note Interpolating Registers::, and *Note
3959 Note that macros, strings, and diversions share the same name space.
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.
3978 *Note Interpolating Registers::, and *Note Strings::.
3981 File: groff, Node: Embedded Commands, Next: Registers, Prev: Identifiers, Up: gtroff Reference
3983 5.5 Embedded Commands
3984 =====================
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.
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).
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
4005 File: groff, Node: Requests, Next: Macros, Prev: Embedded Commands, Up: Embedded Commands
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_
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.
4032 Another possibility is to use the blank line macro request `blm' by
4033 assigning an empty macro to it.
4038 .blm do-nothing \" activate blank line macro
4049 .blm \" deactivate blank line macro
4051 *Note Blank Line Traps::.
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.
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.
4063 * Request and Macro Arguments::
4066 File: groff, Node: Request and Macro Arguments, Prev: Requests, Up: Requests
4068 5.5.1.1 Request and Macro Arguments
4069 ...................................
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::)
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.
4079 Here are a few examples for a hypothetical macro `uh':
4082 .uh The Mouse Problem
4083 .uh "The Mouse Problem"
4084 .uh The\ Mouse\ Problem
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::)
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.
4097 .xxx a" "b c" "de"fg"
4099 has the arguments `a"', `b c', `de', and `fg"'. Don't rely on this
4102 There are two possibilities to get a double quote reliably.
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'):
4112 . tm xx: `\\$1' `\\$2' `\\$3'
4114 . yy "\\$1" "\\$2" "\\$3"
4117 . tm yy: `\\$1' `\\$2' `\\$3'
4119 .xx A "test with ""quotes""" .
4120 => xx: `A' `test with "quotes"' `.'
4121 => yy: `A' `test with ' `quotes""'
4123 If not in compatibility mode, you get the expected result
4126 xx: `A' `test with "quotes"' `.'
4127 yy: `A' `test with "quotes"' `.'
4129 since `gtroff' preserves the input level.
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.
4135 Not that this method won't work with UNIX `troff' in general since
4136 the glyph `dq' isn't defined normally.
4138 Double quotes in the `ds' request are handled differently. *Note
4139 Strings::, for more details.
4142 File: groff, Node: Request and Macro Arguments-Footnotes, Up: Request and Macro Arguments
4144 (1) Plan 9's `troff' implementation also allows tabs for argument
4145 separation - `gtroff' intentionally doesn't support this.
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,
4155 File: groff, Node: Macros, Next: Escapes, Prev: Requests, Up: Embedded Commands
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.
4164 *Note Writing Macros::, and *Note Request and Macro Arguments::.
4167 File: groff, Node: Escapes, Prev: Macros, Up: Embedded Commands
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::.
4177 Escape sequences which require an identifier as a parameter accept
4178 three possible syntax forms.
4180 * The next single character is the identifier.
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.
4186 * If this single character is an opening bracket, take all characters
4187 until a closing bracket as the identifier.
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:
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
4219 possible, but it is better not to use this feature to avoid confusion.
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
4228 No newline characters as delimiters are allowed in the following
4229 escapes: `\A', `\B', `\Z', `\C', and `\w'.
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:
4234 * The digits `0'-`9'.
4236 * The (single-character) operators `+-/*%<>=&:().'.
4238 * The space, tab, and newline characters.
4240 * All escape sequences except `\%', `\:', `\{', `\}', `\'', `\`',
4241 `\-', `\_', `\!', `\@', `\/', `\c', `\e', and `\p'.
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.
4249 *Note Implementation Differences::, *Note Copy-in Mode::, and *Note
4250 Diversions::, *Note Identifiers::, for more information.
4257 File: groff, Node: Comments, Prev: Escapes, Up: Escapes
4262 Probably one of the most(1) (*note Comments-Footnote-1::) common forms
4263 of escapes is the comment.
4266 Start a comment. Everything to the end of the input line is
4269 This may sound simple, but it can be tricky to keep the comments
4270 from interfering with the appearance of the final output.
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
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.
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:
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
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.
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:
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:
4330 This is part of a large block
4331 of text that has been
4332 temporarily(?) commented out.
4334 We can restore it simply by removing
4335 the .ig request and the ".." at the
4338 More text text text...
4343 text text text... More text text text...
4345 Note that the commented-out block of text does not cause a break.
4347 The input is read in copy-mode; auto-incremented registers _are_
4348 affected (*note Auto-increment::).
4351 File: groff, Node: Comments-Footnotes, Up: Comments
4353 (1) Unfortunately, this is a lie. But hopefully future `gtroff'
4354 hackers will believe it `:-)'
4357 File: groff, Node: Registers, Next: Manipulating Filling and Adjusting, Prev: Embedded Commands, Up: gtroff Reference
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.
4366 *Note Identifiers::, for details on register identifiers.
4370 * Setting Registers::
4371 * Interpolating Registers::
4373 * Assigning Formats::
4374 * Built-in Registers::
4377 File: groff, Node: Setting Registers, Next: Interpolating Registers, Prev: Registers, Up: Registers
4379 5.6.1 Setting Registers
4380 -----------------------
4382 Define or set registers using the `nr' request or the `\R' escape.
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.
4389 The argument to `\R' usually has to be enclosed in quotes. *Note
4390 Escapes::, for details on parameter delimiting characters.
4392 The `\R' escape doesn't produce an input token in `gtroff'; with
4393 other words, it vanishes completely after `gtroff' has processed
4396 For example, the following two lines are equivalent:
4399 .nr a (((17 + (3 * 4))) % 4)
4400 \R'a (((17 + (3 * 4))) % 4)'
4403 Both `nr' and `\R' have two additional special forms to increment or
4404 decrement a register.
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.
4418 To assign the negated value of a register to another register,
4419 some care must be taken to get the desired result:
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':
4446 -- Request: .rr ident
4447 Remove number register IDENT. If IDENT doesn't exist, the request
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.
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.
4461 File: groff, Node: Interpolating Registers, Next: Auto-increment, Prev: Setting Registers, Up: Registers
4463 5.6.2 Interpolating Registers
4464 -----------------------------
4466 Numeric registers can be accessed via the `\n' escape.
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.
4494 File: groff, Node: Auto-increment, Next: Assigning Formats, Prev: Interpolating Registers, Up: Registers
4496 5.6.3 Auto-increment
4497 --------------------
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.
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.
4508 To activate auto-incrementing, the escape `\n' has a special syntax
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
4533 \n+a, \n+a, \n+a, \n+a, \n+a
4535 \n-(xx, \n-(xx, \n-(xx, \n-(xx, \n-(xx
4537 \n+[foo], \n+[foo], \n+[foo], \n+[foo], \n+[foo]
4543 -5, -10, -15, -20, -25
4546 To change the increment value without changing the value of a
4547 register (A in the example), the following can be used:
4553 File: groff, Node: Assigning Formats, Next: Built-in Registers, Prev: Auto-increment, Up: Registers
4555 5.6.4 Assigning Formats
4556 -----------------------
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.
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:
4571 Decimal arabic numbers. This is the default format: 0, 1, 2,
4575 Decimal numbers with as many digits as specified. So, `00'
4576 would result in printing numbers as 01, 02, 03, ....
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).
4584 Upper-case Roman numerals: 0, I, II, III, IV, ....
4587 Lower-case Roman numerals: 0, i, ii, iii, iv, ....
4590 Upper-case letters: 0, A, B, C, ..., Z, AA, AB, ....
4593 Lower-case letters: 0, a, b, c, ..., z, aa, ab, ....
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.
4599 The following example produces `10, X, j, 010':
4603 .af a 1 \" the default format
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.
4619 If IDENT doesn't exist, it is created.
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
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.
4635 File: groff, Node: Built-in Registers, Prev: Assigning Formats, Up: Registers
4637 5.6.5 Built-in Registers
4638 ------------------------
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::.
4646 This string-valued register returns the current input file name.
4649 Horizontal resolution in basic units.
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
4657 Vertical resolution in basic units.
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'.
4665 The number of minutes after the hour, in the range 0 to 59.
4666 Initialized at start-up of `gtroff'.
4669 The number of hours past midnight, in the range 0 to 23.
4670 Initialized at start-up of `gtroff'.
4673 Day of the week (1-7).
4676 Day of the month (1-31).
4679 Current month (1-12).
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:
4692 '\" The following line stopped working after 1999
4693 This document was formatted in 19\n(yr.
4695 can be corrected as follows:
4698 This document was formatted in \n[year].
4700 or, to be portable to older `troff' versions, as follows:
4704 This document was formatted in \n(y4.
4708 The current _input_ line number. Register `.c' is read-only,
4709 whereas `c.' (a `gtroff' extension) is writable also, affecting
4713 The current _output_ line number after a call to the `nm' request
4714 to activate line numbering.
4716 *Note Miscellaneous::, for more information about line numbering.
4719 The major version number. For example, if the version number is
4720 1.03 then `.x' contains `1'.
4723 The minor version number. For example, if the version number is
4724 1.03 then `.y' contains `03'.
4727 The revision number of `groff'.
4730 The process ID of `gtroff'.
4733 Always 1. Macros should use this to determine whether they are
4734 running under GNU `troff'.
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::.
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
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
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'.
4758 File: groff, Node: Manipulating Filling and Adjusting, Next: Manipulating Hyphenation, Prev: Registers, Up: gtroff Reference
4760 5.7 Manipulating Filling and Adjusting
4761 ======================================
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'.
4769 Break the current line, i.e., the input collected so far is emitted
4772 If the no-break control character is used, `gtroff' suppresses the
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'
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.
4792 The fill mode status is associated with the current environment
4793 (*note Environments::).
4795 See *Note Line Control::, for interaction with the `\c' escape.
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.
4803 The fill mode status is associated with the current environment
4804 (*note Environments::).
4806 See *Note Line Control::, for interaction with the `\c' escape.
4808 -- Request: .ad [mode]
4812 Activation and deactivation of adjusting is done implicitly with
4813 calls to the `fi' or `nf' requests.
4815 MODE can have one of the following values:
4818 Adjust text to the left margin. This produces what is
4819 traditionally called ragged-right text.
4822 Adjust text to the right margin, producing ragged-left text.
4825 Center filled text. This is different to the `ce' request
4826 which only centers text without filling.
4830 Justify to both margins. This is the default used by
4833 Finally, MODE can be the numeric argument returned by the `.j'
4836 With no argument, `gtroff' adjusts lines in the same way it did
4837 before adjusting was deactivated (with a call to `na', for
4849 .ad \" back to centering
4851 .ad \n[ad] \" back to right justifying
4853 The current adjustment mode is available in the read-only number
4854 register `.j'; it can be stored and subsequently used to set
4857 The adjustment mode status is associated with the current
4858 environment (*note Environments::).
4861 Disable adjusting. This request won't change the current
4862 adjustment mode: A subsequent call to `ad' uses the previous
4865 The adjustment mode status is associated with the current
4866 environment (*note Environments::).
4870 Adjust the current line and cause a break.
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
4878 This is an uninteresting sentence.
4879 This is an uninteresting sentence.\p
4880 This is an uninteresting sentence.
4885 This is an uninteresting sentence. This is an
4886 uninteresting sentence.
4887 This is an uninteresting sentence.
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.
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
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'
4915 The word space and sentence space values are associated with the
4916 current environment (*note Environments::).
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::).
4922 The request is ignored if there is no parameter.
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
4931 1.\ This is the first footnote.\c
4935 2.\ This is the second footnote.
4940 1. This is the first footnote. 2. This
4941 is the second footnote.
4943 Note that the `\h' escape produces unbreakable space.
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
4953 The following example demonstrates the differences. Here the
4959 This is a small text fragment which shows the differences
4960 between the `.ce' and the `.ad c' request.
4964 This is a small text fragment which shows the differences
4965 between the `.ce' and the `.ad c' request.
4967 And here the result:
4970 This is a small text fragment which
4971 shows the differences
4972 between the `.ce' and the `.ad c' request.
4974 This is a small text fragment which
4975 shows the differences between the `.ce'
4976 and the `.ad c' request.
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.
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.
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.
4991 The `.ce' read-only number register contains the number of lines
4992 remaining to be centered, as set by the `ce' request.
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::).
5004 File: groff, Node: Manipulating Hyphenation, Next: Manipulating Spacing, Prev: Manipulating Filling and Adjusting, Up: gtroff Reference
5006 5.8 Manipulating Hyphenation
5007 ============================
5009 Here a description of requests which influence hyphenation.
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:
5017 The default argument if MODE is omitted. Hyphenate without
5018 restrictions. This is also the start-up value of `gtroff'.
5021 Do not hyphenate the last word on a page or column.
5024 Do not hyphenate the last two characters of a word.
5027 Do not hyphenate the first two characters of a word.
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.
5033 The current hyphenation restrictions can be found in the read-only
5034 number register `.hy'.
5036 The hyphenation mode is associated with the current environment
5037 (*note Environments::).
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
5044 The hyphenation mode is associated with the current environment
5045 (*note Environments::).
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.
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
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:
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
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.
5080 This request is ignored if there is no parameter.
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.
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.
5096 The `\:' escape inserts a zero-width break point (that is, the
5097 word breaks but without adding a hyphen).
5100 ... check the /var/log/\:httpd/\:access_log file ...
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.
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.
5113 The hyphenation character is associated with the current
5114 environment (*note Environments::).
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.
5123 It should have the same format as (simple) TeX patterns files.
5124 More specifically, the following scanning rules are implemented.
5126 * A percent sign starts a comment (up to the end of the line)
5127 even if preceded by a backslash.
5129 * No support for `digraphs' like `\$'.
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
5135 * No macro expansion.
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.
5142 * Similarly, `\hyphenation{...}' gives a list of hyphenation
5145 * `\endinput' is recognized also.
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).
5151 If no `hpf' request is specified (either in the document or in a
5152 macro package), `gtroff' won't hyphenate at all.
5154 The `hpfa' request appends a file of patterns to the current list.
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.
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').
5170 A second call to `hpf' (for the same language) will replace the
5171 hyphenation patterns with the new ones.
5173 Invoking `hpf' causes an error if there is no current hyphenation
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.
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):
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')
5209 This request is ignored if it has no parameter.
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::).
5220 A negative argument resets the hyphenation margin to zero, emitting
5221 a warning of type `range'.
5223 The current hyphenation margin is available in the `.hym' read-only
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::).
5236 A negative argument resets the hyphenation space to zero, emitting
5237 a warning of type `range'.
5239 The current hyphenation space is available in the `.hys' read-only
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
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'.
5264 The current hyphenation language is available as a string in the
5265 read-only number register `.hla'.
5268 .ds curr_language \n[.hla]
5274 File: groff, Node: Manipulating Hyphenation-Footnotes, Up: Manipulating Hyphenation
5276 (1) "Soft hyphen character" is a misnomer since it is an output
5280 File: groff, Node: Manipulating Spacing, Next: Tabs and Fields, Prev: Manipulating Hyphenation, Up: gtroff Reference
5282 5.9 Manipulating Spacing
5283 ========================
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'.
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
5318 The amount of discarded space is available in the number register
5321 To protect `sp' against vertical traps, use the `vpt' request:
5329 -- Request: .ls [nnn]
5331 Output NNN-1 blank lines after each line of text. With no
5332 argument, `gtroff' uses the previous value before the last `ls'
5336 .ls 2 \" This causes double-spaced output
5337 .ls 3 \" This causes triple-spaced output
5338 .ls \" Again double-spaced
5340 The line spacing is associated with the current environment (*note
5343 The read-only number register `.L' contains the current line
5346 *Note Changing Type Sizes::, for the requests `vs' and `pvs' as
5347 alternatives to `ls'.
5349 -- Escape: \x'spacing'
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.
5360 *Note Escapes::, for details on parameter delimiting characters.
5362 The `.a' read-only number register contains the most recent
5363 (nonnegative) extra vertical line space.
5365 Using `\x' can be necessary in combination with the `\b' escape,
5366 as the following example shows.
5369 This is a test with the \[rs]b escape.
5371 This is a test with the \[rs]b escape.
5373 This is a test with \b'xyz'\x'-1m'\x'1m'.
5375 This is a test with the \[rs]b escape.
5377 This is a test with the \[rs]b escape.
5382 This is a test with the \b escape.
5383 This is a test with the \b escape.
5385 This is a test with y.
5387 This is a test with the \b escape.
5388 This is a test with the \b escape.
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.
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).
5408 File: groff, Node: Tabs and Fields, Next: Character Translations, Prev: Manipulating Spacing, Up: gtroff Reference
5410 5.10 Tabs and Fields
5411 ====================
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).
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.
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).
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
5432 .ta 1i 2i 3i 4i 5i 6i
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
5440 .ta 1i +1i +1i +1i +1i +1i
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.
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.
5457 Example: `4c +6c T 3c 5c 2c' is equivalent to `4c 10c 13c 18c 20c
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:
5470 * The default unit of the `ta' request is `m'.
5472 * A tab stop is converted into a non-breakable horizontal
5473 movement which can be neither stretched nor squeezed. For
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:
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.
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
5503 .ds ZZ foo\tbar\tfoobar
5504 .ds ZZZ foo\tbar\tfoo\tbar
5513 which produces the following output:
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.
5526 * Tab stops are associated with the current environment (*note
5529 * Calling `ta' without an argument removes all tab stops.
5531 * The start-up value of `gtroff' is `T 0.8i'.
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.
5538 .ds tab-string \n[.tabs]
5542 The `troff' version of the Plan 9 operating system uses register
5543 `.S' for the same purpose.
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::)
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
5560 For example, the following code:
5571 in normal mode, results in the output
5576 in line-tabs mode, the same code outputs
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.
5591 File: groff, Node: Tabs and Fields-Footnotes, Up: Tabs and Fields
5593 (1) "Tab repetition character" is a misnomer since it is an output
5597 File: groff, Node: Leaders, Next: Fields, Prev: Tabs and Fields, Up: Tabs and Fields
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
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
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
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
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.
5632 .ds entry 1.1\tFoo\a\t12
5640 1.1 Foo.......................................... 12
5643 File: groff, Node: Leaders-Footnotes, Up: Leaders
5645 (1) "Leader repetition character" is a misnomer since it is an
5649 File: groff, Node: Fields, Prev: Leaders, Up: Tabs and Fields
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
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::).
5682 and here the result:
5690 File: groff, Node: Character Translations, Next: Troff and Nroff Mode, Prev: Tabs and Fields, Up: gtroff Reference
5692 5.11 Character Translations
5693 ===========================
5695 The control character (`.') and the no-break control character (`'')
5696 can be changed with the `cc' and `c2' requests, respectively.
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
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::).
5711 Disable the escape mechanism completely. After executing this
5712 request, the backslash character `\' no longer starts an escape
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:
5719 .\" This is a simplified version of the
5720 .\" .BR request from the man macro package
5724 . while (\n[.$] >= 2) \{\
5725 . as result \fB\$1\fR\$2
5728 . if \n[.$] .as result \fB\$1
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.
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.
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.
5752 The `ecr' request restores the escape character saved with `ecs'.
5753 Without a previous call to `ecs', this request sets the escape
5759 Print the current escape character (which is the backslash
5760 character `\' by default).
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
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
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:
5782 .ds { \v'-.3m'\s'\En[.s]*60/100'
5785 Another example to demonstrate the differences between the various
5786 escape sequences, using a strange escape character, `-'.
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.
5802 If the escape character followed by itself is a valid escape
5803 sequence, only `\E' yields the expected result:
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.
5832 The first backslash is consumed while the macro is read, and the
5833 second is swallowed while exexuting macro `foo'.
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).
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 (`\ ').
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.
5853 * Special characters (`\(XX', `\[XXX]', `\C'XXX'', `\'', `\`',
5854 `\-', `\_'), glyphs defined with the `char' request, and
5855 numbered glyphs (`\N'XXX'') can be translated also.
5857 * The `\e' escape can be translated also.
5859 * Characters can be mapped onto the `\%' and `\~' escapes (but
5860 `\%' and `\~' can't be mapped onto another glyph).
5862 * The following characters can't be translated: space (with one
5863 exception, see below), backspace, newline, leader (and `\a'),
5866 * Translations are not considered for finding the soft hyphen
5867 character set with the `shc' request.
5869 * The pair `C\&' (this is an arbitrary character C followed by
5870 the zero width space character) maps this character to
5878 It is even possible to map the space character to nothing:
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 \&'
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).
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'.
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.
5904 *Note Gtroff Internals::.
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.
5912 Consider the following translation:
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.
5923 The right way to write the above translation is
5928 With other words, the first argument of `tr' should be an
5929 input character or entity, and the second one a glyph entity.
5931 * Without an argument, the `tr' request is ignored.
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
5948 prints `b' to the standard error stream; if `trnt' is used instead
5949 of `tr' it prints `a'.
5952 File: groff, Node: Troff and Nroff Mode, Next: Line Layout, Prev: Character Translations, Up: gtroff Reference
5954 5.12 Troff and Nroff Mode
5955 =========================
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.
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'.
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').
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'.
5989 *Note Conditionals and Loops::, for more details on built-in
5993 File: groff, Node: Line Layout, Next: Line Control, Prev: Troff and Nroff Mode, Up: gtroff Reference
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.
6004 |<-----------ll------------>|
6005 +----+----+----------------------+----+
6007 +----+----+----------------------+----+
6009 |<--------paper width---------------->|
6011 These dimensions are:
6014 "Page offset" - this is the leftmost position of text on the final
6015 output, defining the "left margin".
6018 "Indentation" - this is the distance from the left margin where
6022 "Line length" - this is the distance from the left margin to right
6025 A simple demonstration:
6029 This is text without indentation.
6030 The line length has been set to 3\~inch.
6033 Now the left and right margins are both increased.
6036 Calling .in and .ll without parameters restore
6037 the previous values.
6042 This is text without indenta-
6043 tion. The line length has
6048 Calling .in and .ll without
6049 parameters restore the previ-
6052 -- Request: .po [offset]
6053 -- Request: .po +offset
6054 -- Request: .po -offset
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).
6064 The current page offset can be found in the read-only number
6067 If `po' is called without an argument, the page offset is reset to
6068 the previous value before the last call to `po'.
6082 -- Request: .in [indent]
6083 -- Request: .in +indent
6084 -- Request: .in -indent
6086 Set indentation to INDENT (or increment or decrement the current
6087 value by INDENT). This request causes a break. Initially, there
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'.
6094 The indentation is associated with the current environment (*note
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.
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
6105 The current indentation (as set by `in') can be found in the
6106 read-only number register `.i'.
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.
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.
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.
6126 The effect of `ti' is delayed until a partially collected line (if
6127 it exists) is output.
6129 The read-only number register `.in' is the indentation that applies
6130 to the current output line.
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.
6136 -- Request: .ll [length]
6137 -- Request: .ll +length
6138 -- Request: .ll -length
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
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.
6152 The line length is associated with the current environment (*note
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.
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.
6164 File: groff, Node: Line Control, Next: Page Layout, Prev: Line Layout, Up: gtroff Reference
6169 It is important to understand how `gtroff' handles input and output
6172 Many escapes use positioning relative to the input line. For
6176 This is a \h'|1.2i'test.
6188 The main usage of this feature is to define macros which act exactly
6189 at the place where called.
6192 .\" A simple macro to underline a word
6194 . nop \\$1\l'|0\[ul]'
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
6202 `gtroff' makes a difference between input and output line
6203 continuation; the latter is also called "interrupting" a line.
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.
6217 The `|' operator is also affected.
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.
6225 The visual results depend on whether no-fill mode is active.
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.
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.
6247 Note that an intervening control line which causes a break is
6248 stronger than `\c', flushing out the current partial line in the
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::).
6256 File: groff, Node: Page Layout, Next: Page Control, Prev: Line Control, Up: gtroff Reference
6261 `gtroff' provides some very primitive operations for controlling page
6264 -- Request: .pl [length]
6265 -- Request: .pl +length
6266 -- Request: .pl -length
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'.
6272 The current setting can be found in the read-only number register
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.
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).
6283 If no argument or an invalid argument is given, `pl' sets the page
6286 `gtroff' provides several operations which help in setting up top
6287 and bottom titles (or headers and footers).
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).
6297 Without argument, `tl' is ignored.
6301 * A title line is not restricted to the top or bottom of a page.
6303 * `tl' prints the title line immediately, ignoring a partially
6304 filled line (which stays untouched).
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.
6311 * `tl' accepts the same parameter delimiting characters as the
6312 `\A' escape; see *Note Escapes::.
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'.
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::).
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.
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.
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 `%'.
6351 File: groff, Node: Page Control, Next: Fonts and Symbols, Prev: Page Layout, Up: gtroff Reference
6356 -- Request: .bp [page]
6357 -- Request: .bp +page
6358 -- Request: .bp -page
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::.
6368 .de newpage \" define macro
6370 'sp .5i \" vertical space
6371 .tl 'left top'center top'right top' \" title
6372 'sp .3i \" vertical space
6375 `bp' has no effect if not called within the top-level diversion
6376 (*note Diversions::).
6378 The read-write register `%' holds the current page number.
6380 The number register `.pe' is set to 1 while `bp' is active. *Note
6381 Page Location Traps::.
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
6393 For example, to make sure that no fewer than 2 lines get orphaned,
6394 do the following before each paragraph:
6400 `ne' will then automatically cause a page break if there is space
6403 -- Request: .sv [space]
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
6414 Both `sv' and `os' ignore no-space mode. While the `sv' request
6415 allows negative values for SPACE, `os' will ignore them.
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.
6425 Consider the following:
6453 Without resetting `nl' to a negative value, the just planted trap
6454 would be active beginning with the _next_ page, not the current
6457 *Note Diversions::, for a comparison with the `.h' and `.d'
6461 File: groff, Node: Fonts and Symbols, Next: Sizes, Prev: Page Control, Up: gtroff Reference
6463 5.17 Fonts and Symbols
6464 ======================
6466 `gtroff' can switch fonts at any point in the text.
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).
6480 * Artificial Fonts::
6481 * Ligatures and Kerning::
6484 File: groff, Node: Changing Fonts, Next: Font Families, Prev: Fonts and Symbols, Up: Fonts and Symbols
6486 5.17.1 Changing Fonts
6487 ---------------------
6489 -- Request: .ft [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).
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).
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.
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.
6510 The example below produces two identical lines.
6519 eggs, bacon, \fBspam\fP and sausage.
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:
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.
6533 *Note Font Positions::, for an alternative syntax.
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.
6543 File: groff, Node: Font Families, Next: Font Positions, Prev: Changing Fonts, Up: Fonts and Symbols
6545 5.17.2 Font Families
6546 --------------------
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.
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'.
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::).
6560 -- Request: .fam [family]
6561 -- Register: \n[.fam]
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.
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
6578 .fam H \" helvetica family
6579 spam, \" used font is family H + style R = HR
6580 .ft B \" family H + style B = font HB
6582 .fam T \" times family
6583 spam, \" used font is family T + style B = TB
6584 .ft AR \" font AR (not a style)
6586 .ft R \" family T + style R = font TR
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
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.
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.
6616 N must be a non-negative integer value.
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
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.
6639 In the following example, we want to access the POSTSCRIPT font
6640 `FooBar' from the font family `Foo':
6645 => warning: can't find font `FooR'
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
6651 A solution to this problem is to use a dummy font like the
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'
6661 *Note Font Positions::.
6664 File: groff, Node: Font Positions, Next: Using Symbols, Prev: Font Families, Up: Fonts and Symbols
6666 5.17.3 Font Positions
6667 ---------------------
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.
6673 -- Request: .fp pos font [external-name]
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
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::).
6688 .nr save-font \n[.f]
6690 ... text text text ...
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
6698 .fp \n[.fp] NEATOFONT
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.
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.
6717 Both the `ft' request and the `\f' escape have alternative syntax
6718 forms to access font positions.
6724 Change the current font position to NNN (one-digit position N,
6725 two-digit position NN), which must be a non-negative integer.
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).
6736 .ft \" switch back to font 1
6740 this is font 1 again
6742 *Note Changing Fonts::, for the standard syntax form.
6745 File: groff, Node: Using Symbols, Next: Special Fonts, Prev: Font Positions, Up: Fonts and Symbols
6747 5.17.4 Using Symbols
6748 --------------------
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
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
6770 Here the exact rules how `gtroff' searches a given symbol:
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.
6775 * Check the current font.
6777 * If the symbol has been defined with the `fchar' request, use it.
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.
6783 * If the symbol has been defined with the `fschar' request for the
6784 current font, use it.
6786 * Check all fonts in the order of appearance in the last `special'
6789 * If the symbol has been defined with the `schar' request, use it.
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:
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
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.
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.
6822 *Note Font Files::, and *Note Special Fonts::, for more details.
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
6829 man -Tdvi groff_char > groff_char.dvi
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:
6836 groff -Tdvi -mec -man groff_char.7 > groff_char.dvi
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)".
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.
6855 * A glyph representing more than a single input character will be
6858 `u' COMPONENT1 `_' COMPONENT2 `_' COMPONENT3 ...
6860 Example: `u0045_0302_0301'.
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
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
6879 * glyph names of the GGL can't be used in composite glyph names; for
6880 example, `^E_u0301' is invalid.
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::)
6890 If NAME is undefined, a warning of type `char' is generated, and
6891 the escape is ignored. *Note Debugging::, for information about
6894 groff resolves `\[...]' with more than a single component as
6897 * Any component which is found in the GGL will be converted to
6900 * Any component `uXXXX' which is found in the list of
6901 decomposable glyphs will be decomposed.
6903 * The resulting elements are then concatenated with `_'
6904 inbetween, dropping the leading `u' in all elements but the
6907 No check for the existence of any component (similar to `tr'
6908 request) will be done.
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'.
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).
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'.
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.
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.
6944 This mapping is based on glyph names only; no check for the
6945 existence of either glyph is done.
6947 A set of default mappings for many accents can be found in the file
6948 `composite.tmac' which is loaded at start-up.
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:
6960 .char \[phone] \f[ZD]\N'37'
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
6968 No kerning is applied to glyphs accessed with `\N'.
6970 Some escape sequences directly map onto special glyphs.
6973 This is a backslash followed by the apostrophe character, ASCII
6974 character `0x27' (EBCDIC character `0x7D'). The same as `\[aa]',
6978 This is a backslash followed by ASCII character `0x60' (EBCDIC
6979 character `0x79' usually). The same as `\[ga]', the grave accent.
6982 This is the same as `\[-]', the minus sign in the current font.
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.
6993 The character ends sentences (initially characters `.?!' have
6997 Lines can be broken before the character (initially no
6998 characters have this property).
7001 Lines can be broken after the character (initially the
7002 character `-' and the symbols `\[hy]' and `\[em]' have this
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
7012 The character overlaps vertically if used as vertical line
7013 building element. Initially symbol `\[br]' has this property.
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).
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.
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.
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'.
7050 Note that the `tr' and `trin' requests take precedence if `char'
7051 accesses the same symbol.
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
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
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.
7080 *Note Using Symbols::, for a detailed description of the glyph
7081 searching mechanism in `gtroff'.
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.
7088 It is possible to omit the whitespace between arguments.
7090 The request `rfschar' removes glyph definitions defined with
7091 `fschar' for glyph f.
7093 *Note Special Characters::.
7096 File: groff, Node: Using Symbols-Footnotes, Up: Using Symbols
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.
7106 (2) `\C' is actually a misnomer since it accesses an output glyph.
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.
7113 (4) `char' is a misnomer since an output glyph is defined.
7116 File: groff, Node: Special Fonts, Next: Artificial Fonts, Prev: Using Symbols, Up: Fonts and Symbols
7118 5.17.5 Special Fonts
7119 --------------------
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
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'.
7129 Usually, only non-TTY devices have special fonts.
7131 -- Request: .special [s1 s2 ...]
7132 -- Request: .fspecial f [s1 s2 ...]
7133 Use the `special' request to define special fonts. Initially, this
7136 Use the `fspecial' request to designate special fonts only when
7137 font F is active. Initially, this list is empty.
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.
7143 All fonts which appear in a call to `special' or `fspecial' are
7146 *Note Using Symbols::, for the exact search order of glyphs.
7149 File: groff, Node: Artificial Fonts, Next: Ligatures and Kerning, Prev: Special Fonts, Up: Fonts and Symbols
7151 5.17.6 Artificial Fonts
7152 -----------------------
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.
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'.
7168 The read-only number register `.height' contains the font height as
7171 Currently, only the `-Tps' device supports this feature.
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:
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
7187 \H'+5'test \H'+5'test
7189 prints the word `test' twice with the same font height (five
7190 points larger than the current font size).
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.
7197 The read-only number register `.slant' contains the font slant as
7200 Currently, only the `-Tps' device supports this feature.
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:
7209 This request is incorrectly documented in the original UNIX troff
7210 manual; the slant is always set to an absolute value.
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.
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.
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.
7232 The `ul' request does not underline spaces.
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).
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.
7243 -- Request: .bd font [offset]
7244 -- Request: .bd font1 font2 [offset]
7246 Artificially create a bold font by printing each glyph twice,
7249 Two syntax forms are available.
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
7257 FONT can be either a non-negative font position or the name
7260 OFFSET is available in the `.b' read-only register if a
7261 special font is active; in the `bd' request, its default unit
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.
7270 This affects special fonts only (either set up with the
7271 `special' command in font files or with the `fspecial'
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.
7282 Default scaling indicator for EM-SIZE is `z'; WIDTH is an integer.
7285 File: groff, Node: Ligatures and Kerning, Prev: Artificial Fonts, Up: Fonts and Symbols
7287 5.17.7 Ligatures and Kerning
7288 ----------------------------
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.
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).
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.
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).
7314 Setting the ligature mode to 2 enables the two-character ligatures
7315 (fi, fl, and ff) and disables the three-character ligatures (ffi
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
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,
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'.
7335 *Note Font File Format::.
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.
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.
7352 The default scaling indicator is `z' for S1 and S2, `p' for N1 and
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.
7359 Sometimes, when typesetting letters of different fonts, more or less
7360 space at such boundaries are needed. There are two escapes to help
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".
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
7386 Insert a zero-width character, which is invisible. Its intended
7387 use is to stop interaction of a character with its surrounding.
7389 * It prevents the insertion of extra space after an
7390 end-of-sentence character.
7400 * It prevents interpretation of a control character at the
7401 beginning of an input line.
7405 => warning: `Test' not defined
7409 * It prevents kerning between two glyphs.
7411 * It is needed to map an arbitrary character to nothing in the
7412 `tr' request (*note Character Translations::).
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.
7419 Its main usage is in macro definitions to protect against arguments
7420 starting with a control character.
7432 =>This is a test.' This is a test.
7436 =>This is a test.' This is a test.
7440 File: groff, Node: Sizes, Next: Strings, Prev: Fonts and Symbols, Up: gtroff Reference
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.
7454 The difference between type size and vertical spacing is known, by
7455 typesetters, as "leading" (this is pronounced `ledding').
7459 * Changing Type Sizes::
7460 * Fractional Type Sizes::
7463 File: groff, Node: Sizes-Footnotes, Up: Sizes
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.
7473 File: groff, Node: Changing Type Sizes, Next: Fractional Type Sizes, Prev: Sizes, Up: Sizes
7475 5.18.1 Changing Type Sizes
7476 --------------------------
7478 -- Request: .ps [size]
7479 -- Request: .ps +size
7480 -- Request: .ps -size
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.
7488 Default scaling indicator of `size' is `z'. If `size' is zero or
7489 negative, it is set to 1u.
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.
7495 `.s' is associated with the current environment (*note
7503 wink, wink, \s+2nudge, nudge,\s+8 say no more!
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:
7511 Set the point size to N points. N must be either 0 or in the
7516 Increase or decrease the point size by N points. N must be
7520 Set the point size to NN points. NN must be exactly two
7527 Increase or decrease the point size by NN points. NN must be
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:
7537 *Note Fractional Type Sizes::, for yet another syntactical form of
7538 using the `\s' escape.
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.
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.
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
7555 -- Request: .vs [space]
7556 -- Request: .vs +space
7557 -- Request: .vs -space
7559 Change (increase, decrease) the vertical spacing by SPACE. The
7560 default scaling indicator is `p'.
7562 If `vs' is called without an argument, the vertical spacing is
7563 reset to the previous value before the last call to `vs'.
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).
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.
7573 The read-only number register `.v' contains the current vertical
7574 spacing; it is associated with the current environment (*note
7577 The effective vertical line spacing consists of four components.
7578 Breaking a line causes the following actions (in the given order).
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.
7584 * Move the current point vertically by the vertical line spacing as
7585 set with the `vs' request.
7587 * Output the current line.
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.
7593 * Move the current point vertically by the "post-vertical line
7594 spacing" as set with the `pvs' request.
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.
7601 *Note Manipulating Spacing::, for more details on the `\x' escape
7602 and the `ls' request.
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'.
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'.
7614 `gtroff' creates a warning of type `range' if SPACE is zero or
7615 negative; the vertical spacing is then set to zero.
7617 The read-only number register `.pvs' contains the current
7618 post-vertical spacing; it is associated with the current
7619 environment (*note Environments::).
7622 File: groff, Node: Fractional Type Sizes, Prev: Changing Type Sizes, Up: Sizes
7624 5.18.2 Fractional Type Sizes
7625 ----------------------------
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).
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.
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.
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.
7655 -- Register: \n[.ps]
7656 A read-only number register returning the point size in scaled
7659 `.ps' is associated with the current environment (*note
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.
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.
7675 Both registers are associated with the current environment (*note
7678 The `\s' escape has the following syntax for working with fractional
7683 Set the point size to N scaled points; N is a numeric expression
7684 with a default scale indicator of `z'.
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'.
7700 File: groff, Node: Strings, Next: Conditionals and Loops, Prev: Sizes, Up: gtroff Reference
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).
7709 -- Request: .ds name [string]
7710 -- Request: .ds1 name [string]
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::.
7727 This is \*[foo nice].
7728 => This is a nice test.
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
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).
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.
7747 .ds UX \s-1UNIX\s0\u\s-3tm\s0\d \" UNIX trademark
7749 Instead the comment should be put on another line or have the
7750 comment escape adjacent with the end of the string.
7753 .ds UX \s-1UNIX\s0\u\s-3tm\s0\d\" UNIX trademark
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.
7760 .ds sign " Yours in a white wine sauce,
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.
7767 .ds foo lots and lots \
7768 of text are on these \
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.
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.
7782 .ds aa The value of xxx is \\n[xxx].
7783 .ds1 bb The value of xxx ix \\n[xxx].
7788 => warning: number register `[' not defined
7789 => The value of xxx is 0xxx].
7791 => The value of xxx ix 12345.
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.
7803 => This is a funny test.
7805 .ds yyy a funny test
7808 => This is a funny test.
7810 Diversions and boxes can be also called with string syntax.
7812 Another consequence is that you can copy one-line diversions or
7820 .ds yyy This is \*[xxx]\c
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.
7828 Copying diversions longer than a single output line produces
7838 .ds yyy This is \*[xxx]\c
7840 => test This is a funny.
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.
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
7864 => This is a funny test.
7866 *Note Gtroff Internals::, for more information.
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.
7875 .as sign " with shallots, onions and garlic,
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.
7883 Rudimentary string manipulation routines are given with the next two
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,
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.
7908 .ds xxx abcd\h'3i'efgh
7914 -- Request: .rn xx yy
7915 Rename the request, macro, diversion, or string XX to YY.
7918 Remove the request, macro, diversion, or string XX. `gtroff'
7919 treats subsequent invocations as if the object had never been
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.
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'.
7936 *Note Identifiers::, and *Note Comments::.
7939 File: groff, Node: Conditionals and Loops, Next: Writing Macros, Prev: Strings, Up: gtroff Reference
7941 5.20 Conditionals and Loops
7942 ===========================
7946 * Operators in Conditionals::
7951 File: groff, Node: Operators in Conditionals, Next: if-else, Prev: Conditionals and Loops, Up: Conditionals and Loops
7953 5.20.1 Operators in Conditionals
7954 --------------------------------
7956 In `if' and `while' requests, there are several more operators
7961 True if the current page is even or odd numbered (respectively).
7964 True if the document is being processed in nroff mode (i.e., the
7965 `.nroff' command has been issued).
7968 True if the document is being processed in troff mode (i.e., the
7969 `.troff' command has been issued).
7972 Always false. This condition is for compatibility with other
7973 `troff' versions only (identifying a `-Tversatec' device).
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:
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.
7998 True if there is a number register named XXX.
8001 True if there is a string, macro, diversion, or request named XXX.
8004 True if there is a color named XXX.
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.
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.
8017 This test doesn't load the complete font but only its header to
8018 verify its validity.
8021 True if style STYLE has been registered. Font translation is
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.
8036 A whitespace after `!' always evaluates to zero (this bizarre
8037 behaviour is due to compatibility with UNIX `troff').
8047 It is possible to omit the whitespace before the argument to the
8048 `r', `d', and `c' operators.
8050 *Note Expressions::.
8053 File: groff, Node: Operators in Conditionals-Footnotes, Up: Operators in Conditionals
8055 (1) The created output nodes must be identical. *Note Gtroff
8058 (2) The name of this conditional operator is a misnomer since it
8059 tests names of output glyphs.
8062 File: groff, Node: if-else, Next: while, Prev: Operators in Conditionals, Up: Conditionals and Loops
8067 `gtroff' has if-then-else constructs like other languages, although the
8068 formatting can be painful.
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.
8080 .if ((\n[xxx] == 1) & (\n[yyy] == 2)) true
8084 -- Request: .nop anything
8085 Executes ANYTHING. This is similar to `.if 1'.
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.
8093 .ie n .ls 2 \" double-spacing in nroff
8094 .el .ls 1 \" single-spacing in troff
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
8116 *Note Expressions::.
8119 File: groff, Node: while, Prev: if-else, Up: Conditionals and Loops
8124 `gtroff' provides a looping construct using the `while' request, which
8125 is used much like the `if' (and related) requests.
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.
8133 .while (\na < 9) \{\
8137 => 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
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
8152 . while (\\n[num] > 0) \{\
8153 . \" many lines of code
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.
8164 . if (\\n[num] > 0) \{\
8165 . \" many lines of code
8176 Note that the number of available recursion levels is set
8177 to 1000 (this is a compile-time constant value of `gtroff').
8179 * The closing brace of a `while' body must end a line.
8184 . while (\n[a] < 10) \{\
8191 Break out of a `while' loop. Be sure not to confuse this with the
8192 `br' request (causing a line break).
8194 -- Request: .continue
8195 Finish the current iteration of a `while' loop, immediately
8196 restarting the next iteration.
8198 *Note Expressions::.
8201 File: groff, Node: Writing Macros, Next: Page Motions, Prev: Conditionals and Loops, Up: gtroff Reference
8206 A "macro" is a collection of text and embedded commands which can be
8207 invoked multiple times. Use macros to define common operations.
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'.
8218 There can be whitespace after the first dot in the line containing
8219 the ending token (either `.' or macro `END').
8221 Here a small example macro called `P' which causes a break and
8222 inserts some vertical space. It could be used to separate
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.
8236 \# a dummy macro to avoid a warning
8242 . nop \f[B]Hallo \\\\$1!\f[]
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'.
8254 The `de1' request turns off compatibility mode while executing the
8255 macro. On entry, the current compatibility mode is saved and
8262 The value of xxx is \\n[xxx].
8265 The value of xxx ix \\n[xxx].
8271 => warning: number register `[' not defined
8272 => The value of xxx is 0xxx].
8274 => The value of xxx ix 12345.
8276 The `dei' request defines a macro indirectly. That is, it expands
8277 strings whose names are NAME or END before performing the append.
8291 The `dei1' request is similar to `dei' but with compatibility mode
8292 switched off during execution of the defined macro.
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.
8301 Using `trace.tmac', you can trace calls to `de' and `de1'.
8303 Note that macro identifiers are shared with identifiers for
8304 strings and diversions.
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:
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.
8325 The `ami' request appends indirectly, meaning that `gtroff'
8326 expands strings whose names are NAME or END before performing the
8329 The `ami1' request is similar to `ami' but compatibility mode is
8330 switched off during execution of the defined macro.
8332 Using `trace.tmac', you can trace calls to `am' and `am1'.
8334 *Note Strings::, for the `als' request to rename a macro.
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
8342 -- Request: .return [anything]
8343 Exit a macro, immediately returning to the caller.
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'.
8355 File: groff, Node: Copy-in Mode, Next: Parameters, Prev: Writing Macros, Up: Writing Macros
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.
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.
8372 The following example prints the numbers 20 and 10:
8384 File: groff, Node: Parameters, Prev: Copy-in Mode, Up: Writing Macros
8389 The arguments to a macro or string can be examined using a variety of
8393 The number of arguments passed to a macro or string. This is a
8394 read-only number register.
8396 Note that the `shift' request can change its value.
8398 Any individual argument can be retrieved with one of the following
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.
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.
8418 The register `.$' is adjusted accordingly.
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::).
8431 The name used to invoke the current macro. The `als' request can
8432 make a macro have more than one name.
8438 . tm \\$0: Houston, we have a problem.
8443 .als foo generic-macro
8444 .als bar generic-macro
8447 *Note Request and Macro Arguments::.
8450 File: groff, Node: Page Motions, Next: Drawing Requests, Prev: Writing Macros, Up: gtroff Reference
8455 *Note Manipulating Spacing::, for a discussion of the main request for
8456 vertical motion, `sp'.
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).
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
8473 Here a primitive solution for a two-column macro.
8476 .nr column-length 1.5i
8478 .nr bottom-margin 1m
8485 . ll \\n[column-length]u
8486 . wh -\\n[bottom-margin]u 2c-trap
8493 . ie \\n[right-side] \{\
8495 . po -(\\n[column-length]u + \\n[column-gap]u)
8497 . wh -\\n[bottom-margin]u
8500 . \" switch to right side
8502 . po +(\\n[column-length]u + \\n[column-gap]u)
8511 This is a small test which shows how the
8512 rt request works in combination with mk.
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
8523 This is a small test which shows how the
8524 rt request works in combination with mk.
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.
8533 The following escapes give fine control of movements about the page.
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.
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
8549 There are some special-case escapes for vertical motion.
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'.
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.
8569 There are a number of special-case escapes for horizontal motion.
8572 An unbreakable and unpaddable (i.e. not expanded during filling)
8573 space. (Note: This is a backslash followed by a space.)
8576 An unbreakable space that stretches like a normal inter-word space
8577 when a line is adjusted.
8580 A 1/6th em space. Ignored for TTY output devices (rounded to
8584 A 1/12th em space. Ignored for TTY output devices (rounded to
8588 A space the size of a digit.
8590 The following string sets the TeX logo:
8593 .ds TeX T\h'-.1667m'\v'.224m'E\v'-.224m'\h'-.125m'X
8598 -- Register: \n[rst]
8599 -- Register: \n[rsb]
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).
8608 The length of the string `abc' is \w'abc'u.
8609 => The length of the string `abc' is 72u.
8611 Font changes may occur in TEXT which don't affect current settings.
8613 After use, `\w' sets several registers:
8617 The highest and lowest point of the baseline, respectively,
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.
8628 Defines the kinds of glyphs occurring in TEXT:
8631 only short glyphs, no descenders or tall glyphs.
8634 at least one descender.
8637 at least one tall glyph.
8640 at least one each of a descender and a tall glyph.
8643 The amount of horizontal space (possibly negative) that
8644 should be added to the last glyph before a subscript.
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.
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.
8660 The current horizontal position at the input line.
8663 A read-only number register containing the current horizontal
8664 output position (relative to the current indentation).
8667 Overstrike glyphs A, B, C, ...; the glyphs are centered, and the
8668 resulting spacing is the largest width of the affected glyphs.
8671 Print glyph G with zero width, i.e., without spacing. Use this to
8672 overstrike glyphs left-aligned.
8674 -- Escape: \Z'anything'
8675 Print ANYTHING, then restore the horizontal and vertical position.
8676 The argument may not contain tabs or leaders.
8678 The following is an example of a strike-through macro:
8683 \Z@\v'-.25m'\l'\\n[ww]u'@\\$1
8688 an actual emergency!