Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

migrated from stackoverflow.com Jul 23 '12 at 16:08

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 7 down vote accepted

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}
share|improve this answer
    
Thanks Werner! This addresses my issue perfectly –  kevin.arseneau Aug 11 '12 at 1:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.