I have a table that has alternating rows of percentages and counts.
How can I conditionally apply SIunitx to every second row? I want the row of percentages to be left as it is (to one decimal place) and need the row of counts to be rounded to integers, italicised and surrounded by brackets.
\documentclass{article}
\usepackage{pgfplotstable}
\usepackage{siunitx}
\usepackage[english]{babel}
\usepackage{booktabs}
\usepackage{listings}
\usepackage{pgfplotstable}
\begin{filecontents*}{test.csv}
{} &22.3\\
15000.9999 & 23568.44485\\
45.1 &22.3\\
15000.9999 & 23568.44485\\
{} &22.3\\
15000.9999 & 23568.44485\\
45.1 &22.3\\
15000.9999 & 23568.44485\\
\end{filecontents*}
\begin{document}
\pgfplotstableread[col sep=&,header=false]{test.csv}{\mytable}
\begin{table}[!htb]
\begin{center}
\resizebox{1.0\textwidth}{!}{%
\pgfplotstabletypeset[
every first row/.style={before row=\toprule},
string type,
every head row/.style={output empty row},
every last row/.style={after row=\bottomrule},
postproc cell content/.code={
\ifnum\pgfplotstablecol=1
\ifodd\pgfplotstablerow\relax
\pgfkeysalso{@cell content={(\num[math-rm=\mathit,round-mode=places,round-precision=0]{#1}})}%
\fi
\else\fi
},
]{\mytable}
}
\end{center}
\end{table}
\end{document}
The following is not working as I can't specify the latex-type format to `\pgftabletypeset'. The end-of-line markings are stopping it from compiling.
I would also like to insert a space after every second row, which I was able to do with the following workaround (in pseudocode) when just using tabular.
\global\let\restorecr=\\
. . .
\global\let\oldcr=\\
\global\def\crsng{\global\let\\=\crdbl\oldcr}
\global\def\crdbl{\global\let\\=\crsng\oldcr[4pt]}
\global\let\\=\crdbl
. . .
\global\let\restorecr=\\
How can I achieve this with pgfplotstable?


\\. – user2146441 Nov 16 '15 at 20:57