texlive[55725] Build/source/texk/web2c/cwebdir: [CWEB] Add links and

commits+ascherer at tug.org commits+ascherer at tug.org
Thu Jul 2 13:21:53 CEST 2020


Revision: 55725
          http://tug.org/svn/texlive?view=revision&revision=55725
Author:   ascherer
Date:     2020-07-02 13:21:53 +0200 (Thu, 02 Jul 2020)
Log Message:
-----------
[CWEB] Add links and bookmarks for 'cwebman' in PDF.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2020-07-01 23:55:15 UTC (rev 55724)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2020-07-02 11:21:53 UTC (rev 55725)
@@ -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,

Modified: trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch	2020-07-01 23:55:15 UTC (rev 55724)
+++ trunk/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch	2020-07-02 11:21:53 UTC (rev 55725)
@@ -16,6 +16,14 @@
 @q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
 
 @x
+\input cwebmac
+\acrofalse\pdffalse\pdftexfalse
+ at y
+\ifx\undefined\XeTeXrevision\else\let\pdf+\fi % XeTeX produces PDF output
+\input cwebmac
+ at z
+
+ at 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{}}}
+ at 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}
+ at z
+
+ at x
 \def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 3.64)}
 @y
 \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}}
@@ -93,6 +178,23 @@
 @z
 
 @x
+Sometimes things don't work as smoothly, and you get a bunch of
+ at y
+\acrofalse\pdftexfalse\pdffalse
+Sometimes things don't work as smoothly, and you get a bunch of
+ at z
+
+ at x
+`\.{main(argc,argv)}'.
+ at 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
+ at z
+
+ at x
 saying `\.{pdftex}~\.{cob}'.
 @y
 saying `\.{pdftex}~\.{cob}'.%
@@ -107,6 +209,20 @@
 @z
 
 @x
+As an example of a real program written in \.{CWEB}, Appendix~A
+ at y
+As an example of a real program written in \.{CWEB}, \Appendix A
+ at z
+
+ at 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
+ at 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
+ at z
+
+ at x
 \.{CTANGLE} and \.{CWEAVE}.
 
 \vfil\eject\titletrue
@@ -120,6 +236,51 @@
 @z
 
 @x
+\def\runninghead{APPENDIX A --- {\tentt CWEB} FILE FORMAT}
+\section Appendix A: Excerpts from a \.{CWEB} Program.
+ at y
+\def\runninghead{APPENDIX A --- {\tentt CWEB} FILE FORMAT}
+\ssection Appendix A: Excerpts from a \.{CWEB} Program.4.
+\subsection CWEB file format.
+ at z
+
+ at x
+\def\runninghead{APPENDIX A  --- TRANSLATION BY {\tentt CTANGLE}}
+ at y
+\def\runninghead{APPENDIX A  --- TRANSLATION BY {\tentt CTANGLE}}
+\subsection Translation by CTANGLE.
+ at z
+
+ at x
+\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}}
+ at y
+\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}}
+\subsection Translation by CWEAVE.
+ at z
+
+ at x
+\def\runninghead{APPENDIX A --- FINAL DOCUMENT}
+
+And here's what the same excerpt looks like when typeset.
+ at y
+\def\runninghead{APPENDIX A --- FINAL DOCUMENT}
+\subsection Final document.
+
+\acrofalse\pdftexfalse\pdffalse
+And here's what the same excerpt looks like when typeset.
+ at z
+
+ at x
+\vfil\eject\titletrue
+ at 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
+ at z
+
+ at x
   \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$
 @y
   \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$



More information about the tex-live-commits mailing list.