将附录添加到目录中而不添加页码

将附录添加到目录中而不添加页码

我希望目录中的附录、词汇表和参考书目没有页码但可点击。当用户点击其中一个论文的名称时,它应该跳转到特定章节。

对于我想要的附录,没有页码,我该如何关闭它?我没有使用 fancyhdr 包。

我的最小例子:

\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}

答案1

您可以使用\addchap*而不是\addchap。在这种情况下,您可能必须自己处理页眉条目,使用\chaptermark\markboth。此外,您可以调用\addtocontents。与 相比\addcontentsline,它默认不显示页码。您需要注意目录条目的格式,为此您可以使用\usekomafont{chapterentry}。此外,我在下面手动添加了超链接。\protect是必需的,以防止扩展写入 .toc 文件的命令。

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

如果您多次需要这种方式,您可以为这种章节创建一个宏。

相关内容