How can I make the labels of components in appdesigner use the latex interpreter?
Show older comments
Hi,
Is there a way to make the label of a numeric box in a GUI generated by appdesigner to use latex as an interpreter? Currently, if I want to say label the numeric text box it displays e.g. y_2(0). How can I make it display $y_2(0)$ i.e. in latex mode, please?
Thank you!
3 Comments
Christopher Braunholz
on 9 Aug 2018
Moved: Voss
on 4 Oct 2024
This is not satisfying, Matlab.
André Luis Gama Rodrigues
on 22 Aug 2018
Moved: Voss
on 4 Oct 2024
Yeah, App Designer still lacks a ton of features which we have to work around. I'm also quite disappointed with it.
Julio Perez
on 3 Jul 2022
Moved: Voss
on 4 Oct 2024
en 2022 sigue los mismos limitantes que terrible
Accepted Answer
More Answers (2)
Rick Butler
on 21 Jul 2019
Edited: Rick Butler
on 21 Jul 2019
As a workaround I sometimes use a figure instead with the following properties:
- No labels, title, ticks or ticklabels
- YLim = [0,1], XLim depends on the width of your 'label'
- XColor, YColor and the color of the box set to 'none'
- DataAspectRatio = [1,1,1]
Now you can use
text(figure_handle, 0.2, 0.5, '$L\alpha TeX t\epsilon xt$', 'Interpreter', 'latex', more options..)
Copy-pasting from another source is probably less tedious but this solution allows you to change your label text dynamically.
Fingers crossed for label interpreters in 2019b!
3 Comments
Ron Fredericks
on 24 Mar 2020
Edited: Ron Fredericks
on 24 Mar 2020
Rick's answer worked well for me using R2019b!
Code Snippet:
% Initialize LateX equation
csign = ['+' '-']; % manage sign of c value in LateX equation
csign_idx = 1;
if c>=0
csign_idx = 2;
end
title(app.UIAxes, ...
['$$ f_ (x) = \frac{\mathrm{' num2str(round(a,2)) ...
'} }{\mathrm{1} + e^{-' num2str(round(b,2)) ...
'(x' csign(csign_idx) num2str(round(abs(c),2)) ...
')} } $$'],"Interpreter","latex")
axis(app.UIAxes,'off')
Result shown in upper right hand of my GUI:

Saeid
on 26 Jul 2021
Nice example, Ron. It covers almost all the cases that someone needs to put a formula into a GUI!
Thanks!
Gary Gorman
on 29 Dec 2022
I am trying to get Rick's and ron's methods to work but no luck. As for Rick's method:
figure_handle = gcf; text(figure_handle, 0.2, 0.5, '$L\alpha TeX t\epsilon xt$', 'Interpreter', 'latex', more options..)
throws and error "Error using text Text cannot be a child of Figure."
Ron's answer throws a bunch of errors, probably because either 1) I do not understand how to fill in the missing but presumed user-understood syntax items, or 2) Ron's example code is not executable in a standard livescript; Ron's code only executes in AppDesigner.
Does there exist anywhere a code example for a .mlx file which contains all the necessary commands and sytax to run?
Jasmine Poppick
on 4 Oct 2024
2 votes
Starting in R2021a, you can set the Interpreter property of a label to "latex" to display equations. For more info, see Label.
Categories
Find more on Printing and Saving 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!