How to stop latex interpreter from being in italics

175 visualizaciones (últimos 30 días)
Roederer Lyne
Roederer Lyne el 26 de Feb. de 2016
Comentada: gdowdy el 26 de Jun. de 2018
I needed to have an xlabel of 'u' with an overbar and the only way I found to do it is using Latex interpreter, however it displays it in italics which I don't want.
Is there a way to change this?
xlabel(['$(\overline {u}) (m/s)','$'],'interpreter','latex')

Respuesta aceptada

Shivam Chaturvedi
Shivam Chaturvedi el 2 de Mzo. de 2016
Hi Roederer,
The overline on u would be there due to the fonts being used during the LaTeX interpreter.
But there's a way out if you want the interpreter to use a non-italic font. For this, you need to encapsulate the expression with \mathrm{} like below:
xlabel(['$(\mathrm{\overline{u}})(m/s)$'],'interpreter','latex')
I have tested this for the \overlibe{} case and it works, and it should ideally work in all cases, but keep in mind that it may not work in some complex cases.
However, if you need the rest of the text (besides u) to be without the italics, you can only surround u with $ and leave the rest as-is. Those characters will be un-italicised as they are not rendered in the "math" mode.
Ex:
xlabel(['($\overline {u}$) (m/s)'],'interpreter','latex')
Or maybe a combination of the 2 things above would return you the expected results.
Hope that helps your case!
  1 comentario
gdowdy
gdowdy el 26 de Jun. de 2018
Thanks, Shivam! I was searching for a solution like this for far too long!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Files and Folders en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by