diff options
author | Andreas Scherer <andreas_tex@freenet.de> | 2020-06-15 17:08:27 +0000 |
---|---|---|
committer | Andreas Scherer <andreas_tex@freenet.de> | 2020-06-15 17:08:27 +0000 |
commit | c3c348ea8e5e866e35b7c8abe98df366f8c68b72 (patch) | |
tree | fca66acf7887c83bab4d2cd18928dcff59063757 /Build | |
parent | 73b549dd4c503deb68ac23705c6dd59ab3f9afd2 (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')
-rw-r--r-- | Build/source/texk/web2c/cwebdir/ChangeLog | 2 | ||||
-rw-r--r-- | Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex | 38 |
2 files changed, 28 insertions, 12 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog index 3654035a14a..03923520f23 100644 --- a/Build/source/texk/web2c/cwebdir/ChangeLog +++ b/Build/source/texk/web2c/cwebdir/ChangeLog @@ -2,7 +2,7 @@ * texinputs/pdfctimac.tex: Unified color management; code compaction; simplified if-else inside \acro; - flat outlines/bookmarks with pdfTeX. + structured outlines/bookmarks with all supported TeX engines. 2020-06-14 Andreas Scherer <https://ascherer.github.io> 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{} |