summaryrefslogtreecommitdiff
path: root/web/pwebmac
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-28 03:01:21 +0000
committerNorbert Preining <norbert@preining.info>2020-06-28 03:01:21 +0000
commitb744c27771c8d669144b77ff52439d43a5596ff2 (patch)
tree0e71e5bb43906ba61fa85acdff3fd79f5faff459 /web/pwebmac
parent62dc979b3581324476e859c5193c81c4583e2618 (diff)
CTAN sync 202006280301
Diffstat (limited to 'web/pwebmac')
-rw-r--r--web/pwebmac/README.md2
-rwxr-xr-xweb/pwebmac/makeall147
-rw-r--r--web/pwebmac/pwebmac.tex21
3 files changed, 80 insertions, 90 deletions
diff --git a/web/pwebmac/README.md b/web/pwebmac/README.md
index 538a39c557..28bfe3fe77 100644
--- a/web/pwebmac/README.md
+++ b/web/pwebmac/README.md
@@ -29,4 +29,4 @@ clickable links and bookmarks (depending on your PDF viewer).
The `pwebmac` package is free software and may be used without constraints.
-This is version “4.5.3” of the `pwebmac` package — 2020-06-17, AS.
+This is version “4.5.4” of the `pwebmac` package — 2020-06-27, AS.
diff --git a/web/pwebmac/makeall b/web/pwebmac/makeall
index a97508f416..228860f3c3 100755
--- a/web/pwebmac/makeall
+++ b/web/pwebmac/makeall
@@ -57,7 +57,21 @@ for f in \
do
f=$(basename $f .web)
- if $CHANGES
+ if [ ctwill = $f ]
+ then
+ # amend TeX Live's 'prod-twill.w' for (c)twill'ing
+ if [ ! -e prod-twill.w ]
+ then
+ tie -m prod-twill.w prod-twill.w prod-mini.ch
+ fi
+ # apply tons of editorial changes to 'ctwill.w'
+ CWEBINPUTS=.:$CWEBINPUTS \
+ ctie -m $f.w cweave.w $f-w2c.ch $f-mini.ch
+ cp -an $KNUTHWARE/cwebdir/*.bux .
+ $CTWILL $f
+ $CTWILL $f
+
+ elif $CHANGES
then
# pdftex.ch and xetex.ch for TeX Live are assembled here
WEBINPUTS=$KNUTHWARE/../../Work//:$WEBINPUTS:
@@ -66,63 +80,69 @@ do
common ) $CWEAVE $f comm-w2c ;;
ctangle ) $CWEAVE $f ctang-w2c ;;
cweave ) $CWEAVE $f cweav-w2c ;;
- ctwill ) ;; # do nothing for CTWILL
ctie ) $CWEAVE $f $f-k ;;
tie ) $CWEAVE $f $f-w2c ;;
* ) weave $f $f ;;
esac
- # only document changed modules/sections
- case $f in
- # pdfTeX and XeTeX have overlong tables-of-contents
- pdftex ) sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
- -e "s/\(\\\\pageno=3\)/\1\n\\\\def\\\\contentspagenumber{1}/" \
- $f.tex ;;
-
- # XeTeX uses '\pdfTeX' from section 114, which
- # is not changed and thus 'disappears'
- xetex ) sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse\n\\\\def\\\\pdfTeX{pdf\\\\TeX}/" \
- -e "s/\(\\\\pageno=3\)/\1\n\\\\def\\\\contentspagenumber{1}/" \
- $f.tex ;;
-
- ctwill ) ;; # do nothing for CTWILL
+ # FIX: XeTeX uses '\pdfTeX' from section 114, which
+ # is not changed and thus 'disappears'
+ if [ xetex = $f ]
+ then
+ sed -i -e "s/\(\\\\let\\\\maybe\)/\\\\def\\\\pdfTeX{pdf\\\\TeX}\n\1/" \
+ $f.tex
+ fi
- * ) sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
- $f.tex ;;
- esac
+ # only document changed modules/sections
+ sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \
+ $f.tex
else
case $f in
- common | ctangle | cweave | ctie | tie ) $CWEAVE $f ;;
- ctwill ) ;; # do nothing for CTWILL
+ c* | tie ) $CWEAVE $f ;;
+
* ) weave $f ;;
esac
fi
- # Format CTWILL in its own format
- if [ ctwill = $f ]
- then
- WEBINPUTS=/opt/github/cwebbin:$WEBINPUTS \
- tie -m $f.w cweave.w $f-w2c.ch $f-mini.ch
- cp -an /opt/github/cwebbin/*.bux .
- $CTWILL $f
- $CTWILL $f
- fi
-
- # use extended macros for TeX Live PDF documentation
if $NEW
then
+ # use extended WEB macros for TeX Live PDF documentation
sed -i -e "1 s/\\\\input webmac/\\\\input pwebmac/" $f.tex
# timestamp on table-of-contents page or the first page
case $f in
+ c* | tie ) ;; # do nothing for CWEB programs
+
bibtex | patgen | tangle | weave )
sed -i -e "s/\(\\\\def\\\\title\)/\\\\datecontentspage\n\1/" $f.tex ;;
mf | tex | pdftex | xetex )
- sed -i -e "s/\(\\\\def\\\\botofcontents\)/\\\\datethis\n\1/" $f.tex ;;
+ sed -i -e "s/\(\\\\def\\\\botofcontents\)/\\\\datethis\n\1/" $f.tex
- c* | tie ) ;; # do nothing for CWEB programs
+ # amend '\N' redefinition for PDF outlines in
+ # Metafont and TeX (also pdfTeX and XeTeX)
+ # 'pwebmac' defines headers differently
+ sed -i -e "s/\(\\\\outer\\\\def\\\\N.*{\)/\1%/" \
+ -e "s/\\\\def\\\\rhead\(.*}\)/\\\\gtitle=\1\\\\MN#1.\\\\vfill\\\\eject/" \
+ $f.tex
+
+ # active links in PDF outlines/bookmarks
+ cat > texmf-pdf.patch << FI
+ \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
+FI
+ sed -i -e "/\\\\outer\\\\def\\\\N/ {
+ r texmf-pdf.patch
+ }" $f.tex
+
+ cat > texmf-pdf.patch << FI
+ \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
+ [ @thispage /FitH @ypos ] >>}\fi
+FI
+ sed -i -e "/ \\\\edef\\\\next/ {
+ r texmf-pdf.patch
+ }" $f.tex
+ rm texmf-pdf.patch ;;
* ) sed -i -e "s/\(\\\\def\\\\botofcontents\)/%\1/" \
-e "s/ \\\\centerline{\(\\\\hsize\)/\\\\def\\\\covernote{\1/" \
@@ -137,7 +157,7 @@ do
# FIX: most of the WEB codes will be corrected.
sed -i -e "s/\\\\def\\\\titlepage{F}/\\\\titlefalse/" $f.tex
- # special treatment for individual WEB programs
+ # special treatment for individual (C)WEB programs
case $f in
# purge conflict between bibtex.web and webmac.tex
# 'E' no longer free to be active character
@@ -153,62 +173,29 @@ do
# FIX: should be fixed upstream.
tangle ) sed -i -e "s/number{123}/number{125}/" $f.tex ;;
- # amend '\N' redefinition for PDF outlines in mf.tex and
- # tex.tex (also pdftex.web and xetex.web); depends on the
- # extended 'pwebmac.tex' macros
- mf | tex | pdftex | xetex )
- if [ xetex = $f ]
- then
- # purge obsolete macros from XeTeX
- sed -i -e "/\\\\input xewebmac/d" $f.tex
- fi
- if $NEW
- then
- if [ pdftex = $f ]
- then
- # pdfTeX has a looong table-of-contents
- cat > pdftex.patch << FI
- \advance\vsize by 4\baselineskip
- \ifacro\advance\pdfpageheight by 4\baselineskip\fi
-FI
- sed -i -e "/\\\\def\\\\topofcontents.*/ {
- r pdftex.patch
- }" $f.tex
- fi
- # active links in PDF outlines/bookmarks
- cat > texmf-pdf.patch << FI
- \ifacro{\toksF={}\makeoutlinetoks{[#2] #3}\outlinedone\outlinedone}\fi
-FI
- sed -i -e "/\\\\outer\\\\def\\\\N.*/ {
- r texmf-pdf.patch
- }" $f.tex
- cat > texmf-pdf.patch << FI
- \ifpdf\special{pdf: outline 0 << /Title (\the\toksE) /Dest
- [ @thispage /FitH @ypos ] >>}\fi
-FI
- sed -i -e "/ \\\\edef\\\\next.*/ {
- r texmf-pdf.patch
- }" $f.tex
- rm texmf-pdf.patch
- fi ;;
+ # FIX: purge obsolete macros from XeTeX
+ xetex ) sed -i -e "/\\\\input xewebmac/d" $f.tex ;;
- common | ctangle | cweave | ctie | tie )
- # Use nicer format for C comments and assignment
+ # Use nicer format for C comments and assignment
+ common | ctangle | cweave | ctie | tie ) # sans ctwill
sed -i -e "1 s/\(cwebmac\)/\1\n\\\\input Xcwebmac/" \
$f.tex ;;
esac
- if $PDFTOCFRONT
+ # shift table-of-contents pages to the front in PDF
+ if $PDFTOCFRONT && [ ctwill != $f ]
then
- # shift table-of-contents pages to the front in PDF
- sed -i -e "1 s/\(webmac\)/\1\n\\\\input pdfwebtocfront/" $f.tex
+ sed -i -e "0,/\\\\N[1{]/s/\(\\\\N[1{]\)/\\\\input pdfwebtocfront\n\n\1/" \
+ $f.tex
+ # only XeTeX can process XETEX.WEB
if [ xetex = $f ]
then $f $f # run TeX twice
else $TEX $f # run TeX twice
fi
fi
+ # only XeTeX can process XETEX.WEB
if [ xetex = $f ]
then $f $f
else $TEX $f
@@ -216,6 +203,7 @@ FI
if [ ctwill = $f ]
then
+ # sort mini-indexes
ctwill-refsort < $f.ref > $f.sref
$TEX $f
fi
@@ -280,8 +268,7 @@ then
-wvzf "$OUTDIR/ctie-changes.tar.gz" -s ,^,ctie/,
pax tie-changes.pdf \
-wvzf "$OUTDIR/tie-changes.tar.gz" -s ,^,tie/,
- pax common-changes.pdf ctangle-changes.pdf \
- cweave-changes.pdf \
+ pax common-changes.pdf ctangle-changes.pdf cweave-changes.pdf \
-wvzf "$OUTDIR/cweb-changes.tar.gz" -s ,^,cweb/,
else
pax vftovp.pdf vptovf.pdf -wvzf "$OUTDIR/etc.tar.gz" -s ,^,etc/,
diff --git a/web/pwebmac/pwebmac.tex b/web/pwebmac/pwebmac.tex
index 8027e10b24..926bcd6f88 100644
--- a/web/pwebmac/pwebmac.tex
+++ b/web/pwebmac/pwebmac.tex
@@ -77,6 +77,7 @@
\def\7{\Y\6} % forced break and a little extra space
\newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections
+\newtoks\gtitle % title of current major group
\let\yskip=\smallskip
\def\to{\mathrel{.\,.}} % double dot, used only in math mode
\def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt%
@@ -202,9 +203,9 @@
\let\L=\le % less than or equal sign
\outer\def\M#1.{\MN#1.\ifon\vfil\penalty-100\vfilneg % beginning of section
\vskip\intersecskip\startsection\ignorespaces}
-\outer\def\N#1.#2.{\MN#1.\vfil\eject % beginning of starred section
+\outer\def\N#1.#2.{% beginning of starred section
\ifacro{\toksF={}\makeoutlinetoks#2\outlinedone\outlinedone}\fi
- \def\rhead{\uppercase{\ignorespaces#2}} % define running headline
+ \gtitle={#2}\MN#1.\vfil\eject % define running headline
\message{*\modno} % progress report
\edef\next{\write\cont{\Z{#2}{\modno}% write to contents file
{\noexpand\the\pageno}}}\next % \Z{title}{sec}{page}
@@ -214,7 +215,7 @@
\def\MN#1.{\par % common code for \M, \N
{\xdef\modstar{#1}\let\*=\empty\xdef\modno{#1}}% remove \* from section name
\ifx\modno\modstar \onmaybe \else\ontrue \fi
- \mark{{{\tensy x}\modno}{\rhead}}}
+ \mark{{{\tensy x}\modno}{\the\gtitle}}}
% each \mark is {section reference or null}{group title}
\def\O#1{\hbox{\rm\char'23\kern-.2em\it#1\/\kern.05em}} % octal constant
\def\P{\rightskip=0pt plus 100pt minus 10pt % go into Pascal mode
@@ -245,10 +246,12 @@
\def\onmaybe{\let\ifon=\maybe} \let\maybe=\iftrue
\newif\ifon \newif\iftitle \newif\ifpagesaved
-\def\lheader{\mainfont\the\pageno\eightrm\qquad\rhead
+\def\lheader{\mainfont\the\pageno\eightrm\qquad\grouptitle
\hfill\title\qquad\mainfont\topsecno} % top line on left-hand pages
\def\rheader{\mainfont\topsecno\eightrm\qquad\title\hfill
- \rhead\qquad\mainfont\the\pageno} % top line on right-hand pages
+ \grouptitle\qquad\mainfont\the\pageno} % top line on right-hand pages
+\def\grouptitle{\let\i=I\let\j=J\uppercase\expandafter{\expandafter
+ \taketwo\topmark}}
\def\topsecno{\expandafter\takeone\topmark}
\def\takeone#1#2{#1}
\def\taketwo#1#2{#2}
@@ -264,8 +267,8 @@
\vfill#1}} % parameter #1 is the page itself
\global\advance\pageno by1}
-\def\rhead{\.{WEB} OUTPUT} % this running head is reset by starred sections
-\mark{\noexpand\nullsec{\rhead}}
+\gtitle={\.{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
@@ -329,7 +332,7 @@
\if L\lr\else\null\vfill\eject\fi % finish the current page
\ifpdftex \makebookmarks \fi % added in Version 4.5
\parfillskip 0pt plus 1fil
- \def\rhead{NAMES OF THE SECTIONS}
+ \def\grouptitle{NAMES OF THE SECTIONS}
\let\topsecno=\nullsec
\message{Section names:}
\output={\normaloutput\page\lheader\rheader}
@@ -367,7 +370,7 @@
\setpage \output={\normaloutput\page\lheader\rheader}
\titletrue % prepare to output the table of contents
\pageno=\contentspagenumber
- \def\rhead{TABLE OF CONTENTS}
+ \def\grouptitle{TABLE OF CONTENTS}
\message{Table of contents:}
\topofcontents \startpdf
\line{\hfil Section\hbox to3em{\hss Page}}