[Tex/LaTex] `\stackrel` but lower

oversetstacking-symbols

I am trying to place a frown above a times so it behaves like a hat. I have tried:

\stackrel{\frown}{\times}
{\frown \above 0pt \times}
\overset{\frown}{\times}
\mathrlap{\frown}\times
{\frown\atop\times}
\ooalign{$\frown$\cr$\times$}

but the distance of the frown to the times is either too high or too low. I think \ooalign provides a solution but am unable to find it.

Edit:

\ooalign{\hidewidth\raise1ex\hbox{$\frown$}\cr$\times$}

gives a pretty good result but the symbols are not aligned.

Best Answer

Not \ooalign, which superimposes symbols: you need to stack them, so \ialign is better.

\documentclass{article}
\usepackage{amsmath,mathtools}

\makeatletter
\DeclareRobustCommand{\frtimes}{\mathbin{\mathpalette\frtimes@@\relax}}
\newcommand{\frtimes@@}[2]{%
  \vbox{\offinterlineskip
    \sbox\z@{$\m@th#1\times$}%
    \ialign{%
      \hfil##\hfil\cr
      $\m@th#1{}_{\frown}\kern-\scriptspace$\cr
      \noalign{\kern-.3\ht\z@}
      \box\z@\cr
    }%
  }%
}
\makeatother

\begin{document}

$A\frtimes B_{A\frtimes B}$

\end{document}

enter image description here