[tex-eplain] Miscellaneous patch for hyperlinks

geolsoft at mail.ru geolsoft at mail.ru
Mon Aug 15 16:02:55 CEST 2005


Dear list members,

This is another patch for the hyperlinks.  It changes some
macro names according to the suggestion from Karl Berry
(e.g., \idxhl -> \hlidx), adds the \write-1's, \leavevmode's
and \ignorespaces's to hyperlink macros of nolinks driver,
and updates some comments.

-- 
Best regards,
Oleg Katsitadze
-------------- next part --------------
--- eplain2.8.4.patched/xeplain.tex	2005-08-13 21:37:15.000000000 +0300
+++ eplain2.8.4/xeplain.tex	2005-08-15 09:41:30.000000000 +0300
@@ -399,7 +399,7 @@
 \def\biblabelprint#1{%
    \noindent
    \hbox to \biblabelwidth{%
-      \hldest{\bibhldesttype}{\bibhldestopts,raise=\bibhldestraise}{\@hlbblitemlabel}%
+      \hldest{\hldestbibtype}{\hldestbibopts,raise=\hldestbibraise}{\@hlbblitemlabel}%
       \biblabelprecontents
       \biblabelcontents{#1}%
       \biblabelpostcontents
@@ -410,7 +410,7 @@
 % To avoid unnecessary warnings about undefined destinations (e.g.,
 % from pdfTeX), produce the link only when .bbl file (which does the
 % \hldest's) is present.
-\def\eplainprintcitepreitem#1{\hlstart{\citehltype}{\citehlopts}{#1}}%
+\def\eplainprintcitepreitem#1{\hlstart{\hlcitetype}{\hlciteopts}{#1}}%
 \def\eplainprintcitepostitem{\hlend}%
 %
 %
@@ -1068,7 +1068,7 @@
   % Add hyperlink destination in front of \marker before doing \printitem.
   \begingroup
     \ifx\@lioptarg\empty \else
-      \toks@ = {\hldest{\lihldesttype}{\lihldestopts,raise=\lihldestraise}}%
+      \toks@ = {\hldest{\hldestlitype}{\hldestliopts,raise=\hldestliraise}}%
       \toks at ii = \expandafter{\@lioptarg}%
       \let\li at nohldest@marker\marker
       \edef\marker{\the\toks@{\the\toks at ii}\noexpand\li at nohldest@marker}%
@@ -1457,9 +1457,9 @@
 % 
 \def\xrdef#1{%
   \begingroup
-    \let\definexrefhldesttype\xrdefhldesttype
-    \let\definexrefhldestopts\xrdefhldestopts
-    \let\definexrefhldestraise\xrdefhldestraise
+    \let\hldestdefinexreftype\hldestxrdeftype
+    \let\hldestdefinexrefopts\hldestxrdefopts
+    \let\hldestdefinexrefraise\hldestxrdefraise
     \definexref{#1}{\noexpand\folio}{page}%
   \endgroup
 }%
@@ -1472,8 +1472,8 @@
 % 
 \def\definexref#1#2#3{%
   % Define a hyperlink destination LABEL.
-  \hldest{\definexrefhldesttype}
-         {\definexrefhldestopts,raise=\definexrefhldestraise}
+  \hldest{\hldestdefinexreftype}
+         {\hldestdefinexrefopts,raise=\hldestdefinexrefraise}
          {#1}%
   % Remember what we're given; it might be `\@optionalarg', which
   % \readauxfile trashes.  (No loss of generality here, since \csname
@@ -1516,7 +1516,7 @@
 \def\xrefn{\@getoptionalarg\@finxrefn}%
 \def\@finxrefn#1{%
   % Hyperlink and optional TEXT.
-  \hlstart{\xrefnhltype}{\xrefnhlopts}{#1}%
+  \hlstart{\hlxrefntype}{\hlxrefnopts}{#1}%
   \ifx\@optionalarg\empty \else
     % Save \@optionalarg before it is trashed by \readauxfile.
     \let\@xrefnoptarg\@optionalarg
@@ -1566,7 +1566,7 @@
 \def\xref{\@getoptionalarg\@finxref}%
 \def\@finxref#1{%
   % Hyperlink and optional TEXT.
-  \hlstart{\xrefhltype}{\xrefhlopts}{#1}%
+  \hlstart{\hlxreftype}{\hlxrefopts}{#1}%
   \ifx\@optionalarg\empty \else
     {\hloff\@optionalarg}\refspace
   \fi
@@ -1621,7 +1621,7 @@
   % Get the class of the label.
   \edef\temp{\getproperty{\xrlabel{#3}}{class}}%
   % Maybe start hyperlink here.
-  \ifcase#1 \else \hlstart{\refhltype}{\refhlopts}{#3}\fi
+  \ifcase#1 \else \hlstart{\hlreftype}{\hlrefopts}{#3}\fi
   % If the word for this class is not defined, don't complain.
   \expandafter\ifx\csname \temp word\endcsname\relax
     % Produce \@optionalarg followed by a \reftie, if \@optionalarg is
@@ -1639,7 +1639,7 @@
     \endgroup
   \fi
   % Maybe start hyperlink here.
-  \ifcase#1 \hlstart{\refhltype}{\refhlopts}{#3}\fi
+  \ifcase#1 \hlstart{\hlreftype}{\hlrefopts}{#3}\fi
   % Typeset the reference omitting hyperlinks.
   \plain at xrefn{#3}%
   \hlend
@@ -1753,8 +1753,8 @@
 % 
 \def\@eqdefn#1#2{%
   % Define hyperlink destination taking care of empty LABEL.
-  \define at hl@eqlabel{#1}%
-  \hldest{\eqhldesttype}{\eqhldestopts,raise=\eqhldestraise}{\hl at eqlabel}%
+  \hl at define@eqlabel{#1}%
+  \hldest{\hldesteqtype}{\hldesteqopts,raise=\hldesteqraise}{\hl at eqlabel}%
   % Define cross-reference but not hyperlink destination.
   \begingroup
     \hldestoff
@@ -1787,16 +1787,16 @@
 \def\@eqdef#1#2{%
   % Define the label but not hyperlink destination (we want to define
   % the destination after \eqno).  Note that \@eqdefn will call
-  % \define at hl@eqlabel{#2}, so we won't call it again (definintions in
-  % \define at hl@eqlabel must be global to survive past the group).
+  % \hl at define@eqlabel{#2}, so we won't call it again (definintions in
+  % \hl at define@eqlabel must be global to survive past the group).
   \begingroup
     \hldestoff
     #1{#2}%
   \endgroup
   % Define hyperlink destination and print the text.
   \@maybedisableeqno
-  \eqno % \define at hl@eqlabel already called in \@eqdefn.
-        \hldest{\eqhldesttype}{\eqhldestopts,raise=\eqhldestraise}{\hl at eqlabel}%
+  \eqno % \hl at define@eqlabel already called in \@eqdefn.
+        \hldest{\hldesteqtype}{\hldesteqopts,raise=\hldesteqraise}{\hl at eqlabel}%
         \let\@optionalarg\empty % \@fineqref will examine \@optionalarg.
         {\hloff\@fineqref{#2}}% No hyperlink here.
   \@mayberestoreeqno
@@ -1855,9 +1855,9 @@
   \let\@eqrefoptarg\@optionalarg
   % Hyperlink (fetch last `phantom' equation label if LABEL is empty).
   \ifempty{#1}%
-    \hlstart{\eqhltype}{\eqhlopts}{\phantomeqlabel}%
+    \hlstart{\hleqtype}{\hleqopts}{\phantomeqlabel}%
   \else
-    \hlstart{\eqhltype}{\eqhlopts}{#1}%
+    \hlstart{\hleqtype}{\hleqopts}{#1}%
   \fi
   % Optional TEXT followed by a \reftie.
   \ifx\@eqrefoptarg\empty \else
@@ -2030,7 +2030,7 @@
   \expandafter\ifx\csname\xrlabel{\idxpagexref{\folio}}\endcsname\relax \else
     % Say \hldeston in case a page break happened at an unfortunate time when
     % user said \hldestoff.
-    {\hldeston \hldest{\idxhldesttype}{\idxhldestopts}{\idxhlpagelabel{\folio}}}%
+    {\hldeston \hldest{\hldestidxtype}{\hldestidxopts}{\hlidxpagelabel{\folio}}}%
   \fi
   \indexproofunbox
   \@plainmakeheadline
@@ -2080,7 +2080,7 @@
 \def\idxseecmdword{see}%
 \def\idxseealsocmdword{seealso}%
 \newif\if at idxsee
-\newif\if at idxhlencap
+\newif\if at hlidxencap
 \let\@idxseenterm = \relax
 %
 \def\idxpagemarkupcmdword{pagemarkup}%
@@ -2092,7 +2092,7 @@
   \@getoptionalarg\@finidxgetopt
 }%
 \def\@finidxgetopt{%
-  \@idxhlencaptrue
+  \@hlidxencaptrue
   %
   \for\@idxarg:=\@optionalarg\do{%
     % These are ordered by my guess at frequency of use.
@@ -2103,17 +2103,17 @@
     \else
       \ifx\@idxarg\idxrangeendword
         \def\@idxrangestr{\idxencapoperator\idxendrangemark}%
-        \@idxhlencapfalse
+        \@hlidxencapfalse
       \else
         \ifx\@idxarg\idxseecmdword
           \def\@idxpagemarkup{indexsee}%
           \@idxseetrue
-          \@idxhlencapfalse
+          \@hlidxencapfalse
         \else
           \ifx\@idxarg\idxseealsocmdword
             \def\@idxpagemarkup{indexseealso}%
             \@idxseetrue
-            \@idxhlencapfalse
+            \@hlidxencapfalse
           \else
              \ifx\@idxpagemarkup\relax
                \errmessage{Unrecognized index option `\@idxarg'}%
@@ -2124,28 +2124,28 @@
     \fi
   }%
   % Stick hyperlink encapsulator into \@idxpagemarkup.
-  \ifnum\idxhldestplace < 0 \else
-    \if at idxhlencap
+  \ifnum\hldestidxplace < 0 \else
+    \if at hlidxencap
       \ifx\@idxpagemarkup\relax
         % Even when user gives no pagemarkup command, we still do
         % insert our hyperlink encapsulator.
         \let\@idxpagemarkup\empty
       \fi
-      \ifcase\idxhldestplace
-        % \idxhldestplace = 0, dests point to a page with a term.
-        \edef\@idxpagemarkup{idxhlpage{\@idxpagemarkup}}%
+      \ifcase\hldestidxplace
+        % \hldestidxplace = 0, dests point to a page with a term.
+        \edef\@idxpagemarkup{hlidxpage{\@idxpagemarkup}}%
         % We want to define index \hldest's only on those
         % pages which contain at least one index term, so this
         % `cross-reference' will tell \makeheadline on which pages to
         % generate an \hldest.
         {\hldestoff \definexref{\idxpagexref{\folio}}{}{}}%
       \or
-        % \idxhldestplace = 1, dests point to exact location of a term.
-        \global\advance\idxhllabelnumber by 1
-        \edef\@idxpagemarkup{idxhl{\idxhllabel}{\@idxpagemarkup}}%
-        \hldest{\idxhldesttype}{\idxhldestopts,raise=\idxhldestraise}{\idxhllabel}%
+        % \hldestidxplace = 1, dests point to exact location of a term.
+        \global\advance\hlidxlabelnumber by 1
+        \edef\@idxpagemarkup{hlidx{\hlidxlabel}{\@idxpagemarkup}}%
+        \hldest{\hldestidxtype}{\hldestidxopts,raise=\hldestidxraise}{\hlidxlabel}%
       \else
-        \errmessage{Invalid \string\idxhldestplace\space setting
+        \errmessage{Invalid \string\hldestidxplace\space setting
                     (sould be 0, 1 or negative)}%
       \fi
     \fi
@@ -2172,31 +2172,31 @@
 }%
 %
 %
-% \idxhlpage and \idxhl are hyperlink encapsulators for the two types
+% \hlidxpage and \hlidx are hyperlink encapsulators for the two types
 % of hyperlink destinations for index terms.
 %
-% \idxhldestplace defines which type is selected.  When defined to 0,
+% \hldestidxplace defines which type is selected.  When defined to 0,
 % we generate destinations pointing to the page on which the indexed
 % term is located.  When defined to 1, we generate destinations
 % pointing to exact location of the indexed term.  When negative, we
 % generate no hyperlinks / destinations.
-\def\idxhldestplace{-1}%
+\def\hldestidxplace{-1}%
 % Name for a `cross-reference' which \makeheadline uses do decide on
 % which pages to generate \hldest.
 \def\idxpagexref#1{@@IDXPG@@#1}%
 % Hyperlink labels for both types of destinations.
-\newcount\idxhllabelnumber
-\def\idxhllabel{IDX\the\idxhllabelnumber}%
-\def\idxhlpagelabel#1{IDXPG#1}%
-%
-% \idxhl{HYPERLINK-LABEL}{PAGEENCAP}{PAGESPEC}
-\def\idxhl#1#2#3{%
-  \hlstart{\idxhltype}{\idxhlopts}{#1}%
+\newcount\hlidxlabelnumber
+\def\hlidxlabel{IDX\the\hlidxlabelnumber}%
+\def\hlidxpagelabel#1{IDXPG#1}%
+%
+% \hlidx{HYPERLINK-LABEL}{PAGEENCAP}{PAGESPEC}
+\def\hlidx#1#2#3{%
+  \hlstart{\hlidxtype}{\hlidxopts}{#1}%
   \csname #2\endcsname{#3}%
   \hlend
 }%
 %
-% \idxhlpage{PAGEENCAP}{PAGESPEC}
+% \hlidxpage{PAGEENCAP}{PAGESPEC}
 %
 % We expect PAGESPEC to be one of the following:
 %   14          (single page number)
@@ -2218,25 +2218,25 @@
 % In case of a page range, we do not break the range, call \PAGEENCAP
 % on the entire range and turn what results into a hyperlink for the
 % first of the page numbers.
-\def\idxhlpage#1#2{%
+\def\hlidxpage#1#2{%
   % Set \@idxpagei[i][ref] and \@idxpagesep
-  \@idxhlgetpages{#2}%
+  \@hlidxgetpages{#2}%
   % Alias for \PAGEENCAP.
   \expandafter\let\expandafter\@idxpageencap\csname #1\endcsname
   % Now comes the first part, to be done in any of the three cases.
-  \hlstart{\idxhltype}{\idxhlopts}{\idxhlpagelabel{\@idxpageiref}}%
+  \hlstart{\hlidxtype}{\hlidxopts}{\hlidxpagelabel{\@idxpageiref}}%
   \expandafter\@idxpageencap\expandafter{\@idxpagei}%
   \hlend
   % The second part, to be done only if there is a second page number.
   \ifx\@idxpageii\empty \else
     \@idxpagesep
-    \hlstart{\idxhltype}{\idxhlopts}{\idxhlpagelabel{\@idxpageiiref}}%
+    \hlstart{\hlidxtype}{\hlidxopts}{\hlidxpagelabel{\@idxpageiiref}}%
     \expandafter\@idxpageencap\expandafter{\@idxpageii}%
     \hlend
   \fi
 }%
 %
-% This macro parses PAGESPEC parameter to \idxhlpage.  It sets
+% This macro parses PAGESPEC parameter to \hlidxpage.  It sets
 % \@idxpagei to the first page number, \@idxpageii to the second (if
 % present; if not, \@idxpageii will be set to \empty).  For the first
 % page number, use \@idxpageiref to construct hyperlink label; for
@@ -2246,7 +2246,7 @@
 % NOTE:  we use \@idxpagei[i], not \idxpagei[i], because the user may
 % use \idxparselist / \idxparserange in his \PAGEENCAP, in which case
 % our \idxpagei[i]'s will get garbled.
-\def\@idxhlgetpages#1{%
+\def\@hlidxgetpages#1{%
   % Try to parse a two-page list.
   \idxparselist{#1}%
   \ifx\idxpagei\empty
@@ -2813,7 +2813,7 @@
 % the space after the rule is \belowfootnoterulespace.
 % 
 \newcount\footnotenumber
-\newcount\foothllabelnumber
+\newcount\hlfootlabelnumber
 \newdimen\footnotemarkseparation \footnotemarkseparation = .5em
 \newskip\interfootnoteskip \interfootnoteskip = 0pt
 \newtoks\everyfootnote
@@ -2824,14 +2824,14 @@
 \let\@plainfootnote = \footnote
 \let\@plainvfootnote = \vfootnote
 % Hyperlink labels for forward and back references.
-\def\foothllabel{FOOT\the\foothllabelnumber}%
-\def\footbackhllabel{FOOTB\the\foothllabelnumber}%
+\def\hlfootlabel{FOOT\the\hlfootlabelnumber}%
+\def\hlfootbacklabel{FOOTB\the\hlfootlabelnumber}%
 %
 \def\@eplainfootnote#1{\let\@sf\empty % parameter #2 (the text) is read later
   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
-  \global\advance\foothllabelnumber by 1
-  \hlstart{\foothltype}{\foothlopts}{\foothllabel}%
-  \hldest{\footbackhldesttype}{\footbackhldestopts,raise=\footbackhldestraise}{\footbackhllabel}%
+  \global\advance\hlfootlabelnumber by 1
+  \hlstart{\hlfoottype}{\hlfootopts}{\hlfootlabel}%
+  \hldest{\hldestfootbacktype}{\hldestfootbackopts,raise=\hldestfootbackraise}{\hlfootbacklabel}%
   #1%
   \hlend
   \@sf\vfootnote{#1}%
@@ -2855,8 +2855,8 @@
   \the\everyfootnote
   \vskip\interfootnoteskip
   \indent\llap{%
-    \hlstart{\footbackhltype}{\footbackhlopts}{\footbackhllabel}%
-    \hldest{\foothldesttype}{\foothldestopts,raise=\foothldestraise}{\foothllabel}%
+    \hlstart{\hlfootbacktype}{\hlfootbackopts}{\hlfootbacklabel}%
+    \hldest{\hldestfoottype}{\hldestfootopts,raise=\hldestfootraise}{\hlfootlabel}%
     #1%
     \hlend
     \kern\footnotemarkseparation
@@ -3343,53 +3343,53 @@
 % link options (which are driver-specific).
 %
 % Types of destinations.
-\let\definexrefhldesttype\empty
-\let\xrdefhldesttype\empty
-\let\lihldesttype\empty
-\let\eqhldesttype\empty % \eqdef and friends
-\let\bibhldesttype\empty % \biblabelprint (BibTeX)
-\let\foothldesttype\empty % \footnote / \numberedfootnote
-\let\footbackhldesttype\empty % back-reference for \footnote / \numberedfootnote
-\let\idxhldesttype\empty % both `page' dests and `exact' dests
+\let\hldestdefinexreftype\empty
+\let\hldestxrdeftype\empty
+\let\hldestlitype\empty
+\let\hldesteqtype\empty % \eqdef and friends
+\let\hldestbibtype\empty % \biblabelprint (BibTeX)
+\let\hldestfoottype\empty % \footnote / \numberedfootnote
+\let\hldestfootbacktype\empty % back-reference for \footnote / \numberedfootnote
+\let\hldestidxtype\empty % both `page' dests and `exact' dests
 % Options for destinations.
-\let\definexrefhldestopts\empty
-\let\xrdefhldestopts\empty
-\let\lihldestopts\empty
-\let\eqhldestopts\empty % \eqdef and friends
-\let\bibhldestopts\empty % \biblabelprint (BibTeX)
-\let\foothldestopts\empty % \footnote / \numberedfootnote
-\let\footbackhldestopts\empty % back-reference for \footnote / \numberedfootnote
-\let\idxhldestopts\empty % both `page' dests and `exact' dests
+\let\hldestdefinexrefopts\empty
+\let\hldestxrdefopts\empty
+\let\hldestliopts\empty
+\let\hldesteqopts\empty % \eqdef and friends
+\let\hldestbibopts\empty % \biblabelprint (BibTeX)
+\let\hldestfootopts\empty % \footnote / \numberedfootnote
+\let\hldestfootbackopts\empty % back-reference for \footnote / \numberedfootnote
+\let\hldestidxopts\empty % both `page' dests and `exact' dests
 % We want to control the option `raise' separately because the other
 % options are usually set once and for all while `raise' may need
 % adjustment per instance (especially with equations).
-\def\definexrefhldestraise{\normalbaselineskip}%
-\def\xrdefhldestraise{\normalbaselineskip}%
-\def\lihldestraise{\normalbaselineskip}%
-\def\eqhldestraise{1.7\normalbaselineskip}% \eqdef and friends
-\def\bibhldestraise{\normalbaselineskip}% \biblabelprint (BibTeX)
-\def\foothldestraise{\normalbaselineskip}% \footnote / \numberedfootnote
-\def\footbackhldestraise{\normalbaselineskip}% back-reference for \footnote / \numberedfootnote
-\def\idxhldestraise{\normalbaselineskip}% only `exact' dests (`page' dests are in vertical mode)
+\def\hldestdefinexrefraise{\normalbaselineskip}%
+\def\hldestxrdefraise{\normalbaselineskip}%
+\def\hldestliraise{\normalbaselineskip}%
+\def\hldesteqraise{1.7\normalbaselineskip}% \eqdef and friends
+\def\hldestbibraise{\normalbaselineskip}% \biblabelprint (BibTeX)
+\def\hldestfootraise{\normalbaselineskip}% \footnote / \numberedfootnote
+\def\hldestfootbackraise{\normalbaselineskip}% back-reference for \footnote / \numberedfootnote
+\def\hldestidxraise{\normalbaselineskip}% only `exact' dests (`page' dests are in vertical mode)
 %
 % Types of links.
-\let\xrefnhltype\empty % \refn and \xrefn
-\let\xrefhltype\empty
-\let\refhltype\empty % \ref and \refs
-\let\eqhltype\empty % \eqref and \eqrefn
-\let\citehltype\empty % \cite (BibTeX)
-\let\foothltype\empty % \footnote / \numberedfootnote
-\let\footbackhltype\empty % back-reference for \footnote / \numberedfootnote
-\let\idxhltype\empty
+\let\hlxrefntype\empty % \refn and \xrefn
+\let\hlxreftype\empty
+\let\hlreftype\empty % \ref and \refs
+\let\hleqtype\empty % \eqref and \eqrefn
+\let\hlcitetype\empty % \cite (BibTeX)
+\let\hlfoottype\empty % \footnote / \numberedfootnote
+\let\hlfootbacktype\empty % back-reference for \footnote / \numberedfootnote
+\let\hlidxtype\empty
 % Options for links.
-\let\xrefnhlopts\empty % \refn and \xrefn
-\let\xrefhlopts\empty
-\let\refhlopts\empty % \ref and \refs
-\let\eqhlopts\empty % \eqref and \eqrefn
-\let\citehlopts\empty % \cite (BibTeX)
-\let\foothlopts\empty % \footnote / \numberedfootnote
-\let\footbackhlopts\empty % back-reference for \footnote / \numberedfootnote
-\let\idxhlopts\empty
+\let\hlxrefnopts\empty % \refn and \xrefn
+\let\hlxrefopts\empty
+\let\hlrefopts\empty % \ref and \refs
+\let\hleqopts\empty % \eqref and \eqrefn
+\let\hlciteopts\empty % \cite (BibTeX)
+\let\hlfootopts\empty % \footnote / \numberedfootnote
+\let\hlfootbackopts\empty % back-reference for \footnote / \numberedfootnote
+\let\hlidxopts\empty
 %
 % Hyperlink destinations (driver-independent code).
 %
@@ -3524,10 +3524,10 @@
   \ifx\@optionalarg\empty
     % The user did not specify a driver, detect.
     \ifpdf
-      \def\@selectedhldriver{pdftex}%
+      \def\hl at selecteddriver{pdftex}%
       \message{^^JUsing `pdftex' hyperlink driver.}%
     \else
-      \def\@selectedhldriver{dvipdfm}%
+      \def\hl at selecteddriver{dvipdfm}%
       \message{^^JUsing `dvipdfm' hyperlink driver.}%
     \fi
   \else
@@ -3536,12 +3536,12 @@
     \expandafter\ifx\csname hldriver@\@optionalarg\endcsname \relax
       \errmessage{No hyperlink driver `\@optionalarg' available}%
     \fi
-    \let\@selectedhldriver\@optionalarg
+    \let\hl at selecteddriver\@optionalarg
   \fi
   % Call the driver's initialization routine.
-  \csname hldriver@\@selectedhldriver\endcsname
+  \csname hldriver@\hl at selecteddriver\endcsname
   % Driver should not be changed later.
-  \def\@finenablehyperlinks{\errmessage{Hyperlink driver `\@selectedhldriver'
+  \def\@finenablehyperlinks{\errmessage{Hyperlink driver `\hl at selecteddriver'
                                         already selected}}%
   % Free memory taken up by the drivers.
   \let\hldriver at nolinks\undefined
@@ -3557,7 +3557,7 @@
   \hlon \hldeston
   % By default we generate index hyperlink destination pointing to the
   % page on which the term is located.
-  \def\idxhldestplace{0}%
+  \def\hldestidxplace{0}%
 }%
 %
 % Driver `nolinks'.
@@ -3577,34 +3577,46 @@
 %
 % If instead you have prepared a document with links and just want to
 % compile a version without the links, it is better to select the
-% driver `nolinks'.
+% driver `nolinks'.  This will ensure that spacing and pagebreaking
+% will be the same as what you were getting with hyperlinks enabled.
 %
-% The reason is that in horizontal mode \hldest places destinations
-% inside zero-width/height/depth boxes.  When you say \hldestoff,
-% \hldest will omit both destination specs and these boxes.  The
-% missing boxes can cause typesetting to be inconsistent with what you
-% were getting with destinations enabled.  However, if you use the
-% driver `nolinks' to suppress the destinations / links, the empty
-% boxes, without the destinations, are still produced ensuring
-% identical (well, almost) typesetting.
-%
-% Note that in vertical mode destinations, which are usually
-% \special's, are output directly, without any boxes.  Whichever
-% method you use to suppress the destinations, these \special's are
-% not produced.  Therefore take extra care with destinations in
-% vertical mode.  Lack of the \special's may have some implications
-% with destinations / links in horizontal mode, too.
+% The reason for this is that hyperlinks are produced by \special
+% commands.  Each \special is placed inside a whatsit which may
+% introduce a legitimate breakpoint at places where none would exist
+% without the whatsit.  The macros \hldestoff and \hloff disable
+% hyperlink macros so drastically that no whatsits are produced.
+%
+% On the other hand, `nolinks' driver does not completely disable
+% hyperlink macros.  Instead, it defines them to write to the log
+% file (what gets written is not really important).  This will produce
+% the whatsits imitating the whatsits from the \special's.  (This
+% trick was borrowed from graphics bundle.)
+%
+% Another reason for using `nolinks' is that in horizontal mode
+% \hldest places destinations inside zero-width/height/depth boxes.
+% When you say \hldestoff, \hldest will omit both destination specs
+% and these boxes.  The missing boxes can cause typesetting to be
+% inconsistent with what you were getting with destinations enabled.
+% Again, `nolinks' driver helps here by defining \hldest to still
+% produce the empty boxes.
 %
 \def\hldriver at nolinks{%
   \def\@hldest##1##2##3{%
-    \ifhmode
+    \ifvmode
+      \write-1{\string\hldest: ##3}%
+    \else
       \allowhyphens
-      \null
+      \smash{\write-1{\string\hldest: ##3}}%
       \allowhyphens
     \fi
+    \ignorespaces
+  }%
+  \def\@hlstart##1##2##3{%
+    \leavevmode
+    \write-1{\string\hlstart: ##3}%
+    \ignorespaces
   }%
-  \let\@hlstart\gobblethree
-  \let\@hlend\relax
+  \def\@hlend{\write-1{\string\hlend}}%
 }%
 %
 % Driver `pdftex'.
@@ -3978,7 +3990,7 @@
 %
 % Internal hyperlink macros.
 %
-% \define at hl@eqlabel{LABEL} will define \hl at eqlabel to a non-empty
+% \hl at define@eqlabel{LABEL} will define \hl at eqlabel to a non-empty
 % hyperlink label for an equation.  The idea is to generate
 % (hopefully) unique label in cases when LABEL is empty (e.g., when
 % user says `\eqdef{}').  To customize the autogenerated labels
@@ -3987,7 +3999,7 @@
 \newcount\phantomeqnumber
 \def\phantomeqlabel{PHEQ\the\phantomeqnumber}%
 %
-\def\define at hl@eqlabel#1{%
+\def\hl at define@eqlabel#1{%
   % Make all definitions global so they are not shadowed by groups
   % (\@eqdef depends on this).
   \ifempty{#1}%


More information about the tex-eplain mailing list