What works in 2024 stopped with 2025: Latex interpreter
109 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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?
My original source was : https://stackoverflow.com/questions/10818392/matlab-putting-a-circled-number-onto-a-graph
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
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.
Réponse acceptée
dpb
le 12 Oct 2025 à 14:05
Modifié(e) : dpb
le 13 Oct 2025 à 16:22
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.
0 commentaires
Plus de réponses (1)
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
Walter Roberson
le 13 Oct 2025 à 21:18
https://www.mathworks.com/help/releases/R2024b/matlab/matlab_prog/insert-equations.html?s_tid=doc_srchtitle#bvak56c-1 lists Supported LaTeX commands.
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.
Voir également
Catégories
En savoir plus sur Characters and Strings 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!
