3

In order to keep everything neat and tidy in my document (in particular with regards to floats floating all over the place), I want each subsection to end with a \clearpage. I originally had the following redefinition for the subsection command:

\let\oldsubsection\subsection

\renewcommand{\subsection}{
\clearpage
\oldsubsection
}

However, this puts the page break before the subsection heading, which means there is a break between section headings and the first subsection headings.

Is there any way to force that page break at the end of the subsection?

  • You could issue the \clearpage only if the subsection counter is not zero. But first check if \FloatBarrier from the placeins package is a better option. – Ulrike Fischer Jun 6 '13 at 7:15
  • @UlrikeFischer : FloatBarrier is exactly what I needed! If you give that as an official answer, I'll mark it as the accepted one. – thornate Jun 6 '13 at 7:54
6

You could issue the \clearpage only if the subsection counter is not zero. But first check if \FloatBarrier from the placeins package is a better option.

0

I suppose you may not automatically put \clearpage at the end of subsections since you don't use anything like \endsubsection command. But you may try to redefine \section command in a way to flag place after section header and avoid breaking at the beginning of the first subsection of the section, and redefine subsection to unmark it. For example,

\let\oldsection\section
\let\oldsubsection\subsection

\def\section{\let\subsectionclearpage\empty\oldsection}

\def\subsection{\subsectionclearpage\let\subsectionclearpage\clearpage\oldsubsection}

You may also like to add \clearpage before \let in \section definition or adopt \sectionclearpage in a way to match \section and \chapter command.

Also, be aware that this way \subsection before \section won't work. If you want to, you have to add either

\let\subsectionclearpage\empty

or

\let\subsectionclearpage\clearpage

into preamble.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.