I am using the scrbook
class and I (for some reasons) need to redefine the commands \thesection
and etc. The problem is that this modifies the TOC entries. And I want to restore the TOC entries to the normal format, i.e,
- Chapter
1.2 Section
1.2.3 Subsection
but now I just have:
- Chapter
- Section
- Subsection
I solved this problem for the headers by redefining the command \sectionformat
, but I did not find any equivalent command to the TOC entries.
\documentclass[12pt]{scrbook}
\usepackage{scrextend}
\usepackage[automark]{scrlayer-scrpage} % instead of fancyhdr
\renewcommand\thepart{\arabic{part}}
\renewcommand\thechapter{\arabic{chapter}}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\arabic{subsection}}
\renewcommand\thesubsubsection{\arabic{subsubsection}}
\renewcommand{\chaptermarkformat}{}
\renewcommand*\sectionformat{\thechapter.\thesection\enskip}
\renewcommand*\subsectionformat{\thechapter.\thesection.\thesubsection\enskip}
\begin{document}
\tableofcontents
\chapter{One}
\section{two}
\subsection{three}
\chapter{One}
\section{two}
\subsection{three}
\chapter{One}
\section{two}
\subsection{three}
\chapter{One}
\section{two}
\subsection{three}
\end{document}
Best Answer
Disclaimer: The desired output seems strange to me and I do not suggest to use different numbers in headings, page header and ToC.
If you want to change the numbers in headings and references redefine
\addsectiontocentry
and\addsubsectiontocentry
to restore the numbers in ToC to the original format:If you only want to change the numbers in the headings and not in page header, ToC and references, then you can redefine
\sectionformat
etc.Additional remark: Do not load package
scrextend
with a KOMA-Script class. Packagescrextend
provides some basic KOMA-Script features for usage with other classes.