# Undesired space before the section title when a figure is inserted after the section title

After I used a template, Latex gives me a lot of white space before the section title because a figure is inserted after the first paragraph of the section. I used [H] as the floating parameter for the figure because it makes more sense to appear there.

In my earlier draft where I didn’t use the template, the space occurred after the first paragraph of the section instead of before, i.e., it left space at the bottom of the previous page but kept normal space around the section title. Any idea how to fix that? Thanks!

Some text

\section{Discussion \& Conclusion}

More text

\begin{figure}[H]


Below is the part that stipulates the section title format in the template:

\def\section{\@startsection {section}{1}{\z@}%
{-1.2\onelineskip plus -4pt}{1.2\onelineskip}{\raggedright\normalsize\bf\boldmath}}

\def\any@section#1#2{\@startsection {#1}{#2}{\z@}%
{-1\onelineskip plus -3pt}{\onelineskip}{\raggedright\normalsize\bf\boldmath}}

• The problem is not the \section, but the over-sized figure placed as a non-float (using the [H]ERE float specifier), coupled with your use of a document class that issues \flushbottom. As a fix, allow the figure to float, or issue \raggedbottom in your preamble, or re-order the content. – Werner Jan 19 '15 at 21:19
• So I added \raggedbottom in the preamble and it worked! Thank you very much for solving this problem! – lericjee Jan 19 '15 at 21:32
• You could elaborate on "a template", which would make this question more useful for future visitors. – Werner Jan 19 '15 at 21:35
• @Werner Useful or not, do you want to add an answer? – Johannes_B Oct 7 '15 at 16:46

The problem is not the \section, but the over-sized figure placed as a non-float (using the [H]ERE float specifier), coupled with your use of a document class that issues \flushbottom. As a fix, choose one of the following:
• allow the figure to float (using something other than [H]);
• issue \raggedbottom in your preamble to override the template's issue of \flushbottom; or