# Are there Any Restrictions on Latex Markup in Figure Titles?

2 views (last 30 days)

Show older comments

This works fine:

syms t

s1(t) = exp(-abs(t));

figure;

title("$"+latex(s1(t))+"$",'Interpreter','latex')

But this does not

s2(t) = piecewise(t<-1,0, t>2,0, exp(-abs(t)));

figure;

title("$"+latex(s2(t))+"$",'Interpreter','latex')

Is there any way to get s2(t) on the figure in any way at all (title, text, anything)?

##### 1 Comment

Star Strider
on 8 Dec 2021

The Symbolic Math Toolbox has its own way of depicting piecewise functions:

syms t

s2(t) = piecewise(t<-1,0, t>2,0, exp(-abs(t)))

I doubt that could be incorporated into a text object of any sort.

### Accepted Answer

Walter Roberson
on 8 Dec 2021

The \text is the immediate problem. If you use \textrm instead then you get something

##### 4 Comments

Walter Roberson
on 8 Dec 2021

### More Answers (0)

### See Also

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!