Hello
Acccording to internet the unicode for subscript e ( _{e} in Latex) is U2091 or 8337 in decimal.
char(8337)
ans = 'ₑ'
but on my machine it doesn't work.
Other unicode work but not this one. Does anybody know what I should check ?
I'm on window 11 and my laptop is in french if that helps.

댓글 수: 7

Dyuman Joshi
Dyuman Joshi 2023년 1월 6일
I think that is how the symbol appears in the command window.
Though, if you see it in workspace, you will find that the symbol is correct. I've attached an image for reference.
Adam Danz
Adam Danz 2023년 1월 6일
@Matteo Bonhomme, how do you plan on using ths character? Is the purpose to only display in the command window or should it display elsewhere such as a graphics text object?
Matteo Bonhomme
Matteo Bonhomme 2023년 1월 9일
@Dyuman Joshi You're right even thought it doesn't work in the commmand window it works in the workspace
@Adam Danz I want to display it in a uifigure textbox
With what Adam said I managed to do this
hFig=uifigure;
txa = uitextarea(hFig);
antenna_underscript="T"+[char(8336) char(8345) char(8348) char(8337) char(8345) char(8345) char(8336)];
txa.Value=antenna_underscript;
txa.FontName= 'Arial';
txa.FontSize=40;
txa.FontWeight='normal'
Wich gives me this
It's almost what I want. The "a" and "e" just look a little weird
I'm looking for that :
figure; text(.5, 0.5,"T_{antenna}")
Dyuman Joshi
Dyuman Joshi 2023년 1월 9일
Maybe changing the font is causing the issue. Can you try again without the font changes?
I tried, it still doesn't work.
After doing some additionnal research, it looks like that's the best that unicode can do. The unicode character of the voyel are just not the same size. (found this cool website btw : https://www.unicodeit.net/ )
I read somewhere else on the forum that uitextarea does't accept interpreter so I don't think there's a way to fix that.
After doing some try I found a workaround where I put axes then put a textbox on the axes then hide the axes:
hFig=uifigure;
ax=uiaxes(hFig);
text(ax,0.5,0.5,"T_{antenna}",'FontSize', 40)
ax.Visible='off';
That's not answering my initial question but that's a satisfying work around
I was able to reproduce these difference between results shown here and on my local machine. Clearly the encoding is not consistent between the Run feature and my local installation and there are differences between recent releases. There were changes to system encoding in 22a (release notes) but that does not explain these differences and I haven't had time to look deeper.
Subscripts codes references on wiki.
unidec = hex2dec({'2090','2099','209c','2091','2099','2099','2090'})
unidec = 7×1
8336 8345 8348 8337 8345 8345 8336
str = ['T', char(unidec')]
str = 'Tₐₙₜₑₙₙₐ'
text(0.5,0.5,str,'FontSize',24)

댓글을 달려면 로그인하십시오.

 채택된 답변

VBBV
VBBV 2023년 1월 9일

0 개 추천

To display text on figure window, you should rather use uilabel function in place of uitextarea which produces same output as desired, This function also supports both latex and tex interpreters in contrast to former uitextarea function.
hFig=uifigure;
txa = uilabel(hFig);
txa.Text ='T_{antenna}'
txa.Interpreter = 'tex'
txa.FontName= 'Arial';
txa.FontSize=40;
txa.FontWeight='normal'
txa.Position = [100 274 170 45]

추가 답변 (1개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 1월 6일

0 개 추천

To display in a figure is straightforward, e.g.:
figure; title(char(8337))
text(0.5, 0.5, ['This is the character: ' char(8337)])

댓글 수: 3

Matteo Bonhomme
Matteo Bonhomme 2023년 1월 9일
This is how it comes out on my machine
It's like I have a different Unicode version locally
Rik
Rik 2023년 1월 9일
The whole point of Unicode is not to have these things happen, so this behavior should be considered a bug. Please report it.
Matteo Bonhomme
Matteo Bonhomme 2023년 1월 9일
I just did it
I found a workaround so I'll stop looking into this issue but if someone understand what's happening I'm interested

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2023년 1월 6일

답변:

2023년 1월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by