[pstricks] using values read from an external file

Leon Free leon.free at free.fr
Mon Apr 16 13:50:13 CEST 2012


Thank you so much!

I tried reading the value in test.data with
\def\myvalue{\input{test.data}}

Issuing \myvalue somewhere in the latex file actually prints the value
contained in test.data. But things like \rput(0,\myvalue){something}
fail. latex does not interpret \myvalue as a number (coordinate).

As far as I understand, your macro works in a similar way. After
\readdata\data{test.data}, the object \data is D 0.123456789
and the macro \getValue extracts the last element. But why is this
interpreted as a number in latex while it is not when the value comes
from \input{test.data}?

lf

Le 14/04/2012 18:50, Herbert Voss a écrit :
> 
> in this case read it this way:
> 
> \RequirePackage{filecontents}% allows overwriting
> \begin{filecontents*}{test.data}
> 0.123456789
> \end{filecontents*}
> 
> \documentclass{article}
> \usepackage{pst-plot}
> \makeatletter
> \def\getValue#1{\expandafter\get at Value\data\@nil}
> \def\get at Value#1 #2 #3\@nil{%
> \def\Value{#3}}
> 
> \begin{document}
> 
> \readdata\data{test.data}
> \getValue{\data}
> \Value
> 
> \end{document}
> 
> Herbert
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/



More information about the PSTricks mailing list