Adjust subscript style / height

조회 수: 67 (최근 30일)
Sebastian Sprunck
Sebastian Sprunck 2019년 10월 5일
답변: wang 2021년 4월 7일
Hi all,
I'm trying to get 'neat' subscripts in the axes labels of a plot. I'd like to use the standard tex interpreter, as most of my figures are already using it, but the subscript style doesn't look good IMO:
tex.png
I'd like the subscripted 'n' to not be completely below the 't' but rather have its upper end somewhere close to the t's middle.
Changing the interpreter to latex does exactly what I want, but it changes the font not only of the characters in question, but of the whole axis label as well as putting it in cursive:
latex.png
Is there any way to adjust the subscript's height with the tex interpreter?
Best regards
Sebastian
  댓글 수: 1
Sebastian Sprunck
Sebastian Sprunck 2019년 10월 9일
I'm still searching for a solution. Any ideas or suggestions would be appreciated.

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

답변 (3개)

wang
wang 2021년 4월 7일
You can get roman or italic using \mathrm{} or \mathit{} respectively. And you can use both \mathrm{} and \mathit{} to get the effect of both regular and italic
figure
text(0.1,0.5,'$\mathrm{A_n}$','FontSize',16,'Interpreter','latex')
text(0.2,0.5,'$\mathit{A_n}$','FontSize',16,'Interpreter','latex')
text(0.3,0.5,'$\mathrm{A} \mathit{_n}$','FontSize',16,'Interpreter','latex')

Muhammad Usman
Muhammad Usman 2019년 10월 6일
use the following after the plot command
xlabel("y_{" + n + "}", 'Interpreter', 'tex') %for alphabet
and
xlabel(" \Omega_{" + n + "}", 'Interpreter', 'tex') %for special charcters
more more details please have look to this link:
  댓글 수: 1
Sebastian Sprunck
Sebastian Sprunck 2019년 10월 6일
That does not seem to answer my question.
I already know how to put subscripts into a label and how to change the interpreter. My question was regarding the style of the subscript, especially its position relative to the rest of the string.

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


Manuela Cabrera
Manuela Cabrera 2020년 9월 26일
Hi sebastian
I hope this is still useful. I use diffenrent text heights in the same label sing this code:
ylabel(['\fontsize{12} Normalized strength (F\fontsize{10} R\fontsize{12} /F\fontsize{10} Rmax \fontsize{12})'],'fontweight','bold')

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by