1groff_out(5)                  File Formats Manual                 groff_out(5)
2
3
4

Name

6       groff_out - GNU roff intermediate output format
7

Description

9       The  fundamental operation of the troff(1) formatter is the translation
10       of the groff(7) input language into a series of instructions  concerned
11       primarily  with  placing  glyphs or geometric objects at specific posi‐
12       tions on a rectangular page.  In the  following  discussion,  the  term
13       command  refers  to  this  intermediate  output  language, never to the
14       groff(7) language intended for use by document  authors.   Intermediate
15       output commands comprise several categories: glyph output; font, color,
16       and text size selection; motion of the printing position; page advance‐
17       ment;  drawing  of geometric primitives; and device control commands, a
18       catch-all for other operations.  The last includes directives to  start
19       and stop output, identify the intended output device, and embed URL hy‐
20       perlinks in supported output formats.
21
22       Because the front-end command groff(1) is a wrapper that normally  runs
23       the  troff  formatter  to  generate  intermediate  output and an output
24       driver (“postprocessor”) to consume it, users normally do not encounter
25       this  language.   The groff program's -Z option inhibits postprocessing
26       such that this intermediate output  is  sent  to  the  standard  output
27       stream as when troff is run manually.
28
29       groff's intermediate output facilitates the development of output driv‐
30       ers and other postprocessors by offering a  common  programming  inter‐
31       face.  It is an extension of the page description language developed by
32       Brian Kernighan for AT&T device-independent troff circa 1980.  Where  a
33       distinction  is  necessary,  we will say “troff output” to describe the
34       output of GNU troff, and “intermediate output” to denote  the  language
35       accepted by the parser implemented in groff's internal C++ library used
36       by most of its output drivers.
37

Language concepts

39       During the run of troff, the roff input is cracked down to the informa‐
40       tion on what has to be printed at what position on the intended device.
41       So the language of the intermediate output format can be  quite  small.
42       Its only elements are commands with or without arguments.  In this doc‐
43       ument, the term “command” always refers to the intermediate output lan‐
44       guage,  never to the roff language used for document formatting.  There
45       are commands for positioning and text writing, for drawing, and for de‐
46       vice controlling.
47
48   Separation
49       Classical  troff  output  had  strange requirements on whitespace.  The
50       groff output parser, however, is smart about whitespace  by  making  it
51       maximally  optional.   The whitespace characters, i.e., the tab, space,
52       and newline characters, always have a syntactical  meaning.   They  are
53       never printable because spacing within the output is always done by po‐
54       sitioning commands.
55
56       Any sequence of space or tab characters is treated as a single  syntac‐
57       tical space.  It separates commands and arguments, but is only required
58       when there would occur a clashing between the command code and the  ar‐
59       guments  without  the  space.   Most  often, this happens when variable
60       length command names, arguments, argument lists,  or  command  clusters
61       meet.   Commands  and  arguments with a known, fixed length need not be
62       separated by syntactical space.
63
64       A line break is a syntactical element, too.  Every command argument can
65       be  followed  by whitespace, a comment, or a newline character.  Thus a
66       syntactical line break is defined to consist  of  optional  syntactical
67       space  that  is optionally followed by a comment, and a newline charac‐
68       ter.
69
70       The normal commands, those for positioning and text, consist of a  sin‐
71       gle letter taking a fixed number of arguments.  For historical reasons,
72       the parser allows stacking of such commands on the same line, but  for‐
73       tunately, in groff intermediate output, every command with at least one
74       argument is followed by a line break, thus  providing  excellent  read‐
75       ability.
76
77       The  other commands — those for drawing and device controlling — have a
78       more complicated structure; some recognize long command names, and some
79       take  a variable number of arguments.  So all D and x commands were de‐
80       signed to request a syntactical line break after their  last  argument.
81       Only  one  command, ‘x X’ has an argument that can stretch over several
82       lines, all other commands must have all of their arguments on the  same
83       line  as  the  command,  i.e., the arguments may not be split by a line
84       break.
85
86       Lines containing only spaces and/or a comment are treated as empty  and
87       ignored.
88
89   Argument units
90       Some commands accept integer arguments that represent measurements, but
91       the scaling units of the formatter's language  are  never  used.   Most
92       commands assume a scaling unit of “u” (basic units), and others use “z
93       (scaled points); These are defined by the parameters specified  in  the
94       device's  DESC  file; see groff_font(5) and, for more on scaling units,
95       groff(7) and Groff: The GNU Implementation of troff, the groff  Texinfo
96       manual.  Color-related commands use dimensionless integers.
97
98       Note  that  single  characters  can have the eighth bit set, as can the
99       names of fonts and special characters (this is, glyphs).  The names  of
100       glyphs  and  fonts  can  be of arbitrary length.  A glyph that is to be
101       printed will always be in the current font.
102
103       A string argument is always terminated by the next whitespace character
104       (space,  tab,  or newline); an embedded # character is regarded as part
105       of the argument, not as the beginning of a comment command.  An integer
106       argument  is  already terminated by the next non-digit character, which
107       then is regarded as the first character of the next  argument  or  com‐
108       mand.
109
110   Document parts
111       A  correct intermediate output document consists of two parts, the pro‐
112       logue and the body.
113
114       The task of the prologue is to set the general device parameters  using
115       three  exactly specified commands.  The groff prologue is guaranteed to
116       consist of the following three lines (in that order):
117
118              x T device
119              x res n h v
120              x init
121
122       with the arguments set as outlined in subsection “Device  Control  Com‐
123       mands”  below.   However, the parser for the intermediate output format
124       is able to swallow additional whitespace and comments as well.
125
126       The body is the main section for processing the document data.  Syntac‐
127       tically,  it is a sequence of any commands different from the ones used
128       in the prologue.  Processing is terminated as soon as the first  x stop
129       command  is encountered; the last line of any groff intermediate output
130       always contains such a command.
131
132       Semantically, the body is page oriented.  A new page is  started  by  a
133       p  command.  Positioning, writing, and drawing commands are always done
134       within the current page, so they cannot occur before the first  p  com‐
135       mand.   Absolute positioning (by the H and V commands) is done relative
136       to the current page, all other positioning is done relative to the cur‐
137       rent location within this page.
138

Command reference

140       This  section describes all intermediate output commands, the classical
141       commands as well as the groff extensions.
142
143   Comment command
144       #anything⟨line-break⟩
145              A comment.  Ignore any characters from the # character up to the
146              next newline.  Each comment can be preceded by arbitrary syntac‐
147              tical space; every command can be terminated by a comment.
148
149   Simple commands
150       The commands in this subsection have a command  code  consisting  of  a
151       single character, taking a fixed number of arguments.  Most of them are
152       commands for positioning and text writing.  These  commands  are  smart
153       about  whitespace.   Optionally,  syntactical space can be inserted be‐
154       fore, after, and between the command letter and its arguments.  All  of
155       these  commands are stackable, i.e., they can be preceded by other sim‐
156       ple commands or followed by arbitrary other commands on the same  line.
157       A separating syntactical space is necessary only when two integer argu‐
158       ments would clash or if the preceding argument ends with a string argu‐
159       ment.
160
161       C id⟨white-space⟩
162              Typeset the glyph of the special character id.  Trailing syntac‐
163              tical space is necessary to allow special character names of ar‐
164              bitrary length.  The drawing position is not advanced.
165
166       c c    Typeset  the  glyph  of the ordinary character character c.  The
167              drawing position is not advanced.
168
169       f n    Select the font mounted at position n.  n cannot be negative.
170
171       H n    Horizontally move the drawing position to n basic units from the
172              left edge of the page.  n cannot be negative.
173
174       h n    Move  the  drawing position right n basic units.  AT&T troff al‐
175              lowed negative n; GNU troff does not produce  such  values,  but
176              groff's output driver library handles them.
177
178       m scheme [component ...]
179              Select  the stroke color using the components in the color space
180              scheme.  Each component is an integer between 0 and 65536.   The
181              quantity of components and their meanings vary with each scheme.
182              This command is a groff extension.
183
184              mc cyan magenta yellow
185                     Use the CMY color scheme with components  cyan,  magenta,
186                     and yellow.
187
188              md     Use  the  default  color  (no  components;  black in most
189                     cases).
190
191              mg gray
192                     Use a grayscale color scheme with a component ranging be‐
193                     tween 0 (black) and 65536 (white).
194
195              mk cyan magenta yellow black
196                     Use  the CMYK color scheme with components cyan, magenta,
197                     yellow, and black.
198
199              mr red green blue
200                     Use the RGB color scheme with components red, green,  and
201                     blue.
202
203       N n    Typeset  the  glyph with index n in the current font.  n is nor‐
204              mally a non-negative integer.  The drawing position is  not  ad‐
205              vanced.   The html and xhtml devices use this command with nega‐
206              tive n to produce unbreakable space; the absolute value of n  is
207              taken and interpreted in basic units.
208
209       n b a  Indicate  a  break.   No  action  is  performed;  the command is
210              present to make the output more easily parsed.  The  integers  b
211              and  a  describe the vertical space amounts before and after the
212              break, respectively.  GNU troff issues this command but  groff's
213              output driver library ignores it.  See v and V.
214
215       p n    Begin  a  new page, setting its number to n.  Each page is inde‐
216              pendent, even from those using the same  number.   The  vertical
217              drawing  position  is  set  to 0.  All positioning, writing, and
218              drawing commands are interpreted in the context of a page, so  a
219              p command must precede them.
220
221       s n    Set  type  size  to n scaled points (unit z in GNU troff).  AT&T
222              troff used unscaled points (p) instead; see section “Compatibil‐
223              ity” below.
224
225       t xyz...⟨white-space⟩
226       t xyz... dummy-arg⟨white-space⟩
227              Typeset  word  xyz;  that  is, set a sequence of ordinary glyphs
228              named x, y, z, ..., terminated by a space  or  newline;  an  op‐
229              tional  second integer argument is ignored (this allows the for‐
230              matter to generate an even number of arguments).  Each glyph  is
231              set  at  the  current drawing position, and the position is then
232              advanced horizontally by the glyph's width.  A glyph's width  is
233              read  from  its  metrics in the font description file, scaled to
234              the current type size, and rounded to a multiple of the horizon‐
235              tal motion quantum.  Use the C command to emplace glyphs of spe‐
236              cial characters.  The t command is a groff extension and is out‐
237              put  only  for devices whose DESC file contains the tcommand di‐
238              rective; see groff_font(5).
239
240       u n xyz...
241       u xyz... dummy-arg⟨white-space⟩
242              Typeset word xyz with track kerning.  As t,  but  after  placing
243              each  glyph,  the  drawing position is further advanced horizon‐
244              tally by n basic units.  The u command is a groff extension  and
245              is output only for devices whose DESC file contains the tcommand
246              directive; see groff_font(5).
247
248       V n    Vertically move the drawing position to n basic units  from  the
249              top edge of the page.  n cannot be negative.
250
251       v n    Move  the  drawing  position down n basic units.  AT&T troff al‐
252              lowed negative n; GNU troff does not produce  such  values,  but
253              groff's output driver library handles them.
254
255       w      Indicate  an inter-word space.  No action is performed; the com‐
256              mand is present to make the output more easily parsed.  Only ad‐
257              justable,  breakable inter-word spaces are thus described; those
258              resulting from \~ or horizontal motion escape sequences are not.
259              GNU  troff issues this command but groff's output driver library
260              ignores it.  See h and H.
261
262   Graphics commands
263       Each graphics or drawing command in the intermediate output starts with
264       the  letter  D followed by one or two characters that specify a subcom‐
265       mand; this is followed by a fixed or variable number of  integer  argu‐
266       ments  that are separated by a single space character.  A D command may
267       not be followed by another command on the same line (apart from a  com‐
268       ment), so each D command is terminated by a syntactical line break.
269
270       troff output follows the classical spacing rules (no space between com‐
271       mand and subcommand, all arguments are preceded by a single space char‐
272       acter),  but  the parser allows optional space between the command let‐
273       ters and makes the space before the first argument optional.  As usual,
274       each space can be any sequence of tab and space characters.
275
276       Some  graphics  commands  can  take a variable number of arguments.  In
277       this case, they are integers representing  a  size  measured  in  basic
278       units u.  The h arguments stand for horizontal distances where positive
279       means right, negative left.  The v arguments stand  for  vertical  dis‐
280       tances where positive means down, negative up.  All these distances are
281       offsets relative to the current location.
282
283       Unless indicated otherwise, each graphics command directly  corresponds
284       to a similar groff \D escape sequence; see groff(7).
285
286       Unknown  D  commands  are assumed to be device-specific.  Its arguments
287       are parsed as strings; the whole information is then sent to the  post‐
288       processor.
289
290       In  the  following  command  reference, the syntax element ⟨line-break⟩
291       means a syntactical line break as defined  in  subsection  “Separation”
292       above.
293
294       D~ h1 v1 h2 v2 ... hn vn⟨line-break⟩
295              Draw  B-spline from current position to offset (h1, v1), then to
296              offset (h2, v2) if given, etc., up  to  (hn, vn).  This  command
297              takes  a variable number of argument pairs; the current position
298              is moved to the terminal point of the drawn curve.
299
300       Da h1 v1 h2 v2⟨line-break⟩
301              Draw arc from current position to (h1, v1)+(h2, v2) with  center
302              at  (h1, v1);  then move the current position to the final point
303              of the arc.
304
305       DC d⟨line-break⟩
306       DC d dummy-arg⟨line-break⟩
307              Draw a solid circle using the current fill color with diameter d
308              (integer  in  basic  units u) with leftmost point at the current
309              position; then move the current position to the rightmost  point
310              of  the  circle.  An optional second integer argument is ignored
311              (this allows the formatter to generate an even number  of  argu‐
312              ments).  This command is a groff extension.
313
314       Dc d⟨line-break⟩
315              Draw circle line with diameter d (integer in basic units u) with
316              leftmost point at the current position; then  move  the  current
317              position to the rightmost point of the circle.
318
319       DE h v⟨line-break⟩
320              Draw a solid ellipse in the current fill color with a horizontal
321              diameter of h and a vertical diameter of v (both integers in ba‐
322              sic  units  u)  with the leftmost point at the current position;
323              then move to the rightmost point of the ellipse.   This  command
324              is a groff extension.
325
326       De h v⟨line-break⟩
327              Draw  an  outlined ellipse with a horizontal diameter of h and a
328              vertical diameter of v (both integers in basic units u) with the
329              leftmost  point  at current position; then move to the rightmost
330              point of the ellipse.
331
332       DF color-scheme [component ...]⟨line-break⟩
333              Set fill color for solid drawing objects using  different  color
334              schemes;  the  analogous  command for setting the color of text,
335              line graphics, and the outline of graphic  objects  is  m.   The
336              color  components  are  specified as integer arguments between 0
337              and 65536.  The number of color  components  and  their  meaning
338              vary for the different color schemes.  These commands are gener‐
339              ated by the groff escape sequences \D'F ...'  and  \M  (with  no
340              other corresponding graphics commands).  This command is a groff
341              extension.
342
343              DFc cyan magenta yellow⟨line-break⟩
344                     Set fill color for solid drawing objects  using  the  CMY
345                     color  scheme,  having  the  3 color components cyan, ma‐
346                     genta, and yellow.
347
348              DFd ⟨line-break⟩
349                     Set fill color for solid drawing objects to  the  default
350                     fill color value (black in most cases).  No component ar‐
351                     guments.
352
353              DFg gray⟨line-break⟩
354                     Set fill color for solid drawing objects to the shade  of
355                     gray  given by the argument, an integer between 0 (black)
356                     and 65536 (white).
357
358              DFk cyan magenta yellow black⟨line-break⟩
359                     Set fill color for solid drawing objects using  the  CMYK
360                     color  scheme,  having  the  4 color components cyan, ma‐
361                     genta, yellow, and black.
362
363              DFr red green blue⟨line-break⟩
364                     Set fill color for solid drawing objects  using  the  RGB
365                     color  scheme,  having the 3 color components red, green,
366                     and blue.
367
368       Df n⟨line-break⟩
369              The argument n must be an integer in the range -32767 to 32767.
370
371              0≤n≤1000
372                     Set the color for filling  solid  drawing  objects  to  a
373                     shade  of  gray, where 0 corresponds to solid white, 1000
374                     (the default) to solid black, and values  in  between  to
375                     intermediate shades of gray; this is obsoleted by command
376                     DFg.
377
378              n<0 or n>1000
379                     Set the filling color to the color that is currently  be‐
380                     ing  used  for  the  text and the outline, see command m.
381                     For example, the command sequence
382
383                            mg 0 0 65536
384                            Df -1
385
386                     sets all colors to blue.
387
388              This command is a groff extension.
389
390       Dl h v⟨line-break⟩
391              Draw line from current position to offset  (h, v)  (integers  in
392              basic  units  u);  then  set  current position to the end of the
393              drawn line.
394
395       Dp h1 v1 h2 v2 ... hn vn⟨line-break⟩
396              Draw a polygon line from current position  to  offset  (h1, v1),
397              from  there to offset (h2, v2), etc., up to offset (hn, vn), and
398              from there back to the starting position.  For  historical  rea‐
399              sons, the position is changed by adding the sum of all arguments
400              with odd index to the current horizontal position and  the  even
401              ones to the vertical position.  Although this doesn't make sense
402              it is kept for compatibility.  This command is  a  groff  exten‐
403              sion.
404
405       DP h1 v1 h2 v2 ... hn vn⟨line-break⟩
406              The same macro as the corresponding Dp command with the same ar‐
407              guments, but draws a solid polygon in  the  current  fill  color
408              rather than an outlined polygon.  The position is changed in the
409              same way as with Dp.  This command is a groff extension.
410
411       Dt n⟨line-break⟩
412              Set the current  line  thickness  to  n  (an  integer  in  basic
413              units  u)  if  n>0;  if  n=0  select the smallest available line
414              thickness; otherwise, the line thickness is made proportional to
415              the  type  size,  which is the default.  For historical reasons,
416              the horizontal position is changed by adding the argument to the
417              current  horizontal position, while the vertical position is not
418              changed.  Although this doesn't make sense, it is kept for  com‐
419              patibility.  This command is a groff extension.
420
421   Device control commands
422       Each  device  control  command  starts  with the letter x followed by a
423       space character (optional or arbitrary space/tab in groff) and  a  sub‐
424       command  letter  or  word; each argument (if any) must be preceded by a
425       syntactical space.  All x commands are terminated by a syntactical line
426       break;  no device control command can be followed by another command on
427       the same line (except a comment).
428
429       The subcommand is basically a single letter, but to increase  readabil‐
430       ity,  it can be written as a word, i.e., an arbitrary sequence of char‐
431       acters terminated by the next tab, space, or  newline  character.   All
432       characters  of  the  subcommand  word but the first are simply ignored.
433       For example, troff outputs the initialization command x i as x init and
434       the  resolution command x r as x res.  But writings like x i_like_groff
435       and x roff_is_groff are accepted as well to mean the same commands.
436
437       In the following, the syntax element ⟨line-break⟩ means  a  syntactical
438       line break as defined in subsection “Separation” above.
439
440       xF name⟨line-break⟩
441              (Filename control command)
442              Use  name as the intended name for the current file in error re‐
443              ports.  This is useful for remembering the  original  file  name
444              when groff uses an internal piping mechanism.  The input file is
445              not changed by this command.  This command is a groff extension.
446
447       xf n s⟨line-break⟩
448              (font control command)
449              Mount font position n (a non-negative integer) with font named s
450              (a text word); see groff_font(5).
451
452       xH n⟨line-break⟩
453              (Height control command)
454              Set  character  height  to  n  (a  positive  integer  in  scaled
455              points z).  Classical troff used the unit  points  (p)  instead;
456              see section “Compatibility” below.
457
458       xi ⟨line-break⟩
459              (init control command)
460              Initialize device.  This is the third command of the prologue.
461
462       xp ⟨line-break⟩
463              (pause control command)
464              Parsed but ignored.  The classical documentation reads pause de‐
465              vice, can be restarted.
466
467       xr n h v⟨line-break⟩
468              (resolution control command)
469              Resolution is n, while h is the minimal horizontal motion, and v
470              the minimal vertical motion possible with this device; all argu‐
471              ments are positive integers in basic units u per inch.  This  is
472              the second command of the prologue.
473
474       xS n⟨line-break⟩
475              (Slant control command)
476              Set slant to n degrees (an integer in basic units u).
477
478       xs ⟨line-break⟩
479              (stop control command)
480              Terminates  the  processing  of  the current file; issued as the
481              last command of any intermediate troff output.
482
483       xt ⟨line-break⟩
484              (trailer control command)
485              Generate trailer information, if any.  In groff,  this  is  cur‐
486              rently ignored.
487
488       xT xxx⟨line-break⟩
489              (Typesetter control command)
490              Set  the  name  of  the output driver to xxx, a sequence of non-
491              whitespace characters terminated by  whitespace.   The  possible
492              names  correspond  to  those  of groff's -T option.  This is the
493              first command of the prologue.
494
495       xu n⟨line-break⟩
496              (underline control command)
497              Configure underlining of spaces.  If n is 1,  start  underlining
498              of  spaces;  if  n  is  0,  stop underlining of spaces.  This is
499              needed for the cu request in nroff mode and  is  ignored  other‐
500              wise.  This command is a groff extension.
501
502       xX anything⟨line-break⟩
503              (X-escape control command)
504              Send  string  anything uninterpreted to the device.  If the line
505              following this command starts with a + character  this  line  is
506              interpreted  as a continuation line in the following sense.  The
507              + is ignored, but a newline character is sent instead to the de‐
508              vice,  the rest of the line is sent uninterpreted.  The same ap‐
509              plies to all following lines until the first character of a line
510              is  not  a  + character.  This command is generated by the groff
511              escape sequence \X.  The line-continuing feature is a groff  ex‐
512              tension.
513
514   Obsolete command
515       In classical troff output, emitting a single glyph was mostly done by a
516       very strange command that combined a horizontal move and  the  printing
517       of  a  glyph.   It  didn't have a command code, but is represented by a
518       3-character argument consisting of exactly 2 digits and a character.
519
520       ddc    Move right dd (exactly two decimal digits) basic units  u,  then
521              print glyph with single-letter name c.
522
523              In  groff,  arbitrary  syntactical  space around and within this
524              command is allowed to be added.  Only when a  preceding  command
525              on the same line ends with an argument of variable length a sep‐
526              arating space is obligatory.  In classical troff, large clusters
527              of  these  and  other commands were used, mostly without spaces;
528              this made such output almost unreadable.
529
530       For modern high-resolution devices, this command does  not  make  sense
531       because the width of the glyphs can become much larger than two decimal
532       digits.  In groff, it is used only for output to the X75, X75-12, X100,
533       and  X100-12 devices.  For others, the commands t and u provide greater
534       functionality and superior troubleshooting capacity.
535

Postprocessing

537       The roff postprocessors are programs that have the  task  to  translate
538       the  intermediate output into actions that are sent to a device.  A de‐
539       vice can be some piece of hardware such as a  printer,  or  a  software
540       file  format suitable for graphical or text processing.  The groff sys‐
541       tem provides powerful means that make the programming of such  postpro‐
542       cessors an easy task.
543
544       There  is  a  library  function that parses the intermediate output and
545       sends the information obtained to the device via  methods  of  a  class
546       with a common interface for each device.  So a groff postprocessor must
547       only redefine the methods of this class.  For details, see  the  refer‐
548       ence in section “Files” below.
549

Example

551       This  section  presents the intermediate output generated from the same
552       input for three different devices.  The  input  is  the  sentence  hell
553       world fed into groff on the command line.
554
555       • High-resolution device ps
556
557         shell> echo "hell world" | groff -Z -T ps
558
559         x T ps
560         x res 72000 1 1
561         x init
562         p1
563         x font 5 TR
564         f5
565         s10000
566         V12000
567         H72000
568         thell
569         wh2500
570         tw
571         H96620
572         torld
573         n12000 0
574         x trailer
575         V792000
576         x stop
577
578       This  output can be fed into the postprocessor grops(1) to get its rep‐
579       resentation as a PostScript file, or gropdf(1) to  output  directly  to
580       PDF.
581
582       • Low-resolution device latin1
583
584         This  is  similar to the high-resolution device except that the posi‐
585         tioning is done at a minor scale.  Some comments (lines starting with
586         #)  were added for clarification; they were not generated by the for‐
587         matter.
588
589         shell> "hell world" | groff -Z -T latin1
590
591         # prologue
592         x T latin1
593         x res 240 24 40
594         x init
595         # begin a new page
596         p1
597         # font setup
598         x font 1 R
599         f1
600         s10
601         # initial positioning on the page
602         V40
603         H0
604         # write text 'hell'
605         thell
606         # inform about a space, and do it by a horizontal jump
607         wh24
608         # write text 'world'
609         tworld
610         # announce line break, but do nothing because ...
611         n40 0
612         # ... the end of the document has been reached
613         x trailer
614         V2640
615         x stop
616
617       This output can be fed into the postprocessor grotty(1) to get  a  for‐
618       matted text document.
619
620       • Classical style output
621
622         As  a  computer  monitor has a very low resolution compared to modern
623         printers the intermediate output for the X devices can use the  jump-
624         and-write command with its 2-digit displacements.
625
626         shell> "hell world" | groff -Z -T X100
627
628         x T X100
629         x res 100 1 1
630         x init
631         p1
632         x font 5 TR
633         f5
634         s10
635         V16
636         H100
637         # write text with old-style jump-and-write command
638         ch07e07l03lw06w11o07r05l03dh7
639         n16 0
640         x trailer
641         V1100
642         x stop
643
644       This   output  can  be  fed  into  the  postprocessor  xditview(1x)  or
645       gxditview(1) for displaying in X.
646
647       Due to the obsolete jump-and-write command, the text  clusters  in  the
648       classical output are almost unreadable.
649

Compatibility

651       The intermediate output language of the classical troff was first docu‐
652       mented in [CSTR #97].  The groff intermediate output format is compati‐
653       ble with this specification except for the following features.
654
655       • The classical quasi device independence is not yet implemented.
656
657       • The  old  hardware was very different from what we use today.  So the
658         groff devices are also fundamentally different from the ones in clas‐
659         sical troff.  For example, the classical PostScript device was called
660         post and had a resolution of 720 units per inch, while groff's ps de‐
661         vice  has a resolution of 72000 units per inch.  Maybe, by implement‐
662         ing some rescaling mechanism similar to the  classical  quasi  device
663         independence, these could be integrated into modern groff.
664
665       • The B-spline command D~ is correctly handled by the intermediate out‐
666         put parser, but the drawing routines aren't implemented  in  some  of
667         the postprocessor programs.
668
669       • The  argument  of the commands s and x H has the implicit unit scaled
670         point z in groff, while classical troff had point (p).  This isn't an
671         incompatibility,  but a compatible extension, for both units coincide
672         for all devices without a sizescale parameter, including all  classi‐
673         cal  and  the  groff  text  devices.   The  few  groff devices with a
674         sizescale parameter either did not exist, had a  different  name,  or
675         seem to have had a different resolution.  So conflicts with classical
676         devices are very unlikely.
677
678       • The position changing after the commands Dp, DP, and Dt is illogical,
679         but as old versions of groff used this feature it is kept for compat‐
680         ibility reasons.
681
682       The differences between groff and classical  troff  are  documented  in
683       groff_diff(7).
684

Files

686       /usr/share/groff/1.23.0/font/devname/DESC
687              describes the output device name.
688

Authors

690       James  Clark  wrote  an early version of this document, which described
691       only the differences between  AT&T  device-independent  troff's  output
692       format  and  that  of  GNU  roff.   The  present version was completely
693       rewritten in 2001 by Bernd Warken ⟨groff-bernd.warken-72@web.de⟩.
694

See also

696       Groff: The GNU Implementation of troff, by Trent A. Fisher  and  Werner
697       Lemberg,  is the primary groff manual.  You can browse it interactively
698       with “info groff”.
699
700       “Troff User's Manual” by Joseph F. Ossanna, 1976 (revised by  Brian  W.
701       Kernighan,  1992),  AT&T  Bell Laboratories Computing Science Technical
702       Report No. 54, widely called simply “CSTR #54”, documents the language,
703       device and font description file formats, and device-independent output
704       format referred to collectively in groff documentation as “AT&T troff”.
705
706       “A Typesetter-independent TROFF” by Brian W. Kernighan, 1982, AT&T Bell
707       Laboratories  Computing Science Technical Report No. 97, provides addi‐
708       tional insights into the device and font description file  formats  and
709       device-independent output format.
710
711       groff(1)
712              documents  the  -Z option and contains pointers to further groff
713              documentation.
714
715       groff(7)
716              describes the groff language, including its escape sequences and
717              system of units.
718
719       groff_font(5)
720              details the device scaling parameters of device DESC files.
721
722       troff(1)
723              generates  the device-independent intermediate output documented
724              here.
725
726       roff(7)
727              presents historical aspects and the general  structure  of  roff
728              systems.
729
730       groff_diff(7)
731              enumerates  differences between the intermediate output produced
732              by AT&T troff and that of groff.
733
734       gxditview(1)
735              is a viewer for intermediate output.
736
737       Roff.js
738https://github.com/Alhadis/Roff.js/⟩ is a viewer for intermedi‐
739              ate output written in JavaScript.
740
741       grodvi(1),  grohtml(1),  grolbp(1), grolj4(1), gropdf(1), grops(1), and
742       grotty(1) are groff postprocessors.
743
744
745
746groff 1.23.0                    2 November 2023                   groff_out(5)
Impressum