9

I have a table which contains measurement results. Currently I have one column per measurement 'type'. In each column, I have values like $+$0.74\,\,$\pm$\,\,0.14. The table is rather long (~30 rows), and looks very unorganized. I think it is possible to align the column on one character, like the (first?) ., or the $\pm$. However, I think that then it still looks unorganized. Is there a way to align table columns on more than one item, like both . and the $\pm$. Maybe this will also look weird, I don't know.

Here is what I currently have:

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{lccccl}
 & A & B & C & D & E\\
continental US      & $-$0.81\,$\pm$\,0.14 & $-$1.7\,$\pm$\,0.30 & $-$0.81\,$\pm$\,0.15 & $-$1.6\,$\pm$\,0.30 & $-$0.78 \\
Central-Eastern US  & $-$2.9\,$\pm$\,0.38  & $-$3.0\,$\pm$\,0.38 & $-$2.9\,$\pm$\,0.39  & $-$2.9\,$\pm$\,0.39 & $-$2.7  \\
Western Europe      & $-$2.9\,$\pm$\,0.63  & $-$2.6\,$\pm$\,0.56 & $-$3.0\,$\pm$\,0.65  & $-$2.6\,$\pm$\,0.56 & $-$2.6  \\
Japan               & $-$0.49\,$\pm$\,0.13 & $-$1.2\,$\pm$\,0.33 & $-$0.49\,$\pm$\,0.14 & $-$1.2\,$\pm$\,0.33 & $-$0.49 \\
Middle East         & $+$0.78\,$\pm$\,0.08 & $+$4.0\,$\pm$\,0.42 & $+$0.79\,$\pm$\,0.08 & $+$4.0\,$\pm$\,0.42 & $+$0.72 \\
East Central China  & $+$10\,$\pm$\,1.1    & $+$21\,$\pm$\,2.2   & $+$10\,$\pm$\,1.1    & $+$20\,$\pm$\,2.2   & $+$8.7  \\
North Central India & $+$1.3\,$\pm$\,0.27  & $+$4.0\,$\pm$\,0.84 & ~~1.1\,$\pm$\,0.27   & $+$4.6\,$\pm$\,1.1  & $+$1.1  \\
\end{tabular}
\end{document}

Any suggestions to make this nicer are welcome :)

3
  • 6
    siunitx allows you to align number in tables. Take a look at tex.stackexchange.com/questions/85769/…
    – Jake
    Feb 15, 2013 at 11:15
  • What do the "measurements" represent? If you were to read the table aloud to me, how would you read it column-wise or row-wise? Feb 19, 2013 at 20:38
  • @YiannisLazarides measurements are trends in air quality. rows are locations, columns are different methods. If reading the table, I would read row-wise
    – andreas-h
    Mar 1, 2013 at 18:18

1 Answer 1

6

I would recommend siunitx for this kind of table:

\documentclass{article}
\usepackage{booktabs,siunitx}

% uncertainty is separated with a "plus-minus" symbol
\sisetup{separate-uncertainty=true}
\begin{document}

\begin{tabular}{
 l
 S[table-format=-1.2,
   table-figures-uncertainty=1]
 S[table-format=-1.2,
   table-figures-uncertainty=1]
}
\toprule
 & {A} & {B} \\
\midrule
continental US      & -0.81 \pm 0.14 & -1.7 \pm 0.30 \\
Central-Eastern US  & -2.9  \pm 0.38 & -3.0 \pm 0.38 \\
Western Europe      & -2.9  \pm 0.63 & -2.6 \pm 0.56 \\
Japan               & -0.49 \pm 0.13 & -1.2 \pm 0.33 \\
\bottomrule
\end{tabular}
\end{document}

The same number of significant digits seems better; look at the package documentation for more details.

enter image description here

6
  • nice one! thanks! any idea how I can do this in LyX?
    – andreas-h
    Mar 1, 2013 at 18:23
  • 1
    @andreas-h No, I've never used LyX: I tried it once, five minutes later there was no trace of it on my machine any more. I think it's false that it eases using LaTeX; to the contrary, it makes easy things like this difficult.
    – egreg
    Mar 1, 2013 at 18:25
  • The only reason I'm using LyX is to be able to share documents and annotate (like in collaborative writing) them in a group of people. LyX allows you to insert notes, track changes, etc. I personally would do this in plain LaTeX with git, but some of my coworkers (read: boss) refuse to use a plain text file in an ASCII editor for this. They're used to word, and I'm glad I can convince them to use LyX ... Any suggestions?
    – andreas-h
    Mar 1, 2013 at 18:29
  • You might want to insert it as ERT. You can then put a preview box around it so the rendered table will show up. Or you could save it in an external file and include it (Insert File > Child Document)
    – scottkosty
    Mar 1, 2013 at 18:32
  • @egreg I agree that the same number of significant digits looks better. But strictly speaking, it's not correct, right? Writing 2.90 implies that the value is measured to three significant digits, when in fact it's only two. At least, that's how I learned it.
    – andreas-h
    Apr 10, 2013 at 12:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .