As the GNU roff processor groff(1) is a wrapper program around troff that automatically calls a postprocessor, this output does not show up normally. This is why it is called intermediate within the groff system. The groff program provides the option -Z to inhibit postprocessing, such that the produced intermediate output is sent to standard output just like calling troff manually.
In this document, the term troff output describes what is output by the GNU troff program, while intermediate output refers to the language that is accepted by the parser that prepares this output for the postprocessors. This parser is smarter on whitespace and implements obsolete elements for compatibility, otherwise both formats are the same. Both formats can be viewed directly with gxditview(1)
The main purpose of the intermediate output concept is to facilitate the development of postprocessors by providing a common programming interface for all devices. It has a language of its own that is completely different from the groff(7) language. While the groff language is a high-level programming language for text processing, the intermediate output language is a kind of low-level assembler language by specifying all positions on the page for writing and drawing.
The roff versions are denoted as classical troff. The intermediate output produced by groff is fairly readable, while classical troff output was hard to understand because of strange habits that are still supported, but not used any longer by GNU troff.
Any sequence of space or tab characters is treated as a single syntactical space. It separates commands and arguments, but is only required when there would occur a clashing between the command code and the arguments without the space. Most often, this happens when variable length command names, arguments, argument lists, or command clusters meet. Commands and arguments with a known, fixed length need not be separated by syntactical space.
A line break is a syntactical element, too. Every command argument can be followed by whitespace, a comment, or a newline character. Thus a syntactical line break is defined to consist of optional syntactical space that is optionally followed by a comment, and a newline character.
The normal commands, those for positioning and text, consist of a single letter taking a fixed number of arguments. For historical reasons, the parser allows to stack such commands on the same line, but fortunately, in groff intermediate output, every command with at least one argument is followed by a line break, thus providing excellent readability.
The other commands -- those for drawing and device controlling -- have a more complicated structure; some recognize long command names, and some take a variable number of arguments. So all D and x commands were designed to request a syntactical line break after their last argument. Only one command, has an argument that can stretch over several lines, all other commands must have all of their arguments on the same line as the command, i.e., the arguments may not be splitted by a line break.
Empty lines, i.e., lines containing only space and/or a comment, can occur everywhere. They are just ignored.
Note that single characters can have the eighth bit set, as can the names of fonts and special characters. The names of characters and fonts can be of arbitrary length. A character that is to be printed will always be in the current font.
A string argument is always terminated by the next whitespace character (space, tab, or newline); an embedded # character is regarded as part of the argument, not as the beginning of a comment command. An integer argument is already terminated by the next non-digit character, which then is regarded as the first character of the next argument or command.
The task of the prologue is to set the general device parameters using three exactly specified commands. The groff prologue is guaranteed to consist of the following three lines (in that order):
x T
device
x res
n h v
x init
with the arguments set as outlined in the section Device Control Commands. But the parser for the intermediate output format is able to swallow additional whitespace and comments as well.
The body is the main section for processing the document data. Syntactically, it is a sequence of any commands different from the ones used in the prologue. Processing is terminated as soon as the first x stop command is encountered; the last line of any groff intermediate output always contains such a command.
Semantically, the body is page oriented. A new page is started by a p command. Positioning, writing, and drawing commands are always done within the current page, so they cannot occur before the first p command. Absolute positioning (by the H and V commands) is done relative to the current page, all other positioning is done relative to the current location within this page.
This command is the only possibility for commenting in the intermediate output. Each comment can be preceded by arbitrary syntactical space; every command can be terminated by a comment.
troff output follows the classical spacing rules (no space between command and subcommand, all arguments are preceded by a single space character), but the parser allows optional space between the command letters and makes the space before the first argument optional. As usual, each space can be any sequence of tab and space characters.
Some graphics commands can take a variable number of arguments. In this case, they are integers representing a size measured in basic units u. The arguments called h1, h2, ..., hn stand for horizontal distances where positive means right, negative left. The arguments called v1, v2, ..., vn stand for vertical distances where positive means down, negative up. All these distances are offsets relative to the current location.
Unless indicated otherwise, each graphics command directly corresponds to a similar groff \D escape sequence; see groff(7)
Unknown D commands are assumed to be device-specific. Its arguments are parsed as strings; the whole information is then sent to the postprocessor.
In the following command reference, the syntax element
n
mmgg 00 00 6655553366 DDff --11sets all colors to blue.
No position changing. This command is a groff extension.
The subcommand is basically a single letter, but to increase readability, it can be written as a word, i.e., an arbitrary sequence of characters terminated by the next tab, space, or newline character. All characters of the subcommand word but the first are simply ignored. For example, troff outputs the initialization command x i as x init and the resolution command x r as x res. But writings like x i_like_groff and x roff_is_groff resp. are accepted as well to mean the same commands.
In the following, the syntax element
> <> <
> xx TT ppss xx rreess 7722000000 11 11 xx iinniitt pp11 xx ffoonntt 55 TTRR ff55 ss1100000000 VV1122000000 HH7722000000 tthheellll wwhh22550000 ttww HH9966662200 ttoorrlldd nn1122000000 00 xx ttrraaiilleerr VV779922000000 xx ssttoopp </pprree>> <
>
TThhiiss oouuttppuutt ccaann bbee ffeedd iinnttoo tthhee ppoossttpprroocceessssoorr
<>ggrrooppss((11))</aa>>
ttoo ggeett iittss rreepprreesseennttaattiioonn aass aa PPoossttSSccrriipptt ffiillee..
< >
TThhiiss iiss ssiimmiillaarr ttoo tthhee hhiigghh--rreessoolluuttiioonn ddeevviiccee eexxcceepptt tthhaatt tthhee
ppoossiittiioonniinngg iiss ddoonnee aatt aa mmiinnoorr ssccaallee..
SSoommee ccoommmmeennttss ((lliinneess ssttaarrttiinngg wwiitthh
<>##</ii>>))
wweerree aaddddeedd ffoorr ccllaarriiffiiccaattiioonn;; tthheeyy wweerree nnoott ggeenneerraatteedd bbyy tthhee
ffoorrmmaatttteerr..
< >
<>
<>sshheellll>></ii>> eecchhoo hheellll wwoorrlldd || ggrrooffff --ZZ --TT llaattiinn11
< >
<>
< >
<>## pprroolloogguuee</ii>>
xx TT llaattiinn11
xx rreess 224400 2244 4400
xx iinniitt
<>## bbeeggiinn aa nneeww ppaaggee</ii>>
pp11
<>## ffoonntt sseettuupp</ii>>
xx ffoonntt 11 RR
ff11
ss1100
<>## iinniittiiaall ppoossiittiioonniinngg oonn tthhee ppaaggee</ii>>
VV4400
HH00
<>## wwrriittee tteexxtt ``hheellll''</ii>>
tthheellll
<>## iinnffoorrmm aabboouutt aa ssppaaccee,, aanndd ddoo iitt bbyy aa hhoorriizzoonnttaall jjuummpp</ii>>
wwhh2244
<>## wwrriittee tteexxtt ``wwoorrlldd''</ii>>
ttwwoorrlldd
<>## aannnnoouunnccee lliinnee bbrreeaakk,, bbuutt ddoo nnootthhiinngg bbeeccaauussee ......</ii>>
nn4400 00
<>## ...... tthhee eenndd ooff tthhee ddooccuummeenntt hhaass bbeeeenn rreeaacchheedd</ii>>
xx ttrraaiilleerr
VV22664400
xx ssttoopp
</pprree>>
< >
TThhiiss oouuttppuutt ccaann bbee ffeedd iinnttoo tthhee ppoossttpprroocceessssoorr
<>ggrroottttyy((11))</aa>>
ttoo ggeett aa ffoorrmmaatttteedd tteexxtt ddooccuummeenntt..
< >
AAss aa ccoommppuutteerr mmoonniittoorr hhaass aa vveerryy llooww rreessoolluuttiioonn ccoommppaarreedd ttoo mmooddeerrnn
pprriinntteerrss tthhee
<>iinntteerrmmeeddiiaattee oouuttppuutt</ii>>
ffoorr tthhee XX ddeevviicceess ccaann uussee tthhee jjuummpp--aanndd--wwrriittee ccoommmmaanndd wwiitthh iittss 22--ddiiggiitt
ddiissppllaacceemmeennttss..
< >
<>
<>sshheellll>></ii>> eecchhoo hheellll wwoorrlldd || ggrrooffff --ZZ --TT XX110000
< >
<>
< >
xx TT XX110000
xx rreess 110000 11 11
xx iinniitt
pp11
xx ffoonntt 55 TTRR
ff55
ss1100
VV1166
HH110000
<>## wwrriittee tteexxtt wwiitthh oolldd--ssttyyllee jjuummpp--aanndd--wwrriittee ccoommmmaanndd</ii>>
cchh0077ee0077ll0033llww0066ww1111oo0077rr0055ll0033ddhh77
nn1166 00
xx ttrraaiilleerr
VV11110000
xx ssttoopp
</pprree>>
< >
TThhiiss oouuttppuutt ccaann bbee ffeedd iinnttoo tthhee ppoossttpprroocceessssoorr
<>xxddiittvviieeww</bb>>((11xx))
oorr
<>ggxxddiittvviieeww((11))</aa>>
ffoorr ddiissppllaayyiinngg iinn XX..
< >
DDuuee ttoo tthhee oobbssoolleettee jjuummpp--aanndd--wwrriittee ccoommmmaanndd,, tthhee tteexxtt cclluusstteerrss iinn tthhee
ccllaassssiiccaall oouuttppuutt aarree aallmmoosstt uunnrreeaaddaabbllee..
< >
TThhee ddiiffffeerreenncceess bbeettwweeeenn
<>ggrrooffff</ii>>
aanndd
<>ccllaassssiiccaall ttrrooffff</ii>>
aarree ddooccuummeenntteedd iinn
<>ggrrooffff__ddiiffff((77))</aa>>
< >
<>
<>sshheellll>></ii>> mmaann 77 ggrrooffff
< >
FFoorr mmoorree ddeettaaiillss,, sseeee
<>mmaann((11))</aa>>
< >
<>ggrrooddvvii((11))</aa>>
<>ggrroohhttmmll((11))</aa>>
<>ggrroollbbpp((11))</aa>>
<>ggrroolljj44((11))</aa>>
<>ggrrooppss((11))</aa>>
<>ggrroottttyy((11))</aa>>
<>
tthhee ggrrooffff ppoossttpprroocceessssoorr pprrooggrraammss..
< >
FFoorr aa ttrreeaattmmeenntt ooff aallll aassppeeccttss ooff tthhee ggrrooffff ssyysstteemm wwiitthhiinn aa ssiinnggllee
ddooccuummeenntt,, sseeee tthhee
<>ggrrooffff iinnffoo</ii>>
<>ffiillee</ii>>..
IItt ccaann bbee rreeaadd wwiitthhiinn tthhee iinntteeggrraatteedd hheellpp ssyysstteemmss,, wwiitthhiinn
<>eemmaaccss((11))</aa>>
oorr ffrroomm tthhee sshheellll pprroommpptt bbyy
<>
<>sshheellll>></ii>> iinnffoo ggrrooffff
< >
TThhee
<>ccllaassssiiccaall ttrrooffff oouuttppuutt llaanngguuaaggee</ii>>
iiss ddeessccrriibbeedd iinn ttwwoo AATT&&TT BBeellll LLaabbss CCSSTTRR ddooccuummeennttss aavvaaiillaabbllee oonn--lliinnee aatt
BBeellll LLaabbss CCSSTTRR ssiittee < >
TThhiiss ddooccuummeenntt iiss ddiissttrriibbuutteedd uunnddeerr tthhee tteerrmmss ooff tthhee FFDDLL ((GGNNUU FFrreeee
DDooccuummeennttaattiioonn LLiicceennssee)) vveerrssiioonn 11..11 oorr llaatteerr..
YYoouu sshhoouulldd hhaavvee rreecceeiivveedd aa ccooppyy ooff tthhee FFDDLL wwiitthh tthhiiss ppaacckkaaggee;; iitt iiss aallssoo
aavvaaiillaabbllee oonn--lliinnee aatt tthhee
GGNNUU ccooppyylleefftt ssiittee < >
TThhiiss ddooccuummeenntt iiss ppaarrtt ooff
<>ggrrooffff</ii>>,,
tthhee GGNNUU
<>rrooffff</ii>>
ddiissttrriibbuuttiioonn..
IItt iiss bbaasseedd oonn aa ffoorrmmeerr vveerrssiioonn -- ppuubblliisshheedd uunnddeerr tthhee GGPPLL -- tthhaatt
ddeessccrriibbeedd oonnllyy ppaarrttss ooff tthhee
<>ggrrooffff</ii>>
eexxtteennssiioonnss ooff tthhee oouuttppuutt llaanngguuaaggee..
IItt hhaass bbeeeenn rreewwrriitttteenn 22000022 bbyy BBeerrnndd WWaarrkkeenn aanndd iiss
mmaaiinnttaaiinneedd bbyy
WWeerrnneerr LLeemmbbeerrgg <