4

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.

emmalgale
  • 187

1 Answers1

4

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.

karlkoeller
  • 124,410
  • 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 09:56
  • @karlkoeller please try some number which is not 1.1. For me, the \uline approach does not work then. Thanks. – LaRiFaRi Aug 05 '15 at 09:59
  • @LaRiFaRi It works fine for me with every number I tried. Can you give some more info? – karlkoeller Aug 05 '15 at 14:12
  • @karlkoeller Just do \uline{8.77} & 6.5\\ and the decimal alignment (which, I guess, is what was wanted by the S-column) vanishes. – LaRiFaRi Aug 05 '15 at 14:13
  • @LaRiFaRi I don't see the point. Use S[table-format = 1.2] as a column specifier. Nothing to do with \uline. – karlkoeller Aug 05 '15 at 14:19
  • @karlkoeller If you set \uline{9.3} then as well, it will get distorted again. If you leave SS and don't use \uline at all, the decimal point alignment works even without table-format=1.2 or alike. That is why I think your solution is having some mistake. The follow up of the OP goes in similar direction, of course. – LaRiFaRi Aug 05 '15 at 14:21
  • @LaRiFaRi You're right. I don't have a workaround, I'm sorry. – karlkoeller Aug 05 '15 at 14:24
  • Me neither. Well. I just wanted to be sure, it is not just on my system. Thanks for your time. If someone stumbles on this discussion. Here is some work to do: http://tex.stackexchange.com/q/161032 – LaRiFaRi Aug 05 '15 at 14:26