Euro sign when using latex interpreter

This has been asked before, of course, but not in a couple of years, so I'd like to ask again: is it possibly by now to use the Euro symbol, €, when using latex as the Interpreter, e.g. for legend entries? And if so, how?
Something as simple as
text(.5, .5, "€", "Interpreter", "latex")
breaks, as does (\texteuro requires no additional packages anymore these days BTW)
text(.5, .5, "\texteuro", "Interpreter", "latex")
And this is rather annoying: consider the case where one (and only one!) of your legend entries in a more complicated plot is suddenly rendered using the tex interpreter, say.
People have asked about this in 2015, in 2017 (twice), and in 2018, and the answer's always been "this is not possible".
It's been years since then. MATLAB is a commercial product with outstanding development and support teams, and does not come cheap. I hope that this time, the answer will be "yes, this has been implemented" (or at the very least, "no, not yet, but we will do so for the next release"; I'll be happy to file an RFE in that case if it helps).
Thanks,
Chris

Answers (2)

It is my understanding that you would like to add a Euro symbol in a legend. As of MATLAB R2023a, you can simply add it using the following code:
text(.5, .5, "€");
Moreover, if you do not have access to the "€" key, you can alternatively use char(8364) as below:
text(.5, .5, char(8364))

3 Comments

Thanks for your reply. (Out of curiosity, BTW, did you use ChatGPT?) Actually, what I'd like to do isn't add a Euro symbol to a plot as such, I'd like to do so using the latex interpreter, which produces more visually appealing results. Based on another answer that was unfortunately deleted, it seems that this is not currently possible.
No I did not use ChatGPT. I just went on MATLAB and tried a couple things till I found a solution. I now understand that you want to do so using the LaTeX interpreter to make it prettier. I do not think it is currently possible.
Hi Nitya, and thanks again for taking the time to reply. Yes, it looks like it isn't. I'll file an RFE for this ASAP.

Sign in to comment.

I can't find it right now, but I recall someone changing/updaing the LaTeX engine shipped with Matlab (but apparently this is no longer possible).
You could either use placeholders and typeset with LaTeX outside of Matlab, or mess around with text calls to build your own legend out of the constituent parts. That way lies madness, but it will work:
hold on
text(0.100, 0.5, 'this is a')
text(0.225, 0.5, 'very')
text(0.300, 0.5, 'bad idea')

1 Comment

+1 Good thinking outside the box! Another similar approach is to only overlap the required character/s:
text(0.100, 0.5, 'this is a 5 idea')
text(0.225, 0.5, '€')

Sign in to comment.

Categories

Products

Release

R2023a

Asked:

on 6 Jun 2023

Edited:

on 9 Jun 2023

Community Treasure Hunt

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

Start Hunting!