1

I'm getting weird results on exporting Org files to LaTeX. The following Org code produces blank pages and the resulting PDF terminates before the fifth heading and subheadings are printed:

* First Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line

* First Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line

* First Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line

* First Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line

* First Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line
** Second Line

I see nothing unusual in the generated LaTeX code. Any assistance greatly appreciated. Will be glad to post further info, but not sure what else I should post.

1 Answer 1

2

This is actually a LaTeX problem. But maybe it only occurs in the context of Orgmode.

LaTeX does not like to break a line after a heading. So the whole text appears on one page and most of it is cut off.

You can avoid the problem by inserting some invisible paragraph in each section.

The following LATEX_HEADER setting in your Org file would do that:

#+LATEX_HEADER:\let\oldsection\section\def\section{\mypagebreak\oldsection}\def\mypagebreak{\def\mypagebreak{\par\mbox{}\par\mbox{}}}

Maybe an even better method is to reduce the penalty for breaking pages after headings to zero:

#+LATEX_HEADER:\let\oldsection\section\def\section{\mypagebreak\oldsection}\makeatletter\def\mypagebreak{\@secpenalty0}\makeatother
1
  • Tobias: thank you. I will try your suggestions and post with the results.
    – msakkas
    Jan 29, 2019 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.