Effacer les filtres
Effacer les filtres

Plot title: set font size with LaTeX interpreter

62 vues (au cours des 30 derniers jours)
Andrey Kazak
Andrey Kazak le 28 Oct 2015
Commenté : Martin le 9 Sep 2019
Greetings, dear community!
I use LaTeX interpreter for generating a plot title:
title('Interesing Plot','Interpreter','latex')
Now I want is to be underlined:
title('\underline{Interesing Plot}','Interpreter','latex')
And finally I want to set font size either explicitly or using LaTeX syntax:
  • \Huge
  • \huge
  • \LARGE
  • \Large
  • \large

Réponses (1)

Martin
Martin le 13 Avr 2018
By default, text objects in MATLAB® support a subset of TeX markup. For a list of supported TeX markup, see the text Interpreter property description.
It sould be: (underling not possible)
title('\fontsize{19} Interesing Plot')
Or you can do:
hT = title('Interesing Plot')
set(hT, 'FontSize', 19)
I hope you did already find a solution :), but for others reading this question.... I post an answer.
Martin
  2 commentaires
Ondrej Zika
Ondrej Zika le 6 Sep 2019
Modifié(e) : Ondrej Zika le 6 Sep 2019
Hi,
I find that latex formatting in title simply doesn't work. While for axes or legend I can format the text as you indicated, for title nothing works.
i) When the content is simply text it works fine, selecting default font size
t=title('Interesing Plot')
ii) When I add fontsize
t=title(['\fontsize{19} Interesting Plot']
iii) Any subsequent manipulations have no effect, e.g.
set(t, 'FontSize', 16);
I am on Ubuntu 18.04, Matlab2019a.
Thanks for any tips.
Ondrej
Martin
Martin le 9 Sep 2019
Hello Ondrej,
Please try tex interpreter in stead of latex:
figure
plot(rand(10,10))
title('\fontsize{19} Interesing Plot', 'Interpreter','tex')
Martin

Connectez-vous pour commenter.

Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by