[Tex/LaTex] Format whole row of table as bold

boldformattingtables

This appears to be a problem which a few people have had before, but since I've been unable to find a solution which works I thought I should ask again.

I have a LaTeX table of 5 columns width and about 100 rows depth, and I'd like to format whole rows in bold font as opposed to changing each individual cell entry to bold. I don't want every single row to be bold, only a certain selection.

I've tried this solution:

Make first row of table all bold

This doesn't throw up errors, but only changes the first entry of the row to bold font, rather than all the entries in the row. My code is below.

\begin{table}[htbp]
\caption{List of the gamma rays from TS1 and TS2 in the energy region from 140 keV to 655 keV}
\begin{adjustbox}{center}
\begin{tabular}{cccrcc}
\toprule
Energy & Energy & Origin & \multicolumn{1}{c}{Branching} & Av. peak  & Av. Peak \\

Measured & Measured & \&    & \multicolumn{1}{c}{Ratio } & count rate in & count rate \\
TS1   & TS2   & Process & \multicolumn{1}{c}{(emission} & TS1 [1/hr]  & TS2  \\
 (keV) & (keV) &       & \multicolumn{1}{c}{probability} & Beam on  & [1/hr]  \\
      &       &       & \multicolumn{1}{c}{per decay)} & (Beam off) &  \\
      \midrule
140.38 & 140.31 & 75m-Ge (IT) & 39\%  & 461 (0) & 17 \\
159.70 & --    & 63-Cu (n,G) & 15.00\% & 411 (0) & -- \\
175.77 & --    & 70-Ge (n,G) & 25.00\% & 272 (0) & -- \\
186.39 & 186.59 & 235-U (A) & 57.20\% & 44 (56) & 43 \\
199.02 & 199.07 & 71-Ge (EC) & N/A   & 440 (0) & 38 \\
239.20 & 239.19 & 212-Pb (B-) & 43.30\% & 192 (197) & 186 \\
242.41 & 242.59 & 214-Pb (B-) & 7.43\% & 52 (57) & 79 \\
250.75 & --    & 39-Cl (B-) & 46.30\% & 177 (0) & -- \\
--    & 272.36 & 173-Lu (EC) & 21.20\% & --    & 48 \\
278.51 & --    & 63-Cu (n,G) & 24.00\% & 296 (0) & -- \\
295.65 & 295.55 & 214-Pb (B-) & 19.30\% & 92 (133) & 134 \\
320.41 & --    & 51-Cr (EC) & 10.00\% & 16 (17) & -- \\
338.61 & 338.78 & 228-Ac (B-) & 11.27\% & 43 (41) & 50 \\
352.28 & 352.22 & 214-Pb (B-) & 19.30\% & 449 (232) & 307 \\
352.28 & 352.22 & 56-Fe (n,G) & 9.50\% & 449 (232) & 307 \\
440.09 & --    & 23-Mg (EC) & 8.20\% & 131 (0) & -- \\
463.21 & 463.31 & 228-Ac (B-) & 4.40\% & 25 (17) & 14 \\
472.27 & --    & 23-Na (n,G) & 90.39\% & 81 (0) & -- \\
477.77 & --    & 7-Be (EC) & 10.52\% & 1457 (1501) & -- \\
500.01 & --    & 70-Gen (n,G) & 24.10\% & 93 (0) & -- \\
510.99 & 511.02 & Ann.  & N/A   & 116190 (262) & 18607 \\
--    & 558.42 & 113-Cd (n,G) & 74.40\% & --    & 141 \\
583.45 & 583.31 & 208-Tl (B-) & 84.50\% & 82 (91) & 84 \\
595.96 & 596.31 & 74-Ge (n,n' G) & 100.00\% & 272(0) & 15 \\
609.26 & --    & 74-Ge (n,n' G) & 18.20\% & 275 (219) & -- \\
609.48 & 609.55 & 214-Bi (B-) & 46.10\% & 275 (219) & 287 \\
--    & 651.28 & 113-Cd (n,G) & 14.09\% & --    & 35 \\
\bottomrule
\end{tabular}%
\end{adjustbox}
\label{tab:addlabel}%
\end{table}%

Thanks for any guidance.

Best Answer

Maybe this? I introduce a \setrow{...} macro invoked on the first element of a row, which applies to each cell of that row (and is then reset). It employs the >{} and <{} feature of tabularx.

\documentclass{article}
\usepackage{tabularx}
\newcommand\setrow[1]{\gdef\rowmac{#1}#1\ignorespaces}
\newcommand\clearrow{\global\let\rowmac\relax}
\clearrow
\begin{document}
\begin{tabular}{>{\rowmac}c|>{\rowmac}c|>{\rowmac}c<{\clearrow}}
a & b & c\\
\setrow{\bfseries}d & e & f\\
e & f& g\\
h & i & j\\
\setrow{\itshape} k & l & m\\
n & o & p
\end{tabular}
\end{document}

enter image description here

As applied to the OP's problem:

\documentclass{article}
\usepackage{tabularx,adjustbox,booktabs}
\newcommand\setrow[1]{\gdef\rowmac{#1}#1\ignorespaces}
\newcommand\clearrow{\global\let\rowmac\relax}
\clearrow
\begin{document}
\begin{adjustbox}{center}
\begin{tabular}{>{\rowmac}c>{\rowmac}c>{\rowmac}c>{\rowmac}r>{\rowmac}c>{\rowmac}%
  c<{\clearrow}}
\toprule
Energy & Energy & Origin & \multicolumn{1}{c}{Branching} & Av. peak  & Av. Peak \\

Measured & Measured & \&    & \multicolumn{1}{c}{Ratio } & count rate in & count rate \\
TS1   & TS2   & Process & \multicolumn{1}{c}{(emission} & TS1 [1/hr]  & TS2  \\
 (keV) & (keV) &       & \multicolumn{1}{c}{probability} & Beam on  & [1/hr]  \\
      &       &       & \multicolumn{1}{c}{per decay)} & (Beam off) &  \\
      \midrule
140.38 & 140.31 & 75m-Ge (IT) & 39\%  & 461 (0) & 17 \\
159.70 & --    & 63-Cu (n,G) & 15.00\% & 411 (0) & -- \\
175.77 & --    & 70-Ge (n,G) & 25.00\% & 272 (0) & -- \\
\setrow{\bfseries}186.39 & 186.59 & 235-U (A) & 57.20\% & 44 (56) & 43 \\
199.02 & 199.07 & 71-Ge (EC) & N/A   & 440 (0) & 38 \\
239.20 & 239.19 & 212-Pb (B-) & 43.30\% & 192 (197) & 186 \\
242.41 & 242.59 & 214-Pb (B-) & 7.43\% & 52 (57) & 79 \\
250.75 & --    & 39-Cl (B-) & 46.30\% & 177 (0) & -- \\
--    & 272.36 & 173-Lu (EC) & 21.20\% & --    & 48 \\
\setrow{\bfseries}278.51 & --    & 63-Cu (n,G) & 24.00\% & 296 (0) & -- \\
\setrow{\bfseries}295.65 & 295.55 & 214-Pb (B-) & 19.30\% & 92 (133) & 134 \\
320.41 & --    & 51-Cr (EC) & 10.00\% & 16 (17) & -- \\
338.61 & 338.78 & 228-Ac (B-) & 11.27\% & 43 (41) & 50 \\
352.28 & 352.22 & 214-Pb (B-) & 19.30\% & 449 (232) & 307 \\
352.28 & 352.22 & 56-Fe (n,G) & 9.50\% & 449 (232) & 307 \\
440.09 & --    & 23-Mg (EC) & 8.20\% & 131 (0) & -- \\
463.21 & 463.31 & 228-Ac (B-) & 4.40\% & 25 (17) & 14 \\
\setrow{\bfseries}472.27 & --    & 23-Na (n,G) & 90.39\% & 81 (0) & -- \\
477.77 & --    & 7-Be (EC) & 10.52\% & 1457 (1501) & -- \\
500.01 & --    & 70-Gen (n,G) & 24.10\% & 93 (0) & -- \\
510.99 & 511.02 & Ann.  & N/A   & 116190 (262) & 18607 \\
--    & 558.42 & 113-Cd (n,G) & 74.40\% & --    & 141 \\
\setrow{\bfseries}583.45 & 583.31 & 208-Tl (B-) & 84.50\% & 82 (91) & 84 \\
595.96 & 596.31 & 74-Ge (n,n' G) & 100.00\% & 272(0) & 15 \\
\setrow{\bfseries}609.26 & --    & 74-Ge (n,n' G) & 18.20\% & 275 (219) & -- \\
609.48 & 609.55 & 214-Bi (B-) & 46.10\% & 275 (219) & 287 \\
--    & 651.28 & 113-Cd (n,G) & 14.09\% & --    & 35 \\
\bottomrule
\end{tabular}%
\end{adjustbox}
\end{document}

enter image description here