diff options
Diffstat (limited to 'web/pwebmac/pwebmac.tex')
-rw-r--r-- | web/pwebmac/pwebmac.tex | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/web/pwebmac/pwebmac.tex b/web/pwebmac/pwebmac.tex index 3143de696b..f7cff63628 100644 --- a/web/pwebmac/pwebmac.tex +++ b/web/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.% |