Subject: mailing-list for TeXmacs Users
List archive
From : bytecolor <address@hidden>- To: address@hidden
- Subject: Re: [TeXmacs] imbedding plots generated by maxima
- Date: Sat, 15 Aug 2009 15:42:03 -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:MIME-Version:Content-Type; b=W0RPSRPBqNpO7nbS7ouaHdeGqAIJjwNCdLt2heWSLS4OfA++08n5oKpjX8hi7T6hzW2gBhebo6bKH98cMx4aVHnlST+aaDALgID6dEJDXOJjdCDQw8oPlXf4iJph0/K8HIeqHRsIdoqBo/rGR0V6/bpXRyl+ToGrhWpVSr59MMM=;
Hi Khadga,
I had no clue how to use the batch command. Thanks for the info ;)
I created ~/.maxima. I put maxima-init.mac and texmacs.mac there. Then in
maxima-init.mac I have the single statement (load "texmacs.mac"). This keeps
me from mucking around with files in /usr.
The problem is the ^B and ^E strings you see in the maxima code I posted.
Those are control characters. A single character each, not the two characters
^ and B. I should have mentioned that. I sometimes assume too much. I have
attached the file texmacs.mac, with the controls characters embedded. If that
doesn't work you can use emacs or some other editor that allows you to enter
control characters. In emacs you type C-q then C-b or C-e for the characters.
At least it's finding the .ps file. I did mention this is a quick hack, no? ;)
--
bytecolor (S. Edward Dolan)
--- On Sat, 8/15/09, Khadga Karki <address@hidden> wrote:
> From: Khadga Karki <address@hidden>
> Subject: [TeXmacs] imbedding plots generated by maxima
> To: address@hidden
> Date: Saturday, August 15, 2009, 4:35 PM
> Hi,
>
> I copied the code to a file name tmplot2d.mac and put in
> the folder
> /usr/share/maxima/.../draw/ and issued the command
> 'batch (tmplot2d)' from maxima to load the function.
> Then I used the function to make plots.
> The code works in producing the ps file. But the ps file
> gets printed in
> the document rather than being embedded as figure.
> Did I do it the right way?
>
> Khadga
>
>
> > 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)
> >
> >
> >
> >
> >
>
>
>
Attachment:
texmacs.mac
Description: Binary data
- Re: [TeXmacs] imbedding plots generated by maxima, bytecolor, 08/16/2009
- <Possible follow-up(s)>
- Re: [TeXmacs] imbedding plots generated by maxima, Khadga Karki, 08/16/2009
- Re: [TeXmacs] imbedding plots generated by maxima, bytecolor, 08/16/2009
Archive powered by MHonArc 2.6.19.