Is it possible to add the LaTeX representative of \varphi (small greek phi) into the title of a MATLAB plot?
Greetings Sebastian.
"Sebastian Gatzka" <sebastian.g...@stud.tu-darmstadt.de> wrote in message <gkposh$dj9$1...@fred.mathworks.com>...
you can change interpreter to latex:
hl=legend('\phi')
set(hl,'Interpreter','latex');
-----------------------------------------
Quaternions visualizations in Matlab:
http://quaternion.110mb.com/
Yes, for example,
title('The value is $$\varphi$$.','Interpreter','latex')
--
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
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
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')