[Tex/LaTex] Links do not lead to right pages

bookmarkshyperreflinkstable of contents

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 and babel first:

\documentclass[a4paper,12pt]{article}
\usepackage[T1]{fontenc} % recommended for German
\usepackage[latin1]{inputenc}
\usepackage[USenglish,ngerman]{babel}

<...other packages...>

\usepackage[
  colorlinks,
  linkcolor=black,
  filecolor=black,
  citecolor=black
  ]{hyperref} %% should be last

\makeatletter
\renewcommand*{\@pnumwidth}{3em}  
\makeatother 

<...other settings...>

Your problem about wrong links is in the order of the commands:

\begin{document}

\pagenumbering{alph} % not to get duplicate links (see Ulrike's comment)
\begin{titlepage}
\begin{center}
Title
\end{center}
\end{titlepage}

\newpage
\pagenumbering{Roman}

\begingroup %% there will be no need to reset \abstractname
\renewcommand{\abstractname}{Acknowledgements}
\begin{abstract}
\noindent
bla bla
\end{abstract}
\endgroup

\newpage

\vspace*{5,3cm} %% the space won't disappear at the top of the page

\phantomsection
\addcontentsline{toc}{section}{Abstract}

\begin{abstract}
TEXT
\end{abstract}

\newpage

\tableofcontents

\newpage

\phantomsection
\addcontentsline{toc}{section}{List of Figures}
\listoffigures

\newpage

<...similarly for the other lists...>

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.

Related Question