I looked at all solutions for this problem, which is having section or subsection head at end of page and then the text starts at next page. So far, solution I tried did not work.

I worked hard to make a MWE to show the problem. Here it is

\usepackage[letterpaper, margin=1.1in]{geometry}

\subsection{Problem 1}%



\subsection{Problem 2}%


Here comes some text. Bad break above


Here is the output PDF

>lualatex document.tex
This is LuaTeX, Version 1.0.4 (TeX Live 2017) 
 restricted system commands enabled.
LaTeX2e <2017-04-15>
(using write cache: /home/me/.texlive2017/texmf-var/luatex-cache/generic)(using
 read cache: /usr/local/texlive/2017/texmf-var/luatex-cache/generic /home/me/.t
luaotfload | main : initialization completed in 0.133 seconds
Babel <3.14> and hyphenation patterns for 1 language(s) loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/size12.clo(load luc: /home/m
) (/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/graphicx.sty
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2017/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(load luc: /home/me/.texlive2017/texmf-var/luatex-cache/generic/fonts/otl/lmrom
an12-bold.luc) [1{/usr/local/texlive/2017/texmf-var/fonts/map/pdftex/updmap/pdf
tex.map}] [2] [3] (./document.aux))
 353 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 3 attribute, 45 glue_spec, 3 attribute_lis
t, 1 write nodes
   avail lists: 2:71,3:22,4:5,5:246,6:5039,7:1219,8:2,9:78,10:3,11:298
Output written on document.pdf (3 pages, 12006 bytes).
Transcript written on document.log.

Mathematica graphics

Most of the time, this happens when I have section or subsection title followed immediately by an image which I always write as

\subsection{name}   %or section

rest of text in the section comes here.....

In the MWE above, I used subsection but same problem shows up with section

I tried solution how-can-one-keep-a-section-from-being-at-the-end-of-a-page
Both the \usepackage[nobottomtitles*]{titlesec} and the solution by kquinn and the solution that uses


No effect. I still get section title at bottom of page, with image on next page.

Any other solution I could try? But this is important. The solution should be something I can do in the preamble only. I do not want to add Latex code manually in the body of the document to solve this for each case by case.

Thank you

  • Just get rid of the \FloatBarrier directives. If you really believe strongly that the second figure must be placed immediately after the subsection-level header, load the float package and write \begin{figure}[H].
    – Mico
    Oct 26 '17 at 4:08
  • @Mico But I need \FloatBarrier because I want the image to be there? I use this everywhere where I put an image, to make sure the images go where I want them and not somewhere else.
    – Nasser
    Oct 26 '17 at 4:09
  • See the addendum I just wrote to my comment.
    – Mico
    Oct 26 '17 at 4:10
  • @Mico thanks. But I found from my limited experience that \FloatBarrier works better than \begin{figure}[H]. Are you saying they will work the same way? ALways forcing the image to go where I want it? If so, I will switch.
    – Nasser
    Oct 26 '17 at 4:13
  • 2
    \FloadBarrier is a forced page break, so if you use it you will get a page break. LaTeX never puts a page break after a section heading normally. Also never put a figure inside a center environment, it does not centre it and just forces spurious vertical space, which may not be at the point the figure is. If you do use \FloatBarrier you should use it before a section head never after it. Oct 26 '17 at 6:56

You're over-using (and, IMNSHO, mis-using) \FloatBarrier, to essentially suppress the "floating" behavior of the LaTeX floats in question. It is my understanding that \FloatBarrier should be used if it's necessary to prevent floats from being placed after a certain point in the document (typically, some sectioning header). It's not a good idea to use \FloatBarrier as a sledgehammer to fine-tune the placement of the float within a section.

If you strongly believe that it's essential that the figure be placed in one exact spot -- here: immediately after the subsection-level header -- I suggest you load the float package and replace \begin{figure}[!htbp] with \begin{figure}[H]. Of course, be prepared to encounter massive (and I mean, massive) blocks of whitespace at the bottoms of the preceding pages.

Do ask yourself if it's truly essential that the figure be placed in one exact spot. If it's not essential, don't use [H].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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