1

I would like to create a \tableofcontents (no modifications) but without page numbering. So here this is very minimal-MWE:

\documentclass[13pt,a4paper,headlines=6,headinclude=true]{scrartcl}
\begin{document}

\tableofcontents

\newpage
\section{Topic A}
\section{Topic B}

\end{document}

enter image description here

  • Are you going to use hyperref? – user31729 Jun 14 '15 at 19:50
  • I think I can do without hyperref. What solution is there? – Mac Jun 14 '15 at 19:54
  • Forget my statement about hyperref. It works too with hyperref, see my solution below – user31729 Jun 14 '15 at 19:59
1

Unless the KOMA classes do not provide other means, the easiest way is to patch the \thepage in \addcontentsline out.

This is the definition of \addcontentsline in latex.ltx:

\def\addcontentsline#1#2#3{%
  \addtocontents{#1}{\protect\contentsline{#2}{#3}{\thepage}}}

By applying a patch to kick the \thepage out, there will be an empty {} pair then, i.e. no page number.

\documentclass[13pt,a4paper,headlines=6,headinclude=true]{scrartcl}


\usepackage{xpatch}

\xpatchcmd{\addcontentsline}{%
  {\thepage}%
}{{}}{\typeout{success}}{}


\begin{document}

\tableofcontents

\clearpage
\section{Topic A}
\section{Topic B}

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.