Using the code
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\newcolumntype{C}{>$c<$}
\begin{document}
\[
\begin{array}{C|C|C|C|C|C}
$p$ & $q$ & $p\land q$ & $\overbrace{(p\land q)\to p}^{\textbf{(a)}}$ & $p\lor q$ & $\overbrace{p\to (p\lor q)}^{\textbf{(b)}}$\\
\hline
T & T & T & T & T & T\\
T & F & F & T & T & T\\
F & T & F & T & T & T\\
F & F & F & T & F & T
\end{array}
\]
\end{document}
I can also use
\begin{array}{C|C|C|C|C|C}
$p$ & $q$ & $p\land q$ & $(p\land q)\to p$ & $p\lor q$ & $p\to (p\lor q)$\\
\hline
T & T & T & T & T & T\\
T & F & F & T & T & T\\
F & T & F & T & T & T\\
F & F & F & $\underbrace{\text{T}}_{\textbf{(a)}}$ & F & $\underbrace{\text{T}}_{\textbf{(b)}}$
\end{array}
The only problem, in both cases, is that I want the over/underbrace usage, but I do not want the vertical lines to extend for all of the columns. Is there a way to accomplish the overbrace effect without having the vertical bars scale with it?
Note: If someone can think of a better title for this post and/or more appropriate tags, then please change for whatever works best.
Best Answer
You could use the
\smash
macro to encase the expressions with\overbrace
and\underbrace
material.Since the tables are mostly set in text mode (except for the header row), I suggest you use
tabular
instead ofarray
environments. Furthermore, consider usingcenter
environments instead of encasing the tables in\[
and\]
statements. Finally, you should contemplate getting rid of all vertical bars in the tables and using\midrule
(from thebooktabs
package) instead of\hline
. This will give you a much more open look.Actually, without the vertical bars, using
\smash
isn't strictly necessary. However, I suggest you keep the\smash
directives, just in case you do decide to retain (or bring back) the vertical bars in the tables.