[pstricks] Generate Table via \readdata

Buddy Ledger buddyledger at gmail.com
Mon Apr 20 05:44:07 CEST 2009

I've been trying to develop a macro which will typeset a data file into 
a table.  The code below represents my most sucsessful atempt.  I want 
to be able to generate a table for any data file which could be used 
with listplot.  So far I am having trouble generating the column format 
string for the tabular environment and I cannot dynamically set the 
number of colums via an input argument.  I have no doubt these problems 
are due to my limited knowledge of advanced Tex/Latex macro 
programming.  Any help with this would be appreciated.  My objective is 
to typeset data tables which are in plot format rather than TeX 
format.   Possible advanced options would  be to only print selected 
columns and possibly provide the column labels in the data file and have 
them typeset in mathmode, or formatting of numerical data.   Any 
input/help or simplifications would be appreciated. 


1.00E+001 2.00E+001 3.00E+001 4.00E+001
2.00E+001 3.00E+001 4.00E+001 5.00E+001
3.00E+001 4.00E+001 5.00E+001 6.00E+001
4.00E+001 5.00E+001 6.00E+001 7.00E+001



\def\colform{|c|c|c|c|} %This should be constructed via a loop and 
\expandafter\PrintCoordinates at i#1

\def\PrintCoordinates at i#1{\PrintCoordinates at ii#1}
\def\PrintCoordinates at ii D #1 {%
%\ifthenelse{\value{rowcount}<1}{\xdef\colform{\ignorespaces\colform c|}}{}
\@ifnextchar D{%
\ifthenelse{\value{loopcount}=4}{% the value 4 should be \@datawidth
\\ \hline
\PrintCoordinates at ii}{%
\\ \hline


$X$ & $Y$ & $\Delta X$ & $\Delta Y$ \\

More information about the PSTricks mailing list