MATLAB: Underline a character in a string text

caretcharacterhatlatextext;underline

Hi, I try to display a string containing some characters that are underlined or with a hat? Does someone know how to proceed? Thanks

Best Answer

If you use text(), title(), xlabel(), etc. you can use latex which is the default interpreter.
% title('S\underline{tring} now x hat:\hat{x}', 'FontSize', 30, 'Interpreter', 'latex')
title('S\underline{tring}', 'FontSize', 30, 'Interpreter', 'latex')
I couldn't get the hat to work, but the underline worked. MATLAB admits they don't support all LATEX instructions - maybe hat is one of those.
Related Question