GeneralDon't want to have sections in Appendices in TOC

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
sabiha
Posts: 7
Joined: Wed Sep 03, 2008 9:40 am

Don't want to have sections in Appendices in TOC

Post by sabiha »

I am using the package \usepackage{appendix} in my thesis. The problem is that I get all the sections included in Appendices in TOC. I want to show only "Appendices" in TOC. Another thing is that before the heading of Appendices it is putting "A" both in TOC and in text. How can I get rid of this?

Regards,

Sabiha

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Don't want to have sections in Appendices in TOC

Post by gmedina »

Hi sabina,

you could use the starred versions of the sectioning commands along with \addcontentsline as the following example suggests:

Code: Select all

\documentclass{report}
\usepackage{appendix}

\begin{document}

\tableofcontents

\appendix
\chapter*{Dummy appendix}
\addcontentsline{toc}{chapter}{Dummy appendix}
\section*{First section in appendix}
\section*{Second section in appendix}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
sabiha
Posts: 7
Joined: Wed Sep 03, 2008 9:40 am

Re: Don't want to have sections in Appendices in TOC

Post by sabiha »

Hello gmedina,

I have tried this but it has removed the Appendix number in the text as well. Also the "A" is still there. I want to have the numbered headings of each appendix in Appendices but I dont want to have these in TOC.

Still confused.

Sabiha
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Don't want to have sections in Appendices in TOC

Post by Stefan Kottwitz »

Hi Sabiha,

you could change the tocdepth counter, try this example:

Code: Select all

\documentclass{report}
\usepackage{appendix}

\begin{document}
\tableofcontents
\chapter{Test chapter}
\section{Test section}

\appendix
\cleardoublepage
\addcontentsline{toc}{chapter}{Appendix}
\addtocontents{toc}{\protect\setcounter{tocdepth}{-2}}
\chapter{Chapter in appendix}
\section{Section in appendix}
\end{document}
Stefan
LaTeX.org admin
sabiha
Posts: 7
Joined: Wed Sep 03, 2008 9:40 am

Don't want to have sections in Appendices in TOC

Post by sabiha »

Hi,

Code: Select all

\addcontentsline{toc}{chapter}{Appendix}
worked fine and now I see my customized heading in toc as "Appendix"

but

Code: Select all

\addtocontents{toc}{\protect\setcounter{tocdepth}{-2}}
made no effect to chapter headings in toc?? this means I still see chapter headings and toc. (section headings are gone from toc now)

Regards,
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Don't want to have sections in Appendices in TOC

Post by gmedina »

Hi sabina,

then we will need some more information. Can you please post a minimal working example showing the undesired bahaviour? (if you follow the link, you will find instructions to build such an example).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Re: Don't want to have sections in Appendices in TOC

Post by Stefan Kottwitz »

Hi sabiha,

compile two times to get the updated toc, if necessary follow gmedinas link to provide a mwe.
The more information the quicker and better the advice. In some minutes I'll be away for the weekend but there are more helpful people in the community.

Stefan
LaTeX.org admin
sabiha
Posts: 7
Joined: Wed Sep 03, 2008 9:40 am

Re: Don't want to have sections in Appendices in TOC

Post by sabiha »

Hi all!

I have some how managed to solve this problem (actually compromised ;) ) due to time constraints.

But I really appreciate your efforts to take me out this problem.

Regards.

Sabiha
Post Reply