Es wäre schön gewesen, wenn Du wirklich ein vollständiges Minimalbeispiel an Stelle eines Codeschnippsels gepostet hättest. Da Du das nicht hast, habe ich mein eigenes Minimalbeispiel gebastelt. Wenn es nicht passt, bist Du selbst schuld.
\documentclass[toc=flat]{scrbook}
\usepackage{blindtext}
\makeatletter
\DeclareRobustCommand*{\redefnumberline}{%
\let\appendix@saved@numberline\numberline
\renewcommand*\numberline[1]{\appendix@saved@numberline{\appendixname~##1}}%
}
\g@addto@macro\appendix{%
\addtocontents{toc}{\noexpand\redefnumberline}%
}
\makeatother
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}
Option toc=flat ist in diesem Fall notwendig, weil für die Gliederungsnummern nur ein bestimmter Platz reserviert ist. Der reicht natürlich nicht mehr, wenn da auch noch "Anhang" oder "Appendix" davor steht. Bei toc=flat wird hingegen der benötigte Platz selbst berechnet.
Eine Alternative wäre:
\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{tocstyle}
\usetocstyle{classic}
\makeatletter
\DeclareRobustCommand*{\redefnumberline}{%
\renewcommand*{\tocstyle@@numberline}[1]{%
\appendixname~##1\csname autotot\endcsname
}%
}
\g@addto@macro\appendix{%
\addtocontents{toc}{\noexpand\redefnumberline}%
}
\makeatother
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}
Man sieht an den Beispielen ganz deutlich wie problematisch inkonsistente Vorgaben im Inhaltsverzeichnis sind.
Tatsächlich sinnvoll wäre etwas wie:
\documentclass{scrbook}
\usepackage{blindtext}
\makeatletter
\g@addto@macro\appendix{%
\cleardoubleoddemptypage
\addcontentsline{toc}{part}{\appendixname}%
}
\makeatother
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}
Es wäre schön gewesen, wenn Du wirklich ein vollständiges Minimalbeispiel an Stelle eines Codeschnippsels gepostet hättest. Da Du das nicht hast, habe ich mein eigenes Minimalbeispiel gebastelt. Wenn es nicht passt, bist Du selbst schuld.
[code]\documentclass[toc=flat]{scrbook}
\usepackage{blindtext}
\makeatletter
\DeclareRobustCommand*{\redefnumberline}{%
\let\appendix@saved@numberline\numberline
\renewcommand*\numberline[1]{\appendix@saved@numberline{\appendixname~##1}}%
}
\g@addto@macro\appendix{%
\addtocontents{toc}{\noexpand\redefnumberline}%
}
\makeatother
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}[/code]
Option toc=flat ist in diesem Fall notwendig, weil für die Gliederungsnummern nur ein bestimmter Platz reserviert ist. Der reicht natürlich nicht mehr, wenn da auch noch "Anhang" oder "Appendix" davor steht. Bei toc=flat wird hingegen der benötigte Platz selbst berechnet.
Eine Alternative wäre:
[code]\documentclass{scrbook}
\usepackage{blindtext}
\usepackage{tocstyle}
\usetocstyle{classic}
\makeatletter
\DeclareRobustCommand*{\redefnumberline}{%
\renewcommand*{\tocstyle@@numberline}[1]{%
\appendixname~##1\csname autotot\endcsname
}%
}
\g@addto@macro\appendix{%
\addtocontents{toc}{\noexpand\redefnumberline}%
}
\makeatother
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}[/code]
Man sieht an den Beispielen ganz deutlich wie problematisch inkonsistente Vorgaben im Inhaltsverzeichnis sind.
Tatsächlich sinnvoll wäre etwas wie:
[code]\documentclass{scrbook}
\usepackage{blindtext}
\makeatletter
\g@addto@macro\appendix{%
\cleardoubleoddemptypage
\addcontentsline{toc}{part}{\appendixname}%
}
\makeatother
\begin{document}
\tableofcontents
\blinddocument
\appendix
\blinddocument
\end{document}[/code]