# siunitx, bold numbers in cell with cell content start with \$Based on egreg answer on question how-can-i-make-siunitxs-num-bold i try to make the following table: \documentclass[12pt, border=2mm, preview]{standalone} \usepackage{booktabs} \usepackage{siunitx} \usepackage{etoolbox} \renewcommand{\bfseries}{\fontseries{b}\selectfont} \newrobustcmd{\B}{\bfseries} \begin{document} %---------------------------------------------------------------% \begin{table} \sisetup{detect-weight, mode=text, table-format=2.2} \centering \begin{tabular}{ l >{\$}S[table-align-text-pre=false,
table-space-text-pre =\$] S[table-space-text-post=\,]<{\%} } \toprule text a & \B 17.89 & \B 10.29 \\ text b & 0.29 & 7.89 \\ \bottomrule \end{tabular} \end{table} \end{document}  which gives: Is possible to convince siunitx that also the second cell in the first row to be write in bold? • Interesting feature. Anyway, repeated marker should be avoided and put in the column header. Feb 18 '17 at 23:43 • @Bernard As I understood he wants the "17.89" to be bold. Feb 18 '17 at 23:44 • @Bernard The second cell in the first row has \B, but the entry is not emboldened. Feb 18 '17 at 23:44 • The >{\$} somehow prevents the cell from being bold. Feb 18 '17 at 23:45
• @egreg, in normal circumstances the ˙should be in column headers, but I saw some question here with such demands, so I start to thinking how to solve this with siunitx Feb 18 '17 at 23:50 ## 1 Answer This happens as siunitx is trying to maintain alignment. The material before the number is typeset in a box, which means that any colour or font change commands will be lost. You don't see that with just a font switch as it's zero-width: that's detected and inserted directly (not boxed). You can get around this by making the inserted material have zero width: \documentclass[12pt, border=2mm, preview]{standalone} \usepackage{booktabs} \usepackage{siunitx} \usepackage{etoolbox} \renewcommand{\bfseries}{\fontseries{b}\selectfont} \newrobustcmd{\B}{\bfseries} \begin{document} %---------------------------------------------------------------% \begin{table} \sisetup{detect-weight, mode=text, table-format = 2.2} \centering \begin{tabular}{ l >{{\makebox[0pt][l]{\}}}S[table-align-text-pre=true,
table-space-text-pre =\$] S[table-space-text-post={\,\%}]<{\,\%} } \toprule text a & \B 17.89 & \B 10.29\cr text b & 0.29 & 7.89\cr \bottomrule \end{tabular} \end{table} \end{document}  A bug shows up in siunitx when you do this as the $ tokens are duplicated. A fix will be on CTAN later today. It can be fixed for the moment using

\ExplSyntaxOn
\patchcmd \__siunitx_table_print_S_reserved_ends:
{ \l__siunitx_table_collect_pre_tl \bool_set_false:N }
{ \box_clear:N \l__siunitx_table_pre_box
\l__siunitx_table_collect_pre_tl \bool_set_false:N
}
{ }
{ }
\ExplSyntaxOff

• Thank you very much! I try to replace >{{\makebox[0pt][l]{\$}}} with shorter >{\rlap{\$}} and this also works. Both makes numbers bold, but table-align-text-pre=false, doesn't work anymore :-( Feb 19 '17 at 11:27
• @Zarko \rlap` isn't a LaTeX command Feb 19 '17 at 11:30
• @Zarko I'll see if I can sort the alignment issue: it's tricky with the current code set up Feb 19 '17 at 12:49