Greek symbols (esp. µ) not italic

276 Ansichten (letzte 30 Tage)
lee
lee am 30 Okt. 2014
Kommentiert: Jiarui Kang am 16 Sep. 2022
I want to use the greek "mu" to be displayed non-italic. Example: ylabel('c [\mu mol/l]')
Is there any easy solution to this problem?

Antworten (4)

Kenneth
Kenneth am 9 Feb. 2017
Simply copy past the mu "µ" in your text like >> ylabel('c [µmol/l]') works perfectly fine in Matlab 2016a

Sean de Wolski
Sean de Wolski am 30 Okt. 2014
Use the 'tex' interpreter instead of the latex one:
>> xlabel(['c_{O2} [',char(181),'mol/l]'],'Interpreter','tex');
  1 Kommentar
lee
lee am 30 Okt. 2014
Thank you for your replies, but still it doesn't solve the underlying problem that you can't use the latex interpreter with non italic greek symbols.
From your answers I have implemented this workaround since I wanted the variable to be italic and the rest to be "normal":
ylabel(['\it{c}\rm{_{O2}} [',char(181),'mol/l]']);

Melden Sie sich an, um zu kommentieren.


Mattias Flygare
Mattias Flygare am 24 Jun. 2021
Comments that suggest using unicode mu and tex interpreter do not always offer a good solution. For many reasons, one might have to use latex interpreter, and a solution for upright mu within the latex interpreter is still needed, as the unicode mu is not supported there.
My workaround was to use the latex interpreter to set the text, but with a space instead of the mu, and then insert the mu with tex interpreter "manually" where the space is. Needless to say this solution is not ideal...
  2 Kommentare
Jérôme
Jérôme am 26 Jul. 2022
Could you please detail how you "insert the mu with tex interpreter "manually" where the space is" after having inserted the text with the latex interpreter?
Thanks
Mattias Flygare
Mattias Flygare am 27 Jul. 2022
I believe I used the text command together with the tex interpreter and then trial and error to find the correct x and y coordinates to place the mu in the space I previously left for it. Hope it helps!

Melden Sie sich an, um zu kommentieren.


Star Strider
Star Strider am 30 Okt. 2014
See if replacing ‘\mu’ with char(181) does what you want. (This applies to US-ASCII character maps. If you have a different one, you may have to search for it.)
  2 Kommentare
lee
lee am 30 Okt. 2014
This solves the problem stated above, but now I would like to set the Interpreter to 'latex'.
Solution with 'tex': ylabel(['c[',char(181),'mol/l]']) -> works
Solution with latex: ylabel(['$c_{O2}$ [',char(181),'mol/l]'],'Interpreter','latex'); -> doesn't work
The second approach is not working since the latex interpreter can't read the µ.
Is there any other solution to this modified problem?
Star Strider
Star Strider am 30 Okt. 2014
I haven’t used LaTeX in years, so I had to go searching. It seems that according to the latest documentation, in LaTeX, \mu also produces an italicised symbol.
My suggestion: Go with Tex and char(181).

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Labels and Annotations finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by