Copyright (C) 2000-2012 |
GNU Info (groff)Operators in ConditionalsOperators in Conditionals ------------------------- In `if' and `while' requests, there are several more operators available: `e' `o' True if the current page is even or odd numbered (respectively). `n' True if the document is being processed in nroff mode (i.e., the `.nroff' command has been issued). `t' True if the document is being processed in troff mode (i.e., the `.troff' command has been issued). `v' Always false. `'XXX'YYY'' True if the string XXX is equal to the string YYY. Other characters can be used in place of the single quotes; the same set of delimiters as for the `\D' escape is used (Note: Escapes). `gtroff' formats the strings before being compared: .ie "|"\fR|\fP" \ true .el \ false => true The resulting motions, character sizes, and fonts have to match,(1) (Note: Operators in Conditionals-Footnote-1) and not the individual motion, size, and font requests. In the previous example, `|' and `\fR|\fP' both result in a roman `|' character 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. `r XXX' True if there is a number register named XXX. `d XXX' True if there is a string, macro, diversion, or request named XXX. `c CH' True if there is a character CH available; CH is either an ASCII character or a special character (`\(CH' or `\[CH]'); the condition is also true if CH has been defined by the `char' request. Note 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. Note: Expressions. automatically generated by info2www version 1.2.2.9 |