MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

Subject: \varphi

From: Sebastian Gatzka

### Sebastian Gatzka

Date: 16 Jan, 2009 10:52:01

Message: 1 of 6

Hello World.

Is it possible to add the LaTeX representative of \varphi (small greek phi) into the title of a MATLAB plot?

Greetings Sebastian.

Subject: \varphi

From: Fabian Roth

### Fabian Roth

Date: 16 Jan, 2009 11:26:01

Message: 2 of 6

Hello Sebastian,
Since you seem to be using LaTeX, there is a cool package for LaTeX called 'psfrag', that let's you substitute characters with arbitrary LaTeX symbols. It operates on the included eps files of a latex document.
if you google for MATLAB and psfrag you'll find plenty of hints.
Good luck, F

"Sebastian Gatzka" <sebastian.gatzka.NOSPAM@stud.tu-darmstadt.de> wrote in message <gkposh$dj9$1@fred.mathworks.com>...
> Hello World.
>
> Is it possible to add the LaTeX representative of \varphi (small greek phi) into the title of a MATLAB plot?
>
> Greetings Sebastian.

 Subject: \varphi From: vedenev Date: 16 Jan, 2009 11:55:56 Message: 3 of 6 Default interpreter is 'TeX', to make small phi use \phi: plot([1 2],[3 4]); legend('\phi') you can change interpreter to latex: hl=legend('\phi') set(hl,'Interpreter','latex'); ----------------------------------------- Quaternions visualizations in Matlab: http://quaternion.110mb.com/
 Subject: \varphi From: Doug Schwarz Date: 16 Jan, 2009 13:49:50 Message: 4 of 6 In article ,  "Sebastian Gatzka"  wrote: > Hello World. > > Is it possible to add the LaTeX representative of \varphi (small greek phi) > into the title of a MATLAB plot? > > Greetings Sebastian. Yes, for example,   title('The value is $$\varphi$$.','Interpreter','latex') -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address.

Subject: \varphi

From: Rivo

### Rivo

Date: 18 May, 2009 16:22:02

Message: 5 of 6

vedenev <vedenev.maxim@gmail.com> wrote in message <77c54503-14fe-49f0-83ce-786066009cdb@p23g2000prp.googlegroups.com>...
> Default interpreter is 'TeX', to make small phi use \phi:
> plot([1 2],[3 4]);
> legend('\phi')
>
> you can change interpreter to latex:
> hl=legend('\phi')
> set(hl,'Interpreter','latex');

Hi, all

But is there a complete support of latex interpreter in Matlab ? Because, if it works fine with the title command, the legend command is really painful to use as it doesn't undersatnd the Interpreter property.

What I want to do is to have a legend whose text is built on the fly :

plot([1 2],[3 4], [1 2], [2.5 4.5]);

a= 20.50;
leg1= sprintf('$$\varphi$$= %g %%', a); % I also tried strcat but same problem.
con=legend(leg1, '$\varphi$ ');
set(con,'Interpreter','latex');

Result : Matlab chokes on the leg1 string with the following warning:
Warning: Unable to interpret TeX string

 Subject: \varphi From: Doug Schwarz Date: 18 May, 2009 20:56:19 Message: 6 of 6 In article , "Rivo " wrote: > vedenev wrote in message > <77c54503-14fe-49f0-83ce-786066009cdb@p23g2000prp.googlegroups.com>... > > Default interpreter is 'TeX', to make small phi use \phi: > > plot([1 2],[3 4]); > > legend('\phi') > > > > you can change interpreter to latex: > > hl=legend('\phi') > > set(hl,'Interpreter','latex'); > > Hi, all > > But is there a complete support of latex interpreter in Matlab ? Because, if > it works fine with the title command, the legend command is really painful to > use as it doesn't undersatnd the Interpreter property. > > What I want to do is to have a legend whose text is built on the fly : > > plot([1 2],[3 4], [1 2], [2.5 4.5]); > > a= 20.50; > leg1= sprintf('$$\varphi$$= %g %%', a); % I also tried strcat but same > problem. > con=legend(leg1, '$\varphi$ '); > set(con,'Interpreter','latex'); > > Result : Matlab chokes on the leg1 string with the following warning: > Warning: Unable to interpret TeX string You have a couple of problems. I'm not sure what you want for the text of your legend, but in any case you didn't escape the \ in sprintf and you need to escape the % for latex. Assuming you want your legend to read     o = 20.5% (substitute \varphi for o) then here's how to do it:   a = 20.5;   str = sprintf('$$\\varphi = %g$$\\%%',20.5);   lh = legend(str);   set(lh,'Interpreter','latex') -- Doug Schwarz dmschwarz&ieee,org Make obvious changes to get real email address.