I'm using pgfplotstable to create tables from .csv-files. But when I use postproc cell content to change the appearence of a specific cell, all former formatting of this cell seems to be ignored. How can I make changes to the appearence of a specific cell and at the same time preserve a uniform styling of the table?

Here is the MWE:



%Make rows higher:

\pgfkeys{/pgf/number format/.cd,
                use comma,
                1000 sep={}}





\caption{Some text describing the table}

\pgfplotstabletypeset[col sep=comma,
    columns={Name, 1, 2},% <---these columns will appear in the table
%------------------TYPESETTING COLUMNS:-------------------------------
     columns/Name/.style={% <---style column "Name"
      string type,%
      column type/.add={}{|},%
    columns/1/.style={% <---style column "1"
      column name=I,
      precision=1,column type/.add={}{|},%
    columns/2/.style={% <---style column "2"
      column name=II,
      precision=1, column type/.add={}{},%
      postproc cell content/.code={% <--- style row 2 (=index 1) of column "2"
            \pgfkeysalso{@cell content=\textcolor{red!100}{##1}}% <---make it red
%------------------TYPESETTING ROWS-------------------------------
    every head row/.style={before row=\toprule, after row=\midrule},%
    every last row/.style={after row=\bottomrule}%



And this is, what it looks like:

Obviously the formatting of the red cell differs from the others.

I would like to have the cell containing 4.23 to contain 4,2, so that it is formatted as all the other cells.

Thank you very much in advance!

  • 1
    ##1 is a shortcut to the value @preprocessed cell content. In this context you need @cell content
    – percusse
    Commented Jul 6, 2015 at 10:42

1 Answer 1


Here is a possible (but I guess not the best) solution:

  postproc cell content/.append code={% <--- style row 2 (=index 1) of
              \noexpand\pgfkeyssetvalue{/pgfplots/table/@cell content}%
                  {\noexpand\color{red!100}\pgfkeysvalueof{/pgfplots/table/@cell content}}%

enter image description here


Using bold font instead of changing the text color (to highlight the cell) is easier:

      \pgfkeysalso{@cell content/.add={$\bf}{$}}
  • Looks pretty OK to me.
    – percusse
    Commented Jul 6, 2015 at 11:33
  • @percusse A lot of low level code just to change the text color?
    – sergej
    Commented Jul 6, 2015 at 11:35
  • Haha that's acceptable criticism I guess. But this is rather a lot of low level code for table automation. Imagine you have 50 rows and you look for the minimum etc. then it will pay off.
    – percusse
    Commented Jul 6, 2015 at 11:37
  • Thank you very much! It works as desired. Could I change the cell to bold text with this approach too? I'm sorry, but I really have no clue of how \edef,\expandafter and \noexpand work. And if I just replace \color{red!100} with something else, it only works for things like \tiny etc.
    – Wamseln
    Commented Jul 6, 2015 at 12:05
  • @Wamseln Add \noexpand\boldmath before \noexpand\color
    – sergej
    Commented Jul 6, 2015 at 12:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .