[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: |
Mon, 28 Dec 2015 18:44:48 +0000 |
Hi Peter,
> Since you're in no-fill mode, it's a perfect job for the little-used
> input line trap request. This should do what you want.
I had a play with this, and renamed some things to understand what was
going on.
.de settrap
. it 1 gotline
. di prevline
..
.
.de gotline
. di
. if \\n[dl]>\\n[.l] \
. tm Line \\n[.c] exceeds width.
. prevline
. settrap
..
.
.de enddi
.di
..
.em enddi
.
.pl 10
.ll 4i
.nf
.settrap
\l'1i'<one inch
\l'2i'<two inch
\Z'\l'4i''four inch
First line of text.
Second line of text.
etc.
.in 1i
\Z'\l'3.5i''3.5 inch
.in
Any line exceeding 4i will be reported. The .em (enddi) prevents
groff from complaining about the final diversion being incomplete.
I've two questions, both to do with the "3.5 inch" line.
$ nroff peter.tr
Line 32 exceeds width.
Line 33 exceeds width.
__________<one inch
____________________<two inch
four_inch_______________________________
First line of text.
Second line of text.
etc.
→ 3.5_inch___________________________
Any line exceeding 4i will be reported. The .em (enddi) prevents
groff from complaining about the final diversion being incomplete.
$
The `.in 1i' gives 2i indentation. Without diversions, this doesn't
happen so in some way the token for indentation occurs once originally
and is "replayed" by .prevline? I'm sure this has been discussed
before, but my Google fu let me down.
More simply, the 3.5-inch line doesn't trigger a .tm, so I guess the
comparison has to take into account the indent of that line?
Cheers, Ralph.
- [Groff] horizontal trap, Dave, 2015/12/26
- Re: [Groff] horizontal trap, Ralph Corderoy, 2015/12/27
- Re: [Groff] horizontal trap, Peter Schaffter, 2015/12/27
- Re: [Groff] horizontal trap,
Ralph Corderoy <=
- Re: [Groff] horizontal trap, Tadziu Hoffmann, 2015/12/28
- Re: [Groff] horizontal trap, Tadziu Hoffmann, 2015/12/28
- Re: [Groff] horizontal trap, Ralph Corderoy, 2015/12/29
- Re: [Groff] horizontal trap, Ralph Corderoy, 2015/12/29
- Re: [Groff] horizontal trap, Tadziu Hoffmann, 2015/12/30
- Re: [Groff] horizontal trap, Steffen Nurpmeso, 2015/12/31
Re: [Groff] horizontal trap, Carsten Kunze, 2015/12/28