summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2020-06-21 10:54:25 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2020-06-21 10:54:25 +0000
commit6243a02ea6b6aadbe12bad7d006119fed6917eca (patch)
tree5c81dcd20a07379275202f1a0862edbf825aafc5 /Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
parent7bc7c6ad12be2d2ae1c800398ce0593dad063ef9 (diff)
[CWEB] Update auxiliary PDF macros.
git-svn-id: svn://tug.org/texlive/trunk@55616 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex')
-rw-r--r--Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex91
1 files changed, 49 insertions, 42 deletions
diff --git a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
index 54531a25764..3fc5f64de2f 100644
--- a/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
+++ b/Master/texmf-dist/tex/plain/cweb/cwebbin/pdfwebtocfront.tex
@@ -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