ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: gnuplot for Mojca
Date: Tue, 03 Jan 2006 23:07:45 +0100	[thread overview]
Message-ID: <43BAF5B1.1010703@wxs.nl> (raw)
In-Reply-To: <6faad9f00601031227k520f1c82k386b7c246e7031f1@mail.gmail.com>

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

  parent reply	other threads:[~2006-01-03 22:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-02 10:34 Peter Münster
2006-01-03  8:18 ` Mojca Miklavec
2006-01-03 17:49   ` Peter Münster
2006-01-03 20:27     ` Mojca Miklavec
2006-01-03 21:19       ` Hans Hagen
2006-01-03 21:22       ` Hans Hagen
2006-01-03 22:07       ` Hans Hagen [this message]
2006-01-03 22:41         ` Peter Münster
2006-01-04  8:55           ` Hans Hagen
2006-01-04 14:45           ` present for mojca Hans Hagen
2006-01-04 15:34             ` Tobias Burnus
2006-01-04 16:14               ` Hans Hagen
2006-01-05 15:57                 ` Mojca Miklavec
2006-01-05 18:43                   ` Hans Hagen
2006-01-06 12:35                     ` Mojca Miklavec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43BAF5B1.1010703@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).