Euro sign when using latex interpreter

16 次查看(过去 30 天)
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

回答(2 个)

Nitya Patel
Nitya Patel 2023-6-8
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 个评论
Nitya Patel
Nitya Patel 2023-6-8
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.
Christian Schröder
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.

请先登录,再进行评论。


Rik
Rik 2023-6-8
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 个评论
Stephen23
Stephen23 2023-6-9
编辑:Stephen23 2023-6-9
+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, '€')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by