How can I make the labels of components in appdesigner use the latex interpreter?
Mostra commenti meno recenti
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 Commenti
Christopher Braunholz
il 9 Ago 2018
Spostato: Voss
il 4 Ott 2024
This is not satisfying, Matlab.
André Luis Gama Rodrigues
il 22 Ago 2018
Spostato: Voss
il 4 Ott 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
il 3 Lug 2022
Spostato: Voss
il 4 Ott 2024
en 2022 sigue los mismos limitantes que terrible
Risposta accettata
Più risposte (2)
Rick Butler
il 21 Lug 2019
Modificato: Rick Butler
il 21 Lug 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 Commenti
Ron Fredericks
il 24 Mar 2020
Modificato: Ron Fredericks
il 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
il 26 Lug 2021
Nice example, Ron. It covers almost all the cases that someone needs to put a formula into a GUI!
Thanks!
Gary Gorman
il 29 Dic 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
il 4 Ott 2024
2 voti
Starting in R2021a, you can set the Interpreter property of a label to "latex" to display equations. For more info, see Label.
Categorie
Scopri di più su App Building in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!