# Use of underline and siunitx in a table

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.

-

## 1 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:

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.

-
Thanks a lot! I did try the \uline thing with ulem, but I hadn't done the \robustify bit. I will try that now to see if it works. – emmalgale Feb 10 '14 at 17:16
Added the package and did \robustify\uline and it all works perfectly! So frustrating when you miss little things like that, so very grateful for this website!! – emmalgale Feb 10 '14 at 17:19
I now have another problem related to this. In the \sisetup, I have added table-format=2.1 to reduce the space each number was taking up. When I do this, the underline values don't align with the non-underlined ones. Is there any way I can fix this without removing the table-format? – emmalgale Feb 17 '14 at 17:35
@emmalgale Please ask a follow-up question for this. – karlkoeller Feb 17 '14 at 20:20
Ok, I will do :) – emmalgale Feb 18 '14 at 9:56