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

Fractions in the title of a MATLAB figure

3,339 views
Skip to first unread message

Jesper

unread,
Sep 20, 2007, 6:13:47 AM9/20/07
to
I would like to write a fraction in the title of a MATLAB
figure, eg. “Public budget, A-A(-1)/Y”, where “A-A(-1)” is
the numerator and “Y” is the denominator.

I have tried exploiting the TeX code by stating “\frac{A-A(-
1)/Y}{Y}”, but this does not work. Any suggestions?

Thanks,
Jesper

Ben

unread,
Sep 20, 2007, 8:15:10 AM9/20/07
to

Hi Jasper,

It is my impression that \frac is not a TeX command, but a LaTeX one.

You can place a fraction in the title/xlabel/ylabel by

title('$\displaylstyle\frac{A-A(-1)}{Y}$','interpreter','latex')

... I've added displaystyle so that I could *read* the resulting
fraction.

I don't know what is intended by the &#8220 / &#8221 macro pairs, but
these produce an error when included. What is the intention of these
macros?

Jesper

unread,
Sep 20, 2007, 8:58:27 AM9/20/07
to
Dear Ben,

Thanks a lot - you quickly solved my problem. A minor
problem is that I receive the warning:

"Warning: Unable to interpret TeX string. Invalid LaTeX
string."

Nevertheless, the statement produces the title exactly as I
wanted it.

I'm not sure I understand your question regarding the " / "
macro pairs?

Best,
Jesper

Ben <abbo...@gmail.com> wrote in message
<1190290510.9...@w3g2000hsg.googlegroups.com>...

Walter Roberson

unread,
Sep 20, 2007, 12:32:27 PM9/20/07
to
In article <1190290510.9...@w3g2000hsg.googlegroups.com>,

Ben <abbo...@gmail.com> wrote:
>On Sep 20, 6:13 am, "Jesper " <j...@dors.dk> wrote:
>> I would like to write a fraction in the title of a MATLAB
>> figure, eg. &#8220;Public budget, A-A(-1)/Y&#8221;, where &#8220;A-A(-1)&#8221; is
>> the numerator and &#8220;Y&#8221; is the denominator.

>I don't know what is intended by the &#8220 / &#8221 macro pairs, but
>these produce an error when included. What is the intention of these
>macros?

I believe Jesper has Microsoft "Smart Quotes" turned on;
I have seen contextual evidence in other postings to suggest that
what shows up to us as
ampersand number-sign eight two two zero semi-colon
is the "opening smart quote", and that what shows up to us as
ampersand number-sign eight two two one semi-colon
is the "closing smart quote".

I haven't looked in detail at Jesper's headers, but in the cases
I have investigated before, there has always been a mismatch between
the character-set the poster was actually using, and the character
set claimed in the poster's MIME headers. Something along the
lines that the MIME headers claimed Windows 1292, but the 8220 and 8221
codes are UTF-8 that should have appeared as the single characters hex A1
and hex A3 (or thereabouts) if Windows 1292 were actually in effect.

So it has always been a compound problem: A) that the user had the
nuisance smart-quotes turned on; and B) that the user's actual character
set in use, UTF-8, is not what the user's posting software claims.
--
Is there any thing whereof it may be said, See, this is new? It hath
been already of old time, which was before us. -- Ecclesiastes

Craig

unread,
Dec 19, 2007, 4:15:04 PM12/19/07
to
When I use the code:

ylabel('$\displaystyle\frac{dW}{dN}*$','interpreter','latex')

I get the fraction bar, but it doesn't put "dW" or "dN" in
the numerator or denominator. Any ideas?

Maxx

unread,
Aug 8, 2012, 5:52:11 AM8/8/12
to
"Craig " <craig.bau...@gmail.com> wrote in message <fkc1ko$lu6$1...@fred.mathworks.com>...
> When I use the code:
>
> ylabel('$\displaystyle\frac{dW}{dN}*$','interpreter','latex')
>
> I get the fraction bar, but it doesn't put "dW" or "dN" in
> the numerator or denominator. Any ideas?

In R2012b it works on title, ylabel, but doesn't work on legend.

Any ideas how to use \frac in legend?

Maxx

unread,
Aug 8, 2012, 6:04:10 AM8/8/12
to
"Maxx" wrote in message <jvtcsb$rer$1...@newscl01ah.mathworks.com>...
> > When I use the code:
> >
> > ylabel('$\displaystyle\frac{dW}{dN}*$','interpreter','latex')
> >
> > I get the fraction bar, but it doesn't put "dW" or "dN" in
> > the numerator or denominator. Any ideas?
>
> In R2012b it works on title, ylabel, but doesn't work on legend.
>
> Any ideas how to use \frac in legend?

Sorry, R2012a.

But it works next way:

obj=legend('$\displaystyle f(\theta) = k\frac{\theta}{(1+\theta^2)}$');
set(obj,'Interpreter','Latex');
clear obj

Yes! :)

Ariel

unread,
Aug 8, 2013, 3:04:12 PM8/8/13
to
Thanks men.

You solved me a great problem.

can you please elaborate what is the $ function?

Thank you

Ariel

"Jesper " <j...@dors.dk> wrote in message <fctqpj$cko$1...@fred.mathworks.com>...
0 new messages