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.

Let me begin by stating that I did google the answers (and I'll reference to them soon). Yet each of the resources I found discussed one particular method, I'm interested in a comparison of the approaches.

So far, I've found three ways to deal with this problem:

  • split the number into two columns (integer and fractional parts), as documented here or here. The LaTeX code is simple, but the approach is a pain when it comes to copying and pasting tables from external sources.

  • use dcolumn manually

  • use Mike Zhang's automatic converter (description). I have yet to test it.

What do most people use? dcolumn? Are there other options?

share|improve this question
add comment

1 Answer 1

up vote 53 down vote accepted

The newest option is using the S column type of the siunitx package.

\documentclass{article}

\usepackage{siunitx}

\begin{document}
\begin{tabular}{S[table-format=3.2]}% syntax for siunitx v2; for v1 use "tabformat"
555 \\
7.77 \\
99.9
\end{tabular}

\end{document}

example

share|improve this answer
2  
I didn't know you didn't know. ;-) –  lockstep Sep 4 '10 at 21:37
3  
Indeed, in version 2 of siunitx you will find that there is an implementation that is ~ the same as the dcolumn one, plus a second approach more similar to rccol. –  Joseph Wright Sep 4 '10 at 21:48
1  
This looks great. I can't get it to work though. With pdflatex from texlive 2009 on OSX, I got: ! Package xkeyval Error: `table-format' undefined in families `key'. –  dank Sep 5 '10 at 13:01
1  
Seems like you're using siunitx v.1.x (the current version is 2). Try tabformat instead of table-format. –  lockstep Sep 5 '10 at 13:58
5  
in response to a comment by daniel kullmann Nov 15 '11 at 10:31 The official way of getting siunitx to ignore bits of text, like headers, is to just wrap them in braces; i.e. {name} will work just as well as \multicolumn{1}{c}{name}. See for instance tex.stackexchange.com/questions/3709/… (would still like newbies to be able to post comments!) –  Sam Mason Sep 23 '12 at 17:41
show 7 more comments

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.