%--------------------------------------------
%
% Package numtable.
%
% This file provides support for column types in LaTeX tabular
% environments, i.e.
%
%\begin{tabular}{>{\pgfplotstablecoltype}c<{\endpgfplotstablecoltype}}
% 1 \\
% 2 \\
% 3 \\
%\end{tabular}
%
%
%
% Copyright 2007/2008 by Christian Feuersänger.
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see .
%
%--------------------------------------------
% If I did not get it wrong, the tabular package, initialised with a
% column type like
% >{\pgfplotstablecoltype}c<{\endpgfplotstablecoltype}
% yields
%
% \pgfplotstablecoltype \ignorespaces \unskip \endpgfplotstablecoltype
% OR
% \pgfplotstablecoltype \ignorespaces \\ \endpgfplotstablecoltype
%
% So, I define \pgfplotstablecoltype to skip \ignorespaces and \unskip and simply
% get .
\def\pgfplotstablecoltype{%
\begingroup
\let\pgfplotstablecoltype@content=\empty
\pgfutil@ifnextchar[{%
\pgfplotstablecoltype@
}{%
\pgfplotstablecoltype@until@end@start
}%
}%
\def\pgfplotstablecoltype@[#1]{%
\pgfqkeys{/pgf/number format}{#1}%
\pgfplotstablecoltype@until@end@start
}%
\def\pgfplotstablecoltype@until@end@start\ignorespaces{%
\pgfplotstablecoltype@until@end
}%
\def\pgfplotstablecoltype@until@end{%
\pgfutil@ifnextchar\\{%
\pgfplotstablecoltype@finish%
}{%
\pgfutil@ifnextchar{\unskip}{%
\pgfplotstablecoltype@finish%
}{%
\pgfplotstablecoltype@next
}%
}%
}
\def\pgfplotstablecoltype@next#1{%
\expandafter\def\expandafter\pgfplotstablecoltype@content\expandafter{\pgfplotstablecoltype@content#1}%
\pgfplotstablecoltype@until@end
}
\def\pgfplotstablecoltype@finish{%
%\message{COLLECTED \meaning\pgfplotstablecoltype@content}%
\edef\pgfplotstablecoltype@content{\pgfplotstablecoltype@content}%
%
% trim white space:
\expandafter\pgfkeys@spdef\expandafter\pgfplotstablecoltype@content\expandafter{\pgfplotstablecoltype@content}%
%
\ifx\pgfplotstablecoltype@content\pgfutil@empty
\else
\pgfmathprintnumber{\pgfplotstablecoltype@content}%
\fi
\endgroup
}%
%\def\pgfplotstablecoltype{\message{COLLECT}}%
\def\endpgfplotstablecoltype{}%