texlive[55555] Build/source/texk/web2c/cwebdir: [CWEB/CTWILL]
commits+ascherer at tug.org
commits+ascherer at tug.org
Mon Jun 15 17:45:37 CEST 2020
Revision: 55555
http://tug.org/svn/texlive?view=revision&revision=55555
Author: ascherer
Date: 2020-06-15 17:45:37 +0200 (Mon, 15 Jun 2020)
Log Message:
-----------
[CWEB/CTWILL] Improved 'pdfctwimac'.
* Unified color management for 'link color'
* Simplified if-else inside \acro
* Flat outlines/bookmarks with pdfTeX
TODO: Implement \makebookmarks for pdfTeX with a \jobname.toc file.
Modified Paths:
--------------
trunk/Build/source/texk/web2c/cwebdir/ChangeLog
trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog 2020-06-15 11:27:22 UTC (rev 55554)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog 2020-06-15 15:45:37 UTC (rev 55555)
@@ -1,3 +1,9 @@
+2020-06-15 Andreas Scherer <https://ascherer.github.io>
+
+ * texinputs/pdfctimac.tex: Unified color management;
+ code compaction; simplified if-else inside \acro;
+ flat outlines/bookmarks with pdfTeX.
+
2020-06-14 Andreas Scherer <https://ascherer.github.io>
* texinputs/pdfctimac.tex: New macros for PDF output with hyperlinks
Modified: trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex 2020-06-15 11:27:22 UTC (rev 55554)
+++ trunk/Build/source/texk/web2c/cwebdir/texinputs/pdfctwimac.tex 2020-06-15 15:45:37 UTC (rev 55555)
@@ -17,7 +17,7 @@
\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
\else \pdftextrue \pdfoutput=1
\def\Black{\pdfliteral{0 g 0 G}} % use rgb colors for direct PDF output too
- \def\Blue{\pdfliteral{0 0 1 rg 0 0 1 RG}}
+ \def\PDFlinkcolor{\pdfliteral{\pdflinkcolor rg \pdflinkcolor RG}}
\fi\fi
\newif\ifacro \ifpdf\acrotrue\fi \ifpdftex\acrotrue\fi
@@ -237,8 +237,8 @@
\let\yskip=\smallskip
\def\?{\mathrel?}
\def\note#1#2.{\par\penalty5000
- \Y\noindent{\hangindent2\em
- \baselineskip10pt\eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}
+ \Y\noindent{\hangindent2\em\baselineskip10pt
+ \eightrm#1~\ifacro{\pdfnote#2.}\else#2\fi.\par}}
\newtoks\toksA \newtoks\toksB \newtoks\toksC \newtoks\toksD
\newtoks\toksE \newtoks\toksF \newtoks\usersanitizer
@@ -254,7 +254,7 @@
\ifpdftex
\ifx\pdfannotlink\undefined\let\pdfannotlink\pdfstartlink\fi% for pdfTeX 0.14
\def\pdflink#1#2{\hbox{\pdfannotlink height\ht\strutbox depth\dp\strutbox
- attr{/Border [0 0 0]} goto num #1 \Blue #1\Black\pdfendlink}} % changed 3.69
+ attr{/Border [0 0 0]} goto num #1 \PDFlinkcolor #1\Black\pdfendlink}}
\else\def\pdflink#1#2{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
\special{pdf: ec}}\special{pdf: ann width \thewidth height \theheight
depth \thedepth << /Type /Annot /Subtype /Link
@@ -283,9 +283,9 @@
{\noexpand\pdflink{\the\toksC}{\romannumeral\the\toksC}}\toksC={}\global\countC=0}
\def\maketoksdone{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
\def\pdfURL#1#2{\ifpdftex\pdfannotlink height\ht\strutbox depth\dp\strutbox
- attr {/Border [0 0 0]} user { /Type /Action /Subtype /Link /A
- << /S /URI /URI (#2) >>}\Blue #1\Black \pdfendlink % changed in 3.69
- \else \ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
+ attr {/Border [0 0 0]} user {/Type /Action /Subtype /Link /A
+ << /S /URI /URI (#2) >>}\PDFlinkcolor #1\Black \pdfendlink
+ \else\ifpdf{\setbox0=\hbox{\special{pdf: bc [ \pdflinkcolor ]}{#1}%
\special{pdf: ec}}\special{pdf: ann width \thewidth\space height \theheight
\space depth \thedepth\space << /Border [0 0 0]
/Type /Action /Subtype /Link /A << /S /URI /URI (#2) >> >>}\box0\relax}%
@@ -395,11 +395,10 @@
\def\stsec{\tenpoint\rightskip=0pt % get out of C mode (cf. \B)
\sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50
\noindent\strut{\let\*=\lapstar\bf\secno.\quad}%
- \ifpdftex\smash{\raise\baselineskip\hbox to0pt{%
- \let\*=\empty\pdfdest num \secstar fith}}%
- \else\ifpdf\smash{\raise\baselineskip\hbox to0pt{%
- \let\*=\empty\special{%
- pdf: dest (\romannumeral\secstar) [ @thispage /FitH @ypos ]}}}\fi\fi}
+ \ifacro \smash{\raise\baselineskip\hbox to0pt{\let\*=\empty
+ \ifpdftex \pdfdest num \secstar fith%
+ \else \special{pdf: dest (\romannumeral\secstar)
+ [ @thispage /FitH @ypos ]}\fi}}\fi}
\def\startsection{\titletrue
\line{\smash{\titlefont\title}\quad\hrulefill}\bigskip
\let\startsection=\stsec\stsec}
@@ -453,10 +452,17 @@
%{\noexpand\the\pageno}{\the\toksE}}}\next % \ZZ{title}{depth}{sec}{page}{ss}
\ifpdftex\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\fi
- \ifpdf\special{pdf: outline #1 << /Title (\the\toksE) /Dest
- [ @thispage /FitH @ypos ] >>}\fi
+ \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}
+\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
+ \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
+\def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
+ \expandafter\xdef\csname#1\endcsname{\the\countA}}
% \O is Scandinavian letter O-with-slash
% \P is paragraph sign
\def\Q{\note{This code is cited in section}} % xref for mention of a section
@@ -465,7 +471,7 @@
% \S is section sign
\def\T#1{\leavevmode % octal, hex or decimal constant
\hbox{$\def\?{\kern.2em}%$%
- \def\$##1{\egroup_{\rm##1}\bgroup}% suffix to constant
+ \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant
\def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick)
\let\~=\oct \let\^=\hex {#1}$}}%$%
\def\U{\note{This code is used in section}} % xref for use of a section
@@ -639,9 +645,8 @@
\let\inx=\flushout % No full index at the end
\def\fin{\parfillskip 0pt plus 1fil
- \ifpdftex \makebookmarks \fi
\gtitle={NAMES OF THE SECTIONS}
- \let\topsecno=\nullsec \let\next=\relax
+ \let\topsecno=\nullsec
\message{Section names:}
\def\note##1##2.{\quad{\eightrm##1~\ifacro{\pdfnote##2.}\else{##2}\fi.}}
\def\Q{\note{Cited in section}} % crossref for mention of a section
@@ -655,24 +660,15 @@
%\def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.%
%{\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}%
%\pdfoutline goto num \the\toksA \expandafter{\the\toksE}}
- %\else\ifpdf
- %\special{pdf: outline -1 << /Title (\outsecname)
+ %\else \special{pdf: outline -1 << /Title (\outsecname)
%/Dest [ @thispage /FitH @ypos ] >>}
%\def\X##1:##2\X{\Xpdf##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\fi
+ %\fi\fi
\readsections}
\def\readsections{\relax}%\input \jobname.scn}
-\def\makebookmarks{\relax}%\let\ZZ=\writebookmarkline \readcontents\relax}
-\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
- \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
-\def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
- \expandafter\xdef\csname#1\endcsname{\the\countA}}
-\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{}
@@ -690,7 +686,3 @@
\else\ifnum\pageno=\nextpage\getnextpage\let\next=\Shipout
\else\let\next=\Tosspage\fi\fi \next}
\newbox\garbage \def\Tosspage{\deadcycles=0\setbox\garbage=}
-\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
- \else \csname#1\endcsname \fi} % Petr Olsak's macros from texinfo.tex
-\def\advancenumber#1{\countA=\expnumber{#1}\relax \advance\countA by1
- \expandafter\xdef\csname#1\endcsname{\the\countA}}
More information about the tex-live-commits
mailing list.