|
From: | Clarke Echols |
Subject: | Re: [Groff] conditional logic based on device? |
Date: | Thu, 21 Feb 2008 07:04:46 -0700 |
User-agent: | Thunderbird 2.0.0.9 (Windows/20071031) |
Michael(tm) Smith wrote:
Werner LEMBERG <address@hidden>, 2008-02-20 18:53 +0100:> .if n \" for nroff processing input > .if t \" for troff/groff processing inputI read the groff info node about conditionals, but just didn't know how to specify a condition that would only affect console output.Hmm. groff.texinfo has an index entry for `nroff mode' which points to section named `Troff and Nroff Mode', and which explains the differences. Anyway, I'll add links.OK, I did now read the following in the that node: "Originally, `nroff' and `troff' were two separate programs, the former for TTY output, the latter for everything else. [...] it is sometimes necessary to make a distinction between TTY and non-TTY devices: `gtroff' provides two built-in conditions `n' and `t' for the `if', `ie', and `while' requests to decide whether `gtroff' shall behave like `nroff' or like `troff'."
I was not aware that groff had both conditionals. The correct classic behavior would be for troff to ignore anything following the ".if n" conditional, and nroff would ignore input associated with ".if t" . I learned about it when modifying the man macros for producing theHP-UX man pages. I once told a co-worker if one wants to learn and understand troff (groff), a good way would be to take a completely
uncommented man macro file (or mm, ms, me, etc.) and convert it into a completely commented file where every operation is fully explained, and do it without breaking any macros. That's essentially how I learned it. Clarke
[Prev in Thread] | Current Thread | [Next in Thread] |