
How do I set text formatting of \leq and \geq look similar to that of < and > symbols ?
10 views (last 30 days)
Show older comments
MathWorks Support Team
on 9 Sep 2020
Answered: MathWorks Support Team
on 3 Feb 2021
I want to display text having few Greek symbols (\leq, \geq) in a MATLAB figure. I want to use 'Helvetica' font in bold with a 'FontSize' of 8.
I have tried using "tex" and "latex" interpreters but both of them had some issues and did not match my desired output.
1) I am using following code to annotate text using 'tex' interpreter.
t1 = text('String', '1.5 ms^{-1} \leq {\itu}_f < 2.0 ms^{-1}',...
'FontSize', 20, 'FontWeight', 'bold', 'Position', [.3 .3 0]);
As can be seen in output below, the formatting of the "less than or equal" symbol is different from the "less than" symbol.

2) I am using following code to annotate text using 'latex' interpreter.
t2 = text('String','$2.0\,\mathrm{ms^{-1}} \leq u_\mathrm{f} < 2.5\, \mathrm{ms^{-1}}$',...
'Interpreter','latex','FontSize',20, 'Position', [.3 .5 0]);
As can be seen in output below, the two symbols are identical but not bold like the previous text object. Font is also changed.

Can you please suggest a workaround to fix this issue and get the output with desired text formatting requirements.
Accepted Answer
MathWorks Support Team
on 9 Sep 2020
To get the desired output, use equivalent unicode character codes instead of "\leq" and "\geq" along with the default "tex" interpreter.
t1 = text('String', ['1.5 ms^{-1} ',char(8804),' {\itu}_f < 2.0 ms^{-1}'], 'FontSize', 20,...
FontWeight', 'bold', 'Position', [.3 .3 0]);
t2 = text('String', ['1.5 ms^{-1} ',char(8805),' {\itu}_f > 2.0 ms^{-1}'], 'FontSize', 20,...
'FontWeight', 'bold', 'Position', [.3 .5 0]);

0 Comments
More Answers (0)
See Also
Categories
Find more on Labels and Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!