I am trying to change the aspect of \part titles. My goal is to reach this aspect :
Here is what I have done so far :
\documentclass[12pt,twoside,draft]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[T1]{fontenc}
\usepackage{librecaslon}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{titlesec}
\renewcommand{\thepart}{\arabic{part}}
\newcommand\encadrement[1][1cm]{%
\tikz[overlay,remember picture,line width=0.3pt]
\draw(-8.2mm,5.1mm) -- (109.8mm,5.1mm);%
\tikz[overlay,remember picture,line width=0.3pt]
\draw(-8.2mm,5.1mm) -- (-8.2mm,-192.9mm);%
}
\makeatletter
\def\@part[#1]#2{%
\encadrement[1cm]
\thispagestyle{empty}
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
{\parindent \z@
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >\m@ne
\begin{center}
\begin{tikzpicture}[my node/.style={anchor=base,inner sep=0pt}]
\node[my node] (center) {\text{Livre} \thepart};
\draw($(center.base)+(-1.9cm,-1ex)$) -- ($(center.base)+(+1.9cm,-1ex)$);
\end{tikzpicture}
\end{center}
\par\nobreak
\fi
\huge \bfseries #2
\markboth{}{}\par}
\newpage
\@afterheading}
\makeatother
And here is the result :
As you can see, my \newpage move the title to the middle of the page. With a \pagebreak it goes to the bottom of the page. And without any command, it gets split between the first and the second page.
Does anyone have an idea how to solve this ?
And by the way, if someone can explain this piece of code, I would really appreciate !
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
{\parindent \z@
\interlinepenalty \@M
\normalfont
\ifnum \c@secnumdepth >\m@ne
Thanks a lot !