Annotation with fraction and upright Greek letters

4 views (last 30 days)
Good day folks,
I want to put upright SI units in a fraction using the annotation command. If I use the Latex interpreter, \mathrm works for Latin characters but doesn't for Greek. If I use Unicode charakters, the Greek characters are upright, but the fraction is lost.
Is there any way to get out of this predicament?
Thanks!

Answers (2)

dpb
dpb on 21 Jun 2017
Edited: dpb on 21 Jun 2017
Try
annotation('textbox',[0.2,0.6,0.1,0.1],'String','$$\frac{\Delta - \Gamma}{\delta}$$','interpreter','latex')
and mess around from there...
I find <<Intro:latex2e flavor of tex> invaluable; why TMW doesn't include some more easily accessible LaTeX documentation links is a mystery--I suppose they figure if you're going to use it you should probably already know it, but most users I expect haven't more than ever heard of either when first approach Matlab, if that.
PS: There does seem to be an issue of centering the text in the box; using 'verticalalignment','middle' didn't fix the issue of the nearly touching upper side but 'verticalalignment','bottom' did make noticeable change in putting it at the lower edge. Dunno wha's up w/ that, sorry...
  2 Comments
Shiro
Shiro on 23 Jun 2017
Thanks, I already came this far:
annotation('textbox',[0.2,.5,.4,.3],'LineStyle','None','String'...
,{'$$\frac{\mathrm{\mu Ns}}{\mathrm{\mu m}}$$'},'interpreter','latex','fontsize',11','Fontname','times')
resulting in:
I messed around a lot already, but I can't get the µ upright.
dpb
dpb on 23 Jun 2017
Well, sometimes we just can't have everything we want...I've no further klew about what to tell you that might work; the limitation is likely inherent in the fonts themselves that are available.
I tried \scriptu{} upright but it wasn't recognized at all by the install interpreter here (R2012b). I don't know enough to have a clue as to how one might load some other package in the context of trying to use text or annotation and the lack of any effective way to debug while using them makes it so painful that if I can come even close I'm satisfied. Of course, I'm not trying to satisfy the dissertation guidelines checker or the editorial board of a journal, either, ...

Sign in to comment.


Walter Roberson
Walter Roberson on 21 Jun 2017
There are hacks that can allow unicode to be used with LaTex, by bringing in additional packages. Some links at https://www.mathworks.com/matlabcentral/answers/283242-problem-with-latex-interpreter

Categories

Find more on Labels and Annotations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!