Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

LaTeX: Tables and Columns and Units, oh my!

  1. May 15, 2010 #1
    I'm trying to make a table in LaTeX in which all the entries of a column have the same units, without having to type them for each column. (Before you say it, yes, I know I could just put the units in the column heading, but I don't want to).

    I tried:
    Code (Text):

    \documentclass{article}
    \usepackage{siunitx}
    \begin{document}
    \begin{center}\begin{tabular}{|>{\SI\bgroup}c<{\egroup{\centi m}}|c|c|c|}\hline
    0.1 & 0.2 & 0.3 & 0.4 \\ \hline
    0.5 & 0.6 & 0.7 & 0.8 \\ \hline
    \end{tabular}\end{center}
    \end{document}
     
    Which gives:
    Code (Text):

    ! Package siunitx Error: Invalid character `\bgroup ' in numerical input.
     
    Any suggestions?
    Thanks in advance.
     
  2. jcsd
  3. May 15, 2010 #2
    Figured it out.

    If anyone else is interested
    Code (Text):

    \documentclass{article}
    \usepackage{siunitx}
    \begin{document}
    \begin{center}\begin{tabular}{|S<{\, \si{\centi m}}|c|c|c|}\hline
    0.1 & 0.2 & 0.3 & 0.4 \\ \hline
    0.5 & 0.6 & 0.7 & 0.8 \\ \hline
    \end{tabular}\end{center}
    \end{document}
     
    Works as long as the numbers are all the same length.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook