groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MOM heading question


From: Peter Schaffter
Subject: Re: MOM heading question
Date: Fri, 26 Nov 2021 13:08:42 -0500
User-agent: Mutt/1.9.4 (2018-02-28)

On Thu, Nov 25, 2021, Richard Morse wrote:
> Most of the paragraphs in the document are numbered as,
> e.g., 5.2.23.  However, the separate articles (ie, the “5” of
> the example) are introduced as “ARTICLE V” — that is, in
> Roman numerals.
> 
> I tried to leave out the number in the heading style for heading
> level 1, but then the subheading (2, 3) don’t include the
> heading number, and they don’t reset to one when a new heading
> level 1 occurs.
> 
> Is there some way to suppress the *display* of the heading
> number for a particular level while still having it count for
> purposes of labelling the rest of the headings?

Yes.  It requires the insertion of a line into mom's main macro
file, om.tmac.
  - open om.tmac
  - search for
      MAC HEADING END
  - search for
      TOC collection and formatting
Immediately above "TOC collection and formatting", insert
  .if \\n[#LEVEL]=1 .rm $HD_NUM

With this, if you set
  .HEADING_STYLE 1 NUMBER
  .HEADING_STYLE 2 NUMBER
  .HEADING_STYLE 3 NUMBER
  ...
in your input file, first level headings will not display the
heading number but subsequent heading levels, incrementing as
expected, will.  You will have to include the roman numeral for
each ARTICLE in the string you pass to HEADING 1.  You can do it
literally or by associating the numbering with an incrementing,
roman numeral register you create in your input file, e.g.
  .nr foo 0 1
  .af foo I
This keeps track of the roman numeral ARTICLE numbers for you.
  .HEADING 1 "ARTICLE \n+[foo]"

-- 
Peter Schaffter
https://www.schaffter.ca



reply via email to

[Prev in Thread] Current Thread [Next in Thread]