1

I'm trying to add the appendix to my thesis and I've used the following commands:

\begin{appendices}
\chapter{Performance Tables of ABCD}
\input{tab1}
\input{tab2}
\input{tab3}
\input{tab4}
\input{realworld}
\end{appendices}

And I've used the following package:

\usepackage[titletoc]{appendix}

The problem is that it shows the following:

enter image description here

How can I get it to show just Appendix A? Sorry if this is a stupid question.

  • Try using \chapter*{} – Markus Mar 25 '14 at 18:11
3

I assume you already have some definitions in your preamble regarding the way chapters are set in the ToC. As such, some minor adaptation listed below will allow you to switch off the Chapter insertion for the appendices:

enter image description here

\documentclass{report}

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\newcommand{\frontmatternumberline}{%
  \renewcommand{\numberline}[1]{\@chapapp~##1\hfill\mbox{}\par\nobreak}}
\newcommand{\appendixnumberline}{%
  \renewcommand{\numberline}[1]{##1\hfill\mbox{}\par\nobreak}}
\patchcmd{\l@chapter}% <cmd>
  {#1}% <search>
  {\frontmatternumberline #1}% <replace>
  {}{}% <success><failure>
\AtBeginEnvironment{appendices}{% Do the following when you hit \begin{appendices}
  \addtocontents{toc}{\string\let\string\frontmatternumberline\string\appendixnumberline}}
\makeatother

\usepackage[titletoc]{appendix}

\begin{document}

\tableofcontents

\chapter{Introduction}

\chapter{Preliminaries}
\section{Problem definition}
\section{Genetic algorithms}
\section{Ant algorithms}
\section{Previous work}

\begin{appendices}
\chapter{An appendix}
\section{First appendix}
\section{Second appendix}
\section{Last appendix}
\end{appendices}

\end{document}

The use of \string - similar to \protect in this case - is to ensure that the macro insertions into the ToC do not expand.

  • Good solution, just came across this. Thank you! – muddy Mar 12 '15 at 2:27
0

With \chapter* the chapter should not appear in the TOC.

\begin{appendices}
\chapter*{Performance Tables of ABCD}
...
\end{appendices}
  • Doing that ends up removing the entry from the toc altogether apparently. – muddy Mar 25 '14 at 18:16
  • How about adding \phantomsection after \begin{appendices}? – Markus Mar 25 '14 at 18:18
  • That doesn't change the output either. – muddy Mar 25 '14 at 18:20
  • 1
    What documentclass are you using? In book for example it only says Appendix A in the TOC. Could you provide a minimal working example? – Markus Mar 25 '14 at 18:27
  • 2
    If I compile this I get Appendix A Performance... in the TOC. Using \chapter[]{...} I get Appendix A. This is what you want right? It is important to have a MWE to figure out what's not going expectedly. – Markus Mar 25 '14 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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