views:

209

answers:

2

I'd like to center just the header, but not the body of particular columns in a table. For example:

\begin{table}[!t]
\centering
\caption{
\bf{My table}}
\begin{tabular}{l|c|}
...
\end{tabular}
\end{table}

will make a left-aligned column, and a center-aligned column. I'd like the headers to all be centered, but the body of the table to actually be left aligned. If the entries in each column are wide, having left or right aligned content without centering the header looks strange (it leaves lots of whitespace in the header).

second, is there a way to force a table to be on its own page in LaTeX? Or any figure for that matter?

thanks.

+2  A: 

Define the headings using

\multicolumn{1}{c}{Heading}

Feel free to stick leading and trailing |s around the c as needed.

dmckee
The first argument specifies the number of columns to span.
Svante
Yep. I was assuming he wanted a heading for each column. That is usually the case when this comes up.
dmckee
Sorry, I really just meant that as a comment; you are completely right.
Svante
@Svante: Don't apologize, it's a good note and adds value to the answer. I didn't type it here because I've answered *that* question elsewhere and I was feeling lazy.
dmckee
+4  A: 

In order to put a table (or any float) on its own page, use the p argument for location:

\begin{table}[p]
  ...

It will then appear at the end of the chapter/section, or when you issue a \clearpage or \cleardoublepage.

Svante
Heh. Missed that part of the question.
dmckee