# LaTex: hyperref package and the toc as displayed by the pdf viewing program

I have a roblem with LaTex involving the hyperref package. Consider the following example:

\documentclass{scrartcl}
\usepackage{hyperref}

\begin{document}

\tableofcontents

\section{Some section}

\section*{Some starred section}
\label{starred-section}

\end{document}


I use XeLaTex to compile this which works perfectly fine but there is one minor problem with the output, I posted a screenshot below. The pdf itself looks completely fine, but the table of contents AS DISPLAYED BY THE PDF VIEWING PROGRAM (preview on mac in my case) is screwed up by hyperref, see the red box. I checked whether this is an issue of preview, but Adobe reader displays the table of contents in the same way. Does anyone know a solution to that? Thank you!

## migrated from stackoverflow.comOct 13 '15 at 3:13

This question came from our site for professional and enthusiast programmers.

Actually you don't need to link any table-of-contents(toc) entry to a section or something. Since you are using hyperref all toc-entrys are already links and this is also what made this error come up. If you need that label for the section for somewhere else it will work perfectly fine without any errors, but don't use it for the toc.

This is what the working code looks like:

\documentclass{scrartcl}
%hidelinks removes the ugly boxes around the links, if you want that.
%Else just remove the '[hidelinks]' again

\begin{document}

\tableofcontents

\section{Some section}

\section*{Some starred section}
\label{starred-section} %remove it if not needed elsewhere!