# Indentation of chapters, sections, … entries of appendix in TOC and bookmarks with scrreprt

\documentclass{scrreprt}
\begin{document}
\chapter{First Chapter}
\section{First Section of First Chapter}
\section{Secont Section of First Chapter}
\chapter{Second Chapter}
\section{First Section of Second Chapter}
\section{Secont Section of Second Chapter}
\appendix
\chapter{First Appendix}
\section{First Section of First Appendix}
\section{Secont Section of First Appendix}
\chapter{Second Appendix}
\section{First Section of Second Appendix}
\section{Secont Section of Second Appendix}
\end{document}


like this:

1. First Chapter
1.1 First Section of First Chapter
1.2 Second Section of First Chapter
2. First Chapter
2.1 First Section of Second Chapter
2.2 Second Section of Second Chapter
Appendix
A. First Appendix
A.1 First Section of First Appendix
A.2 Second Section of First Appendix
B. First Appendix
B.1 First Section of Second Appendix
B.2 Second Section of Second Appendix


I have a problem quite similar to this, but this solution does not work. It just prints chapter@@section section@@subsection in the TOC.

My solution so far is to put \addcontentsline{toc}{part}{Appendix} in front of the appendencies, but this only fix the bookmark-issue.

I do not recommend such a change of the TOC structure, but it is possible:

\documentclass{scrreprt}

\usepackage{xpatch}
\xapptocmd{\appendix}{%
\cleardoublepage
\ChapAsSecInTOC
\SecAsSubsecInTOC
}{}{\AppendixPatchFailed}
\newcommand*\ChapAsSecInTOC{%
}
\newcommand*\SecAsSubsecInTOC{%
}

\usepackage{bookmark}
\begin{document}
\tableofcontents
\chapter{First Chapter}
\section{First Section of First Chapter}
\section{Secont Section of First Chapter}
\chapter{Second Chapter}
\section{First Section of Second Chapter}
\section{Secont Section of Second Chapter}
\appendix
\chapter{First Appendix}
\section{First Section of First Appendix}
\section{Secont Section of First Appendix}
\chapter{Second Appendix}
\section{First Section of Second Appendix}
\section{Secont Section of Second Appendix}
\end{document}


Or if options listof=chaptergapline, listof=chapterentry etc. should affect entries in LOF and LOT for appendix "chapters", too:

\documentclass{scrreprt}

\usepackage{xpatch}
\xapptocmd{\appendix}{%
\cleardoublepage
\ChapAsSecInTOC
\SecAsSubsecInTOC
}{}{\AppendixPatchFailed}
\newcommand*\ChapAsSecInTOC{%
{}{\PatchFailedI}%
}
\newcommand*\SecAsSubsecInTOC{%
}

\usepackage{bookmark}
\begin{document}
\tableofcontents
\chapter{First Chapter}
\section{First Section of First Chapter}
\section{Secont Section of First Chapter}
\chapter{Second Chapter}
\section{First Section of Second Chapter}
\section{Secont Section of Second Chapter}
\appendix
\chapter{First Appendix}
\section{First Section of First Appendix}
\section{Secont Section of First Appendix}
\chapter{Second Appendix}
\section{First Section of Second Appendix}
\section{Secont Section of Second Appendix}
\end{document}

• yep, that does the thing. :) – sivizius May 11 '18 at 12:45