Euro sign when using latex interpreter

15 visualizaciones (últimos 30 días)
Christian Schröder
Christian Schröder el 6 de Jun. de 2023
Editada: Stephen23 el 9 de Jun. de 2023
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

Respuestas (2)

Nitya Patel
Nitya Patel el 8 de Jun. de 2023
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 comentarios
Nitya Patel
Nitya Patel el 8 de Jun. de 2023
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
Christian Schröder el 8 de Jun. de 2023
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.

Iniciar sesión para comentar.


Rik
Rik el 8 de Jun. de 2023
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 comentario
Stephen23
Stephen23 el 9 de Jun. de 2023
Editada: Stephen23 el 9 de Jun. de 2023
+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, '€')

Iniciar sesión para comentar.

Categorías

Más información sobre Text Data Preparation en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by