Extra white spaces not inserted using the text command

21 visualizaciones (últimos 30 días)
Tim Garrett
Tim Garrett el 23 de Abr. de 2021
Comentada: Tim Garrett el 26 de Abr. de 2021
I cannot get multiple spaces to show up on a plot when using the 'text' command.
For example, this works fine
c5 = strcat('$\rm{SW}$','{ }','$D_{\rm{max}}$','{ }','$v$');
l5 = text(0.9, 0.4, c5)
set(l5,'Interpreter','Latex','FontSize',10,'Color','b');
However, the extra white spaces as here do not show up
c5 = strcat('$\rm{SW}$','{ }','$D_{\rm{max}}$','{ }','$v$');
l5 = text(0.9, 0.4, c5)
set(l5,'Interpreter','Latex','FontSize',10,'Color','b');

Respuesta aceptada

Jan
Jan el 23 de Abr. de 2021
Yes, of course. The LaTeX interpreter ignores spaces. It is intented to do so.
Use the LaTeX command \hspace{} for horizontal blanks:
figure;
axes;
c5 = strcat('$\rm{SW}$','{\hspace{1cm}}','$D_{\rm{max}}$','{ }','$v$');
l5 = text(0.5, 0.5, c5)
set(l5, 'Interpreter', 'Latex', 'FontSize', 10, 'Color', 'b');
  1 comentario
Tim Garrett
Tim Garrett el 26 de Abr. de 2021
Thanks. Very helpful, and of course was being a bit stupid. Sigh.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Grid Lines, Tick Values, and Labels en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by