Thread Subject: latex in legend

Subject: latex in legend

From: Juliette Salexa

Date: 19 Jun, 2009 01:52:01

Message: 1 of 3

Hi,

I have absolutely no trouble labeling my x and y axes with equations:
xlabel('$\frac{1}{r^3}$','Interpreter','latex')

But this doesn't work if I want to have equations for my LEGEND entries. Does anyone know how to put an equation in the legend entries with latex ??

Subject: latex in legend

From: Doug Schwarz

Date: 19 Jun, 2009 02:09:05

Message: 2 of 3

In article <h1er01$2bf$1@fred.mathworks.com>,
 "Juliette Salexa" <juliette.physicist@gmail.com> wrote:

> Hi,
>
> I have absolutely no trouble labeling my x and y axes with equations:
> xlabel('$\frac{1}{r^3}$','Interpreter','latex')
>
> But this doesn't work if I want to have equations for my LEGEND entries. Does
> anyone know how to put an equation in the legend entries with latex ??


Yes, for some reason you have to set the interpreter after the legend is
created. For example,

  h = legend('$\frac{1}{r^3}$');
  set(h,'Interpreter','latex')

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

Subject: latex in legend

From: Waseem Tahir

Date: 11 Feb, 2011 18:45:07

Message: 3 of 3

Doug Schwarz <see@sig.for.address.edu> wrote in message <see-FF7C81.22090518062009@news.frontiernet.net>...
> In article <h1er01$2bf$1@fred.mathworks.com>,
> "Juliette Salexa" <juliette.physicist@gmail.com> wrote:
>
> > Hi,
> >
> > I have absolutely no trouble labeling my x and y axes with equations:
> > xlabel('$\frac{1}{r^3}$','Interpreter','latex')
> >
> > But this doesn't work if I want to have equations for my LEGEND entries. Does
> > anyone know how to put an equation in the legend entries with latex ??
>
>
> Yes, for some reason you have to set the interpreter after the legend is
> created. For example,
>
> h = legend('$\frac{1}{r^3}$');
> set(h,'Interpreter','latex')
>
> --
> Doug Schwarz
> dmschwarz&ieee,org
> Make obvious changes to get real email address.
Thank you very much Schwarz, your answer also help me, and it solve my problem i was struggling for last few hours. thanks again

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
legend Sprinceana 22 Jun, 2009 04:37:58
rssFeed for this Thread

Contact us at files@mathworks.com