diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2024-08-10 12:27:58 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2024-08-10 12:27:58 +0000 |
commit | 800b73331c8e704a3bfa45b35bb423f63e71e808 (patch) | |
tree | 9e6223c5044d5d3c23b2f216ecdd1bdc5ab28395 /Master | |
parent | 80ffbeee215b6feda13c9a8c2f6d229c6d5815b4 (diff) |
[CWEB] Update PDF/HINT macros.
git-svn-id: svn://tug.org/texlive/trunk@72005 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/plain/cweb/cwebacromac.tex | 104 | ||||
-rw-r--r-- | Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex | 12 | ||||
-rw-r--r-- | Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex | 74 | ||||
-rw-r--r-- | Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex | 55 | ||||
-rw-r--r-- | Master/texmf-dist/tex/plain/cweb/cwebmac.tex | 63 |
5 files changed, 152 insertions, 156 deletions
diff --git a/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex b/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex index f8462d06a37..3e8baad77c1 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex @@ -1,6 +1,8 @@ % hypertext macros for CWEB listings (in addition to cwebmac.tex) -% Version 2.0 --- May 2024 +% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex +% Version 3.0 --- August 2024 \ifx\ifacrohint\undefined\endinput\fi % these are not standalone macros + \ifluatex % LuaTeX is almost like pdfTeX \protected\def\pdfliteral {\pdfextension literal} \protected\def\pdfstartlink {\pdfextension startlink\space} @@ -15,7 +17,6 @@ \let\pdfoutput=\outputmode \fi % end of LuaTeX->pdfTeX redirection macros -% Used in cwebmac.tex, pdfctwimac.tex, pdfproofmac.tex \def\tocpages{1} % Most programs have one-page Table-of-Contents \def\startpdf{\def\pagemode{/PageMode /UseOutlines} \ifnum\contentspagenumber=0 \advance \pageno by -\tocpages @@ -24,9 +25,53 @@ \else \twodigits=\pageno \pageno=\contentspagenumber \advance \pageno by \tocpages \advance \twodigits by -\pageno \def\pagelabels{/PageLabels << /Nums [ 0 << /S/D/St \the\pageno >> - \the\twodigits << /S/D/St \contentspagenumber >> ] >>} \fi + \the\twodigits << /S/D/St \contentspagenumber >> ] >>} + \fi \ifpdflua\pdfcatalog{\pagemode\space\pagelabels} - \else \special{pdf: docview << \pagemode\space\pagelabels >>}\fi} + \else\special{pdf: docview << \pagemode\space\pagelabels >>}\fi} +\ifacrohint\def\digits{\pdflink{\the\countA}\scan} +\else\def\digits{{\the\countA}\scan}\fi +\def\scan#1{\begingroup + \ifx!#1% exit on exclamation point + \else\ifx,#1,\space\aftergroup\scan % insert ,\space}\scan ... + \else\ifx\[#1\aftergroup#1% insert }\[... + \else\ifx\*#1\aftergroup\lapstar\aftergroup\scan % insert }\lapstar\scan ... + \else\ifnum`#1>`9#1\aftergroup\scan % insert #1}\scan ... + \else\ifnum`#1<`0#1\aftergroup\scan % insert #1}\scan ... + \else + \afterassignment\digits \aftergroup\countA + \aftergroup#1% insert }\countA=#1...\digits ... + \fi\fi\fi\fi\fi \fi + \endgroup} + +% Local variables; there are a few externals like '\toksA' and '\countA' +\newtoks\toksB \newtoks\toksC \newtoks\toksD \newtoks\toksF \newtoks\sanitizer +\newif\iftokprocessed \newif\ifTnum \newif\ifinstr \newif\ifhavenum + +\ifacrohint % Common macros for \ifacro and \ifhint to create \pdflink's +\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} +\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% + \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\let\space\empty + \toksC={}\toksD={}}\makenote}\maketoks}} +\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} +\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}% + \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi} +\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% + \let\next=\maketoks % continue processing by default + \ifnum\countB>`9 \countB=0 \fi + \ifnum\countB<`0 + \ifhavenum\makenote\fi + \ifx\first.\let\next=\maketoksdone % fullstop + \else \addtokens\toksB{\the\toksD} \ifx\first,\addtokens\toksB{\space}\fi + \fi + \else \addtokens\toksC{\the\toksD}\global\havenumtrue + \fi + \next +} +\def\makenote{\addtokens\toksB + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\havenumfalse} +\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\fi % End of common pdf/hint macros \ifacro % The following are general pdf macros \def\thewidth{\the\wd0 \space} @@ -34,13 +79,14 @@ \def\thedepth{\the\dp\strutbox\space} \ifpdflua \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 - \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth + \def\pdflink#1{\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}% +\else\def\pdflink#1{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight - depth \thedepth << /Type /Annot /Subtype /Link - /Border [0 0 0] /A << /S /GoTo /D (#2) >> >>}\box0\relax}\fi -\def\sanitizecommand#1#2{\addtokens\usersanitizer + depth \thedepth << /Type /Annot /Subtype /Link /Border [0 0 0] + /A << /S /GoTo /D (\romannumeral#1) >> >>}\box0\relax} +\fi +\def\sanitizecommand#1#2{\addtokens\sanitizer {\noexpand\dosanitizecommand\noexpand#1{#2}}} \def\dosanitizecommand#1#2{\ifx\nxt#1\addF{#2}\fi} @@ -49,7 +95,8 @@ \catcode`\[=12 \catcode`\]=12 \catcode`\{=1 \catcode`\}=2 \catcode`\~=12 \def\tildechar{~} \catcode`\~=13 \catcode`\|=0 |catcode`|\=12 |def|bschar{\} |catcode`|\=0 \catcode`\|=12 -\def\makeoutlinetoks{\Tnumfalse\afterassignment\makeolproctok\let\nxt= } +\def\makeoutlinetoks{\toksF={}\Tnumfalse + \afterassignment\makeolproctok\let\nxt= } \def\makeolnexttok{\afterassignment\makeolproctok\let\nxt= } \def\makeolgobbletok{\afterassignment\makeolnexttok\let\nxt= } \def\addF#1{\addtokens\toksF{#1}\tokprocessedtrue} @@ -64,7 +111,7 @@ \else\if\noexpand\nxt\relax % we have a control sequence; is it one we know? \ifx\nxt~\addF\space \else\ifx\nxt\onespace\addF\space - \else\the\usersanitizer + \else\the\sanitizer \iftokprocessed\else\makeolproctokctli \iftokprocessed\else\makeolproctokctlii \iftokprocessed\else\makeolproctokctliii % if not recognised, skip it @@ -141,48 +188,19 @@ \fi\fi\fi\fi\fi } \def\outlinedone{\edef\outlinest{\global\noexpand\toksE={\the\toksF}}% - \outlinest\let\outlinedone=\relax} + \outlinest\let\outlinedone=\relax\outlinedone} \fi % End of pdf macros \ifhint -% The following uses HINT primitives to implement: +% The following top level macros use HINT primitives to implement: % \HINThome to mark the position of the home page % \HINTlabel to attach a label to the top of a section % \HINTlink to link a section number to the section label % \HINTcontents to produce an 'outline' item -% These are the top level HINT macros that are used in this file -% No HINT primitives are used directly. \def\HINThome{\HINTdest name {HINT.home}% \HINToutline goto name {HINT.home} depth 1 {Table of Contents}} \def\HINTlabel{{\let\*=\empty\HINTdest num \secstar top}} -\def\HINTlink#1#2{\HINTstartlink goto num #1 {#1}\HINTendlink}% #2 not used ??? +\def\HINTlink#1{\HINTstartlink goto num #1 {#1}\HINTendlink} \def\HINTcontents#1#2#3{\HINToutline goto num #3 depth #2 {#1}} \let\pdflink=\HINTlink \fi % End of HINT macros - -% Common macros for \ifacro and \ifhint -\ifacrohint -\def\pdfnote#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}\maketoks}\the\toksA} -\def\firstsecno#1.{\setbox0=\hbox{\toksA={#1.}\toksB={}% - \def\makenote{\addtokens\toksB{\the\toksC}\def\makenote{\toksD={} - \toksC={}\let\space\empty}\makenote}\maketoks}} -\def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} -\def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}% - \ifcat\noexpand\first0\countB=`#1\else\countB=0\fi\toksA={#2}} -\def\maketoks{\expandafter\poptoks\the\toksA|ENDTOKS|% - \ifnum\countB>`9 \countB=0 \fi - \ifnum\countB<`0 - \ifnum0=\countC\else\makenote\fi - \ifx\first.\let\next=\maketoksdone\else - \let\next=\maketoks - \addtokens\toksB{\the\toksD} - \ifx\first,\addtokens\toksB{\space}\fi - \fi - \else \addtokens\toksC{\the\toksD}\global\countC=1\let\next=\maketoks - \fi - \next -} -\def\makenote{\addtokens\toksB - {\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0} -\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} -\fi % End of common macros diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex index 5f2e7d3a45a..21b3d356056 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex @@ -73,7 +73,7 @@ \def\inx{\par\vskip6pt plus 1fil % we are beginning the index \def\page{\box255 } \normalbottom \write\cont{} % ensure that the contents file isn't empty - \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother + \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother \closeout\cont % the contents information has been fully gathered \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi \global\setbox\sbox=\page \global\pagesavedtrue \mark{\topmark}} @@ -82,9 +82,7 @@ \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height \hsize=.5\pagewidth \advance\hsize by -10pt % column width for the index (20pt between cols) - \ifhint\else - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \fi + \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines \def\lr{L} % this tells whether the left or right column is next \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} \else\normaloutput{\vbox to\pageheight{\box\sbox\vss @@ -93,9 +91,9 @@ \message{Indice Analitico:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacrohint\pdfnote##2.\else##2\fi.} % index entry - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \scan##2!.} % index entry + \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \hyphenpenalty 10000 \parindent0pt \readindex} \def\fin{\par\vfill\eject % this is done when we are ending the index diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex index f41ad4d6334..8afc8e654c7 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex @@ -14,15 +14,6 @@ \font\ninerm=cmr9 \let\mc=\ninerm % medium caps -\def\CEE/{{\mc C\spacefactor1000}} -\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} -\def\TEX/{\TeX} -\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} -\def\Cee{\CEE/} % for backward compatibility -\def\Cpp{\CPLUSPLUS/} % for backward compatibility -\def\9#1{} - % with this definition of \9 you can say @:sort key}{TeX code@> - % to alphabetize an index entry by the sort key but format with the TeX code \font\eightrm=cmr8 \let\sc=\eightrm % small caps (NOT a caps-and-small-caps font) \let\mainfont=\tenrm @@ -33,6 +24,16 @@ \font\tentex=cmtex10 % TeX extended character set (used in strings) \fontdimen7\tentex=0pt % no double space after sentences +\def\CEE/{{\mc C\spacefactor1000}} +\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} +\def\TEX/{\TeX} +\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} +\def\Cee{\CEE/} % for backward compatibility +\def\Cpp{\CPLUSPLUS/} % for backward compatibility +\def\9#1{} + % with this definition of \9 you can say @:sort key}{TeX code@> + % to alphabetize an index entry by the sort key but format with the TeX code + \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way \def\{\leavevmode\hbox{\bf @@ -116,11 +117,9 @@ \def\note#1#2.{\Y\noindent{\hangindent2em% \baselineskip10pt\eightrm#1~\ifacrohint{\pdfnote#2.}\else#2\fi.\par}} -\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD -\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer +\newtoks\toksA \newtoks\toksE \newcount\countA \countA=0 \newcount\countB \countB=0 -\newcount\countC \countC=0 \newcount\countD \countD=0 -\newif\iftokprocessed \newif\ifTnum \newif\ifinstr +\newcount\countNOS \countNOS=0 {\def\\{\global\let\spacechar= }\\ } % Here we decide the output format, depending on the TeX engine in use: @@ -137,7 +136,7 @@ \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\ifacrohint \input cwebacromac \fi % load hypertext macros +\input cwebacromac % load hypertext macros \def\pdfURL#1#2{\ifpdf \ifpdflua\pdfannotlink height \theheight depth \thedepth attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 @@ -187,7 +186,7 @@ \outer\def\M#1{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section \vskip\intersecskip\startsection\ignorespaces} \outer\def\N#1#2#3.{% beginning of starred section - \ifpdf{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi + \ifpdf{\makeoutlinetoks#3\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small \else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi @@ -327,18 +326,16 @@ \newbox\lbox % lefthand column in the index \def\inx{\par\vskip6pt plus 1fil % we are beginning the index \write\cont{} % ensure that the contents file isn't empty - \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother + \write\cont{\catcode `\noexpand\@=12\relax} % \makeatother \closeout\cont % the contents information has been fully gathered \output{\ifpagesaved\normaloutput{\box\sbox}\lheader\rheader\fi - \global\setbox\sbox=\page \global\pagesavedtrue} + \global\setbox\sbox=\page \global\pagesavedtrue \mark{\topmark}} \pagesavedfalse \eject % eject the page-so-far and predecessors \setbox\sbox\vbox{\unvbox\sbox} % take it out of its box \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height \hsize=.5\pagewidth \advance\hsize by -10pt % column width for the index (20pt between cols) - \ifhint\else - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \fi + \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines \def\lr{L} % this tells whether the left or right column is next \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} \else\normaloutput{\vbox to\pageheight{\box\sbox\vss @@ -347,9 +344,9 @@ \message{Index:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacrohint\pdfnote##2.\else##2\fi.} % index entry - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \scan##2!.} % index entry + \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \hyphenpenalty 10000 \parindent0pt \readindex} \def\fin{\par\vfill\eject % this is done when we are ending the index @@ -370,23 +367,21 @@ \def\I{\par\hangindent 2em}\let\*=* \ifpdf \def\outsecname{Names of the sections} \let\Xpdf\X \ifpdflua \pdfdest name {NOS} fith - \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}} + \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname} \else \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi\fi + /Dest [ @thispage /FitH @ypos ] >>}\fi + \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% + {\makeoutlinetoks##2\outlinedone}% + \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE} + \else \special{pdf: outline 0 << /Title (\the\toksE) + /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi} + \fi % \ifacro \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\I{\global\advance\countNOS 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}} + \readsections\relax}\message{\the\countNOS}} \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 @@ -412,17 +407,14 @@ \line{\consetup{#2}#1 \rm\leaders\hbox to .5em{.\hfil}\hfil \ \ifhint - \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT + \HINTlink{#3}% No page numbers in HINT \HINTcontents{#1}{#2}{#3}% - \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi + \else\ifacro\pdflink{#3}\else#3\fi \hbox to3em{\hss#4}\fi}} \def\consetup#1{\ifcase#1 \bf % depth -1 (@**) \or % depth 0 (@*) \or \hskip2em % depth 1 (@*1) - \or \hskip4em % depth 2 (@*2) - \or \hskip6em % depth 3 (@*3) - \or \hskip8em % depth 4 (@*4) - \or \hskip10em % depth 5 (@*5) + \or \hskip4em \or \hskip6em \or \hskip8em \or \hskip10em % depth 2,3,4,5 \else \hskip12em \fi} % depth 6 or more \def\noinx{\let\inx=\end} % no indexes or table of contents \def\nosecs{\let\FIN=\fin \def\fin{\let\parfillskip=\end \FIN}} diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex index 2a0499949e6..0685bfc8fc7 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex @@ -26,15 +26,6 @@ \font\ninerm=cmr9 \let\mc=\ninerm % medium caps -\def\CEE/{{\mc C\spacefactor1000}} -\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} -\def\TEX/{\TeX} -\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} -\def\Cee{\CEE/} % for backward compatibility -\def\Cpp{\CPLUSPLUS/} % for backward compatibility -\def\9#1{} - % with this definition of \9 you can say @:sort key}{TeX code@> - % to alphabetize an index entry by the sort key but format with the TeX code \font\eightrm=cmr8 \font\sixrm=cmr6 \font\ninei=cmmi9 @@ -146,6 +137,16 @@ \font\titlefont=cmr7 scaled\magstep4 % title on the contents page \font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title +\def\CEE/{{\mc C\spacefactor1000}} +\def\UNIX/{{\mc U\kern-.05emNIX\spacefactor1000}} +\def\TEX/{\TeX} +\def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} +\def\Cee{\CEE/} % for backward compatibility +\def\Cpp{\CPLUSPLUS/} % for backward compatibility +\def\9#1{} + % with this definition of \9 you can say @:sort key}{TeX code@> + % to alphabetize an index entry by the sort key but format with the TeX code + \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way \def\{\leavevmode\hbox{\bf @@ -228,11 +229,9 @@ \Y\noindent{\hangindent2\em\baselineskip10pt% \eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}} -\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD -\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer +\newtoks\toksA \newtoks\toksE \newcount\countA \countA=0 \newcount\countB \countB=0 -\newcount\countC \countC=0 \newcount\countD \countD=0 -\newif\iftokprocessed \newif\ifTnum \newif\ifinstr +\newcount\countNOS \countNOS=0 {\def\\{\global\let\spacechar= }\\ } % Here we decide the output format, depending on the TeX engine in use: @@ -253,7 +252,7 @@ \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\ifacrohint \input cwebacromac \fi % load hypertext macros +\input cwebacromac % load hypertext macros \def\lapstar{\rlap{*}} \def\stsec{\tenpoint\rightskip=0pt % get out of C mode (cf. \B) @@ -301,7 +300,7 @@ \outer\def\NN{\ifvoid\partialpage\leftfalse \else\ifdim\ht\partialpage<\pageht \lefttrue\else\leftfalse\fi\fi\NNN} \outer\def\NNN#1#2#3.{% beginning of starred section - \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi + \ifacro{\makeoutlinetoks#3\outlinedone}\fi \gdepth=#1\gtitle={#3}\def\secno{#2}\xdef\secstar{#2} \ifleft \flushout \gdef\rlhead{\let\i=I\uppercase{\ignorespaces#3}} % running left headline @@ -334,7 +333,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 @@ -543,22 +542,20 @@ \def\outsecname{Names of the sections} \ifpdflua \makebookmarks \countsections \pdfdest name {NOS} fith - \pdfoutline goto name {NOS} count -\the\countD {\outsecname} - \def\X##1:##2\X{\firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \pdfoutline goto num \the\toksA \expandafter{\the\toksE}} + \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname} \else \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi \readsections \fi} + /Dest [ @thispage /FitH @ypos ] >>}\fi + \def\X##1:##2\X{\firstsecno##1.% + {\makeoutlinetoks##2\outlinedone}% + \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE} + \else \special{pdf: outline 0 << /Title (\the\toksE) + /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi} + \readsections \fi} \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\I{\global\advance\countNOS 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}} + \readsections\relax}\message{\the\countNOS}} \def\writebookmarkline#1#2#3#4#5{{% \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let \pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}}} @@ -579,7 +576,7 @@ %\def\contentsline#1#2#3#4#5{\ifnum#2=0 \smallbreak\fi %\line{\consetup{#2}#1 %\rm\leaders\hbox to .5em{.\hfil}\hfil - %\ \ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi\hbox to3em{\hss#4}}} + %\ \ifacro\pdflink{#3}\else#3\fi\hbox to3em{\hss#4}}} %\def\consetup#1{\ifcase#1 \bf % depth -1 (@**) %\or % depth 0 (@*) %\or \hskip2em % depth 1 (@*1) diff --git a/Master/texmf-dist/tex/plain/cweb/cwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebmac.tex index f9891daf1bc..a46dc4b782f 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebmac.tex @@ -1,12 +1,9 @@ % standard macros for CWEB listings (in addition to plain.tex) -% Version 4.12 --- July 2024 +% Version 4.12 --- August 2024 \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros \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) - \parskip 0pt % no stretch between paragraphs \parindent 1em % for paragraphs and for the first line of C text @@ -28,9 +25,10 @@ \def\CPLUSPLUS/{{\mc C\PP\spacefactor1000}} \def\Cee{\CEE/} % for backward compatibility \def\Cpp{\CPLUSPLUS/} % for backward compatibility -\def\9#1{} - % with this definition of \9 you can say @:sort key}{TeX code@> - % to alphabetize an index entry by the sort key but format with the TeX code +\def\9#1{} % with this definition of \9 you can say @:sort key}{TeX code@> + % to alphabetize an index entry by the sort key but format with the TeX code +\let\:=\. % preserve a way to get the dot accent + % (all other accents will still work as usual) \def\\#1{\leavevmode\hbox{\it#1\/\kern.05em}} % italic type for identifiers \def\|#1{\leavevmode\hbox{$#1$}} % one-letter identifiers look better this way @@ -114,11 +112,9 @@ \def\?{\mathrel?} \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} -\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD -\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer +\newtoks\toksA \newtoks\toksE \newcount\countA \countA=0 \newcount\countB \countB=0 -\newcount\countC \countC=0 \newcount\countD \countD=0 -\newif\iftokprocessed \newif\ifTnum \newif\ifinstr +\newcount\countNOS \countNOS=0 {\def\\{\global\let\spacechar= }\\ } % Here we decide the output format, depending on the TeX engine in use: @@ -135,7 +131,7 @@ \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\ifacrohint \input cwebacromac \fi % load hypertext macros +\input cwebacromac % load hypertext macros \def\pdfURL#1#2{\ifpdf \ifpdflua\pdfannotlink height \theheight depth \thedepth attr {/Border [0 0 0]} user { /Type /Annot /Subtype /Link /A << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69 @@ -187,7 +183,7 @@ \outer\def\M#1{\MN{#1}\ifon\vfil\penalty-100\vfilneg % beginning of section \vskip\intersecskip\startsection\ignorespaces} \outer\def\N#1#2#3.{% beginning of starred section - \ifacro{\toksF={}\makeoutlinetoks#3\outlinedone\outlinedone}\fi + \ifacro{\makeoutlinetoks#3\outlinedone}\fi \gdepth=#1\gtitle={#3}\MN{#2}% \ifon\ifnum#1<\secpagedepth \vfil\eject % force page break if depth is small \else\vfil\penalty-100\vfilneg\vskip\intersecskip\fi\fi @@ -241,9 +237,8 @@ \def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}} % CWEB style \def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style \def\bin{\hbox{$^{\scriptscriptstyle b}$\tt\aftergroup}} % new in CWEB 4.3 -\def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule - \hbox{\strut\kern2pt\.{#1}\kern2pt}} - \hrule}\vrule\kern2pt}} % verbatim string +\def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule\hbox{\strut + \kern2pt\.{#1}\kern2pt}}\hrule}\vrule\kern2pt}} % verbatim string \def\p#1{\cdot 2^{#1}} % power of two (hex exponent) \def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue @@ -318,9 +313,7 @@ \vsize=\pageheight \advance\vsize by -\ht\sbox % the remaining height \hsize=.5\pagewidth \advance\hsize by -10pt % column width for the index (20pt between cols) - \ifhint\else - \parfillskip 0pt plus .6\hsize % try to avoid almost empty lines - \fi + \ifhint\else\parfillskip 0pt plus .6\hsize\fi % avoid almost empty lines \def\lr{L} % this tells whether the left or right column is next \output{\if L\lr\global\setbox\lbox=\page \gdef\lr{R} \else\normaloutput{\vbox to\pageheight{\box\sbox\vss @@ -329,9 +322,9 @@ \message{Index:} \parskip 0pt plus .5pt \outer\def\I##1, ##2.{\par\hangindent2em\noindent##1:\kern1em - \ifacrohint\pdfnote##2.\else##2\fi.} % index entry - \def\[##1]{$\underline{##1}$} % underlined index item - \rm \rightskip0pt plus 2.5em \tolerance 10000 \let\*=\lapstar + \scan##2!.} % index entry + \def\[##1]{$\underline{\scan##1!}$\scan} % underlined index item + \rm \rightskip0pt plus 2.5em \tolerance 10000 \hyphenpenalty 10000 \parindent0pt \readindex} \def\fin{\par\vfill\eject % this is done when we are ending the index @@ -354,23 +347,21 @@ \ifacro \def\outsecname{Names of the sections} \let\Xpdf\X % \ifpdflua \makebookmarks \pdfdest name {NOS} fitb % in versions < 3.68 \ifpdflua \pdfdest name {NOS} fith % changed in version 3.69 - \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}} + \pdfoutline goto name {NOS} count -\the\countNOS {\outsecname} \else \special{pdf: outline -1 << /Title (\outsecname) - /Dest [ @thispage /FitH @ypos ] >>} - \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% - {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% - \special{pdf: outline 0 << /Title (\the\toksE) - /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} - \fi\fi + /Dest [ @thispage /FitH @ypos ] >>}\fi + \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% + {\makeoutlinetoks##2\outlinedone}% + \ifpdflua \pdfoutline goto num \the\toksA \expandafter{\the\toksE} + \else \special{pdf: outline 0 << /Title (\the\toksE) + /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}\fi} + \fi % \ifacro \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\I{\global\advance\countNOS 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}} + \readsections\relax}\message{\the\countNOS}} \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 @@ -396,9 +387,9 @@ \line{\consetup{#2}#1 \rm\leaders\hbox to .5em{.\hfil}\hfil \ \ifhint - \HINTlink{#3}{\romannumeral#3}% No page numbers in HINT + \HINTlink{#3}% No page numbers in HINT \HINTcontents{#1}{#2}{#3}% - \else\ifacro\pdflink{#3}{\romannumeral#3}\else#3\fi + \else\ifacro\pdflink{#3}\else#3\fi \hbox to3em{\hss#4}\fi}} \def\consetup#1{\ifcase#1 \bf % depth -1 (@**) \or % depth 0 (@*) |