mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] texmacs and octave


Chronological Thread 
  • From: "chu-ching huang" <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] texmacs and octave
  • Date: Mon, 24 Jan 2011 10:11:21 +0800

On Sun, 23 Jan 2011 23:44:57 +0100, texmacs wrote
...

I just test texmacs-octave plugins with
TeXmacs-1.0.7.9 and octave octave-3.3.54 (dev version)

Although plot module has been rewritten in octave especially in dev version,
the following solution can be run on both stable and dev octave's:

1. modify tm/tmrepl.m
line 12: if dispans && isnewans(ans) % one amp -> double amp's
2. modify tm-octave.oct:
----
if (length(d) > 0)

d1="/usr/local/share/TeXmacs/plugins/octave/octave/tm";
d2="/usr/local/share/TeXmacs/plugins/octave/octave/plot";
d3="/usr/local/share/TeXmacs/plugins/octave/octave/polynomial";
d4="/usr/local/share/octave/3.3.54/m/plot";
addpath (d4, d3,d2,d1);

PS1("\\002channel:prompt\\005octave> \\005");
PS2("\\002channel:prompt\\005> \\005");
global TMSTRUCT=0;
global TMCOLORS=["black"; "red"; "magenta"; "orange"; "green"; "blue";];
global TMCOLIDX=rows(TMCOLORS);

tmrepl
endif
---------
value of d4 variable according to exact directory installed in your box. for
example, octave-3.3.54 was installed in /usr/local, it would install the
m-files in /usr/local/share/octave/3.3.54/m.

3. remove (or backup somewhere)all the files ""__plt*.m" in
TeXmacs/plugins/octave/octave/plot and copy all the m-files which do plotting
stuff in /usr/local/share/octave/3.3.54/m/plot (plot.m, plot3.m, surface.m for
instance) into the directory $TeXmacs/plugins/octave/octave/plot.
4. modify each m-file by adding the codes in the end as follows (plot.m as
example):

if (nargout > 0)
retval = tmp;
endif

%% print the generated eps into TeXmacs
if (length(getenv("TEXMACS_PATH"))>0)
%__gnuplot_set__ term postscript enhanced color
print("/tmp/tmplot.eps","-depsc2")

P=[2;112;115;58]; #P= "\002ps:"
g=fopen("/tmp/tmplot.eps");
while (g==-1)
sleep(1);
g=fopen("/tmp/tmplot.eps");
endwhile
while (!feof(g))
f=fread(g,2048);
if (length(f))
P=[P;f];
endif
endwhile
fclose(g);
P=[P;5];
disp(sprintf("%cverbatim:\n",2));
disp(char(P'));
system("rm /tmp/tmplot.eps");
endif
%% End of printing
endfunction

4. if you want to change the size of picture, add "-g" option as follows:

print("/tmp/tmplot.eps","-depsc2 -g600,480")

print in the format 600pixel x 480pixel

5. In octave dev version, epstool, transfig/fig2dev are also required. And
additional addpath in tm-octave.oct:

d5="/usr/local/share/octave/3.3.54/m/plot/private";


This is not "official" solution and does not solve all the octave's print
stuff. If you want the modified code I use, I can upload all the codes. Hope
this can solve your problem.


Best regards,

cch





Archive powered by MHonArc 2.6.19.

Top of page