Why does my text overflow the legend window of my MATLAB figure when the TeX interpreter is off?

7 views (last 30 days)
Why does my text overflow the legend window of my MATLAB figure when the TeX interpreter is off?
I am creating legends with quite a few underlined characters; I turned TeX interpreting off to prevent subsequent characters from being subscripted. Now my legend text overflows the legend box. For example:
figure
set(gcf,'defaulttextinterpreter','none')
plot([1 10])
legend('this_is_a_test_of_the_interpreter_set_to_none')

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This bug has been fixed for Release 14 (R14). For previous releases, please read below for any possible workarounds:
The TeX interpreter is still used to determine the text extent before the legend is drawn. Resizing the figure window will fix the problem. Alternately, you can use the TeX interpreter and replace the TeX special characters before the string is used with LEGEND. For example:
figure
plot([1 10])
s = strrep('this_is_a_test_of_the_interpreter_set_to_none','_','\_')
legend(s)

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!