bug-groff
[Top][All Lists]
Advanced

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

[bug #62825] page header info should correspond to last section on the p


From: anonymous
Subject: [bug #62825] page header info should correspond to last section on the page
Date: Fri, 29 Jul 2022 14:35:05 -0400 (EDT)

Follow-up Comment #10, bug #62825 (project groff):

[comment #7 comment #7:]
> It sounds to me like this was just a straight-up bug.  My guess is that
people simply haven't been putting section information in their headers
because of this behavior, they worked around it, or they got lucky.

I think they might have worked around it, possibly in the same way I just
figured out: using hard-coded values. I did it like this:

0 Typeset the document with your custom "generic" $h macro definition to be
used for all pages.
0 Go through the output to find the "problem" pages with headers showing the
incorrect section number/title.
0 On the page _before_ each "problem" page and _after_ the last section
creation on that page, re-define $h with a hard-coded section number/title.
0 Right after the "problem" page is created, restore the "generic" $h
definition.
0 Repeat this for each "problem" page.

I tried this out on my example and it worked (the first page of a chapter
doesn't matter to me because I always suppress the header there anyway):


.hx
.ll 6.5i
.de $h
.tl 'Chapter \\n(ch'Section \\*($n'Page \\n%'
.hl
..
.+c ""
.sh 2 "Section 1.1"
.lp
This is the first section.
.rm $h
.de $h
.tl 'Chapter \\n(ch'Section 1.2'Page \\n%'
.hl
..
.bp
.sh 2 "Section 1.2"
.rm $h
.de $h
.tl 'Chapter \\n(ch'Section \\*($n'Page \\n%'
.hl
..
.lp
This is the second section.
.rm $h
.de $h
.tl 'Chapter \\n(ch'Section 1.3'Page \\n%'
.hl
..
.bp
.sh 2 "Section 1.3"
.lp
This is the third section.

The output now has correct headers:


$ nroff -me section_test_fix.roff | cat -s

                           CHAPTER  1

1.1.  Section 1.1

This is the first section.

Chapter 1                  Section 1.2                     Page 2
_________________________________________________________________

1.2.  Section 1.2

This is the second section.

Chapter 1                  Section 1.3                     Page 3
_________________________________________________________________

1.3.  Section 1.3

This is the third section.


I also tried it in my larger document where I first saw the problem, and it
worked there, too (with a more complicated $h definition). It's brute force
and ugly, and tedious, since it has to be done for every section change
(excluding new chapters). But it works. This is for the me macros, but the
workaround for ms is similar.

Brian Kernighan is still around (and typesetting new books in troff), so I'm
tempted to email him and ask if this is how he did it in the K&R C book. Maybe
I was giving the old troff too much credit. :)

[comment #7 comment #7:]
> An LX?  Running 2.6?  We might have this bug fixed before it finishes
booting.  And we don't work fast.

Haven't booted up the LX yet. I'd rather wait until the winter when the heat
from the massive Sun monitor could warm my entire house. I'll still try it,
but not a priority since I found a workaround that will tide me over until a
true fix is released. I appreciate you and Dave working on this. It's great
that groff will likely be the first troff implementation to fix this
decades-old bug that seems to go back to the old UNIX troff from the 1970s.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62825>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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