summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--NEWS3
-rw-r--r--doc/groff.texinfo35
-rw-r--r--tmac/groff_ms.man65
-rw-r--r--tmac/s.tmac13
5 files changed, 94 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index ca8a1333..adb52014 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-04-08 Keith Marshall <keith.d.marshall@ntlworld.com>
+
+ * tmac/s.tmac (SN): Define unconditionally.
+ (SN-STYLE): New string; define.
+
+ * NEWS, tmac/groff_ms.man, doc/groff.texinfo (SN-STYLE): Document it.
+
2007-03-22 Werner LEMBERG <wl@gnu.org>
* tmac/pspic.tmac: Fix harmless numeric overflow warning. Reported
diff --git a/NEWS b/NEWS
index 61346da6..2b1191ab 100644
--- a/NEWS
+++ b/NEWS
@@ -132,6 +132,9 @@ o For -ms, Eric S. Raymond contributed support for ancient Bell Labs
localisms `.SC', `.UC', `.P1', and `.P2'. The latter three are enabled
only after .SC is called.
+o A new string, `SN-STYLE', has been added to the ms macros, controlling
+ the formatting of section numbers in headings defined by `.NH'.
+
VERSION 1.19.2
==============
diff --git a/doc/groff.texinfo b/doc/groff.texinfo
index 91d5ce8e..29b4febb 100644
--- a/doc/groff.texinfo
+++ b/doc/groff.texinfo
@@ -3352,26 +3352,41 @@ standard error.
@DefstrItem {SN-DOT, ms}
@DefstrListEnd {SN-NO-DOT, ms}
After invocation of @code{NH}, the assigned section number is made
-available in the strings @code{SN-DOT} (exactly as it appears in the
-printed section heading) and @code{SN-NO-DOT} (with the final period
-omitted). The string @code{SN} is also defined, as an alias for
-@code{SN-DOT}; if preferred, you may redefine it as an alias for
-@code{SN-NO-DOT}, by including the initialization
-
+available in the strings @code{SN-DOT} (as it appears in a printed
+section heading with default formatting, followed by a terminating
+period), and @code{SN-NO-DOT} (with the terminating period omitted).
+The string @code{SN} is also defined, as an alias for @code{SN-DOT};
+if preferred, you may redefine it as an alias for @code{SN-NO-DOT},
+by including the initialization
@Example
-.ds SN-NO-DOT
.als SN SN-NO-DOT
@endExample
@noindent
-@strong{before} your first use of @code{NH}, or simply
+at any time @strong{before} you would like the change to take effect.
+@endDefstr
+@Defstr {SN-STYLE, ms}
+You may control the style used to print section numbers, within
+numbered section headings, by defining an appropriate alias for the
+string @code{SN-STYLE}. The default style, in which the printed
+section number is followed by a terminating period, is obtained
+by defining the alias
@Example
-.als SN SN-NO-DOT
+.als SN-STYLE SN-DOT
+@endExample
+
+@noindent
+If you prefer to omit the terminating period, from section numbers
+appearing in numbered section headings, you may define the alias
+@Example
+.als SN-STYLE SN-NO-DOT
@endExample
@noindent
-@strong{after} your first use of @code{NH}.
+Any such change in section numbering style becomes effective from
+the next use of @code{.NH}, following redefinition of the alias for
+@code{SN-STYLE}.
@endDefstr
@Defmac {SH, [@Var{match-level}], ms}
diff --git a/tmac/groff_ms.man b/tmac/groff_ms.man
index 9ec359eb..00891139 100644
--- a/tmac/groff_ms.man
+++ b/tmac/groff_ms.man
@@ -528,14 +528,57 @@ scaling factor should be employed,
when assigning a value specified in points.
.
.IP
+The style used to represent the section number,
+within a numbered heading,
+is controlled by the
+.B SN-STYLE
+string;
+this may be set to either the
+.B SN-DOT
+or the
+.B SN-NO-DOT
+style,
+(described below),
+by aliasing
+.B SN-STYLE
+accordingly.
+By default,
+.B SN-STYLE
+is initialised by defining the alias
+.RS
+.nf
+.IP
+\&.als SN-STYLE SN-DOT
+.fi
+.RE
+.IP
+it may be changed to the
+.B SN-NO-DOT
+style,
+if preferred,
+by defining the alternative alias
+.RS
+.nf
+.IP
+\&.als SN-STYLE SN-NO-DOT
+.fi
+.RE
+.IP
+Any such change becomes effective with the first use of
+.BR .NH ,
+.I after
+the new alias is defined.
+.
+.IP
After invoking
.BR .NH ,
the assigned heading number is available in the strings
.B SN-DOT
-(exactly as it appears in the formatted heading),
+(as it appears in the default formatting style for numbered headings,
+with a terminating period following the number),
and
.B SN-NO-DOT
-(with its final period omitted).
+(with this terminating period omitted).
The string
.B SN
is also defined,
@@ -550,28 +593,16 @@ by including the initialisation:
.RS
.nf
.IP
-\&.ds SN-NO-DOT
\&.als SN SN-NO-DOT
.fi
.RE
.
.IP
-.I before
-the first use of
+at any time;
+the change becomes effective with the next use of
.BR .NH ,
-or simply:
-.
-.RS
-.nf
-.IP
-\&.als SN SN-NO-DOT
-.fi
-.RE
-.
-.IP
.I after
-the first use of
-.BR .NH .
+the new alias is defined.
.
.TP
.BI .SH\ [ xx ]
diff --git a/tmac/s.tmac b/tmac/s.tmac
index 82e4aaf7..b43fd454 100644
--- a/tmac/s.tmac
+++ b/tmac/s.tmac
@@ -1534,6 +1534,16 @@ Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
.\" Numbered headings.
.\" nh*hl is the level of the last heading
.nr nh*hl 0
+.\" SN-DOT and SN-NO-DOT represent the section number of
+.\" the current heading, with and without a terminating dot.
+.ds SN-DOT
+.ds SN-NO-DOT
+.\" SN-STYLE sets the statement numbering style used in headings
+.\" (either SN-DOT or SN-NO-DOT); for backward compatibility with
+.\" earlier ms versions, the default is SN-DOT
+.als SN-STYLE SN-DOT
+.\" Also for backward compatibility, let SN represent SN-DOT.
+.als SN SN-DOT
.\" numbered heading
.de @NH
.ie '\\$1'S' \{\
@@ -1577,12 +1587,11 @@ Foundation, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
. 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
.DEVTAG-NH "\\$1"
. if '\*(.T'html' .nr need_eo_h 1
-\\*[SN-DOT]
+\\*[SN-STYLE]
..
.\" ****************************
.\" ******** module toc ********