groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: vertical spacing trivia challenge


From: G. Branden Robinson
Subject: Re: vertical spacing trivia challenge
Date: Mon, 15 Jul 2024 04:10:47 -0500

At 2024-07-15T01:06:55+0200, Tadziu Hoffmann wrote:
> [Spoilers ahead.]
> 
> > A   Question: is the `vs` request (which sets the vertical spacing)
> >     honored in nroff mode?
> 
> Yes.

Agreed!

> > B.  In nroff (or nroff mode in groff), what _units_ is the argument
> >     to the `vs` request reckoned in?
> 
> I remember .vs always being given in points, with a default value of
> 12 pt, resulting in 6 lines per inch, or 66 lines per 11-inch sheet.

Also agreed.

> (I know this because I have set my terminal windows to a height of
> 67 lines, in order to display manual entries paginated for 11-inch
> fan-fold line printer paper one page at a time, with an additional
> line for the "less" prompt.)

Convenient!

> Empirical tests with groff support this.  However, groff appears to
> round different values for .vs immediately to a multiple of 12 pt,
> and then consistently use that rounded number.  E.g.,
> 
>   echo -e '.sp 12p\n.nf\n.vs 6\na\nb\nc\nd' | nroff | less
> 
> only shows "d", i.e., 6 gets rounded down to zero.
> 
> [This is in contrast to a conceivable different model, in which
> groff might internally keep a higher-resolution line tally, and
> output a linefeed only when this surpasses the next grid position.]

Yes.  It's also in contrast to Version 7, DWB, and Heirloom nroff.
Seems likely true of Solaris 10 and Plan 9 too, though I didn't check.

$ cat EXPERIMENTS/nroff-vs.troff
.tm \n(.v
.vs -2
.tm \n(.v
.vs -6
.tm \n(.v
.vs 40u
.vs -12
.tm \n(.v

On the AT&T nroffs, the foregoing produces:

$ nroff nroff-vs.troff
40
40
20
20

GNU troff in nroff mode produces:

$ ~/groff-1.22.3/bin/nroff EXPERIMENTS/nroff-vs.troff
40
40
40
0

...at least as far back as shown, and my guess is "forever".

> > C.  A point is less than a vee, right?
> 
> Usually, but the vee can also be set to zero for special
> formatting purposes.

Agreed.

> > D.  What does nroff do if you request to alter the vertical
> >     spacing in points?
> 
> Not sure what is meant here.  I think it is always in points.
> Or do you mean, if different values than the default are
> requested?  Then, see above.

At that point I was a little confused; I thought the `vs` request was
interpreting a dimensionless argument in different units for nroff only.
But that's not the case; instead, what's happening is that AT&T nroff
sets a vertical spacing floor of half a line--20 basic units.

GNU troff will let you take the vertical spacing to zero on any device.

> However: I remember Unix nroff also supporting terminals with
> half-line capability, which groff doesn't.  Maybe someone here
> has an old system they can use to test nroff's behavior when
> formatting for one of these terminals?

That would be cool, but I find the self-reporting of the `.v` register
value pretty convincing.  :)

Thank you for rising to the trivia challenge!

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]