# Custumize TOC only for the appendix part

I am currently writing in article class and I would like to do something really specific in my toc. Currently it looks like this:

I got the phrase "Appendices" in there by using

    \phantomsection\addcontentsline{toc}{section}{Appendices}\appendix


This is almoast what I was going for but not quite. Since "Appendices" is not really a section of its own, I would like to remove the page number that it gets. Also I would like the white space between the last (real) section and the word "Appendices" to be slightly yet noticeably larger than it is between the other entries.

It is probably clear to you that I'm trying to implement something to my toc that makes a clear visual distiction between the main part and the rest of the document. If someone knows a better/easier way to do this, than by the means I'm trying; please do let me know.

Here's a MWE:

    \documentclass[12pt,a4paper]{article}
\usepackage[dutch]{babel}
\usepackage{amsfonts,amsmath,amstext,amsthm,amssymb,graphicx,mathtools,scrextend,xcolor}
\usepackage{babelbib}
\begin{document}
\tableofcontents
\section{Centrale...}
\subsection{De stelling...}
\section{De Brauer}
\section{Quasi-...}

\section{Nulpunten...}
\section{Formele...}
\end{document}


Edit: The answer provided by Steven B. Segletes works almost perfectly, except that it doesn't seem to work in combination whith the hyperref package. Excluding the hyperref package is not an option, so I'm adding compatibility with hyperref to my question.

• not tested: try substituting "part" for "section". – barbara beeton Oct 17 '14 at 19:28
• @barbarabeeton: It's the article class, according to the OP, so there is no part. \phantomsection\addtocontents{toc}{Appendices}\appendix could help – user31729 Oct 17 '14 at 19:38
• Both suggestions did not work. Substituting "part" only made the font size bigger. Leaving {section} out gave an error. – gebruiker Oct 17 '14 at 19:41
• @ChristianHupfer -- before i commented, i checked article.cls. it does contain lines like \addcontentsline{toc}{part}{#1}, so part is defined. what i wasn't sure about is whether it would produce the desired output. which is why i wrote a comment, not an answer. – barbara beeton Oct 17 '14 at 20:11
• @barbarabeeton: Alright, I did not check it, since I was rather sure that part is not defined. – user31729 Oct 18 '14 at 8:31

REVISED APPROACH (using \contentsline revision, to handle hyperref)

With this revision, I totally reworked the approach. The first key was the invocation of the phantom section as

\phantomsection\addcontentsline{toc}{Z}{%
\protect\rule{0pt}{5ex}{\Large Appendices}}


to use type sectioning type Z instead of section. To handle this possibility, I had to redefine \contentsline as follows:

\renewcommand\contentsline[4]{%
\ifx Z#1\relax\svcontentsline{section}{#2}{}{#4}\else
\svcontentsline{#1}{#2}{#3}{#4}\fi
}


In this way, if a Z is detected as the first argument of \contentsline, it invokes \svcontentsline{section}{#2}{}{#4} with a blank argument #3, which is the page number. If #1 is not a Z, the traditional invocation is made.

\documentclass{article}
\usepackage{ifthen}
\providecommand\phantomsection{}
\usepackage{hyperref}
\newcounter{appndx}
\newcommand\anappendix[2][x]{
\clearpage
\refstepcounter{appndx}
\setcounter{section}{\arabic{appndx}}
\renewcommand\thesection {\appendixname~\Alph{appndx}.}
\setcounter{subsection}{0}
\renewcommand\thesubsection {\Alph{appndx}.\@arabic\c@subsection}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{equation}{0}
\setcounter{figure}{0}
\renewcommand\thefigure{\Alph{appndx}-\@arabic\c@figure}
\setcounter{table}{0}
\renewcommand\thetable{\Alph{appndx}-\arabic{table}}
\renewcommand\theequation {\Alph{appndx}-\arabic{equation}}
\setcounter{footnote}{0}
\def\appendixtitle{\appendixname~\Alph{appndx}. #2}
\if p#1\vspace*{\fill}\fi
{\centering\theappendix\appendixtitle\par}
\if p#1\vspace*{\fill}\clearpage\fi
}
\newcommand\theappendix[1]{
\section*{#1}
}
\let\svcontentsline\contentsline
\renewcommand\contentsline[4]{%
\ifx Z#1\relax\svcontentsline{section}{#2}{}{#4}\else
\svcontentsline{#1}{#2}{#3}{#4}\fi
}
\begin{document}
\tableofcontents

\section{Centrale ...}
\subsection{De stelling...}
\section{De Brauer...}
\section{Quasi-algebraic...}

\clearpage
\protect\rule{0pt}{5ex}{\Large Appendices}}

\anappendix{Nulpunten...}
xyz
\anappendix{Formele...}
xyz

\end{document}


ORIGINAL APPROACH (using white page number)

Obviously, without an MWE on the OP's part, I had to construct my own version of appendices, nonetheless, the following works (in article class). The key line:

\phantomsection\addcontentsline{toc}{section}{%
\protect\rule{0pt}{5ex}{\Large Appendices}\color{white}}


The \color{white} makes sure the page number is printed in white. The protected \rule adds header space above the name Appendices. The \Large makes it the same size as Contents, though perhaps you might change that to suit.

[As noted by OP, Doesn't quite Work] with hyperref. Here is the MWE:

\documentclass{article}
\usepackage{xcolor}
\providecommand\phantomsection{}
%\usepackage{hyperref}
\newcounter{appndx}
\newcommand\anappendix[2][x]{
\clearpage
\refstepcounter{appndx}
\setcounter{section}{\arabic{appndx}}
\renewcommand\thesection {\appendixname~\Alph{appndx}.}
\setcounter{subsection}{0}
\renewcommand\thesubsection {\Alph{appndx}.\@arabic\c@subsection}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{equation}{0}
\setcounter{figure}{0}
\renewcommand\thefigure{\Alph{appndx}-\@arabic\c@figure}
\setcounter{table}{0}
\renewcommand\thetable{\Alph{appndx}-\arabic{table}}
\renewcommand\theequation {\Alph{appndx}-\arabic{equation}}
\setcounter{footnote}{0}
\def\appendixtitle{\appendixname~\Alph{appndx}. #2}
\if p#1\vspace*{\fill}\fi
{\centering\theappendix\appendixtitle\par}
\if p#1\vspace*{\fill}\clearpage\fi
}
\newcommand\theappendix[1]{
\section*{#1}
}
\begin{document}
\tableofcontents

\section{Centrale ...}
\subsection{De stelling...}
\section{De Brauer...}
\section{Quasi-algebraic...}

\clearpage
\protect\rule{0pt}{5ex}{\Large Appendices}\color{white}}

\anappendix{Nulpunten...}
xyz
\anappendix{Formele...}
xyz

\end{document}


• How geniously simple. In my case however the \color{white} command doesn't do anything. I've added a MWE. Can you perhaps see why it's not working. – gebruiker Oct 17 '14 at 20:01
• @gebruiker You are right that it does not work with hyperref. I'll give it some more thought, but I am not optimistic. – Steven B. Segletes Oct 17 '14 at 21:52
• I've noticed that colouring does apply to "Appendices" in combination with hyperref, just not the page number... :( – gebruiker Oct 17 '14 at 21:56
• @gebruiker Please see revision. – Steven B. Segletes Oct 18 '14 at 1:03
• Thank you, that totally did it. One important thing that should perhaps be mentioned is that \let\svcontentsline\contentsline \renewcommand\contentsline[4]{% \ifx Z#1\relax\svcontentsline{section}{#2}{}{#4}\else \svcontentsline{#1}{#2}{#3}{#4}\fi }  should be uesed after \usepackage{hyperref} or else you'll get an error. Also when I tried to run it, I didn't need to load the ifthen-package... – gebruiker Oct 18 '14 at 12:02