Rhythmical Diphthong
Rhythmical Diphthong

Reputation: 23

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.

Upvotes: 2

Views: 2055

Answers (2)

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.

Upvotes: 5

user12425014
user12425014

Reputation: 126

Try this:

#+LATEX_HEADER: \let\oldsection\section
#+LATEX_HEADER: \renewcommand{\section}{\clearpage\oldsection}
#+LATEX_HEADER: \let\oldsubsection\subsection
#+LATEX_HEADER: \renewcommand{\subsection}{\clearpage\oldsubsection}

Upvotes: 3

Related Questions