From b2b60d839733a3ab1e79acb1c89ecfa604a5d645 Mon Sep 17 00:00:00 2001 From: Andreas Scherer Date: Fri, 17 Jun 2022 17:44:48 +0000 Subject: [CWEB] Fix two bugs in CWEB macros. git-svn-id: svn://tug.org/texlive/trunk@63626 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/plain/cweb/cwebmac.tex | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'Master/texmf-dist/tex/plain') diff --git a/Master/texmf-dist/tex/plain/cweb/cwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebmac.tex index e2d2ecb3a24..adf4ec7f07d 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebmac.tex @@ -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 -- cgit v1.2.3