1

I am using this template (link) to create my thesis. However, the hyperref local PDF link of the References and Appendix points to the wrong sections. The list of chapters are shown below:

enter image description here

The link of section References is pointed to page 37 instead of 38. The link of Appendices is pointed to page 38 instead of 39. The chapters before the references have correct links. I tried to figure out why the links provided are wrong. How to identify and fix wrong local PDF links?

Update

MWE

\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
    Well, asking for help and then requiring users to follow links on the net is troublesome. If you would use tocbibind package, you would have less issues, most likely. Try a \phantomsection at top of your appendix.tex file – user31729 Oct 11 '17 at 12:16
  • I am sorry, I couldn't find a more better way to put the question without links to the LaTeX files. Placing \phantomsection at top of the appendix.tex file didn't help. – nxkryptor Oct 11 '17 at 12:33
  • IIRC, \appendix resets the chapter/section counter. You might use the appendix package instead: \begin{appedices} ... \end{appendices}. – John Kormylo Oct 11 '17 at 13:25
  • Welcome to TeX.SX!! Rather than posting link please give a minimal working example. A MWE should start with a \documentclass command, have a minimal preamble and then \begin{document}...\end{document}. The code should compile and be as small as possible to demonstrate your problem. You suggest that the code is the link is too voluminous to post but cutting your code down to a MWE may well reveal what your problem actually is and it will certainly clarify your problem and so make it easier for people to help you. – Andrew Oct 11 '17 at 14:35
1

Add

\phantomsection

to mark a spot in your text where a hyperlink should jump to if the hyper-destination doesn't leave a mark on its own. Typically \chapter and \section leave such marks, but \chapter* and \section* don't (generally).

It's clear you're manually creating the setup for your References and Appendix, which points to that being your problem. The given code allows for correcting References in a different way from Appendix. The former can be done using a modified \chapter*, while the latter uses a \phantomsection.

So, for your References and Appendix, use

\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
  • The problem still exists. Could you try the References link. – nxkryptor Oct 12 '17 at 10:54
  • @nxkryptor: I can't replicate it using your code together with my adjustment. References and Appendix jump to the correct page. – Werner Oct 13 '17 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.