In if, ie, and while requests, in addition to ordinary
Expressions, there are several more operators available:
eon.nroff command has been issued). See Troff and Nroff Mode.
t.troff command has been issued). See Troff and Nroff Mode.
vtroff versions only (identifying a -Tversatec device).
'xxx'yyy'\D escape is used
(see Escapes). gtroff formats xxx and yyy in
separate environments; after the comparison the resulting data is
discarded.
.ie "|"\fR|\fP" \
true
.el \
false
⇒ true
The resulting motions, glyph sizes, and fonts have to match,1 and not the individual motion, size, and font requests. In the previous example, ‘|’ and ‘\fR|\fP’ both result in a roman ‘|’ glyph with the same point size and at the same location on the page, so the strings are equal. If ‘.ft I’ had been added before the ‘.ie’, the result would be “false” because (the first) ‘|’ produces an italic ‘|’ rather than a roman one.
To compare strings without processing, surround the data with \?.
.ie "\?|\?"\?\fR|\fP\?" \
true
.el \
false
⇒ false
Since data protected with \? is read in copy-in mode it is even
possible to use incomplete input without causing an error.
.ds a \[
.ds b \[
.ie '\?\*a\?'\?\*b\?' \
true
.el \
false
⇒ true
r xxxd xxxm xxxc g\N'xxx', \(gg or
\[ggg]); the condition is also true if g has been
defined by the char request.
F fontft request (this is, font translation and
styles are applied), without actually mounting it.
This test doesn't load the complete font but only its header to verify
its validity.
S styleNote that these operators can't be combined with other operators like ‘:’ or ‘&’; only a leading ‘!’ (without whitespace between the exclamation mark and the operator) can be used to negate the result.
.nr xxx 1
.ie !r xxx \
true
.el \
false
⇒ false
A whitespace after ‘!’ always evaluates to zero (this bizarre
behaviour is due to compatibility with UNIX troff).
.nr xxx 1
.ie ! r xxx \
true
.el \
false
⇒ r xxx true
It is possible to omit the whitespace before the argument to the ‘r’, ‘d’, and ‘c’ operators.
See Expressions.
[1] The created output nodes must be identical. See Gtroff Internals.
[2] The name of this conditional operator is a misnomer since it tests names of output glyphs.