![Выровняйте римские номера деталей в оглавлении](https://rvso.com/image/254689/%D0%92%D1%8B%D1%80%D0%BE%D0%B2%D0%BD%D1%8F%D0%B9%D1%82%D0%B5%20%D1%80%D0%B8%D0%BC%D1%81%D0%BA%D0%B8%D0%B5%20%D0%BD%D0%BE%D0%BC%D0%B5%D1%80%D0%B0%20%D0%B4%D0%B5%D1%82%D0%B0%D0%BB%D0%B5%D0%B9%20%D0%B2%20%D0%BE%D0%B3%D0%BB%D0%B0%D0%B2%D0%BB%D0%B5%D0%BD%D0%B8%D0%B8.png)
Как можно выровнять римские номера частей таким образом? Альтернативой является использование арабской нумерации. Я бы не стал вносить никаких изменений в TOC classicthesis за пределами выравнивания римских номеров частей.
\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}
решение1
Вот одно из возможных решений, использующее переопределение, \Part
как определено в 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}
решение2
В отличие от других секционных команд, \part
не использует никакого выравнивания своего номера в ToC. Выравнивание, аналогичное другим командам, возможно при использовании \numberline
(что требует установки значения для \@tempdima
to 1.5em
из исходного 3em
).xpatch
предоставляет средства для исправления двух команд, необходимых для исправления поведения ToC: \l@part
и \@part
.
\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}