texlive[63626] Master/texmf-dist/tex/plain/cweb/cwebmac.tex: [CWEB]

commits+ascherer at tug.org commits+ascherer at tug.org
Fri Jun 17 19:44:49 CEST 2022


Revision: 63626
          http://tug.org/svn/texlive?view=revision&revision=63626
Author:   ascherer
Date:     2022-06-17 19:44:48 +0200 (Fri, 17 Jun 2022)
Log Message:
-----------
[CWEB] Fix two bugs in CWEB macros.

Modified Paths:
--------------
    trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex	2022-06-17 17:44:16 UTC (rev 63625)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebmac.tex	2022-06-17 17:44:48 UTC (rev 63626)
@@ -1,8 +1,8 @@
 % standard macros for CWEB listings (in addition to plain.tex)
-% Version 4.8--- June 2022
+% Version 4.8 --- June 2022
 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
 \xdef\fmtversion{\fmtversion+CWEB4.8}
-\chardef\cwebversion=4 \chardef\cwebrevision=7
+\chardef\cwebversion=4 \chardef\cwebrevision=8
 \newif\ifpdf
 \ifx\pdf+\pdftrue\fi
 % Uncomment the following line if you want PDF goodies to be the default
@@ -135,7 +135,7 @@
 \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
 \newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
 \newcount\countA \countA=0 \newcount\countB \countB=0
-\newcount\countC \countC=0
+\newcount\countC \countC=0 \newcount\countD \countD=0
 \newif\iftokprocessed \newif\ifTnum \newif\ifinstr
 {\def\\{\global\let\spacechar= }\\ }
 
@@ -145,7 +145,7 @@
 \def\thedepth{\the\dp\strutbox\space}
 \ifpdftex
   \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
-  \def\pdflink#1#2{\hbox{\pdfannotlink height\ht\strutbox depth\dp\strutbox
+  \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth
     attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}} % changed 3.69
 \else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
     \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
@@ -294,12 +294,12 @@
 \def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
 \fi % End of common macros
 
-\def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox
+\def\pdfURL#1#2{\ifpdftex\pdfannotlink height \theheight depth \thedepth
   attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A
       << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69
   \else \ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
-    \special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight
-      \space depth \thedepth\space << /Border [0 0 0]
+    \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
+      depth \thedepth << /Border [0 0 0]
       /Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}%
   \else #1 ({\tt#2})\fi\fi}
 {\catcode`\~=12 \gdef\TILDE/{~}} % ~ in a URL
@@ -354,9 +354,9 @@
    {\noexpand\the\pageno}{\the\toksE}}}\next % \ZZ{title}{depth}{sec}{page}{ss}
   \ifpdftex\expandafter\xdef\csname curr#1\endcsname{\secno}
     \ifnum#1>0\countB=#1 \advance\countB by-1
-      \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi\fi
-  \ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
-    [ @thispage /FitH @ypos ] >>}\fi
+      \advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi
+  \else \ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
+    [ @thispage /FitH @ypos ] >>}\fi\fi
   \ifon\startsection{\bf#3.\quad}\ignorespaces}
 \def\MN#1{\par % common code for \M, \N
   {\xdef\secstar{#1}\let\*=\empty\xdef\secno{#1}}% remove \* from section name
@@ -495,7 +495,7 @@
 \def\fin{\par\vfill\eject % this is done when we are ending the index
   \ifpagesaved\null\vfill\eject\fi % output a null index column
   \if L\lr\else\null\vfill\eject\fi % finish the current page
-  \ifpdftex \makebookmarks \fi % added in Version 3.68
+  \ifpdftex \makebookmarks \countsections \fi % added in Version 3.68 and 4.9
   \parfillskip 0pt plus 1fil
   \def\grouptitle{NAMES OF THE SECTIONS}
   \let\topsecno=\nullsec
@@ -511,7 +511,7 @@
   \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X
 %  \ifpdftex \makebookmarks \pdfdest name {NOS} fitb % in versions < 3.68
   \ifpdftex \pdfdest name {NOS} fith % changed in version 3.69
-    \pdfoutline goto name {NOS} count -\secno {\outsecname}
+    \pdfoutline goto name {NOS} count -\the\countD {\outsecname}
     \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
       {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
       \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
@@ -524,6 +524,10 @@
   \fi\fi
   \readsections}
 \def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
+\def\countsections{\message{Number of named sections:}
+  {\def\I{\global\advance\countD by 1}\def\X##1\X{\relax}
+  \def\Q##1.{\relax}\def\Qs##1.{\relax}\def\U##1.{\relax}\def\Us##1.{\relax}
+  \readsections\relax}\message{\the\countD}}
 \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
   \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
 \def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1



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