From: ruud verschaeren on
hi all,

I want to put a latex table in the textbox of a figure. This all works fine but in the table I want to have a subscript where it says 'v_L' in the code below.

cs = '\begin{tabular}{lll} v_L&=&0.7 m/s\\ S&=&1.02 +- 0.01\\ t&=&16.67 sec \end{tabular}';
ha = annotation('textbox',[0.15 0.75 0.3 0.15], 'Interpreter', 'latex');
set(ha, 'String', cs);

the above code doesn't do a subscript but shows the underscore instead, similar I want the +- to change in the plus-minus sign. normal code for this would be /pm but inside the textbox this doesn't work.

Any help would be appreciated.
Ruud
From: ruud verschaeren on
any help? to summarize: I want to have a subscribt and the plus-minus sign in a textbox. What can I find the code for this?
From: Bogdan Cristea on
"ruud verschaeren" <r.l.p.verschaeren(a)student.tue.nl> wrote in message <hcnpof$1ks$1(a)fred.mathworks.com>...
> hi all,
>
> I want to put a latex table in the textbox of a figure. This all works fine but in the table I want to have a subscript where it says 'v_L' in the code below.
>
> cs = '\begin{tabular}{lll} v_L&=&0.7 m/s\\ S&=&1.02 +- 0.01\\ t&=&16.67 sec \end{tabular}';
> ha = annotation('textbox',[0.15 0.75 0.3 0.15], 'Interpreter', 'latex');
> set(ha, 'String', cs);
>
> the above code doesn't do a subscript but shows the underscore instead, similar I want the +- to change in the plus-minus sign. normal code for this would be /pm but inside the textbox this doesn't work.
>
> Any help would be appreciated.
> Ruud

I guess you should try to use the equation environment: $v_L$
I'm not sure, but you could try ...
From: Jane on
In latex all math notation must be within $ $. So you should use:

cs = '\begin{tabular}{lll} $v_L$&=&0.7 m/s\\ S&=&1.02 $\pm$ 0.01\\ t&=&16.67 sec \end{tabular}';
ha = annotation('textbox',[0.15 0.75 0.3 0.15], 'Interpreter', 'latex','string',cs);
From: ruud verschaeren on
thanx to the both of you! it worked!