diff options
author | Karl Berry <karl@freefriends.org> | 2023-10-01 20:09:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-10-01 20:09:39 +0000 |
commit | b074876c74b4a7c72764cbf1205141d96b3de6fe (patch) | |
tree | 8bd1d763d4bbdb9d38824fab5fb2dc5aac945c6a /Master | |
parent | fad7cf291919646cb0a7fc0ba5712a1c8775a7b2 (diff) |
pwebmac (1oct23)
git-svn-id: svn://tug.org/texlive/trunk@68419 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/plain/pwebmac/README.md | 24 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/pwebmac/index.md | 5 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/pwebmac/makeall | 55 | ||||
-rw-r--r-- | Master/texmf-dist/doc/plain/pwebmac/webman.ch | 22 | ||||
-rw-r--r-- | Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex | 45 |
5 files changed, 93 insertions, 58 deletions
diff --git a/Master/texmf-dist/doc/plain/pwebmac/README.md b/Master/texmf-dist/doc/plain/pwebmac/README.md index 7468ba8092a..a5288c99f61 100644 --- a/Master/texmf-dist/doc/plain/pwebmac/README.md +++ b/Master/texmf-dist/doc/plain/pwebmac/README.md @@ -1,4 +1,4 @@ -# pwebmac – Consolidated WEB macros for DVI and PDF output +# pwebmac – Consolidated WEB macros for DVI, PDF, and HINT output The original [WEB](https://ctan.org/pkg/web) system by Donald Knuth has the macros `webmac.tex` that produce DVI output only; for historic reasons, it @@ -12,26 +12,28 @@ output; all these macros can only be used with a specific “TeX engine” each. The present `pwebmac` package integrates these three WEB macro files similar to `cwebmac.tex` in Silvio Levy's and Don Knuth's [CWEB](https://ctan.org/pkg/cweb) system, so `pwebmac.tex` can be used with -“plain TeX,” “pdfTeX,” and “XeTeX” alike. And it adds full support for Martin -Ruckert's “[HiTeX](https://ctan.org/pkg/hitex)” engine and its `HINT` output -format. +“plain TeX,” “pdfTeX,” “LuaTeX,” and “XeTeX” alike. And it adds full support +for Martin Ruckert's “[HiTeX](https://ctan.org/pkg/hitex)” engine and its +[`HINT`](https://hint.userweb.mwn.de/hint/format.html) output format. Its initial application is the production of PDF and HINT files for all major WEB programs for “TeX and friends” as distributed in [TeX Live](https://www.tug.org/texlive). For this purpose, the shell script `makeall` was whipped together; it provides various commandline options and -works around several “quirks” in the WEB sources. The resulting collection -of PDF documents can be browsed in the `knuth-pdf` package and the collection -of HINT documents are available in the `knuth-hint` package. +works around several “quirks” in the WEB sources. The resulting collections +of PDF and HINT documents can be browsed in the +[`knuth-pdf`](https://ctan.org/pkg/knuth-pdf) and +[`knuth-hint`](https://ctan.org/pkg/knuth-hint) packages. WEB programmers who want to use `pwebmac.tex` instead of the default `webmac.tex` in their programs have to change the first line in the TeX file created by `weave`. From there, all depends on the “TeX engine” you use: “plain TeX” by default creates DVI output, “plain TeX” with the invocation -`tex "\let\pdf+\input…"`, `pdftex`, and `xetex` create PDF output with -clickable links and bookmarks (depending on your PDF viewer), and `hitex` -creates HINT output that can be viewed with the `hintview` program. +`tex "\let\pdf+\input…"`, `pdftex`, `luatex`, and `xetex` create PDF output +with clickable links and bookmarks (depending on your PDF viewer), and `hitex` +creates HINT output that can be viewed with the +[`hintview`](https://hint.userweb.mwn.de/hint/hintview.html) program. The `pwebmac` package is free software and may be used without constraints. -This is version “4.8.1” of the `pwebmac` package — 2022-06-25, Andreas Scherer. +This is version **4.9** of the `pwebmac` package — 2023-10-01, Andreas Scherer. diff --git a/Master/texmf-dist/doc/plain/pwebmac/index.md b/Master/texmf-dist/doc/plain/pwebmac/index.md index 59f6663e267..a580c752a66 100644 --- a/Master/texmf-dist/doc/plain/pwebmac/index.md +++ b/Master/texmf-dist/doc/plain/pwebmac/index.md @@ -1,5 +1,5 @@ --- -title: C/WEB programs in \TeX\ Live 2022 +title: C/WEB programs in \TeX\ Live 2023 colorlinks: true filecolor: blue urlcolor: blue @@ -86,6 +86,7 @@ directly. [`TWINX`](cweb/twinx.pdf)+[`chg`](cweb/twinx-changes.pdf) \] * `ctie/` \[ [`CTIE`](ctie/ctie.pdf)+[`chg`](ctie/ctie-changes.pdf) \] * `tie/` \[ [`TIE`](tie/tie.pdf)+[`chg`](tie/tie-changes.pdf) \] +* `hitex/` \[ [`HiTeX`](hitex/hitex.pdf) \] ## Errata for “Computers & Typesetting” by Donald E.\ Knuth @@ -107,4 +108,4 @@ directly. ## Happy C/WEB Programming! -2022-02-02 Andreas Scherer +2023-06-11 Andreas Scherer diff --git a/Master/texmf-dist/doc/plain/pwebmac/makeall b/Master/texmf-dist/doc/plain/pwebmac/makeall index 0f857db24f3..05f8178589f 100644 --- a/Master/texmf-dist/doc/plain/pwebmac/makeall +++ b/Master/texmf-dist/doc/plain/pwebmac/makeall @@ -33,7 +33,7 @@ FILESELECT=false # user-defined '--files' selection NEW=false # '\input pwebmac' instead of '\input webmac' for PDF et al. OUTDIR=. # path where the resulting tarballs are placed PDFTOCFRONT=false # push table-of-contents to front of PDF output -TEX=tex # or 'pdftex' or 'xetex' or 'hitex' +TEX=tex # or 'pdftex' or 'xetex' or 'hitex' or 'luatex' VALID=false # give 'pdftex' a chance to produce valid output # Initial list of C/WEB sources to process, overridable with option '-f': @@ -46,7 +46,7 @@ KNUTHWARE=$(dirname $KNUTHWHERE) FILES="$KNUTHWARE/*.web pdftex.web xetex.web twill" WEBINPUTS=$KNUTHWARE//: -FILES="$FILES common ctangle cweave ctwill refsort twinx ctie tie" +FILES="$FILES common ctangle cweave ctwill refsort twinx ctie tie hitex" CWEBINPUTS=$KNUTHWARE//: KNUTHWHERE=$(locate /glue.web) @@ -94,15 +94,17 @@ PDF=pdf # default extension for 'knuth-pdf' HITEX="hitex --compress" # HINT format -if [ hitex = $TEX ] +if [ hitex = "$TEX" ] then + CTWILL="$CTWILL +P" TEX="$HITEX" PDF=hnt # default extension for 'knuth-hint' + PDFTOCFRONT=false # use 'hintview -h' to start with TOC page fi # Valid PDF output from 'pdftex': In 'pwebmac.tex' set '\countD' to the actual # number of @<named modules@>, not the number of all sections. -if ( [ pdftex = $TEX ] && $VALID ) +if ( [ pdftex = "$TEX" ] && $VALID ) then TEX="$TEX --shell-escape" fi @@ -115,7 +117,10 @@ do if [ ctwill = $f ] then # apply tons of editorial changes to 'ctwill.w' - ctie -m $f.w cweave.w $f-w2c.ch $f-mini.ch + if [ "$HITEX" = "$TEX" ] + then ctie -m $f.w cweave.w $f-w2c.ch $f-hint.ch + else ctie -m $f.w cweave.w $f-w2c.ch $f-mini.ch + fi cp -an $KNUTHWARE/cwebdir/*.bux . $CTWILL $f # prime the pump $CTWILL $f # get decent answers @@ -129,6 +134,10 @@ do then weave $f # no 'glue.ch' at this time + elif [ hitex = $f ] + then + cweave $f # no 'hitex.ch' at this time + elif $CHANGES then case $f in @@ -148,6 +157,9 @@ do # TWILL is a change in and of itself twill ) ;; + # HiTeX is a stand-alone version of TeX + hitex ) ;; + # all other WEB codes have singular changefiles * ) weave $f $f ;; esac @@ -165,7 +177,7 @@ do $f.tex else case $f in - c* | refsort | twinx | tie ) $CWEAVE $f ;; + c* | refsort | twinx | tie | hitex ) $CWEAVE $f ;; * ) weave $f ;; esac fi @@ -180,6 +192,9 @@ do # do nothing for CWEB programs c* | refsort | twinx | tie ) ;; + hitex ) + $SED_I -e "s/\(\\\\def\\\\topofcontents\)/\\\\datethis\n\\\\emergencystretch=.1\\\\hsize\n\1/" $f.tex ;; + bibtex | patgen | tangle | weave ) $SED_I -e "s/\(\\\\def\\\\title\)/\\\\datecontentspage\n\1/" $f.tex ;; @@ -204,7 +219,7 @@ FI $SED_I -e "s/{\\\\the\\\\pageno}}}\\\\next/{\\\\the\\\\pageno}{\\\\the\\\\toksE}}}\\\\next/" $f.tex cat > texmf-pdf.patch << FI - \ifpdftex\relax\else + \ifpdflua\relax\else \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest [ @thispage /FitH @ypos ] >>}\fi\fi FI @@ -262,7 +277,7 @@ FI esac # shift table-of-contents pages to the front in PDF - if $PDFTOCFRONT && [ ctwill != $f ] + if $PDFTOCFRONT && [ ctwill != $f ] && [ hitex != $f ] then $SED_I -e "0,/\\\\N[1{]/s/\(\\\\N[1{]\)/\\\\input pdfwebtocfront\n\n\1/" \ $f.tex @@ -279,19 +294,20 @@ FI fi fi - # only XeTeX can process XETEX.WEB - if [ xetex = $f ] + if [ xetex = $f ] # only XeTeX can process XETEX.WEB then $f $f - elif [ ctwill = $f ] + elif [ ctwill = $f ] # gives two different outcomes then + # sort mini-indexes if [ "$HITEX" = "$TEX" ] - then CTWILLTEX=pdftex - else CTWILLTEX="$TEX" + then # directly in the TeX file + proofsort $f.tex > $f-sorted.tex + mv $f-sorted.tex $f.tex + else # in the TeX-created .ref file + $TEX $f + ctwill-refsort < $f.ref > $f.sref fi - $CTWILLTEX $f - # sort mini-indexes - ctwill-refsort < $f.ref > $f.sref - $CTWILLTEX $f + $TEX $f elif [ refsort = $f ] then $TEX -interaction nonstopmode $f else $TEX $f @@ -406,13 +422,14 @@ then $PAX "$OUTDIR/bibtex.tar.gz" -s ,^,bibtex/, bibtex.$PDF $PAX "$OUTDIR/other.tar.gz" -s ,^,other/, \ dvicopy.$PDF patgen.$PDF pktogf.$PDF pktype.$PDF + $PAX "$OUTDIR/hitex.tar.gz" -s ,^,hitex/, hitex.$PDF $PAX "$OUTDIR/pdftex.tar.gz" -s ,^,pdftex/, pdftex.$PDF $PAX "$OUTDIR/xetex.tar.gz" -s ,^,xetex/, xetex.pdf $PAX "$OUTDIR/ctie.tar.gz" -s ,^,ctie/, ctie.$PDF $PAX "$OUTDIR/tie.tar.gz" -s ,^,tie/, tie.$PDF $PAX "$OUTDIR/cweb.tar.gz" -s ,^,cweb/, \ cwebman.$PDF common.$PDF ctangle.$PDF cweave.$PDF \ - ctwill.pdf refsort.$PDF twinx.$PDF + ctwill.$PDF refsort.$PDF twinx.$PDF fi # Notes to self: @@ -420,7 +437,7 @@ then # (a) pandoc index.md -o index.pdf # (b) pandoc index.md -o index.tex; # pandoc index.tex -s -o index.html \ - # --metadata title="C/WEB programs in TeX Live 2022"; + # --metadata title="C/WEB programs in TeX Live 2023"; # rm index.tex # (2) Prepare a super-tarball from all the contents of these # individual tarballs (42/53 and 34/54) with either of diff --git a/Master/texmf-dist/doc/plain/pwebmac/webman.ch b/Master/texmf-dist/doc/plain/pwebmac/webman.ch index e781ee01dc3..1663836f422 100644 --- a/Master/texmf-dist/doc/plain/pwebmac/webman.ch +++ b/Master/texmf-dist/doc/plain/pwebmac/webman.ch @@ -5,7 +5,7 @@ \ifpdf \pdfpagewidth=\pagewidth \advance\pdfpagewidth by 2cm \pdfpageheight=\pageheight \advance\pdfpageheight by 3cm - \ifpdftex \pdfhorigin=1cm \pdfvorigin=1cm + \ifpdflua \pdfhorigin=1cm \pdfvorigin=1cm \else \advance\pdfpageheight by 1cm \global\pageshift=-1.54cm \global\hoffset=-1.54cm \global\voffset=-1.54cm \fi \else\pageno=1\fi @@ -20,11 +20,11 @@ \def\bkminfo{} \outer\def\section #1.{\penalty-50\vskip 12pt plus 3pt minus 3pt \noindent\ifpdf\vbox to 0pt{\kern-2.5ex\relax - \ifpdftex\pdfdest num \destcount fitbh\relax + \ifpdflua\pdfdest num \destcount fitbh\relax \else\special{pdf: dest (\the\destcount) [ @thispage /FitBH @ypos ]}\fi \def\.##1{##1}% \ifx\bkminfo\empty\def\sectitle{#1}\else\def\sectitle{#1 (\bkminfo)}\fi - \ifpdftex\pdfoutline goto num \destcount {\sectitle}\relax + \ifpdflua\pdfoutline goto num \destcount {\sectitle}\relax \else\special{pdf: outline 0 << /Title (\sectitle) /A << /S /GoTo /D (\the\destcount) >> >>}\fi \gdef\bkminfo{}% @@ -32,20 +32,20 @@ \kern2.5ex\relax }\fi{\bf #1.}\quad\ignorespaces} -\def\appA{7} -\def\appB{8} -\def\appC{9} +\def\appA{8} +\def\appB{9} +\def\appC{10} \def\appD{0} \def\appE{0} -\def\appF{10} -\def\appG{11} -\def\appH{12} +\def\appF{11} +\def\appG{12} +\def\appH{13} \def\Appendix#1{\leavevmode \ifnum\csname app#1\endcsname>0 % - \ifpdf\ifpdftex + \ifpdf\ifpdflua \pdfstartlink attr{/Border[0 0 0]} goto num\csname app#1\endcsname\relax - \PDFlinkcolor\hbox{Appendix}~#1\Black + \Blue\hbox{Appendix}~#1\Black \pdfendlink \else \setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{\hbox{Appendix}~#1}% diff --git a/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex b/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex index 3143de696bc..f7cff636289 100644 --- a/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex +++ b/Master/texmf-dist/tex/plain/pwebmac/pwebmac.tex @@ -5,18 +5,19 @@ % macro integration \`a la CWEB by Andreas Scherer <andreas_tex@freenet.de>. % This file is not copyrighted and can be used freely. \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros -\xdef\fmtversion{\fmtversion+WEBMAC4.8} +\xdef\fmtversion{\fmtversion+WEBMAC4.9} \input iftex.sty % TeX engine tests \ifx\pdf+\pdftrue\fi % Uncomment the following line if you want PDF goodies to be the default %\ifx\pdf-\else\pdftrue\fi \def\pdflinkcolor{0 0 1} % the RGB values for hyperlink color \ifxetex\pdftrue\fi % XeTeX produces PDF output -\ifpdftex % pdfTeX produces PDF output if \pdfoutput>0 +\newif\ifacrohint \ifpdf\acrohinttrue\fi \ifhint\acrohinttrue\fi +\newif\ifpdflua \ifluatex\pdfluatrue\fi \ifpdftex\pdfluatrue\fi +\ifpdflua % pdfTeX and luaTeX produce PDF output if \pdfoutput>0 \def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too - \def\PDFlinkcolor{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} + \def\Blue{\pdfliteral{\pdflinkcolor\space rg \pdflinkcolor\space RG}} \fi -\newif\ifacrohint \ifpdf\acrohinttrue\fi \ifhint\acrohinttrue\fi \parskip 0pt % no stretch between paragraphs \parindent 1em % for paragraphs and for the first line of Pascal text @@ -91,14 +92,28 @@ \newif\iftokprocessed \newif\ifTnum \newif\ifinstr {\def\\{\global\let\spacechar= }\\ } +\ifluatex % LuaTeX is almost like pdfTeX +\protected\def\pdfliteral {\pdfextension literal} +\protected\def\pdfstartlink {\pdfextension startlink\space} +\protected\def\pdfendlink {\pdfextension endlink} +\protected\def\pdfoutline {\pdfextension outline\space} +\protected\def\pdfdest {\pdfextension dest\space} +\protected\def\pdfcatalog {\pdfextension catalog} +\edef\pdfhorigin {\pdfvariable horigin} +\edef\pdfvorigin {\pdfvariable vorigin} +\let\pdfpagewidth=\pagewidth +\let\pdfpageheight=\pageheight +\let\pdfoutput=\outputmode +\fi % end of LuaTeX->pdfTeX redirection macros + \ifpdf % The following are pdf macros from 'cwebmac.tex 3.70' \def\thewidth{\the\wd0 \space} \def\theheight{\the\ht\strutbox\space} \def\thedepth{\the\dp\strutbox\space} -\ifpdftex +\ifpdflua \ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14 \def\pdflink#1#2{\hbox{\pdfannotlink height \theheight depth \thedepth - attr{/Border [0 0 0]} goto num #1 \PDFlinkcolor #1\Black\pdfendlink}} + attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}} \else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight depth \thedepth << /Type /Annot /Subtype /Link @@ -216,9 +231,9 @@ \def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} \fi % End of common macros -\def\pdfURL#1#2{\ifpdf \ifpdftex\pdfannotlink height \theheight depth \thedepth +\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) >> }\PDFlinkcolor #1\Black \pdfendlink + << /S /URI /URI (#2) >> }\Blue #1\Black \pdfendlink \else {\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}% \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight depth \thedepth << /Border [0 0 0] /Type /Annot /Subtype /Link /A @@ -233,7 +248,7 @@ \ifhint\HINTlabel\fi% Start page before section \noindent{\let\*=\lapstar\bf\modstar.\quad}% \ifpdf \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty - \ifpdftex \pdfdest num \modstar fith% + \ifpdflua \pdfdest num \modstar fith% \else \special{pdf: dest (\romannumeral\modstar) [ @thispage /FitH @ypos ]}\fi}}\fi} \let\startsection=\stsec @@ -264,8 +279,8 @@ \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}% \edef\next{\write\cont{\Z{\gtitletoks}{\modno}% write to contents file {\noexpand\the\pageno}{\the\toksE}}}\next % \Z{title}{sec}{page}{ss} - \ifpdftex\relax\else - \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest + \ifpdf \ifpdflua\relax + \else \special{pdf: outline 0 << /Title (\the\toksE) /Dest [ @thispage /FitH @ypos ] >>}\fi\fi \ifon\startsection{\bf\ignorespaces#2.\quad}\ignorespaces} \def\MN#1.{\par % common code for \M, \N @@ -323,12 +338,12 @@ \vfill#1}} % parameter #1 is the page itself \global\advance\pageno by1} -\gtitle={\.{WEB} output} % this running head is reset by starred sections +\gtitle={{\tentex WEB} output} % this running head is reset by starred sections \mark{\noexpand\nullsec{\the\gtitle}} \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 \ifpdftex\pdfcatalog{/PageMode /UseOutlines} +\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 @@ -388,7 +403,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 4.5 + \ifpdflua \makebookmarks \fi % added in Version 4.5 \parfillskip 0pt plus 1fil \def\grouptitle{NAMES OF THE SECTIONS} \let\topsecno=\nullsec @@ -401,7 +416,7 @@ \def\Us{\note{Used in sections}} % crossref for uses of a section \def\:{\par\hangindent 2em}\let\*=*\let\.=\ttentry \ifpdf \def\outsecname{Names of the sections} \let\Xpdf\X - \ifpdftex \pdfdest name {NOS} fith + \ifpdflua \pdfdest name {NOS} fith \ifnum \the\countD>0 \xdef\modno{\the\countD} \fi \pdfoutline goto name {NOS} count -\modno {\outsecname} \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% |