Set title in two lines with different font sizes with interpreter latex
35 views (last 30 days)
Show older comments
It is possible to set title in two lines with different font sizes with interpreter latex?
i found an answer how to do that BUT with interpreter tex. for example:
title(['\fontsize{20} Thermometer output signal' char(10) ...
'\fontsize{10} Look small' char(10) ...
'\fontsize{20} Mixed_{\fontsize{8} underscore}'],'interpreter','tex');
this is mine without different font sizes:
TT=title({'$Thermometer\quad output\quad signal$','$EXP02$'},'FontWeight','bold',...
'Interpreter','latex');
thanks
0 Comments
Accepted Answer
Jan
on 30 Jan 2019
Edited: Jan
on 30 Jan 2019
title(['\fontsize{12}{0}\selectfont$Large$', char(10), ...
'\fontsize{8}{0}\selectfont$small$'], ...
'interpreter','latex');
5 Comments
jose herrero
on 9 May 2022
very useful Jan, thanks! For me (2019b) it works better using num2str.
Using 'sprintf', it adds some extra characters (e.g, 'Font').
Quick questions: is it also possible to have all in 1 single line (instead of 2) but with different fonts? where do you select the font type in your function?
Str=10;Vtr=20;Btr=30;
charnow = ['Trials (aS=' num2str(Str) ',aV=' num2str(Vtr) ',aB=' num2str(Btr) ')'];
title(['\fontsize{12}{0}\selectfont$ITPC @ Visfreq$', char(10), ...
'\fontsize{8}{0}\selectfont$', charnow, '$'], ...
'interpreter','latex');
Jan
on 10 May 2022
@jose herrero: Simply try it. Omit the char(10) and all appears in 1 line. Omit other parts as "\selectfont$small$" and see, what happens. You cannot damage anything so feel free to experiment.
More Answers (0)
See Also
Categories
Find more on Characters and Strings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!