TEXT or ANNOTATION multiple Colors, Multiple Lines

23 次查看(过去 30 天)
I want to input text in one box with multiple colors and multiple lines using Latex commands.
Ive tried everythig, nothing seems to work.
Looping through text...
color = {'b','y','g',};
words={' {$\rho= 5 cm$ }',' $\rho 10 cm$ ',' $\rho 20 cm$ '};
for i = length(color)
figure(1)
text('Position',...
[0.5 0.5-(i*.1)],...
'Interpreter','latex','String',words,'Color',color{i});
end
Annotation with latex etc,
words='\bf{ $5 cm$}';
textp={
'String',words,...
};
annotation('textbox',...
[0.15 0.65 0.3 0.15],...
'interpreter','latex',...
textp,...
'FontSize',14,...
'FontName','Times New Roman',...
'LineStyle','--',...
'EdgeColor','k',...
'LineWidth',2);
I've tried various latex commands, various approaches... nothing seems to work...
\color....
\textcolor...
There must be a simple way to create a text box with varying Latex colors etc in a plot! THanks!
  2 个评论
Walter Roberson
Walter Roberson 2019-2-22
编辑:Walter Roberson 2019-2-22
The material I am finding implies you would need to \usepackage{xcolor} or \usepackage{color} for really old installations. However, neither of those packages is available for MATLAB.
\color works with interpreter tex but not latex

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by