Werner Lemberg:

> > I  will  be  glad to add it to the "End-of-input
> > Traps" section,
>
> Great!

Here it is, coming sooner than expected. Please, see
if it is sane and readable.

Anton
--- groff.texinfo       2011-02-12 19:31:07.968750000 +0300
+++ groff_new.texinfo   2011-02-12 22:20:55.781250000 +0300
@@ -12676,6 +12676,43 @@
 Note that this specific feature affects only the first potential page
 break caused by the end macro; further page breaks emitted by the end
 macro are handled normally.
+
+Another possible use of the @code{em} request is emitting a single page
+when the division into multiple pages is undesirable.  For example, one
+may want to produce a long plain-text file for reading onscreen.
+
+To accomplish this, in the beginning of the document the page height can
+be set large enough to hold all the text and, after the text has been
+output, it can be decreased back to the exact height of the document.
+
+The way of explicitly trimming the page at the end of the source file
+lacks flexibility in the sence that it cannot be isolated into a single
+macro and stored in a separate macro package.  This can be worked around
+by using an end-of-input trap to have the page-trimming macro executed
+automatically on completion of output:
+
+@Example
+.\" Macros to emit a long [s]ingle [p]age
+.\" Trim page to total height of text
+.de sp:trap
+.  br
+.  pl \\n[nl]u
+..
+.
+.\" Set single-page mode
+.de sp:trim
+.  pl 99999
+.  em set:trap
+..
+@endExample
+
+Now it is enough to call @code{sp:trap} in the beginning of the
+document.
+
+Only one end-of-input trap can exist, and since other macro packages may
+already use this mechanism, care must be taken not to break it.  In this
+case, instead of creating a new trap the existing one should be appended
+to using the @code{.am} request.
 @endDefreq
 
 

Reply via email to