Start new page with each section
The titlesec package allows to do this with just
\newcommand{\sectionbreak}{\clearpage}
It's cleaner than what you were doing and the package also allows to completely customize sections. Here's a fully compilable code sample showing how it works:
\documentclass{article}
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\begin{document}
Text
\section{Title}
Text
\subsection{Title}
Text
\subsection{Title}
Text
\section{Title}
Text
\end{document}
Obligatory ConTeXt solution:
\setuphead[section][page=yes] % or page=right
The accepted answer in that form won't work as expected in LyX. This solution causes problems when the document includes a ToC
and hyperref
support: It makes the paging of the hyperref
links be off-sync with the document paging (e.g. clicking on Section 3 which is on p4 will take you to p3 instead).
As mentioned in the comments, this happens because by default LyX is loading hyperref
before titlesec
. To work around this you can use \newcommand{\sectionbreak}{\clearpage\phantomsection}
.
Alternatively, in LyX, you can include in Document Settings > Local Layout
:
Provides hyperref
And then load hyperref
manually in the LaTeX preamble, like this:
\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\usepackage{hyperref}