Re: Do not print higher-level headings with ms NH

Deri <[email protected]>
Newsgroups gmane.comp.printing.groff.general
Message-ID <4124229.l0i7eVnBpF@pip>
On Tuesday, 14 October 2025 02:01:54 GMT Sebastien Peterson-Boudreau wrote:
> Oftentimes when writing documents with numbered headings (using ms), I
> have no need of the top level heading -- at least, not to display it --
> but still want the automatic numbering for deeper headings.
> 
> For example, I will oftentimes settle for something like this:
> 
> 	\" ms input
> 	.NH 1
> 	.NH 2
> 	foo
> 	.NH 2
> 	bar
> 	.NH 1
> 	.NH 2
> 	baz
> 
> 	\" output...
> 	1.
> 	1.1. foo
> 	1.2. bar
> 	2.
> 	2.1. baz
> 
> ...when really I'd like to only have the headings with `foo', `bar', and
> `baz', if that all makes sense.
> 
> So, I was wondering if there was any option to suppress the output of
> the `.NH 1' while still having it increment the number of headings.
> Otherwise, I will have to look into fiddling with whatever internal
> registers NH uses...
> 
> Thanks :D

You could try:-

.de NONH
.  nr nh*hl \\$1
.  nr H1 \\$1
.  nr H2 0
..
.NONH 1
.NH 2
Foo
.NH 2
Bar
.NONH 2
.NH 2
bother
.NH 2
ation
.NH 3
3rd level
.NONH 3
.NH 2
2nd level

Call NONH where you would call ".NH 1". The parameter is the number you want 
to appear in the first level. Can definitely be improved. :-)

Cheers

Deri
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.