siunitx:如何在表格中加粗、对齐和分隔?

siunitx:如何在表格中加粗、对齐和分隔?

我有以下 siunitxttable:

\sisetup{separate-uncertainty=true}
\begin{tabular}{
l
S[table-format=6.0, table-figures-uncertainty=5]
S[table-format=6.0, table-figures-uncertainty=5, detect-weight]
S[table-format=2.0]
S[table-format=1.2, detect-weight]
}
\toprule
{algorithm} & {$1$-ply} & {$3$-ply} & {\# $n$-tuples} & {time [days]}\\
\midrule
42-33 (baseline) & 265435\pm8511  & 393289\pm26496 & 5  & 2.35 \\
42-33, CS        & 258616\pm5784  & 432701\pm13005 & 5  & 2.78 \\
42-33-4-22, CS   & 263156\pm27722 & 464836\pm15941 & 10 & \bfseries 4.63 \\
42-33-4-22-3     & 319433\pm2708  & 469779\pm10920 & 12 & 5.06 \\
42-33-4-22-3, CS & 314013\pm7587  & 491398\pm19458 & 12 & 5.47 \\
\bottomrule
\end{tabular}

我能够使 4.63 加粗并对齐,但我想使第二列或第三列的一些单元格也加粗并对齐。这\bfseries对它们不起作用。怎么做?

答案1

您必须按照说明\robustify执行命令\bfseries这里.然后它适用于任何S列。

\documentclass[border=2mm]{standalone}
\usepackage{etoolbox}
\usepackage{booktabs}
\usepackage{siunitx}
    \sisetup{separate-uncertainty=true}
\begin{document}
        \robustify\bfseries
    \begin{tabular}{
                    l
                    S[table-format=6.0,table-figures-uncertainty=5]
                    S[table-format=6.0,table-figures-uncertainty=5, detect-weight]
                    S[table-format=2.0]
                    S[table-format=1.2,detect-weight]
                   }
            \toprule
        {algorithm} & {$1$-ply} & {$3$-ply} & {\# $n$-tuples} & {time [days]}\\
            \midrule
        42-33 (baseline) & 265435(8511)  & 393289(26496)           & 5  & 2.35           \\
        42-33, CS        & 258616(5784)  & \bfseries 432701(13005) & 5  & 2.78           \\
        42-33-4-22, CS   & 263156(27722) & 464836(15941)           & 10 & \bfseries 4.63 \\
        42-33-4-22-3     & 319433(2708)  & 469779(10920)           & 12 & 5.06           \\
        42-33-4-22-3, CS & 314013(7587)  & 491398(19458)           & 12 & 5.47           \\
            \bottomrule
    \end{tabular}
\end{document}

该图显示了上述代码的结果

相关内容