Page LayoutContents without appendix

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
bleagos
Posts: 5
Joined: Mon Mar 07, 2011 12:27 pm

Contents without appendix

Post by bleagos »

Hi,
I was just wondering how you could make the table of contents not show appendices?

Thanks

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Re: Contents without appendix

Post by west.logan »

Do you have a MWE? What class are you using?
bleagos
Posts: 5
Joined: Mon Mar 07, 2011 12:27 pm

Contents without appendix

Post by bleagos »

west.logan wrote:Do you have a MWE? What class are you using?
I am using article but am not sure what an MWE is?
west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Re: Contents without appendix

Post by west.logan »

Sorry about that. An MWE is "Minimum Working Example" and the forum rules specify that you should post one when asking a question. I'd suggest reading those right away. It helps others to be able to quickly help you, rather than spend a lot of time trying to come up with something they can test their ideas on.

Welcome to the forum!
bleagos
Posts: 5
Joined: Mon Mar 07, 2011 12:27 pm

Contents without appendix

Post by bleagos »

Ah ok... So something like this:

Code: Select all

\documentclass[a4paper,12pt]{article}
\begin{document}
\tableofcontents
\section{Section 1}
.....
\appendix
\section{Appendix A}
\end{document}
I want it so that my table of contents only shows the sections rather than the appendices aswell.
Thanks
west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Contents without appendix

Post by west.logan »

There are a couple of ways you could do it, one would be to use the

Code: Select all

\section*{First Appendix}
command. This would prevent it from showing up in the ToC but it would also eliminate automatic numbering.

If you need the automatic numbering, I'd suggest just changing it with something like:

Code: Select all

\documentclass[a4paper,12pt]{article}

%command to remove appendix from ToC
\renewcommand{\appendix}{%
 \setcounter{section}{0}
  \renewcommand{\section}[1]{%
  \addtocounter{section}{1}\vspace{1em}\par\noindent\bfseries\Large Appendix \Alph{section}: ##1%
  \vspace{1em}\par\noindent\normalfont\normalsize}%
}

\begin{document}
\tableofcontents
\section{First Section}
This is some text.
\section{Second Section}
This is some more text.

\appendix
\section{First Appendix}
This is some text.
\section{Second Appendix}
This is some more text
\end{document}
I basically just redefined the section command after "\appendix" is called.
Post Reply