Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site watmath.UUCP Path: utzoo!watmath!idallen From: idallen@watmath.UUCP Newsgroups: net.wanted.sources,net.text Subject: Re: Orphans & Widows Fix for Troff Wanted Message-ID: <2434@watmath.UUCP> Date: Mon, 5-May-86 02:10:00 EDT Article-I.D.: watmath.2434 Posted: Mon May 5 02:10:00 1986 Date-Received: Tue, 6-May-86 04:23:02 EDT References: <312@garth.UUCP> <2331@phri.UUCP> Reply-To: idallen@watmath.UUCP (Ian! D. Allen) Distribution: net Organization: U of Waterloo, Ontario Lines: 51 Keywords: orphans widows ditroff Xref: watmath net.wanted.sources:2271 net.text:1060 I know of no cheap way to eliminate those stray lines at the tops of pages, but a simple addition to your local macro package can at least tell you about most pages on which they occur. Most macro packages have an internal "reset-parameters" macro that does a break then resets various format things. Modify this macro so that after the break it checks to see where you are on the current page. If you are exactly one line down from the top of the text portion of the page, you've just generated a widowed line, and you can .tm this to the user. The user can do a dry run of the document without printing it to get a list of the problem pages, then go back and edit text on the previous pages to remove the problem areas. For the -ms macros, the modification might read something like this. You have to add some complications to allow the SH/NH title macros to put one-line titles at page top without complaint, and the easiest thing to do is to catch widows at paragraph end only. Add this line to the end of the LP macro; add it to PP and IP too if necessary: .nr WI \\n% Add this line to the end of the SH macro; add it to NH too if necessary: .nr SH 1 Define an "error message" macro of some sort, such as: .de ER .tm MS MACROS: Input line \\n(.c: \\$1 .if \\n(.$>1 .tm ... \\$2 .if \\n(.$>2 .tm ... \\$3 .if \\n(.$>3 .tm ... \\$4 .if \\n(.$>4 .tm ... \\$5 .if \\n(.$>5 .tm ... \\$6 .if \\n(.$>6 .tm ... \\$7 .if \\n(.$>7 .tm ... \\$8 .. Put this at the beginning of the RT macro: .br .if \\n(WI&(\\n(SH=0) .if \\n(.z \{\ . if (\\n(.h>\\n(HM)&(\\n(WI<\\n%)&(\\n(.h<(\\n(HM+1.2v)) .ER \ "Possible single line widow at top of page '\\n(PN'" . nr WI 0 .\} .nr SH 0 \n(HM is the -ms register containing the size of the top margin. -- -IAN! (Ian! D. Allen) University of Waterloo