(Ted Harding) wrote:
On 12-Feb-07 Joerg van den Hoff wrote:
hi, second try (something went wrong the first time...):
I stumbled over the following:
I have some ms-macros to collect .NH section headings automatically in
a table of content
(TOC) with the correct section number. a stripped down variant is
attached. in order to
account for .SH sections as well I modifed this recently. the calling
syntax is
.NHH n heading
where `n' is the level and `heading' the section header. if `n' is set
to 0 a `.SH'
section should be inserted, otherwise a level-n `.NH' section. I now
noted that inserting
.NHH 0 heading
calls in the document leads to omission of the \*[SN] information from
the TOC despite
correct numbering in the document. only if one uncomments the third
line in the attached
example (i.e. `.rm SN') everything is ok.
question: can someone explain to me what actually is going on? somehow
something seems to
go wrong with the `.als SN SN-DOT' or I unintentionally mask the
correct definition of
\*[SN] or whatever. I don't get it why the `.NH' calls work, but \*[SN]
no longer contains
the correct information if I insert the `.SH' option in the macro
definition. why have I
explicitely `.rm SN' first??
any ideas would be appreciated :-)
joerg
I tried your example (your code not reproduced here) with
groff-1.18.1, without making any changes to it, and got
no earnings, and the following output:
heading1
SN register content: >>><<<
1. heading2
SN register content: >>>1.<<<
1.1. heading3
SN register content: >>>1.1.<<<
Table of Contents
heading1 ................................1
1. heading2 .............................1
1.1. heading3............................1
[spaces in the tab leader removed in the above]
That looks to me like what should have been produced.
Was your result different, and, if so, what is supposed to
be wrong with it?
Bestwishes,
Ted.
sorry, I forgot to mention: I use 1.19.3 (and OSX). and yes, your result is what I would
aspect from the example code, but it's _not_ happening with 1.19.3 (I now actually copied
the example back from the mail and tried again, not to make some silly mistake at this
point ...). the groff -a output, for instance, looks like this:
heading1
SN register content: >>><<<
1. heading2
SN register content: >>><<<
1.1. heading3
SN register content: >>><<<
Table of Contents
heading1 1
heading2 1
heading3 1
i.e. the `.NH' calls number the headings as they should, but \\*[SN] is empty (within the
document). as I wrote, with 1.19, I need to uncomment line 3 (i.e. add `.rm SN' prior to
the .NH call).
but maybe this difference in behaviour between 1.18 and 1.19 corners the culprit? I
believe, the new construction of \*[SN] (i.e. being an alias to either \*[SN-DOT] or
\*[SN-NO-DOT]) was introduced only with 1.19.
I'm simply not fluent enough with the low level troff stuff to understand what exactly is
happening. anyway, I would argue that the code _should_ work as it does in 1.18. the
present behaviour is rather confusing (an "at least for me" always implied...).
best wishes,
joerg