The problem is that the links (as well as the PDF bookmarks) of abstract, explanation, CV and appendix do not lead to the right pages. abstract leads to the titlepage
and appendix to introduction etc. Also the sections belong to the introduction in the bookmarks 🙁 Maybe it is due to the page numbering I did (and I need). I've tried so many things, I'm about to leave it like that 🙁 Please correct my codes if you find the mistake. I'm a beginner and have a lot of difficulties to adjust the options, packages etc…
\makeatletter
\renewcommand*{\@pnumwidth}{3em}
\makeatother
\documentclass[a4paper,12pt,ngerman]{article}
\usepackage[
colorlinks,
linkcolor=black,
filecolor=black,
citecolor=black
]{hyperref}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{eurosym}
\usepackage{latexsym}
\usepackage{graphicx}
\usepackage[abbr,agsmcite,agsm,round]{harvard}
\usepackage{longtable}
\usepackage{portland}
\usepackage{lscape}
\usepackage[onehalfspacing]{setspace}
\usepackage{footmisc}
\usepackage{hyphenat}
\usepackage{rotating}
\usepackage[USenglish]{babel}
\usepackage{array}
\usepackage{tabularx}
\usepackage[latin1]{inputenc}
\usepackage[para]{threeparttable}
\usepackage{caption}
\usepackage[capposition=top]{floatrow}
%\usepackage[subfigure]
\usepackage{currvita}
\usepackage{enumitem}
%\usepackage[latin9]{inputenc}
%\usepackage[T1]{fontenc}
\setcounter{MaxMatrixCols}{12}
\setlength{\skip\footins}{10mm}
\setlength{\evensidemargin}{0cm}
\setlength{\textwidth}{15cm}
\setlength{\textheight}{23cm}
\setlength{\topmargin}{-1cm}
\pagenumbering{arabic}
\renewcommand\harvardand{and}
\renewcommand{\labelenumi}{\Alph{enumi})}
\renewcommand{\labelenumii}{\arabic{enumii}.}
\renewcommand{\cite}{\citeasnoun}
\renewcommand{\harvardand}{and}
\begin{document}
\begin{titlepage}
\begin{center}
Title
\end{center}
\end{titlepage}
\newpage
\pagenumbering{Roman}%
\renewcommand{\abstractname}{Acknowledgements}
\begin{abstract}
\noindent
bla bla
\end{abstract}
\newpage
\phantom{T}\vspace{5,3cm}
\renewcommand{\abstractname}{Abstract}
\begin{abstract}
TEXT
\end{abstract}
\addcontentsline{toc}{section}{Abstract}
\newpage
\tableofcontents
\newpage
\listoffigures
\addcontentsline{toc}{section}{List of Figures}
\newpage
\listoftables
\addcontentsline{toc}{section}{List of Tables}
\newpage
\section*{Symbols}
\addcontentsline{toc}{section}{Symbols}%
\newpage
\section*{List of abbreviations}
\begin{tabular}{L{5.5cm} L{9cm}}
\end{tabular}%
\addcontentsline{toc}{section}{List of abbreviations}%
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}%
\section{Introduction}
text text text
\newpage
\section{System and whatever}
\subsection{System}
\setcounter{table}{0}
\setcounter{figure}{0}
\setcounter{section}{0}
\newcommand{\initAnhang}{
\renewcommand{\thepage}{\Alph{section}\ \arabic{page}}
\newpage
}
\renewcommand\appendix{\par
\renewcommand\thesection{\Alph{section}}
\renewcommand\thesubsection{\Alph{section}\arabic{subsection}}
\renewcommand\thefigure{\Alph{section}\arabic{figure}}
\renewcommand\thetable{\Alph{section}\arabic{table}}}
\newcommand{\anhang}[1]{
\setcounter{page}{1}
\input{#1}
\newpage
}
\appendix\initAnhang
\section{Appendix}
%\addcontentsline{toc}{section}{Appendix}%
\subsection{Descriptive Statistics}
\newpage
\nocite{*}
\bibliographystyle{dcu}
\bibliography{bib}
\addcontentsline{toc}{section}{References}
\newpage
\section*{Explanation}
\addcontentsline{toc}{section}{Explanation}
\newpage
\begin{cv}{CV}
\addcontentsline{toc}{section}{CV}%
\end{cv}
\end{document}
Best Answer
Apart from putting
hyperref
first and not last among the called packages I see nothing too bad in them; but are you sure you need all of them?Anyway, I'd put
fontenc
,inputenc
andbabel
first:Your problem about wrong links is in the order of the commands:
With
\phantomsection
you set the link position; by putting\addcontentsline
just after the page break you know that the reference to the page will be correct.