61 views (last 30 days)
Show older comments
Sim on 29 Aug 2022
-
-
Link
Direct link to this question
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a
Edited: Sim on 22 Sep 2023
Accepted Answer: Abhishek Chakram
Open in MATLAB Online
When I run the following example, in which I use (1) \mathsf (2) \textsf and (3) interpreter latex together,
plot(rand(3,10));
ylabel('$\mathsf{\stackrel {.}{K} / units}$', 'Interpreter', 'latex','fontsize',20);
text(1.5, 0.8, '\textsf{sans serif}','interpreter','latex','FontSize',20)
text(1.5, 0.6, '$$\mathsf{math\,\,mode\,\,sans\,\,serif}$$','interpreter','latex','FontSize',20)
I get these warning/errors, and the san-serif texts are not correctly displayed in my plot:
Warning: Error updating Text.
Font cmss10 is not supported.
Warning: Error updating Text.
Font cmss10 is not supported.
Warning: Error updating Text.
Font cmss10 is not supported.
How can I correclty visualise/display my texts that include \mathsf and \textsf, and remove the warning/errors ?
Note: my Matlab version is R2022a.
6 Comments Show 4 older commentsHide 4 older comments
Show 4 older commentsHide 4 older comments
dpb on 29 Aug 2022
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2337430
Pretty-much stuck in that the MATLAB-packaged implementation isn't fully general -- while the <TMW Answer> and <Answer> both address R2020b and earlier explicitly, I don't believe there's been any changes since.
The second of the above illustrates some of what can be done; whether you can get a result pleasing to your wishes or not I don't know for certain will be possible.
Sim on 29 Aug 2022
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2337495
I did not understand anything of what you wrote, except the last part where you said: "whether you can get a result pleasing to your wishes or not I don't know for certain will be possible"........ but...... thanks a lot for your comment @dpb !! :-)
dpb on 29 Aug 2022
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2337545
Edited: dpb on 29 Aug 2022
"....did not understand anything of what you wrote..."
I simply provided links to previously-posted Answers from TMW Staff regarding the same issue -- there are examples in them of what limited things can be done with fonts an the MATLAB-installed LaTeX interpreter. You can go look at those examples and see if any of their illustrated usages helps you (or not).
In particular, what I see in those is that the installed font itself must support the type of operation being requested and some characters like Greek symbols must be handled outside the attempts to use the text style modifications. Again, whether any of that will help your issues, I really can't say.
I don't know enough LaTeX off top of my head to be able to provide anything else but it is true that the installation with MATLAB is not completely general in its functionality and fonts is a particularly sore point in that regards. This topic has come up for as long as I've been using MATLAB which goes back all the way to the original Windows release. It's a prime reason I've never bothered to even try to use it (besides that I've never been in a position that the details of presentation ever mattered to me nor my consulting clients sufficiently to worry about details like fonts).
Sim on 29 Aug 2022
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2337590
Edited: Sim on 29 Aug 2022
ahhhh okkk, very clear now!
Ok, I will not even try to go deeper then... But I hope that the @MathWorks Support Team sooner or later will fix this aspect .... btw, the font is just an aesthetic aspect (it is nicer to see a paper with the same font than with different ones, figures included...) .....once it was required by reviewers in one of the Nature's journals.... :-)
dpb on 29 Aug 2022
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2337690
Edited: dpb on 29 Aug 2022
I understand entirely the publication-ready issues(*) -- unfortunately, MATLAB doesn't always provide sufficient facilities(**) to do that with graphics--it's a recognized shortcoming in the user community that to date doesn't have a totally satisfactory solution. TMW has made some improvements, but it appears (from the outside looking in with no inside knowledge at all) that the difficulties with the HG2 (shorthand for "handle graphics V2", the base graphics rendering package inside MATLAB) are so embedded and deep that there simply aren't resources enough considered expendable to try to start over and build such a system--things that can be patched up or added occasionally make improvments, but to me it appears a whole fresh start would probably be required to be able to have a clean-enough code base to be able to remove many of the deeply-embedded warts.
Again, this is just surmise based on observation of what has transpired over some 30+ years.
(*) I'm such an old fogey that my publications days were from well before having such layout tools; everything still went on the hardcopy mats by typewriter and pen and ink -- no electronic transfer back then! Beyond that, technical presentations and conference proceedings never had such stringent publication rules as did the formal journals or the University "Thesis/Dissertation Scrutinizer Czar" who had the final arbitration over whether the format followed guidelines sufficiently well or not. That was typically more difficult a hurdle by far to pass than were the actual orals or research itself.
(**) There is also a "veritable plethora" of Q? on the forum about exporting graphics to pdf and then trying to finish cleaning up with the pdf file to meet publications' form criteria. That also doesn't always work as users may desire.
Sim on 30 Aug 2022
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2339060
thanks a lot @dpb for your interesting comments!!!
Sign in to comment.
Sign in to answer this question.
Accepted Answer
Abhishek Chakram on 22 Sep 2023
Hi Sim,
It is my understanding that you are facing difficulty in setting up San-serif \mathsf and \textsf in y-label of the plot function, you can refer to the following MATLAB answer for the same: https://in.mathworks.com/matlabcentral/answers/546197-how-can-i-apply-font-options-when-using-the-latex-interpreter-in-matlab
Best Regards,
Abhishek Chakram
1 Comment Show -1 older commentsHide -1 older comments
Show -1 older commentsHide -1 older comments
Sim on 22 Sep 2023
Direct link to this comment
https://support.mathworks.com/matlabcentral/answers/1789980-san-serif-mathsf-and-textsf-are-not-supported-when-using-interpreter-latex-in-matlab-r2022a#comment_2896407
Edited: Sim on 22 Sep 2023
Open in MATLAB Online
Thanks a lot!
Yes, as MathWorks Support Team showed there, by using the sans-serif options, I would get the "Warning: Error updating Text. Font cmss10 is not supported.", which is OK, according to what they stated.
Just for a sake of completenesse, I report here, their example that includes the usage of the usage of the sans-serif option (in my machine, I get exactly the same as here):
figure
% 2) Sans-serif, no italics
strx = ['$\textsf{t}$'];
stry = ['$\dot{\textsf{x}}(\textsf{t})$'];
xlabel(strx,'FontSize',30,'Interpreter','LaTeX','Color','r') % Font size/color is set using 'FontSize' and 'Color' name-value pairs
ylabel(stry,'FontSize',30,'Interpreter','LaTeX','Color','b')
Warning: Error updating Text.
Font cmss10 is not supported.
However, the usage of "\mathsf" is still an open problem... :-)
Sign in to comment.
More Answers (0)
Sign in to answer this question.
See Also
Categories
MATLABGraphicsFormatting and AnnotationLabels and Annotations
Find more on Labels and Annotations in Help Center and File Exchange
Tags
- \mathsf
- \textsf
- mathsf
- textsf
- interpreter
- latex
- text
- textscan
- ylabel
- xlabel
- title
- serif
- sanserif
- san-serif
- font
- fontname
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom(English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
Contact your local office