On Tuesday, March 9, 2010 8:20:26 PM UTC, David Kincaid wrote:
> How do I use a LaTeX \hat and \tilde in a plot label?
> For example, something like this:
>
> gtext(texlabel('hat{L}: x+y=1, tilde{L}: x-y=1'))
In my case, I needed only the hat itself, not over some other character. It took me a while to find a working solution.
tag = regexprep( myString, '%5E','$\\widehat{\\ \\ }$','ignorecase' );
AX=plotyy(D,S, D(2:end),X, 'stairs','stairs');
set( get(AX(1),'yLabel'), 'Interpreter','LaTeX' );
set( get(AX(1),'yLabel'), 'String', tag );
The key things to note, besides the use of LaTeX's widehat command, are the double back-slashes. To typeset the hat without any character to sit on top of, the argument to the widehat command is two blank spaces, escaped with the back-slashes.
|