views:

89

answers:

2

It looks bad in my paper if a caption is wider than the table underneath it. How can I make them both align?

Right now my code looks like:

\begin{table}[th!]
\caption{Reference temperature blah blah}
\centering
\begin{tabular}{llll}
...
\end{tabular}
\end{table}
A: 

Put your table plus caption inside a minipage. The caption will wrap. Oh, and this is the best way to have proper footnotes for tables, or at least it was a few years ago when I was still using LaTeX.

cjrh
I think I might have already tried that... how do I get the minipage to the table width?
webjunkie
Search in this page for *Side-by-side tables* (shows an example of specifying minipage width): http://people.csail.mit.edu/jrennie/latex/
cjrh
A: 

if you know or find out the width of the table, let's say 5cm -

  • if you're using a KOMA-Script class:

    \setcapwidth[c]{5cm}

  • if you're using the caption package:

    \captionsetup{width=5cm}

Both may be applied inside the table environment.

An automatically calculating solution is more complicated, but could be done using the \settowidth command.

Stefan