Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

\varphi

713 views
Skip to first unread message

Sebastian Gatzka

unread,
Jan 16, 2009, 5:52:01 AM1/16/09
to
Hello World.

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

Greetings Sebastian.

Fabian Roth

unread,
Jan 16, 2009, 6:26:01 AM1/16/09
to
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.g...@stud.tu-darmstadt.de> wrote in message <gkposh$dj9$1...@fred.mathworks.com>...

vedenev

unread,
Jan 16, 2009, 6:55:56 AM1/16/09
to
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/

Doug Schwarz

unread,
Jan 16, 2009, 8:49:50 AM1/16/09
to
In article <gkposh$dj9$1...@fred.mathworks.com>,
"Sebastian Gatzka" <sebastian.g...@stud.tu-darmstadt.de>
wrote:


Yes, for example,

title('The value is $$\varphi$$.','Interpreter','latex')

--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.

Rivo

unread,
May 18, 2009, 12:22:02 PM5/18/09
to
vedenev <vedene...@gmail.com> wrote in message <77c54503-14fe-49f0...@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$=20');
set(con,'Interpreter','latex');

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

Doug Schwarz

unread,
May 18, 2009, 4:56:19 PM5/18/09
to
In article <gus1va$88s$1...@fred.mathworks.com>, "Rivo " <su...@night.com>
wrote:

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')

0 new messages