texlive[71333] Master/texmf-dist/tex/plain/cweb: [CWEB] Updated

commits+ascherer at tug.org commits+ascherer at tug.org
Fri May 24 16:09:13 CEST 2024


Revision: 71333
          https://tug.org/svn/texlive?view=revision&revision=71333
Author:   ascherer
Date:     2024-05-24 16:09:13 +0200 (Fri, 24 May 2024)
Log Message:
-----------
[CWEB] Updated macros.

See https://github.com/ascherer/web/issues/25 for some context.

Modified Paths:
--------------
    trunk/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -1,5 +1,5 @@
 % hypertext macros for CWEB listings (in addition to cwebmac.tex)
-% Version 1.1 --- September 2023
+% Version 2.0 --- May 2024
 \ifx\ifacrohint\undefined\endinput\fi % these are not standalone macros
 \ifluatex % LuaTeX is almost like pdfTeX
 \protected\def\pdfliteral   {\pdfextension literal}
@@ -15,6 +15,18 @@
 \let\pdfoutput=\outputmode
 \fi % end of LuaTeX->pdfTeX redirection macros
 
+% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex
+\def\startpdf{\def\pagemode{/PageMode /UseOutlines}
+  \ifnum\contentspagenumber=0 \advance \pageno by -1
+    \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St 1 >>
+      \the\pageno << /P(Contents) >> ] >>}
+  \else \twodigits=\pageno \pageno=\contentspagenumber
+    \advance \pageno by 1 \advance \twodigits by -\pageno
+    \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St \the\pageno >>
+      \the\twodigits << /S/D/St \contentspagenumber >> ] >>} \fi
+  \ifpdflua\pdfcatalog{\pagemode\space\pagelabels}
+  \else \special{pdf: docview << \pagemode\space\pagelabels >>}\fi}
+
 \ifacro % The following are general pdf macros
 \def\thewidth{\the\wd0 \space}
 \def\theheight{\the\ht\strutbox\space}

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -28,6 +28,7 @@
 % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005
 % Version 3.64 [p22] --- Andreas Scherer, March 2016
 % Version 4.9 --- Andreas Scherer, June 2022
+% Version 4.12 --- Andreas Scherer, May 2024
 
 \ifx\undefined\botofcontents\input cwebmac.tex\fi
 
@@ -81,11 +82,11 @@
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   \rightskip 0pt \hyphenpenalty 50 \tolerance 200
   \setpage \output={\normaloutput\page\lheader\rheader}
-  \titletrue % prepare to output the table of contents
+  \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
   \pageno=\contentspagenumber
   \redefcon
   \ifhint\HINThome\fi% Mark the Table of contents as home page
-  \topofcontents \startpdf
+  \topofcontents
   \line{\headerline}
   \let\ZZ=\contentsline
   \readcontents\relax % read the contents info

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -28,6 +28,7 @@
 % Version 3.64 [p21] --- Andreas Scherer, October 2005
 % Version 3.64 [p22] --- Andreas Scherer, March 2016
 % Version 4.9  --- Andreas Scherer, June 2022
+% Version 4.12 --- Andreas Scherer, May 2024
 
 % french translations --- Denis Roegel, 18 September 1994
 
@@ -107,12 +108,12 @@
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   \rightskip 0pt \hyphenpenalty 50 \tolerance 200
   \setpage \output={\normaloutput\page\lheader\rheader}
-  \titletrue % prepare to output the table of contents
+  \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
   \pageno=\contentspagenumber
   \def\grouptitle{SOMMAIRE:}
   \message{Sommaire:}
   \ifhint\HINThome\fi% Mark the Table of contents as home page
-  \topofcontents \startpdf
+  \topofcontents
   \line{\hfil Section\ifhint\else\hbox to3em{\hss Page}\fi}% No Page in HINT
   \let\ZZ=\contentsline
   \readcontents\relax % read the contents info

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -28,6 +28,7 @@
 % Version 3.64 [p21] --- Andreas Scherer, October 2005
 % Version 3.64 [p22] --- Andreas Scherer, March 2016
 % Version 4.9 --- Andreas Scherer, June 2022
+% Version 4.12 --- Andreas Scherer, May 2024
 
 \ifx\undefined\botofcontents\input cwebmac.tex\fi
 
@@ -133,12 +134,12 @@
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   \rightskip 0pt \hyphenpenalty 50 \tolerance 200
   \setpage \output={\normaloutput\page\lheader\rheader}
-  \titletrue % prepare to output the table of contents
+  \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
   \pageno=\contentspagenumber
   \def\grouptitle{INDICE}
   \message{Indice:}
   \ifhint\HINThome\fi% Mark the Table of contents as home page
-  \topofcontents \startpdf
+  \topofcontents
   \line{\hfil Sezione\ifhint\else\hbox to3em{\hss Pag.}\fi}% No Page in HINT
   \let\ZZ=\contentsline
   \readcontents\relax % read the contents info

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -1,10 +1,10 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.11 --- October 2023
+% Version 4.12 --- May 2024
 % modified for proofs in CTWILL
 % modified for PDF/HINT output with 'tex "\let\pdf+' or '{hi|lua|pdf|xe}tex'
 % This file is not copyrighted and can be used freely.
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CTWILL4.11+PROOFS+PDF}
+\xdef\fmtversion{\fmtversion+CTWILL4.12+PROOFS+PDF}
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -216,7 +216,7 @@
 \def\T#1{\leavevmode % octal, hex or decimal constant
   \hbox{$\def\?{\kern.2em}%$%
     \let\ \, % C++ digit separator becomes a little white space
-    \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant
+    \def\$##1{\egroup_{\rm##1}\bgroup}%$% suffix to constant
     \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
     \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$%
 \def\U{\note{This code is used in section}} % xref for use of a section
@@ -274,8 +274,6 @@
 \def\title{\expandafter\uppercase\expandafter{\jobname}}
 \def\topofcontents{\centerline{\titlefont\title}\vskip.7in
   \vfill} % this material will start the table of contents page
-\def\startpdf{\ifpdf \ifpdflua\pdfcatalog{/PageMode /UseOutlines}
-  \else {\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
 \def\botofcontents{\vfill
   \centerline{\covernote}} % this material will end the table of contents page
 \def\covernote{}
@@ -400,12 +398,12 @@
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   \rightskip 0pt \hyphenpenalty 50 \tolerance 200
   \setpage \output={\normaloutput\page\lheader\rheader}
-  \titletrue % prepare to output the table of contents
+  \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
   \pageno=\contentspagenumber
   \def\grouptitle{TABLE OF CONTENTS}
   \message{Table of contents:}
   \ifhint\HINThome\fi% Mark the Table of contents as home page
-  \topofcontents \startpdf
+  \topofcontents
   \line{\hfil Section\ifhint\else\hbox to3em{\hss Page}\fi}% No Page in HINT
   \let\ZZ=\contentsline
   \readcontents\relax % read the contents info

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -1,11 +1,11 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.11 --- October 2023
+% Version 4.12 --- May 2024
 % modified for pages produced by CTWILL
 % further modified for page size of the MMIXware book
 % modified for PDF output with 'tex "\let\pdf+' or '{lua|pdf|xe}tex'
 % This file is not copyrighted and can be used freely.
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CTWILL4.11+LNCS+PDF}
+\xdef\fmtversion{\fmtversion+CTWILL4.12+LNCS+PDF}
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -515,8 +515,6 @@
   %\global\advance\pageno by1}
 %\def\topofcontents{\centerline{\titlefont\title}\vskip.7in
   %\vfill} % this material will start the table of contents page
-%\def\startpdf{\ifpdf \ifpdflua\pdfcatalog{/PageMode /UseOutlines}
-  %\else {\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
 %\def\botofcontents{\vfill
   %\centerline{\covernote}} % this material will end the table of contents page
 %\def\covernote{}
@@ -569,11 +567,11 @@
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   %\rightskip 0pt \hyphenpenalty 50 \tolerance 200
   %\setpage \output={\normaloutput\page\lheader\rheader}
-  %\titletrue % prepare to output the table of contents
+  %\ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
   %\pageno=\contentspagenumber
   %\def\grouptitle{TABLE OF CONTENTS}
   %\message{Table of contents:}
-  %\topofcontents \startpdf
+  %\topofcontents
   %\line{\hfil Section\hbox to3em{\hss Page}}
   %\let\ZZ=\contentsline
   %\readcontents\relax % read the contents info

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -1,6 +1,6 @@
 % pdfwebtofront.tex
 % Code from knuth.drv in https://github.com/oberdiek/latex-tds
-% 2020/06/20 v2.0 by Andreas Scherer.
+% 2024/05/24 v3.0 by Andreas Scherer.
 %
 % This file is part of project https://github.com/ascherer/cwebbin
 % and may be distributed under the MIT License or the LaTeX Project
@@ -17,6 +17,14 @@
 \openin\testread=\contentsfile\relax
 \ifeof\testread % First run
 \else % Second run
+  % Fix page numbers in the PDF bootmarks with 'Page Labels'
+  \def\tocpages{1} % Most programs have one page Table-of-Contents
+  \def\pagemode{/PageMode /UseOutlines}
+  \def\pagelabels{/PageLabels << /Nums [
+    \ifnum\contentspagenumber=0 0 << /P(Contents) >> \tocpages << /S/D/St 1 >>
+    \else 0 << /S/D/St \contentspagenumber >> \fi ] >> }
+  \def\startpdf{\ifpdf \ifpdflua\pdfcatalog{\pagemode \pagelabels}
+    \else {\special{pdf: docview << \pagemode \pagelabels >>}}\fi\fi}
   % Redefine '\con' to be invoked before the first '\N' (starred section).
   \let\ORGcon\con
   \def\con{%
@@ -42,10 +50,13 @@
   \edef\y{\detokenize{mf}}%
   \ifx\x\y \texmftrue\else
   \edef\y{\detokenize{pdftex}}%
-  \ifx\x\y \texmftrue\else
+  \ifx\x\y \texmftrue \def\tocpages{2}\else
   \edef\y{\detokenize{xetex}}%
   \ifx\x\y \texmftrue\fi\fi\fi\fi
   \iftexmf
+    % These main programs start on page '3' (after any number of ToC pages)
+    \def\pagelabels{/PageLabels << /Nums [
+      0 << /P(Contents) >> \tocpages << /S/D/St 3 >> ] >> }
     \expandafter\let\csname ORGN\expandafter\endcsname
                     \csname N\endcsname
     \expandafter\outer\expandafter\def\csname N\endcsname{%
@@ -55,6 +66,10 @@
       \csname N\endcsname
     }%
   \else % Much more general approach for WEB and CWEB programs.
+    \edef\y{\detokenize{mp}}%
+    % This main program starts on page '3' (after any number of ToC pages)
+    \ifx\x\y \def\pagelabels{/PageLabels << /Nums [
+        0 << /P(Contents) >> \tocpages << /S/D/St 3 >> ] >> } \fi
     % In fact, '\con' will be invoked _inside_ the first '\N' right _after_
     % '\MN', but _before_ '\eject'.  And '\topofcontents' gets in the twist
     % as well.

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex	2024-05-24 14:05:19 UTC (rev 71332)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex	2024-05-24 14:09:13 UTC (rev 71333)
@@ -1,8 +1,8 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.11 --- October 2023
+% Version 4.12 --- May 2024
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CWEB4.11}
-\chardef\cwebversion=4 \chardef\cwebrevision=11
+\xdef\fmtversion{\fmtversion+CWEB4.12}
+\chardef\cwebversion=4 \chardef\cwebrevision=12
 
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
@@ -215,8 +215,8 @@
 \def\T#1{\leavevmode % octal, hex or decimal constant
   \hbox{$\def\?{\kern.2em}%$%
     \let\ \, % C++ digit separator becomes a little white space
-%    \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant % versions < 3.67
-    \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant % in version 3.67
+%    \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant %$% versions < 3.67
+    \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant %$% in version 3.67
     \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
     \let\~=\oct \let\^=\hex \let\\=\bin {#1}$}}%$%
 \def\U{\note{This code is used in section}} % xref for use of a section
@@ -276,8 +276,6 @@
 \def\title{\expandafter\uppercase\expandafter{\jobname}}
 \def\topofcontents{\centerline{\titlefont\title}\vskip.7in
   \vfill} % this material will start the table of contents page
-\def\startpdf{\ifpdf \ifpdflua\pdfcatalog{/PageMode /UseOutlines}
-  \else {\special{pdf: docview << /PageMode /UseOutlines >>}}\fi\fi}
 \def\botofcontents{\vfill
   \centerline{\covernote}} % this material will end the table of contents page
 \def\covernote{}
@@ -383,12 +381,12 @@
 % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers
   \rightskip 0pt \hyphenpenalty 50 \tolerance 200
   \setpage \output={\normaloutput\page\lheader\rheader}
-  \titletrue % prepare to output the table of contents
+  \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents
   \pageno=\contentspagenumber
   \def\grouptitle{TABLE OF CONTENTS}
   \message{Table of contents:}
   \ifhint\HINThome\fi% Mark the Table of contents as home page
-  \topofcontents \startpdf
+  \topofcontents
   \line{\hfil Section\ifhint\else\hbox to3em{\hss Page}\fi}% No Page in HINT
   \let\ZZ=\contentsline
   \readcontents\relax % read the contents info



More information about the tex-live-commits mailing list.