5

I want to highlight cells in my pgfplotstable, but the bold font setting overwrites my number format. How to prevent this?

Here is a MWE:

\documentclass[12pt]{standalone}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}

\begin{filecontents}{data.csv}
0.563725,0.819520,0.713402
0.563725,0.819520,0.713402
\end{filecontents}

\pgfplotstabletypeset[ 
      col sep=comma,    
      every row 1 column 1/.style={
        postproc cell content/.style={
          @cell content=\textbf{##1}
        }
      },
      fixed,fixed zerofill,
      precision=1,
      multiply with=100,  
    ]{data.csv}
\end{document}

with the output:

enter image description here

fmetz
  • 555
  • this is a duplicate somewhere – percusse Oct 13 '15 at 08:50
  • @percusse I didn't find an exact duplicate. I tried to customize this approach but failed, as it is conditional to the whole table and inserted new cells when applied to a selected cell... – fmetz Oct 14 '15 at 13:31
  • it's formated why can't I edit my bounty description? ;) – fmetz Oct 15 '15 at 08:45
  • @fmetz - Have a look at sergej's answer to this question of mine: http://tex.stackexchange.com/questions/253897/pgfplotstable-postproc-cell-content-resets-style-of-cell – Wamseln Oct 18 '15 at 19:27

1 Answers1

6

You can just replace @cell content=\textbf{##1} with @cell content/.add={$\bf}{$}

Code

\documentclass[12pt]{standalone}
\usepackage{xcolor}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{document}

\begin{filecontents}{data.csv}
0.563725,0.819520,0.713402
0.563725,0.819520,0.713402
\end{filecontents}

\pgfplotstabletypeset[ 
      col sep=comma,    
      every row 1 column 1/.style={
        postproc cell content/.style={
          @cell content/.add={$\bf}{$}
        }
      },
      fixed,fixed zerofill,
      precision=1,
      multiply with=100,  
    ]{data.csv}
\end{document}

Result

enter image description here

Salim Bou
  • 17,021
  • 2
  • 31
  • 76