1

I'm currently using \documentclass{book} and I'd like to remove the roman numeral before the parts of my TOC. It currently looks like this:

enter image description here

What I did before was use \part* and \addcontentsline{toc}{part}{this is the first part} but I figured that I need the \part numbering for a different code thus, I have to strictly use \part.

1

You don't have to use the starred version if you want no part label to appear in the toc. With the newlinetospace option, it is needless to use the optional argument to remove a line break in titles: it is automatically converted to a horizontal space in table of contents and headers.

enter image description here

\documentclass[12pt,a4paper,oneside]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[newlinetospace, newparttoc]{titlesec}

\titleformat{\part}[display]{}{}{1em}{\sffamily\huge}

\usepackage{titletoc}
\titlecontents{part}[0em]
    {\vspace{2em}\large\bfseries\sffamily\relax}
    {\contentslabel[\relax]{0em}}{}{\hfill\contentspage}

\begin{document}

\tableofcontents

\part{Introduction}
    Bla

\part{Example 1:\\Foo}%
    Bla

\part{Example 2:\\Bar}%[
    Bla

\part{Appendix}
    Bla

\end{document} 

Does this suit your requirements?

If you feel the answer is as per your requirements please upvote the answer by clicking on the red triangle at the left and the tick mark below it

1
  • amazing!! this works really well! Thank you!!!
    – Kylie
    Nov 29 '19 at 2:57
0

enter image description hereYou can patch \@part (defined in book.cls) and remove the insertion of \thepart and the subsequent space (\hspace{1em}):

\documentclass{book}

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@part}% <cmd>
  {\thepart\hspace{1em}}% <search>
  {}% <replace>
  {}{}% <success><failure>
\makeatother

\begin{document}

\tableofcontents

\part{First part}

\end{document}

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.