Ao usar \part com tocloft (sem fontspec) em pdflatex conforme sugerido na resposta deste postSepare o livro em partes e capítulos, encontro um problema na numeração das seções do índice como este.
Conteúdo
Primeira parte
1 Capítulo 1
1 Seções 1.1
1.1 Subseção 1.1.1
2 Capítulo 2
1 Seção 2.1
1 Seção 2.2
1.1 Subseção 2.2.1
Segunda parte
3 Capítulo 3
2 Seção 3.1
2.1 Subseção 3.1.1
O seccionamento no texto, entretanto, está bom.
Alguém pode me ajudar? Obrigado.
O preâmbulo é o seguinte
\documentclass[a4paper,10pt]{book}
\usepackage{amsmath,amssymb,amsfonts,amsthm}
\usepackage{inputenc}
\usepackage{tabularx}
\usepackage{mathtools}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{xpatch}
\usepackage{tikz}
\usepackage{tocloft}
\usepackage{inputenc}
\usepackage{xspace}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[RE,LO]{\textcopyright~ Prints 2019}
\fancyfoot[CE,CO]{}
\fancyfoot[LE,RO]{\thepage}
\everymath{\displaystyle}
\newtheorem{prop}{Proposition}[chapter]
\newtheorem{defn}{Definition}[chapter]
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[prop]{Corollary}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}[chapter]
\newcommand{\floorceil}[1]{\lceil #1 \rfloor}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother
\renewcommand{\cftpartfont}{\bfseries\Large\hrule}%add line above part
\renewcommand{\cftpartpagefont}{\bfseries}
\renewcommand{\cftbeforepartskip}{5mm}
\renewcommand{\cftpartafterpnum}{\\\hrule}%add line below part
\cftpagenumbersoff{part}%get rid of part page numbers
\renewcommand{\cftsecindent}{8mm}%control spacing between number and sec title
\renewcommand{\cftsecnumwidth}{4mm}%section indent
\renewcommand{\cftparskip}{4mm}%control line spacing
\begin{document}
\tableofcontents
\part{First part}
\chapter{Chapter1}
\section{Sections1.1}
\subsection{Subsection1.1.1}
\chapter{Chapter2}
\section{Section2.1}
\section{Section2.2}
\subsection{Subsection2.2.1}
\part{Second part}
\chapter{Chapter3}
\section{Section3.1}
\subsection{Subsection3.1.1}
\end{document}
Um instantâneo do toc está aqui.]2
Responder1
Alguns comentários e sugestões:
parâmetros de comprimento do
tocloft
pacote devem ser modificados via\setlength
, não\renewcommand
considere a substituição
\renewcommand{\cftsecindent}{8mm}%control spacing between number and sec title \renewcommand{\cftsecnumwidth}{4mm}%section indent
com
\cftsetindents{chap}{0em}{1.5em} \cftsetindents{sec}{1.5em}{2em} \cftsetindents{subsec}{3.5em}{2.75em}
Obviamente, você é livre para modificar essas configurações de acordo com suas preferências e necessidades de composição tipográfica.
\documentclass[a4paper,10pt]{book}
\usepackage{mathtools,amssymb,amsthm}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{textcomp}
\usepackage{xpatch}
\usepackage{tikz}
\usepackage{tocloft}
\usepackage{xspace}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,RO]{}
\fancyhead[RE,LO]{\textcopyright~ Prints 2019}
\fancyfoot[CE,CO]{}
\fancyfoot[LE,RO]{\thepage}
\everymath{\displaystyle}
\newtheorem{prop}{Proposition}[chapter]
\newtheorem{defn}{Definition}[chapter]
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[prop]{Corollary}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}[chapter]
\newcommand{\floorceil}[1]{\lceil #1 \rfloor}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother
\renewcommand{\cftpartfont}{\hrule\bfseries\Large}%add line above part
\renewcommand{\cftpartpagefont}{\bfseries}
\setlength{\cftbeforepartskip}{5mm}
\renewcommand{\cftpartafterpnum}{\\\hrule}%add line below part
\cftpagenumbersoff{part}%no page numbers for part-level entries
%% commented out:
%\setlength{\cftsecindent}{8mm}% spacing between number and sec title
%\setlength{\cftsecnumwidth}{6mm}%section indent
%% new instructions:
\cftsetindents{chap}{0em}{1.5em}
\cftsetindents{sec}{1.5em}{2em} % 1st length should be sum of lengths on preceding line
\cftsetindents{subsec}{3.5em}{2.75em}
\setlength{\cftparskip}{4mm}%control line spacing
\begin{document}
\tableofcontents
\part{First part}
\chapter{Chapter1}
\section{Section1.1}
\subsection{Subsection1.1.1}
\chapter{Chapter2}
\section{Section2.1}
\section{Section2.2}
\subsection{Subsection2.2.1}
\part{Second part}
\chapter{Chapter3}
\section{Section3.1}
\subsection{Subsection3.1.1}
\end{document}