Error in the creation of a Greek letter in a GUI
2 ビュー (過去 30 日間)
古いコメントを表示
Hello. I expose my question. I have tried to insert Greek letters in a static text following the procedure at the link:
I put in the Property Inspector in the entry "Tag" latex_text5 and under "String" \ alpha. However, in the command window I get the following warning:
Warning: Unable to interpret LaTeX string "\ alpha" > In openfig at 135 In gui_mainfcn> local_openfig at 286 In gui_mainfcn at 234 In GUI_prova2 at 42
What should I do to see the Greek letter alpha in the static text?
6 件のコメント
採用された回答
dpb
2014 年 5 月 24 日
Warning: Unable to interpret LaTeX string "\ alpha"
> In openfig at 135
In gui_mainfcn> local_openfig at 286
In gui_mainfcn at 234
In GUI_prova2 at 42
...What should I do to see the Greek letter alpha in the static text?
Well, I built a new GUI w/ just a single uicontrol and voila! was able to reproduce your error.
The problem is that for LaTeX the string '\alpha' must be in the math environment it turns out (enclosed in '$' signs. Otherwise, it's attempted to be interpreted in text mode and that fails spectacularly. Set the text in the Property Inspector to
This is a Greek alpha: $\alpha$
and joy will ensue...
Whew....learned something about LaTeX...
3 件のコメント
dpb
2014 年 5 月 25 日
編集済み: dpb
2014 年 5 月 25 日
You're welcome...was an experience. I went back and cleaned up the sidebar conversation most of which was owing to my using a complicated sample GUI figure rather than building a single uicontrol. NB: that the script supplied by TMW only works for positioning on a UI that doesn't contain grouping boxes because it doesn't convert the positions for items within from those relative coordinates to absolute so the positioning of elements within them is incorrect. That was what I saw in first testing and presumed it was related to your problem which it wasn't.
Also, note that the problem you had really has no bearing on the GUI but was simply an issue w/ LaTeX syntax--I use LaTeX so infrequently over the default TeX it was new to me, too, so that took a while to discover, as well. The issue can (and actually, is how I finally did resolve it) be seen directly from text w/o the GUI around at all.
To work around any issues going forward, try
text(0.5,0.5,'\alpha','interpreter','latex')
text(0.5,0.5,'\alpha','interpreter','tex')
simply from the command line. Note also that the error from the failure in the 'LaTeX' interpreter doesn't necessarily show up on the command line until later--the actual failure may (and often is initially) just that nothing shows up in the figure.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Labels and Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!