How can I make the labels of components in appdesigner use the latex interpreter?
Afficher commentaires plus anciens
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 commentaires
Christopher Braunholz
le 9 Août 2018
Déplacé(e) : Voss
le 4 Oct 2024
This is not satisfying, Matlab.
André Luis Gama Rodrigues
le 22 Août 2018
Déplacé(e) : Voss
le 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
le 3 Juil 2022
Déplacé(e) : Voss
le 4 Oct 2024
en 2022 sigue los mismos limitantes que terrible
Réponse acceptée
Plus de réponses (2)
Rick Butler
le 21 Juil 2019
Modifié(e) : Rick Butler
le 21 Juil 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 commentaires
Ron Fredericks
le 24 Mar 2020
Modifié(e) : Ron Fredericks
le 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
le 26 Juil 2021
Nice example, Ron. It covers almost all the cases that someone needs to put a formula into a GUI!
Thanks!
Gary Gorman
le 29 Déc 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
le 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.
Catégories
En savoir plus sur App Building dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!