summaryrefslogtreecommitdiff
path: root/tmac/s.tmac
diff options
context:
space:
mode:
authorwl <wl>2004-09-20 09:08:33 +0000
committerwl <wl>2004-09-20 09:08:33 +0000
commit692b484d3776150a86f0a00ccb6ae482738b8e34 (patch)
tree01474e14b170280396a2988c773f558eb1b56d38 /tmac/s.tmac
parentbe1a0310ab8319a8111d34c6a48fbc8586857f26 (diff)
downloadgroff-692b484d3776150a86f0a00ccb6ae482738b8e34.tar.gz
This change implements the following features:
PORPHANS New numeric register: Defines number of lines following LP, PP, QP, IP or XP, which must be kept together, before any automatic page break. If insufficient space remains on the current page, a page break is forced before the new paragraph begins. HORPHANS New numeric register: Sets number of lines of following paragraph which must be kept with a heading, defined by NH or SH, before any automatic page break. If insufficient space remains on the current page, a page break is forced before the heading. GROWPS (Thanks to Joerg van den Hoff, for this idea). New numeric register: Sets the first level of heading (set with NH), which will keep the same point size as body text; e.g. if GROWPS is set to 3, .NH 3, .NH 4, ... will produce headings at the point size specified by \n[PS], but .NH 2 and .NH 1 will have progressively larger point sizes, determined by \n[PSINCR] (see below). PSINCR New numeric register: Sets the point size increment for each level of heading, (set with NH), below the threshold level set by GROWPS; e.g. if \n[PS] = 10, \n[GROWPS] = 3 and \n[PSINCR] = 2.0p, then .NH 1 will produce 14pt headings, .NH 2 will produce 12pt, and all other levels will remain at 10pt, (because \n[PS] = 10). SH Existing macro now accepts a numeric argument, to make heading size match that of NH with same argument value, when the GROWPS/PSINCR feature is enabled. SN-DOT New string, set by NH macro, replaces the existing (undocumented) use of SN, to represent the assigned section number. SN-NO-DOT New string, set by NH macro, represents the assigned section number, but omits the terminal period (periods at intermediate levels are retained). SN String set by NH macro, originally undocumented, now implemented as an alias for SN-DOT (which reproduces original behaviour). * tmac/s.tmac (PORPHANS): New register. (par*start): Use it. (HORPHANS, GROWPS, PSINCR): New registers. (SH-NO-TAG, @SH): Use them. (@NH): Improved. * NEWS, doc/groff.texinfo, tmac/groff_ms.man: Document the deletion of `Ds' and `De' macros.
Diffstat (limited to 'tmac/s.tmac')
-rw-r--r--tmac/s.tmac45
1 files changed, 38 insertions, 7 deletions
diff --git a/tmac/s.tmac b/tmac/s.tmac
index 636735e7..ef540c4a 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1159,13 +1159,18 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.de TA
.ta T 5n
..
+.\" \n[PORPHANS] sets number of initial lines of any paragraph,
+.\" which must be kept together, without any included page break.
+.\" Initialise to reproduce original behaviour; user may adjust it.
+.if !rPORPHANS .nr PORPHANS 1
+.
.de par*start
.ds@auto-end
.nr \\n[.ev]:pli \\$1
.nr \\n[.ev]:pri \\$2
.par@reset
.sp \\n[\\n[.ev]:PD]u
-.ne 1v+\\n(.Vu
+.ne \\n[PORPHANS]v+\\n(.Vu
..
.de par@finish
.nr \\n[.ev]:pli 0
@@ -1366,14 +1371,37 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\}
.el \!.par*box-draw \\$1 \\$2
..
+.\" \n[HORPHANS] sets how many lines of the following paragraph must be
+.\" kept together, with a preceding section header. Initialise it,
+.\" to reproduce original behaviour; user may change it.
+.if !rHORPHANS .nr HORPHANS 1
+.
+.\" \n[GROWPS] and \n[PSINCR] cause auto-increment of header point size.
+.\" Initialise them, so they have no effect, unless explicitly set by the user.
+.if !rGROWPS .nr GROWPS 0
+.if !rPSINCR .nr PSINCR 1p
+.
.de SH-NO-TAG
.par@finish
-.\" Keep together the heading and the first two lines of the next paragraph.
-.ne 3v+\\n[\\n[.ev]:PD]u+\\n(.Vu
+.\" Keep the heading and the first few lines of the next paragraph together.
+.\" (\n[HORPHANS] defines "first few" -- default = 1; user may redefine it).
+.nr sh*minvs \\n[HORPHANS]v
+.if \\n[sh*psincr]<0 .nr sh*psincr 0
+.ie \\n(VS<1000 .par*vs \\n(VSp+\\n[sh*psincr]u
+.el .par*vs \\n(VSp/1000u+\\n[sh*psincr]u
+.ne 2v+\\n[sh*minvs]u+\\n[\\n[.ev]:PD]u+\\n(.Vu
+.\" Adjust point size for heading text, as specified by \n[GROWPS] and \n[PSINCR].
+.ie \\n(PS<1000 .ps \\n(PS+\\n[sh*psincr]u
+.el .ps \\n(PSz/1000u+\\n[sh*psincr]u
.sp 1
.ft B
..
.de @SH
+.\" Standard ms implementation does not expect an argument,
+.\" but allow ".SH n" to make heading point size match ".NH n",
+.\" for same "n", when \n[GROWPS] and \n[PSINCR] are set.
+. nr sh*psincr 0
+. if 0\\$1>0 .nr sh*psincr (\\n[GROWPS]-0\\$1)*\\n[PSINCR]
. SH-NO-TAG
. HTML-TAG ".SH 1"
..
@@ -1535,15 +1563,18 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
. \}
. nr H\\n[nh*hl] +1
.\}
-.ds SN
-.nr nh*i 0
+.ds SN-NO-DOT \\n(H1
+.nr nh*i 1
.while \\n[nh*i]<\\n[nh*hl] \{\
. nr nh*i +1
-. as SN \\n[H\\n[nh*i]].
+. as SN-NO-DOT .\\n[H\\n[nh*i]]
.\}
+.ds SN-DOT \\*[SN-NO-DOT].
+.if !dSN .als SN SN-DOT
+.nr sh*psincr (\\n[GROWPS]-\\n[nh*hl])*\\n[PSINCR]
.SH-NO-TAG
.HTML-TAG ".NH \\$1"
-\\*[SN]
+\\*[SN-DOT]
..
.\" ****************************
.\" ******** module toc ********