[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Texmacs-dev] inline plots
Re: [Texmacs-dev] inline plots
Mon, 20 May 2013 11:28:58 -0700
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
What I did: Create a file called ps_out.m which contains
disp( [char(2) 'ps:' fileread(fname)' char(5)] );
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:
print 'test.eps' '-S500,300'
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
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.
From: Bill Eaton [mailto:address@hidden
Sent: Monday, May 20, 2013 7:13 AM
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.
On 05/17/2013 07:04 PM, David E. Miller wrote:
> 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)] )
>> 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