I am trying to specify a custom column command, taking a width parameter and aligning the column by the decimal point of the content.
I am using the tabularx package to use columns with a pre-defined width
p{<width>}
The width is corrected by table margins with my defined \COLW{<width>} command (see Table layout with tabularx (column widths: 50%|25%|25%) for reference)
What I am trying to achieve is a columend aligned along the decimal dot, which is provided by the 'S' column option of the siunitx. But this does not allow to specify the column width. I found the array package providing the \centerdots and \endcenterdots commands to define this behavior manually with a custom column type 'd' like
\newcolumntype{d}[1]{>{\centerdots\arraybackslash}p{#1}<{\endcenterdots}}
But somehow these commands are not properly recoginzed
undefined control sequence [...] \centerdots
Any ideas how to combine dot-aligned columns with explicit width specifications?
Minimal working example
\documentclass[a4paper,11pt]{report}
\usepackage{array} %should provide \centerdots command!?
\usepackage{tabularx} %tabularx environment with fixed size columns
\usepackage{ragged2e} %Provide \RaggedLeft and \RaggedRight commands
\usepackage{siunitx} %Add 'S' option in tables to align along decimal point
\newcommand{\COLW}[1]{\dimexpr#1\textwidth-2\tabcolsep-1.3333\arrayrulewidth} %defined column width with margin correction
\newcolumntype{R}[1]{>{\RaggedLeft\arraybackslash}p{#1}} %right-aligned column with given column width
\newcolumntype{L}[1]{>{\RaggedRight\arraybackslash}p{#1}} %left-aligned column with given column width
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}} %centered column with given column width
\newcolumntype{d}[1]{>{\centerdots\arraybackslash}p{#1}<{\endcenterdots}} %dot-aligned column with given column width
\begin{document}
\begin{table}[hbtp!]
\centering
%this setup uses the 'S' column from siunitx package which properly centeres the content along the dot, BUT does not allow for column width specification
\begin{tabularx}{1.0\textwidth}{|L{\COLW{0.25}}|C{\COLW{0.25}}|R{\COLW{0.25}}|d{\COLW{0.25}}|}
%this setup uses \centerdots command from array package and defined column width, but doesn't work
%\begin{tabularx}{1.0\textwidth}{|L{\COLW{0.25}}|C{\COLW{0.25}}|R{\COLW{0.25}}|S|}
\hline
left-aligned & centered & right-aligned & \multicolumn{1}{c|}{dot-aligned} \\ %multicolumn as workaround for non decimal number conflicting with 'S' option
\hline
1 & 1 & 1 & 100.0 \\
2 & 2 & 2 & 10.0 \\
3 & 3 & 3 & 1.0 \\
4 & 4 & 4 & 0.1 \\
5 & 5 & 5 & 0.01 \\
6 & 6 & 6 & 0.001 \\
\hline
\end{tabularx}
\end{table}
\end{document}

tabularenvironment does not allow to specify the overall tabular width, which I would like to stretch to full\textwidth, hence I switched totabularx. – HeXor Mar 10 '16 at 12:10tabularenvironment, not using the fulll (or 90%) textwidth. So I now confirmed for myself that I can just use the standardtabularenvironment without specifying the full tabular width, but just defining N columns withtextwidth/Ncolumnwidth to achieve my desired behavior, which brings me back to the problem of the 'S' option not providing a width parameter option. – HeXor Mar 10 '16 at 12:210.9\textwidthtables, so I would like to have the possibility to define the column width as fraction of textwidth adding up to 0.9. This should be possible by manually using the\centerdotscommand as shown in my MWE, but I am not able to make this work – HeXor Mar 10 '16 at 12:31\centerdotsoption as it is proposed in the array package manual ftp://ftp.tu-chemnitz.de/pub/tex/macros/latex/required/tools/array.pdf with\newcolumntype{d}{>{\centerdots}c<{\endcenterdots}}– HeXor Mar 10 '16 at 12:50\centerdotswouldn't work as>{\centering\centerdots}p{3cm}<\endcenterdotsif you copied the definitions from the array package documentation (they are only given as example definitions in the doc, not actually defined in the package), as it notes there similar but improved versions are in my dcolumn package (but there again I assumecrather tahnpcolumns. – David Carlisle Mar 10 '16 at 12:56arraypackage. Do you know where it is defined? – HeXor Mar 10 '16 at 14:40