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'm trying to align numbers (that are bolded, between parentheses, etc.) by decimal points in table columns while using the auto-round option of the siunitx package. The following code doesn't work:

\documentclass{article}
\usepackage[detect-all]{siunitx}
\begin{document}
\sisetup{table-auto-round,input-open-uncertainty=,input-close-uncertainty=,
tableformat=-1.1}
\begin{tabular}{SS}
1.14 & \textbf{-1.15} \\
\footnotesize{(1.34)} & \footnotesize{(1.35)}\\
\textbf{-1.54} & 1.55
\end{tabular}
\end{document}
share|improve this question
2  
I have an answer half-written, but notice a bug in siunitx. I'll have to look at that first! –  Joseph Wright Dec 23 '11 at 22:29
    
Ok. I also noticed that using the array package to make the whole second line footnotesize doesn't seem to work either. Is there a solution? Thanks in advance. –  petobens Dec 23 '11 at 22:50
add comment

1 Answer 1

up vote 6 down vote accepted

You cannot put stuff inside a group and expect siunitx to be able to tell it is a number. For that reason, you should use \bfseries rather than \textbf to make cell contents bold. This needs \bfseries to be 'robust', most easily achieved using the etoolbox package and its \robustify macro:

\documentclass{article}
\usepackage{etoolbox}
\usepackage[detect-all]{siunitx}
\robustify\bfseries
\begin{document}
\sisetup
  {
    table-auto-round,
    input-open-uncertainty=,
    input-close-uncertainty=,
    table-format=-1.1
  }
\begin{tabular}{SS}
1.14            & \bfseries -1.15 \\
( 1.34)         & (1.35)\\
\bfseries -1.54 & 1.55
\end{tabular}
\end{document}

I'm really not sure what you are up to with \footnotesize. Maintaining alignment here looks pretty tough.

share|improve this answer
    
Note: in answering this question, I spotted a bug in v2.4e of siunitx which is fixed but will take a few days to propagate around the world, especially given the time of year. –  Joseph Wright Dec 23 '11 at 23:01
    
Thank you again. I wanted to use footnotesize for standard errors of parameter estimates in a regression. Since they are not as important as the estimated coefficients I wanted to report them in smaller size (and in parentheses). –  petobens Dec 23 '11 at 23:13
    
The parenthesis are no issue, but changing the size is. Setting up an alignment relies on knowing how big the digits are, and so changing the size of the digits (and the .) is a disaster. It is possible to set up to get the size to change but the alignment breaks. Moreover, I'd say that it's bad design to alter the size of text in a table. The parenthesis alone should be enough. –  Joseph Wright Dec 24 '11 at 8:44
    
Without the option [detect-all] when calling the package siunitx, the command \bfseries doesn't work (no error, it just doesn't make it bold). –  Vivi Oct 10 '13 at 1:23
    
@Vivi That’s why it’s in: \usepackage[detect-all]{siunitx}. \sisetup{detect-all} should work, too. –  Qrrbrbirlbel Oct 10 '13 at 1:26
show 1 more 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.