1

I am use the book documentclass with various parts. For a part, I'd like the Part number and title followed by a paragraph on the same page. Currently, I'm getting the Part number and title on a page, with the rest of the page blank, the following page blank and then a page with the paragraph.

Also, I'm using the titlesec package to reformat them and realize there is spacing in the \titleformat command, but it appears that no control over the spacing will remove the page break.

I also tried refining \@endpart, however that didn't work. I wonder if this conflicts with the titlesec package.

Edited Below

With the answer below, here's a twist on the code with \titleformat defined which shows that redefining \@endpart doesn't seem to work:

\documentclass{book}
\usepackage{titlesec}
\usepackage{lipsum}

\titleformat{\part} {\huge\sffamily\slshape} {Part~\thepart:}{1em}{}

\begin{document}

\makeatletter \renewcommand{@endpart}{} \makeatother

\part{A part} \vspace{2\baselineskip} \lipsum[1]

\cleardoublepage \lipsum[2]

\end{document}

2 Answers2

2

The titlesec package hardwires the new page after the title without using the \@endpart mechanism.

Here's a patch:

\documentclass{book}
\usepackage{titlesec}
\usepackage{etoolbox}
\usepackage{lipsum}

\makeatletter \patchcmd{\ttl@page@ii}{\newpage\if@twoside}{\iffalse}{}{} \makeatother

\titleformat{\part} {\huge\sffamily\slshape} {Part~\thepart:}{1em}{}

\begin{document}

\part{A part} \vspace{2\baselineskip} \lipsum[1]

\cleardoublepage \lipsum[2]

\end{document}

enter image description here

egreg
  • 1,121,712
1

This works for me

% partpageprob.tex  SE 553544
\documentclass{book}
\usepackage{titlesec}
\usepackage{lipsum}

\begin{document}

\makeatletter \renewcommand{@endpart}{} \makeatother

\part{A part} \vspace{2\baselineskip} \lipsum[1]

\cleardoublepage \lipsum[2]

\end{document}

If you are using twocolumns, and possibly some pagestyles, the definition of \@endpart may need modifying instead of just cancelling its effect.

I would have found it useful if you had provided an MWE; I had to make one up but it does not necessarily have much to do with your actual code.

Peter Wilson
  • 28,066
  • It seems like it is an interaction with the titlesec package. If use the explicit option on the titlesec package and add the following command: \titleformat{\part}{\huge\sffamily\slshape}{Part \thepart:}{1em}{#1}

    The page break comes back.

    – Peter Staab Jul 20 '20 at 11:43