I am using the usual algorithm
package for a paper. However, LaTeX puts too much vspace below algorithms. I have already reduced \floatsep
, \textfloatsep
and \intextsep
but it does not seem to help. For figures, I can use negative \vspaces
after the figure to get less space after it. However, this does not work for algorithms as there is a line displayed below the algorithm. If I use a negative vspace in the algorithm environment, the line gets pulled into the pseudocode.
Thus, both answers which were posted for this question:
How to remove/change the vertical spacing before and after an \algorithm environment?
do not work.
How to fix this?
Best Answer
The
layouts
documentation (section 6.2 Detailed float layout, p 25) describes the possible lengths influencing the vertical space between floats and text body elements:\textfloatsep
- betweent
op andb
ottom-aligned float and text body (default is20\p@ \@plus 2\p@ \@minus 4\p@
); and\intextsep
- between float and text for other floats (default is12\p@ \@plus 2\p@ \@minus 2\p@
).The defaults for these are set in
latex.ltx
. Both these lengths have glue (meaning they can stretch/shrink). Here's a graphic fromlayouts
showing the lengths involved.Here's an incidental view on a change in
\textfloatsep
from the default to0pt
with an example from thealgorithmicx
package:Note the visible difference in the vertical space below algorithm.