TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two \newcommand defined as follows:

\newcommand{\hvar}[1]{\hat{\delta #1}}

And they look like this:

\hvar{X} \hvar{X}

\gbp \gbp

The problem is that, if I use them together I get this:

\hvar{\gbp} \hvar{\gbp}

It seems like the \gamma was shifted to the right. Is this a bug? Is there a way to fix it?

Here is a MWE:

\newcommand{\hvar}[1]{\hat{\delta #1}}
\hvar{X} \qquad \gbp \qquad \hvar{\gbp}


As egreg mentioned, this is a bug on the accent implementation of amsmath. A work around is provided here: Why do arguments to nested \tilde or \breve commands reappear when amsmath is used? and a MWE presented below:



\newcommand{\hvar}[1]{\compaccX{\hat}{\delta #1}}
\hvar{X} \qquad \gbp \qquad \hvar{\gbp} \qquad A_{\hvar{\gbp}}


Looks like:

enter image description here

share|improve this question
I can't really provide any technical insights on this one, but I will observe that replacing \hat with \widehat seems to work, if that's an acceptable solution. – You Sep 9 '13 at 18:05
\hat and \bar are accents. Combining multiple accents onto one character is one of the "scary" parts of TeX. – kahen Sep 9 '13 at 18:24
Are you planning on using this symbol combination in subscripts/superscripts? – Werner Sep 9 '13 at 18:48
Yes. I will need a \dot{\gbp} in a subscript, which has the same problem. – Miguel Sep 9 '13 at 18:53
I believe this is a bug in the accent implementation of amsmath. :-( Some macros that are set globally disrupt the working of the inner accent. This can be seen by trying \hvar{\text{$\gbp$}} which produces the dreaded undefined control sequence error about \macc@kerna. See also tex.stackexchange.com/questions/30327/… – egreg Sep 9 '13 at 19:48

Here's an alternative using a homegrown \althat routine, with three defining parameters (\Ht, \Wd, and \Dp).


\newcommand{\hvar}[1]{\althat{\delta #1}}

      \trimbox{.15ex .75ex .15ex .2ex}{\scalerel*{\char'136}{\rule{1ex}{1ex}}}%

\parindent 0in

\( \althat {\mathrm{H}} = \althat {\mathrm{T}} + \althat {\mathrm{V}} \)

\( \hvar{X} \qquad \gbp \qquad \hvar{\gbp} \)


enter image description here

As originally proposed at How to make circumflexes wider but still of a fixed size in XeTeX?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.