4

I want to set a range of columns (1,2,3 in the MWE below) at once without overwriting the formatting of the first column. Therefore, I don't think an "all" columns solution is applicable.

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

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

\sisetup{
  round-mode          = places,
  round-precision     = 2,
}
\pgfplotstabletypeset[ 
      col sep=comma,
      display columns/0/.style={string type},
      display columns/1/.style={column type={S},string type},
      display columns/2/.style={column type={S},string type},
      display columns/3/.style={column type={S},string type}
    ]{data.csv}
\end{document}
6

You can construct your multi setter

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

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

\sisetup{
  round-mode          = places,
  round-precision     = 2,
}

\pgfplotstableset{
  my multistyler/.style 2 args={
    @my multistyler/.style={display columns/##1/.append style={#2}},
    @my multistyler/.list={#1}
  }
}
\pgfplotstabletypeset[ 
      col sep=comma,
      my multistyler={0,...,3}{string type},
      my multistyler={1,2,3}{column type={S}}
    ]{data.csv}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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