Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ico!vail!rcd From: rcd@ico.ISC.COM (Dick Dunn) Newsgroups: comp.text Subject: Re: Troff Macro Programming A: Part 1 [repost] Summary: NOT troff (but sqtroff perhaps) Message-ID: <15768@vail.ICO.ISC.COM> Date: 16 May 89 21:13:10 GMT References: <18@nx32s.anduk.co.uk> Distribution: comp Organization: Interactive Systems Corp, Boulder, CO Lines: 64 In article <18@nx32s.anduk.co.uk>, lee@anduk.co.uk (Liam R. Quin) posted the beginning of an introduction supposedly for troff. However, much of it is specific to a formatter based on troff but significantly changed. I assume he's talking about one by ``SoftQuad Publishing Software'' mentioned in the article as sqtroff. It's particularly confusing to read: > I have marked with a side-bar where there are most likely to be > differences | > | old troff: > | Like this. because "old troff" is conventionally used to refer to pre-DWB troff, i.e., the one which generated C/A/T output. But in the article by Quin, "old troff" comments also apply to "new troff" (i.e., ditroff). I think it's an exceptionally bad idea to start right off teaching people a notation which is peculiar to a vendor-specific extended version of troff and not supported by the "reference" version. Call it a "sqtroff" tutorial! While I was at it, I came across an item which made me wonder about the naming extensions: > You make a macro with > .de macro-name > text (which can include pretty much > anything) > .. This was in a context where it was clear that the macro name could be more than two characters. Then: > You use the macro with > .macro-name > in exactly the same way that you would use a normal request (.ps for example). BUT note that troff syntax does NOT require a space between request name and first argument! Consider: .de ps12 .. .ps12 To be compatible with troff, the last line would have to mean the same as .ps 12 i.e., set point size to 12. It's not clear how you'd invoke the ps12 macro. Consider also the methods for interpolating strings and number registers using notations \*[name] and \n[name]. These clash with troff, since [ is a valid name for a number register or string. Try: .nr [ 37 The text is \n[abcd]. This must produce "The text is 37abcd." in troff. It may seem that [ would be a very poor choice of name for a register, string, etc...but macro packages commonly use bizarre names laden with special characters internally. Moreover, it's not possible to decide what to interpolate based on the existence of a definition of register (or string) [, because the value of an undefined number register is 0. -- Dick Dunn UUCP: {ncar,nbires}!ico!rcd (303)449-2870 ...Relax...don't worry...have a homebrew.