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

41 ビュー (過去 30 日間)
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!

採用された回答

Sam McDonald
Sam McDonald 2017 年 3 月 8 日
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)']
  2 件のコメント
Nathalie Cauchi
Nathalie Cauchi 2017 年 3 月 8 日
Thanks :) it worked with this work around.
Gary Gorman
Gary Gorman 2022 年 12 月 29 日
Sam, could I ask for a little more clarification on your answer to Natalie?
I don't understand "generate the formatted text elsewhere and copy and paste it into the label field."
I dont understand because Matlab uses several different rendering engines for character strings. One rendering engine is the LATEX interpreter. One rendering engine is used to display output in the console. One rendering engine is used to display output in the livescript command window. One rendering engine is used to display output in the livescript output window.
I also don't understand what "formatted text" means. Matlab has its own native and proprietary "text formatting" like x_0 for "x-subscript-0". Is already-rendered LATEX output also "formatted text"?
I guess I am tring to figure out exactly what my quesion is. Perhaps my question is: "Can already-rendered LATEX be output to any field in AppDesigner?"
Sorry I can't write a better question. I am totally confused between "formatting" and "rendering", I guess.

サインインしてコメントする。

その他の回答 (2 件)

Christopher Braunholz
Christopher Braunholz 2018 年 8 月 9 日
This is not satisfying, Matlab.
  2 件のコメント
André Luis Gama Rodrigues
André Luis Gama Rodrigues 2018 年 8 月 22 日
Yeah, App Designer still lacks a ton of features which we have to work around. I'm also quite disappointed with it.
Julio Perez
Julio Perez 2022 年 7 月 3 日
en 2022 sigue los mismos limitantes que terrible

サインインしてコメントする。


Rick Butler
Rick Butler 2019 年 7 月 21 日
編集済み: Rick Butler 2019 年 7 月 21 日
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 件のコメント
Saeid
Saeid 2021 年 7 月 26 日
Nice example, Ron. It covers almost all the cases that someone needs to put a formula into a GUI!
Thanks!
Gary Gorman
Gary Gorman 2022 年 12 月 29 日
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?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by