# Org-mode export: force page break after TOC

I'm using org-mode to export to PDF. I'm going over the same document multiple times and exporting different branches during my evaluation.

I always want the first section in the PDF to start on a clean page, regardless of which subtree I export. So, there should always be a cleanpage after the TOC.

I can manually add newpage everywhere in my org-mode doc, but I have a tree with thousands of branches. I'd rather add this in the latex preamble or .emacs config, once.

Is it possible?

Add the following to your init file:

(setq org-latex-toc-command "\\tableofcontents \\clearpage")


Explanation: The variable org-latex-toc-command normally is set to the value "\\tableofcontents" and its value is emitted by the LaTeX exporter into the output TeX file at the place where the TOC is to be placed (normally right after the \begin{document} in the TeX file):

 \begin{document}
\tableofcontents
...


When the TeX file is processed to produce the PDF output file, the LaTeX processor expands the \tablecontents macro to the full TOC.

By modifying the value of org-latex-toc-command, the LaTeX exporter is made to emit the modified string, so the TeX file looks liks this:

 \begin{document}
\tableofcontents \clearpage
...


When the modified TeX file is processed by the LaTeX processor, after \tableofcontents is expanded to the full TOC, the \clearpage macro causes the page to be emitted immediately, leaving the rest of it blank.

Note BTW, that in an emacs string like "\\foo", the first backslash "escapes" the second, so that one backslash is part of the string. More about such escape sequences can be found in the Emacs documentation, e.g. here and here.

• You might show the doc of that variable and make clear what that value does. That might be more helpful.
– Drew
Jul 13 '18 at 2:21
• @Drew: Edited, PTAL. Jul 13 '18 at 2:54

If you don't want to permanently change the value of org-latex-toc-command (as per @NickD answer), you can also include a latex export block before the first section

#+begin_export latex
\clearpage \tableofcontents \clearpage
#+end_export

* Fist section


Remember to include #+OPTIONS: toc:nil in the preamble to avoid a double TOC

• This can also be done with file variables. Put this as the first line: #+COMMENT:-*- org-latex-toc-command: "\\tableofcontents \\clearpage" -*-. gnu.org/software/emacs/manual/html_node/emacs/… Apr 25 '20 at 1:33
• @@latex:\clearpage@@ before main text should work as well. Also, it doesn't need #+OPTIONS: toc:nil. Jul 5 '20 at 15:59