# Table mid align

I have made two tables side by side as below.

\begin{center}
\begin{tabular}{c|cc}
\hline
+ & 0 & 1 \\
\hline
0 & 0 & 1 \\
\hline
1 & 1 & 0 \\
\end{tabular}
\begin{tabular}{c|cc}
\hline
$\cdot$ & 0 & 1 \\
\hline
0 & 0 & 0 \\
\hline
1 & 0 & 1 \\
\end{tabular}
\end{center}


But the texts in each cell is aligned top. How do I align them all in the middle?

• I am confused. The text in each cell is not aligned to the top. Perhaps I am misunderstanding the question? Could you please elaborate? Sep 6 '15 at 17:01
• They are in the in the middle. That is, on the baseline of each row. Sep 6 '15 at 17:01
• The numbers appear to be "lifted" a bit and not in the center of their respective boxes? Sep 6 '15 at 17:29
• That is just because the numbers have height but not depth i.e. there is nothing below the baseline. If you add a y, you will see what I mean.
– cfr
Sep 6 '15 at 17:46

The effect is the result of the numberals being lining and so having no depth. That is, there is nothing below the baseline. If you add a letter which has depth e.g. y and one with only height e.g. f, you can see that the content is aligned correctly (from TeX's point of view, at least) in terms of the baseline:

\documentclass[]{article}

\begin{document}
\begin{center}
\begin{tabular}{c|cc}
\hline
+ & 0 & 1fy \\
\hline
0 & 0 & 1 \\
\hline
1 & 1 & 0 \\
\end{tabular}
\begin{tabular}{c|cc}
\hline
$\cdot$ & 0 & 1 \\
\hline
0 & 0 & 0 \\
\hline
1 & 0 & 1 \\
\end{tabular}
\end{center}
\end{document}


You might want to take a look at booktabs to improve the formatting. In general, booktabs recommends dispensing with vertical rules altogether. For example:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{center}
\begin{tabular}{ccc}
\toprule
+ & 0 & 1fy \\
\midrule
0 & 0 & 1 \\
\midrule
1 & 1 & 0 \\
\bottomrule
\end{tabular}
\begin{tabular}{ccc}
\toprule
$\cdot$ & 0 & 1 \\
\midrule
0 & 0 & 0 \\
\midrule
1 & 0 & 1 \\
\bottomrule
\end{tabular}
\end{center}
\end{document}


Or look at one of the other packages available for enhanced tabular layouts. For example, here's a possibility using makecell:

Doubtless this is not the most efficient usage but I'm not very familiar with this package:

\documentclass{article}
\usepackage{makecell}
\begin{document}
\begin{center}
\renewcommand\cellalign{cc}
\begin{tabular}{c|cc}
\Xhline{1pt}
+ & \gape[t]{0} & \gape[t]{1} \\
\hline
\gape[t]{0} & \gape[t]{0} & \gape[t]{1} \\
\hline
\gape[t]{1} & \gape[t]{1} & 0 \\
\Xhline{1pt}
\end{tabular}
$\cdot$ & \gape[t]{0} & \gape[t]{1} \\