I'm creating new classes with titlesec
package to work in this hierarchy:
PART
- Prechap
-- Presec
--- Presubsec
I implemented them as seen in the MWE below. When I compiled the file with LuaLaTeX
the hierarchy is not respected and they seem to have the same level. The figure shows in the right what I have and what I wish I have in the left.
Also, in the Table of Contents, the Part is not typeset in small caps. How do I get the hierarchy level as shown above with the classes I have made?
\documentclass[12pt,a4paper]{book}
\usepackage[loadonly]{titlesec}
\usepackage{titletoc}
\usepackage{tocloft}
\usepackage{lipsum}
\usepackage{bookmark}
\usepackage{hyperref}
\hypersetup{draft}
\titleclass{\part}[-1]{page}
% Changes in part name appearence
\titleformat{\part}% command
[block]% shape
{\centering\fontsize{30pt}{30pt}\selectfont}% format
{}% label
{0 cm}% sep
{\thispagestyle{empty}}% before-code
[]% after-code
% Changes spaces in between part
\titlespacing{\part}{0 pt}{.4\textheight}{0 cm}
% Add part to toc
\titlecontents{part}[0em]{\Large\bfseries\scshape}{}{}{\hfill\contentspage}[]
% Create prechap class
\titleclass{\prechap}{top}[\part]
\newcounter{prechap}
% Formats prechap entry
\titleformat{\prechap}% command
[block]% shape
{\centering\fontsize{20pt}{20pt}\selectfont}% format
{}% label
{0 cm}% sep
{\uppercase}% before-code
[\thispagestyle{empty}]% after-code
% Changes spaces in between prechap
\titlespacing{\prechap}{0 cm}{1 cm}{1 cm}
% Add prechaps to toc
\titlecontents{prechap}[0em]{\bfseries}{}{}{\hfill\contentspage}[]
% Create presec class
\titleclass{\presec}{straight}[\prechap]
\newcounter{presec}
% Formats presec entry
\titleformat{\presec}% command
[hang]% shape
{\fontsize{14pt}{14pt}\selectfont}% format
{}% label
{0 cm}% sep
{\bfseries}% before-code
[]% after-code
% Changes spaces in between presec
\titlespacing{\presec}{0 cm}{1 cm}{.2 cm}
% Add presecs to toc
\titlecontents{presec}[1em]{\scshape}{}{}{\hfill\contentspage}[]
% Create presubsec class
\titleclass{\presubsec}{straight}[\presec]
\newcounter{presubsec}
% Formats presubsec entry
\titleformat{\presubsec}% command
[hang]% shape
{\fontsize{14pt}{14pt}\selectfont}% format
{}% label
{0 cm}% sep
{\itshape}% before-code
[]% after-code
% Changes spaces in between presubsec
\titlespacing{\presubsec}{0 cm}{1 cm}{.2 cm}
% Add presubsecs to toc
\titlecontents{presubsec}[2em]{\itshape}{}{}{\hfill\normalfont\contentspage}[]
\begin{document}
\tableofcontents
\prechap{Preface}
\lipsum[1]
\prechap{Prelude}
\lipsum[2]
\presec{Section one}
\lipsum[3]
\presubsec{Subsection one}
\lipsum[4]
\presubsec{Subsection two}
\lipsum[5]
\part{Part One}
\lipsum[6]
\prechap{Prechap One}
\lipsum[7]
\presec{Section Two}
\lipsum[8]
\presubsec{Subsection Three}
\lipsum[9]
\end{document}