texlive[55616] Master/texmf-dist/tex/plain/cweb/cwebbin: [CWEB]

commits+ascherer at tug.org commits+ascherer at tug.org
Sun Jun 21 12:54:25 CEST 2020


Revision: 55616
          http://tug.org/svn/texlive?view=revision&revision=55616
Author:   ascherer
Date:     2020-06-21 12:54:25 +0200 (Sun, 21 Jun 2020)
Log Message:
-----------
[CWEB] Update auxiliary PDF macros.

Modified Paths:
--------------
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex
    trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex	2020-06-21 02:26:45 UTC (rev 55615)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfctwimac.tex	2020-06-21 10:54:25 UTC (rev 55616)
@@ -24,8 +24,6 @@
 \let\:=\. % preserve a way to get the dot accent
  % (all other accents will still work as usual)
 
-\def\contentspagenumber{0} % default page number for table of contents
-
 \newdimen\em \em=10pt % this "em" will not change with font size
 \parskip 0pt plus .1pt % almost no stretch between paragraphs
 \parindent 1\em % for paragraphs and for the first line of C text
@@ -61,7 +59,6 @@
 \font\ninebf=cmbx9
 \font\eightbf=cmbx8
 \font\sixbf=cmbx6
-\font\niness=cmss9
 \font\ninett=cmtt9
 \font\eighttt=cmtt8
 \hyphenchar\ninett=-1 \hyphenchar\eighttt=-1
@@ -118,7 +115,7 @@
   \textfont\ttfam=\ninett
   \def\ttx{\ninetex}%
   \normalbaselineskip=11pt
-  \let\cmntfont=\niness%\ninerm
+  \let\cmntfont=\ninerm
   \let\mc=\eightrm
   \let\sc=\sevenrm
   \let\big=\ninebig
@@ -156,7 +153,7 @@
 \def\eightbig#1{{\hbox{$\textfont0=\ninerm\textfont2=\ninesy
   \left#1\vbox to6.5pt{}\right.\nulldelimiterspace=0pt$}}}
 
-\font\tenss=cmss10 \let\cmntfont\tenss % alternative comment font
+%\font\tenss=cmss10 \let\cmntfont\tenss % alternative comment font
 \font\titlefont=cmr7 scaled\magstep4 % title on the contents page
 \font\ttitlefont=cmtt10 scaled\magstep2 % typewriter type in title
 
@@ -238,7 +235,7 @@
 \let\yskip=\smallskip
 \def\?{\mathrel?}
 \def\note#1#2.{\par\penalty5000
-  \Y\noindent{\hangindent2\em\baselineskip10pt
+  \Y\noindent{\hangindent2\em\baselineskip10pt%
     \eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}
 
 \newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
@@ -407,6 +404,7 @@
 \def\A{\note{See also section}} % xref for doubly defined section name
 \def\As{\note{See also sections}} % xref for multiply defined section name
 \def\B{\iftenpoint\ninepoint\fi
+  \font\niness=cmss9 \let\cmntfont\niness % alternative comment font
   \rightskip=0pt plus 100pt minus 10pt % go into C mode
   \sfcode`;=3000
   \pretolerance 10000
@@ -641,6 +639,7 @@
 
 \hsize=\pagewd \vsize=\maxdimen \output={\twillout}
 
+\def\contentspagenumber{0} % default page number for table of contents
 \def\contentsfile{\jobname.toc} % file that gets table of contents info
 \def\readcontents{\input \contentsfile}
 \def\readsections{\input \jobname.scn}
@@ -655,24 +654,21 @@
   \ifpdftex
     \immediate\write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
     \immediate\closeout\cont % the contents information has been fully gathered
-  \fi
-}
-\def\fin{\message{Section names:}
+  \fi}
+\def\fin{\ifacro \message{Section names:}
   \def\U##1.{} \def\Us##1.{} \let\I=\relax \let\*=*
-  \ifacro \def\outsecname{Names of the sections}
+  \def\outsecname{Names of the sections}
   \ifpdftex \makebookmarks
     \pdfoutline goto num 1 count -\secno {\outsecname}
     \def\X##1:##2\X{\firstsecno##1.%
       {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
       \pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
-  \else \special{pdf: outline -1 << /Title (\outsecname)
-        /A << /S /Goto /D (1) >> >>}%
+  \else \special{pdf: outline -1 << /Title (\outsecname) >>}%
     \def\X##1:##2\X{\firstsecno##1.%
       {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
       \special{pdf: outline 0 << /Title (\the\toksE)
         /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
-  \fi\fi
-  \readsections}
+  \fi \readsections \fi}
 \def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
 \def\writebookmarkline#1#2#3#4#5{{%
   \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let

Modified: trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
===================================================================
--- trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex	2020-06-21 02:26:45 UTC (rev 55615)
+++ trunk/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex	2020-06-21 10:54:25 UTC (rev 55616)
@@ -1,6 +1,6 @@
 % pdfwebtofront.tex
 % Code from knuth.drv in https://github.com/oberdiek/latex-tds
-% 2020/05/30 v1.1 by Andreas Scherer.
+% 2020/06/20 v2.0 by Andreas Scherer.
 %
 % This file is part of project https://github.com/ascherer/cwebbin
 % and may be distributed under the MIT License or the LaTeX Project
@@ -20,7 +20,6 @@
   % Redefine '\con' to be invoked before the first '\N' (starred section).
   \let\ORGcon\con
   \def\con{%
-    \def\:{\par\hangindent 2em} % Fix for 'bibtex.web'.
     % reduce size of PDF pages for more screen space
     \pdfpagewidth=\pagewidth  \advance\pdfpagewidth by 2cm
     \pdfpageheight=\pageheight \advance\pdfpageheight by 3cm
@@ -30,49 +29,57 @@
     \begingroup
       \let\end\relax
       \ORGcon
-      % let's start with section '1', the 'Introduction'.
-      \ifx\undefined\gdepth \mark{{{\tensy x}1}{Introduction}} % WEB
-      \else \mark{{{\tensy x}1}0{Introduction}}\fi % CWEB
-      \eject % set '\botmark' on TOC, hence '\topmark' on next page.
     \endgroup
     \let\con\end
   }%
-  % Redefine '\N’ to invoke redefined '\con' before switching back
-  % to original '\N'.
-  \expandafter\let\csname ORGN\expandafter\endcsname
-                  \csname N\endcsname
-  \expandafter\outer\expandafter\def\csname N\endcsname{%
-    \con
-    \expandafter\let\csname N\expandafter\endcsname
-                    \csname ORGN\endcsname
-    \csname N\endcsname
-  }%
-  % Special variant of the above for 'mf.web' and 'tex.web'.  They put
-  % their tables-of-contents on a sparse 'page 2' and start on page '3'.
-  \begingroup
-    \edef\x{\jobname}%
-    \edef\y{\detokenize{tex}}%
-    \ifx\x\y \texmftrue\else
-    \edef\y{\detokenize{mf}}%
-    \ifx\x\y \texmftrue\else
-    \edef\y{\detokenize{pdftex}}%
-    \ifx\x\y \texmftrue\else
-    \edef\y{\detokenize{xetex}}%
-    \ifx\x\y \texmftrue\fi\fi\fi\fi
-  \expandafter\endgroup\iftexmf %
-    \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
-        \expandafter\let\csname N\expandafter\endcsname
-                        \csname ORGN\endcsname
-        \csname N\endcsname
-      }%
-      \pageno
+  % Special variant for 'mf.web' and 'tex.web' (et al.).
+  % They all define a peculiar version of '\N' in their preamble.
+  % And they put their tables-of-contents on a sparse 'page 2' and
+  % start the main body on page '3'.
+  \edef\x{\jobname}%
+  \edef\y{\detokenize{tex}}%
+  \ifx\x\y \texmftrue\else
+  \edef\y{\detokenize{mf}}%
+  \ifx\x\y \texmftrue\else
+  \edef\y{\detokenize{pdftex}}%
+  \ifx\x\y \texmftrue\else
+  \edef\y{\detokenize{xetex}}%
+  \ifx\x\y \texmftrue\fi\fi\fi\fi
+  \iftexmf
+    \expandafter\let\csname ORGN\expandafter\endcsname
+                    \csname N\endcsname
+    \expandafter\outer\expandafter\def\csname N\endcsname{%
+      \titletrue \con \pageno=2
+      \expandafter\let\csname N\expandafter\endcsname
+                      \csname ORGN\endcsname
+      \csname N\endcsname
     }%
+  \else % Much more general approach for WEB and CWEB programs.
+    % In fact, '\con' will be invoked _inside_ the first '\N' right _after_
+    % '\MN', but _before_ '\eject'.  And '\topofcontents' gets in the twist
+    % as well.
+    \let\ORGtopofcontents\topofcontents \let\ORGrheader\rheader
+    \def\topofcontents{%
+      \def\:{\par\hangindent 2em} % Fix for 'bibtex.web'; from '\def\fin'.
+      \ORGtopofcontents
+      \let\topofcontents\relax
+    }%
+    % Squeeze '\con' between '\MN' and '\eject' in the very first '\N'.
+    \expandafter\let\csname ORGvfil\expandafter\endcsname
+                    \csname vfil\endcsname
+    \expandafter\let\csname ORGeject\expandafter\endcsname
+                    \csname eject\endcsname
+    \expandafter\outer\expandafter\def\csname vfil\endcsname{%
+      \let\eject\relax
+      \titletrue % prepare to output the table of contents
+      \topofcontents \con
+      \advance\pageno by -1\relax
+      \expandafter\let\csname vfil\expandafter\endcsname
+                      \csname ORGvfil\endcsname
+      \expandafter\let\csname eject\expandafter\endcsname
+                      \csname ORGeject\endcsname
+      \vfil\eject
+      \let\rheader\ORGrheader
+    }%
   \fi
 \fi



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