The command \addtocontents
is mainly intended to be used to enter formatting information (extra spacing, for example) not directly related to any particular actual line of contents of the ToC; if you want to introduce some text together with some information (such as the page number) and some formatting (such as the one used for a particuar sectional unit), then you might want to use \addcontentsline
:
\documentclass{book}
\begin{document}
\tableofcontents
\chapter{chap1}
\chapter{chap2}
\addcontentsline{toc}{chapter}{test}
\chapter{chap3}
\end{document}
If used together with the hyperref
package, a \phantomsection
command should also be included to get the proper result for the hyperlinks in the table of contents and for the bookmarks.
EDIT: since you don't want the page number nor any special formatting for the text to be included, then you can use \addtocontents
:
\documentclass{memoir}
\begin{document}
\tableofcontents
\chapter{chap1}
\chapter{chap2}
\addtocontents{toc}{\bigskip text\par}
\chapter{chap3}
\end{document}