How do I put an em-dash in a text object within a figure in MATLAB?

54 views (last 30 days)
I would like to put an em-dash (long dash with no spaces) in a title or other text object within a figure in MATLAB.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
As of MATLAB 7.0 (R14), "LaTeX" has been added as an optional interpreter for text objects in a figure.
In order to have an em-dash displayed within a figure, the "Interpreter" property of the text should to be set to "LaTeX" and the equivalent LaTeX command "\---" should be typed.
For example, to have "x-hat" displayed in the X-Label, do the following:
plot(1:10)
%An example to have "emdash" displayed as title is:
title(['This is an example for emdash' '---'],'Interpreter','Latex')
%Another example to have "emdash" displayed as text is:
text(5,5,'---','Interpreter','Latex')

More Answers (0)

Categories

Find more on Graphics Object Programming in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!