Hyperlink Xeletex和tikz超链接节点不';似乎没有联系
我按照上的方法创建节点,这些节点是指向文档中其他位置的可单击链接。使用lualatex构建时,节点链接可以工作,但使用xelatex构建时,节点链接似乎根本不起作用——尽管它们确实按预期呈现在屏幕上(节点上的绿色覆盖显示正在调用Hyperlink Xeletex和tikz超链接节点不';似乎没有联系,hyperlink,tikz,xelatex,Hyperlink,Tikz,Xelatex,我按照上的方法创建节点,这些节点是指向文档中其他位置的可单击链接。使用lualatex构建时,节点链接可以工作,但使用xelatex构建时,节点链接似乎根本不起作用——尽管它们确实按预期呈现在屏幕上(节点上的绿色覆盖显示正在调用hyperlink节点,当我不调试时,它将消失) 我的MWE: \documentclass[10pt]{article} \usepackage{tikz} \usetikzlibrary{calc} \usepackage[colorlinks,linkcolor=g
hyperlink节点
,当我不调试时,它将消失)
我的MWE:
\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[colorlinks,linkcolor=green!50!black]{hyperref}
\tikzset{
hyperlink node/.style={
alias=sourcenode,
append after command={
let \p1 = (sourcenode.north west),
\p2=(sourcenode.south east),
\n1={\x2-\x1},
\n2={\y1-\y2} in
node [draw=green!50!black,rounded corners,opacity=0.5,fill=green,inner sep=0pt,outer sep=0pt,anchor=north west,at=(\p1)] {\hyperlink{#1}{\phantom{\rule{\n1}{\n2}}}}
}
},
mynode/.style={rectangle, rounded corners, fill=white,draw=black},
edge/.style={>=Stealth},
}
\begin{document}
\begin{tikzpicture}
\node [mynode] (a) {Not a link};
\node [mynode,hyperlink node=LinkHere] (b) [right=30mm] {This is a link};
\path (a) -> (b);
\end{tikzpicture}
In text, though:
Not a link.
\hyperlink{LinkHere}{This is a link} also
\clearpage
This page deliberately left blank.
\clearpage
\hypertarget{LinkHere}{}
Link lands here.
\end{document}
使用Xeletex构建,单击绿色节点不会将我带到第三页,但单击文本链接(下面的绿色文本“这是一个链接”)会将我带到第三页。当我使用lualatex构建PDF时,这两个超链接都有效
为什么这在lualatex中有效,但在xelatex中无效,我能做些什么?另外,我喜欢Xeletex的输出(布局和字体呈现略有不同),但链接很重要。使用Xeletex构建时,如何使超链接节点正常工作
使用
- XeTeX 3.1415926-2.5-0.9999.3-2013060708(TeX Live 2013)
- LuaTeX,版本beta-0.76.0-2013061708(TeX Live 2013)(版本4627)
$ xelatex mwe.tex; mv mwe.pdf mwe-xelatex.pdf
$ lualatex mwe.tex; mv mwe.pdf mwe-lualatex.pdf
我刚刚确定使用navigator.sty
包而不是hyperref.sty
在使用\jumplink
和\anchor
而不是\hyperlink
和\hypertarget时表现出相同的行为差异
TL;DR:用替换\hyperlink{1}{\phantom{\rule{\n1}{\n2}}}}
\hyperlink{{1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}
我在下面添加了工作(文本)链接:
这和我在超链接节点中的功能差不多。规则以绿色呈现,因为它是一个\hyperlink
,但在使用Xeletex编译PDF时单击它没有任何作用。问题不在于Xeletex和TikZ,而在于Xeletex和hyperref.sty
。Per xelatex仅在找到文本时链接
\XeTeXLinkBox
被添加到hyperref.sty
中,专门用于处理此问题。您仍然需要使用\phantom{}
来隐藏规则
比MWE稍多一些,它做了我想做的事情,并演示了使用\XeTeXLinkBox
和不使用它的区别
\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[colorlinks,linkcolor=green!50!black]{hyperref}
\setlength{\XeTeXLinkMargin}{0pt}
\tikzset{
hyperlink node/.style={
alias=sourcenode,
append after command={
let \p1 = (sourcenode.north west),
\p2=(sourcenode.south east),
\n1={\x2-\x1},
\n2={\y1-\y2} in
node [draw=green!50!black,rounded corners,opacity=0.5,fill=green,inner sep=0pt,outer sep=0pt,anchor=north west,at=(\p1)] {\hyperlink{#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
}
},
mynode/.style={rectangle, rounded corners, fill=white,draw=black},
edge/.style={>=Stealth},
}
\begin{document}
\begin{tikzpicture}
\node [mynode] (a) {Not a link};
\node [mynode,hyperlink node=LinkHere] (b) [right=30mm] {This is a link};
\path (a) -> (b);
\end{tikzpicture}
In text, though:
Not a link.
\hyperlink{LinkHere}{This is a link} also
---
\hyperlink{LinkHere}{test\ldots \rule{1in}{1in}\ldots big green box doesn't work, text does}
---
\hyperlink{LinkHere}{test\ldots \XeTeXLinkBox{\rule{1in}{1in}}\ldots big green box now \emph{does} work, and so does text}
---
\clearpage
This page deliberately left blank.
\clearpage
\hypertarget{LinkHere}{}
Link lands here.
\end{document}
\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[colorlinks,linkcolor=green!50!black]{hyperref}
\setlength{\XeTeXLinkMargin}{0pt}
\tikzset{
hyperlink node/.style={
alias=sourcenode,
append after command={
let \p1 = (sourcenode.north west),
\p2=(sourcenode.south east),
\n1={\x2-\x1},
\n2={\y1-\y2} in
node [draw=green!50!black,rounded corners,opacity=0.5,fill=green,inner sep=0pt,outer sep=0pt,anchor=north west,at=(\p1)] {\hyperlink{#1}{\XeTeXLinkBox{\phantom{\rule{\n1}{\n2}}}}}
}
},
mynode/.style={rectangle, rounded corners, fill=white,draw=black},
edge/.style={>=Stealth},
}
\begin{document}
\begin{tikzpicture}
\node [mynode] (a) {Not a link};
\node [mynode,hyperlink node=LinkHere] (b) [right=30mm] {This is a link};
\path (a) -> (b);
\end{tikzpicture}
In text, though:
Not a link.
\hyperlink{LinkHere}{This is a link} also
---
\hyperlink{LinkHere}{test\ldots \rule{1in}{1in}\ldots big green box doesn't work, text does}
---
\hyperlink{LinkHere}{test\ldots \XeTeXLinkBox{\rule{1in}{1in}}\ldots big green box now \emph{does} work, and so does text}
---
\clearpage
This page deliberately left blank.
\clearpage
\hypertarget{LinkHere}{}
Link lands here.
\end{document}