[pstricks] Generate Table via \readdata

Buddy Ledger buddyledger at gmail.com
Wed Apr 22 03:22:28 CEST 2009


I've run into the mysterious extra column/row before.  For some reason 
when I write it like this (see below) it works fine.  It seems to me 
that \@ifnextchar D{do something}{do nothing} really doesn't do nothing 
if next char is not D.  Therfore if you write \@ifnextchar D{do 
something}{do something else} the problem is resolved.  I am just 
guessing however.

\usepackage{filecontents}% allows overwriting
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\checkEntries#1 #2#3\@nil{%
    \global\advance\pst at cnta\@ne%
  \read1 to \pst at tempa
  \global\pst at cnta=0
  \expandafter\checkEntries\pst at tempa\space\@nil
  \advance\pst at cnta\@ne
  \gdef#2{\the\pst at cnta}\ignorespaces}

\def\fillTab at i#1{\fillTab at ii#1}
\def\fillTab at ii D #1 {%
  \@ifnextchar D{%
  \global\advance\pst at cntm by \@ne
  \ifnum\pst at cntm>\dataNo
    \global\pst at cntm=\@ne
    \\\hline \else & \fi
  \fillTab at ii}{\\\hline}}
  \global\pst at cntm=\@ne
  \expandafter\fillTab at i#1}

the data:\\



More information about the PSTricks mailing list