% knuth.drv % 2008/07/10 v1.0 Driver file for knuth/{texware,mfware,etc}/*.web % Copyright 2008 Heiko Oberdiek. % % This file is part of project `latex-tds'. % % It may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. % The latest version of this license is in % http://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX % version 2005/12/01 or later. % % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Heiko Oberdiek. % % See `README' for a list of all files belonging to the % project `latex-tds' and additional information. % % 2008/07/10 v1.0 % \errorcontextlines=\maxdimen \input ifpdf.sty\relax \ifpdf \else \input infwarerr.sty\relax \catcode`\@=11 % \@PackageError{knuth.drv}{You need pdfTeX in PDF mode}\@ehd \expandafter\end \fi \input pdfwebmac.tex\relax % Han The Thanh's enriched version of webmac.tex % Original paper size is probably letter (default of plain format). % But decrease margins for better online viewing. % /CropBox setting does not work for all viewers (AR, but not xdvi). \iftrue \pdfpagewidth=7.5in\relax % 8.5in - 2*0.5in \pdfhorigin=0.5in\relax \pdfpageheight=10in\relax % 11in - 2*0.5in \pdfvorigin=0.5in\relax \def\voffsetbp{-36}% \else \pdfpagewidth=8.5in\relax \pdfpageheight=11in\relax \def\voffsetbp{0}% \pdfpageattr{% /CropBox[36 36 576 756]% .5in .5in 8in 10.5in }% \fi % Definition of color macros \def\pdfsetrgbcolor#1{% \pdfliteral{#1 rg}% } \def\pdfsetgraycolor#1{% \pdfliteral{#1 g}% } \def\Black{% \pdfsetgraycolor{0}% } \def\LinkColor{% \pdfsetrgbcolor{1 0 0}% } \newif\ifusename \usenamefalse \begingroup \edef\x{\jobname}% \edef\y{\detokenize{tex}}% \ifx\x\y \global\usenametrue \fi \endgroup \def\numname#1{% \ifusename name{\number#1}% \else num #1 % \fi } % Redefinition of pdfwebmac macros \def\startsection{% \Q {% \let\*=\empty \pdfdest \numname{\modstar}xyz% }% \noindent {% \let\*=\lapstar \bf\modstar.\quad }% } \def\n#1{% \leavevmode \ifnum#1>0 % test for valid section numbers that start with 1 \pdfstartlink attr{/Border[0 0 0]} goto \numname{#1}\relax \LinkColor #1\Black \pdfendlink \else #1% \fi } \newcount\seclistnum \let\ORGfin\fin \def\fin{% \ORGfin \seclistnum=\numexpr\modno+1\relax \pdfdest \numname{\seclistnum}fitbh\relax \pdfoutline goto \numname{\seclistnum}{Names of the sections}\relax \iftrue \def\entry##1##2{% \pdfoutline attr{/C[0 0 1]} user{% <<% /S/GoToR% /F(../##1/##2.pdf)% /D[0/FitBH \the\numexpr 720+\voffsetbp\relax]% 10in/9.5in >>% }% {[##1/##2]}\relax }% \entry{tex}{tex}% \entry{tex}{tripman}% \entry{tex}{glue}% \entry{texware}{pooltype}% \entry{texware}{tftopl}% \entry{texware}{pltotf}% \entry{texware}{dvitype}% \entry{mf}{mf}% \entry{mf}{trapman}% \entry{mfware}{gftype}% \entry{mfware}{gftopk}% \entry{mfware}{gftodvi}% \entry{mfware}{mft}% \entry{etc}{vftovp}% \entry{etc}{vptovf}% \entry{web}{weave}% \entry{web}{tangle}% \entry{web}{webman}% \fi } \def\con{% \begingroup \def\lowercase##1{##1}% \def\,{}% \def\TeX{TeX}% \def\eightlogo{}% \xdef\infotitle{\title}% \def\firstofone##1{##1}% \xdef\infotitle{\expandafter\firstofone\infotitle}% \def\filter##1$##2\END{% ##1% \ifx\eject##2\eject \else \filter##2\END \fi }% \xdef\infotitle{\expandafter\filter\infotitle$\END}% \endgroup \pdfinfo{% /Title(\infotitle)% /Author(Donald E. Knuth)% }% \par\vfill\eject % finish the section names \rightskip 0pt % \hyphenpenalty 50 % \tolerance 200 % \setpage \output{\normaloutput\page\lheader\rheader}% \titletrue % prepare to output the table of contents \global\pageno=\contentspagenumber \def\rhead{TABLE OF CONTENTS}% \message{Table of contents:}% \topofcontents \line{\hfil Section\hbox to3em{\hss Page}}% \def\Z##1##2##3{% \line{% \pdfstartlink attr{/Border [0 0 0]} goto \numname{##2}\relax \LinkColor \ignorespaces##1 % \leaders\hbox to .5em{.\hfil}\hfil\ ##2 \Black \pdfendlink \hbox to3em{\hss##3}% }% }% \readcontents\relax % read the contents info \botofcontents % print the contents page(s) and terminate \makeoutlines \eject % \titletrue is necessary during output and % \con is maybe called in a group, therefore % the output is forced here. \makepagelabels \global\advance\pageno by 1 % \end } % Adding PDF page labels \def\makepagelabels{% \ifnum\contentspagenumber=1 % \else \ifnum\contentspagenumber=0 % \pdfcatalog{% /PageLabels<<% /Nums[0<>1<>]% >>% }% \else \pdfcatalog{% /PageLabels<<% /Nums[0<>]% >>% }% \fi \fi } % Move contents page to the front \def\contentsfile{\jobname.toc} \def\readcontents{\input\contentsfile\relax} \def\makeoutlines{% \def\?##1]{}% \def\Z##1##2##3{% \pdfoutline goto \numname{##2}{##2. ##1}\relax }% \readcontents }% \newread\testread \openin\testread=\contentsfile\relax \ifeof\testread \else \let\ORGcon\con \def\con{% \begingroup \let\end\relax \ORGcon \endgroup \let\con\end }% \expandafter\let\csname ORGN\expandafter\endcsname \csname N\endcsname \expandafter\outer\expandafter\def\csname N\endcsname{% \con \advance\pageno by -1\relax \expandafter\let\csname N\expandafter\endcsname \csname ORGN\endcsname \csname N\endcsname }% \begingroup \def\num{0}% \edef\x{\jobname}% \edef\y{\detokenize{tex}}% \ifx\x\y \def\num{1}% \else \edef\y{\detokenize{mf}}% \ifx\x\y \def\num{1}% \fi \fi \expandafter\endgroup\ifnum\num=1 % \def\contentspagenumber{2}% \let\ORGpageno\pageno \def\pageno{% \let\pageno\ORGpageno \expandafter\let\csname ORGN\expandafter\endcsname \csname N\endcsname \expandafter\outer\expandafter\def\csname N\endcsname{% \con \advance\pageno by -1\relax \expandafter\let\csname N\expandafter\endcsname \csname ORGN\endcsname \csname N\endcsname }% \pageno }% \fi \fi % Patch \input to disable `\input webmac' \let\ORGinput\input \def\input #1\relax{% \def\input webmac {% \let\input\ORGinput }% \ORGinput #1 % } \input \jobname.tex\relax \endinput