如何识别和修复错误的超链接本地 PDF 链接?

如何识别和修复错误的超链接本地 PDF 链接?

我正在使用这个模板(关联) 创建我的论文。但是,参考文献和附录的超链接指向错误的章节。章节列表如下所示:

在此处输入图片描述

参考文献部分的链接指向第 37 页而不是第 38 页。附录的链接指向第 38 页而不是第 39 页。参考文献之前的章节有正确的链接。我试图弄清楚为什么提供的链接是错误的。如何识别和修复错误的本地 PDF 链接?

更新

平均能量损失

\documentclass[onecolumn, 12 pt, doublespace, fullpage, letterpaper]{report}
\renewcommand{\baselinestretch}{1.75}

% Packages
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{float}
\usepackage{color}
\usepackage[cmex10]{amsmath}
\usepackage{latexsym,amsfonts}
\usepackage{amsthm}
\usepackage{url}
\usepackage{longtable}
\usepackage[figuresright]{rotating}
\usepackage{listings}
\usepackage{etoolbox}
\usepackage{sectsty}

% Changing chapters' headings and subheadings to size 14
\chapterfont{\fontsize{14}{15}\selectfont}
\sectionfont{\fontsize{14}{15}\selectfont}
\subsectionfont{\fontsize{14}{15}\selectfont}
\subsubsectionfont{\fontsize{14}{15}\selectfont}

\usepackage{fancyhdr}       
\pagestyle{fancy} 
\fancyhead{} \fancyfoot{} 
\fancyhead[CO,CE]{\thepage}    
%centering the page numbers with text body
\fancyheadoffset[L]{0.25in}

\renewcommand{\headrulewidth}{0pt}

%The following code changes the empty vertical space above a new chapter title. It sets it from 50pt to 20pt
\makeatletter
\patchcmd{\@makechapterhead}{50\p@}{20pt}{}{}
\patchcmd{\@makeschapterhead}{50\p@}{20pt}{}{}
\makeatother
%end of modification

% The following code redefines the plain pagestyle with the objective of moving the page number from the bottom to the top of the page. This only affects new chapter pages.
\fancypagestyle{plain}{
\fancyhf{} %clear all header and footer fields
\fancyhead[C]{\thepage} %puts number on top center of the page
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
%ending of plain pagestyle modification.

\usepackage{setspace}
\usepackage{subfigure}

% ### Nomenclature, List of Abbreviations and List of Symbols 
   \usepackage{ifthen,xkeyval,xfor,amsgen}
   \usepackage[acronym,toc, nogroupskip]{glossaries}
   \newglossary[slg]{symbols}{syi}{sbl}{List of Symbols}

   \makeglossaries

   \include{Lists}
   % Run the following three lines in the command line to get the lists
%makeindex -s Thesis.ist -t Thesis.alg -o Thesis.acr Thesis.acn
%makeindex -s Thesis.ist -t Thesis.slg -o Thesis.syi Thesis.sbl
%makeindex -s Thesis.ist -t Thesis.glg -o Thesis.gls Thesis.glo

% ### End of addition

\usepackage{hyperref} 

% Modified commands
\newcommand{\Tab}{\hspace{2ex}}
\usepackage[lmargin=1.5in, rmargin=1in, vmargin=1in, headsep=0.083334in]{geometry}
\newcommand{\mathsym}[1]{{}}
\newcommand{\unicode}[1]{{}}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand\bibname{\centering BIBLIOGRAPHY}

\usepackage{lipsum}
\usepackage{filecontents}
\begin{filecontents*}{file1.tex}
\chapter{Introduction}
%\pagenumbering{arabic}      % Commenting-out by Christos, see p.13 of Guidelines, all pages should have arabic page numbers

This guide has been prepared by \gls{XYZ} Graduate Affairs to assist students in the preparation of dissertations or
theses. The requirements in this guide apply to all dissertations or theses to facilitate their preparation and
distribution, and to assure preservation of the archival copy.  Individual Divisions may dictate more specific
requirements.  Queries not addressed in this guide should be directed to the appropriate degree program department.

\section{Objectives and Contributions}

The main objective of this thesis comes here.

The contributions of this thesis folds in the following streams:

$\bullet$ Objective 1.

$\bullet$ Objective 2.

$\bullet$ Objective 3 and so on.

\section{Testing the Bibliography}
I am now going to add some citations like \cite{key1} and some more for example \cite{key2} and \cite{key3} because I
want to make some tests.

\end{filecontents*}

\begin{filecontents*}{file2.tex}
\chapter{Dissertation or Thesis Manuscript Preparation}
\label{chapter2}

\section{Sample Title Page}

Use the format below, making allowance for the left margin of 1.5 inches in centering the print. The date shown (month
and year only) should reflect when the dissertation or thesis was approved. This will protect the candidate in the event
an intellectual property issue related to presentation of information or date of submission should arise. A sample title
page template is as shown in figure \ref{title_page}.

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.85]{example-image-a}
\caption{Sample Title Page Template \cite{guidelines}.}
\label{title_page}
\end{center}
\end{figure}

\section{Thesis Title Guidelines}

Dissertations or Theses are valuable resources for scholars that should be easily retrievable. Modern retrieval systems


Use the same margins as the title page. The copyright page template can be seen in figure \ref{copyright_page}.

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.85]{Copyright_Page.jpg}
\caption{Copyright Page Template \cite{guidelines}.}
\label{copyright_page}
\end{center}
\end{figure}
\end{filecontents*}

\begin{filecontents*}{file3.tex}
\chapter{Example chapter}
\lipsum
\end{filecontents*}

\begin{filecontents*}{file4.tex}
\chapter{Example chapter}
\lipsum
\end{filecontents*}

\begin{filecontents*}{file5.tex}
\chapter{Example chapter}
\lipsum
\end{filecontents*}

\begin{filecontents*}{file6.tex}
\chapter{Example chapter}
\lipsum
\end{filecontents*}


\begin{document}

%\raggedright %to make the text left aligned.

\vspace{2pt}
\thispagestyle{empty}
\addvspace{10mm}

\begin{center}

{\textbf{{\large Your Thesis Title}}}\vfill 
{Thesis/Dissertation by}\\
{ Your Full Name}\vfill



{ In Partial Fulfillment of the Requirements}\\[12pt]
{ For the Degree of}\\[12pt]
{Masters of Science/Doctor of Philosophy} \vfill
{ABC}\\
{PQR}
\vfill
%\maketitle
{Insert Date (Month, Year)}

\end{center}

\newpage

% Do not remove centering environment below
\begin{center}

\end{center}


\begin{center}

{ \textbf{{\large EXAMINATION COMMITTEE PAGE}}}\\\vspace{1cm}

\end{center}
\noindent{The thesis/dissertation of Your Full Name is approved by the examination committee}
\addcontentsline{toc}{chapter}{Examination Committee Page}

\vspace{4\baselineskip}

\begin{onehalfspacing}
\noindent{Committee Chairperson: Your advisor's name}\\
Committee  Co-Chair (if appropriate): [insert name]\\
Committee Members: First name, Second name, Third name\vfill
\end{onehalfspacing}

%\begin{center}
%{ABC University of Science and Technology}\\
%{Year}
%\end{center}

\newpage
\addcontentsline{toc}{chapter}{Copyright}
\vspace*{\fill}
\begin{center}
{ \copyright Month, Year}\\
{Your Full Name}\\
{All Rights Reserved}
\end{center}

\include{Abstract}

\include{Acknowledgment}


\begin{onehalfspacing}%To make the table of contents, figures, and tables single spaced, as required by the formatting guidelines, pg. 24.

\renewcommand{\contentsname}{\centerline{\textbf{{\large TABLE OF CONTENTS}}}}
\tableofcontents
\cleardoublepage

\printglossary[type=\acronymtype,style=long3col, title=\centerline{LIST OF ABBREVIATIONS}, toctitle=List of Abbreviations, nonumberlist=true] 

\printglossary[type=symbols,style=long3col, title=\centerline{LIST OF SYMBOLS}, toctitle=List of Symbols, nonumberlist=true]

\cleardoublepage
\addcontentsline{toc}{chapter}{\listfigurename} 
\renewcommand*\listfigurename{\centerline{LIST OF FIGURES}} 
\listoffigures

\cleardoublepage
\addcontentsline{toc}{chapter}{\listtablename}
\renewcommand*\listtablename{\centerline{LIST OF TABLES}} 
\listoftables

\end{onehalfspacing}
% \printglossary[style=altlist,title=Nomenclature, toctitle=Nomenclature, nonumberlist=true] 

\include{file1}
\include{file2}
\include{file3}

\begin{onehalfspacing}
\renewcommand*\bibname{\centerline{REFERENCES}} 
\addcontentsline{toc}{chapter}{References}
\newcommand{\BIBdecl}{\setlength{\itemsep}{0pt}}%To control space between bibliography entries
\bibliographystyle{IEEEtran}
\bibliography{References}
\end{onehalfspacing}

\appendix

\newpage

\begingroup
\let\clearpage\relax
\begin{center}
\vspace*{2\baselineskip}
{ \textbf{{\large APPENDICES}}} 
\addcontentsline{toc}{chapter}{Appendices} 
\end{center}
\include{file4}
\endgroup

\include{file5}
\include{file6}
\end{document}

答案1

添加

\phantomsection

在文本中标记一个位置,如果超链接目标本身没有留下标记,则超链接应跳转到该位置。通常\chapter\section会留下这样的标记,但\chapter*\section*通常不会。

很明显,您正在手动创建参考文献和附录的设置,这表明这是您的问题。给定的代码允许以不同于附录的方式更正参考文献。前者可以使用修改的 来完成\chapter*,而后者使用\phantomsection

因此,对于参考文献和附录,请使用

\begin{onehalfspacing}
  \let\oldchapter\chapter
  \def\chapter*#1{\oldchapter[#1]{\makebox[\linewidth]{\MakeUppercase{#1}}}}
  \setcounter{secnumdepth}{-1}
  \renewcommand\bibname{References} 
  \newcommand{\BIBdecl}{\setlength{\itemsep}{0pt}}%To control space between bibliography entries
  \bibliographystyle{IEEEtran}
  \bibliography{references}
\end{onehalfspacing}

\clearpage

\appendix
\begingroup
  \let\clearpage\relax
  \begin{center}
    \vspace*{2\baselineskip}
    \phantomsection
    \textbf{\large APPENDICES}
    \addcontentsline{toc}{chapter}{Appendices} 
  \end{center}
  \include{file4}
\endgroup

相关内容