texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7083] XeTeX @xref PDF link support


From: Masamichi Hosoda
Subject: [7083] XeTeX @xref PDF link support
Date: Tue, 29 Mar 2016 14:28:13 +0000

Revision: 7083
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7083
Author:   trueroad
Date:     2016-03-29 14:28:13 +0000 (Tue, 29 Mar 2016)
Log Message:
-----------
XeTeX @xref PDF link support

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/texinfo.tex

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2016-03-29 14:22:51 UTC (rev 7082)
+++ trunk/ChangeLog     2016-03-29 14:28:13 UTC (rev 7083)
@@ -1,5 +1,11 @@
 2016-03-29  Masamichi Hosoda  <address@hidden>
 
+       * doc/texinfo.tex (\skipspaces, \getfilename):
+       Copy from the definition for pdfTeX.
+       (\xrefX): Add XeTeX @xref PDF link support.
+
+2016-03-29  Masamichi Hosoda  <address@hidden>
+
        * doc/texinfo.tex (\pdfmkdest, \dopdfoutline):
        Add \txiescapepdf for XeTeX.
 

Modified: trunk/doc/texinfo.tex
===================================================================
--- trunk/doc/texinfo.tex       2016-03-29 14:22:51 UTC (rev 7082)
+++ trunk/doc/texinfo.tex       2016-03-29 14:28:13 UTC (rev 7083)
@@ -1626,6 +1626,20 @@
   % ``\special{pdf:dest ...}'' can not handle non-ASCII strings.
   % It fixed by xdvipdfmx 20160106 (TeX Live SVN r39753).
 %
+  \def\skipspaces#1{\def\PP{#1}\def\D{|}%
+    \ifx\PP\D\let\nextsp\relax
+    \else\let\nextsp\skipspaces
+      \addtokens{\filename}{\PP}%
+      \advance\filenamelength by 1
+    \fi
+    \nextsp}
+  \def\getfilename#1{%
+    \filenamelength=0
+    % If we don't expand the argument now, \skipspaces will get
+    % snagged on things like "@value{foo}".
+    \edef\temp{#1}%
+    \expandafter\skipspaces\temp|\relax
+  }
   % make a live url in pdf output.
   \def\pdfurl#1{%
     \begingroup
@@ -8762,6 +8776,7 @@
   %
   % Make link in pdf output.
   \ifpdf
+    % For pdfTeX and LuaTeX
     {\indexnofonts
      \turnoffactive
      \makevalueexpandable
@@ -8788,6 +8803,47 @@
      \fi
     }%
     \setcolor{\linkcolor}%
+  \else
+    \ifx\XeTeXrevision\thisisundefined
+    \else
+      % For XeTeX
+      {\indexnofonts
+       \turnoffactive
+       \makevalueexpandable
+       % This expands tokens, so do it after making catcode changes, so _
+       % etc. don't get their TeX definitions.  This ignores all spaces in
+       % #4, including (wrongly) those in the middle of the filename.
+       \getfilename{#4}%
+       %
+       % This (wrongly) does not take account of leading or trailing
+       % spaces in #1, which should be ignored.
+       \iftxiuseunicodedestname
+         \def\pdfxrefdest{#1}% Pass through Unicode characters.
+       \else
+         \edef\pdfxrefdest{#1}% Replace Unicode characters to ASCII.
+       \fi
+       \ifx\pdfxrefdest\empty
+         \def\pdfxrefdest{Top}% no empty targets
+       \else
+         \txiescapepdf\pdfxrefdest  % escape PDF special chars
+       \fi
+       %
+       \leavevmode
+       \ifnum\filenamelength>0
+         % By the default settings,
+         % XeTeX (xdvipdfmx) replaces link destination names with integers.
+         % In this case, the replaced destination names of
+         % remote PDF cannot be known. In order to avoid replacement,
+         % you can use commandline option `-C 0x0010' for xdvipdfmx.
+         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
+           << /S /GoToR /F (\the\filename.pdf) /D (name\pdfxrefdest) >> >>}%
+       \else
+         \special{pdf:bann << /Border [0 0 0] /Type /Annot /Subtype /Link /A
+           << /S /GoTo /D (name\pdfxrefdest) >> >>}%
+       \fi
+      }%
+      \setcolor{\linkcolor}%
+    \fi
   \fi
   {%
     % Have to otherify everything special to allow the \csname to




reply via email to

[Prev in Thread] Current Thread [Next in Thread]