[Tex/LaTex] Remove the chapter number in ToC

chapterskoma-scriptscrpage2table of contentstitlesec

I am using the latest version of the LaTeX template of Matthias Pospiech, see http://www.matthiaspospiech.de/blog/2016/05/09/latex-thesis-template-3-2-4-released/.

In my MWE I try to achieve the following: I created a chapter with \chapter[Chapter 1: Headline]{Headline} and in the ToC it is printed as 1 Chapter 1: Headline.

I want to remove the first 1, so that Chapter 1: Headline will be displayed in combination that the styling of the chapter itself on the page where the chapter begins and the styling of the header of the pages should be still the same. So only removing the chapter number 1 without changing something else in the document.

\documentclass[paper=a4,version=last,english]{scrbook}

\usepackage{templatetools}
\usepackage{lipsum}
\usepackage{babel}
\usepackage[style=apa,backend=biber]{biblatex}
\usepackage[automark,komastyle]{scrpage2}
\usepackage{pageslts}

\ifcsdef{chapter}
    {\usepackage{titlesec}}
    {\usepackage{titlesec} \csundef{chapter}}

\usepackage{titletoc}
\usepackage{pdfpages}

\IfPackageLoaded{scrpage2}{
\IfElseDefined{chapter}{
   \pagestyle{scrheadings}
}{
   \pagestyle{scrplain}
}
\IfElseDefined{chapter}{
   \ohead{\pagemark}
   \ihead{\headmark}
   \ofoot[\pagemark]{}
}{
   \cfoot[\pagemark]{\pagemark}
}
\IfElseDefined{chapter}{
   \automark[section]{chapter}
}{
   \automark[subsection]{section}
}
\IfDefined{chapter}{
   \setheadsepline{.4pt}[\color{black}]
}
}
\IfPackageLoaded{titlesec}{
\titleformat{\chapter}[display]
  {\usekomafont{chapter}\Large \color{black}}
  {\LARGE\MakeUppercase{\chaptertitlename}
   \Huge~\thechapter \filright}
  {1pt}
  {
   \titlerule \vspace{0.9pc}\vspace{-\parskip}
   \filright 
   \IfColorDefined{sectioncolor}{\color{sectioncolor}}{}   
  }
  [\color{black} \vspace{0.9pc} \filright {\titlerule}]
}

\makeatletter
\@ifundefined{frontmatter}{
   \newcommand{\frontmatter}{
      \pagenumbering{roman}
   }
}{}
\@ifundefined{mainmatter}{
   \newif\if@mainmatter\@mainmattertrue
   \newcommand{\mainmatter}{
      \pagenumbering{arabic}
      \setcounter{page}{1}
   }
}{}
\makeatother

\begin{document}
\frontmatter
\IfPackageLoaded{scrpage2}{\pagestyle{scrheadings}}
\tableofcontents

\mainmatter

\addchap{General Introduction}
\lipsum[1]

\chapter[Chapter 1: Headline]{Headline}
\lipsum[3-10]

\end{document}

Best Answer

Note that neither package titletoc nor package titlesec should be used with a KOMA-Script class. Package scrpage2 is deprecated for years. Its successor is scrlayer-scrpage.

You could add

\DeclareTOCStyleEntry[
  numwidth=0pt,
  entrynumberformat=\noentrynumber
]{chapter}{chapter}
\newcommand*\noentrynumber[1]{}
\renewcommand*\chaptermarkformat{}

to remove the chapter numbers from TOC and page header. Note that the chapter entries in TOC then will be controlled by package tocbasic.

Remove package titletoc and use

\DeclareTOCStyleEntry[
  numwidth=0pt,
  entrynumberformat=\noentrynumber
]{chapter}{chapter}
\newcommand\noentrynumber[1]{}

enter image description here

enter image description here

But I think it would be better to remove the optional argument of the chapters (and the manuel numbering in it) and insert the chapter prefix in TOC by changing entrynumberformat for chapterentries:

\DeclareTOCStyleEntry[
  dynnumwidth,
  entrynumberformat=\chapterentrynumber
]{chapter}{chapter}
\newcommand\chapterentrynumber[1]{\def\autodot{:}\chaptername\ #1}
\renewcommand\chaptermarkformat{\chaptername\ \thechapter:\enskip}

Then you have to run the code three times to get:

enter image description here

Code:

% Disclamer:
% The following code is mainly the MWE from the question.
% Note that you should not use packages titlesec and titletoc
% together with a KOMA-Script class.
% Package `scrpage2` is deprecated. Its successor is scrlayer-scrpage.
% So I do not recommend to use the following code.
\documentclass[paper=a4,version=last,english]{scrbook}

\usepackage{templatetools}
\usepackage{lipsum}
\usepackage{babel}
\usepackage[style=apa,backend=biber]{biblatex}
\usepackage[automark,komastyle]{scrpage2}
\usepackage{pageslts}

\ifcsdef{chapter}
    {\usepackage{titlesec}}
    {\usepackage{titlesec} \csundef{chapter}}

\usepackage{titletoc}
\usepackage{pdfpages}

\IfPackageLoaded{scrpage2}{
\IfElseDefined{chapter}{
   \pagestyle{scrheadings}
}{
   \pagestyle{scrplain}
}
\IfElseDefined{chapter}{
   \ohead{\pagemark}
   \ihead{\headmark}
   \ofoot[\pagemark]{}
}{
   \cfoot[\pagemark]{\pagemark}
}
\IfElseDefined{chapter}{
   \automark[section]{chapter}
}{
   \automark[subsection]{section}
}
\IfDefined{chapter}{
   \setheadsepline{.4pt}[\color{black}]
}
}
\IfPackageLoaded{titlesec}{
\titleformat{\chapter}[display]
  {\usekomafont{chapter}\Large \color{black}}
  {\LARGE\MakeUppercase{\chaptertitlename}
   \Huge~\thechapter \filright}
  {1pt}
  {
   \titlerule \vspace{0.9pc}\vspace{-\parskip}
   \filright 
   \IfColorDefined{sectioncolor}{\color{sectioncolor}}{}
  }
  [\color{black} \vspace{0.9pc} \filright {\titlerule}]
}

\makeatletter
\@ifundefined{frontmatter}{
   \newcommand{\frontmatter}{
      \pagenumbering{roman}
   }
}{}
\@ifundefined{mainmatter}{
   \newif\if@mainmatter\@mainmattertrue
   \newcommand{\mainmatter}{
      \pagenumbering{arabic}
      \setcounter{page}{1}
   }
}{}
\makeatother

\DeclareTOCStyleEntry[% <- added
  dynnumwidth,
  entrynumberformat=\chapterentrynumber
]{chapter}{chapter}
\newcommand\chapterentrynumber[1]{\def\autodot{:}\chaptername\ #1}% <- added
\renewcommand\chaptermarkformat{\chaptername\ \thechapter:\enskip}%<- added

\begin{document}
\frontmatter
\IfPackageLoaded{scrpage2}{\pagestyle{scrheadings}}
\tableofcontents

\mainmatter

\addchap{General Introduction}
\lipsum[1]

\chapter{Headline}% <- changed
\lipsum[3-10]

\end{document}
Related Question