# Bolding the first column of a table in math mode

What I want to do:

1. Create a table in math mode without $...$ everywhere
2. Bolding the first column

What I have done:

1. Using >{$}c<{$} to put table in math mode; see this answer.
2. Following this answer, I use the package bm. However, I failed to integrate the command $\bm{}$ into >{$}c<{$} introduced above.

I have tried >{$\bm\{}c<{\}$}, >{$\bm}c<{$}, >{\bm$}c<{$}, and >\bm{{$}c<{$}}. Notice that >{$\it}c<{\it$} can italicize the first column. But that is not what I want.

\documentclass{article}
\usepackage{array}      % >{\command} and <{\command} for advanced column specification
\usepackage{bm}         % for bold math symbols

\begin{document}
\begin{table}[!t]
\renewcommand{\arraystretch}{1.5}
\centering
\begin{tabular}{|>{$}c<{$}|>{$}c<{$}|}
\hline
2 & \sin(x) \\ \hline
3 & \log(x) \\ \hline
\end{tabular}
\end{table}
\end{document}


You could use the LaTeX built in \boldmath:

\documentclass{article}
\usepackage{array}      % >{\command} and <{\command} for advanced column specification

\begin{document}
\begin{table}[!t]
\renewcommand{\arraystretch}{1.5}
\centering
\begin{tabular}{|>{\boldmath$}c<{$}|>{\boldmath$}c<{$}|}
\hline
2 & \sin(x) \\ \hline
3 & \log(x) \\ \hline
\end{tabular}
\end{table}
\end{document}


The difference between \bm{} and things like \it (which generally shouldn't be used in LaTeX anyway, with \itshape being preferred) is that \it is a switch that makes all text after it italic, while \bm{} only operates on a given argument.

• \bm has a normal argument, thus the curly braces are argument braces. Therefore the argument for \bm in \bm\bgroup...\egroup is \bgroup, which disturbs the internals, thus that some bold commands are leaking out and affect numbers. However other symbols like \int are not becoming bold. – Heiko Oberdiek Jun 26 '15 at 5:12

If the cells in the column always end with &, then the following trick with delimited arguments can be used:

\documentclass{article}
\usepackage{amstext}
\usepackage{array}
\usepackage{bm}

\def\bmstart#1\bmstop{\bm{#1}}

\begin{document}
\begin{table}[!t]
\renewcommand{\arraystretch}{1.5}
\centering
\begin{tabular}{|>{$\bmstart}c<{\bmstop$}|>{$}c<{$}|}
\hline
2 & \sin(x) \\ \hline
3 & \log(x) \\ \hline
\end{tabular}
\end{table}
\end{document}


Remarks:

The caught argument with the cell contents is wrapped by LaTeX in \ignorespaces and \unskip. Depending on the further processing of the cell contents, they are removed as delimited argument. The spaces should not hurt in math mode.