What works in 2024 stopped with 2025: Latex interpreter

108 views (last 30 days)
The following (\textcircled and \fbox) used to produce circled and boxed text on axes in MATLAB 2024 and earlier versions. Can you tell what might have happened and/or a specific setting that would restore? Or is there an alternative efficient way (instead of writing lines of code and using graphics) to get circled/boxed text?
I realize that latex support in MATLAB may be somewhat limited, but I wish that what worked before still works.
Thank you all in advance...
GP--
text(0.5,0.5,[' ' ' $\raisebox{.5pt}{\textcircled{\raisebox{-.9pt} {' num2str(14) '}}}$' ' :i-end'],...
'Units','normalized','HorizontalAlignment','left','VerticalAlignment', 'bottom', 'Color','m',...
'Interpreter','latex',"FontSize",14);
text(0.2,0.5,['$\fbox{ ' num2str(25) ' }$' ],...
'HorizontalAlignment','center','VerticalAlignment', 'top','rotation',40,...
'Interpreter','latex',"FontSize",11);
  7 Comments
Paul
Paul on 13 Oct 2025 at 21:33
Adding an extra line to the plot just to get the circled text could be problematic, or at least annoying. For example, that additional, single-marker line will have to be dealt with in the legend, any findobj code looking for lines, etc.
dpb
dpb on 14 Oct 2025 at 4:24
Edited: dpb on 14 Oct 2025 at 13:32
Yeah, but one could manage the pain somewhat if wrapped in a user function to set
...
hCirc=plot(x,y,'o','Markeredgecolor',c,'Markersize',sz,'HandleVisibility','off');
hCirc.Annotation.LegendInformation.IconDisplayStyle='off;

Sign in to comment.

Accepted Answer

dpb
dpb on 12 Oct 2025 at 14:05
Edited: dpb on 13 Oct 2025 at 16:22
Submit this to Mathworks as an official support request/bug at <Product Support Page>.
With the new nendering engine much seems to be different and/or broken, but Mathworks won't know about rare usage issues unless they're reported.
ADDENDUM
As in Comment above, it appears Mathworks has purposely removed these builtin LaTeX commands in latest release. IMO, that is misguided on their part; let the user decide whether the result is ok or not, don't prevent the use entirely, whether it is an elegant solution or not.
I've not seen much noise in the area recently, a number of years ago there was quite a bit of activity trying to add packages, but it appears folks just gave up as a lost cause. That again, would seem to me to be a reasonable enhancement request to document how that can be done or add the ability if not presently so...or use another full implementation instead.

More Answers (1)

Walter Roberson
Walter Roberson on 13 Oct 2025 at 19:52
\raisebox and \fbox were never previously documented as working.
I speculate that when Mathworks converted java based figures to javascript based figures, that they had to re-implement latex, and that they simply did not take the time to re-implement commands that were previously supported but were undocumented.
  3 Comments
dpb
dpb on 13 Oct 2025 at 21:48
Edited: dpb on 14 Oct 2025 at 18:31
OK, so that is, I presume also when it became a subtopic in the Live Editor documentation instead of standing alone as annotation of graphics.
However, note for text for use as @Gokhan Pekcan is/was using the interpreter the documentation is still identical as it was before in R2022b and text is still the same documentation links as it was before as well. No indication anything changed there with the use of 'Interpreter','latex' from prior releases.
From this it appears Mathworks has switched horses in midstream with only live scripts having been considered in revising LaTeX support. And, you'll never stumble across the above list from the text function documentation.

Sign in to comment.

Categories

Find more on Characters and Strings in Help Center and File Exchange

Products


Release

R2025b

Community Treasure Hunt

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

Start Hunting!