bugGNU roff - Bugs: bug #59345, ms: can't use custom titles using...

 
 

bug #59345: ms: can't use custom titles using '%' for page number with .TC

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Sun 25 Oct 2020 04:29:23 AM UTC
   
 
Category:  Macro ms Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 16 Jan 2022 05:02:43 AM UTC, comment #3: 

The removal of support for the old AT&T ms PN register did not last.


commit 3d7a207e853468c78391ae66f9350a5328deac4b
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun May 2 06:12:42 2021 +1000

    [ms]: Restore support for AT&T ms PN register.

    * tmac/s.tmac (pg): Make register PN an alias of %.

    * doc/groff.texi (Differences from AT&T ms):
    * doc/ms.ms (Differences from AT&T ms):
    * tmac/groff_ms.7.man (Differences from troff ms): We don't need PN, and
      it was removed in commit 08291b40 (25 October 2020), but since it is
      documented in Lesk 1978 we're stuck with it.  Advise users to stick
      with %.  Also warn them of the hoop they must jump through if they
      redefine the page trap macro PT, which Lesk 1978 also encourages.

    Fixes <https://savannah.gnu.org/bugs/?59823>.


G. Branden Robinson <gbranden>
Group administrator
Sun 16 Jan 2022 05:01:13 AM UTC, comment #2: 


commit 08291b401786f57ffb8c8c3551455167bcfb4d31
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Sun Oct 25 20:57:39 2020 +1100

    tmac/s.tmac: Fix page number in table of contents.

    Fix ms .TC macro by allowing it to actually use lowercase Roman numerals
    for the page(s) of the table of contents when a custom title (header or
    footer) is defined containing '%'.

    As a side effect, eliminate the PN register, which was apparently
    misused because it was undocumented and had a name just long enough to
    be both suggestive and ambiguous.  Another pin goes into my Ken Thompson
    voodoo doll.

    * tmac/s.tmac (IX): Write out page number of index term(s) in using the
      % register (instead of PN), obtaining whatever format is assigned to
      % the register at that time.
      (CH): Similarly, output %, not PN, in the center of the default
      heading.
      (PT): Save the format of %, set it to decimal, copy its value to a new
      register, pg*page-number-in-decimal, then restore %'s previous format.
      Compare the new register, not %, to 1 to determine whether special
      page one behavior should be used.
      (pg*end-page): Assign pg*next-format to %, not PN.
      (XA): Define toc*num with the interpolation of %, not PN.

    * tmac/tests/s-TC-works-with-percent-in-custom-titles.sh: Test.
    * tmac/tmac.an (tmac_TEST): Run test.

    Problem appears to be very old; as I read it, Larry Kollar was
    complaining of it in his ms.ms document over 20 years ago.

    Fixes <https://savannah.gnu.org/bugs/?59345>.


G. Branden Robinson <gbranden>
Group administrator
Sun 25 Oct 2020 10:59:20 AM UTC, comment #1: 

Turns out you had to use both a custom title (header/footer) with the magic % for the page number and the .TC macro to hit this problem.  Larry Kollar's ms.ms did that.

Fixed in 08291b401786f57ffb8c8c3551455167bcfb4d31.

G. Branden Robinson <gbranden>
Group administrator
Sun 25 Oct 2020 04:29:23 AM UTC, original submission:  

Tables of contents in ms are hosed because they try to set an alternative number format for the page number but this gets ignored, so the table of contents shows up as another page "1".

I guess this has been broken for 20+ years.  Larry Kollar's ms.ms document complains about it at the end--at least I think this is what he was referring to.


$ tail -n 12 doc/ms.ms
.
.\" ====================================================================
.\" Toc here at end...
.\" We need to fix the headers...
.TC
.
.
.\" Local Variables:
.\" fill-column: 72
.\" mode: nroff
.\" End:
.\" vim: set filetype=groff textwidth=72:


After much frustration today, I think I've fixed it.  Attached.

I'm seeing if it changes/regresses any of our other ms documents, and if it doesn't, I'll write a regression test and commit.

Man, am I irritated!

G. Branden Robinson <gbranden>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #50092:  s.tmac.diff added by gbranden (1004B - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-25 gbranden StatusConfirmed Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
        Summaryms: can't use an alternative format for page numbers; breaks .TC ms: can't use custom titles using '%' for page number with .TC
    2020-10-25 gbranden Attached File- Added s.tmac.diff, #50092

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code