7

I would like my appendices to behave like sections under the ToC but keep them as chapters in my document.

Here is a MWE of my current structure:

\documentclass[11pt,a4paper,oneside,openright]{book}

\begin{document}

\tableofcontents

\chapter{Introduction}
\section{Section 1}

\chapter{Literature Review}
\section{Section 2}

\chapter{Methodology and Data}
\section{Section 3}

\chapter{Results}
\section{Section 4}

\chapter{Conclusion}
\section{Section 5}

\appendix
\addcontentsline{toc}{chapter}{Appendices}

\chapter{First Appendix}

\chapter{Second Appendix}

\end{document}

I would like to indent the two appendices in the ToC to fall under the \addcontentsline entry as sections.

I have tried to do this by making the appendices into actual sections, but when I do this I get entries like '.A' and '.B' which is untidy. I'd like to keep the typical alph list for my appendices.

i.e.

Contents

1   Introdution
    1.1   Section 1

...    

Appendices
    A. First Appendix
    B. second Appendix

Has anyone else tried to format their ToC with appendices in this way?

0

1 Answer 1

11

Add

\makeatletter
\addtocontents{toc}{\let\protect\l@chapter\protect\l@section}
\makeatother

before calling your \chapter appendices. The above command changes \l@chapter to be equivalent to \l@section - these two macros are used when setting the ToC entries labelled as chapter and section, respectively. As such, the equivalence causes \chapter-style ToC entries to be set just like \section-style entries would be. Since writing to the ToC is fragile, \protection is required.

Here's your MWE with above incorporation:

enter image description here

\documentclass[11pt,a4paper,oneside,openright]{book}

\begin{document}

\tableofcontents

\chapter{Introduction}\section{Section 1}
\chapter{Literature Review}\section{Section 2}
\chapter{Methodology and Data}\section{Section 3}
\chapter{Results}\section{Section 4}
\chapter{Conclusion}\section{Section 5}

\appendix
\addcontentsline{toc}{chapter}{Appendices}
\makeatletter
\addtocontents{toc}{\let\protect\l@chapter\protect\l@section}
\makeatother

\chapter{First Appendix}
\chapter{Second Appendix}

\end{document}
0

You must log in to answer this question.

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