Thank you very much for your answer.

> Since you're already diverting into TEXT when you expect the
> overflow to occur, you have to use a diversion trap instead
> of a page trap:

It is true, I did not saw it.

>   .ll 20m
>   .de CUT
>   .di       \" stop diverting into TEXT...
>   .di TEXT2 \" ...and divert into TEXT2.
>   ..
>   .di TEXT
>   .dt 1v CUT \" 1v into the diversion, redivert into TEXT2.
>   A paragraph that is long enough to be used as an example
>   for my question.
>   .br
>   .di
>   .nf
>   .TEXT
>   -----
>   .TEXT2
>   .fi

Your proposition works well, but I decided to go for another solution.
I will explain why here.

I remarked that the behaviors of .wh and .dt differ for small values (for
values <= 0.5v in the default .vs setting).  With .wh, the trap is
trigged as expected, but not with .dt.

For example, if we put 0v as the for argument of .dt in your solution, the
trap is never triggered.

I prefer the behavior of .wh, so I modified a little bit my program to
make it work.  As you remarked, the text has to be outputting on the
page for the .wh request to work.

$ cat solution.tr
.ll 40m
.wh 0v CUT
.de CUT
.  di TEXT2
..
A paragraph that is long enough to be used as an example for my
question.
.br
.di
-----
.nf
.TEXT2
.fi

$ nroff solution.tr
‐‐‐‐‐
A  paragraph  that  is long enough to be
used as an example for my question.

This solution is not stricly equivalent, but I it seems to me that, with
some reorganization, it is always possible.  Rather than splitting the
diversion in advance, it is split when output on the page is occuring.

Regards,
Selve

Reply via email to