Text FormattingKeep section title with next

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ahmedrashed
Posts: 2
Joined: Fri Apr 18, 2014 2:22 pm

Keep section title with next

Post by ahmedrashed »

Hi

I use beamer to create wonderful presentations slides.
My problem arises when I create the presentation handouts using \usepackage{beamerarticle}.

In the generated handouts, it frequently happens that frameTitle/section titles appear at the end of the page, which is very annoying.

If what follows the frameTitle/section was a usual paragraph, then \needspace{2\baselineskip} might have helped, but sometimes it is an inline image whose hight is 80% of the text height that follows the frameTitle/section. In this case,\needspace{2\baselineskip} doesn't help.

When I was using MS Word, this was solved using an option called "keep with next". This option simply moves the section heading to the following page so that it is kept with what comes after. I think this is exactly what I want.

I think this may be done using \nopagebreak. I hope this command is smart enough to move the frameTitle/section heading to the following page if there is no space for what follows the frameTitle/section in the current page.

So could you please tell me how can I redefine/patch the \section, \subsection and \subsubsection commands so that they issue \nopagebreak before what follows these commands?

I think this not a special beamer problem, but a general Latex problem.

For the FrameTitle, I think \addtobeamertemplate{frametitle}{}{\nopagebreak} does the trick. Please correct me is I'm wrong.


Thanks in advance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply