help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LaTeX in octave/automated plots


From: David Bateman
Subject: Re: LaTeX in octave/automated plots
Date: Mon, 26 Nov 2007 12:27:33 +0100
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On 25-Nov-2007, A. Scottedward Hodel wrote:
>
> |  From time to time I've seen discussion on how to integrate LaTeX  
> | code into Octave plots and, in turn, to integrate those plots into a  
> | LaTeX document.  I'm in the process of writing a textbook with more  
> | than 250 plots/m-files, entirely done in Octave, and so the ability  
> | to automate this process is an important feature.
> | 
> | I've tried several approaches which I summarize here.
>
> | (1) eps only  Print as an eps file directly:
> |     print -deps -mono myfile.eps
>
> | (2) epslatex/dvips Use epslatex, then use dvips -E* in a shell script  
> | to generate a cropped .eps file that can be resized.
>
> | (3) eps/psfrag Print as an eps file and use psfrag in LaTeX to  
> | process embedded LaTeX commands (requires an additional shell script)
>
> | (4) xfig/fig2ps Print as a fig file, then use fig2ps to generate an  
> | eps file
>
> For something like this, I recommend using Octave to generate the data
> and then using gnuplot (or your favorite graphics package) to generate
> the plots from the data.  A big advantage of separating the
> calculation and plot generation is that you don't need to run a long
> calculation again just to make a change in the appearance of a figure.
> If using gnuplot, I recommend using the epslatex terminal and epstopdf
> (or the equivalent ghostscript command) to generate pdf files from the
> eps files.
>   
My recent patches include the capability to use the TeX mode in the text
objects of Octave. What it does is just use a simple heuristic (well for
sub- and super-script it wasn't that simple) to convert to the gnuplot
extended mode. An example of what can then be done is

x = 0:0.01:3;
plot(x,erf(x));
hold on;
plot(x,x,"r");
axis([0, 3, 0, 1]);
text(0.65, 0.6175, strcat('\leftarrow x = {2/\surd\pi',
' {\fontsize{16}\int_{\fontsize{8}0}^{\fontsize{8}x}}',
' e^{-t^2} dt} = 0.6175'))

D.

-- 
David Bateman                                address@hidden
Motorola Labs - Paris                        +33 1 69 35 48 04 (Ph) 
Parc Les Algorithmes, Commune de St Aubin    +33 6 72 01 06 33 (Mob) 
91193 Gif-Sur-Yvette FRANCE                  +33 1 69 35 77 01 (Fax) 

The information contained in this communication has been classified as: 

[x] General Business Information 
[ ] Motorola Internal Use Only 
[ ] Motorola Confidential Proprietary



reply via email to

[Prev in Thread] Current Thread [Next in Thread]