[Tex/LaTex] pgfplotstable selecting numeric columns or multiple columns by index

formattingpgfplotstabletables

Hi two questions in one:

I haven't been able to figure out the answer from the manual: I have a table of data with strings in the first column:

I'd like to apply some key-values (e.g. fonts by sign) to the numeric columns only. Is there a quick way of doing so?

something like

every numeric column/.style={fonts by sign={}{\color{red}}

or

every columns nos {2,3,4}/.style={fonts by sign={}{\color{red}}

MWE to work on below

\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableread[row sep=\\,col sep=&,header=false]{
a & 1 & 2\\
b & 2 & -2\\
c & 3 & 0.5\\
}\atable

\pgfplotstabletypeset[fixed,
zerofill,
fonts by sign={}{\color{red}},
every first column/.style={string type}]\atable
\end{document}

Best Answer

You can use

columns/1/.style={{fonts by sign={}{\color{red}}},dec sep align},

for each column, Here, dec sep align is used to align the numbers at the decimal point.

Full code:

\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableread[row sep=\\,col sep=&,header=false]{
a & 1 & 2\\
b & 2 & -2\\
c & 3 & 0.5\\
}\atable

\pgfplotstabletypeset[fixed,
zerofill,
columns/1/.style={{fonts by sign={}{\color{red}}},dec sep align},
columns/2/.style={{fonts by sign={}{\color{red}}},dec sep align},
every first column/.style={string type}]\atable
\end{document}

enter image description here