[comp.text] Nroff/mm question

root@investor.UUCP (Bob Peirce) (07/08/88)

Often a letter which mm runs over two pages can really fit on one page
and we make that happen by telling mm the page length is > 66 lines.
This works fine for a single letter.  However, sometimes we need
multiple copies printed and this approach causes trouble because the
printer starts the next letter partway down the next page.

We have been trying to find some way to force a page eject (^L) from
nroff with zero success.  Does anyone know of a way to solve this
problem?
-- 
Bob Peirce, Pittsburgh, PA				 412-471-5320
uucp: ...!{allegra, bellcore, cadre, idis, psuvax1}!pitt!investor!rbp
	    NOTE:  Mail must be < 30K  bytes/message

gls@odyssey.ATT.COM (g.l.sicherman) (07/15/88)

> We have been trying to find some way to force a page eject (^L) from
> nroff with zero success.  Does anyone know of a way to solve this
> problem?

Nroff cannot print most control characters.  Try having it print
"FORMFEED!" or something like that, and filter the output through
awk or sed to turn "FORMFEED!" into ^L.
-- 
Col. G. L. Sicherman
...!ihnp4!odyssey!gls

meissner@xyzzy.UUCP (Michael Meissner) (07/16/88)

In article <991@investor.UUCP> Bob Peirce writes:
| Often a letter which mm runs over two pages can really fit on one page
| and we make that happen by telling mm the page length is > 66 lines.
| This works fine for a single letter.  However, sometimes we need
| multiple copies printed and this approach causes trouble because the
| printer starts the next letter partway down the next page.
| 
| We have been trying to find some way to force a page eject (^L) from
| nroff with zero success.  Does anyone know of a way to solve this
| problem?

In general you can't, since nroff valently strips control characters
out.  My current method is to have the page header (or footer) macro
output a specific text string via \\!, and use a postprocessor, to
convert lines containing nothing but that string to a formfeed.  For
example, if you output a line containing ~~~ to indicate a page break,
the following could be used to convert it into a formfeed (^L below
would be typed as an actual formfeed):

	soelim files... | tbl -TX | nroff -Tlp | col -p |
		sed 's/^~~~$/^L/' >outputfile

Note, you should use the escaped \\! request rather than the normal
request, so that it goes out when the header macro is evaluated, not
when it is scanned.

You can also be somewhat clever, and have the post processor remember
blank lines, and remove any blank lines that occur immediately before a
page break (and of course putting the blank lines back in if some text
appears).  This is especially useful if you use headers, but don't use
footers.

Unfortuneately, over the years, this is one area nroff has really
degraded (I know, I know, TeX/WordPerfect/etc. fans will say nroff is
already degraded).  I seem to recall that PWB nroff (that ran on V6
PDP-11's) had an explicit escape to output control characters (darned if
I can remember what it is, it has been ten years since I used it).  In
DWB revision 1, I think, you could output the stuff with the
undocumented .cf function, wheras in revision 2 it is documented, and
nroff seems to strip it out.  I am not entirely clear if DWB revision
1's .cf (copy file) did so without interpretation, I know it seems to be
striped with DWB revision 2.
-- 
Michael Meissner, Data General.

Uucp:	...!mcnc!rti!xyzzy!meissner
Arpa:	meissner@dg-rtp.DG.COM   (or) meissner%dg-rtp.DG.COM@relay.cs.net