diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2020-07-02 11:21:53 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2020-07-02 11:21:53 +0000 |
commit | f7c797d64ebdb651e0a97b6cb7620363e2353187 (patch) | |
tree | 088bdd835e0b8c01dc229f8be6cd3c16a60f1626 /Build | |
parent | 5d993c535037f33258ff8949659391711775b1b2 (diff) |
[CWEB] Add links and bookmarks for 'cwebman' in PDF.
git-svn-id: svn://tug.org/texlive/trunk@55725 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/cwebman-w2c.ch | 161 |
2 files changed, 165 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index c3f2c2627c0..7df72c56289 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -1,3 +1,7 @@ +2020-07-02 Andreas Scherer <https://ascherer.github.io> + + * cwebman-w2c.ch: Add links and bookmarks in PDF. + 2020-06-29 Andreas Scherer <https://ascherer.github.io> * ctwill-mini.ch, diff --git a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch index d943c2aa5b6..311ae38f673 100644 --- a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch +++ b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch @@ -16,6 +16,14 @@ @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> @x +\input cwebmac +\acrofalse\pdffalse\pdftexfalse +@y +\ifx\undefined\XeTeXrevision\else\let\pdf+\fi % XeTeX produces PDF output +\input cwebmac +@z + +@x \def\page{\box255 } \normalbottom @y \let\page=\pagebody \raggedbottom @@ -25,6 +33,83 @@ @z @x +\outer\def\section #1.{\penalty-500\bigskip + \centerline{\sectionfont\def\.##1{{\twelvett##1}} #1}\nobreak\vskip 6pt + \everypar{\hskip-\parindent\everypar{}}} +@y +\ifacro + \pdfpagewidth=\pagewidth \advance\pdfpagewidth by 2cm + \pdfpageheight=\pageheight \advance\pdfpageheight by 3cm + \ifpdftex \pdfhorigin=1cm \pdfvorigin=1cm + \else \advance\pdfpageheight by 1cm \global\pageshift=-1.54cm + \global\hoffset=-1.54cm \global\voffset=-1.54cm \fi +\fi + +\newcount\destcount \destcount=1\relax + +\def\bkminfo{} +\outer\def\section #1.{\penalty-500\bigskip + \centerline{\sectionfont\def\.##1{{\twelvett##1}} + \ifacro\vbox to 0pt{\kern-2.5ex\relax + \ifpdftex\pdfdest num \destcount fitbh\relax + \else\special{pdf: dest (\the\destcount) [ @thispage /FitBH @ypos ]}\fi + \def\.##1{##1}\def\TeX{TeX}% + \ifx\bkminfo\empty\def\sectitle{#1}\else\def\sectitle{#1 (\bkminfo)}\fi + \ifpdftex\pdfoutline goto num \destcount {\sectitle}\relax + \else\special{pdf: outline 0 << /Title (\sectitle) + /A << /S /GoTo /D (\the\destcount) >> >>}\fi + \gdef\bkminfo{}% + \global\advance\destcount by 1\relax + \kern2.5ex\relax + }\fi #1}\nobreak\vskip 6pt + \everypar{\hskip-\parindent\everypar{}}} + +\outer\def\ssection #1.#2.{\penalty-500\bigskip + \ifacro\vbox to 0pt{\kern-2.5ex\relax + \ifpdftex\pdfdest num \destcount fitbh\relax + \else\special{pdf: dest (\the\destcount) [ @thispage /FitBH @ypos ]}\fi + \def\.##1{##1}\def\TeX{TeX}% + \ifx\bkminfo\empty\def\sectitle{#1}\else\def\sectitle{#1 (\bkminfo)}\fi + \ifpdftex\pdfoutline goto num \destcount count -#2 {\sectitle}\relax + \else\special{pdf: outline 0 << /Title (\sectitle) + /A << /S /GoTo /D (\the\destcount) >> >>}\fi + \gdef\bkminfo{}% + \global\advance\destcount by 1\relax + \kern2.5ex\relax + }\fi \centerline{\sectionfont\def\.##1{{\twelvett##1}} #1}\nobreak\vskip 6pt + \everypar{\hskip-\parindent\everypar{}}} + +\def\appA{15} +\def\appB{16} +\def\appC{17} + +\def\Appendix#1{\leavevmode + \ifnum\csname app#1\endcsname>0 % + \ifacro\ifpdftex + \pdfstartlink attr{/Border[0 0 0]} goto num\csname app#1\endcsname\relax + \Blue\hbox{Appendix}~#1\Black + \pdfendlink + \else + \setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{\hbox{Appendix}~#1}% + \special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight + depth \thedepth << /Type /Annot /Subtype /Link /Border [0 0 0] + /A << /S /GoTo /D (\csname app#1\endcsname) >> >>}\box0\relax + \fi\else Appendix~#1\fi + \else Appendix~#1\fi} + +\newcount\subdestcount \subdestcount=151\relax + +\outer\def\subsection #1.{\ifacro + \ifpdftex\pdfdest num \subdestcount fitbh\relax + \pdfoutline goto num \subdestcount {#1}\relax + \else\special{pdf: dest (\the\subdestcount) [ @thispage /FitBH @ypos ]}% + \special{pdf: outline 1 << /Title (#1) + /A << /S /GoTo /D (\the\subdestcount) >> >>}\fi + \global\advance\subdestcount by 1\relax + \fi} +@z + +@x \def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 3.64)} @y \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} @@ -93,6 +178,23 @@ macros could be called \.{dkcwebmac.tex} and would be included by `\.{+ldk}'. @z @x +Sometimes things don't work as smoothly, and you get a bunch of +@y +\acrofalse\pdftexfalse\pdffalse +Sometimes things don't work as smoothly, and you get a bunch of +@z + +@x +`\.{main(argc,argv)}'. +@y +`\.{main(argc,argv)}'. +\ifx\pdf+\pdftrue\fi +\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse +\else \pdftextrue \pdfoutput=1\fi\fi +\ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi +@z + +@x saying `\.{pdftex}~\.{cob}'. @y saying `\.{pdftex}~\.{cob}'.% @@ -107,6 +209,20 @@ acroread cob.pdf\cr}}$$} @z @x +As an example of a real program written in \.{CWEB}, Appendix~A +@y +As an example of a real program written in \.{CWEB}, \Appendix A +@z + +@x +Appendix B is the file that sets \TEX/ up to accept +the output of \.{CWEAVE}, and Appendix~C discusses how to use some of those +@y +\Appendix B is the file that sets \TEX/ up to accept +the output of \.{CWEAVE}, and \Appendix C discusses how to use some of those +@z + +@x \.{CTANGLE} and \.{CWEAVE}. \vfil\eject\titletrue @@ -120,6 +236,51 @@ is based on \.{CWEAVE}.} @z @x +\def\runninghead{APPENDIX A --- {\tentt CWEB} FILE FORMAT} +\section Appendix A: Excerpts from a \.{CWEB} Program. +@y +\def\runninghead{APPENDIX A --- {\tentt CWEB} FILE FORMAT} +\ssection Appendix A: Excerpts from a \.{CWEB} Program.4. +\subsection CWEB file format. +@z + +@x +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} +@y +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}} +\subsection Translation by CTANGLE. +@z + +@x +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}} +@y +\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}} +\subsection Translation by CWEAVE. +@z + +@x +\def\runninghead{APPENDIX A --- FINAL DOCUMENT} + +And here's what the same excerpt looks like when typeset. +@y +\def\runninghead{APPENDIX A --- FINAL DOCUMENT} +\subsection Final document. + +\acrofalse\pdftexfalse\pdffalse +And here's what the same excerpt looks like when typeset. +@z + +@x +\vfil\eject\titletrue +@y +\vfil\eject\titletrue +\ifx\pdf+\pdftrue\fi +\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse +\else \pdftextrue \pdfoutput=1\fi\fi +\ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi +@z + +@x \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$ @y \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$ |