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)
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.

Accepted Answer

MathWorks Support Team
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.
text('interpreter','latex','string',['$sin(\overline {5*pi/4} ) = ',num2str(sin(5*pi/4)),'$'],...
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.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!