The following table was created with the following LaTeX-code (mwe):

\documentclass{article} \usepackage{tabu} \usepackage{multirow} \begin{document} \newtabulinestyle{stip=on 1.5pt off 2pt} \begin{tabu} to \linewidth {X[0.8l]X[2.5l]X[c]X[c]X[c]X[c]X[c]} \hline \rowfont{\bfseries} \multicolumn{2}{c}{\multirow{2}{*} {NUMBERS}} & \multicolumn{2}{c}{Type} & \multicolumn{2}{c}{Size} & \multirow{2}{*}{All} \\ & & A & B & Big & Small & \\ \hline \multicolumn{2}{l}{Good} & 1 & 4 & 2 & 3 & 5\\ \tabucline[stip]{-} \multirow{3}{*}{Ugly} & Cow & 7 & 1 & 4 & 4 & 8 \\ \tabucline[stip]{2-} & Goat & 1 & 2 & 0 & 3 & 3 \\ \tabucline[stip]{2-} & Horse & 2& 1 & 3 & 0 & 3 \\ \tabucline[stip]{-} \multicolumn{2}{l}{Bad}& 12 & 1 & 6 & 7 & 13 \\ \hline \rowfont{\bfseries} \multicolumn{2}{l}{TOTAL} & 23 & 9 & 15 & 17 & 32 \\ \hline \end{tabu} \end{document} Is it possible to create a macro that makes such tables from the following input?
\begin{mytable}[NUMBERS] 1 & 4 & 2 & 3 & 5 \\ 7 & 1 & 4 & 4 & 8 \\ 1 & 2 & 0 & 3 & 3 \\ 2 & 1 & 3 & 0 & 3 \\ 12 & 1 & 6 & 7 & 13 \\ 23 & 9 & 15 & 17 & 32 \end{mytable} I have been playing around with pgfplotstable for a while, but especially the multirows are giving me a headache.
(Ideally, even the sums would be automatically calculated and an error would be returned if the numbers did not match. (A + B = Big + Small). But this is luxury rather than necessary.)

