help-octave
[Top][All Lists]
Advanced

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

Re: Plots in LaTeX


From: Ben Abbott
Subject: Re: Plots in LaTeX
Date: Sat, 27 Mar 2010 14:24:07 -0400

On Mar 27, 2010, at 10:32 AM, Jason Martin wrote:

> On 3/26/2010 10:19 PM, Ben Abbott wrote:
> 
>> On Mar 26, 2010, at 10:13 PM, Jason Martin wrote:
>> 
>>    On 3/26/2010 8:38 PM, Ben Abbott wrote:
>>>     
>>>> On Mar 26, 2010, at 8:10 PM, Jason Martin wrote:
>>>> 
>>>>> On 3/26/2010 7:05 PM, Ben Abbott wrote:
>>>>>         
>>>>>> On Mar 26, 2010, at 11:54 AM, Jason Martin wrote:
>>>>>>           
>>>>>>> Can anyone help me understand what file format I need to use with the 
>>>>>>> following print commands?  Are what I have listed correct?
>>>>>>> 
>>>>>>> On 3/23/2010 1:38 PM, Jason Martin wrote:
>>>>>>>             
>>>>>>>>     Also, is my understanding correct on the following print 
>>>>>>>> -d"device" commands?
>>>>>>>> 
>>>>>>>> -dtex filename.tex
>>>>>>>> 
>>>>>>>> -depslatex filename.eps
>>>>>>>> 
>>>>>>>> -depslatexstandalone I have no idea what extension to use here, and 
>>>>>>>> the manual doesn't explain either
>>>>>>>> 
>>>>>>>> -dpstex    filename.ps
>>>>>>>> 
>>>>>>>> -dpslatex    filename.ps
>>>>>>>> 
>>>>>>>>     Thanks in advance for any help.
>>>>>>>> 
>>>>>>>> Jason
>>>>>>>> 
>>>>>>>>               
>>>>>> Just let Octave pick the extension for you.
>>>>>> 
>>>>>>  print -depslatex test
>>>>>> 
>>>>>> The result will be a pair of files. One test.tex and one test.eps
>>>>>> 
>>>>>> In your latex document you just need to input the latex file ...
>>>>>> 
>>>>>>  \input{test.tex}
>>>>>> 
>>>>>> Ben
>>>>>> 
>>>>> Ben,
>>>>> 
>>>>>    Thanks first off!  I tried this, and it does not give me two files, or 
>>>>> even a single file with an extension.  when I do:
>>>>> 
>>>>>    figure(2);
>>>>>    plot(ff0/pi,abs(G));
>>>>>    line([pstart,pstart],[0,1],"color","magenta");
>>>>>    line([pstop,pstop],[0,1],"color","magenta");
>>>>>    line([0,2],[pmax,pmax],"color","magenta");
>>>>>    xlabel ('f/f_0');
>>>>>    ylabel('\Gamma');
>>>>>    text(0.566,0.5,'\leftarrow f_{start} = 8 GHz');
>>>>>    text(1.55,0.5,'\leftarrow f_{stop} = 22 GHz');
>>>>>    text(1,0.05,'\Gamma_m');
>>>>>    print -depslatex test2;
>>>>> 
>>>>>    I get a single file named test2 and that is it.  no extension, no 
>>>>> additional files.and every example I have found, including in the printed 
>>>>> manual, has the command as print -deps foo.eps.   So, I guess I am still 
>>>>> confused.  Is there something wrong with my setup that is keeping Octave 
>>>>> from producing the proper files?  I have tried it both in and out of 
>>>>> qtoctave.  I am running on Windows.
>>>>> 
>>>>> Jason
>>>>> 
>>>>>         
>>>> I thought the print() command was able to add the extension. I'll put that 
>>>> on my list of todos.
>>>> 
>>>> For now, try ...
>>>> 
>>>>    print -depslatex test.tex
>>>> 
>>>> Ben
>>>> 
>>>> p.s. please "reply-all" and respond on the bottom so that those arriveing 
>>>> late can follow along. TiA
>>>> 
>>>>       
>>> Sorry for that Ben.
>>> 
>>> Following the example above did produce the 2 files necessary.  I am now 
>>> having an issue in getting the resultant tex file to input into my report.  
>>> Seeing as it is a LaTeX issue, should I move it to a different group?
>>> 
>>> Just in case it can be resolved here, the following error is what I am 
>>> getting {and it might just be a matter of me not including the right 
>>> package}:
>>> 
>>> ~~LaTeX file
>>> 
>>> \documentclass{article}
>>> \usepackage{graphicx,psfrag,floatflt,hyperref}
>>> \begin{document}
>>> \input{test2.tex}
>>> \end{document}
>>> 
>>> ~~LaTeX error
>>> ~~ snippet before the end ~~
>>> Package hyperref Warning: Rerun to get /PageLabels entry.
>>> (C:\Octave\3.2.3_gcc-4.4.0\MATLAB\test2.tex
>>> ! Missing $ inserted.
>>> <inserted text>
>>>                           $
>>> 1.116          \gplbacktext
>>> 
>>> ?
>>> Jason
>>>     
>> I'd guess you have a character in one of you text objects that LaTeX is 
>> complaining about. Do you have any of the following? _,&, %, ^
>> 
>> Ben
>>   
> 
> Ben,
> 
>    Yes, I did have some of those in my labels.  I am trying to get LaTeX to 
> add "prettier" labels than what is possible with GNUPlot atm.  Ie: 
> $$\frac{f}{f_0}$$ instead of f/f0.  I guess this solution is not yet viable?  
> Thanks for helping me understand better how to get the plots into LaTeX.
> 
> Jason


I can't tell exactly what you're doing but the following produces the correct 
result for me.

        plot (0:10)
        text (5, 5, '$\frac{f}{f_0)$', 'interpreter', 'none')
        print -depslatex test.tex

Note, that the latex part will not be rendered correctly on the screen.

Ben




reply via email to

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