Error in the creation of a Greek letter in a GUI
1 次查看(过去 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?
采纳的回答
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 中查找有关 Environment and Settings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!