From d2ab4774f24480aaf4c0d55410e0c1e745b585f9 Mon Sep 17 00:00:00 2001 From: "G. Branden Robinson" Date: Fri, 8 Jul 2022 02:24:52 -0500 Subject: [ms]: Add new `RP` optional arguments. * tmac/s.tmac (RP): Recognize new optional arguments `no-renumber` and `no-repeat-info`, the latter as a synonym for the existing `no`. The former suppresses the page number manipulation that normally occurs. Drop now-unnecessary `pn 0` request. (top level, cov*first-page-init, RP, cov*print): Rename `cov*rp-format` to `cov*use-rp-format` for clarity. (cov*break-page): New macro breaks the cover page at the end, resetting next page number to 1 only if desired by user. (cov*print, cov*rp-print): Call `cov*break-page` instead of invoking `bp`. * doc/groff.texi (Document Description Macros) : * doc/ms.ms (Document description macros) : * tmac/groff_ms.7.man (Document description macros) : Document them. * NEWS: Add item. Prompted by formatting Kernighan & Cherry's "Typesetting Mathematics -- User's Guide (Second Edition) from the Unix V7 Programmer's Manual for PDF, where the page numbers in a viewer's navigation sidebar are out of sync with those formatted on the pages. --- tmac/s.tmac | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'tmac/s.tmac') diff --git a/tmac/s.tmac b/tmac/s.tmac index 5a8f89f73..11f507111 100644 --- a/tmac/s.tmac +++ b/tmac/s.tmac @@ -187,7 +187,7 @@ along with this program. If not, see . .par@init .als RP cov*err-not-after-first-page .@init -.ie \\n[cov*rp-format] \{\ +.ie \\n[cov*use-rp-format] \{\ . pg@cs-top . als FS cov*FS . als FE cov*FE @@ -206,14 +206,21 @@ along with this program. If not, see . .br \\*[FS]\\ .. -.nr cov*rp-format 0 +.nr cov*use-rp-format 0 +.\" If we add more cover page formats, these behaviors and names could +.\" be generalized. .nr cov*rp-no-repeat-info 0 -.\" released paper format +.nr cov*rp-no-renumber 0 +.\" report (AT&T: "released paper") document type .de RP -.nr cov*rp-format 1 -.if \\n[.$] .if '\\$1'no' .nr cov*rp-no-repeat-info 1 +.nr cov*use-rp-format 1 +.while \\n[.$] \{\ +. if '\\$1'no' .nr cov*rp-no-repeat-info 1 +. if '\\$1'no-repeat-info' .nr cov*rp-no-repeat-info 1 +. if '\\$1'no-renumber' .nr cov*rp-no-renumber 1 +. shift +.\} .if rPO .po \\n(POu -.pn 0 .. .de TL .br @@ -365,16 +372,20 @@ along with this program. If not, see . .de @div-end!cov*ab-div .AE .. +.de cov*break-page +.ie \\n[cov*rp-no-renumber] .bp +.el .bp 1 +.. .de cov*print .als cov*print @nop .ie d cov*tl-div \{\ -. ie \\n[cov*rp-format] .cov*rp-print +. ie \\n[cov*use-rp-format] .cov*rp-print . el .cov*draft-print .\} .el \{\ -. if \\n[cov*rp-format] \{\ +. if \\n[cov*use-rp-format] \{\ . @warning .RP format but no .TL -. bp 1 +. .cov*break-page . als FS @FS . als FE @FE . CHECK-FOOTER-AND-KEEP @@ -416,7 +427,7 @@ along with this program. If not, see . .if -\\n[FM]/2+1v+\\n[cov*page-length]<\\n[nl] \ . @error cover sheet overflow .pl \\n[cov*page-length]u -.bp 1 +.cov*break-page .if !\\n[cov*rp-no-repeat-info] .cov*tl-au-print .rs .sp 1 -- cgit v1.2.1