groff
[Top][All Lists]
Advanced

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

Re: page reference , page foward reference


From: Marko Pesikan
Subject: Re: page reference , page foward reference
Date: Thu, 21 Nov 2019 23:29:15 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

Good evening,
awesome!

Thx for providing a solution.

regards, Marko


Am 21.11.19 um 18:51 schrieb Ralph Corderoy:
Hi Marko,

i realize if i add a cover page , that the page number does not exact
work, i get a wrong page number.
My new test code.

     $ cat ref.tr
     .nr H1dot 0
     .
     .INITR index
     .
     .COVER
     .TL title
     .AU author
     .COVEND
     .
     .H 1 Introduction
     .SETR intro
     .
     Chapter
     .GETHN epi
     \& on page
     .GETPN epi
     \& is well worth a peruse.
     .
     .H 2 Sub-introduction
     .SETR subintro
     .
     .SK
     .
     .H 1 Epilogue
     .SETR epi
     .
     .GETHN intro s
     Read fine chapter \*s,
     .GETHN subintro s
     including sub-chapter \*s.
     $

I agree the output is wrong.

     $ mmroff -Tascii ref.tr | grep .
                                       author
                                 November 21, 2019
                                        - 2 -
            1  Introduction
            Chapter 2 on page 2 is well worth a peruse.
            1.1  Sub-introduction
                                        - 3 -
            2  Epilogue
            Read fine chapter 1, including sub-chapter 1.1.
     $

This is because there are two `current' page numbers being used.
There's troff's number register called `%', and another number register
that mm maintains called `P'.

The default page header uses P.

     .ds pg*header ''- \\nP -''

The COVEND pulls in /usr/share/groff/1.22.4/tmac/mm/ms.cov that resets %
back to 1 so the page after the cover page is page 1.

     .bp 1

SETR uses % when defining the reference.

     .       ds \\*[qrf*name]-pn \\n[%]

This inconsistency seems wrong.  Better heads, and those with more time,
need to take a look.  :-)  I may have worked around it by altering the
start of the code to be

     .nr H1dot 0
   + .nr P -1
     .
     .INITR index

     $ mmroff -Tascii ref.tr | grep .
                                      author
                                November 21, 2019
                                       - 1 -
           1  Introduction
           Chapter 2 on page 2 is well worth a peruse.
           1.1  Sub-introduction
                                       - 2 -
           2  Epilogue
           Read fine chapter 1, including sub-chapter 1.1.
     $

But this shouldn't be needed AFAICS.




reply via email to

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