Mojca Miklavec wrote:

On 1/3/06, Peter Münster wrote:
On Tue, 3 Jan 2006, Mojca Miklavec wrote:

Thanks a lot. I've learnt a lot from the example, it's only that in
the way it's written now it's not compatible with windows.
Hello Mojca,
if you are using Windows, you can install MinGW, it's free and bash is
included.

OK, that could be file for me and maybe for two others, but this can't
be a general solution. (Beginners wouldn't install it and the skilled
ones have linux anyway.)
that makes me a beginner

So my question for gurus remains: how to write a macro, so that

\startGnuplotinclusions
set title "trigonometry"
\stopGnuplotinclusions
\startGnuplot
plot sin(x)
\stopGnuplot
\startGnuplot
plot cos(x)
\stopGnuplot

would result in one file with

set terminal postscript
set output "filename1"
set title "trigonometry"
plot sin(x)

and the other one with

set terminal postscript
set output "filename2" # If too complicated, the filename may remain the same
why should it change

an option is to collect *all graphic data* and do it in one run, in which case we can gain some speed

set title "trigonometry"
plot cos(x)

% output=pdf

\def\startGNUPLOTinclusions
 {\bgroup
  \obeylines
  \dostartGNUPLOTinclusions}

\def\dostartGNUPLOTinclusions#1\stopGNUPLOTinclusions
 {\gdef\GNUPLOTinclusions{#1}%
  \egroup}

\def\startGNUPLOTgraphic
 {\bgroup
  \obeylines
  \dostartGNUPLOTgraphic}

\def\dostartGNUPLOTgraphic#1\stopGNUPLOTgraphic
 {\def\par{\rawcharacter{13}}%
  \immediate\openout\scratchwrite=\bufferprefix gnuplot.job
  \immediate\write\scratchwrite{\GNUPLOTinclusions}%
  \immediate\write\scratchwrite{set output "\bufferprefix gnuplot.ps"}%
  \immediate\write\scratchwrite{#1}%
  \immediate\closeout\scratchwrite
  \egroup
  \processGNUPLOTgraphic{\bufferprefix gnuplot}}

\def\processGNUPLOTgraphic#1%
 {\executesystemcommand{start d:/gnuplot/bin/pgnuplot #1.job}%
  \executesystemcommand{texmfstart newpstopdf #1.ps}%
  \externalfigure[#1.pdf]}

\starttext

\startGNUPLOTinclusions
set title "trigonometry"
set terminal postscript
\stopGNUPLOTinclusions

\startGNUPLOTgraphic
plot sin(x)
\stopGNUPLOTgraphic

\startGNUPLOTgraphic
plot cos(x)
\stopGNUPLOTgraphic

\stoptext

i leave it to you to figure out why i don't get output

Hans
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to