MATLAB Answers

# How can I make the labels of components in appdesigner use the latex interpreter?

137 views (last 30 days)
Nathalie Cauchi on 3 Mar 2017
Edited: Ron Fredericks on 24 Mar 2020
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!

#### 0 Comments

Sign in to comment.

### Accepted Answer

Sam McDonald on 8 Mar 2017
This is a limitation of App Designer. There is currently no way of setting a latex interpreter for text boxes.
As somewhat of a workaround, you could simply generate the formatted text elsewhere and copy and paste it into the label field. Try it with this: y₂(0)
You can also use the "char" command to create special characters. This will create the same string:
['y' char(8322) '(0)']

#### 1 Comment

Nathalie Cauchi on 8 Mar 2017
Thanks :) it worked with this work around.

Sign in to comment.

### More Answers (2)

Christopher Braunholz on 9 Aug 2018
This is not satisfying, Matlab.

#### 1 Comment

Yeah, App Designer still lacks a ton of features which we have to work around. I'm also quite disappointed with it.

Sign in to comment.

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!

#### 1 Comment

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:

Sign in to comment.

### Community Treasure Hunt

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

Start Hunting!