diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2024-05-24 14:09:13 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2024-05-24 14:09:13 +0000 |
commit | d5f6cb4c054d1a3dc89822fddd3a57980f7f0dc6 (patch) | |
tree | 51e104306fcb31009677b80ec7f2efa94259aac1 /Master/texmf-dist | |
parent | e570ab7e47a94403e8d038ed2cf0ca28f802c12f (diff) |
[CWEB] Updated macros.
See https://github.com/ascherer/web/issues/25 for some context.
git-svn-id: svn://tug.org/texlive/trunk@71333 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
8 files changed, 55 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex b/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex index 4c12e413827..9782d44f498 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebacromac.tex @@ -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} diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex index 40343ff6225..09e222d3c3a 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/dcwebmac.tex @@ -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 diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex index d7e65ec7854..82d67edb1a5 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/fcwebmac.tex @@ -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 diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex index 81c425207c0..5f2e7d3a45a 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/icwebmac.tex @@ -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 diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex index 7abb58d883d..f41ad4d6334 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctproofmac.tex @@ -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 diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex index 1eb66a2db8b..2a0499949e6 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex @@ -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 diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex index e26e628b0bb..d08b0395d31 100644 --- a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex +++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex @@ -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. diff --git a/Master/texmf-dist/tex/plain/cweb/cwebmac.tex b/Master/texmf-dist/tex/plain/cweb/cwebmac.tex index a59f15b4441..99e899476ce 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.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 |