axis label subscript in latex environment

Hi,
I have following code for the ylabel. However, it does not show a proper subscript 'E'. I use MATLAB 2025a. Any help will be highly appreciated.
ylabel('$\tilde{p}_E \ (-)$','FontSize',14','FontName','TimesNewRoman','Interpreter','latex');

6 个评论

I get the same result when using LaTeX here in the text editor. Since 'p' is lowercase, the uppercase subscript 'E' might look a bit out of place. You will observe the same with any other uppercase letter.
Here's the same with a lowercase 'e' -
Using $\tilde{p}^{}_{E}\ (-)$ results in a slightly lower 'E', but that's only marginal -
But anyways, seems like the issue (so to speak) is with LaTeX.
Thanks Dyuman, yes i tried with both 'e' and 'E'. With 'e', it works, however, if we look into the lower base for 'p' and 'E' are different; 'E' is placed sightly higher than 'p' on axis label. I do not know why.
This was working fine with older MATLAB version, probably 2018 or 2019. Here is the figure with Matlab 2018 and it produces subscript properly in latex environment and with same code.
I tried with (from left to right) R2024b, R2022b, R2019b and R2017b and can see no discernible difference.
@Chirag, The image you have attached doesn't look like a MATLAB figure.
Maybe it is being exported from MATLAB using some function/functionality?
Here is how ChatGPT renders it (in another words, a completey non-Matlab environment),
To me, it looks the same.
HERE IS THE MATLAB CODE. YOU TOOK ME TO OLD DAYS :) See ylable. I used '\mathrm'. Even using '\mathrm' now, it no longer works presently.
% Plot data
[f,FigLocation] = figHere;
set(f,'Position',[FigLocation,18,6]);
ax1 = axes('Parent',f,'Position',[0.07,0.2,0.43,0.74],'box','on'); hold(ax1,'all');
plot(ax1, x1, pE1, 'LineStyle','-','LineWidth',1,'Color',[0,0,0],'DisplayName','1% span');
% plot(ax1, x2, pE2, 'LineStyle','--','LineWidth',1,'Color',[0,0,0],'DisplayName','25% span');
plot(ax1, x3, pE3, 'LineStyle','--','LineWidth',1,'Color',[0,0,0],'DisplayName','50% span');
% plot(ax1, x4, pE4, 'LineStyle',':','LineWidth',1,'Color',[0,0,0],'DisplayName','75% span');
plot(ax1, x5, pE5, 'LineStyle',':','LineWidth',1,'Color',[0,0,0],'DisplayName','99% span');
axis([0,1,0.8,2.4]);
ax1.YTick = linspace(min(ylim),max(ylim),5);
xlabel(ax1,'{\it x}/{\itc}');
ylabel(ax1,'$\tilde{p}\mathrm{_{_E}}$','Interpreter','latex');
title(ax1,'Blade loading','FontSize',10,'Position',[0.5,2.25]);
legend(ax1, 'show'); legend('boxoff');

请先登录,再进行评论。

回答(1 个)

Upon reviewing the figure, the character E is indeed rendered as a subscript; however, because it is uppercase, it occupies more vertical space and visually appears closer to the baseline, giving the impression that it is not properly subscripted.

类别

帮助中心File Exchange 中查找有关 Annotations 的更多信息

标签

提问:

2025-12-19

评论:

2025-12-22

Community Treasure Hunt

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

Start Hunting!

Translated by