[Tex/LaTex] titlesec \clearpage before a part

page-breakingpartssectioningtitlesec

I'm using the titlesec package for my sectioning. I want to have a \clearpage before every \part however when I put it into the format field of

\titleformat{command}[shape]{format}{label}{sep}{before-code}{after-code}

Then it does what I want, but if the very first part of the document (which is incidentally the first content after the \maketitle command, it will insert a blank page. This is because, to quote the titlesec documentation,

{format} is the format to be applied to the whole title—label and text. This part can contain vertical material (and horizontal with some shapes) which is typeset just after the space above the title

Note the ''just after the space above the title'. So \clearpage should not be put into the format field.

I can do the same thing that I want to do, but with sections, not parts, using

\newcommand{\sectionbreak}{\clearpage}

I know there are other commands just like that for things such as subsubsection or subsection, but I couldn't find one for part that worked. How would I do it?

\documentclass{article}

\usepackage{titlesec}

\titleformat{\part}[display]{\clearpage\itshape\rmfamily\raggedright}{\LARGE Part     \thepart}{0mm}{\Huge}{}
\titlespacing*{\part}{0mm}{30mm}{30mm}

\begin{document}
\part{Part test}
test text
\end{document}

Best Answer

A more appropriate way of inserting a \clearpage before every \part is to redefine \part in the following way:

\let\oldpart\part% Store \part in \oldpart
\renewcommand{\part}{\clearpage\oldpart}% Insert \clearpage before every \part

Use this after specifying \titleformat for \part.