[Tex/LaTex] Add Appendix to TOC without a pagenumber

appendicespage-numberingtable of contents

I want my Appendix, Glossary and Bibliography in the TOC without a pagenumber but clickable. When the user click on the name of one of theses, it should jump to the specific chapter.

For the appendix I want, that there is no page numbering, how could I turn this off? I'm not using the fancyhdr package.

My minimal example:

\documentclass[a4paper,12pt,headsepline,smallheadings,parident, numbers=noenddot]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} 
\usepackage[babel,german=quotes]{csquotes}
\usepackage{listings}
\usepackage{caption}
\usepackage{cite}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{pdfpages}
\usepackage{color}
\bibliographystyle{alphadin}

\usepackage{hyperref}
\typearea{12}
\pagestyle{headings}

\addtokomafont{subsubsection}{\small}
\addtokomafont{caption}{\small}

\usepackage[nonumberlist]{glossaries}
\makeglossaries

\begin{document}
%Bibliogrpahy
\bibliography{./literatur/literaturverzeichnis.bib}
\addcontentsline{toc}{chapter}{Literaturverzeichnis}

%Glossary
\renewcommand{\glossaryname}{Glossar}
\printglossaries
\addcontentsline{toc}{chapter}{Glossar}

%Appendix
\appendix
\renewcommand{\thesection}{\Alph{section}}
\addchap{Anhang}
\refstepcounter{chapter}
\section*{Klassendiagramm} \label{class-diagram}
\section*{Liste mit verwendeten UI-Elementen} \label{list-ui-elements}
\section*{Quelltext} \label{source-code}
\section*{Abbildungen}
\end{document}

Best Answer

You could use \addchap* instead of \addchap. In that case you might have to take care of the page header entry yourself, using \chaptermark or \markboth. Further you can call \addtocontents. In contrast to \addcontentsline, it doesn't show the page number by default. You need to take care of the formatting of the TOC entry, for this you can use \usekomafont{chapterentry}. Further I added the hyperlink manually below. \protect is required, for preventing the expansion of the commands which are written to the .toc file.

\clearpage
\phantomsection
\hypertarget{link.appendix}{}
\addchap*{Anhang}
\addtocontents{toc}{\protect\usekomafont{chapterentry}%
  \protect\hyperlink{link.appendix}{Anhang}}

If you need this way several times, you could create a macro for this kind of chapter.