[Top][All Lists]

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

Re: [Groff] blm blues

From: Miklos Somogyi
Subject: Re: [Groff] blm blues
Date: Mon, 17 Nov 2008 19:41:37 +1100

Good God, I am so pleased with this outpouring of help. Tadziu, Larry, Ted, thank you very much. It was a nice learning exercise, and I love the simplicity of using a string.
I would like to add only two things.

In case of .../10u*4u like structures I'd like to add that with integer arithmetic it is better to multiply first and divide later.
Not that in this case it would matter much.

The other thing: I did not want to settle for numbers like 0.4 that can be done with *4u/10u. I wanted finer resolution, e.g. 0.418 or 0.398 so that I could adjust the bottom line on each page easily. Then, of course, the new-page macro would reset it to 0.4 or whatever to start a new day afresh.

Folks, thank you for all of you,


On 16/11/2008, at 08:50 AM, Tadziu Hoffmann wrote:

I know I'm coming in late, but there are two things I'd do
differently: set a default and use relative spacing (v)
instead of machine units (u).

.de blank_aux
. if !rblankreg .nr blankreg 0.4v
. sp \\n[blankreg]u
.blm blank_aux

Replace the 0.4v above with whatever you want the default
value to be and it will work with the entire range of devices
and text sizes.

Unfortunately this implementation has the disadvantage that the
blank line spacing is fixed with the baseline spacing in effect
when the macro is first called.  For example, if you first call it
in the title which, say, has a font size of 24pt and a baseline
spacing of 26pt, and then switch to body text with font size
10pt and baseline spacing 12pt, the blank line spacing will not
be 0.4v of that of the body text.

The solution Miklos gave does not have this problem, but it
works correctly only when "blank" is called without units,
always with the interpretation that the number represents "V"s.
The default centimeter scale is somewhat misleading. It's there
only to introduce a scaling factor to store a non-integer in an
integer register. The scaling factor is divided out again in
"blank_aux". (Although he should have simply said "1c" instead
of "28340", to be independent of the unit scale of the output
device.) (By the way, the correct number for devps appears to
be "28346".)

Perhaps the best solution would be to simply defer computation
of the spacing until it is actually needed. This is possible by
storing the desired spacing in a string instead of a register,
which allows the units to be preserved:

 .de blank
 .ds blankreg \\$1
 .de blank_aux
 .sp \\*[blankreg]
 .blm blank_aux

reply via email to

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