[NTG-context] present for mojca

Mojca Miklavec mojca.miklavec.lists at gmail.com
Thu Jan 5 16:57:16 CET 2006


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? ;)


More information about the ntg-context mailing list