Hi Sebastien,

At 2025-10-13T22:01:54-0300, 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...

I don't know of any way to achieve what you're aiming for with Lesk ms
(Seventh Edition Unix), Tuthill ms (4.2BSD), or groff ms.

Does anyone else?

I guess if I were in your position, I'd forget the `NH` macro
altogether, and use my own registers to construct and increment the
two-part version numbers, then interpolate them on the line after an
`SH` (unnumbered heading) macro call.  That should get them correctly
into the body text.

You could alternatively use the `XH` macro, which Keith Marshall
contributed to groff 1.23.0, to also get these headings into the table
of contents, as long as you don't need to call any macros as part of
formatting your section heading.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to