groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible Bug in s.tmac (forked from: [Groff] pointsize changes in .N


From: Keith Marshall
Subject: Re: Possible Bug in s.tmac (forked from: [Groff] pointsize changes in .NH ms-macro)
Date: Sat, 18 Sep 2004 09:38:38 +0100

On Thursday 16 September 2004 7:21 am, Werner LEMBERG wrote:
> > If we *really* want to keep two lines of the following paragraph
> > with the header, then we need to change this definition ...
>
> >     .
> >     .
> >     .ne 4v+\\n[\\n[.ev]:PD]u+\\n(.Vu
> >     .
> >     .
>
> I favor that.

Meanwhile, I've devised a mechanism using a new register, which I've called 
HORPHANS, to let the user choose a preferred behaviour -- more info below.

> > On a similar note, the par*start macro requests sufficient space for
> > the paragraph separating space set in \n(PD, followed by *one* line
> > of text.  While this is probably the behaviour normally expected of
> > ms, we *could* add some orphan line prevention here, by asking for
> > space for two lines of text.
>
> Again, I favor two lines of text.

Again, I've implemented this with a new register, (I've called this one 
PORPHANS), to let the user choose -- more below.

> > I'll gladly provide a patch to implement whichever of these changes
> > the list membership would prefer [...]
>
> Please do so.

Attached is a patch, against the current CVS implementation of s.tmac on 
savannah.gnu.org, implementing the above, and adding the following:-

-  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.

     Initialised to 1, to reproduce existing behaviour, (which ensures only
     one line of text before a page break).  User may redefine it:

          .nr PORPHANS 2

     will ensure that at least two lines are kept together.

-  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.

     Initialised to one, to reproduce existing behaviour, (which ensures only
     one line of the following paragraph is kept with each heading).  User may
     redefine it:

          .nr HORPHANS 2

     will ensure that each heading and two lines of the following paragraph
     are kept together.

-  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).

     Initially set to zero, which disables the incremental heading size
     feature.

-  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).

     Initially set to 1p, but ignored when \n[GROWPS] < 2.  User may
     redefine it according to preference.  Value is interpreted as basic
     groff units; use "p" scale indicator when setting value in points.

-  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 intermetiate levels are retained).

-  SN
     string set by NH macro, originally undocumented, now implemented as an
     alias for SN-DOT, (which reproduces original behaviour).  If preferred,
     user may reassign it with

          .als SN SN-NO-DOT

     to remove the terminal period.  (I favour this representation, when
     writing cross references, with additional punctuation following the
     section number).

I had hoped to provide separate patches for each of the above features, but 
unfortunately they clash, within the diff context.  If you prefer only a 
partial implementation, I can provide a modified patch.

Best regards,
Keith.

Attachment: s.tmac.patch.gz
Description: GNU Zip compressed data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]