I want to add to TOC a section without a section number and a page number.
I have the following MWE.
Code: Select all
\documentclass{article}
%Add dots for Sections in TOC
\makeatletter
\renewcommand\l@section[2]{%
\ifnum \c@tocdepth >\z@
\addpenalty\@secpenalty
\addvspace{1.0em \@plus\p@}%
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\hskip -\leftskip
#1\nobreak\
\leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}
\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\endgroup
\fi}
\makeatother
\def\contentsname{\centering Contents}
\begin{document}
\addtocontents{toc}{\hfill\textbf{Page}\par}
%\clearpage\phantomsection
\addcontentsline{toc}{section}{Contents}
\tableofcontents
\newpage
\section{First Section}
\newpage
\section{Second Section}
\newpage
\subsection{First Subsection of the Second Section}
\newpage
\subsection{Second Subsection of the Second Section}
\newpage
\section{Third Section}
\newpage
\pagestyle{empty}
\section*{Section without Page Number}
\addcontentsline{toc}{section}{Section without Page Number}
\end{document}
Thank you very much.
bkarpuz