Re: [NTG-context] present for mojca

2006-01-06 Thread Mojca Miklavec
Hans, great! I love the design (including the fact that one graphic
can be reused with multiple terminals).

Just a few comments:

replace
  \immediate\write\scratchwrite{set terminal \@@GNUPLOTmethod}%
with
  \immediate\write\scratchwrite{set terminal \@@GNUPLOToutput}%
(No quotes and ps should be postscript.)

{\executesystemcommand{start gnuplot #1.gpd}}

Here both guplot filename and start gnuplot filename work equally
well (but even if start is left there, I would rename pgnuplot
into gnuplot).
Something is terribly wrong with the windows machine I'm currently
working on, but on linux it worked OK (except for problems with text
in the metapost sample, but I have to figure out what went wrong
first).

When executing these lines on MikTeX:

 {\doifelse\operatingsystem{mswin}
 {\executesystemcommand{start gnuplot
\GNUPLOTfile.gpd}\message{[win]}} {\executesystemcommand{gnuplot
\GNUPLOTfile.gpd}\message{[lin]}}}

I got [lin] a couple of times and no traces of any gnuplot work
(though gnuplot compiled the two remaining files ok when called
separately). But this has nothing to do with the module itself. Most
probably problem with permissions. write18 was enabled.

On 1/5/06, Hans Hagen wrote:
 Mojca Miklavec wrote:

 did \def\par{;} work out ok?

No, it didn't. Neither under linux nor under windows. So this remains
the only serious thing to fix.

The example you sent worked (almost) OK, but since it had only one
line in the \startGNUPLOTinclusions. As soon as I add
set terminal mp color
(which only overrides the already defined set terminal mp on the
proper place, so it's OK)

I get:

set terminal mp
^M set title trigonometry^Mset terminal mp color^M
set output m-gnuplot-gnuplot-1-mp
^Mplot sin(x)^M
quit

gnuplot didn't complain about ^M, but it can't have more than one line
compressed in one.

 The problem is not in \def\par{} I guess. It doesn't have any
 influence on the way how input lines appear in the file. Even if I
 redefined the \par and put strange chars in there, it didn't have any
 influence.
 
 
 strange, maybe i have a better tex binary

;)

It's 1.30.0 on linux (from your distribution) and 1.21a under MikTeX.

 ok, quit then

 2. The default file extension is .plt (instead of gpd; the ending
 really doesn't matter, but this one is recognized by default when you
 open file from gnuplot)
 
 hm, we don't want to overwrite files, do we?

Does the ending matter in (not)overwriting files?

I would only change
\immediate\openout\scratchwrite=\GNUPLOTfile.gpd
into
\immediate\openout\scratchwrite=\GNUPLOTfile.plt
(or even \scratchwrite=\GNUPLOTfile-\@@GNUPLOTsuffix.plt, so that the
files don't overwrite each other)

and
gnuplot \GNUPLOTfile.gpd
into
gnuplot \GNUPLOTfile.plt

but that's only cosmetics, doesn't really change the functionality.

 that's a big list ... why isn't there a context mode?

Perhaps because nobody (including me) knew that there's a module to
support gnuplot inside ConTeXt source :).

Well ... after I spent approximately 2 or 3 hours to figure out how to
compile it I started writing the code. It's true that it's tempting to
do just anything else except learning during the period of exams, but
it will nevertheless take me some time to finish, so please don't
expect anything that soon.

Besides that: PDF support has been written 5 years ago and it is still
not present in standard binaries. I have no idea how much time is
needed once the support is written so that:
- a new version appears
- it's included in distributions
- people/admins upgrade the software

 PS: Does this module really mean that I have no more excuses for not
 finishing my report(s) for physics in time? ;)
 
 no, worse, you now can finish it faster

 see attached file (bottom of file); should be enough to get your reports
 done

So ... I have to get back to work then ;)

Thanks again,
Mojca
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] present for mojca

2006-01-05 Thread Mojca Miklavec
Wow! Thank you a lot for this one, Hans!
(And to Peter as well!)

Hans Hagen wrote:
 Tobias Burnus wrote:

  Hi,
 
  Hans Hagen wrote:
 
  see attached file for usage
  %D   [   file=m-gnuplot,
 
 
 
  This does not work here, the produced .gpd file looks like:
  ---
  ^Mset title trigonometry^Mset terminal postscript
  set output gpl-gnuplot-1.ps
  ^Mplot sin(x)
  end
  ---
  ^M stands for \r (Carridge, decimal 13, hex 0d, oct 015).
 
  I frankly don't understand why one does not get a \n (linefeed,
  decimal 10/0A/012) or a ;\n for that matter
  [\def\par{;\rawcharacter{10}}].

I experience exactly the same problem here both under Windows and
Linux. ^M should be replaced by some newline. If I do that manually,
the module works perfectly.

A bit weird request (and not urgent at all since there are other ways
to solve this): could rotate= be added to \externalfigure once in
the distant future? The resulting graphs in postscript are rotated 90
degrees counterclocwise.

 do you use the natural.ctx file when building the format?

I think so (but not sure).

 maybe \def\par{; } also works here, i dunny how long gnuplot lines may be

The problem is not in \def\par{} I guess. It doesn't have any
influence on the way how input lines appear in the file. Even if I
redefined the \par and put strange chars in there, it didn't have any
influence.

I tried to play with \obeylines a bit, but without success. I managed
to get ^E (0x05) instead of ^M in the gnuplot file if I redefined
\endchar to be ^^L (if I remember correctly), but just anything else
led to errors.

Two not-so-important remarks:
1. \immediate\write\scratchwrite{end}
end should be changed into quit or even better: left out
completely since gnuplot exits anyway after executing the script

2. The default file extension is .plt (instead of gpd; the ending
really doesn't matter, but this one is recognized by default when you
open file from gnuplot)



Some terminals are more ugly than the others. The best idea to specify
the terminal is really by placing it manually into
\startGNUPLOTinclusion, not by prepending it automatically (as I asked
first), since it can have some additional parameters (color,
landscape, ...).

There are also set terminal pdf (only in the latest versions,
perhaps not even included in the binaries), set terminal png, set
terminal mp, set terminal latex, ...

Another humble request from me would be to support more than a single terminal:

%
\setupGNUPLOT[terminal=postscript] % should result in
\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.ps}%
...
\convertGNUPLOTgraphic{\bufferprefix gnuplot-\GNUPLOTnumber}%
% perhaps a better name, suggesting ps2pdf conversion


%
\setupGNUPLOT[terminal=pdf] % only recent; should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.pdf}%
% no postprocessing/conversion needed.

%
\setupGNUPLOT[terminal=png] % should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.png}%
% no postprocessing/conversion needed.

%
\setupGNUPLOT[terminal=mp] % should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.mp}%
% plus mpost + mptopdf postprocessing

%
\setupGNUPLOT[terminal=latex] % somewhat more tricky; should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.tex}%
% another auxilary file has to be used in this case with \documentclass ...
% \begindocument ... \input \bufferprefix gnuplot-\GNUPLOTnumber.tex
% and then processed with pdflatex; that's what I currently use: most
beautiful results


Thanks a lot,
Mojca

PS: Does this module really mean that I have no more excuses for not
finishing my report(s) for physics in time? ;)
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] present for mojca

2006-01-05 Thread Hans Hagen

Mojca Miklavec wrote:


I experience exactly the same problem here both under Windows and
Linux. ^M should be replaced by some newline. If I do that manually,
the module works perfectly.
 


i hate locales


A bit weird request (and not urgent at all since there are other ways
to solve this): could rotate= be added to \externalfigure once in
the distant future? The resulting graphs in postscript are rotated 90
degrees counterclocwise.

 


hm, i have to think about it


maybe \def\par{; } also works here, i dunny how long gnuplot lines may be
   



 


did \def\par{;} work out ok?


The problem is not in \def\par{} I guess. It doesn't have any
influence on the way how input lines appear in the file. Even if I
redefined the \par and put strange chars in there, it didn't have any
influence.
 


strange, maybe i have a better tex binary


I tried to play with \obeylines a bit, but without success. I managed
to get ^E (0x05) instead of ^M in the gnuplot file if I redefined
\endchar to be ^^L (if I remember correctly), but just anything else
led to errors.

Two not-so-important remarks:
1. \immediate\write\scratchwrite{end}
end should be changed into quit or even better: left out
completely since gnuplot exits anyway after executing the script
 


ok, quit then


2. The default file extension is .plt (instead of gpd; the ending
really doesn't matter, but this one is recognized by default when you
open file from gnuplot)

 


hm, we don't want to overwrite files, do we?



Some terminals are more ugly than the others. The best idea to specify
the terminal is really by placing it manually into
\startGNUPLOTinclusion, not by prepending it automatically (as I asked
first), since it can have some additional parameters (color,
landscape, ...).
 

it's not prepended now; however, it makes sense to think about it 
because in the case of mp we need a different treatment



There are also set terminal pdf (only in the latest versions,
perhaps not even included in the binaries), set terminal png, set
terminal mp, set terminal latex, ...

Another humble request from me would be to support more than a single terminal:

%
\setupGNUPLOT[terminal=postscript] % should result in
\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.ps}%
...
\convertGNUPLOTgraphic{\bufferprefix gnuplot-\GNUPLOTnumber}%
% perhaps a better name, suggesting ps2pdf conversion


%
\setupGNUPLOT[terminal=pdf] % only recent; should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.pdf}%
% no postprocessing/conversion needed.

%
\setupGNUPLOT[terminal=png] % should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.png}%
% no postprocessing/conversion needed.

%
\setupGNUPLOT[terminal=mp] % should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.mp}%
% plus mpost + mptopdf postprocessing

%
\setupGNUPLOT[terminal=latex] % somewhat more tricky; should result in

\immediate\write\scratchwrite{set output \bufferprefix
gnuplot-\GNUPLOTnumber.tex}%
% another auxilary file has to be used in this case with \documentclass ...
% \begindocument ... \input \bufferprefix gnuplot-\GNUPLOTnumber.tex
% and then processed with pdflatex; that's what I currently use: most
beautiful results

 


that's a big list ... why isn't there a context mode?


Thanks a lot,
   Mojca

PS: Does this module really mean that I have no more excuses for not
finishing my report(s) for physics in time? ;)
 

 


no, worse, you now can finish it faster

see attached file (bottom of file); should be enough to get your reports 
done


Hans
%D \module
%D   [   file=m-gnuplot,
%Dversion=2006.01.04,
%D  title=\CONTEXT\ Extra Modules,
%D   subtitle=\GNUPLOT\ Inclusion,
%D author=Hans Hagen,
%D   date=\currentdate,
%D  copyright=\PRAGMA]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

% todo: reuse (only if really needed)

% \enablemode[demo]

%D example:
%D
%D \starttyping
%D texexec --pdf --mode=demo m-gnuplot
%D \stoptyping

\unprotect

\ifx\operatingsystem\undefined \def\operatingsystem{unix} \fi % texexec will set that

\newcounter\GNUPLOTnumber

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

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

\def\startGNUPLOTgraphic#1%
  {\bgroup
   \obeylines
   \dostartGNUPLOTgraphic{#1}}

\def\dostartGNUPLOTgraphic#1#2\stopGNUPLOTgraphic
  {\doglobal\increment\GNUPLOTnumber
   \letgvalue{gpg:n:#1}\GNUPLOTnumber
   \setgvalue{gpg:d:\GNUPLOTnumber}{#2}%
   \egroup}

\def\useGNUPLOTgraphic
  {\dodoubleempty\douseGNUPLOTgraphic}

\def\douseGNUPLOTgraphic[#1][#2]%
  {\iffirstargument
 [EMAIL PROTECTED] % like \externalfigure[name][optional args]
   \else
 [EMAIL PROTECTED] % like 

Re: [NTG-context] present for mojca

2006-01-04 Thread Tobias Burnus

Hi,

Hans Hagen wrote:

see attached file for usage
%D   [   file=m-gnuplot,
  


This does not work here, the produced .gpd file looks like:
---
^Mset title trigonometry^Mset terminal postscript
set output gpl-gnuplot-1.ps
^Mplot sin(x)
end
---
^M stands for \r (Carridge, decimal 13, hex 0d, oct 015).

I frankly don't understand why one does not get a \n (linefeed, decimal 
10/0A/012) or a ;\n for that matter [\def\par{;\rawcharacter{10}}].


Tobias
___
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


Re: [NTG-context] present for mojca

2006-01-04 Thread Hans Hagen

Tobias Burnus wrote:


Hi,

Hans Hagen wrote:


see attached file for usage
%D   [   file=m-gnuplot,
  



This does not work here, the produced .gpd file looks like:
---
^Mset title trigonometry^Mset terminal postscript
set output gpl-gnuplot-1.ps
^Mplot sin(x)
end
---
^M stands for \r (Carridge, decimal 13, hex 0d, oct 015).

I frankly don't understand why one does not get a \n (linefeed, 
decimal 10/0A/012) or a ;\n for that matter 
[\def\par{;\rawcharacter{10}}].



do you use the natural.ctx file when building the format?

don't ask me why, but for some obscure reasons tex distributions like to 
default to a not so 255  tcx setup (called 255 -)


you really need to make sure that locales are ignored

maybe \def\par{; } also works here, i dunny how long gnuplot lines may be

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