[Tex/LaTex] Use of underline and siunitx in a table

siunitxtables

I have a table of numbers that are aligned using the 'S' format of siunitx (so they are aligned by the decimal point). I need to mark the statistically significant numbers somehow, and using bold font or asterisks to mark these don't make them stand out very well. I am not allowed to use colour in the table, so I was thinking of trying underlining. However, if I use \underline{}, the underlined numbers are no longer aligned by the decimal point and are left aligned instead.

Is there any way I can underline items whilst keeping them aligned by the decimal point?

Here is a basic version of the code for the table I have so far:

\documentclass{article}
\usepackage{etoolbox,siunitx,booktabs,threeparttable,multirow,array,graphicx}
\robustify\bfseries
\robustify\tnote

\begin{document}
\sisetup{detect-weight=true,detect-inline-weight=math,table-align-text-post=false}
\begin{table}
    \caption{Insert caption here}
    \centering
    \begin{threeparttable}[b]
        \begin{tabular}{SS}
        \toprule
        {Column 1} & {Column 2}\\
        \midrule
        7.1 & 4.2\\
        \underline{8.7} & 6.5\\
        9.3 & \underline{1.0}\\
        \bottomrule 
        \end{tabular}
    \end{threeparttable}
\end{table}
\end{document}

Not sure how to post an image of what the output looks like.

I did have a search online for anyone asking a similar question, but couldn't find anything.

Best Answer

It works fine with the command \uline from the ulem package.

MWE:

\documentclass{article}
\usepackage{etoolbox,siunitx,booktabs,threeparttable,multirow,array,graphicx}
\usepackage[normalem]{ulem}
\robustify\bfseries
\robustify\uline
\robustify\tnote


\begin{document}
\sisetup{detect-weight=true,detect-inline-weight=math,table-align-text-post=false}
\begin{table}
    \caption{Insert caption here}
    \centering
    \begin{threeparttable}[b]
        \begin{tabular}{SS}
        \toprule
        {Column 1} & {Column 2}\\
        \midrule
        7.1 & 4.2\\
        \uline{8.7} & 6.5\\
        9.3 & \uline{1.0}\\
        \bottomrule
        \end{tabular}
    \end{threeparttable}
\end{table}
\end{document} 

Output:

enter image description here

Note that you have to load ulem with the option normalem if you don't want the command \emph to behave as \uline and you also have to \robustify the \uline command.

Related Question