Table formatting top left corner caption
I would use the caption
package to fine-tune the appearance of the captions to meet your professors' formatting requirements. In addition, I would load the siunitx
package and its S
column type to format the numeric data columns, and I would load the booktabs
package for well-spaced horizontal lines. Don't use \underline
, please; instead, use \cmidrule
. Finally, consider using a tabular*
environment instead of a tabular
environment, to help the tabular material fit inside the width of the text block.
\documentclass{article}
\usepackage{booktabs} % for sell-spaced horizontal lines
\usepackage{siunitx} % for 'S' column type
\usepackage{caption} % fine control over caption appearance
\captionsetup{labelfont=bf,singlelinecheck=false,
labelsep=space,skip=2pt}
\begin{document}
\begin{table}
\setlength\heavyrulewidth{2pt} % does it have to be soooo wide?
\setlength\extrarowheight{2pt}
\setlength\tabcolsep{0pt}
\caption{Main Effects and Interactions} \label{tab:effects}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
c *{2}{S[table-format= 3.2]}
S[table-format=-3.2]
S[table-format=-2.3]
S[table-format= 2.3] @{}}
\toprule
Combination & {$\sum\Delta T^{+}$} &
{$\sum\Delta T^{-}$} & {Contrast} &
{Main Effect ($E$)} & {Abs.\ Effect $|E|$} \\
\cmidrule{1-1} \cmidrule{2-2} \cmidrule{3-3}
\cmidrule{4-4} \cmidrule{5-5} \cmidrule{6-6}
A & 251.03& 376.99& -125.96& -10.49 & 10.49\\
B & 372.03& 255.99& 116.04& 9.67 & 9.67 \\
AB & 305.82& 322.2 & -16.38& -1.365 & 1.365\\
C & 274.89& 353.13& -78.24& -6.52 & 6.52 \\
AC & 324.9 & 303.12& 21.78& 1.815 & 1.815\\
BC & 337.3 & 290.72& 46.58& 3.88 & 3.88 \\
ABC & 306.09& 321.93& -15.84& -1.32 & 1.32 \\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
I think of something like that with the caption package and some options?
\documentclass[12pt]{article}
\usepackage[labelfont=bf]{caption}
\captionsetup{justification=raggedright,
singlelinecheck=false
}
\begin{document}
\begin{table}[h]
\centering
\setlength{\arrayrulewidth}{2pt}
\caption{Main Effects and Interaction}
\begin{tabular}{cccccc}
\hline\\
\underline{Combination} & \underline{$\sum\Delta T^{+}$} & \underline{$\sum\Delta T^{-}$} & \underline{Contrast} & \underline{Main Effect (E)} & \underline{Absolute Effect $|E|$}\\[0.25cm]
A & 251.03& 376.99& -125.96& -10.49 & 10.49\\[0.125cm]
B & 372.03& 255.99& 116.04& 9.67 & 9.67\\[0.125cm]
AB & 305.82& 322.2& -16.38& -1.365 & 1.365\\[0.125cm]
C & 274.89& 353.13& -78.24& -6.52 & 6.52\\[0.125cm]
AC & 324.9& 303.12& 21.78& 1.815 & 1.815\\[0.125cm]
BC & 337.3& 290.72& 46.58& 3.88 & 3.88\\[0.125cm]
ABC & 306.09& 321.93& -15.84& -1.32 & 1.32\\[0.125cm]
\hline
\end{tabular}
\label{tab:effects}
\end{table}
\end{document}
Hope it helps :-)
Romain
If I've well understood what you want, you can obtain what you want with the caption
and floatrow
packages. I added some improvements to your table – replacing the \underline
s with cmidrule
(from booktabs
), so as to have all shortlines at the same level, and changing columnspecifier from c
to S
, to have all numbers in a column aligned on the decimal dot.
Also, your table is too wide for default margins. So I loaded geometry, which defines more sensible defaults.
\documentclass{article}
\usepackage{array, caption, floatrow, booktabs}
\usepackage{siunitx}
\usepackage[showframe]{geometry}
\begin{document}
\setcounter{table}{2}
\begin{table}[!htb]
\centering
\captionsetup{singlelinecheck=off, labelfont=bf, skip=0pt}
\floatsetup{captionskip=6pt}
\setlength{\arrayrulewidth}{2pt}
\sisetup{ table-number-alignment=center}
\ttabbox{\caption{Main Effects and Interactions}\label{tab:effects}}
{\begin{tabular}{c*{2}{S[table-format=3.2]}S[table-format=-3.2]S[table-format=-2.3]S[table-format=2.3]}
\toprule
Combination & {$\sum\Delta T^{+}$} & {$\sum\Delta T^{-}$} & {Contrast} & {Main Effect (E)} &{Absolute Effect $|E|$}\\
\cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}\cmidrule(lr){5-5}\cmidrule(lr){6-6}
\addlinespace
A & 251.03& 376.99& -125.96& -10.49 & 10.49\\
\addlinespace
B & 372.03& 255.99& 116.04& 9.67 & 9.67\\
\addlinespace
AB & 305.82& 322.2& -16.38& -1.365 & 1.365\\
\addlinespace
C & 274.89& 353.13& -78.24& -6.52 & 6.52\\
\addlinespace
AC & 324.9& 303.12& 21.78& 1.815 & 1.815\\
\addlinespace
BC & 337.3& 290.72& 46.58& 3.88 & 3.88\\
\addlinespace
ABC & 306.09& 321.93& -15.84& -1.32 & 1.32\\
\bottomrule
\end{tabular}}
\end{table}
\end{document}
Edit:
The syntax used here is rather specific to floatrow
: it defines a generic \floatbox
macro. This macro specialises into a \ffigbox
and a \ttabbox
macros for figures and tables respectively, which take two mandatory arguments – the caption, then the floating object, and three optional arguments: the width and height of the box container, and the vertical position of the object in its box. The caption width is the box width, which defaults to the natural width of the floating object.