1GROFF(7) Miscellaneous Information Manual GROFF(7)
2
3
4
6 groff - a short reference for the GNU roff language
7
9 The name groff stands for GNU roff and is the free implementation of
10 the roff type-setting system. See roff(7) for a survey and the back‐
11 ground of the groff system.
12
13 This document provides only short descriptions of roff language ele‐
14 ments. Groff: The GNU Implementation of troff, by Trent A. Fisher and
15 Werner Lemberg, is the primary groff manual, and is written in Texinfo.
16 You can browse it interactively with “info groff”.
17
18 Historically, the roff language was called troff. groff is compatible
19 with the classical system and provides proper extensions. So in GNU,
20 the terms roff, troff, and groff language could be used as synonyms.
21 However troff slightly tends to refer more to the classical aspects,
22 whereas groff emphasizes the GNU extensions, and roff is the general
23 term for the language.
24
25 The general syntax for writing groff documents is relatively easy, but
26 writing extensions to the roff language can be a bit harder.
27
28 The roff language is line-oriented. There are only two kinds of lines,
29 control lines and text lines. The control lines start with a control
30 character, by default a period “.” or a single quote “'”; all other
31 lines are text lines.
32
33 Control lines represent commands, optionally with arguments. They have
34 the following syntax. The leading control character can be followed by
35 a command name; arguments, if any, are separated by spaces (but not tab
36 characters) from the command name and among themselves, for example,
37
38 .command_name arg1 arg2
39
40 For indentation, any number of space or tab characters can be inserted
41 between the leading control character and the command name, but the
42 control character must be on the first position of the line.
43
44 Text lines represent the parts that is printed. They can be modified
45 by escape sequences, which are recognized by a leading backslash ‘\’.
46 These are in-line or even in-word formatting elements or functions.
47 Some of these take arguments separated by single quotes “'”, others are
48 regulated by a length encoding introduced by an open parenthesis ‘(’ or
49 enclosed in brackets ‘[’ and ‘]’.
50
51 The roff language provides flexible instruments for writing language
52 extension, such as macros. When interpreting macro definitions, the
53 roff system enters a special operating mode, called the copy mode.
54
55 The copy mode behaviour can be quite tricky, but there are some rules
56 that ensure a safe usage.
57
58 1. Printable backslashes must be denoted as \e. To be more pre‐
59 cise, \e represents the current escape character. To get a
60 backslash glyph, use \(rs or \[rs].
61
62 2. Double all backslashes.
63
64 3. Begin all text lines with the special non-spacing character \&.
65
66 This does not produce the most efficient code, but it should work as a
67 first measure. For better strategies, see the groff Texinfo manual and
68 groff_tmac(5).
69
70 Reading roff source files is easier, just reduce all double backslashes
71 to a single one in all macro definitions.
72
74 The roff language elements add formatting information to a text file.
75 The fundamental elements are predefined commands and variables that
76 make roff a full-blown programming language.
77
78 There are two kinds of roff commands, possibly with arguments. Re‐
79 quests are written on a line of their own starting with a dot ‘.’ or a
80 “'”, whereas Escape sequences are in-line functions and in-word format‐
81 ting elements starting with a backslash ‘\’.
82
83 The user can define her own formatting commands using the de request.
84 These commands are called macros, but they are used exactly like re‐
85 quests. Macro packages are pre-defined sets of macros written in the
86 groff language. A user's possibilities to create escape sequences her‐
87 self is very limited, only special characters can be mapped.
88
89 The groff language provides several kinds of variables with different
90 interfaces. There are pre-defined variables, but the user can define
91 her own variables as well.
92
93 String variables store character sequences. They are set with the ds
94 request and retrieved by the \* escape sequences. Strings can have
95 variables.
96
97 Register variables can store numerical values, numbers with a scale
98 unit, and occasionally string-like objects. They are set with the nr
99 request and retrieved by the \n escape sequences.
100
101 Environments allow the user to temporarily store global formatting pa‐
102 rameters like line length, font size, etc. for later reuse. This is
103 done by the ev request.
104
105 Fonts are identified either by a name or by an internal number. The
106 current font is chosen by the ft request or by the \f escape sequences.
107 Each device has special fonts, but the following fonts are available
108 for all devices. R is the standard font Roman. B is its bold counter‐
109 part. The italic font is called I and is available everywhere, but on
110 text devices it is displayed as an underlined Roman font. For the
111 graphical output devices, there exist constant-width pendants of these
112 fonts, CR, CI, and CB. On text devices, all glyphs have a constant
113 width anyway.
114
115 Glyphs are visual representation forms of characters. In groff, the
116 distinction between those two elements is not always obvious (and a
117 full discussion is beyond the scope of this man page). A first approx‐
118 imation is that glyphs have a specific size and colour and are taken
119 from a specific font; they can't be modified any more – characters are
120 the input, and glyphs are the output. As soon as an output line has
121 been generated, it no longer contains characters but glyphs. In this
122 man page, we use either ‘glyph’ or ‘character’, whatever is more appro‐
123 priate.
124
125 Moreover, there are some advanced roff elements. A diversion stores
126 (formatted) information into a macro for later usage. See
127 groff_tmac(5) for more details. A trap is a positional condition like
128 a certain number of lines from page top or in a diversion or in the in‐
129 put. Some action can be prescribed to be run automatically when the
130 condition is met.
131
132 More detailed information and examples can be found in the groff Tex‐
133 info manual.
134
136 There is a small set of characters that have a special controlling task
137 in certain conditions.
138
139 . A dot is only special at the beginning of a line or after the
140 condition in the requests if, ie, el, and while. There it is
141 the control character that introduces a request (or macro). By
142 using the cc request, the control character can be set to a dif‐
143 ferent character, making the dot ‘.’ a non-special character.
144
145 In all other positions, it just means a dot character. In text
146 paragraphs, it is advantageous to start each sentence at a line
147 of its own.
148
149 ' The single quote has two controlling tasks. At the beginning of
150 a line and in the conditional requests it is the non-breaking
151 control character. That means that it introduces a request like
152 the dot, but with the additional property that this request
153 doesn't cause a linebreak. By using the c2 request, the non-
154 break control character can be set to a different character.
155
156 As a second task, it is the most commonly used argument separa‐
157 tor in some functional escape sequences (but any pair of charac‐
158 ters not part of the argument do work). In all other positions,
159 it denotes the single quote or apostrophe character. Groff pro‐
160 vides a printable representation with the \(cq escape sequence.
161
162 " The double quote is used to enclose arguments in macros (but not
163 in requests and strings). In the ds and as requests, a leading
164 double quote in the argument is stripped off, making everything
165 else afterwards the string to be defined (enabling leading
166 whitespace). The escaped double quote \" introduces a comment.
167 Otherwise, it is not special. Groff provides a printable repre‐
168 sentation with the \(dq escape sequence.
169
170 \ The backslash usually introduces an escape sequence (this can be
171 changed with the ec request). A printed version of the escape
172 character is the \e escape; a backslash glyph can be obtained by
173 \(rs.
174
175 ( The open parenthesis is only special in escape sequences when
176 introducing an escape name or argument consisting of exactly two
177 characters. In groff, this behaviour can be replaced by the []
178 construct.
179
180 [ The opening bracket is only special in groff escape sequences;
181 there it is used to introduce a long escape name or long escape
182 argument. Otherwise, it is non-special, e.g. in macro calls.
183
184 ] The closing bracket is only special in groff escape sequences;
185 there it terminates a long escape name or long escape argument.
186 Otherwise, it is non-special.
187
188 space Space characters are only functional characters. They separate
189 the arguments in requests, macros, and strings, and the words in
190 text lines. They are subject to groff's horizontal spacing cal‐
191 culations. To get a defined space width, escape sequences like
192 ‘\ ’ (this is the escape character followed by a space), \|, \^,
193 or \h should be used.
194
195 newline
196 In text paragraphs, newlines mostly behave like space charac‐
197 ters. Continuation lines can be specified by an escaped new‐
198 line, i.e., by specifying a backslash ‘\’ as the last character
199 of a line.
200
201 tab If a tab character occurs during text the interpreter makes a
202 horizontal jump to the next pre-defined tab position. There is
203 a sophisticated interface for handling tab positions.
204
206 A numerical value is a signed or unsigned integer or float with or
207 without an appended scaling indicator. A scaling indicator is a one-
208 character abbreviation for a unit of measurement. A number followed by
209 a scaling indicator signifies a size value. By default, numerical val‐
210 ues do not have a scaling indicator, i.e., they are normal numbers.
211
212 The roff language defines the following scaling indicators.
213
214 c centimeter
215 i inch
216 P pica = 1/6 inch
217 p point = 1/72 inch
218 m em = the font size in points (approx. width of letter
219 ‘m’)
220 M 100th of an em
221 n en = em/2
222 u Basic unit for actual output device
223 v Vertical line space in basic units
224 s scaled point = 1/sizescale of a point (defined in font
225 DESC file)
226 f Scale by 65536.
227
228 Numerical expressions are combinations of the numerical values defined
229 above with the following arithmetical operators already defined in
230 classical troff.
231
232 + Addition
233 - Subtraction
234 * Multiplication
235 / Division
236 % Modulo
237 = Equals
238 == Equals
239 < Less than
240 > Greater than
241 <= Less or equal
242 >= Greater or equal
243 & Logical and
244 : Logical or
245 ! Logical not
246 ( Grouping of expressions
247 ) Close current grouping
248
249 Moreover, groff added the following operators for numerical expres‐
250 sions:
251
252 e1>?e2 The maximum of e1 and e2.
253 e1<?e2 The minimum of e1 and e2.
254 (c;e) Evaluate e using c as the default scaling indicator.
255
256 For details see the groff Texinfo manual.
257
259 Conditions occur in tests raised by the if, ie, and the while requests.
260 The following table characterizes the different types of conditions.
261
262 N A numerical expression N yields true if its value is
263 greater than 0.
264 !N True if the value of N is 0 (see below).
265 's1's2' True if string s1 is identical to string s2.
266 !'s1's2' True if string s1 is not identical to string s2 (see
267 below).
268 cch True if there is a glyph ch available.
269 dname True if there is a string, macro, diversion, or re‐
270 quest called name.
271 e Current page number is even.
272 o Current page number is odd.
273 mname True if there is a color called name.
274 n Formatter is nroff.
275 rreg True if there is a register named reg.
276 t Formatter is troff.
277 Ffont True if there exists a font named font.
278 Sstyle True if a style named style has been registered.
279
280 Note that the ! operator may only appear at the beginning of an ex‐
281 pression, and negates the entire expression. This maintains bug-com‐
282 patibility with AT&T troff.
283
285 This section provides a short reference for the predefined requests.
286 In groff, request, macro, and string names can be arbitrarily long. No
287 bracketing or marking of long names is needed.
288
289 Most requests take one or more arguments. The arguments are separated
290 by space characters (no tabs!); there is no inherent limit for their
291 length or number.
292
293 Some requests have optional arguments with a different behaviour. Not
294 all of these details are outlined here. Refer to the groff Texinfo
295 manual and groff_diff(7) for all details.
296
297 In the following request specifications, most argument names were cho‐
298 sen to be descriptive. Only the following denotations need clarifica‐
299 tion.
300
301 c denotes a single character.
302 font a font either specified as a font name or a font num‐
303 ber.
304 anything all characters up to the end of the line or within \{
305 and \}.
306 n is a numerical expression that evaluates to an integer
307 value.
308 N is an arbitrary numerical expression, signed or un‐
309 signed.
310 ±N has three meanings depending on its sign, described
311 below.
312
313 If an expression defined as ±N starts with a ‘+’ sign the resulting
314 value of the expression is added to an already existing value inherent
315 to the related request, e.g. adding to a number register. If the ex‐
316 pression starts with a ‘-’ the value of the expression is subtracted
317 from the request value.
318
319 Without a sign, N replaces the existing value directly. To assign a
320 negative number either prepend 0 or enclose the negative number in
321 parentheses.
322
323 Request Short Reference
324 . Empty line, ignored. Useful for structuring documents.
325 .\" anything
326 Complete line is a comment.
327 .ab string
328 Print string on standard error, exit program.
329 .ad Begin line adjustment for output lines in current adjust
330 mode.
331 .ad c Start line adjustment in mode c (c=l,r,c,b,n).
332 .af register c
333 Assign format c to register (c=l,i,I,a,A).
334 .aln alias register
335 Create alias name for register.
336 .als alias object
337 Create alias name for request, string, macro, or diversion
338 object.
339 .am macro Append to macro until .. is encountered.
340 .am macro end
341 Append to macro until .end is called.
342 .am1 macro
343 Same as .am but with compatibility mode switched off during
344 macro expansion.
345 .am1 macro end
346 Same as .am but with compatibility mode switched off during
347 macro expansion.
348 .ami macro
349 Append to a macro whose name is contained in the string reg‐
350 ister macro until .. is encountered.
351 .ami macro end
352 Append to a macro indirectly. macro and end are string reg‐
353 isters whose contents are interpolated for the macro name and
354 the end macro, respectively.
355 .ami1 macro
356 Same as .ami but with compatibility mode switched off during
357 macro expansion.
358 .ami1 macro end
359 Same as .ami but with compatibility mode switched off during
360 macro expansion.
361 .as stringvar anything
362 Append anything to stringvar.
363 .as1 stringvar anything
364 Same as .as but with compatibility mode switched off during
365 string expansion.
366 .asciify diversion
367 Unformat ASCII characters, spaces, and some escape sequences
368 in diversion.
369 .backtrace
370 Print a backtrace of the input on stderr.
371 .bd font N
372 Embolden font by N-1 units.
373 .bd S font N
374 Embolden Special Font S when current font is font.
375 .blm Unset the blank line macro.
376 .blm macro
377 Set the blank line macro to macro.
378 .box End current diversion.
379 .box macro
380 Divert to macro, omitting a partially filled line.
381 .boxa End current diversion.
382 .boxa macro
383 Divert and append to macro, omitting a partially filled line.
384 .bp Eject current page and begin new page.
385 .bp ±N Eject current page; next page number ±N.
386 .br Line break.
387 .brp Break output line; adjust if applicable.
388 .break Break out of a while loop.
389 .c2 Reset no-break control character to “'”.
390 .c2 c Set no-break control character to c.
391 .cc Reset control character to ‘.’.
392 .cc c Set control character to c.
393 .ce Center the next input line.
394 .ce N Center following N input lines.
395 .cf filename
396 Copy contents of file filename unprocessed to stdout or to
397 the diversion.
398 .cflags mode c1 c2 ...
399 Treat characters c1, c2, ... according to mode number.
400 .ch trap N
401 Change trap location to N.
402 .char c anything
403 Define entity c as string anything.
404 .chop object
405 Chop the last character off macro, string, or diversion ob‐
406 ject.
407 .class name c1 c2 ...
408 Assign a set of characters, character ranges, or classes c1,
409 c2, ... to name.
410 .close stream
411 Close the stream.
412 .color Enable colors.
413 .color N If N is zero disable colors, otherwise enable them.
414 .composite from to
415 Map glyph name from to glyph name to while constructing a
416 composite glyph name.
417 .continue Finish the current iteration of a while loop.
418 .cp Enable compatibility mode.
419 .cp N If N is zero disable compatibility mode, otherwise enable it.
420 .cs font N M
421 Set constant character width mode for font to N/36 ems with
422 em M.
423 .cu N Continuous underline in nroff, like .ul in troff.
424 .da End current diversion.
425 .da macro Divert and append to macro.
426 .de macro Define or redefine macro until .. is encountered.
427 .de macro end
428 Define or redefine macro until .end is called.
429 .de1 macro
430 Same as .de but with compatibility mode switched off during
431 macro expansion.
432 .de1 macro end
433 Same as .de but with compatibility mode switched off during
434 macro expansion.
435 .defcolor color scheme component
436 Define or redefine a color with name color. scheme can be
437 rgb, cym, cymk, gray, or grey. component can be single com‐
438 ponents specified as fractions in the range 0 to 1 (default
439 scaling indicator f), as a string of two-digit hexadecimal
440 color components with a leading #, or as a string of four-
441 digit hexadecimal components with two leading #. The color
442 default can't be redefined.
443 .dei macro
444 Define or redefine a macro whose name is contained in the
445 string register macro until .. is encountered.
446 .dei macro end
447 Define or redefine a macro indirectly. macro and end are
448 string registers whose contents are interpolated for the
449 macro name and the end macro, respectively.
450 .dei1 macro
451 Same as .dei but with compatibility mode switched off during
452 macro expansion.
453 .dei1 macro end
454 Same as .dei but with compatibility mode switched off during
455 macro expansion.
456 .device anything
457 Write anything to the intermediate output as a device control
458 function.
459 .devicem name
460 Write contents of macro or string name uninterpreted to the
461 intermediate output as a device control function.
462 .di End current diversion.
463 .di macro Divert to macro. See groff_tmac(5) for more details.
464 .do name Interpret .name with compatibility mode disabled.
465 .ds stringvar anything
466 Set stringvar to anything.
467 .ds1 stringvar anything
468 Same as .ds but with compatibility mode switched off during
469 string expansion.
470 .dt N trap
471 Set diversion trap to position N (default scaling indica‐
472 tor v).
473 .ec Reset escape character to ‘\’.
474 .ec c Set escape character to c.
475 .ecr Restore escape character saved with .ecs.
476 .ecs Save current escape character.
477 .el anything
478 Else part for if-else (.ie) request.
479 .em macro The macro is run after the end of input.
480 .eo Turn off escape character mechanism.
481 .ev Switch to previous environment and pop it off the stack.
482 .ev env Push down environment number or name env to the stack and
483 switch to it.
484 .evc env Copy the contents of environment env to the current environ‐
485 ment. No pushing or popping.
486 .ex Exit from roff processing.
487 .fam Return to previous font family.
488 .fam name Set the current font family to name.
489 .fc Disable field mechanism.
490 .fc a Set field delimiter to a and pad glyph to space.
491 .fc a b Set field delimiter to a and pad glyph to b.
492 .fchar c anything
493 Define fallback character (or glyph) c as string anything.
494 .fcolor Set fill color to previous fill color.
495 .fcolor c Set fill color to c.
496 .fi Fill output lines.
497 .fl Flush output buffer.
498 .fp n font
499 Mount font on position n.
500 .fp n internal external
501 Mount font with long external name to short internal name on
502 position n.
503 .fschar f c anything
504 Define fallback character (or glyph) c for font f as string
505 anything.
506 .fspecial font
507 Reset list of special fonts for font to be empty.
508 .fspecial font s1 s2 ...
509 When the current font is font, then the fonts s1, s2, ... are
510 special.
511 .ft Return to previous font. Same as \ or \.
512 .ft font Change to font name or number font; same as \f[font] escape
513 sequence.
514 .ftr font1 font2
515 Translate font1 to font2.
516 .fzoom font
517 Don't magnify font.
518 .fzoom font zoom
519 Set zoom factor for font (in multiples of 1/1000th).
520 .gcolor Set glyph color to previous glyph color.
521 .gcolor c Set glyph color to c.
522 .hc Remove additional hyphenation indicator character.
523 .hc c Set up additional hyphenation indicator character c.
524 .hcode c1 code1 [c2 code2] ...
525 Set the hyphenation code of character c1 to code1, that of c2
526 to code2, etc.
527 .hla lang Set the current hyphenation language to lang.
528 .hlm n Set the maximum number of consecutive hyphenated lines to n.
529 .hpf file Read hyphenation patterns from file.
530 .hpfa file
531 Append hyphenation patterns from file.
532 .hpfcode a b c d ...
533 Set input mapping for .hpf.
534 .hw words List of words with exceptional hyphenation.
535 .hy N Switch to hyphenation mode N.
536 .hym n Set the hyphenation margin to n (default scaling indica‐
537 tor m).
538 .hys n Set the hyphenation space to n.
539 .ie cond anything
540 If cond then anything else goto .el.
541 .if cond anything
542 If cond then anything; otherwise do nothing.
543 .ig Ignore text until .. is encountered.
544 .ig end Ignore text until .end is called.
545 .in Change to previous indentation value.
546 .in ±N Change indentation according to ±N (default scaling indica‐
547 tor m).
548 .it N trap
549 Set an input-line count trap for the next N lines.
550 .itc N trap
551 Same as .it but don't count lines interrupted with \c.
552 .kern Enable pairwise kerning.
553 .kern n If n is zero, disable pairwise kerning, otherwise enable it.
554 .lc Remove leader repetition glyph.
555 .lc c Set leader repetition glyph to c.
556 .length register anything
557 Write the length of the string anything to register.
558 .linetabs Enable line-tabs mode (i.e., calculate tab positions relative
559 to output line).
560 .linetabs n
561 If n is zero, disable line-tabs mode, otherwise enable it.
562 .lf N Set input line number to N.
563 .lf N file
564 Set input line number to N and filename to file.
565 .lg N Ligature mode on if N>0.
566 .ll Change to previous line length.
567 .ll ±N Set line length according to ±N (default length 6.5i, default
568 scaling indicator m).
569 .lsm Unset the leading spaces macro.
570 .lsm macro
571 Set the leading spaces macro to macro.
572 .ls Change to the previous value of additional intra-line skip.
573 .ls N Set additional intra-line skip value to N, i.e., N-1 blank
574 lines are inserted after each text output line.
575 .lt ±N Length of title (default scaling indicator m).
576 .mc Margin glyph off.
577 .mc c Print glyph c after each text line at actual distance from
578 right margin.
579 .mc c N Set margin glyph to c and distance to N from right margin
580 (default scaling indicator m).
581 .mk [register]
582 Mark current vertical position in register, or in an internal
583 register used by .rt if no argument.
584 .mso file The same as .so except that file is searched in the tmac di‐
585 rectories.
586 .na No output-line adjusting.
587 .ne Need a one-line vertical space.
588 .ne N Need N vertical space (default scaling indicator v).
589 .nf No filling or adjusting of output lines.
590 .nh No hyphenation.
591 .nm Number mode off.
592 .nm ±N [M [S [I]]]
593 In line number mode, set number, multiple, spacing, and in‐
594 dentation.
595 .nn Do not number next line.
596 .nn N Do not number next N lines.
597 .nop anything
598 Always process anything.
599 .nr register ±N [M]
600 Define or modify register using ±N with auto-increment M.
601 .nroff Make the built-in conditions n true and t false.
602 .ns Turn on no-space mode.
603 .nx Immediately jump to end of current file.
604 .nx filename
605 Immediately continue processing with file file.
606 .open stream filename
607 Open filename for writing and associate the stream named
608 stream with it.
609 .opena stream filename
610 Like .open but append to it.
611 .os Output vertical distance that was saved by the sv request.
612 .output string
613 Emit string directly to intermediate output, allowing leading
614 whitespace if string starts with " (which is stripped off).
615 .pc Reset page number character to ‘%’.
616 .pc c Page number character.
617 .pev Print the current environment and each defined environment
618 state to stderr.
619 .pi program
620 Pipe output to program (nroff only).
621 .pl Set page length to default 11i. The current page length is
622 stored in register .p.
623 .pl ±N Change page length to ±N (default scaling indicator v).
624 .pm Print macro names and sizes (number of blocks of 128 bytes).
625 .pm t Print only total of sizes of macros (number of 128 bytes
626 blocks).
627 .pn ±N Next page number N.
628 .pnr Print the names and contents of all currently defined number
629 registers on stderr.
630 .po Change to previous page offset. The current page offset is
631 available in register .o.
632 .po ±N Page offset N.
633 .ps Return to previous point size.
634 .ps ±N Point size; same as \s[±N].
635 .psbb filename
636 Get the bounding box of a PostScript image filename.
637 .pso command
638 This behaves like the so request except that input comes from
639 the standard output of command.
640 .ptr Print the names and positions of all traps (not including in‐
641 put line traps and diversion traps) on stderr.
642 .pvs Change to previous post-vertical line spacing.
643 .pvs ±N Change post-vertical line spacing according to ±N (default
644 scaling indicator p).
645 .rchar c1 c2 ...
646 Remove the definitions of entities c1, c2, ...
647 .rd prompt
648 Read insertion.
649 .return Return from a macro.
650 .return anything
651 Return twice, namely from the macro at the current level and
652 from the macro one level higher.
653 .rfschar f c1 c2 ...
654 Remove the definitions of entities c1, c2, ... for font f.
655 .rj n Right justify the next n input lines.
656 .rm name Remove request, macro, diversion, or string name.
657 .rn old new
658 Rename request, macro, diversion, or string old to new.
659 .rnn reg1 reg2
660 Rename register reg1 to reg2.
661 .rr register
662 Remove register.
663 .rs Restore spacing; turn no-space mode off.
664 .rt Return (upward only) to vertical position marked by .mk on
665 the current page.
666 .rt ±N Return (upward only) to specified distance from the top of
667 the page (default scaling indicator v).
668 .schar c anything
669 Define global fallback character (or glyph) c as string any‐
670 thing.
671 .shc Reset soft hyphen glyph to \(hy.
672 .shc c Set the soft hyphen glyph to c.
673 .shift n In a macro, shift the arguments by n positions.
674 .sizes s1 s2 ... sn [0]
675 Set available font sizes similar to the sizes command in a
676 DESC file.
677 .so filename
678 Include source file.
679 .sp Skip one line vertically.
680 .sp N Space vertical distance N up or down according to sign of N
681 (default scaling indicator v).
682 .special Reset global list of special fonts to be empty.
683 .special s1 s2 ...
684 Fonts s1, s2, etc. are special and are searched for glyphs
685 not in the current font.
686 .spreadwarn
687 Toggle the spread warning on and off without changing its
688 value.
689 .spreadwarn limit
690 Emit a warning if each space in an output line is widened by
691 limit or more (default scaling indicator m).
692 .ss N Set space glyph size to N/12 of the space width in the cur‐
693 rent font.
694 .ss N M Set space glyph size to N/12 and sentence space size set to
695 M/12 of the space width in the current font.
696 .sty n style
697 Associate style with font position n.
698 .substring xx n1 n2
699 Replace the string named xx with the substring defined by the
700 indices n1 and n2.
701 .sv Save 1 v of vertical space.
702 .sv N Save the vertical distance N for later output with os request
703 (default scaling indicator v).
704 .sy command-line
705 Execute program command-line.
706 .ta T N Set tabs after every position that is a multiple of N (de‐
707 fault scaling indicator m).
708 .ta n1 n2 ... nn T r1 r2 ... rn
709 Set tabs at positions n1, n2, ..., nn, then set tabs at
710 nn+m×rn+r1 through nn+m×rn+rn, where m increments from 0, 1,
711 2, ... to infinity.
712 .tc Remove tab repetition glyph.
713 .tc c Set tab repetition glyph to c.
714 .ti ±N Temporary indent next line (default scaling indicator m).
715 .tkf font s1 n1 s2 n2
716 Enable track kerning for font.
717 .tl ’left’center’right’
718 Three-part title.
719 .tm anything
720 Print anything on stderr.
721 .tm1 anything
722 Print anything on stderr, allowing leading whitespace if any‐
723 thing starts with " (which is stripped off).
724 .tmc anything
725 Similar to .tm1 without emitting a final newline.
726 .tr abcd...
727 Translate a to b, c to d, etc. on output.
728 .trf filename
729 Transparently output the contents of file filename.
730 .trin abcd...
731 This is the same as the tr request except that the asciify
732 request uses the character code (if any) before the character
733 translation.
734 .trnt abcd...
735 This is the same as the tr request except that the transla‐
736 tions do not apply to text that is transparently throughput
737 into a diversion with \!.
738 .troff Make the built-in conditions t true and n false.
739 .uf font Set underline font to font (to be switched to by .ul).
740 .ul N Underline (italicize in troff) N input lines.
741 .unformat diversion
742 Unformat space characters and tabs in diversion, preserving
743 font information.
744 .vpt n Enable vertical position traps if n is non-zero, disable them
745 otherwise.
746 .vs Change to previous vertical base line spacing.
747 .vs ±N Set vertical base line spacing to ±N (default scaling indica‐
748 tor p).
749 .warn n Set warnings code to n.
750 .warnscale si
751 Set scaling indicator used in warnings to si.
752 .wh N Remove (first) trap at position N.
753 .wh N trap
754 Set location trap; negative means from page bottom.
755 .while cond anything
756 While condition cond is true, accept anything as input.
757 .write stream anything
758 Write anything to the stream named stream.
759 .writec stream anything
760 Similar to .write without emitting a final newline.
761 .writem stream xx
762 Write contents of macro or string xx to the stream named
763 stream.
764
765 Besides these standard groff requests, there might be further macro
766 calls. They can originate from a macro package (see roff(7) for an
767 overview) or from a preprocessor.
768
769 Preprocessor macros are easy to recognize. They enclose their code be‐
770 tween a pair of characteristic macros.
771
772 ┌─────────────┬─────────────────┬────────────────┐
773 │preprocessor │ start macro │ end macro │
774 ├─────────────┼─────────────────┼────────────────┤
775 │ chem │ .cstart │ .cend │
776 │ eqn │ .EQ │ .EN │
777 │ grap │ .G1 │ .G2 │
778 │ grn │ .GS │ .GE │
779 │ ideal │ .IS │ .IE │
780 │ │ │ .IF │
781 │ pic │ .PS │ .PE │
782 │ refer │ .R1 │ .R2 │
783 │ soelim │ none │ none │
784 │ tbl │ .TS │ .TE │
785 ├─────────────┼─────────────────┼────────────────┤
786 │ glilypond │ .lilypond start │ .lilypond stop │
787 │ gperl │ .Perl start │ .Perl stop │
788 │ gpinyin │ .pinyin start │ .pinyin stop │
789 └─────────────┴─────────────────┴────────────────┘
790 Note that the ‘ideal’ preprocessor is not available in groff yet.
791
793 Escape sequences are in-line language elements usually introduced by a
794 backslash ‘\’ and followed by an escape name and sometimes by a re‐
795 quired argument. Input processing is continued directly after the es‐
796 caped character or the argument (without an intervening separation
797 character). So there must be a way to determine the end of the escape
798 name and the end of the argument.
799
800 This is done by enclosing names (escape name and arguments consisting
801 of a variable name) by a pair of brackets [name] and constant arguments
802 (number expressions and characters) by apostrophes (ASCII 0x27) like
803 ’constant’.
804
805 There are abbreviations for short names. Two-character escape names
806 can be specified by an opening parenthesis like \(xy or \*(xy without a
807 closing counterpart. And all one-character names different from the
808 special characters ‘[’ and ‘(’ can even be specified without a marker,
809 for example \nc or \$c.
810
811 Constant arguments of length 1 can omit the marker apostrophes, too,
812 but there is no two-character analogue.
813
814 While one-character escape sequences are mainly used for in-line func‐
815 tions and system-related tasks, the two-letter names following the \(
816 construct are glyphs predefined by the roff system; these are called
817 ‘Special Characters’ in the classical documentation. Escapes sequences
818 of the form \[name] denote glyphs too.
819
820 Single-Character Escapes
821 \" Start of a comment. Everything up to the end of the line is ig‐
822 nored.
823 \# Everything up to and including the next newline is ignored.
824 This is interpreted in copy mode. This is like \" except that
825 the terminating newline is ignored as well.
826 \*s The string stored in the string variable with one-character
827 name s.
828 \*(st The string stored in the string variable with two-character name
829 st.
830 \*[string]
831 The string stored in the string variable with name string (with
832 arbitrary length).
833 \*[stringvar arg1 arg2 ...]
834 The string stored in the string variable with arbitrarily long
835 name stringvar, taking arg1, arg2, ... as arguments.
836 \$0 The name by which the current macro was invoked. The als re‐
837 quest can make a macro have more than one name.
838 \$x Macro or string argument with one-digit number x in the range 1
839 to 9.
840 \$(xy Macro or string argument with two-digit number xy (larger than
841 zero).
842 \$[nexp]
843 Macro or string argument with number nexp, where nexp is a nu‐
844 merical expression evaluating to an integer ≥1.
845 \$* In a macro or string, the concatenation of all the arguments
846 separated by spaces.
847 \$@ In a macro or string, the concatenation of all the arguments
848 with each surrounded by double quotes, and separated by spaces.
849 \$^ In a macro, the representation of all parameters as if they were
850 an argument to the ds request.
851 \\ reduces to a single backslash; useful to delay its interpreta‐
852 tion as escape character in copy mode. For a printable back‐
853 slash, use \e, or even better \[rs], to be independent from the
854 current escape character.
855 \´ The acute accent ´; same as \(aa. Unescaped: apostrophe, right
856 quotation mark, single quote (ASCII 0x27).
857 \` The grave accent `; same as \(ga. Unescaped: left quote, back‐
858 quote (ASCII 0x60).
859 \- The - (minus) sign in the current font.
860 \_ The same as \(ul, the underline character.
861 \. The same as a dot (‘.’). Necessary in nested macro definitions
862 so that ‘\\..’ expands to ‘..’.
863 \% Default optional hyphenation character.
864 \! Transparent line indicator.
865 \?anything?
866 In a diversion, this transparently embeds anything in the diver‐
867 sion. anything is read in copy mode. See also the escape se‐
868 quences \! and \?.
869 \space Unpaddable space size space glyph (no line break).
870 \0 Digit-width space.
871 \| 1/6 em narrow space glyph; zero width in nroff.
872 \^ 1/12 em half-narrow space glyph; zero width in nroff.
873 \& Non-printable, zero-width glyph.
874 \) Like \& except that it behaves like a glyph declared with the
875 cflags request to be transparent for the purposes of end-of-sen‐
876 tence recognition.
877 \/ Increases the width of the preceding glyph so that the spacing
878 between that glyph and the following glyph is correct if the
879 following glyph is a roman glyph.
880 \, Modifies the spacing of the following glyph so that the spacing
881 between that glyph and the preceding glyph is correct if the
882 preceding glyph is a roman glyph.
883 \~ Unbreakable space that stretches like a normal inter-word space
884 when a line is adjusted.
885 \: Inserts a zero-width break point (similar to \% but without a
886 soft hyphen character).
887 \newline
888 Ignored newline, for continuation lines.
889 \{ Begin conditional input.
890 \} End conditional input.
891 \(sc A glyph with two-character name sc; see section “Special Charac‐
892 ters” below.
893 \[name]
894 A glyph with name name (of arbitrary length).
895 \[comp1 comp2 ...]
896 A composite glyph with components comp1, comp2, ...
897 \a Non-interpreted leader character.
898 \A’anything’
899 If anything is acceptable as a name of a string, macro, diver‐
900 sion, register, environment or font it expands to 1, and to 0
901 otherwise.
902 \b’abc...’
903 Bracket building function.
904 \B’anything’
905 If anything is acceptable as a valid numeric expression it ex‐
906 pands to 1, and to 0 otherwise.
907 \c Continue output line at next input line. Anything after this
908 escape on the same line is ignored except \R (which works as
909 usual). Anything before \c on the same line is appended to the
910 current partial output line. The next non-command line after a
911 line interrupted with \c counts as a new input line.
912 \C’glyph’
913 The glyph called glyph; same as \[glyph], but compatible to
914 other roff versions.
915 \d Forward (down) 1/2 em (1/2 line in nroff).
916 \D’charseq’
917 Draw a graphical element defined by the characters in charseq;
918 see the groff Texinfo manual for details.
919 \e Printable version of the current escape character.
920 \E Equivalent to an escape character, but is not interpreted in
921 copy mode.
922 \fF Change to font with one-character name or one-digit number F.
923 \fP Switch back to previous font.
924 \f(fo Change to font with two-character name or two-digit number fo.
925 \f[font]
926 Change to font with arbitrarily long name or number expression
927 font.
928 \f[] Switch back to previous font.
929 \Ff Change to font family with one-character name f.
930 \F(fm Change to font family with two-character name fm.
931 \F[fam]
932 Change to font family with arbitrarily long name fam.
933 \F[] Switch back to previous font family.
934 \gr Return format of register with one-character name r suitable for
935 af request.
936 \g(rg Return format of register with two-character name rg suitable
937 for af request.
938 \g[reg]
939 Return format of register with arbitrarily long name reg suit‐
940 able for af request.
941 \h’N’ Local horizontal motion; move right N (left if negative).
942 \H’N’ Set height of current font to N.
943 \kr Mark horizontal input place in one-character register r.
944 \k(rg Mark horizontal input place in two-character register rg.
945 \k[reg]
946 Mark horizontal input place in register with arbitrarily long
947 name reg.
948 \l’Nc’ Horizontal line drawing function (optionally using character c).
949 \L’Nc’ Vertical line drawing function (optionally using character c).
950 \mc Change to color with one-character name c.
951 \m(cl Change to color with two-character name cl.
952 \m[color]
953 Change to color with arbitrarily long name color.
954 \m[] Switch back to previous color.
955 \Mc Change filling color for closed drawn objects to color with one-
956 character name c.
957 \M(cl Change filling color for closed drawn objects to color with two-
958 character name cl.
959 \M[color]
960 Change filling color for closed drawn objects to color with ar‐
961 bitrarily long name color.
962 \M[] Switch to previous fill color.
963 \nr The numerical value stored in the register variable with the
964 one-character name r.
965 \n(re The numerical value stored in the register variable with the
966 two-character name re.
967 \n[reg]
968 The numerical value stored in the register variable with arbi‐
969 trarily long name reg.
970 \N’n’ Typeset the glyph with index n in the current font. No special
971 fonts are searched. Useful for adding (named) entities to a
972 document using the char request and friends.
973 \o’abc...’
974 Overstrike glyphs a, b, c, etc.
975 \O0 Disable glyph output. Mainly for internal use.
976 \O1 Enable glyph output. Mainly for internal use.
977 \p Break output line at next word boundary; adjust if applicable.
978 \r Reverse 1 em vertical motion (reverse line in nroff).
979 \R’name ±n’
980 The same as .nr name ±n.
981 \s±N Set/increase/decrease the point size to/by N scaled points; N is
982 a one-digit number in the range 1 to 9. Same as ps request.
983 \s(±N
984 \s±(N Set/increase/decrease the point size to/by N scaled points; N is
985 a two-digit number ≥1. Same as ps request.
986 \s[±N]
987 \s±[N]
988 \s’±N’
989 \s±’N’ Set/increase/decrease the point size to/by N scaled points.
990 Same as ps request.
991 \S’N’ Slant output by N degrees.
992 \t Non-interpreted horizontal tab.
993 \u Reverse (up) 1/2 em vertical motion (1/2 line in nroff).
994 \v’N’ Local vertical motion; move down N (up if negative).
995 \Ve The contents of the environment variable with one-character
996 name e.
997 \V(ev The contents of the environment variable with two-character name
998 ev.
999 \V[env]
1000 The contents of the environment variable with arbitrarily long
1001 name env.
1002 \w’string’
1003 The width of the glyph sequence string.
1004 \x’N’ Extra line-space function (negative before, positive after).
1005 \X’string’
1006 Output string as device control function.
1007 \Yn Output string variable or macro with one-character name n unin‐
1008 terpreted as device control function.
1009 \Y(nm Output string variable or macro with two-character name nm unin‐
1010 terpreted as device control function.
1011 \Y[name]
1012 Output string variable or macro with arbitrarily long name name
1013 uninterpreted as device control function.
1014 \zc Print c with zero width (without spacing).
1015 \Z’anything’
1016 Print anything and then restore the horizontal and vertical po‐
1017 sition; anything may not contain tabs or leaders.
1018
1019 The escape sequences \e, \., \", \$, \*, \a, \n, \t, \g, and \newline
1020 are interpreted in copy mode.
1021
1022 Escape sequences starting with \( or \[ do not represent single charac‐
1023 ter escape sequences, but introduce escape names with two or more char‐
1024 acters.
1025
1026 If a backslash is followed by a character that does not constitute a
1027 defined escape sequence, the backslash is silently ignored and the
1028 character maps to itself.
1029
1030 Special Characters
1031 [Note: ‘Special Characters’ is a misnomer; those entities are (output)
1032 glyphs, not (input) characters.]
1033
1034 Common special characters are predefined by escape sequences of the
1035 form \(xy with characters x and y. In groff, it is also possible to
1036 use the writing \[xy] as well.
1037
1038 Some of these special characters exist in the usual font while most of
1039 them are only available in the special font. Below you can see a small
1040 selection of the most important glyphs; a complete list can be found in
1041 groff_char(7).
1042
1043 \(Do Dollar $
1044 \(Eu Euro €
1045 \(Po British pound sterling £
1046 \(aq Apostrophe quote '
1047 \(bu Bullet sign •
1048 \(co Copyright ©
1049 \(cq Single closing quote (right) ’
1050 \(ct Cent ¢
1051 \(dd Double dagger ‡
1052 \(de Degree °
1053 \(dg Dagger †
1054 \(dq Double quote (ASCII 34) "
1055 \(em Em-dash —
1056 \(en En-dash –
1057 \(hy Hyphen ‐
1058 \(lq Double quote left “
1059 \(oq Single opening quote (left) ‘
1060 \(rg Registered sign ®
1061 \(rq Double quote right ”
1062 \(rs Printable backslash character \
1063 \(sc Section sign §
1064 \(tm Trademark symbol ™
1065 \(ul Underline character _
1066 \(== Identical ≡
1067 \(>= Larger or equal ≥
1068 \(<= Less or equal ≤
1069 \(!= Not equal ≠
1070 \(-> Right arrow →
1071 \(<- Left arrow ←
1072 \(+- Plus-minus sign ±
1073
1074 Unicode Characters
1075 The extended escape u allows the inclusion of all available Unicode
1076 characters into a roff file.
1077
1078 \[uxxxx]
1079 u is the escape name. xxxx is a hexadecimal number of four hex
1080 digits, such as 0041 for the letter A, thus \[u0041].
1081
1082 \[uyyyyy]
1083 u is the escape name. yyyyy is a hexadecimal number of five hex
1084 digits, such as 2FA1A for a Chinese-looking character from the
1085 Unicode block CJK Compatibility Ideographs Supplement, thus
1086 \[u2FA1A].
1087
1088 The hexadecimal value indicates the corresponding Unicode code point
1089 for a character.
1090
1091 \[uhex1_hex2]
1092 \[uhex1_hex2_hex3]
1093 hex1, hex2, and hex3 are all Unicode hexadecimal codes (4 or 5
1094 hex digits) that are used for overstriking, e.g. \[u0041_0301]
1095 is A acute, which can also be specified as Á; see groff_char(7).
1096
1097 The availability of the Unicode characters depends on the font used.
1098 For text mode, the device -Tutf8 is quite complete; for troff modes it
1099 might happen that some or many characters will not be displayed.
1100 Please check your fonts.
1101
1102 Strings
1103 Strings are defined by the ds request and can be retrieved by the \*
1104 escape sequence.
1105
1106 Strings share their name space with macros. So strings and macros
1107 without arguments are roughly equivalent; it is possible to call a
1108 string like a macro and vice versa, but this often leads to unpre‐
1109 dictable results. The following string is the only one predefined in
1110 groff.
1111
1112 \*[.T] The name of the current output device as specified by the -T
1113 command-line option.
1114
1116 Registers are variables that store a value. In groff, most registers
1117 store numerical values (see section “Numerical Expressions” above), but
1118 some can also hold a string value.
1119
1120 Each register is given a name. Arbitrary registers can be defined and
1121 set with the nr request.
1122
1123 The value stored in a register can be retrieved by the escape sequences
1124 introduced by \n.
1125
1126 Most useful are predefined registers. In the following the notation
1127 name is used to refer to register name to make clear that we speak
1128 about registers. Please keep in mind that the \n[] decoration is not
1129 part of the register name.
1130
1131 Read-only Registers
1132 The following registers have predefined values that should not be modi‐
1133 fied by the user (usually, registers starting with a dot are read-
1134 only). Mostly, they provide information on the current settings or
1135 store results from request calls.
1136
1137 \n[$$] The process ID of troff.
1138 \n[.$] Number of arguments in the current macro or string.
1139 \n[.a] Post-line extra line-space most recently utilized using \x.
1140 \n[.A] Set to 1 in troff if option -A is used; always 1 in nroff.
1141 \n[.b] The emboldening offset while .bd is active.
1142 \n[.br] Within a macro, set to 1 if macro called with the ‘normal’
1143 control character, and to 0 otherwise.
1144 \n[.c] Current input line number.
1145 \n[.C] 1 if compatibility mode is in effect, 0 otherwise.
1146 \n[.cdp] The depth of the last glyph added to the current environment.
1147 It is positive if the glyph extends below the baseline.
1148 \n[.ce] The number of lines remaining to be centered, as set by the
1149 ce request.
1150 \n[.cht] The height of the last glyph added to the current environ‐
1151 ment. It is positive if the glyph extends above the base‐
1152 line.
1153 \n[.color]
1154 1 if colors are enabled, 0 otherwise.
1155 \n[.csk] The skew of the last glyph added to the current environment.
1156 The skew of a glyph is how far to the right of the center of
1157 a glyph the center of an accent over that glyph should be
1158 placed.
1159 \n[.d] Current vertical place in current diversion; equal to regis‐
1160 ter nl.
1161 \n[.ev] The name or number of the current environment (string-val‐
1162 ued).
1163 \n[.f] Current font number.
1164 \n[.F] The name of the current input file (string-valued).
1165 \n[.fam] The current font family (string-valued).
1166 \n[.fn] The current (internal) real font name (string-valued).
1167 \n[.fp] The number of the next free font position.
1168 \n[.g] Always 1 in GNU troff. Macros should use it to test if run‐
1169 ning under groff.
1170 \n[.h] Text base-line high-water mark on current page or diversion.
1171 \n[.H] Number of basic units per horizontal unit of output device
1172 resolution.
1173 \n[.height]
1174 The current font height as set with \H.
1175 \n[.hla] The current hyphenation language as set by the hla request.
1176 \n[.hlc] The number of immediately preceding consecutive hyphenated
1177 lines.
1178 \n[.hlm] The maximum allowed number of consecutive hyphenated lines,
1179 as set by the hlm request.
1180 \n[.hy] The current hyphenation flags (as set by the hy request).
1181 \n[.hym] The current hyphenation margin (as set by the hym request).
1182 \n[.hys] The current hyphenation space (as set by the hys request).
1183 \n[.i] Current indentation.
1184 \n[.in] The indentation that applies to the current output line.
1185 \n[.int] Positive if last output line contains \c.
1186 \n[.j] The current adjustment mode. It can be stored and used to
1187 set adjustment. (n = 1, b = 1, l = 0, r = 5, c = 3).
1188 \n[.k] The current horizontal output position (relative to the cur‐
1189 rent indentation).
1190 \n[.kern] 1 if pairwise kerning is enabled, 0 otherwise.
1191 \n[.l] Current line length.
1192 \n[.L] The current line spacing setting as set by .ls.
1193 \n[.lg] The current ligature mode (as set by the lg request).
1194 \n[.linetabs]
1195 The current line-tabs mode (as set by the linetabs request).
1196 \n[.ll] The line length that applies to the current output line.
1197 \n[.lt] The title length (as set by the lt request).
1198 \n[.m] The current drawing color (string-valued).
1199 \n[.M] The current background color (string-valued).
1200 \n[.n] Length of text portion on previous output line.
1201 \n[.ne] The amount of space that was needed in the last ne request
1202 that caused a trap to be sprung. Useful in conjunction with
1203 register .trunc.
1204 \n[.ns] 1 if in no-space mode, 0 otherwise.
1205 \n[.o] Current page offset.
1206 \n[.O] The suppression nesting level (see \O).
1207 \n[.p] Current page length.
1208 \n[.P] 1 if the current page is being printed, 0 otherwise (as de‐
1209 termined by the -o command-line option).
1210 \n[.pe] 1 during page ejection, 0 otherwise.
1211 \n[.pn] The number of the next page: either the value set by a pn re‐
1212 quest, or the number of the current page plus 1.
1213 \n[.ps] The current point size in scaled points.
1214 \n[.psr] The last-requested point size in scaled points.
1215 \n[.pvs] The current post-vertical line spacing.
1216 \n[.R] The number of unused number registers. Always 10000 in GNU
1217 troff.
1218 \n[.rj] The number of lines to be right-justified as set by the rj
1219 request.
1220 \n[.s] Current point size as a decimal fraction.
1221 \n[.slant]
1222 The slant of the current font as set with \S.
1223 \n[.sr] The last requested point size in points as a decimal fraction
1224 (string-valued).
1225 \n[.ss] The value of the parameters set by the first argument of the
1226 ss request.
1227 \n[.sss] The value of the parameters set by the second argument of the
1228 ss request.
1229 \n[.sty] The current font style (string-valued).
1230 \n[.t] Vertical distance to the next trap.
1231 \n[.T] Set to 1 if option -T is used.
1232 \n[.tabs] A string representation of the current tab settings suitable
1233 for use as an argument to the ta request.
1234 \n[.trunc]
1235 The amount of vertical space truncated by the most recently
1236 sprung vertical position trap, or, if the trap was sprung by
1237 an ne request, minus the amount of vertical motion produced
1238 by .ne. Useful in conjunction with the register .ne.
1239 \n[.u] Equal to 1 in fill mode and 0 in no-fill mode.
1240 \n[.U] Equal to 1 in safer mode and 0 in unsafe mode.
1241 \n[.v] Current vertical line spacing.
1242 \n[.V] Number of basic units per vertical unit of output device res‐
1243 olution.
1244 \n[.vpt] 1 if vertical position traps are enabled, 0 otherwise.
1245 \n[.w] Width of previous glyph.
1246 \n[.warn] The sum of the number codes of the currently enabled warn‐
1247 ings.
1248 \n[.x] The major version number.
1249 \n[.y] The minor version number.
1250 \n[.Y] The revision number of groff.
1251 \n[.z] Name of current diversion.
1252 \n[.zoom] Zoom factor for current font (in multiples of 1/1000th; zero
1253 if no magnification).
1254
1255 Writable Registers
1256 The following registers can be read and written by the user. They have
1257 predefined default values, but these can be modified for customizing a
1258 document.
1259
1260 \n[%] Current page number.
1261 \n[c.] Current input line number.
1262 \n[ct] Character type (set by width function \w).
1263 \n[dl] Maximal width of last completed diversion.
1264 \n[dn] Height of last completed diversion.
1265 \n[dw] Current day of week (1–7).
1266 \n[dy] Current day of month (1–31).
1267 \n[hours] The number of hours past midnight. Initialized at start-up.
1268 \n[hp] Current horizontal position at input line.
1269 \n[llx] Lower left x-coordinate (in PostScript units) of a given
1270 PostScript image (set by .psbb).
1271 \n[lly] Lower left y-coordinate (in PostScript units) of a given
1272 PostScript image (set by .psbb).
1273 \n[ln] Output line number.
1274 \n[lsn] The number of leading spaces of an input line.
1275 \n[lss] The horizontal space corresponding to the leading spaces of
1276 an input line.
1277 \n[minutes]
1278 The number of minutes after the hour. Initialized at start-
1279 up.
1280 \n[mo] Current month (1–12).
1281 \n[nl] Vertical position of last printed text base-line.
1282 \n[opmaxx]
1283 \n[opmaxy]
1284 \n[opminx]
1285 \n[opminy]
1286 These four registers mark the top left and bottom right hand
1287 corners of a box which encompasses all written glyphs. They
1288 are reset to -1 by \O0 or \O1.
1289 \n[rsb] Like register sb, but takes account of the heights and depths
1290 of glyphs.
1291 \n[rst] Like register st, but takes account of the heights and depths
1292 of glyphs.
1293 \n[sb] Depth of string below base line (generated by width function
1294 \w).
1295 \n[seconds]
1296 The number of seconds after the minute. Initialized at
1297 start-up.
1298 \n[skw] Right skip width from the center of the last glyph in the \w
1299 argument.
1300 \n[slimit]
1301 If greater than 0, the maximum number of objects on the input
1302 stack. If ≤0 there is no limit, i.e., recursion can continue
1303 until virtual memory is exhausted.
1304 \n[ssc] The amount of horizontal space (possibly negative) that
1305 should be added to the last glyph before a subscript (gener‐
1306 ated by width function \w).
1307 \n[st] Height of string above base line (generated by width function
1308 \w).
1309 \n[systat]
1310 The return value of the system() function executed by the
1311 last sy request.
1312 \n[urx] Upper right x-coordinate (in PostScript units) of a given
1313 PostScript image (set by .psbb).
1314 \n[ury] Upper right y-coordinate (in PostScript units) of a given
1315 PostScript image (set by .psbb).
1316 \n[year] The current year (year 2000 compliant).
1317 \n[yr] Current year minus 1900. For Y2K compliance use register
1318 year instead.
1319
1321 The .hy request, given an integer argument, controls when hyphenation
1322 applies. The default value is 1, which enables hyphenation almost ev‐
1323 erywhere (see below). Macro packages often override this default.
1324
1325 1 disables hyphenation only after the first and before the last
1326 character of a word.
1327
1328 2 disables hyphenation only of the last word on a page or column.
1329
1330 4 disables hyphenation only before the last two characters of a
1331 word.
1332
1333 8 disables hyphenation only after the first two characters of a
1334 word.
1335
1336 16 enables hyphenation before the last character of a word.
1337
1338 32 enables hyphenation after the first character of a word.
1339
1340 The values are additive. Some values cannot be used together because
1341 they contradict; for instance, 4 and 16; 8 and 32.
1342
1344 In the RUNOFF language, the underlining was quite easy. But in roff
1345 this is much more difficult.
1346
1347 Underlining with .ul
1348 There exists a groff request .ul (see above) that can underline the
1349 next or further source lines in nroff, but in troff it produces only a
1350 font change into italic. So this request is not really useful.
1351
1352 Underlining with .UL from ms
1353 In the ‘ms’ macro package in tmac/s.tmac groff_ms(7), there is the
1354 macro .UL. But this works only in troff, not in nroff.
1355
1356 Underlining macro definitions
1357 So one can use the italic nroff idea from .ul and the troff definition
1358 in ms for writing a useful new macro, something like
1359 .de UNDERLINE
1360 . ie n \\$1\f[I]\\$2\f[P]\\$3
1361 . el \\$1\Z'\\$2'\v'.25m'\D'l \w'\\$2'u 0'\v'-.25m'\\$3
1362 ..
1363 If doclifter(1) makes trouble, change the macro name UNDERLINE into
1364 some 2-letter word, like Ul. Moreover change the font writing from
1365 \f[P] to \fP.
1366
1367 Underlining without macro definitions
1368 If one does not want to use macro definitions, e.g., when doclifter
1369 gets lost, use the following:
1370 .ds u1 before
1371 .ds u2 in
1372 .ds u3 after
1373 .ie n \*[u1]\f[I]\*[u2]\f[P]\*[u3]
1374 .el \*[u1]\Z'\*[u2]'\v'.25m'\D'l \w'\*[u2]'u 0'\v'-.25m'\*[u3]
1375 Due to doclifter, it might be necessary to change the variable writing
1376 \[xy] and \*[xy] into the strange ancient writing \*(xy and \(xy, and
1377 so on.
1378
1379 Then these lines could look like
1380 .ds u1 before
1381 .ds u2 in
1382 .ds u3 after
1383 .ie n \*[u1]\fI\*(u2\fP\*(u3
1384 .el \*(u1\Z'\*(u2'\v'.25m'\D'l \w'\*(u2'u 0'\v'-.25m'\*(u3
1385
1386 The result looks like
1387 before _i_n after
1388
1389 Underlining with Overstriking \z and \(ul
1390 There is another possibility for underlining by using overstriking with
1391 \zc (print c with zero width without spacing) and \(ul (underline char‐
1392 acter). This produces the underlining of 1 character, both in nroff
1393 and in troff.
1394
1395 For example the underlining of a character say t looks like \z\[ul]t or
1396 \z\(ult
1397
1398 Longer words look then a bit strange, but a useful mode is to write
1399 each character into a whole own line. To underlines the 3 character
1400 part "tar" of the word "start":
1401 before s\
1402 \z\[ul]t\
1403 \z\[ul]a\
1404 \z\[ul]r\
1405 t after
1406 or
1407 before s\
1408 \z\(ult\
1409 \z\(ula\
1410 \z\(ulr\
1411 t after
1412
1413 The result looks like
1414 before s_t_a_rt after
1415
1417 The differences between the groff language and classical troff as de‐
1418 fined by [CSTR #54] are documented in groff_diff(7).
1419
1420 The groff system provides a compatibility mode, see groff(1) on how to
1421 invoke this.
1422
1424 This document was written by Bernd Warken ⟨groff-bernd.warken-72@
1425 web.de⟩.
1426
1428 Groff: The GNU Implementation of troff, by Trent A. Fisher and Werner
1429 Lemberg, is the primary groff manual. You can browse it interactively
1430 with “info groff”. Besides the gory details, it contains many exam‐
1431 ples.
1432
1433 groff(1)
1434 the usage of the groff program and pointers to the documentation
1435 and availability of the groff system.
1436
1437 groff_diff(7)
1438 describes the differences between the groff language and classi‐
1439 cal troff.
1440
1441 This is the authoritative document for the predefined language
1442 elements that are specific to groff.
1443
1444 groff_char(7)
1445 the predefined groff special characters (glyphs).
1446
1447 groff_font(5)
1448 the specification of fonts and the DESC file.
1449
1450 groff_tmac(5)
1451 contains an overview of available groff macro packages, instruc‐
1452 tions on how to interface them with a document, guidance on
1453 writing macro packages and using diversions, and historical in‐
1454 formation on macro package naming conventions.
1455
1456 roff(7)
1457 the history of roff, the common parts shared by all roff sys‐
1458 tems, and pointers to further documentation.
1459
1460 [CSTR #54]
1461 Nroff/Troff User's Manual by Ossanna & Kernighan ⟨http://
1462 cm.bell-labs.com/cm/cs/cstr/54.ps.gz⟩ — the bible for classical
1463 troff.
1464
1465 Wikipedia
1466 article about groff ⟨https://en.wikipedia.org/wiki/
1467 Groff_%28software%29⟩.
1468
1469 Tutorial about groff
1470 Manas Laha - An Introduction to the GNU Groff Text Processing
1471 System ⟨dl.dropbox.com/u/4299293/grofftut.pdf⟩
1472
1473 troff.org
1474 This is a collection of internet sites with classical roff docu‐
1475 mentations and other information.
1476
1477
1478
1479groff 1.22.4 21 July 2022 GROFF(7)