Ryan's Blog

Aligning on decimal points: an example of the @ specifier

Posted in latex by ryanlayer on October 5, 2009

In scientific tables it is often desirable to align the columns on a decimal point. This can be done using the @ col specifier and breaking the number into the integral part in a right-justified column and the fractional part in a left-justified column:

  The following input:          will display as:

  \begin{tabular}{r@{.}l}
  3&14159\                         3.14159
  16&2\                           16.2
  123$456\ \end{tabular}         123.456  

Note that the decimal point is replaced by the column separator, & and that the @suppresses the intercolumn space

Advertisements
Tagged with: ,

4 Responses

Subscribe to comments with RSS.

  1. Stefan Kottwitz said, on October 7, 2009 at 9:26 pm

    There are useful packages regarding aligned decimal numbers in tables, dcolumn and rccol.

    Stefan

  2. Stefan Kottwitz said, on October 8, 2009 at 9:13 am

    Yes, here are links to those packages on CTAN:

    http://ctan.org/pkg/dcolumn
    http://ctan.org/pkg/rccol

  3. […] 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 […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: