Skip to content

Shift page numbers to place mini-indexes on a spread. #86

@ascherer

Description

@ascherer

By default, CTWILL output starts on “page 1” and the mini-index for each pair of pages appears on the even-numbered page. Although the \contentspagenumber is set to “0”, pdfctwimac.tex does not produce a useful table-of-contents (yet).

In DEK's software books (Stanford GraphBase and MMIXware), the mini-indexes appear on the right-hand, i.e., odd-numbered page of each spread. (Don't ask about twimac.tex for WEB sources processed with TWILL.)

In order to achieve this page shift, we must modify pdfctwimac.tex to “add 1” to the \folio number in the page headers

 % diff pdfctwimac.tex /usr/local/texlive/2024basic/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex
419,421d418
< \newcount\PageNo
< \def\Folio{\PageNo=\pageno \advance\PageNo by 1
<   \ifnum\pageno<\z@ \romannumeral-\PageNo \else\number\PageNo \fi}
424c421
<   \hfil\eightrm\Folio}}
---
>   \hfil\eightrm\folio}}
426c423
<   \eightrm\Folio\hfil\ninerm\title:\enspace \eightsl\rrhead\/}}
---
>   \eightrm\folio\hfil\ninerm\title:\enspace \eightsl\rrhead\/}}

and the preamble in mmix-noinx.ch to change the page reference in the PDF catalog

% git diff
diff --git a/mmix-noinx.ch b/mmix-noinx.ch
index caaa449..6f73862 100644
--- a/mmix-noinx.ch
+++ b/mmix-noinx.ch
@@ -2,8 +2,9 @@
 {\eightpoint \let\ninett=\eighttt \editorsnote \vskip7mm}
 @y
 \def\startpdf{\def\pagemode{/PageMode /UseOutlines}
-  \ifpdflua\pdfcatalog{\pagemode}
-  \else\special{pdf: docview << \pagemode >>}\fi}
+  \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St 2 >> ] >> }
+  \ifpdflua\pdfcatalog{\pagemode\space\pagelabels}
+  \else\special{pdf: docview << \pagemode\space\pagelabels >>}\fi}
 {\eightpoint \let\ninett=\eighttt \editorsnote \vskip7mm}
 @z

Internally, apart from the table-of-contents, CWEB documents never reference pages, only sections.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions