# How to align a top-align a table that starts with an \hline?

I want to TeXify this document as an exercise. At the bottom of its second page, there are some tables. I tried to create something similar to this using LaTeX and finally did this:

Von den 15 Zerlegungen \emph{bei} $\mu=4$ sind die ersten sieben:
\begin{flushleft}
$v=2;\ p= \begin{tabular}[t]{|c|c|}\hline$-1$&$-256$\\\hline \end{tabular}$
[bedeutet: $(-1)^2+(-256)^2=p$]\\
$v=3;\ p= \begin{tabular}[t]{|c|c|}\hline$255$&$0$\\\hline$-16$&$-16$\\\hline \end{tabular}$
\end{flushleft}


To me, that code seems very strange and it doesn't works. Can some TeXpert help me please?

-

\usepackage{array}
...

Von den 15 Zerlegungen \emph{bei} $\mu=4$ sind die ersten sieben:
\begin{flushleft}
$v=2$; $p= \begin{array}[t]{|c|c|} \firsthline -1&-256\\ \lasthline \end{array}$
[bedeutet: $(-1)^2+(-256)^2=p$]\\
$v=3$; $p= \begin{array}[t]{|c|c|} \firsthline 255&0\\ \hline -16&-16\\ \lasthline \end{array}$
\end{flushleft}


In these particular examples \lasthline is not really necessary; but it's handy to put it there, so if we change our mind and want bottom alignment all we need is to change the optional argument to array. These commands work, of course, also for tabular. They won't do any good if the first table row has excessive height.

Some advices. Use array in math mode, it spares you from putting so many $ symbols. Notice also the $ before the semicolon: different formulas should be segregated on their own.

-
Good advice! Btw. there's further \lasthline, useful if bottom alignment is desired. –  Stefan Kottwitz Jun 25 '11 at 21:03
@Stefan: I'll add \lasthline, thanks. –  egreg Jun 25 '11 at 21:05
@egreg Another little question: How can I get the columns to have all the same size? –  FUZxxl Jun 25 '11 at 21:33
For that you need the p specifier and fix the width yourself. Or use \makebox[\widthof{$-256$}]{$-1$} (requires the calc package). –  egreg Jun 25 '11 at 21:43
That's normal. But you can say >{\centering\arraybackslash$}p{1cm}<{$} and get fixed width columns with centered math mode entry. –  egreg Jun 25 '11 at 22:15