How do I draw an en dash in MATLAB 7.2 (R2006a) using the TeX interpreter?
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 9 Aug 2011
Edited: MathWorks Support Team
on 21 Jun 2021
I am trying to write text within a figure, and I need to be able to differentiate between a hyphen and an en dash (hyphen being slightly shorter).
Accepted Answer
MathWorks Support Team
on 15 Jun 2021
Edited: MathWorks Support Team
on 21 Jun 2021
You can use the ASCII codes for the specific type of dash you would like to display in the call to the TEXT function. For example,
plot(1:10);
% This will draw a hyphen
h1 = text(2,2,['Test-example']);
% This will draw an en dash
h1 = text(2,4,['Test' char(8211) 'example']);
% This will draw an em dash
h1 = text(2,6,['Test' char(8212) 'example']);
Please refer to the following page to see numeric codes for the common dashes:
0 Comments
More Answers (0)
See Also
Categories
Find more on Environment and Settings 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!