mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Folder preparation


Chronological Thread 
  • From: Joris van der Hoeven <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Folder preparation
  • Date: Sat, 29 Aug 2009 15:25:12 +0200

Hi,

Thanks for this code. Please check with Andrey Grozin about the most
appropriate way
to include this into the Maxima plug-in. Arguably, all plots should be
directly
embedded into the sessions. However, with older versions of Maxima, 3D plots
were
drawn in a separate window, in which it was possible to rotate the plot with
the mouse.
Does this interface still exist, or is everything done with GNUplot nowadays?
In the latter case, we should try to find a hack for embedding all plots into
sessions,
since separate windows then do not have any added value.

Andrey: do you think that the plotting command can easily be intercepted
on the Maxima side, so that plot2d is systematically replaced by our own plot
command?

Best wishes, --Joris


On Fri, Aug 14, 2009 at 07:06:08PM -0700, bytecolor wrote:
> Hello Paul and Khadga,
>
> Is this the correct thread for this? hrm...
>
> I'm the curious type, so I looked into this. Before you read any further,
> this will not work on Windows.
>
> Gnuplot works because the session is sending commands directly to Gnuplot,
> telling it to write to a .ps, as Paul mentioned. The Gnuplot session then
> sends that .ps back to TeXmacs.
>
> A Maxima session, on the other hand, is talking to Gnuplot `through'
> Maxima. You can tell Maxima to write to a .ps:
>
> plot2d(sin(x), [x, -5, 5], [gnuplot_term, ps]);
>
> This will write to ~/maxplot.ps by default on my Ubuntu box. But afaik, the
> Maxima session has nothing coded to recognize this and send the .ps back to
> TeXmacs.
>
> So, I wrote a Maxima .mac file that does this. It defines tmplot2d() that
> behaves just as Maxima plot2d(). The difference is, it automatically
> appends [gnuplot_term, ps] after you hit Return. It then sends the .ps back
> to TeXmacs.
>
> It's a quick hack no doubt, but here is the code for texmacs.mac if you are
> interested. Hope the leading whitespace is retained.
>
> /*
> * Return a string:
> * PREFIX -> list items separated by SEP -> POSTFIX
> */
> join_items(prefix, lst, postfix, sep) := (
> len : length(newargs),
> outstr : prefix,
> for i:1 thru len do
> if equal(i, 1) then
> outstr : sconcat(outstr, newargs[i])
> else
> outstr : sconcat(outstr, sep, newargs[i]),
> sconcat(outstr, postfix)
> )$
>
> /*
> * Append [gnuplot_term, ps] to a plot2d() command.
> * Output will be to maxplot.ps, by default.
> * This file is fed, along with control characters, back to TeXmacs,
> * ala tm_gnuplot.
> *
> * Can you say `kludge'? I knew that you could.
> */
> tmplot2d([args]) := (
> newargs : append(args, [[gnuplot_term, ps]]),
> apply(plot2d, newargs),
> ttyoff : true,
> system("echo -n ^B; \
> echo -n verbatim:; \
> echo -n ^B; \
> echo -n ps:; \
> cat maxplot.ps; \
> echo -n ^E; \
> echo; \
> rm -f maxplot.ps"),
> ttyoff : false,
> /*join_items("plot2d(", newargs, ")")*/
> join_items("plot2d(", newargs, ")", ", ")
> )$
>
> --
> bytecolor (S. Edward Dolan)
>
>
>
>



Archive powered by MHonArc 2.6.19.

Top of page