How to generate plot titles with the latex interpreter and larger font sizes?
293 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(2 个)
madhan ravi
2018-12-12
编辑:madhan ravi
2018-12-12
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 个评论
madhan ravi
2018-12-12
编辑:madhan ravi
2018-12-12
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
2018-12-13
2 个评论
BNB
2019-9-10
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!