summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2020-05-13 09:11:20 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2020-05-13 09:11:20 +0000
commit0002c9545de0b8dee9650738ea6eb9d49adf1ef6 (patch)
treeb39c2837f381de71108cb7542e93444d31f75f6d /Build
parent2f26cad4e30cb3c23a5d1523875b3abbba43a267 (diff)
[CWEB] Separation of powers.
The new 'pdfwebtocfront.tex' works well with both CWEB and WEB. Simply '\input' it in limbo of your (C)WEB code and run 'pdftex' or 'xetex' twice (!) to move the table-of-contents page up front. git-svn-id: svn://tug.org/texlive/trunk@55124 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex60
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/pdfwebtocfront.tex59
2 files changed, 60 insertions, 59 deletions
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex
index d2e25fc33bc..e8e08762d30 100644
--- a/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/texinputs/Xcwebmac.tex
@@ -39,62 +39,4 @@
%\let\K=\leftarrow % "honest" alternative to standard assignment operator
-% Move contents page to the front
-%
-% Code from knuth.drv in https://github.com/oberdiek/latex-tds
-% Works with pdftex (with active links) and xetex (with active
-% links only for '\let\pdf+').
-%
-\ifx\detokenize\undefined\endinput\fi
-\newread\testread
-\openin\testread=\contentsfile\relax
-\ifeof\testread % First run
-\else % Second run
- \let\ORGcon\con
- \def\con{%
- \ifnum\pageno=1 \global\titletrue\fi
- \begingroup
- \let\end\relax
- \ORGcon
- \endgroup
- \let\con\end
- }%
- \expandafter\let\csname ORGN\expandafter\endcsname
- \csname N\endcsname
- \expandafter\outer\expandafter\def\csname N\endcsname{%
- \con
- \advance\pageno by -1\relax
- \expandafter\let\csname N\expandafter\endcsname
- \csname ORGN\endcsname
- \csname N\endcsname
- }%
- \begingroup
- \def\num{0}%
- \edef\x{\jobname}%
- \edef\y{\detokenize{tex}}%
- \ifx\x\y
- \def\num{1}%
- \else
- \edef\y{\detokenize{mf}}%
- \ifx\x\y
- \def\num{1}%
- \fi
- \fi
- \expandafter\endgroup\ifnum\num=1 %
- \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
- \advance\pageno by -1\relax
- \expandafter\let\csname N\expandafter\endcsname
- \csname ORGN\endcsname
- \csname N\endcsname
- }%
- \pageno
- }%
- \fi
-\fi
+\input pdfwebtocfront
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfwebtocfront.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfwebtocfront.tex
new file mode 100644
index 00000000000..3fb8d393a4e
--- /dev/null
+++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfwebtocfront.tex
@@ -0,0 +1,59 @@
+%
+% Move contents page to the front
+%
+% Code from knuth.drv in https://github.com/oberdiek/latex-tds
+% Works with pdftex and xetex.
+%
+\ifx\detokenize\undefined\endinput\fi
+\newread\testread
+\openin\testread=\contentsfile\relax
+\ifeof\testread % First run
+\else % Second run
+ \let\ORGcon\con
+ \def\con{%
+ \ifnum\pageno=1 \global\titletrue\fi
+ \begingroup
+ \let\end\relax
+ \ORGcon
+ \endgroup
+ \let\con\end
+ }%
+ \expandafter\let\csname ORGN\expandafter\endcsname
+ \csname N\endcsname
+ \expandafter\outer\expandafter\def\csname N\endcsname{%
+ \con
+ \advance\pageno by -1\relax
+ \expandafter\let\csname N\expandafter\endcsname
+ \csname ORGN\endcsname
+ \csname N\endcsname
+ }%
+ \begingroup
+ \def\num{0}%
+ \edef\x{\jobname}%
+ \edef\y{\detokenize{tex}}%
+ \ifx\x\y
+ \def\num{1}%
+ \else
+ \edef\y{\detokenize{mf}}%
+ \ifx\x\y
+ \def\num{1}%
+ \fi
+ \fi
+ \expandafter\endgroup\ifnum\num=1 %
+ \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
+ \advance\pageno by -1\relax
+ \expandafter\let\csname N\expandafter\endcsname
+ \csname ORGN\endcsname
+ \csname N\endcsname
+ }%
+ \pageno
+ }%
+ \fi
+\fi