# decimal point alignment and \pgfmathprintnumber

In the table below, column a is aligned by decimal point. Is it possible to align column b that way too?

\documentclass{standalone}
\usepackage{pgfplotstable}
\usepackage{siunitx}
\begin{document}
\begin{tabular}{S S}
a      & b                           \\
-0.135 & \pgfmathprintnumber{-0.135} \\
0.1    & \pgfmathprintnumber{0.1}    \\
-0.1   & \pgfmathprintnumber{-0.1}   \\
\end{tabular}
\end{document}


• \pgfmathprintnumber is not expandable, so I don't think you can make it work inside an S column. I assume that the reason why you want to do this is that there are some calculations in the real world code? In that case, xfp's \fpeval may be a better option. – schtandard Aug 12 '19 at 20:42

It is possible, but have to use dcolumn instead of siunitx, below are the modified tags:

\documentclass{standalone}
\usepackage{pgfplotstable}
\usepackage{dcolumn}%
\newcolumntype{d}[1]{D{.}{.}{#1}}%

\begin{document}
\begin{tabular}{d{2,3} d{2,3}}
a      & b                           \\
-0.135 & \pgfmathprintnumber{-0.135} \\
0.1    & \pgfmathprintnumber{0.1}    \\
-0.1   & \pgfmathprintnumber{-0.1}   \\
\end{tabular}
\end{document}


And the output is: