I have the following code
\documentclass{scrreprt}
%\usepackage[titles]{tocloft}
%\renewcommand{\cftchappresnum}{\thepart.}
\begin{document}
\tableofcontents
\part{First Part}
\chapter{First Chapter}
\end{document}
that results in the following table of contents:
How can I include the number of the part into the chapter entry, i.e. get I.1. First Chapter
?
As you can see, I tried to use the tocloft
package but without success.
Best Answer
You have to adjust a number of length, in addition to the counter representation. Here is a minimal example with some adjustments up to the section level:
Prepending the part number to the chapter number is achieved using
This would be a global replacement, making
\thepart.
appear before a chapter number in the text, the ToC and references to chapters (as well as lower sectional units, since they inherit the hierarchy).Secondly, we patch
\l@chapter
(usingetoolbox
) to allow for a wider spacing around the number. Since the ToC forms a hierarchy of the document structure, a change in one indentation level should typically be followed by an adjustment at lower levels as well. So, since the increase was made from 1.5em to 2em, we need to adjust the<indent>
of\l@section
(and possibly\l@subsection
...) as well:Argument structure of
\bprot@dottedtocline{<level>}{<indent>}{<numwidth>}
indents a sectional units at level<level>
by a length<indent>
and puts the number in a box of width<numwidth>
. Underscrreprt
, the following definitions hold for lower sectional units (if you wish to adjust them as well):