# TOC: part name in center with out page number

I want to put part name in center of TOC as MODULE - I with out page number.

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{tocstyle}
\renewcommand{\partname}{Module}%

\usetocstyle{standard}
%\settocfeature{pagenumberhook}{}
\addtocentrydefault{part}{}{\protect\parbox{\textwidth}{\protect\centering#2}}% original #1 in second argument
}

\begin{document}

\tableofcontents

\part{A}
\chapter{chapter A}
\section{Section a}
\lipsum
\part{B}
\chapter{chapter B}
\section{Section b}
\lipsum
\end{document}


Instead of redefining l@part you can hack l@part with \addtokomafont:

\addto\captionsenglish is used to redefine the partname. See: Change reports text for bibliography

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{lipsum}
\renewcommand{\partname}{Module}%
}

\makeatletter
\makeatother
\begin{document}

\tableofcontents

\part{A}
\chapter{chapter A}
\section{Section a}
\lipsum
\part{B}
\chapter{chapter B}
\section{Section b}
\lipsum
\end{document}

• I am not able to format TOC with tocstyle when i use above. Jul 4 '13 at 4:50

You can redefine \l@part as implemented in scrbook.cls:

\documentclass{scrbook}

\renewcommand\partname{Module}

\makeatletter
\renewcommand*\l@part[2]{%
\ifnum \c@tocdepth >-2\relax
\setlength{\@tempdima}{2em}%
\if@tocleft
\ifx\toc@l@number\@empty\else
\setlength\@tempdima{0\toc@l@number}%
\fi
\fi
\begingroup
\leavevmode
\centering\usekomafont{partentry}{\partname\ -- #1\nobreak
\usekomafont{partentrypagenumber}{}}\null\par
\ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
\endgroup
\penalty20010
\else
\penalty\@highpenalty
\endgroup
\fi
\fi
}\makeatother

\begin{document}

\tableofcontents
\part{Test Part One}
\chapter{Test Chapter}
\section{Test Section}
\part{Test Part Two}
\chapter{Test Chapter}
\section{Test Section}

\end{document}


• I am not able to format TOC with tocstyle when i use above code. Jul 4 '13 at 4:50
• @sandu that's not enough information. If you want to, you can edit your original question and add there a simple document showing the relevant settings you are using (those for tocstyle`) and showing the problems with the proposed solutions. Jul 4 '13 at 17:20
• MWE is added in the question Jul 5 '13 at 6:15
• Jul 5 '13 at 6:17
• @sandu I don't understand. If you already solved the problem, then there's no need for the comments nor for the edit. Please rollback the edit to your question and leave it ss it initially was. Had I known about the other questio I wouldn't have suggested the edit in the first place. Jul 5 '13 at 11:13