How to add bar above a letter in xlabel

597 visualizzazioni (ultimi 30 giorni)
I want to add a bar above the letter U (i.e. a horizontal line above the letter). Why will Matlab not accept xlabel('\bar{U}','Interpreter','Latex')? The output is Warning: Error updating Text.
Character vector must have valid interpreter syntax:
\bar{U}
Is it because there is no bar command in Matlab?

Risposta accettata

Walter Roberson
Walter Roberson il 18 Nov 2017
xlabel('$\bar{U}$','Interpreter','Latex')
  6 Commenti
Oscar Espinosa
Oscar Espinosa il 1 Giu 2020
But if I have text before the bar, doesn't work. There is another method?
I tried this:
zlabel('Относительный силовой фактор $\bar{G}$','Interpreter','Latex')
Walter Roberson
Walter Roberson il 1 Giu 2020
you cannot use Unicode with Latex.
Unfortunately at this time I do not seem to be able to get \bar or \overline or \stackrel to work with Interpreter tex

Accedi per commentare.

Più risposte (1)

Léo
Léo il 24 Giu 2021
Hi,
I have the same problem than Oscar. I want to put some text before and after putting the letter with the bar.
In my case, I have ylabel('Average concentration of species j (Cbar_j) [mol/m^3]'). If anyone has a clue for me I would be greatfull.
Thanks in advance.
  5 Commenti
Léo
Léo il 24 Giu 2021
Thank you so much.
I had no idea you could do so much playing with both matlab and latex
Walter Roberson
Walter Roberson il 24 Giu 2021
Unfortunately fonts in math mode are somewhat restricted in pure LateX, and MATLAB does not support the use of \usepackage that might permit much more extensive customization.

Accedi per commentare.

Categorie

Scopri di più su Labels and Annotations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by