2

As described above, I need to enlarge the space between the label and the content of the item of the section of Table of content (\l@part to be exact). and I typed the command \setlength\labelsep{10em}; but it does't work. See below, I want to enlarge the space marked in red rectangle

the space marked in red rectangle

enter image description here

The .cls file corresponding to the format of the above output

\renewcommand*\l@part[2]{%

  \ifnum \c@tocdepth >-2\relax

    \addpenalty{-\@highpenalty}%

    \addvspace{2.25em \@plus\p@}%

    \setlength\@tempdima{3em}%

    \begingroup

      \parindent \z@ \rightskip \@pnumwidth

      \parfillskip -\@pnumwidth

      {\leavevmode

       \large \bfseries #1

       \leaders\hbox{$\m@th\mkern 1.5mu\cdot\mkern 1.5mu$}

       \hfil \hb@xt@\@pnumwidth{\hss #2}}\par

       \nobreak

         \global\@nobreaktrue

         \everypar{\global\@nobreakfalse\everypar{}}%

    \endgroup
  \fi}

A minimal example is provided:

\documentclass[10pt]{report}

\usepackage{minitoc,lipsum}

\begin{document}

\tableofcontents

\part{I want to enlarge the space between the label and the content}

\chapter{Introduction}

\section{Just a sample section}

\lipsum[2]

\subsection{Explain}

\lipsum[3-8]

\section{Second}

\lipsum[9]

\chapter{Manual}

section{dddddn}

\subsection{cccExplain}

\end{document} 
2
  • 1
    Welcome to TeX.SE. It would be helpful if you took the code in the linked question and added your own text to yield a fully compilable MWE including \documentclass{} (\begin{document} and \end{document}) and the appropriate packages that illustrates the problem . While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem, instead of spending time to first reproduce the problem.
    – skpblack
    Aug 26, 2014 at 4:43
  • So you are using \documentclass{book}? What about other packages involved in construction of the ToC (like tocloft or titletoc)? The main issue may not lie with \l@part, but with \@part.
    – Werner
    Aug 26, 2014 at 6:09

2 Answers 2

3

\part sets its ToC-entry within \@part (from report.cls):

\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >-2\relax
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    \markboth{}{}%
    {\centering
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >-2\relax
       \huge\bfseries \partname\nobreakspace\thepart
       \par
       \vskip 20\p@
     \fi
     \Huge \bfseries #2\par}%
    \@endpart}

To increase the space, use etoolbox to patch and adjust the 1em space:

enter image description here

\documentclass{report}
\usepackage{etoolbox,lipsum}
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\@part}{1em}{2em}{}{}
\makeatother

\begin{document}

\tableofcontents

\part{I want to enlarge the space between the label and the content}

\chapter{Introduction}

\section{Just a sample section}

\lipsum[2]

\subsection{Explain}

\lipsum[3-8]

\section{Second}

\lipsum[9]

\chapter{Manual}

\section{dddddn}

\subsection{cccExplain}

\end{document}

Above I've updated the space to 2em (doubling it).

3
  • In fact, My thesis is based on book.cls, therefore all the modification should be done in \renewcommand*\l@part[2]{%, the example is used to express the meaning of place where the space is. so what should be done in book.cls in order to achieve the effect wanted.
    – poplar
    Aug 26, 2014 at 6:58
  • I want to reset the space between the label and the chapter, section, subsection as well, so I want to know the feasible way.
    – poplar
    Aug 26, 2014 at 7:13
  • 1
    Use a dedicated package like titletoc, (included in titlesec), that gives you full control on the formatting of the table of contents and has easy access documentation.
    – Bernard
    Aug 26, 2014 at 7:27
0
\def\@pardis{9em}% 
\def\@part[#1]#2{% 
\ifnum \c@secnumdepth >-2\relax 
\refstepcounter{part}% 
\addcontentsline{toc}{part}{\CTEXthepart\hspace{\@pardis}#1}% 
\else 
\addcontentsline{toc}{part}{#1}% 
\fi 
\@endpart}

give it a new definition

\def\@pardis{9em}% 

you could set the whatever value you want, then it works!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .