summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/texinputs
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2020-06-15 17:08:27 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2020-06-15 17:08:27 +0000
commitc3c348ea8e5e866e35b7c8abe98df366f8c68b72 (patch)
treefca66acf7887c83bab4d2cd18928dcff59063757 /Build/source/texk/web2c/cwebdir/texinputs
parent73b549dd4c503deb68ac23705c6dd59ab3f9afd2 (diff)
[CWEB/CTWILL] 'pdfctwimac' finalized.
Reintroducing the \jobname.toc mechanism (for pdfTeX only) helps create structured PDF outlines with all supported TeX engines. git-svn-id: svn://tug.org/texlive/trunk@55556 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/texinputs')
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex38
1 files changed, 27 insertions, 11 deletions
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
index b53d789bc9f..eb0b720d06d 100644
--- a/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
+++ b/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
@@ -446,16 +446,13 @@
\gdef\rrhead{\let\i=I\uppercase{\ignorespaces#3}}
\fi
\message{*\secno} % progress report
- %\def\stripprefix##1>{}\def\gtitletoks{#3}%
- %\edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}%
- %\edef\next{\write\cont{\ZZ{\gtitletoks}{#1}{\secno}% write to contents file
- %{\noexpand\the\pageno}{\the\toksE}}}\next % \ZZ{title}{depth}{sec}{page}{ss}
- \ifpdftex\expandafter\xdef\csname curr#1\endcsname{\secno}
+ \ifpdftex\def\stripprefix##1>{}\def\gtitletoks{#3}%
+ \edef\gtitletoks{\expandafter\stripprefix\meaning\gtitletoks}%
+ {\immediate\write\cont{\ZZ{\gtitletoks}{#1}{\secno}% write to contents file
+ {\noexpand\the\pageno}{\the\toksE}}} % \ZZ{title}{depth}{sec}{page}{ss}
+ \expandafter\xdef\csname curr#1\endcsname{\secno}
\ifnum#1>0\countB=#1 \advance\countB by-1
\advancenumber{chunk\the\countB.\expnumber{curr\the\countB}}\fi
- {\let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let
- \pdfoutline goto num \secno count -\expnumber{chunk#1.\secno}
- {\the\toksE}}
\else\ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
[ @thispage /FitH @ypos ] >>}\fi\fi
\startsection{\bf\ignorespaces#3.\quad}\ignorespaces}
@@ -643,8 +640,24 @@
\hsize=\pagewd \vsize=\maxdimen \output={\twillout}
-\let\inx=\flushout % No full index at the end
-\def\fin{\parfillskip 0pt plus 1fil
+\def\contentsfile{\jobname.toc} % file that gets table of contents info
+\def\readcontents{\input \contentsfile}
+\def\readsections{\relax}%\input \jobname.scn}
+
+\newwrite\cont
+\ifpdftex
+ \immediate\openout\cont=\contentsfile
+ \immediate\write\cont{\catcode `\noexpand\@=11\relax} % \makeatletter
+\fi
+
+\def\inx{\flushout % No full index at the end
+ \ifpdftex
+ \immediate\write\cont{\catcode `\noexpand\@=12\relax} % \makeatother
+ \immediate\closeout\cont % the contents information has been fully gathered
+ \fi
+}
+\def\fin{\ifpdftex \makebookmarks \fi
+ \parfillskip 0pt plus 1fil
\gtitle={NAMES OF THE SECTIONS}
\let\topsecno=\nullsec
\message{Section names:}
@@ -668,7 +681,10 @@
%/A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}}
%\fi\fi
\readsections}
-\def\readsections{\relax}%\input \jobname.scn}
+\def\makebookmarks{\let\ZZ=\writebookmarkline \readcontents\relax}
+\def\writebookmarkline#1#2#3#4#5{{%
+ \let\(=\let \let\)=\let \let\[=\let \let\]=\let \let\/=\let
+ \pdfoutline goto num #3 count -\expnumber{chunk#2.#3} {#5}}}
\let\con=\end % no table of contents
\def\datethis{} \def\datecontentspage{}