1

I am new to LaTeX. I am currently writing my thesis with overleaf, and for some reason, the bookmarks generated automatically do not lead to the corresponding section. Here are a few major differences between the format of my thesis and a standard format of a thesis:

  1. My university has a special format for the cover/title page. Which is in font Verdana. I manually created a pdf of my cover and title page and inserted it to my thesis instead of letting latex to generate one for me.

  2. For summary, acknowledgements, table of contents, figures etc, my university requires roman page numbers, whereas for the main text, my university requires arabic page numbers.

  3. For non-main text sections, my university does not allow a running title, but a running title is required for the main text.

  4. That is why I used fancyhf to alternate between different page format. But unfortunately, other than my result section, all other sections in my file leads to my coverpage for some reason.

I have tried resolving it with \phantomsection \addcontentsline{toc}{section}{Summary} and\renewcommand{\summaryname}{Summary} based on answers from Links do not lead to right pages and Bookmarks linked to incorrect page, although bookmarks can lead to the right section, the section title is missed. Furthermore, I don't know if this method works for subsections and paragraphs.

May I please use your brain on this? Why the bookmarks in the result section is the only functional one? Thank you so much!

\usepackage{graphicx}
\usepackage{hyperref} 
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,
    urlcolor=black,
    citecolor=black,
}
\usepackage{bookmark}
\usepackage[english]{babel}
\usepackage[ansinew]{inputenc}
\usepackage{csquotes}
\usepackage[tocbib,bibnewpage]{apacite} 
\usepackage{multicol}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage[table,xcdraw]{xcolor}
\usepackage{fancyhdr}
\usepackage{lineno}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{geometry}
\usepackage{pdfpages}
\usepackage{rotating} % <-- HERE
\usepackage{lscape}
\usepackage{caption}
\usepackage{ltablex}
\usepackage[referable]{threeparttablex}
\usepackage{threeparttable}[normal]
\usepackage{tabularx}

%\documentclass{article} \usepackage{fontspec}%déjà chargé par luatextra \defaultfontfeatures{Ligatures=TeX} % to have the automatics ligatures of TeX

\pagestyle{fancy} \fancyhf{} \rhead{\thepage} \lhead{}

\fancypagestyle{main}{ \fancyhf{} \lhead{\small\small THESIS} \rhead{\thepage} }

\geometry{ left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm }

% only necessary to change shorttitle as it is part of the header \title{title} \shorttitle{THESIS} \author{name} \affiliation{XXX UNIVERSITY} \course{Masterthesis} \professor{professor} \duedate{\today} \usepackage{titlesec}

\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}

\begin{document} \setstretch{1.5} % 1.5 line spacing \setromanfont{Verdana}

% --------------COVER------------------------

\thispagestyle{empty}

% --------------COVER PAGE------------------------

\begin{coverpage} \includepdf{cover} \end{coverpage}

%\vspace*{0cm}

% --------------BLANK PAGE------------------------

\clearpage\null\thispagestyle{empty}\clearpage

% --------------BLANK PAGE------------------------

\clearpage\null\thispagestyle{empty}\clearpage

% --------------BLANK PAGE------------------------

\clearpage\null\thispagestyle{empty}\clearpage

% --------------TITLE PAGE------------------------ % insert pdf due to special title page formatting

\begin{titlepage} \includepdf{cover} \end{titlepage}

% --------------BLANK PAGE------------------------

\clearpage\null\thispagestyle{empty}\clearpage

\clearpage

\setromanfont{Times New Roman} \pagenumbering{Roman} \pagestyle{fancy} \Some {\fontsize{11}{15}\selectfont % font size 11 \setstretch{1.5}} % line spacing 1.5

\section{Summary} \section{Acknowledgements}

\pdfbookmark[section]{\contentsname}{toc} \renewcommand\contentsname{Table of Contents} \tableofcontents

\phantomsection \addcontentsline{toc}{section}{List of Tables} \listoftables

\clearpage \pagestyle{main}

\pagenumbering{arabic} \setcounter{page}{1} \pagestyle{main} %\fancyhf{} %\fancyhead[R]{\thepage} \setlength{\parskip}{0.1mm} \raggedbottom \nopagebreak

\section{1. Introduction} \section{2. Methods} \section{3. Results} \section{4. Discussion} \section{5. Conclusion}

\end{document}```

  • Welcome! The code you have posted is not compilable as it is so it is difficult to test, after stripping out the parts of your code that would not compile the bookmarks seem to go to the correct sections (assuming book is used and after moving hyperref). Try loading hyperref after all the other packages (hyperref should always be loaded last with some exceptions such as glossaries) and see if the links are fixed –  May 04 '22 at 13:38
  • 1
    check the log-file. there should be messages about duplicated destinations. Give your title pages another numbering style, e.g. \pagenumbering{roman} so that you don't have two pages with 1 as number. That confuses the links. – Ulrike Fischer May 04 '22 at 13:46
  • @James_T Thank you for your comment. I think it could not compile because I had the \begin{coverpage} \includepdf{cover} \end{coverpage} whereas the pdf file is not here. Apologies about this!

    I tried to move hyperref after all the other packages, but for some reason, my summary, acknowledgement, clarification of contribution still go to the cover page (which is the pdf I inserted). My introduction, literature review go to the list of figures. So everything is still pretty messed up.

    I think the problem might have to do with the cover page :(

    – Helen Andrews May 05 '22 at 20:20
  • @UlrikeFischer Thank you so much for your reply. Unfortunately, I did see a message about duplicated destination in my log-file. – Helen Andrews May 05 '22 at 20:46
  • I solved the problem by manually typing \phantomsection \addcontentsline{toc}{section}{7. Conclusion} \section*{7. Conclusion} for every section, and it worked. Still don't know why the previous bookmarks all lead to the first page though :( – Helen Andrews May 05 '22 at 21:17

0 Answers0