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
\section
,\subsection
and\subsubsection
usingtitlesec
look like? – Werner Apr 12 '13 at 17:21\clearpage
at every sectional level (\section
,\subsection
and\subsubsection
). Correct? – Werner Apr 12 '13 at 17:23\clearpage
for every*sectionbreak
command. When I do that I have way to many almost blank pages. I really just want to force aclearpage
at the end of every subsubsection. – user28291 Apr 12 '13 at 17:30