TeX - LaTeX Asked by Peter Staab on December 22, 2020
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}
{hugesffamilyslshape}
{Part~thepart:}{1em}{}
begin{document}
makeatletter
renewcommand{@endpart}{}
makeatother
part{A part}
vspace{2baselineskip}
lipsum[1]
cleardoublepage
lipsum[2]
end{document}
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}{newpageif@twoside}{iffalse}{}{}
makeatother
titleformat{part}
{hugesffamilyslshape}
{Part~thepart:}{1em}{}
begin{document}
part{A part}
vspace{2baselineskip}
lipsum[1]
cleardoublepage
lipsum[2]
end{document}
Correct answer by egreg on December 22, 2020
This works for me
% partpageprob.tex SE 553544
documentclass{book}
usepackage{titlesec}
usepackage{lipsum}
begin{document}
makeatletter
renewcommand{@endpart}{}
makeatother
part{A part}
vspace{2baselineskip}
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.
Answered by Peter Wilson on December 22, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP