Oh wow ! Thanks for doing this, super cool.
Since writing my original question, I've found one way to accomplish
what I want without having to rewrite the NH macro, but it may produce
worse output, especially on certain devices, because of the method used.
I .mk the position of the top-level heading and .rt before the deeper
heading. This causes the deeper-level heading to print over the
top-level, which shouldn't be an issue because the headings are already
typeset bold, but this could cause worse output as I said.
\" example.ms:
\" Increment Heading level $1 and create a heading level $1+1 with
\" automatic numbering
.de IH
.NH \\$1
.mk
.NH \\$1+1
.rt
..
\" ms input
.IH 1
foo
.NH 2
bar
.IH 1
baz
.IH 2
ber
$ nroff -c -ms example.ms
1.1. foo
1.2. bar
2.1. baz
2.2.1 ber
I am certain there are issues with this version as I am not at all
experienced with writing troff macros, so please let me know if they
jump out at you ! :)
--
S.