'Org-mode export to Latex: page break at each section and subsection

I want the pdf document to always have a page break at a section and subsection. I could add

#+latex: \clearpage

before each heading and sub-heading on org-mode. However, I think it makes my org document kind of confusing and visually dirty.

Is there a way to do it all at once, i.e., to force a page break so that all sections and subsections begin always on a new page?

I'd be glad if anyone help me.



Solution 1:[1]

You could add

\usepackage{titlesec}
\newcommand{\sectionbreak}{\clearpage}
\newcommand{\subsectionbreak}{\clearpage}

to your header. This has the advantage that it will automatically check if the previous unit actually had content and only add a page break in this case. This means that a section directly followed by a subsection won't be split across empty pages.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 samcarter_is_at_topanswers.xyz