# How can I place an overbar over text using "LATEX" as the "Interpreter" in MATLAB 7.0 (R14) and later versions?

129 views (last 30 days)
MathWorks Support Team on 26 Apr 2010
I would like to place an overbar over text using "LATEX" as the "Interpreter" and I would also like to display the values of variables or the results of evaluated expressions as part of the string in a TEXT object.

MathWorks Support Team on 26 Apr 2010
The following example illustrates how to:
(1) Put an overbar over the text string, "5*pi/4", using "\overline" option.
(2) Evaluate an expression within the TEXT command. In this case, the value of "sin(5*pi/4)" will be evaluated and displayed.
figure
plot(0:pi/20:2*pi,sin(0:pi/20:2*pi))
text('interpreter','latex','string',['$sin(\overline {5*pi/4} ) = ',num2str(sin(5*pi/4)),'$'],...
'FontSize',16)
Similarly, to display this line in the title, (or xlabel or ylabel), use,
title(['$sin(\overline {5*pi/4} ) = ',num2str(sin(5*pi/4)),'$'],'interpreter','latex','FontSize',16)
where the command TITLE can be swapped out with XLABEL or YLABEL directly.

### Categories

Find more on Histograms 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!