How to generate plot titles with the latex interpreter and larger font sizes?
283 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to generate plot titles that include mathematical terms (generated with LaTeX) but also larger font sizes (so that they don't become impossibly tiny when shrunk by the publisher). I seem to be able to get one or the other, but not both. With the following code
plot(x, y, 'k', 'LineWidth', 2)
title('\fontsize{10} *{\cal{R}}(t)* Model 2', 'interpreter', 'latex')
(note, please mentally replace the * symbols with $ symbols - I had to make the change to shut off the text interpreter in this question window!) I obtain plots with the correct fontsize, but uninterpreted text (i.e. {\cal{R}}(t) - and the \fontsize command! - appear typed-out in the title). If, instead, I use the code
plot(x, y, 'k', 'LineWidth', 2)
title('*{\cal{R}}(t)* Model 2', 'interpreter', 'latex')
the LaTeX interpreter works fine, but of course the font is too small. I also tried a fix that I found among Matlab answers:
plot(x, y, 'k', 'LineWidth', 2)
hT = title('*{\cal{R}}(t)* Model 2', 'interpreter', 'latex')
set(hT, 'FontSize', 10)
but that produced the same result as the previous text (properly interpreted title, but with the smaller font size). I tried resetting the figure settings to default values using reset(figname), but that didn't help either. I would be grateful for any help on this question!
0 commentaires
Réponses (2)
madhan ravi
le 12 Déc 2018
Modifié(e) : madhan ravi
le 12 Déc 2018
Use handles and assign the size directly:
plot(x,y, 'k', 'LineWidth', 2)
h=title('*{\cal{R}}(t)* Model 2', 'interpreter', 'latex');
h.FontSize=20;
4 commentaires
madhan ravi
le 12 Déc 2018
Modifié(e) : madhan ravi
le 12 Déc 2018
I just did the following and it works:
plot(1:10, 'k', 'LineWidth', 2)
h=title('${\cal{R}}(t)$ Model 2', 'interpreter', 'latex');
h.FontSize=50;
Rebecca Tyson
le 13 Déc 2018
2 commentaires
BNB
le 10 Sep 2019
I guess it will be too late now, but I wanted to add that I was thinking to have the same problem. Until I understood that the size of the text interpreted by the latex interpreter is a lot smaller than normal text size. Thus, you may think it is not working, but in fact, you only have to increase the font size value by a larger number. You can try some very different numbers like 1 and 100 to see if this is the case.
(I am using MATLAB R2018a)
Voir également
Catégories
En savoir plus sur Time Series Objects 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!