Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using the caption package and have a relatively small table with a caption above with a short final line. In the the case of the equation environment, it will spot this and move the equation up if it detects no overlap between the bottom line of the text above and the equation. I'm hoping there is some similar setting or package to make this happen for floats (specifically tables). I can apply a correction manually with \vspace{-0.3cm} but this seems rather ugly.

I'm using the caption package here, here is some code to demonstrate

\documentclass{article}
\usepackage{caption}


\begin{document}


\begin{table}
    \caption{Hello how are you today, wibble wobble, words, more words and stuff'n stuff.}
    %\vspace{-0.3cm}
    \centering
    \begin{tabular}{c c}
        \hline
        wib & wob \\
        \hline
        1   &  2  \\
        8   &  7  \\
        \hline
    \end{tabular}
\end{table}


\end{document}

Many thank for any help!

share|improve this question

1 Answer 1

It is a built-in feature of TeX that the vertical spacing before (and after) displayed equations depends on wheter or not these equations overlap the last line of the preceding paragraph. (For details see The TeXbook, p. 189.) As far as I know, no comparable spacing distinction has been implemented in LaTeX for float captions or other document elements. Some evidence (obviously not conclusive):

  • The description of the skip option of the caption package (p. 13 of the documentation) doesn't mention such a spacing distinction.

  • On p. 684 of With LaTeX into the Nineties, Frank Mittelbach talks about a "design limitation" for the list environment:

    The vertical space preceding the first item does not depend on the length of the last line of the preceding paragraph (as is the case for displayed equations).

Although I personally prefer fixed vertical spacing between float caption and float content proper, I agree that a package that implements an equation-like spacing solution would come in handy.

share|improve this answer
    
Based on an online version of the TeXbook, possibly you intended to say p. 198. At least this is where the relevant materials appears to be in my version. –  aghsmith Jun 3 '11 at 10:50
    
@aghsmith: I re-checked, but it is p. 189 in my printed version. –  lockstep Jun 3 '11 at 11:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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