Hi,
I would like to align on different decimals. My table uses two different decimal markers in the same column: the top part uses a period and the bottom part a comma. (The top is fractions, the bottom sample size).
I would like to align on *both* the period and comma. Using -dcolumn- allows aligning on the period, but that means that values with the comma separator stick out on the left.
I paste a table example below. Any suggestions much appreciated!
Thanks Bert
\begin{tabular}{ l c }
coeff1 & 2.213 \\
coeff2 & 5.213 \\
N & 7,123 \\
\end{tabular}
Graphics, Figures & Tables ⇒ Changing decimal alignment within column
NEW: TikZ book now 40% off at Amazon.com for a short time.

Changing decimal alignment within column
Hi,
one possible solution would be to define a new column type that aligns the cell contents according to a variable character (declared in the argument of the new type). You declare a decimal point in the table format specification and, with the help of \multicolumn, you can switch to a decimal comma; take a look at the following simple example:
one possible solution would be to define a new column type that aligns the cell contents according to a variable character (declared in the argument of the new type). You declare a decimal point in the table format specification and, with the help of \multicolumn, you can switch to a decimal comma; take a look at the following simple example:
Code: Select all
\documentclass{article}
\usepackage{dcolumn}
\newcolumntype{L}[1]{D{.}{#1}{1,3}}
\newcommand\CommaCell[1]{%
\multicolumn{1}{L{,}}{#1}%
}
\begin{document}
\begin{tabular}{ l L{.} }
coeff1 & 2.213 \\
coeff2 & 5.213 \\
N & \CommaCell{7.123} \\
O & \CommaCell{9.123} \\
\end{tabular}
\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...