LaTeX Text and latex interpreter in xlabel

  • Thread starter Thread starter member 428835
  • Start date Start date
  • Tags Tags
    Latex Text
AI Thread Summary
The discussion centers on formatting labels in MATLAB using LaTeX for better visual representation. A solution is provided for creating an xlabel with the desired format, specifically using the command xlabel(['$Q$', ' (mm \textsuperscript{3}/s)'],'Interpreter','latex'). Participants share experiences with similar text display challenges, noting that HTML tags can also be used for text customization in other programming environments. Additional formatting options are suggested, including using the command xlabel('$Q~\left( \mathrm{mm}^3/\mathrm{s} \right)$', 'Interpreter', 'latex') and the newer Name=Value syntax introduced in R2021a.
member 428835
Hi PF!

I'm going insane here. How can I have the following in xlabel: ##Q \text{ (mm\sup 3/s)}##?
 
Physics news on Phys.org
Answer is here:
Code:
xlabel(['$Q$', ' (mm \textsuperscript{3}/s)'],'Interpreter','latex')
 
Nice, thanks for sharing.

Smetimes these kinds of display issues with text drive one insane. I once had to render some funky labels in Java and discovered that display text could in fact be a string of html tags to resize, colorize, fontify (a made up word to mean change the font to a more desireable one) the text. It really made my day too.
 
  • Like
Likes member 428835
joshmccraney said:
Answer is here:
Or,
[CODE lang="matlab" title="Till R2020b"]xlabel('$Q~\left( \mathrm{mm}^3/\mathrm{s} \right)$', 'Interpreter', 'latex')[/CODE]
Or, using the new Name=Value syntax introduced in R2021a,
[CODE lang="matlab" title="R2021a and later"]xlabel('$Q~\left( \mathrm{mm}^3/\mathrm{s} \right)$', Interpreter='latex')[/CODE]
 
  • Like
Likes member 428835 and jedishrfu

Similar threads

Replies
12
Views
3K
Replies
4
Views
2K
Replies
9
Views
2K
Replies
3
Views
3K
Replies
8
Views
3K
Replies
3
Views
1K
Replies
1
Views
1K
Back
Top