# scrartcl hyperref not working

hyperref doesn't work inside scrartcl class. It happens when I use that class and I want to link to another page but doesn't work at all. Any help? Thanks in advance!

\documentclass[
10pt,
pagesize,
footinclude=false,
hyperref=true
]
{scrartcl}

\usepackage[x11names]{xcolor}
\usepackage{float}
\usepackage{pagecolor}
\usepackage{CJKutf8}
\usepackage[pdftitle=learnChinese,pdfauthor=yu,

\paperwidth=4cm
\paperheight=4cm
\typearea{100}

\pagecolor{LightCyan2}

\begin{document}
\begin{CJK}{UTF8}{gbsn}
\Huge

\clearpage
\vspace*{\stretch{1}}
\begin{center}
\hyperref[o]{あ}
\end{center}
\vspace*{\stretch{2.5}}

\newpage
\vspace*{\stretch{1}}
\begin{center}
い
\end{center}
\vspace*{\stretch{2.5}}

\clearpage
\vspace*{\stretch{1}}
\begin{center}
う
\end{center}
\vspace*{\stretch{2.5}}

\clearpage
\vspace*{\stretch{1}}
\begin{center}
え
\end{center}
\vspace*{\stretch{2.5}}

\clearpage
\vspace*{\stretch{1}}
\begin{center}
お \label{o}
\end{center}
\vspace*{\stretch{2.5}}

\end{CJK}
\end{document}


When you run the MWE, you will see you can't go to the fifth page after click on the first page's character.

• I can not imagine any conflicts right now. Can you please post some codes as your Minimal Working Example ? – Majid Abdolshah Sep 21 '16 at 12:47
• Welcome to TeX.SX! Can you please add the code of a small complete LaTeX document to your question (using the edit button left below your current post) that illustrates your problem? It will us help to analyze the problem (which will not be possible without the example document). – gernot Sep 21 '16 at 13:58
• The format is very bad after I pasted my code example, sorry if you have some difficulties reading the code. Thanks for your help, I didn't realize you guys replied me soon after I posted my question, it was so quick. Thanks! – Jiapan Sep 22 '16 at 12:12

The problem has nothing to to with scrartcl but rather with a misunderstanding of \label, so let me boil it down to the bare minimum. Consider the following code

% WRONG CODE
\documentclass{article}

\begin{document}
\ref{bla} How \newpage
are \newpage
you? \label{bla}
\end{document}


A label points to the last item (chapter, section, equation, figure ...) with some counter which has been increased by \refstepcounter. If you look at the aux file generated by the above code, you'll find

\newlabel{bla}{{}{3}}


so a label on page three referencing nothing. Using \hyperref will result in a link pointing nowhere, which becomes in this case (by default? I honestly don't know) the document start.

If you want to create internal links and targets within your document you have at least two possibilities: the first is to use the \phantomsection macro, which basically provides a hidden counter:

\documentclass{article}

\usepackage{hyperref}

\begin{document}
\hyperref[bla]{How} \newpage
are \newpage
you? \phantomsection\label{bla}
\end{document}


Alternatively you may use the \hyperlink/\hypertarget pair of commands

\documentclass{article}

\usepackage{hyperref}

\begin{document}