Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
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 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 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 at 17:35
    
@emmalgale Please ask a follow-up question for this. –  karlkoeller Feb 17 at 20:20
    
Ok, I will do :) –  emmalgale Feb 18 at 9:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.