What works in 2024 stopped with 2025: Latex interpreter

109 vues (au cours des 30 derniers jours)
Gokhan Pekcan
Gokhan Pekcan le 12 Oct 2025 à 13:03
Modifié(e) : dpb le 14 Oct 2025 à 18:31
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 commentaires
Paul
Paul le 13 Oct 2025 à 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 le 14 Oct 2025 à 4:24
Modifié(e) : dpb le 14 Oct 2025 à 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;

Connectez-vous pour commenter.

Réponse acceptée

dpb
dpb le 12 Oct 2025 à 14:05
Modifié(e) : dpb le 13 Oct 2025 à 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.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 13 Oct 2025 à 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 commentaires
dpb
dpb le 13 Oct 2025 à 21:48
Modifié(e) : dpb le 14 Oct 2025 à 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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Characters and Strings dans Help Center et File Exchange

Produits


Version

R2025b

Community Treasure Hunt

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

Start Hunting!

Translated by