# tabular align with irregular number of rows

I am trying to set up a tabular system like the one below, but latex does not seem to want to work with different number of elements in each row. Any way to fix this ?

|Prime numbers| |   Integers  | | Square numbers  | | Difference  |
| p |           | n_1 | | n_2 | | n_1^2 | | n_2^2 | |n_1^2 - n_2^2|
| 3 |           |  2  | |  1  | |  2^2  | |  1^1  | |      3      |


Anyone have a good method for seting up sucha a table? =)

-

You seem to want \multicolumn, probably combined with the array package to do soemthing like

\documentclass{article}
\usepackage{array,booktabs}
\begin{document}
\begin{tabular}{*{6}{>{$}c<{$}}}
\toprule
\multicolumn{1}{c}{Prime numbers} &
\multicolumn{2}{c}{Integers} &
\multicolumn{2}{c}{Square numbers} &
\multicolumn{1}{c}{Difference} \\
\midrule
p & n_1 & n_2 & n_1^2 & n_2^2 & n_1^2 - n_2^2 \\
3 &   2 &   1 &   2^2 &   1^1 &       3       \\
\bottomrule
\end{tabular}
\end{document}

-
Thanks! Thats almost what I need , so close. Only problem now is that the rows are nor completely aligned. I feel that they are a bit left centered compared to the titles Also they are a bit cramped vertically. Will see if I can add some space on my own Thanks again –  N3buchadnezzar Oct 2 '11 at 9:17