Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Thanks @HarishKumar, I'm looking for something that deals with multiple columns collectively. I have a large number of columns and doing this individually would make the tex file very unwieldy. –  Tahnoon Pasha Oct 15 '12 at 4:16
    
@TahnoonPasha I don't think that feature is available! :(. There are every even column/.style and every odd column/.style though, but they will conflict with your first column. –  Harish Kumar Oct 16 '12 at 0:17
    
I think you may be right, but felt I'd try asking anyway. This may be another feature request for @ChristianFeuersanger. I might try and write a macro for it if I ever figure out how they work. If I do I'll post it here. –  Tahnoon Pasha Oct 16 '12 at 10:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.