[comp.text] Awf: Henry's Amazingly Workable Formatter

eastick@me.utoronto.ca (Doug Eastick) (11/15/90)

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
> By the way, does anyone have a compiled copy of groff for Sun3 or Sun4 (4.1)
> or even Vax or Pyramid?  I've spent hours trying to get it to compile and
> run, and don't have any more time to piddle with it.  It would make me
> Very Happy if there was somewhere I could ftp a runnable copy.  You'll
> never guess what I want to groff a copy of...

I installed Perl on SGI's that DON'T come with troffy stuff unless you
pay for it.  I used Henry Spencer's awf(1) [comp.sources.(unix|misc)]
to format a couple of the smaller man pages, and it even did a "not so
bad" job on the Perl man page.  Problems with the lines:
	''
which mostly contained comments and other things.  Makes the pages
readable enough for me.

Henry:	Thanks for another unbelievable example on how to use blah(1)
	[where blah can be awk, sh, sed, etc...].  I really can't
	believe the thing works.  Slow as a pig, but it works.
	C news is becoming a working "how to use unix tools" example.

Out of curiosity, I ran the awf.awk scripts thru a2p to see what the
perl looks like.  Yecch.  Hey Larry, maybe use these things as tests
for a2p(1) ? :-)

henry@zoo.toronto.edu (Henry Spencer) (11/16/90)

In article <90Nov14.184836est.19909@me.utoronto.ca> eastick@me.utoronto.ca (Doug Eastick) writes:
>... Problems with the lines:
>	''
>which mostly contained comments and other things...

Sounds like Larry needs to go back to his manual and find out what the
nroff/troff comment convention is.  (Hint:  it's not ''.)
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry@zoo.toronto.edu   utzoo!henry

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (11/16/90)

In article <1990Nov15.170711.6778@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
: In article <90Nov14.184836est.19909@me.utoronto.ca> eastick@me.utoronto.ca (Doug Eastick) writes:
: >... Problems with the lines:
: >	''
: >which mostly contained comments and other things...
: 
: Sounds like Larry needs to go back to his manual and find out what the
: nroff/troff comment convention is.  (Hint:  it's not ''.)

Gee, if I didn't know better, I'd say you were trying to be patronizing...  :-)

At the point that I developed the ''' habit, I had seen several documents
that used it in preference to .\", and I had the hope that it would become an
allowed alternative convention.  This has turned out not to be the case,
alas, but that doesn't change the fact that it's easier to type and stands
out more visually.  I think anything that encourages people to insert and
read comments has something to be said for it.  I'm sure you've noticed
that I occasionally try to change the conventions.  :-)

Speaking of conventions, I would think that awf, like nroff, would simply
ignore any macros it doesn't recognize.  (Though I can see arguments
for taking the opposite tack.)

Larry

henry@zoo.toronto.edu (Henry Spencer) (11/17/90)

In article <10416@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
>: Sounds like Larry needs to go back to his manual and find out what the
>: nroff/troff comment convention is.  (Hint:  it's not ''.)
>
>Gee, if I didn't know better, I'd say you were trying to be patronizing...  :-)

Think "irritated", not "patronizing". :-)

>Speaking of conventions, I would think that awf, like nroff, would simply
>ignore any macros it doesn't recognize.  (Though I can see arguments
>for taking the opposite tack.)

I thought about this at some length, but decided that considering awf's
rather serious limitations, it was better for it to complain when it sees
something it doesn't understand.  It's not safe to assume that formatting
errors will always be noticed.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry@zoo.toronto.edu   utzoo!henry

lee@sq.sq.com (Liam R. E. Quin) (11/17/90)

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes:
> At the point that I developed the ''' habit, I had seen several documents
> that used it in preference to .\", and I had the hope that it would become
> an allowed alternative convention.  This has turned out not to be the case,

Probably because it is not, in fact, a comment, and troff has much too much
momentum to allow it to be one.  In particular, beware of things like
	''' \fB
where the font change to bold is _not_ commented out.  If you try and use
this to comment out part of an if-else chain, interesting things happen.
Personally I would have prefered
	...
but that isn't acceptable either...

> Speaking of conventions, I would think that awf, like nroff, would simply
> ignore any macros it doesn't recognize.  (Though I can see arguments
> for taking the opposite tack.)

A large number of bugs in troff macros come to light (and get fixed) when
the formatter reports calls to undefined macros.  I agree that it's useful
to be able to disable such warnings for printing with old macro packages.


A Longish But Amusing Aside About The Alternate Control Character ('):

Many casual troff users don't realise that the single quote at the start of
a line is special to troff in much the same way as is a leading dot.
The most interesting support question I ever witnessed was when someone's
document contained a line starting with
'trouble in the antarctic'

It's fun to try this -- pipe this article through nroff, and then through
a pager (more, less, pg, etc.) and you'll see what happens!
If you're using rn, type
	| nroff | less
before reading the Explanation below....



Explanation:

Normally of course one would type `trouble....antarctic'.  The effect of
the erroneous version, however, is to call troff's "tr" request, which,
for the rest of the document, turned every o into a u, every b into an l,
every e into a space, and so on.  Neat, eh?

As you can imagine, the poor user was more than a little perplexed!

Lee

-- 
Liam R. E. Quin,  lee@sq.com, SoftQuad Inc., Toronto, +1 (416) 963-8337