Pgfplotstable y multifila

Pgfplotstable y multifila

En el siguiente ejemplo, intento componer una tabla usando pgfplotstableuna every even rowregla. ¿Hay alguna forma de desactivarlo para algunas columnas determinadas? O, alternativamente, ¿hay alguna forma de anular el color de las filas de algunas columnas determinadas?

\documentclass{article}
\usepackage{colortbl}
\usepackage{listings}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}
\pgfplotstabletypeset[
columns/Z/.style={
    column name={},
    assign cell content/.code={
        \ifnum\pgfplotstablerow=0
            \pgfkeyssetvalue{/pgfplots/table/@cell content}{\multirow{4}{*}{##1}}%
        \else
            \pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
        \fi
    },
},
postproc cell content/.code={
    \ifodd\pgfplotstablerow\relax
    \else
        % ah - an even row number.
        \ifnum\pgfplotstablecol>0
            % ah - introduce a cell color:
            \pgfkeysalso{@cell content={\cellcolor[gray]{0.9}#1}}%
        \fi
    \fi
},
every head row/.style={before row=\toprule,after row=\midrule},
every last row/.style={after row=\bottomrule},
debug,
columns/a/.style={column name={A},
    column type={S[scientific-notation=engineering, round-precision=2, round-mode=places, table-format=2.2e1]}, string type,
},
row sep=\\, col sep=&]{% here: inline data in tabular format:
Z & a & b \\
data & 1.43 & 2 \\
     & 3.23 & 4 \\
     & 51231.2 & 6 \\
     & 0.007 & 8 \\
}
\end{document}

mwe

Lo que me gustaría es que los "datos" se muestren correctamente, sin grises en el archivo multicolumn.

EDITAR: Cambié mi MWE de acuerdo con la respuesta, como puede ver, siunitxahora hay algo mal con el paquete. Esto se debe al uso #1en postproc, pero no sé cómo solucionarlo.

W.WO

Respuesta1

Al parecer, \rowcolory \multirowno trabajan juntos en el buen sentido.

Experimenté con el debugcambio de pgfplotstablepara verificar que este es, efectivamente, el caso. Una solución parece útil \cellcolorparacadacelda con color de fondo.

Solía postproc cell content​​insertar las instrucciones apropiadas (y también \cellcolorlas incorporé a ese estilo; aparentemente, no se pueden combinar).every even rowevery even rowpostproc cell contents

Aquí está la solución:

\documentclass{article}
\usepackage{colortbl}
\usepackage{listings}
\usepackage{pgfplotstable}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}
\thispagestyle{empty}

\pgfplotstabletypeset[
    columns/Z/.style={
        column name={},
        assign cell content/.code={
            \ifnum\pgfplotstablerow=0
                \pgfkeyssetvalue{/pgfplots/table/@cell content}{\multirow{4}{*}{##1}}%
            \else
                \pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
            \fi
        },
    },
    postproc cell content/.code={
        \ifodd\pgfplotstablerow\relax
        \else
            % ah - an even row number.
            \ifnum\pgfplotstablecol>0
                % ah - introduce a cell color:
                \pgfkeysalso{@cell content={\cellcolor[gray]{0.9}#1}}%
            \fi
        \fi
    },
    every head row/.style={before row=\toprule,after row=\midrule},
    every last row/.style={after row=\bottomrule},
    debug,
    row sep=\\, col sep=&]{% here: inline data in tabular format:
    Z & a & b \\
    data & 1 & 2 \\
         & 3 & 4 \\
         & 5 & 6 \\
         & 7 & 8 \\
}


\begin {tabular}{ccc}%
\toprule &a&b\\\midrule %
\rowcolor [gray]{0.9}\multirow {4}{*}{data}&\pgfutilensuremath {1}&\pgfutilensuremath {2}\\%
&\pgfutilensuremath {3}&\pgfutilensuremath {4}\\%
&\cellcolor [gray]{0.9}\pgfutilensuremath {5}&\cellcolor [gray]{0.9}\pgfutilensuremath {6}\\%
&\pgfutilensuremath {7}&\pgfutilensuremath {8}\\\bottomrule %
\end {tabular}%

\end{document}

ingrese la descripción de la imagen aquí

información relacionada