Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
No formatting of figure title

Subject: No formatting of figure title

From: Philipp Steffen

Date: 4 Nov, 2010 10:32:04

Message: 1 of 6

Hi all,

i would like to set the title of a figure using a string that contains several "_" underscores. Unfortunately, Matlab interprets these underscores in the variable to format the title in such a way that the next character following the underscore is typesetted as subscript.
Is there a way to omit this formatting step?
I would be grateful for any hints.

Thanks a lot,

Philipp

Subject: No formatting of figure title

From: Wayne King

Date: 4 Nov, 2010 10:44:04

Message: 2 of 6

"Philipp Steffen" <philipp.steffen@imba.oeaw.ac.at> wrote in message <iau234$2sg$1@fred.mathworks.com>...
> Hi all,
>
> i would like to set the title of a figure using a string that contains several "_" underscores. Unfortunately, Matlab interprets these underscores in the variable to format the title in such a way that the next character following the underscore is typesetted as subscript.
> Is there a way to omit this formatting step?
> I would be grateful for any hints.
>
> Thanks a lot,
>
> Philipp

Hi Phillipp,
That is because the default behavior of the interpreter is TeX (which is very, very useful by the way for the scientific community). You can change this behavior by setting the interpreter to 'none':

plot(randn(100,1))
title('This is just a t_e_s_t','interpreter','none')

Hope that helps,
Wayne

 

Subject: No formatting of figure title

From: Grzegorz Knor

Date: 4 Nov, 2010 10:47:04

Message: 3 of 6

"Philipp Steffen" <philipp.steffen@imba.oeaw.ac.at> wrote in message <iau234$2sg$1@fred.mathworks.com>...
> Hi all,
>
> i would like to set the title of a figure using a string that contains several "_" underscores. Unfortunately, Matlab interprets these underscores in the variable to format the title in such a way that the next character following the underscore is typesetted as subscript.
> Is there a way to omit this formatting step?
> I would be grateful for any hints.
>
> Thanks a lot,
>
> Philipp

Solution:
title('A_A','Interpreter','none')

Grzegorz

Subject: No formatting of figure title

From: Philipp Steffen

Date: 4 Nov, 2010 13:50:04

Message: 4 of 6

Thanks a lot to both of you! Thats what I was looking for.

Best,

Philipp

"Philipp Steffen" <philipp.steffen@imba.oeaw.ac.at> wrote in message <iau234$2sg$1@fred.mathworks.com>...
> Hi all,
>
> i would like to set the title of a figure using a string that contains several "_" underscores. Unfortunately, Matlab interprets these underscores in the variable to format the title in such a way that the next character following the underscore is typesetted as subscript.
> Is there a way to omit this formatting step?
> I would be grateful for any hints.
>
> Thanks a lot,
>
> Philipp

Subject: No formatting of figure title

From: Prasun

Date: 9 Nov, 2011 11:26:14

Message: 5 of 6

Use ' \_ ' to get rid of the subscript

so 'a_bc\_d'

would appear with subscripted b and underscore between c and d


"Philipp Steffen" wrote in message <iau234$2sg$1@fred.mathworks.com>...
> Hi all,
>
> i would like to set the title of a figure using a string that contains several "_" underscores. Unfortunately, Matlab interprets these underscores in the variable to format the title in such a way that the next character following the underscore is typesetted as subscript.
> Is there a way to omit this formatting step?
> I would be grateful for any hints.
>
> Thanks a lot,
>
> Philipp

Subject: No formatting of figure title

From: dpb

Date: 9 Nov, 2011 20:21:23

Message: 6 of 6

On 11/9/2011 5:26 AM, Prasun wrote:
> Use ' \_ ' to get rid of the subscript
>
> so 'a_bc\_d'
>
> would appear with subscripted b and underscore between c and d

Don't know how old this thread is; only the response showed up here now...

That doesn't really address the question from OP -- he wanted to print
the underscore character w/o TeX interpretation.

The answer for that is to precede it with the '\' character; ie, to
print the special characters used to define the Tex strings when
Interpreter is Tex, prefix them with the backslash "\" character: \\,
\{, \} \_, \^.


If there is no need for TeX interpretation at all, one can save the
extra step by setting the 'interpreter' property to 'none'

>
>
> "Philipp Steffen" wrote in message <iau234$2sg$1@fred.mathworks.com>...
>> Hi all,
>>
>> i would like to set the title of a figure using a string that contains
>> several "_" underscores. Unfortunately, Matlab interprets these
>> underscores in the variable to format the title in such a way that the
>> next character following the underscore is typesetted as subscript.
>> Is there a way to omit this formatting step?
>> I would be grateful for any hints.
>>
>> Thanks a lot,
>>
>> Philipp

Tags for this Thread

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.

Contact us