使用 pdflscape 时 Hyperref 问题

使用 pdflscape 时 Hyperref 问题

如下面的 .gif 动画所示,单击表格下方的链接将把视觉焦点移动到表格中链接单元格正上方的位置。

测试超链接_肖像.gif

但是,使用 pdflscape 包将表格改为横向后,点击表格下方的链接只会将视觉焦点移动到整个表格上方的位置。

测试超链接_景观.gif

您能否帮助建议如何在表格处于横向时实现相同的效果?

下面给出了两种情况的 .tex 文件,使用 Windows 上的 TexLive 2019 中的 TexWorks 打开,并使用 XeLaTeX 进行编译。

测试超链接_肖像.tex:

\documentclass[
  10pt,
  AutoFakeBold,AutoFakeSlant]{article}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  \setmainfont[]{Times New Roman}
  \setmathfont[]{XITS Math}
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  colorlinks=true,
  linkcolor=cyan,
  filecolor=Maroon,
  citecolor=Blue,
  urlcolor=Blue,
  pdfcreator={LaTeX via pandoc}}
\usepackage[top=3.18cm, bottom=3.18cm, left=2.54cm, right=2.54cm]{geometry}
\usepackage{longtable,booktabs}
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
\usepackage{fancyhdr}

\pagestyle{fancy}\fancyhf{}\renewcommand{\headrulewidth}{0pt}
\usepackage{pdflscape}

\date{}

\begin{document}

\hypertarget{title}{%
\section{TITLE}\label{title}}

AUTHOR

Affiliation

\large

\hypertarget{toc}{%
\section{Table of content}\label{toc}}

\normalsize

\newpage

\newgeometry{top=3.18cm, bottom=3.18cm, left=0.5cm, right=0.5cm}
\fancyhfoffset[E,O]{0pt}

\hypertarget{sec0}{%
\section{Results for section0.}\label{sec0}}

\hyperlink{toc}{Back to Table of content}

\hypertarget{tbl:tbl0_Numbers}{}
\begin{longtable}[]{@{}lc@{}}
\caption{\label{tbl:tbl0_Numbers}Numbers for tbl0.}\tabularnewline
\toprule
Description & Number\tabularnewline
\midrule
\endfirsthead
\toprule
Description & Number\tabularnewline
\midrule
\endhead
\(\mathbf{Parent 1}\) \protect\hypertarget{tblA1}{}{} &\tabularnewline
\hyperlink{figA1}{Child 1a} & -6666.666666\tabularnewline
\(\mathbf{Parent 2}\) \protect\hypertarget{tblB1}{}{} &\tabularnewline
\hyperlink{figB1}{Child 2a} & -7777.777777\tabularnewline
\bottomrule
\end{longtable}

\normalsize

\restoregeometry

\hypertarget{figA1}{%
\subsection{Child 1a}\label{figA1}}

\hyperlink{tblA1}{Number  =         -6666.666666 }

\newpage

\hypertarget{figB1}{%
\subsection{Child 2a}\label{figB1}}

\hyperlink{tblB1}{Number  =         -7777.777777 }

\newpage

\end{document}

测试超链接_景观.tex:

\documentclass[
  10pt,
  AutoFakeBold,AutoFakeSlant]{article}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
  \setmainfont[]{Times New Roman}
  \setmathfont[]{XITS Math}
\fi
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  colorlinks=true,
  linkcolor=cyan,
  filecolor=Maroon,
  citecolor=Blue,
  urlcolor=Blue,
  pdfcreator={LaTeX via pandoc}}
\usepackage[top=3.18cm, bottom=3.18cm, left=2.54cm, right=2.54cm]{geometry}
\usepackage{longtable,booktabs}
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if@noskipsec\mbox{}\fi\par}{}{}
\makeatother
\usepackage{fancyhdr}

\pagestyle{fancy}\fancyhf{}\renewcommand{\headrulewidth}{0pt}
\usepackage{pdflscape}

\date{}

\begin{document}

\hypertarget{title}{%
\section{TITLE}\label{title}}

AUTHOR

Affiliation

\large

\hypertarget{toc}{%
\section{Table of content}\label{toc}}

\normalsize

\newpage

\newgeometry{top=2.00cm, bottom=2.00cm, left=1.2cm, right=1.6cm}
\fancyhfoffset[E,O]{0pt}

\begin{landscape}

\hypertarget{sec0}{%
\section{Results for section0.}\label{sec0}}

\hyperlink{toc}{Back to Table of content}

\hypertarget{tbl:tbl0_Numbers}{}
\begin{longtable}[]{@{}lc@{}}
\caption{\label{tbl:tbl0_Numbers}Numbers for tbl0.}\tabularnewline
\toprule
Description & Number\tabularnewline
\midrule
\endfirsthead
\toprule
Description & Number\tabularnewline
\midrule
\endhead
\(\mathbf{Parent 1}\) \protect\hypertarget{tblA1}{}{} &\tabularnewline
\hyperlink{figA1}{Child 1a} & -6666.666666\tabularnewline
\(\mathbf{Parent 2}\) \protect\hypertarget{tblB1}{}{} &\tabularnewline
\hyperlink{figB1}{Child 2a} & -7777.777777\tabularnewline
\bottomrule
\end{longtable}

\normalsize

\end{landscape}

\restoregeometry

\hypertarget{figA1}{%
\subsection{Child 1a}\label{figA1}}

\hyperlink{tblA1}{Number  =         -6666.666666 }

\newpage

\hypertarget{figB1}{%
\subsection{Child 2a}\label{figB1}}

\hyperlink{tblB1}{Number  =         -7777.777777 }

\newpage

\end{document}

相关内容