# How can I remove extra space after the figure, but keep it above the figure [duplicate]

This question already has an answer here:

Code:

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\begin{document}
text text text text text text text text text text text text text text text text text text
\begin{figure}[ht!]
\centering
\rule{5cm}{5cm}
\caption{Caption}
\end{figure}
\section{Section name}
\end{document}


Output:

The space from float is added to the space before section, and it seems too big. I looked here: http://www.latex-community.org/forum/viewtopic.php?f=5&t=1279, and gmedina said, that I must use \intextsep. But when I tried:

text text text text text text text text text text text text text text text text text text
\setlength{\intextsep}{0pt}


Space after "text text" disappeared. Setting \belowcaptionskip and \botfigrule to 0 didn't help at all.

How can I remove extra space after the figure, but keep it after the text above the figure? Without \vspace if possible.

-
vspace*{-\intextsep} ??? –  Nicholas Hamilton Oct 26 '13 at 2:26
I think the relevant parameter is \textfloatsep. This applies to all floats and is applied by the output routine, so if you want to change it for just one float, the timing is tricky. My advice: write your document and ignore this space until the final version, then put \vspace*{-20pt} (or whatever value) right before the offending \section command. –  Dan Oct 26 '13 at 4:30
add comment

## marked as duplicate by Werner, karlkoeller, barbara beeton, Thorsten, GuidoOct 26 '13 at 5:30

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 1 Answer

If setting \belowcaptionskip 0 didn't help, try with some less than 0. Negative values are allowed.

\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\begin{document}
text text text text text text text text text text text text text
text text text text text

\begin{figure}[ht!]
\belowcaptionskip = -20pt
\centering
\rule{5cm}{5cm}
\caption{Caption}
\end{figure}

\section{Section name}
\end{document}

-
BTW, I'm not sure if this is a good idea. Both the title of sections, as well as captions, need their own space around to stand out from the other parts, even if these are spaces added by other objects. May be is better move the figure to the top/bottom of page in these cases. –  Fran Oct 26 '13 at 1:11
It is the most valuable part of your answer (for me), so also upvoted. –  Przemysław Scherwentke Oct 26 '13 at 1:41
add comment