# Mixing “check” and “hat” leads to odd output (using MnSymbol)

I'm trying to typeset a formula that contains the expression $\check{x} g_1$ underneath a widehat. However, when I typeset the expression $\widehat{\check{x} g_1}$, I get odd results -- the "check" and the g_1 are in the right places, but the x is shifted to the right so that it overlaps with the g_1 (thus leaving the check resting over a blank space). What am I doing wrong?

EDIT : My one theory is that this has something to do with using the MnSymbol package. Here's a minimal document that has the problem.

\documentclass[11 pt]{article}
\usepackage{MnSymbol}

\begin{document}

$$\widehat{\check{x} g_1}$$

\end{document}


If I omit the MnSymbol package, the problem goes away.

-
Can you make a minimal document that duplicates the problem and add that to your question. A quick test doesn't reveal the problem. Are you sure it's not simply a problem with your dvi/pdf viewer? –  Alan Munn Jan 28 '11 at 22:21
@Alan: it could be amsmath. I had the same problem in [this question][1] with dot and vector (and the same rendering as described by Andy). --- [1][tex.stackexchange.com/questions/9669/… –  Bruno Le Floch Jan 28 '11 at 22:26
@Bruno I don't think so in this case. That's why we need a minimal document. With or without amsmath I get a fine output. –  Alan Munn Jan 28 '11 at 22:32
@Alan : I added a minimal document. While creating it, I think I narrowed down the problem to the MnSymbol package. –  Andy Putman Jan 28 '11 at 22:33
@Alan: sorry, it looked very similar, and I didn't check. –  Bruno Le Floch Jan 28 '11 at 22:38

load \usepackage{accents} after MnSymbol

-
Thanks! That seems to fix it. By the way, what exactly does the "accents" package do? –  Andy Putman Jan 28 '11 at 22:36
it corrects the accent setting, especially for doubled accents –  Herbert Jan 28 '11 at 22:40

Herbert gave you a perfect solution; I'll try and explain a bit what's going wrong. Let me begin by saying that it's easy to reproduce the odd output with amsmath (see also the comments to the question). In amsmath.sty, there are the lines

%%\@tempa\widetilde
%%\@tempa\widehat


and it's indeed good that they're commented out. \@tempa is a command that gives accents a special treatment for better accent positioning, especially for double accents. (Compare Herbert's comment to his answer.) This treatment is given to all the "small" accents, including \check.

Now the following code gives the same odd output as the OP's code.

\documentclass[11 pt]{article}
\usepackage{amsmath}
\makeatletter
\@tempa\widehat
\makeatother
\begin{document}
$\widehat{\check{x} g_1}$
\end{document}


This might explain why \@tempa\widehat is commented out in amsmath.sty.

Now MnSymbol loads amsmath and then calls

\DeclareMathAccent{\widehat}{\mathord}{largesymbols}{’302}


which in turn calls \set@mathaccent. But this is the modified \set@mathaccent from amsmath, so thing again go wrong. A possible fix is to give \widehat a LaTeX type definition back again, but for this you have to know the accent number "3C2:

\documentclass[11 pt]{article}
\usepackage{MnSymbol}
\show\widehat
\def\widehat{\mathaccent"3C2\relax}
\begin{document}
$\widehat{\check{x} g_1}$
\end{document}


Summarizing: To me it looks like a bug in MnSymbol.

-