在以下示例中,单击两个块上的文本将带我们进入第二部分或该部分内的一段文本。我希望能够使用连接两个块的边缘进行导航,也就是说,我希望单击边缘并转到 或label
。hypertarget
这可行吗?
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes}
\usepackage{hyperref}
\begin{document}
\section{First section}
\begin{tikzpicture}
\node[draw, rectangle] (A) {\hyperlink{gotext}{Go to linked text}};
\node[draw, rectangle, right=of A] (B) {\hyperref[sec:mysection]{Go to 2nd section}};
\draw (A) -- (B); % The edge I want to click on to navigate.
\end{tikzpicture}
\newpage
\section{Second section}
\label{sec:mysection}
Corruption can occur on different scales. There is corruption that occurs as small favours between a small number of people (petty corruption), corruption that affects the government on a large scale (grand corruption), and corruption that is so prevalent that it is part of the every day structure of society, including corruption as one of the symptoms of organized crime (systemic corruption).
Judicial corruption refers to corruption related misconduct of judges, through receiving or giving bribes, improper sentencing of convicted criminals, bias in the hearing and judgement of arguments and other such misconduct.
\hypertarget{gotext}{%
Governmental corruption} of judiciary is broadly known in many transitional and developing countries because the budget is almost completely controlled by the executive. The latter undermines the separation of powers, as it creates a critical financial dependence of the judiciary. The proper national wealth distribution including the government spending on the judiciary is subject of the constitutional economics.
\newpage
empty page
\end{document}
这个问题虽然我无法理解那里发生的事情,但在某种程度上与我想要的有关。
答案1
这是一些发夹曲线。
\path let \p1=(A.east),
\p2=(B.west) ,
\n1={veclen(\x2-\x1,\y2-\y1)} in
node[outer sep=0pt,inner xsep=0pt,align=left,anchor=west,minimum width=\n1,minimum height=1ex]
at (A.east) (link) {\hyperlink{gotext}{\hphantom{\hspace*{\n1}}}};
完整代码:
\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,calc}
\usepackage{hyperref}
\begin{document}
\section{First section}
\begin{tikzpicture}
\node[draw, rectangle] (A) {{Go to linked text}};
\node[draw, rectangle, right=of A] (B) {\hyperref[sec:mysection]{Go to 2nd section}};
\path let \p1=(A.east),
\p2=(B.west) ,
\n1={veclen(\x2-\x1,\y2-\y1)} in
node[outer sep=0pt,inner xsep=0pt,align=left,anchor=west,minimum width=\n1,minimum height=1ex] at (A.east) (link) {\hyperlink{gotext}{\hphantom{\hspace*{\n1}}}};
% \node[minimum width={veclen(A.east-B.west)}] at (A.east) {\hyperlink{gotext}{}};
\draw (A) -- (B); % The edge I want to click on to navigate.
\end{tikzpicture}
\newpage
\section{Second section}
\label{sec:mysection}
Corruption can occur on different scales. There is corruption that occurs as small favours between a small number of people (petty corruption), corruption that affects the government on a large scale (grand corruption), and corruption that is so prevalent that it is part of the every day structure of society, including corruption as one of the symptoms of organized crime (systemic corruption).
Judicial corruption refers to corruption related misconduct of judges, through receiving or giving bribes, improper sentencing of convicted criminals, bias in the hearing and judgement of arguments and other such misconduct.
\hypertarget{gotext}{%
Governmental corruption} of judiciary is broadly known in many transitional and developing countries because the budget is almost completely controlled by the executive. The latter undermines the separation of powers, as it creates a critical financial dependence of the judiciary. The proper national wealth distribution including the government spending on the judiciary is subject of the constitutional economics.
\newpage
empty page
\end{document}
运行代码,点击自己并作证;)