mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] Folder preparation


Chronological Thread 
  • From: bytecolor <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] Folder preparation
  • Date: Fri, 14 Aug 2009 19:06:08 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=qYN0btNDskij3BcBwNDsAH4xb9a1Wj1LEnuGLpRg+BzojQQkwZXQzYfFcBjPMo8/h7Vkiv5Hl/X/K3X+Shw2ANlC/zbgvCm9SVelxrOSZwAl3rSFPGjTOmAwe6ruEggs2R5qSizwvoHjWU3p2h1n+a9mp2AgxHu+ib1K/I5q24g=;

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