groff
[Top][All Lists]
Advanced

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

Re: vim :hardcopy equivalent


From: G. Branden Robinson
Subject: Re: vim :hardcopy equivalent
Date: Wed, 24 Jul 2024 20:10:47 -0500

Hi Tadziu,

At 2024-07-24T22:27:31+0200, Tadziu Hoffmann wrote:
> > > a "margin" measures an extent of whitespace (or "negative space"),
> > > whereas the `sp` request positions the _text baseline_,
> 
> The first is correct and the second incorrect for [g]troff.

I will defend my formulation.  `sp` _does_ position the text baseline,
period.

Where, exactly, it puts it sometimes overturns the user's intuition.

> In troff (and nroff), if you say
> 
>   .sp |0
> 
> then this does not mean "put the baseline at the top of the page"
> but rather "leave zero space above the text", and correspondingly

Agreed.

>   .sp |50p
> 
> means "leave 50 pt of space above the text", as you would expect
> for margins.  Thus, troff's model somewhat follows the concepts
> of metal typesetting.

Yes.  Equally `.sp 1v` (which is really the same as `.sp`) leaves 1v of
space above the next output line.

$ nroff <<EOF
foo
.br
bar
.sp 1v
baz
.pl \n(nlu
EOF
foo
bar

baz

The baselines of "foo" and "bar" are 1v apart, but those of "bar" and
"baz" are 1v+1v=2v apart.

Where I, and apparently sometimes others, usually screw this up is when
computing distances from the page _bottom_.

Hence this bit of diff-business that I committed to my working copy
today:

 .de fo                  \" page footer
-'  sp .5i
+'  sp .5i-1v
 .  tl ''%''
 .  bp
 ..
[...]
 .wh -1i fo              \" trap 1 inch from bottom

If you want the footer title to sit half an inch from the bottom of a
page, you have to adjust it by 1v as shown.

> Of course, troff simplifies this a bit, in the first case by putting
> the baseline at 1 vee below the top of the page, and in the second
> case at 50 pt + 1 vee.

Yes.  To Peter Schaffter's grief.  https://savannah.gnu.org/bugs/?61507

[snip]

I have no gripe with your example; I simply think you inferred something
different from my claim than I was intending.

Collectively, our best efforts at explanation are in the groff Texinfo
manual, groff(7), and roff(7).  If those could use improvement, I'm
listening.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


reply via email to

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