groff
[Top][All Lists]
Advanced

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

Re: [Groff] "Cosmetic" filling


From: Gunnar Ritter
Subject: Re: [Groff] "Cosmetic" filling
Date: Thu, 31 Aug 2006 15:53:35 +0200
User-agent: Heirloom mailx 12.2pre 7/7/06

(Ted Harding) <address@hidden> wrote:

> 1. I'm not aware of a simple mechanism in groff to
>    do this -- e.g. fill all lines whose minimum
>    formatted length is within X of line-length.

AT&T troff has a \n(.x register which holds the remaining
horizontal space on the current output line. Thus it is
possible to do

.sp 5c
.ps 28
.vs 36
.de SP
.       if \\n(.x<1n \p\%
.       sp
..
.ll \w'a full line'u
a full line
stretch it
.SP
a full line
a line
.SP
more text

\n(.x is documented as a "reserved version-dependent register"
but has the described semantics in every version I have seen
from 7th edition troff on.

The \% is necessary to trick the internal control flow; the
.brp request would make it superfluous but is, of course, not
available in AT&T troff.

By introducing a documented register for the same purpose, it
would become possible to use e.g.

.de SP
.       if \\n[.rl]<1n .brp
.       sp
..

to get the desired effect.

        Gunnar




reply via email to

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