How to write Latex in GUI's label?
Show older comments
I want to write latex in Matlab's GUI labels. For example:

I have tried \theta, and with $ on both sides, but it does not work. Could someone please tell me how to solve this question? Thanks.
Answers (1)
From the startup function of your app, set the Edit Field Label's interpreter property to latex. You may need to reassign the string too.
function startupFcn(app)
app.thetaPoint1EditFieldLabel.Interpreter = 'latex';
app.thetaPoint1EditFieldLabel.Text = '$\theta$ of point';
end
Result:

4 Comments
Zihao Liu
on 25 Jan 2021
My advice suggested you add that code within the startup function, not the area that you pointed out.
If your app doesn't already have a startup function, you have to add one. I'll update my answer to include instructions how to add a startup function.
Zihao Liu
on 11 Feb 2021
App designer gets more support and features with every new release since it became available. I don't know when the interpreter property was first supported for this object but I do know it works in r2020b and the result is shown in my answer. You could update to r2020b. Otherwise, there is no solution I'm aware of.
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

