unexpected word wrap behavior in uilabel with tex interpreter. The string wraps unexpectedly at tex font changes.
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1264270/image.jpeg)
% unexpected WordWrap behavior in uilabel with tex interpreter, R2022a
str='A ball in free-fall travels at an average velocity of \bf\color{red} -160.3 inches/second \rm\color{black} over the given interval. At \bf\color{red}0.2275 seconds\rm\color{black} the ball is located \bf\color{red}190.0 inches\rm\color{black} from the ground. Acceleration due to gravity is 9.81 m/s. \bf\color{darkGreen}When will the ball be \bf\color{red}130.0 inches\rm\color{black} from the ground?\rm\color{black}';
interpreter='tex';
h=uifigure; h.Units='normalized'; h.Position=[.01 .02 .98 .96];
uilabel(h,'Text',str,'Position',[0 100 2000 50],'interpreter',interpreter,'WordWrap','off','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 200 1300 100],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 350 1000 150],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 550 700 150],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 750 500 200],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
interpreter='none';
h=uifigure; h.Units='normalized'; h.Position=[.01 .02 .98 .96];
uilabel(h,'Text',str,'Position',[0 100 2000 50],'interpreter',interpreter,'WordWrap','off','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 200 1300 100],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 350 1000 150],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 550 700 150],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
uilabel(h,'Text',str,'Position',[0 750 500 200],'interpreter',interpreter,'WordWrap','on','BackgroundColor',[.9 .9 .9]);
% -----------------------------------------------------------------------------------------------------
% MATLAB Version: 9.12.0.2039608 (R2022a) Update 5
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Bartlett dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!