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.

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
  • Tobias: thank you. I will try your suggestions and post with the results. – msakkas Jan 29 at 19:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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