# How to add “Appendix” as an ToC entry (documentclass: 'article') before the appendices without a pagenumber

I have tried to add "Appendix" in my ToC between the main work and my appendices. I also don't want any page number to be displayed for this ToC entry.

So far I have managed to bodge in an entry like this:

\documentclass[11pt,a4paper]{article}
\usepackage{tocstyle}
\usetocstyle{standard}
\settocstylefeature[-1]{pagenumberbox}{\csname @gobble\endcsname}%no page numbers for part

\begin{document}
\tableofcontents

\section{Section in main text}
Bla bla bla...

\clearpage
\appendix

\section{First appendix}
Bla bla bla...

\end{document}


This gives me an ToC entry that's is formatted like I want. But the hyperlink in the ToC points to the last page before the appendices.

How do I make the ToC entry so that the link points to the first page of my appendices?

Do you have any suggestions for a better/less tricky way of getting the TOC entry like i want?

The trick is to fake a contentsline with empty page numbers. \addcontentsline will cause the page number to be inserted, by using intermediate .aux file step.

\addtocontents{toc}{\protect\contentsline{part}{\appendixname}{}{}}


\@writefile{toc}{\contentsline {part}{Appendix}{}{}}


to the .aux file, the \@writefile command will then provide the correct line to the .toc finally.

Please note the \protect, since \contentsline is highly fragile.

\documentclass[11pt,a4paper]{article}
\usepackage{tocstyle}
\usetocstyle{standard}
\settocstylefeature[-1]{pagenumberbox}{\csname @gobble\endcsname}%no page numbers for part
\usepackage{hyperref}
\begin{document}
\tableofcontents

\section{Section in main text}
Bla bla bla...

\clearpage
\appendix

\section{First appendix}
Bla bla bla...

\end{document}


Edit The version with an explicit hyperlink to the appendix start (which is the same page as the first appendix section, in this case)

\documentclass[11pt,a4paper]{article}

\usepackage{tocstyle}
\usepackage{blindtext}

\usetocstyle{standard}
\settocstylefeature[-1]{pagenumberbox}{\csname @gobble\endcsname}%no page numbers for part

\usepackage{hyperref}

\begin{document}
\tableofcontents

\section{Section in main text}
\blindtext[10]

\clearpage
\hypertarget{appendixstart}{\appendix}% Make a anchor here