groff
[Top][All Lists]
Advanced

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

Re: [Groff] \*[SN] question


From: Tadziu Hoffmann
Subject: Re: [Groff] \*[SN] question
Date: Fri, 16 Feb 2007 22:14:47 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

> It was I who added the SN-DOT/SN-NO-DOT extensions for
> 1.19.2 ms, and, IIRC, I documented their intended behaviour
> in groff_ms(7), and in the groff info file.

Ah, yes, I see it now.  I must admit it had never occurred to
me to read the documentation - my suggestion was simply an
idea that came to me while trying to figure out the bizarre
behavior Joerg was puzzled by.  (I guess I was adhering to
the old Real Programmer's maxim: the source code is all the
documentation you'll ever need. ;-)


> FWIW, I too was unaware of the DIN/ISO standardisation
> relating to this.  I chose to explicitly use SN-DOT within
> the NH definition, simply to preserve existing behaviour,
> while allowing the user to choose which format should be
> exposed for SN, if he wished to refer to it in any context
> *after* an NH call, e.g. in a section number reference,
> (where I tend to prefer the SN-NO-DOT form).

My preference is also to have the dot in the header but not
in the reference.  (Fortunately no one forces us to comply
with any particular standards.)  Not being a -ms user myself
I'll take Werner's stance in this issue: those who use it
should decide.


> It would be trivial to change NH itself, to use the preferred
> SN format in the heading it emits.  I've no strong preference
> either way; it would depend only on how strongly we wish to
> preserve the classical behaviour.  Tadziu's suggestion would
> provide enhanced flexibility: the classical behaviour would
> remain the default, but the user would have the choice of
> preferred style in *all* contexts, and could always access
> the alternative by explicit reference to SN-DOT/SN-NO-DOT
> on demand.

Unfortunately, upon reflection, simply substituting SN for
SN-DOT in the NH macro is not a viable solution, because we
might wish to have the section number for references (without
the trailing dot) available in SN (so we don't always have to
type SN-NO-DOT), but at the same time want to have the trailing
dot in the section headers themselves.  If we want to allow
user-configurability (other than making the user provide a
custom macro) then the only solution I see is to introduce yet
another alias, say SNH (for "section number in the headers"),
so that we can specify

  .als SNH SN-DOT
  .als SN  SN-NO-DOT

(Actually, regarding configurability of SN in this case, I
wonder who *would* want the trailing dot in the reference...
the trailing dot is part of the "syntactic structure" of the
section header, not part of the section number, just like
the dot in a figure caption like "Figure 1. -- Blahblahblah"
is also not part of the figure number.  Ah, well, I guess we
have to preserve this "for historical reasons".)

Also, playing around a bit with the macros, I wonder if the
"!dSN" query (which apparently was the cause for the strange
behavior) is really necessary in NH.  My notion is that we
could perhaps simply initialize the aliases while loading
the macro package, and then letting the user override this
later on.  Here's a suggestion that appears to work for me
(although I admit I'm not familiar with all the intricacies
of -ms):

-------- cut here ----------------------------------------------
*** s.tmac.orig Fri Feb 16 21:29:45 2007
--- s.tmac      Fri Feb 16 21:29:55 2007
***************
*** 233,238 ****
--- 233,242 ----
  .als MC LP
  .als RT LP
  .als XS LP
+ .ds SN-NO-DOT
+ .ds SN-DOT
+ .als SN SN-NO-DOT
+ .als SNH SN-DOT
  .de cov*ab-init
  .als cov*ab-init @nop
  .als LP @LP
***************
*** 1573,1584 ****
  .     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]
  ..
  .\" ****************************
  .\" ******** module toc ********
--- 1577,1587 ----
  .     as SN-NO-DOT .\\n[H\\n[nh*i]]
  .\}
  .ds SN-DOT \\*[SN-NO-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
! \\*[SNH]
  ..
  .\" ****************************
  .\" ******** module toc ********
-------- cut here ----------------------------------------------






reply via email to

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