[comp.text.tex] Indexing multi-part page numbers

mark@motown.altair.fr (Mark James) (05/02/91)

I'm responsible for a 300-page user manual that's getting more and
more stable, as our product does likewise.  So instead of reprinting
the whole thing with each new version, I'd like to print only those
chapters that have changed.  In order not to screw up the pagination
and the index of the whole thing, I'd like to switch from LaTeX's
standard sequential page numbers to the format n-m, where n is the
chapter number and m is the page number within the chapter.  I did:

\renewcommand{\thepage}{\thechapter-\arabic{page}}

and reset the page number with each chapter.  Everything works except
the index (I use Scott Simpson's "index" program).  The \index
commands generate the appropriate page numbers in the .idx file, but
the "index" program chokes on that format when creating its .ind file.

So my questions are:

1.  Is there another indexing program (makeindex, indexor, etc.) that
    handles arbitrary page number formats?  Does anyone have any
    experience from which I might profit?

2.  This suggests that other aspects of TeX/LaTeX might also depend
    upon sequential, numeric page numbers.  For example, how are page
    numbers stored in .dvi files, so that programs such as dvips know
    where to find page 137 when I give the "-p 137" option?  What
    horrors await me as I proceed with this effort?

In my two years of reading comp.text.tex, I recall no one expressing
the slightest interest in this subject, so e-mail responses are
probably most appropriate.  If I'm wrong on that, let me know and I'll
post a summary.  Thanks for any advice.

--
=== T. Mark James           ==== opinions, errors etc are my own ===
=== mark@bdblues.altair.fr  ==== "I'm stupid enough to try anything
=== +33 (1) 39 63 53 93     ====  once."  -- The `Bag Man'
================================      Univ. of Washington, 1968

marcel@cs.caltech.edu (Marcel van der Goot) (05/04/91)

Mark James (mark@motown.altair.fr) asked about page numbers:

>    This suggests that other aspects of TeX/LaTeX might also depend
>    upon sequential, numeric page numbers.  For example, how are page
>    numbers stored in .dvi files, so that programs such as dvips know
>    where to find page 137 when I give the "-p 137" option?  What
>    horrors await me as I proceed with this effort?

When TeX (and therefore LaTeX) ships out a page to the dvi file, one
of the things it stores are the values of registers \count0, ..., \count9.
If these are non-zero, their value is also displayed on your screen
as [1], [1.2], etc. Programs that work on dvi files get the page number
by assuming that \count0 contained the pagenumber. Indeed, in plain
TeX, \pageno is equal to \count0. Exactly how that number is interpreted
depends on the program; e.g., if you tell a program to find page 137 it
will probably look for the first page with \count0=137, but a program
might also just take the 137th page, regardless of the number stored
as \count0.
    However, the characters you print on the page to be interpreted by
the reader as ``page number'' do not need to correspond to the value
stored in register \count0. So, for instance, one could reserve a new
counter \mypage which holds the pagenumber that is printed, and is different
from the value in \count0. Then the dvi file will look just as if \count0
was the pagenumber. Unfortunately, although that method might solve
your problems, it probably requires changing the \output routine. That
is a lot easier in plain TeX than in LaTeX. Whether you want to do that
depends on how experienced you are with TeX/LaTeX.
    If you can just store every chapter in a separate file, the problems
with selecting a page in dvi drivers would go away, since each page
number occurs only once. But probably this method gives you bigger problems
in return, if you want to have references in one chapter to another chapter.
    Sorry, no instant solutions here; hope it helped anyway.


                                          Marcel van der Goot
 .----------------------------------------------------------------
 | Blauw de viooltjes,                    marcel@vlsi.cs.caltech.edu
 |    Rood zijn de rozen;
 | Een rijm kan gezet
 |    Met plaksel en dozen.
 |

plaut@sc2a.unige.ch (05/06/91)

In article <2155@seti.inria.fr>, mark@motown.altair.fr (Mark James) writes:
> 
> I'm responsible for a 300-page user manual that's getting more and
> more stable, as our product does likewise.  So instead of reprinting
> the whole thing with each new version, I'd like to print only those
> chapters that have changed.  In order not to screw up the pagination
> and the index of the whole thing, I'd like to switch from LaTeX's
> standard sequential page numbers to the format n-m, where n is the
> chapter number and m is the page number within the chapter. 

-- 

I think that the simpliest way to do it is to go through LaTeX with
the whole document but to PRINT only the pages you are interested
in.

If you use DVILN03 or DVITOLN3, the command would be

DVITOLN3 filename /s=x /n=y

where x is the Startpage and y the Number of pages to be printed.

Good luck.

-----------------------------------------------------------------
| Olivier Plaut. University of Geneva.      Geneva, Switzerland |
| INTERNET: plaut@sc2a.unige.ch         BITNET:  plaut@cgeuge52 |
-----------------------------------------------------------------

flowers@memstvx1.memst.edu (Harry Flowers) (05/08/91)

In article <1991May6.111959.418@sc2a.unige.ch>, plaut@sc2a.unige.ch writes:
> In article <2155@seti.inria.fr>, mark@motown.altair.fr (Mark James) writes:
>> 
>> I'm responsible for a 300-page user manual that's getting more and
>> more stable, as our product does likewise.  So instead of reprinting
>> the whole thing with each new version, I'd like to print only those
>> chapters that have changed.  In order not to screw up the pagination
>> and the index of the whole thing, I'd like to switch from LaTeX's
>> standard sequential page numbers to the format n-m, where n is the
>> chapter number and m is the page number within the chapter. 
> 
> -- 
> 
> I think that the simpliest way to do it is to go through LaTeX with
> the whole document but to PRINT only the pages you are interested
> in.

I modified the book style to form a manual style.  I believe it's now
distributed as part of the standard LaTeX package.  It does the n-m numbering
as well as supporting page ranges to print.  The documentation (changes from
book style) are in the top of the manual.sty file; for page selection you are
referred to the bottom of the same file.  It uses a Knuth hack from TUGboat.