On Wed, Feb 14, 2007 at 09:26:50PM +0100, Tadziu Hoffmann wrote:
>
> > > Also, had you called ".NHH n xxx" with n>0 first, everything
> > > would have been okay.
> >
> > not quite: the interspersed `.SH' section would have got an
> > erroneous section number (the last one) in the TOC.
>
> You're right (see below).
>
> > but `.rm SN' instead poses no problem, does it?
>
> On the contrary, removing SN (or at least clearing it) prevents
> unnumbered sections from getting the section number of the
> preceding numbered section in the toc, like you said above.
>
> (However, for the generation of the toc entry this could
> also be fixed by querying "\\$1>0" instead of SN being empty,
> as in deciding whether to use SH or NH in your macro.)
>
that seems the best way, indeed:
.de NHH
.ie (\\$1 > 0) \{\
.NH \\$1
\\$2
.XS
\\*[SN] \\$2
.XE
\}
.el \{\
.SH
\\$2
.XS
\\$2
.XE
\}
..
i.e. avoid using \*[SN] completely when the `.SH' block is used.
then even the `.rm SN' becomes unnecessary.
> > another question: wouldn't it be wiser to emit a warning in
> > s.tmac a la
> >
> > "warning: register `SN' already defined. cannot use it for
> > section number. use SN-(NO-)DOT directly or remove `SN'"
>
> Hmm, this is a matter of debate, but I would say "not necessarily":
> for example, assume you want section numbering according to
> DIN 1421 (ISO 2145), i.e., without the trailing dot.
> Then you could say (in principle - see note below)
>
> .ds SN-NO-DOT
> .als SN SN-NO-DOT
>
> and you wouldn't want to be annoyed with a warning for
> something you expressly requested.
>
> Note: The above doesn't (yet) work, because NH explicitly
> uses SN-DOT in the header. However, I see no reason it
> couldn't use SN. Werner?
>
>
with regards to NH behaviour this sure would be better. did'nt know that there
is a DIN/ISO regulation for that kind of thing, but anyway omitting the trailing
dot probably is the nicer variant (but maybe not for level one sections?).