From ed81e6323e585b4e28ff24d5961e38c2e41691d3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 25 May 2020 21:19:51 +0000 Subject: pwebmac (25may20) git-svn-id: svn://tug.org/texlive/trunk@55277 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/plain/pwebmac/LICENSE | 21 ++++ Master/texmf-dist/doc/plain/pwebmac/README.md | 31 ++++++ Master/texmf-dist/doc/plain/pwebmac/makeall | 151 ++++++++++++++++++++++++++ 3 files changed, 203 insertions(+) create mode 100644 Master/texmf-dist/doc/plain/pwebmac/LICENSE create mode 100644 Master/texmf-dist/doc/plain/pwebmac/README.md create mode 100755 Master/texmf-dist/doc/plain/pwebmac/makeall (limited to 'Master/texmf-dist/doc/plain') diff --git a/Master/texmf-dist/doc/plain/pwebmac/LICENSE b/Master/texmf-dist/doc/plain/pwebmac/LICENSE new file mode 100644 index 00000000000..c8b9b87cdbb --- /dev/null +++ b/Master/texmf-dist/doc/plain/pwebmac/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Andreas Scherer + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Master/texmf-dist/doc/plain/pwebmac/README.md b/Master/texmf-dist/doc/plain/pwebmac/README.md new file mode 100644 index 00000000000..b8ac146c2ed --- /dev/null +++ b/Master/texmf-dist/doc/plain/pwebmac/README.md @@ -0,0 +1,31 @@ +# pwebmac – Consolidated WEB macros for DVI and PDF 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 +will never be modified (apart from catastrophic errors). +Hàn Thế Thành has modified these macros in his `pdfwebmac.tex` for PDF output +(only) with [pdfTeX](https://ctan.org/pkg/pdftex). +Jonathan Kew's [XeTeX](https://ctan.org/pkg/xetex) has similar macros +`xewebmac.tex` by Khaled Hosny that _modify_ `webmac.tex` for PDF output; +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. + +Its initial application is the production of PDF 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. + +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). + +The `pwebmac` package is free software and may be used and distributed +according to the MIT License as shipped with the original distribution. diff --git a/Master/texmf-dist/doc/plain/pwebmac/makeall b/Master/texmf-dist/doc/plain/pwebmac/makeall new file mode 100755 index 00000000000..22e4f4662e0 --- /dev/null +++ b/Master/texmf-dist/doc/plain/pwebmac/makeall @@ -0,0 +1,151 @@ +#!/bin/sh + +LONGOPTS=changes,new,pdftocfront,tex: +SHRTOPTS=cnpt: + +CHANGES=false +NEW=false +PDFTOCFRONT=false +TEX=tex + +getopt -T >/dev/null + +if [ $? -eq 4 ] # Check for Linux-getopt with extensions +then OPTS=$(getopt -n downloadable-programs -o $SHRTOPTS -l $LONGOPTS -- "$@") +else OPTS=$(getopt $SHRTOPTS $*) +fi + +if [ $? -eq 0 ] # Check return code from getopt +then eval set -- "$OPTS" +else echo "Failed to parse options." >&2; exit 1 +fi + +while true +do + case "$1" in + -c | --changes ) CHANGES=true; shift ;; + -n | --new ) NEW=true; export TEXINPUTS=".:/opt/github/web//:" + shift ;; + -p | --pdftocfront ) PDFTOCFRONT=true; shift ;; + -t | --tex ) TEX="$2"; shift 2 ;; + -- ) shift; break ;; + * ) break ;; + esac +done + +KNUTHWHERE=$(locate /bibtex.web) +KNUTHWARE=$(dirname $KNUTHWHERE) + +for f in \ + $KNUTHWARE/*.web \ + $KNUTHWARE/pdftexdir/pdftex.web \ + $KNUTHWARE/xetexdir/xetex.web +do + if $CHANGES + then + c=$(basename $f .web).ch + case $c in + "pdftex.ch"|"xetex.ch" ) + c=$KNUTHWARE/$c + c=$(echo $c | sed -e 's?\(texk/\)?Work/\1?') ;; + * ) c=$KNUTHWARE/$c ;; + esac + weave $f $c + sed -i -e "s/\(\\\\let\\\\maybe=\)\\\\iftrue/\1\\\\iffalse/" \ + $(basename $f .web).tex + else + weave $f + fi + + f=$(basename $f .web) + + # use extended macros for TeX Live PDF documentation + if $NEW + then + sed -i -e "1 s/\\\\input webmac/\\\\input pwebmac/" $f.tex + fi + + # replace former convention to indicate "not a title page" + # to include page headers for table-of-contents + sed -i -e "s/\\\\def\\\\titlepage{F}/\\\\titlefalse/" $f.tex + + # special treatment for individual WEB programs + case $f in + # purge conflict between bibtex.web and webmac.tex + # 'E' no longer free to be active character + # fix table-of-contents page for bibtex + "bibtex") sed -i -e "s/titlefalse/titletrue/" \ + -e "70,77d" $f.tex ;; + + # make room for new material in weave.web + "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 + # only XeTeX can process XeTeX + TEX=xetex + 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 + 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 ;; + esac + + if $PDFTOCFRONT + then + # shift table-of-contents pages to the front in PDF + export TEXINPUTS=".:/opt/github/cwebbin//:"$TEXINPUTS + sed -i -e "1 s/\(webmac\)/\1\n\\\\input pdfwebtocfront/" $f.tex + $TEX $f.tex # run TeX twice + fi + + $TEX $f +done + +if $PDFTOCFRONT +then + # create tarballs for publication + pax vftovp.pdf vptovf.pdf -wvzf etc.tar.gz -s ,^,etc/, + pax mf.pdf -wvzf mf.tar.gz -s ,^,mf/, + pax gftodvi.pdf gftopk.pdf gftype.pdf mft.pdf \ + -wvzf mfware.tar.gz -s ,^,mfware/, + pax tex.pdf -wvzf tex.tar.gz -s ,^,tex/, + pax dvitype.pdf pltotf.pdf pooltype.pdf tftopl.pdf \ + -wvzf texware.tar.gz -s ,^,texware/, + pax tangle.pdf weave.pdf -wvzf web.tar.gz -s ,^,web/, + pax bibtex.pdf -wvzf bibtex.tar.gz -s ,^,bibtex/, + pax dvicopy.pdf patgen.pdf pktogf.pdf pktype.pdf \ + -wvzf other.tar.gz -s ,^,other/, + pax pdftex.pdf -wvzf pdftex.tar.gz -s ,^,pdftex/, + pax xetex.pdf -wvzf xetex.tar.gz -s ,^,xetex/, +fi -- cgit v1.2.3