34
votes

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?

3

3 Answers

44
votes

Define the headings using

\multicolumn{1}{c}{Heading}

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

8
votes

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.

0
votes

Use the caption package

\usepackage{caption} 
\captionsetup[table]{skip=6pt}    

or

\captionsetup[table]{aboveskip=6pt}
\captionsetup[table]{belowskip=6pt}

add in the preamble

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