My question is similar to siunitx: aligning numbers by decimal points in tables doesn't work for bolded or italicized numbers , except I would like to apply formatting to a row or a specific cell, not a whole column. I have not been able to applying the suggested answers to make siunitx interpret the bold or color macros.
The section 9.4 of the siunitx package documentation says that
using the e-TeX protected mechanism is the recommended course of action to prevent expansion of macros in table cells
but I still don't know how to properly do that. I tried to apply what is proposed here with no success:
\documentclass{article}
\usepackage{booktabs}
\usepackage{etoolbox}
\robustify\bfseries
\usepackage{siunitx,xcolor}
\sisetup{detect-weight=true, detect-inline-weight=text, locale = FR}
\begin{document}
\begin{tabular}{l S S}
\toprule
\textbf{Foo} & \textbf{Col1} & \textbf{Col2} \
\midrule
foo1 & 11.1 & 11.1\
foo2 & 222.2 & 222.2\
\textbf{foo3} & \textbf{3.333} & \textbf{3.333}\
foo4 & 4 & 4\
foo5 & 555.55 & \textcolor{gray}{555.55}\
foo6 & 6.00 & 6.00\
\bottomrule
\end{tabular}
\end{document}
Thanks for your help.


\textbfyou must use\bfseriesto apply to the whole cell – Joseph Wright Feb 02 '22 at 15:52