I want to migrate my tables to pgfplotstables. I used to have a macro for the rows of my tables, partly, because Kile used to.
So currently, my tables more or less look like:
oldtable:
\begin{tabular}{ccc}
1&2&3\\
\myrow{}
\rowentry{1}{2}{3}{4}{5}{6}
\end{tabular}
And I want to migrate that to something like:
newtable:
\pgfplotstabletypeset[debug]{
one & two & three\\
\myrow{}
\rowentry{1}{2}{3}{4}{5}{6}
}
But that fails with the following error:
./main.tex:28: Package pgfplots Error: input table '<inline_table>' has an unba
lanced number of columns in row '1' (expected '3' cols; got '1'). Maybe the inp
ut table is corrupted? If you need unbalanced data, consider using 'nan' in emp
ty cells (perhaps combined with 'unbounded coords=jump').
------- PGFPLOTSTABLE DEBUG MODE: --------
./main.tex:28: Undefined control sequence.
\\ ->\let \reserved@e
\relax \let \reserved@f \relax \@ifstar {\let \reserv...
l.28 }
I suppose that is because the macros don't get expanded. I don't necessarily want to edit all the tables. So my question is: How to make pgfplotstables read my table definition?
Full example:
\documentclass{article}
\usepackage{booktabs}
\usepackage{pgfplotstable}
% global settings
\pgfplotstableset{
col sep = &,
row sep=\\,
%string type, %% The error changes when enabling this type
}
\newcommand{\myrow}{foo & bar & baz\\}
\newcommand*{\rowentry}[6]{#1 & #2 & #3\\} %& #4}\\}
\begin{document}
oldtable:
\begin{tabular}{ccc}
1&2&3\\
\myrow{}
\rowentry{1}{2}{3}{4}{5}{6}
\end{tabular}
newtable:
\pgfplotstabletypeset[debug]{
one & two & three\\
\myrow{}
\rowentry{1}{2}{3}{4}{5}{6}
}
\end{document}
