URL: <https://savannah.gnu.org/bugs/?62825>
Summary: Incorrect section number using \*($n in a header Project: GNU troff Submitter: None Submitted: Wed 27 Jul 2022 08:18:06 PM UTC Category: Macro me Severity: 3 - Normal Item Group: Incorrect behaviour Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Planned Release: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Wed 27 Jul 2022 08:18:06 PM UTC By: Anonymous When re-defining the $h macro for a custom header when using -me, putting the section number in the header with \*($n results in the number being off by one (e.g. 1.1 instead of 1.2). This can be seen by running groff -me on this example: .de $h .tl 'Chapter \\n(ch'Section \\*($n'Page \\n%' .hl .. .$c .sh 2 "Section 1.1" .lp This is the first section. .bp .sh 2 "Section 1.2" .lp This is the second section. .bp .sh 2 "Section 1.3" .lp This is the third section. Here's the output when running nroff -ww -me: $ nroff -ww -me section_test.roff | cat -s troff: section_test.roff:5: warning: number register 'ch' not defined troff: section_test.roff:5: warning: macro '$n' not defined troff: section_test.roff:5: warning: macro '$C' not defined troff: section_test.roff:6: warning: number register '$1' not defined Chapter 0 Section Page 1 _________________________________________________________________ CHAPTER 1 1.1. Section 1.1 This is the first section. Chapter 1 Section 1.1 Page 2 _________________________________________________________________ 1.2. Section 1.2 This is the second section. Chapter 1 Section 1.2 Page 3 _________________________________________________________________ 1.3. Section 1.3 This is the third section. I don't mind the section number (and chapter number) being off on the first page, as I always suppress the header anyhow on the first page of a new chapter. But the wrong section numbers in the headers of subsequent pages is an issue. If there's something I'm doing wrong, or if there's a simple fix/workaround I could use, then that would be good to know. Otherwise I guess it's a bug. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?62825> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/