groff
[Top][All Lists]
Advanced

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

Re: [Groff] horizontal trap


From: Ralph Corderoy
Subject: Re: [Groff] horizontal trap
Date: Tue, 29 Dec 2015 11:52:36 +0000

Hi Tadziu,

> The behavior described may appear puzzling, but in
> 
> >     \Z'\l'4i''four inch
> 
> the \Z'...' does mean "zero width" (really!)

A-ha!  Of course.  Silly me.  :-)  Together with Carten's comment on
indent, I end up with this.

    .de settrap
    . it 1 gotline
    . di prevline
    ..
    .
    .de gotline
    . di
    . if \\n[dl]>\\n[.l] \
    .   tm Line \\n[.c] exceeds width.
    . ti 0
    . prevline
    . settrap
    ..
    .
    .de enddi
    .di
    ..
    .em enddi
    .
    .pl 12
    .ll 4i
    .nf
    .settrap
    .
    .de line
    \\l'\\$1-\\w'\\$1'u'\\$1
    ..
    .
    First line of text.
    Second line of text.
    etc.
    .line 1i
    .line 2i
    .line 3i
    .line 4i
    .in 1i
    .line 2.5i
    .line 3.5i
    .in
    Any line exceeding 4i will be reported.  The .em (enddi) prevents
    groff from complaining about the final diversion being incomplete.

It works as expected, complaining about the 3.5i line that, together
with the 1i indent, exceeds 4i, as do the last two lines of description.
(Line 39 being the ".in".)

    $ nroff peter.tr
    Line 38 exceeds width.
    Line 40 exceeds width.
    Line 41 exceeds width.
    First line of text.
    Second line of text.
    etc.
    ________1i
    __________________2i
    ____________________________3i
    ______________________________________4i
              _____________________2.5i
              _______________________________3.5i
    Any line exceeding 4i will be reported.  The .em (enddi) prevents
    groff from complaining about the final diversion being incomplete.

    $

Cheers, Ralph.



reply via email to

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