# How to make column bold in array?

\begin{align*}
\begin{array}{cc|>{\boldsymbol}cclccl}
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{align*}


I just need the first column right to the vertical line to be bold. I couldn't figure out how to make this work; I hope someone can help.

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}


   \begin{document}

\huge
\begin{tabular}{cc|cccccc}
X&Y&${\bf\neg}$&X&$\rightarrow$&Y&$\rightarrow$&X\\        \hline
0&0&{\bf 0}&0&1&0&1&0\\
0&1&{\bf 0}&0&1&1&0&0\\
1&0&{\bf 0}&1&1&0&1&1\\
1&1&{\bf 0}&1&1&1&1&1\\\hline
\end{tabular}

\end{document}


% This is a simple way of preparing the table.