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

NAME

6       groff_out - groff intermediate output format
7

DESCRIPTION

9       This  manual  page  describes the intermediate output format of the GNU
10       roff(7) text processing system groff(1).  This output is produced by  a
11       run  of  the GNU troff(1) program.  It contains already all device-spe‐
12       cific information, but it is not yet fed into  a  device  postprocessor
13       program.
14
15       As  the  GNU  roff processor groff(1) is a wrapper program around troff
16       that automatically calls a postprocessor, this output does not show  up
17       normally.   This is why it is called intermediate within the groff sys‐
18       tem.  The groff program provides the option -Z to inhibit  postprocess‐
19       ing,  such  that  the  produced intermediate output is sent to standard
20       output just like calling troff manually.
21
22       In this document, the term troff output describes what is output by the
23       GNU  troff  program,  while  intermediate output refers to the language
24       that is accepted by the parser that prepares this output for the  post‐
25       processors.   This parser is smarter on whitespace and implements obso‐
26       lete elements for compatibility, otherwise both formats are  the  same.
27       Both formats can be viewed directly with gxditview(1).
28
29       The  main  purpose  of the intermediate output concept is to facilitate
30       the development of postprocessors by providing a common programming in‐
31       terface  for  all  devices.   It has a language of its own that is com‐
32       pletely different from the groff(7) language.  While the groff language
33       is  a high-level programming language for text processing, the interme‐
34       diate output language is a kind  of  low-level  assembler  language  by
35       specifying all positions on the page for writing and drawing.
36
37       The pre-groff roff versions are denoted as classical troff.  The inter‐
38       mediate output produced by groff is fairly  readable,  while  classical
39       troff  output was hard to understand because of strange habits that are
40       still supported, but not used any longer by GNU troff.
41

LANGUAGE CONCEPTS

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

COMMAND REFERENCE

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

POSTPROCESSING

558       The roff postprocessors are programs that have the  task  to  translate
559       the  intermediate output into actions that are sent to a device.  A de‐
560       vice can be some piece of hardware such as a  printer,  or  a  software
561       file  format suitable for graphical or text processing.  The groff sys‐
562       tem provides powerful means that make the programming of such  postpro‐
563       cessors an easy task.
564
565       There  is  a  library  function that parses the intermediate output and
566       sends the information obtained to the device via  methods  of  a  class
567       with a common interface for each device.  So a groff postprocessor must
568       only redefine the methods of this class.  For details, see  the  refer‐
569       ence in section “Files” below.
570

EXAMPLES

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

COMPATIBILITY

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

FILES

707       /usr/share/groff/1.22.4/font/devname/DESC
708              Device description file for device name.
709
710       src/libs/libdriver/input.cpp
711              Defines  the  parser and postprocessor for the intermediate out‐
712              put.  It is located relative to the top directory of  the  groff
713              source tree.  This parser is the definitive specification of the
714              groff intermediate output format.
715

AUTHORS

717       James Clark wrote an early version of this  document,  which  described
718       only the differences between ditroff(7)'s output format and that of GNU
719       roff.  The present version was completely rewritten in  2001  by  Bernd
720       Warken ⟨groff-bernd.warken-72@web.de⟩.
721

SEE ALSO

723       A  reference  like groff(7) refers to a manual page; here groff in sec‐
724       tion 7 of the man page documentation system.  To read the example, look
725       up section 7 in your desktop help system or call from the shell prompt
726
727              shell> man 7 groff
728
729       For more details, see man(1).
730
731       groff(1)
732              option -Z and further readings on groff.
733
734       groff(7)
735              for  details  of  the groff language such as numerical units and
736              escape sequences.
737
738       groff_font(5)
739              for details on the device scaling parameters of the DESC file.
740
741       troff(1)
742              generates the device-independent intermediate output.
743
744       roff(7)
745              for historical aspects and the general structure  of  roff  sys‐
746              tems.
747
748       groff_diff(7)
749              The  differences  between  the  intermediate output in groff and
750              classical troff.
751
752       gxditview(1)
753              Viewer for the intermediate output.
754
755       grodvi(1), grohtml(1), grolbp(1), grolj4(1), grops(1), grotty(1)
756              the groff postprocessor programs.
757
758       Groff: The GNU Implementation of troff, by Trent A. Fisher  and  Werner
759       Lemberg,  is the primary groff manual.  You can browse it interactively
760       with “info groff”.
761
762       The classical troff output language is described in two AT&T Bell  Labs
763       CSTR  documents  available  on-line  at  Bell  Labs  CSTR site ⟨http://
764       cm.bell-labs.com/cm/cs/cstr.html⟩.
765
766       [CSTR #97]
767              A Typesetter-independent TROFF by Brian Kernighan is the  origi‐
768              nal and most comprehensive documentation on the output language;
769              see CSTR #97 ⟨http://cm.bell-labs.com/cm/cs/cstr/97.ps.gz⟩.
770
771       [CSTR #54]
772              The 1992 revision of the Nroff/Troff User's Manual by J. F.  Os‐
773              sanna  and  Brian Kernighan isn't as comprehensive as [CSTR #97]
774              regarding  the  output   language;   see   CSTR   #54   ⟨http://
775              cm.bell-labs.com/cm/cs/cstr/54.ps.gz⟩.
776
777
778
779groff 1.22.4                    20 January 2022                   GROFF_OUT(5)
Impressum