esa@kvvax4.UUCP (Esa K Viitala) (06/14/84)
I hope somebody will be able to help me in finding a way to make nroff to produce a formfeed after a given amount of lines. This would make it much easier for us to print our documents on a printer, which uses a sheetfeeder. Any methods are of interest. -- Esa K Viitala {decvax,philabs}!mcvax!kvport!kvvax4!esa A/S Kongsberg Vaapenfabrikk,CTG4,P.O.Box 25,N-3601 Kongsberg,Norway tel. 473-739644 tlx. 71491 vaapn n
hans@log-hb.UUCP (Hans Albertsson) (06/16/84)
[] It is possible to have a "trapped macro", that is a macro which is executed every time a particular condition, such as a page transition. It seems to me that such a macro could be one to emit a form-feed. Then setting the pagelength short enough, you're in the clear. The doc is confusing, due to the lack of redundancy ( as is typical of UNIX ), but it's there in Nroff/Troff User's manual, par. 7, par 3. Particularly, there's reference to a top-of-page macro, which is invoked every time a new page is about to be emitted. Presumably this macro can be modified. I haven't tried it, but it seems this is the mechanism through which nroff outputs the last blank line. -- {decvax,philabs}!mcvax!enea!log-hb!hans Hans Albertsson, TeleLOGIC AB Box 1001, S-14901 Nynashamn, SWEDEN
hans@log-hb.UUCP (Hans Albertsson) (06/16/84)
[] Well, basically I was right, about installing a macro to get called at page breaks, but, how on earth do you get a macro to emit a formfeed? AAAARRRRRGGGGGGHHHHHHH! Methinks there's good cause for a Haque Royal.... Or can you get a macro to emit a formfeed? Is there a newsgroup for nroff business? -- {decvax,philabs}!mcvax!enea!log-hb!hans Hans Albertsson, TeleLOGIC AB Box 1001, S-14901 Nynashamn, SWEDEN
jaap@haring.UUCP (06/17/84)
Of course you can use a macros to get your sheetfeeder at work, but since sheefeeders most times reacts on something like escape sequences, and nroff filters out most control characters there is no way to get the sequence out. There is of course an other solution, you just make some trivial (ahum) changes inside nroff. A system this works for a couple of years now here at the CWI. I've send the changes for this to the guy who asked for it, if more people needs this, I could consider to post it to the net as well. Jaap Akkerhuis.
joe@petsd.UUCP (Joe Orost) (06/19/84)
I tried to get nroff to output a page eject by putting a form-feed character in the header macro, but nroff eats it!! I resorted to writing a small filter which counts lines and writes form-feeds. I just run nroff file|filter|opr. -- Much cleaner than hacking up nroff! regards, joe -- Full-Name: Joseph M. Orost UUCP: vax135!petsd!joe US Mail: MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724 Phone: (201) 870-5844
brad@bradley.UUCP (06/20/84)
#R:kvvax4:-40700:bradley:400005:000:1310 bradley!brad Jun 19 22:48:00 1984 Another way is to set the page length equal to the total distance of the sheet plus gap. (On ours we use Rutishauser sheet feeders with Diablos's 1650 (Xerox 1730,...). Then you set a trap at the bottom to do a 'bp. I the below example, our sheet feeders need AT LEAST 1 inch gap bewteen sheets, on a standard 8.5X11 sheet we set the knob on the right hand side of the sheet feeder to 12. Below is a short piece of what you would have, I included a header just for more stuff. ------------ .pl 72 \" This sets up nroff to 12 inches and 6 lpi .de hd .if \\n%>1 'sp 3 \" Put 3 spaces and .tl and 3 more .if \\n%>1 .tl 'Page %'Bradley University'Your name' .if \\n%>1 'sp 3 .. .de fo 'bp \" Note the single quotes used here, in both the . \" header and footer so that the lines are filled . \" out fully .. .wh 0 hd \" do header at top of page .wh -12 fo \" do foot at 12 lines from the bottom, rember that . \" you have an extra inch so the actual bottom is . \" one inch from the bottom . \" next you have you text. if you want a new . \" page all you do is a .bp if you typing several . \" pages then the traps will handle the page breaks . \" ok. ------------ Spelling maybe off. Hope this helps! Bradley Smith Text Processing/Bradley University {ihnp4,uiucdcs,cepu,noao}!bradley!brad
terry@RAND-UNIX.ARPA (06/21/84)
From: Terry West <terry@RAND-UNIX.ARPA> One way of getting a form feed (or any other control characters) to output without changing nroff, is to modify the definition of some of the unneeded special name characters in one of the terminal driving tables (ie, the "tabxxx" files in /usr/lib/term). For example, "\(bs" (the bell system sign) could be redefined as "\000\f", /*bell system sign; changed to formfeed (trw) */ Then, at the beginning of your page heading macro, insert: .tl '\(bs''' Terry West (decvax!randvax!terry, terry@rand-unix)
kim@enea.UUCP (06/25/84)
#R:kvvax4:-40700:enea:600004:000:701 enea!kim Jun 18 10:51:00 1984 When only a few control commands are required, such as form feed or some special escape sequences, you can make nroff output these by modifying the table for the corresponding output device (at /usr/lib/term or wherever it may be on your installation). By mapping some of the non-ascii symbols that you cannot produce anyway - Greek letters, math symbols etc, you can output any desired ascii sequence. This requires no modification of the nroff code, and has the advantage that a page shift can be defined as one symbol, translated to form feed for printers supporting this, and to the relevant escape sequences for others. Kim Walden {decvax,philabs}!mcvax!enea!kim
jack@vu44.UUCP (Jack Jansen) (06/25/84)
According to the [nt]roff manual, the \! mechanism should enable you to put anything in the outputfile (par 10.7), so why not a formfeed??? Jack Jansen, mcvax!vu44!jack
kim@enea.UUCP (06/29/84)
#R:kvvax4:-40700:enea:600007:000:1338 enea!kim Jun 21 15:34:00 1984 >> According to the [nt]roff manual, the \! mechanism should >> enable you to put anything in the outputfile (par 10.7), >> so why not a formfeed??? Sorry, that does not work. A \! at the beginning of a line simply means that the rest of the line is read in 'copy mode' and transparently output without the \!. But all control characters except STX, ETX, ENQ, ACK, and BEL are ignored already on input (par 10.1 in Ossanna's manual Oct 11, 1976). In System V, SI, SO, and ESC are also accepted, but this is undocumented. In 4.xBSD, the control characters that are not ingnored on input still have to be translated to some printable character by the .tr command in order to appear in the output. In System V, however, BEL, SI, SO, and ESC are transferred directly to the output if not translated by .tr, but STX, ETX, ENQ, ACK disappear. This is also undocumented. If one wishes to extend the list of control characters that may be output by nroff, the tables to modify are in the routines getch0() in n1.c, and ptout1() in n10.c. Warning: since nroff assumes that getch0() cannot return all values in the interval 001-033, it uses some of them for internal purposes. For example, to accept escape characters in 4.xBSD nroff, the value of the symbol ESC in tdef.hd must be changed. Kim Walden {decvax,philabs}!mcvax!enea!kim
jsq@ut-sally.UUCP (John Quarterman) (07/02/84)
Not terribly fast, but easy to do and requires no nroff changes: #!/bin/awk -f # A filter, ff, to insert form feeds at page boundaries in nroff output # and possibly to shorten the pages at the same time. BEGIN { nroffpage = 66; # the usual default nroff page length printpage = 63; # the shortest printer page I've run across if (printpage > nroffpage) { trimtop = 0; trimend = nroffpage; } else { totrim = nroffpage - printpage; trimtop = sprintf ("%d", totrim / 2 + .5); trimend = nroffpage - (totrim - trimtop); } count = 0; } { if (++count == nroffpage) { count = 0; printf (""); # a form feed, ASCII 014 or 0x0C, control L } else if (count > trimtop && count < trimend) print $0; } -- John Quarterman, CS Dept., University of Texas, Austin, Texas 78712 USA jsq@ut-sally.ARPA, jsq@ut-sally.UUCP, {ihnp4,seismo,ctvax}!ut-sally!jsq
chris@hwcs.UUCP (Chris Miller) (07/12/84)
Another way to incorporate form-feeds (or any other control-characters) into nroff output, at least on all versions of Unix to which I have access, is to use the *undocumented* (at least on all versions of Unix to which I have access!) directive ".cf" (copy file), which copies the file whose name is given as argument 1, e.g. .cf /usr/lib/tmac/ff where /usr/lib/tmac/ff contains a single form-feed. Of course, the wisdom and ethics of using undocumented features, which may disappear or change without warning, are open to all the usual criticisms on the grounds of portability, maintainability and comprehensibility. The Unix versions where I know that .cf exists and behaves as described are 4.1bsd, V7 and ZEUS (a V7 port to a Zilog System 8000), Chris Miller Heriot-Watt University
pjbk@hwcs.UUCP (Peter King) (07/12/84)
The problem of having nroff emit a form feed was solved here using an undocumented request .cf which copies its file argument to the nroff output stream, without performing any processing on it. The page header macro is then modified to include the line .cf /usr/lib/tmac/ff and the file /usr/lib/tmac/ff is set up containing a form-feed character. As far as I can make out, the restrictions on the characters on input that nroff will recognise make it very difficult to get a control character in your output in any other way. Although .cf is not documented it has been present in all the nroff's I have tried. Does any body not have it?