Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs] inline plots

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs] inline plots


Chronological Thread 
  • From: Henri Girard <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] inline plots
  • Date: Tue, 21 May 2013 08:11:09 +0200

Le 20/05/2013 20:28, Bill Eaton a écrit :
Ok. I managed to get inline plotting working in Octave. It's kind of kludgy
at the moment, but it works. It should work with Matlab as well. Although,
if there are any differences it is possible to write one set of code that
autodetects if its running from Octave or Matlab and does the appropriate
thing.

What I did: Create a file called ps_out.m which contains

function ps_out(fname)
disp( [char(2) 'ps:' fileread(fname)' char(5)] );
endfunction
This is slightly different from my earlier post. I put this file in the same
folder as a file called "tmrepl.m". In Linux this is found in
/usr/share/texmacs/TeXmacs/plugins/octave/octave/tm. In Windows, it's buried
in a C:\Program Files\TexMacs directory.

Here is a minimal example of how you might use this in a session on Linux:
cd ~/
x=1:10
plot(x, x.^2)
print 'test.eps' '-S500,300'
ps_out('test.eps');
And voila! You should now have an inline plot. Ha! If you go back and tweak
things, you can quickly regenerate a 'test.eps' file and update the inline
plot. It seems to behave well for the 5 minutes of testing I did.

Going forward, if this were to be included in future releases, we could
leave it as is. Or we could also modify the "tmrepl.m" file to look for
ps_out. I think the latter would be better, because then the user wouldn't
have to worry about including or excluding the semicolon on the
ps_out('test.eps') line.

One minor complaint: the previewed eps image doesn't look all that great. If
I export the whole document as a PDF file, it looks great. But on screen
it's a little washed out. I'm not sure if there is any remedy for this.

Bill Eaton

-----Original Message-----
From: Bill Eaton [mailto:address@hidden]
Sent: Monday, May 20, 2013 7:13 AM
To: address@hidden
Subject: Re: [Texmacs-dev] inline plots


I gave my function a try, but what I get is the PostScript text (and not the
image) printed on the screen. And I think this is because you need to
intercept the ps_out command that gets sent to Octave/Texcmacs. You need to
make sure you can control what comes back from Octave to Texmacs.

--Bill


On 05/17/2013 07:04 PM, David E. Miller wrote:
Bill:

Try putting your code in an .m file and then start a TeXmacs Octave
session. Load the .m file using the Octave session command line. You
may have to change the active directory to where your .m file and EPS
file are located on you system.

Then try your code on some EPS file of interest.

If you can get this to work, then it may merely be a matter of finding
the best way to load this file automatically when the Octave plugin
code is executed when the session is started. This should be the
easier part. Getting the code right for the EPS file to insert inline
is the harder part.

David Miller

On 5/17/2013 5:40 PM, Bill Eaton wrote:
It should be easy to do the same thing in Octave. The ps_out function
in Octave could be:
function ps_out(fname)
disp( [char(2); 'ps:'; fileread(fname) ; char(5)] )
endfunction

I'm dying to test this out and add more sophisticated error checking,
but I don't know how to hack the appropriate file to look for the
ps_out function. I think it would be in tmrepl.m. If someone can
suggest the appropriate lines to modify, I would greatly appreciate
and be happy to report my findings.

_______________________________________________
Texmacs-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Hi,
Very nice !
Would it work with maxima or a kind of ?
regards,
Henri



Archive powered by MHonArc 2.6.19.

Top of Page