I am generating a bunch of TeX-tables (with Stata), in which one particular row has to be highlighted (bold). I can however only modify the first column in there, hence I want to place a command in the first cell of column to make it bold(or not)
So far I've been using this "Make first row of table all bold", which does exactly what I want.
\documentclass[12pt]{standalone}
\usepackage{dcolumn}
\newcolumntype{X}{>{\rowstyle{\relax}}l}
\newcolumntype{Y}{>{\currentrowstyle}c}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}}
\begin{document}
\begin{tabular}{XYY}
normal row & 1.1 & 2.2\\
bold row \rowstyle{\bfseries} & 1.1 & 2.2\\
\end{tabular}
\end{document}
Now, I decided to switch to dcolumn
, which is great, but breaks the bold-workaround, as it wraps cells in mathmode. The solution David provided here (Decimals in table don't align with dcolumn when bolded) does not really work either, as it would require a \multicolumn{1}{B}{...}
in every bold cell.
Simply using mathbf
instead doesnt seem to do the trick. Any suggestions are greatly appreciated.
numprint
package (§6 of the documentation:Printing aligned numbers in tabulars
). It can manage bold numbers (in text and math modes) and non-numeric extra content of cells.\bfseries
can't work becausedcolumn
uses math mode.