hat & tilde in plot labels

  • Follow


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'))
0
Reply David 3/9/2010 8:20:26 PM

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

gtext('$\hat{L}: x+y=1, \tilde{L}: x-y=1$','Interpreter','latex')

-- 
Doug Schwarz
dmschwarz&ieee,org
Make obvious changes to get real email address.
0
Reply Doug 3/9/2010 10:17:12 PM


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.
0
Reply sorliej (1) 10/10/2012 10:03:35 PM

2 Replies
1220 Views

(page loaded in 0.115 seconds)

Similiar Articles:









7/22/2012 4:49:57 AM


Reply: