# Problem with table formating

I'm trying to make a table with the cells centered vertically. Any solution I've found is giving me errors or not working.

Here is a minimally working version of my code:

 \documentclass[10pt,a4paper]{article}
\usepackage[left=1.00in, right=1.00in, top=1.00in, bottom=1.00in]{geometry}
\begin{document}
\begin{tabular}{| *7{p{2cm}|}}
\hline
SWIPES & \multicolumn{3}{c|}{ALPHA ACTIVITY DETERMINATIONS} & \multicolumn{3}{c|}{BETA ACTIVITY DETERMINATIONS} \\[2ex] \hline
\normalsize Sample No. & Gross Count Rate (cpm) & Net Count Rate (cpm) & Activity (DPM) & Gross Count Rate (cpm) & Net Count Rate (cpm) & Activity (DPM) \\[2ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
&                        &                      &                &                        &                      &                \\[1.5ex] \hline
\end{tabular}
\end{document}


It outputs a table that looks like this:

Here is what I want it to look like. The double lines aren't required but if you know how to add them I would appreciate it.

My biggest problem with the format is the fact that the titles with beta and alpha in them aren't really centered vertically. Thank you in advance for any help you can give.

• In the preamble \usepackage{array} and then \begin{tabular}{| *7{>{\centering\arraybackslash}p{2cm}|}}...\end{tabular}. – Gonzalo Medina Mar 10 '15 at 16:13

For centering the column contents, load the array package \usepackage{array} and then use

\begin{tabular}{| *7{>{\centering\arraybackslash}p{2cm}|}}
...
\end{tabular}


Use the hhline package for the double lines:

 \documentclass[10pt,a4paper]{article}
\usepackage[left=1.00in, right=1.00in, top=1.00in, bottom=1.00in]{geometry}
\usepackage{array}
\usepackage{hhline}

\begin{document}

{
%\renewcommand\arraystretch{1.3}
\setlength\extrarowheight{5pt}
\begin{tabular}{
|| >{\centering\arraybackslash}p{2cm}
| >{\centering\arraybackslash}p{2cm}
| >{\centering\arraybackslash}p{2cm}
| >{\centering\arraybackslash}p{2cm}
|| >{\centering\arraybackslash}p{2cm}
| >{\centering\arraybackslash}p{2cm}
| >{\centering\arraybackslash}p{2cm}||
}
\hhline{|t:====:t:===:t|}
SWIPES & \multicolumn{3}{c||}{ALPHA ACTIVITY DETERMINATIONS} & \multicolumn{3}{c||}{BETA ACTIVITY DETERMINATIONS} \\[2ex]
\hhline{|:====::===:|}
\normalsize Sample No. & Gross Count Rate (cpm) & Net Count Rate (cpm) & Activity (DPM) & Gross Count Rate (cpm) & Net Count Rate (cpm) & Activity (DPM) \\[2ex]
\hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex] \hhline{||----||---||}
&                        &                      &                &                        &                      &                \\[1.5ex]         \hhline{|b:====:b:===:b|}
\end{tabular}
}

\end{document}


## Remarks:

• Vertical rules are not really necessary; perhaps you could be interested in the booktabs package to improve the quality of your table.

• For vertically centered cells, use m{<length>} instead of p{<length>} columns.

• You can change \arraystretch and/or \extrarowheight to have some more air around cells contents.

• Is there anyway to get the first row of text with swipes, alpha and beta in them to be vertically centered or at least have some space off the top line? – heyjva Mar 10 '15 at 16:24
• @heyjva I think this is an answer to a different question. You asked about vertical centring but this does horizontal centring. Have I understood your question correctly? – cfr Mar 10 '15 at 16:27
• @heyjva Please see my updated answer. I also included the case in which you wanted vertically centered columns. – Gonzalo Medina Mar 10 '15 at 16:30