Alinear los números romanos de las partes en ToC

Alinear los números romanos de las partes en ToC

¿Cómo puedo alinear los números romanos de las partes de esta manera? La alternativa es utilizar una enumeración árabe. No haría ningún cambio en el TOC de la tesis clásica fuera de la alineación de los números romanos de las partes.

\documentclass{scrreprt}                  % classe report di KOMA-Script;

\usepackage[%
                    pdfspacing,%                   % migliora il riempimento di riga
                    linedheaders,%
                    dottedtoc,%
                    parts%                        % da decommentare in un documento diviso in parti
                    ]{classicthesis}               % stile ClassicThesis

\hypersetup{hidelinks}

\begin{document}

\tableofcontents

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

\end{document}

ingrese la descripción de la imagen aquí

Respuesta1

Aquí hay una posible solución usando una redefinición de \Partcomo se define en classicthesis.sty:

\documentclass{scrreprt}
\usepackage[%
                    pdfspacing,%
                    linedheaders,%
                    dottedtoc,%
                    parts%
                    ]{classicthesis}
\hypersetup{bookmarksnumbered,hidelinks}

\makeatletter
\setlength\cftpartnumwidth{1.5em}
\renewcommand\Part[2][]{%
\addtocontents{toc}{\setcounter{tocdepth}{-2}}
\ifpdf\pdfstringdefDisableCommands{\let\thepart\@gobbletwo}%
  \oldpart[\texorpdfstring{\spacedlowsmallcaps{#1}}{#1}]{#2}
\else\oldpart[\spacedlowsmallcaps{#1}]{#2}%
\fi%
\addtocontents{toc}{\setcounter{tocdepth}{2}}%
\addcontentsline{toc}{part}{\protect\numberline{%
  \hspace*{4pt}\texorpdfstring{\llap{\thepart}}{}}\texorpdfstring{\noexpand\spacedlowsmallcaps{#1}}{#1}}
\ctparttext{\relax}%
}%
\makeatother

\begin{document}

\tableofcontents

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

\end{document}

ingrese la descripción de la imagen aquí

Respuesta2

A diferencia de otros comandos seccionales, \partno utiliza ninguna alineación de su número en el ToC. Es posible una alineación similar a otros comandos cuando se usa \numberline(lo que requiere establecer un valor para \@tempdimaa 1.5emdel original 3em).xpatchproporciona un medio para parchear los dos comandos necesarios para corregir el comportamiento de ToC: \l@party \@part.

ingrese la descripción de la imagen aquí

\documentclass{book}
\usepackage{xpatch}% http://ctan.org/pkg/xpatch
\makeatletter
\patchcmd{\l@part}{3em}{1.5em}{}{}% <cmd><search><replace><success><failure>
\xpatchcmd{\@part}{\thepart\hspace{1em}}{\protect\numberline{\ \llap{\thepart}}}{}{}% <cmd><search><replace><success><failure>
\makeatother
\begin{document}

\tableofcontents

\part{title}
\chapter{title}
\section{title}
\part{title}
\chapter{title}
\section{title}
\part{title}
\chapter{title}
\section{title}

\end{document}

información relacionada