The legend option called interpreter latex does not display the latex symbols correctly
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
If I use Interpreter latex in the legend, the latex text is not correctly displayed
plot(1:10,1:10,'DisplayName','\eta_i')
line(1:10,5./((1:10).^2),'color','red','DisplayName','A_{[1,2)}');
legend('Interpreter','latex')
Instead, if I do not call Interpreter latex in the legend, the latex symbols are correctly interpreted. Why? I would expect the opposite...
plot(1:10,1:10,'DisplayName','\eta_i')
line(1:10,5./((1:10).^2),'color','red','DisplayName','A_{[1,2)}');
legend
0 commentaires
Réponse acceptée
Star Strider
le 20 Fév 2024
You need to put dollar signs ($) around the string you send to the LaTeX interpreter —
plot(1:10,1:10,'DisplayName','$\eta_i$')
line(1:10,5./((1:10).^2),'color','red','DisplayName','$A_{[1,2)}$');
legend('Interpreter','latex')
That also explains the error that was thrown.
.
2 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Legend dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!