Setting default font size and style with the latex interpreter

15 ビュー (過去 30 日間)
Olivier Goux
Olivier Goux 2019 年 7 月 15 日
コメント済み: Walter Roberson 2023 年 2 月 23 日
Hello everybody,
I'm trying to write a simple set up script which should set the defaults parameters for my various plots. I nee to use the latex intepreter to add formulas in legend or labels but I can't see how to change the default font size at the same time. For example my set up script begin like this :
set(groot,'defaulttextinterpreter','latex');
set(groot, 'defaultAxesTickLabelInterpreter','latex');
set(groot, 'defaultLegendInterpreter','latex');
and I tried to add the commands like :
set(groot, 'defaultLegendFontSize',18);
set(groot, 'defaultLegendFontWeight','bold');
However after trying I realized these command are not active with the latex interpreter (it is actually also mentioned in the Matlab Doc). I can see how I could change the fontsize or font weight at each legend or label with latex markups but I'd like to set a default value once and for all, inside and outside the math mode. Is there an equivalent to these commands which would work with the latex interpreter ?
Thank you !

回答 (1 件)

Armen Hanissian
Armen Hanissian 2023 年 2 月 23 日
Hello, a bit late on this but I had success by adding the following line to my startup.m file:
set(groot,'defaultAxesfontsize',18)
which modifies the fontsize property which corresponds to the latex interpreter. In general the setting a default value can be done by setting the root property named
'defaultObjectTypePropertyName'
where ObjectType and PropertyName correspond to the object type and property of interest.
  1 件のコメント
Walter Roberson
Walter Roberson 2023 年 2 月 23 日
This does not affect the size of text within \textrm or similar. You also cannot control the font for the \text modes or for math mode.
set(groot,'defaultAxesfontsize',18)
xlabel('$\alpha \textrm{hello}$', 'interpreter', 'latex')
ylabel('$\alpha \textrm{hello}$', 'interpreter', 'none')

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by