Note that package tocstyle
is not developed anymore. Therefore you will get warnings.
I would suggest to use commands, options etc. of package tocbasic
. This package is also part of the KOMA-Script bundle and the KOMA-Script class loads tocbasic
automatically.
Suggestion without tocstyle
:
\documentclass[twoside, openright, BCOR=1cm, headsepline,chapterprefix=true,
toc=indentunnumbered% <- added
]{scrreprt}
\usepackage{lipsum}% only for dummy text
%%---header/footer
\usepackage[manualmark]{scrlayer-scrpage}
\automark{chapter}
%%--"Chapter #" in lehead, chapter name in rohead
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
\addtokomafont{chapterentry}{\mdseries}
\DeclareTOCStyleEntry[
entrynumberformat=\textbf,
numsep=16pt,
dynnumwidth
]{chapter}{chapter}
%%---add "Chapter #" in TOC before chapter title, only for numbered chapters
\let\oldaddchaptertocentry\addchaptertocentry
\renewcommand{\addchaptertocentry}[2]{%
\ifstr{#1}{}{%
\oldaddchaptertocentry{#1}{#2}}{%
\oldaddchaptertocentry{\chapapp{} #1}{#2}%
}}
\setcounter{secnumdepth}{\chapternumdepth}
\setcounter{tocdepth}{\chaptertocdepth}
\renewcommand\chapterpagestyle{empty}% if all chapter pages should use page style empty
\begin{document}
\tableofcontents
\chapter{An interesting title}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\addchap{Unnumbered chapter}
\newpage
\section{Section title}
\lipsum[6-15]
\end{document}
Run three times to get:

If the page number of the chapter entry should be bold too, you can add
pagenumberformat=\usekomafont{chapterentry}\textbf
to the options of \DeclareTOCStyleEntry
for chapter.
Example:
\documentclass[twoside, openright, BCOR=1cm, headsepline,chapterprefix=true,
toc=indentunnumbered% <- added
]{scrreprt}
\usepackage{lipsum}% only for dummy text
%%---header/footer
\usepackage[manualmark]{scrlayer-scrpage}
\automark{chapter}
%%--"Chapter #" in lehead, chapter name in rohead
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{\chaptermarkformat}{}}{#1}%
}
\AfterTOCHead[toc]{\markboth{}{\contentsname}}
\addtokomafont{chapterentry}{\mdseries}
\DeclareTOCStyleEntry[
entrynumberformat=\textbf,
pagenumberformat=\usekomafont{chapterentry}\textbf,
dynnumwidth
]{chapter}{chapter}
%%---add "Chapter #" in TOC before chapter title, only for numbered chapters
\let\oldaddchaptertocentry\addchaptertocentry
\renewcommand{\addchaptertocentry}[2]{%
\ifstr{#1}{}{%
\oldaddchaptertocentry{#1}{#2}}{%
\oldaddchaptertocentry{\chapapp{} #1}{#2}%
}}
\setcounter{secnumdepth}{\chapternumdepth}
\setcounter{tocdepth}{\chaptertocdepth}
\renewcommand\chapterpagestyle{empty}% if all chapter pages should use page style empty
\begin{document}
\tableofcontents
\chapter{An interesting title}
\newpage
\section{A slightly less interesting title}
\lipsum[1-5]
\addchap{Unnumbered chapter}
\newpage
\section{Section title}
\lipsum[6-15]
\end{document}
Run three times to get:
