How to make column bold in array?
collcell
seems to help here, passing the cell contents to a \user
macro
(with one argument) via the array
-like column specification
. . . >{\collectcell\usermacro}c<{\endcollectcell} . . .
\documentclass{article}
\usepackage{amsmath,collcell}
\begin{document}
\[
\begin{array}{ c c | >{\collectcell\boldsymbol}c<{\endcollectcell} c l c c l }
X & Y & \neg & X & \rightarrow( & Y & \rightarrow & X)) \\
\hline
0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 \\
1 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 & 1 & 1 & 1 & 1
\end{array}
\]
\end{document}
Another possibility, without collcell
, is to use a short definition like this:
\def\bstart#1\bstop{\boldsymbol{#1}}
This way, you will be able to bypass the &
character at the end of each cell of the array and get the required bold math symbols.
\documentclass{article}
\usepackage{amsmath,array}
\def\bstart#1\bstop{\boldsymbol{#1}}
\begin{document}
\[
\begin{array}{ c c | >{\bstart} c <{\bstop} c l c c l }
X & Y & \neg & X & \rightarrow( & Y & \rightarrow & X)) \\
\hline
0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 \\
1 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 & 1 & 1 & 1 & 1
\end{array}
\]
\end{document}
Enable \boldmath
, but for this we need to exit from math mode, issuing \boldmath
and reentering math mode. This is more conveniently done with a new column type.
\documentclass{article}
\usepackage{amsmath,array}
\newcolumntype{C}{>{$\boldmath$}c}
\begin{document}
\[
\begin{array}{ c c | C c l c c l }
X & Y & \neg & X & \rightarrow( & Y & \rightarrow & X)) \\
\hline
0 & 0 & 0 & 0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 1 & 1 & 0 & 0 \\
1 & 0 & 0 & 1 & 1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 & 1 & 1 & 1 & 1
\end{array}
\]
\end{document}