Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'd like to clear the page at the end of every \subsubsection. I tried

\usepackage{titlesec}
\newcommand{\subsubsectionbreak}{\clearpage}

But this appears to force a \clearpage at the start of every \subsubsection. Is it possible to force a \clearpage at the end?

share|improve this question
    
Just to clarify: Do you also want page breaks between subsections that do not include subsubsections, and between sections that do not include subsections? Please advise. –  Mico Apr 12 '13 at 17:16
    
@Mico Yes I also want page breaks between subsections and sections (even if they don't include subsub or subsections). –  user28291 Apr 12 '13 at 17:20
    
What do your current definitions of the sectional units \section, \subsection and \subsubsection using titlesec look like? –  Werner Apr 12 '13 at 17:21
    
According to @Mico's comment and your response, it seems like you just want a \clearpage at every sectional level (\section, \subsection and \subsubsection). Correct? –  Werner Apr 12 '13 at 17:23
    
@Werner Sorry for the confusion. I don't just want page breaks everywhere. That could be accomplished by adding \clearpage for every *sectionbreak command. When I do that I have way to many almost blank pages. I really just want to force a clearpage at the end of every subsubsection. –  user28291 Apr 12 '13 at 17:30

2 Answers 2

up vote 4 down vote accepted

You could include the following instructions in your document's preamble:

\usepackage{titlesec}
\newcommand\sectionbreak{\ifnum\value{section}>1\clearpage\fi}
\newcommand\subsectionbreak{\ifnum\value{subsection}>1\clearpage\fi}
\newcommand\subsubsectionbreak{\ifnum\value{subsubsection}>1\clearpage\fi}

This will insert a page break every time a \section, \subsection, or \subsubsection command is encountered if the corresponding counter is greater than 1. I.e., every \section command after the very first such command will trigger a page break; every \subsection command after the very first such command within a given section will trigger a page break, etc.

This method assumes that your document class uses "plain" counter variables for section, subsection and subsubsection. If that's not the case, please indicate how you've set up those variables.

share|improve this answer
    
It works if I add a \fi at the end of the macro definition, otherwise I get a bunch of warnings –  user28291 Apr 12 '13 at 17:49
    
@user28291 - Thanks for pointing out this omission - I've added the \fi instructions. –  Mico Apr 12 '13 at 17:51

The following doesn't require titlesec:

\makeatletter
\newif\if@subsubsectionused \@subsubsectionusedfalse
\let\oldsection\section
\let\oldsubsection\subsection
\let\oldsubsubsection\subsubsection
\renewcommand{\section}{\if@subsubsectionused\clearpage\@subsubsectionusedfalse\fi\oldsection}
\renewcommand{\subsection}{\if@subsubsectionused\clearpage\@subsubsectionusedfalse\fi\oldsubsection}
\renewcommand{\subsubsection}{\if@subsubsectionused\clearpage\fi\@subsubsectionusedtrue\oldsubsubsection}
\makeatother

It inserts a \clearpage before calling the traditional sectioning command based on a condition \if@subsubsectionused. This condition is set to true whenever a \subsubsection is used, and to false otherwise.

An example of code like

\section{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\subsubsection{A subsubsection}
\subsection{A subsection}
\subsubsection{A subsubsection}
\subsubsection{A subsubsection}
\section{A section}
\subsection{A subsection}
\subsubsection{A subsubsection}
\subsubsection{A subsubsection}
\subsection{A subsection}
\subsection{A subsection}
\subsubsection{A subsubsection}
\subsubsection{A subsubsection}

would yield a layout of

1 A section
1.1 A subsection
1.1.1 A subsubsection
-----------< page break >--------------------
1.1.2 A subsubsection
-----------< page break >--------------------
1.2 A subsection
1.2.1 A subsubsection
-----------< page break >--------------------
1.2.2 A subsubsection
-----------< page break >--------------------
2 A section
2.1 A subsection
2.1.1 A subsubsection
-----------< page break >--------------------
2.1.2 A subsubsection
-----------< page break >--------------------
2.2 A subsection
2.3 A subsection
2.3.1 A subsubsection
-----------< page break >--------------------
2.3.2 A subsubsection
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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