1

Consider the following code:

\documentclass{scrbook}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{Introduction}

\part{A}
\chapter{First}
\chapter{Second}
\chapter{Third}

\part{B}
\chapter{First}
\chapter{Second}
\chapter{Third}

\appendix

\chapter{Appendix}

\end{document}

As expected, there is a lot of space between Introduction and Part I, as Introduction does not belong to Part I.

However, there is little space between Part II and the Appendix, even though Appendix does not belong to Part II.

Is it possible to make the space between Part II and Appendix as large as the space between Introduction and Part I?

I know I can do this manually Space between conclusion and appendices in ToC, but I need to guess the correct spacing.

enter image description here

2 Answers 2

1

If you have only one chapter “Appendix”, you can use the part value of beforeskip for the chapter entries in the appendix:

\documentclass{scrbook}

\AddToHook{cmd/appendix/after}{%
  \addtocontents{toc}{\protect\DeclareTOCStyleEntry[beforeskip:=part]{chapter}{chapter}}
}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{Introduction}

\part{A}
\chapter{First}
\chapter{Second}
\chapter{Third}

\part{B}
\chapter{First}
\chapter{Second}
\chapter{Third}

\appendix

\chapter{Appendix}

\end{document}

one appendix chapter

With a trick, you can do this also, if you have more than one appendix chapter:

\documentclass{scrbook}

\AddToHook{cmd/appendix/after}{%
  \addtocontents{toc}{\ManipulateChapterBeforeskipOnce}
}
\DeclareRobustCommand{\ManipulateChapterBeforeskipOnce}{%
  \DeclareTOCStyleEntry[beforeskip:=chapter]{chapter}{subchapter}%
  \DeclareTOCStyleEntry[beforeskip:=part]{chapter}{chapter}%
  \AddToHook{cmd/l@chapter/after}[restorechapter]{%
    \DeclareTOCStyleEntry[beforeskip:=subchapter]{chapter}{chapter}%
    \RemoveFromHook{cmd/l@chapter/after}[restorechapter]%
  }%
}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{Introduction}

\part{A}
\chapter{First}
\chapter{Second}
\chapter{Third}

\part{B}
\chapter{First}
\chapter{Second}
\chapter{Third}

\appendix

\chapter{First appendix}

\chapter{Second appendix}

\end{document}

enter image description here

Note: Part of the trick is to use subchapter as name for the new entry type, that is used to store the beforeskip value of chapter before changing it. Using another name would need extra declarations like level, indent etc.

However, I wouldn't do this, because it is somehow inconsistent to use semantic, content descriptive names for chapters in the main part but a syntax name in the appendix as shown in the first example. And if you already use semantic names, I would use something like:

\documentclass{scrbook}

\AddToHook{cmd/appendix/before}{%
  \addpart{\appendixname}%
}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{Introduction}

\part{A}
\chapter{First}
\chapter{Second}
\chapter{Third}

\part{B}
\chapter{First}
\chapter{Second}
\chapter{Third}

\appendix

\chapter{One note about \dots}

\chapter{Onother addendum}

\end{document}

or

\documentclass{scrbook}

\AddToHook{cmd/appendix/after}{%
  \cleardoublepage
  \addparttocentry{}{\appendixname}%
}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{Introduction}

\part{A}
\chapter{First}
\chapter{Second}
\chapter{Third}

\part{B}
\chapter{First}
\chapter{Second}
\chapter{Third}

\appendix

\chapter{One note about \dots}

\chapter{Onother addendum}

\end{document}

with appendix part and several chapters

Both are IMHO more consistent and better style than the first suggestion.

1
  • Thanks for covering every possible case.
    – Pygmalion
    Commented Apr 26 at 15:31
1

Instead of an appendix chapter use a appendix part. I added blindtext, because I got (in other examples) strange results with lists of chapters. However:

\documentclass{scrbook}

\usepackage{blindtext}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter

\chapter{Introduction}
\blindtext{}
\part{A}
\chapter{First}
\blindtext{}
\chapter{Second}
\blindtext{}
\chapter{Third}
\blindtext{}

\part{B}
\chapter{First}
\blindtext{}
\chapter{Second}
\blindtext{}
\chapter{Third}
\blindtext{}

\appendix

\part{\appendixname}
% \chapter{Appendix}

\blindtext{}

\blindtext{}
\end{document}

pic of toc

3
  • I do not want Appendix part. This is just a sample problem, I have actually several chapters after Part II.
    – Pygmalion
    Commented Feb 11 at 21:30
  • 1
    @Pygmalion Readers can't come and ask you about the reasons for an inconsistent structure in your book. If you use parts, every chapter has to belong to a part. But this isn't an issue of LaTex.
    – Keks Dose
    Commented Feb 13 at 12:38
  • IMHO, frontmatter and appendices are common to all parts, so should not be contained by a particular part. I doubt this structure breaks some rule book styling rule, but if it does, I am prepared to change it and turn frontmatter and appendices into parts.
    – Pygmalion
    Commented Feb 13 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .