unexpected word wrap behavior in uilabel with tex interpreter. The string wraps unexpectedly at tex font changes.
조회 수: 5 (최근 30일)
이전 댓글 표시
![](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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Bartlett에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!