4

I need to create a command that works as \hat[1], but instead of adding a hat on the argument I want to add a flipped hat -- the same symbol but rotated by 180 degree -- on the argument. I found the following code from a paper on Arxiv which adds a flipped hat on the word "HM".

\RequirePackage{rotating}       
\def\Hto{
   \setbox0=\hbox{$\widehat{\mathit{HM}}$}
   \setbox1=\hbox{$\mathit{HM}$}
   \dimen0=1.1\ht0
   \advance\dimen0 by 1.17\ht1
   \smash{\mskip2mu\raise\dimen0\rlap{
      \begin{turn}{180}
          {$\widehat{\phantom{\mathit{HM}}}$}
       \end{turn}} \mskip-2mu    
            \mathit{HM}
}{\vphantom{\widehat{\mathit{HM}}}}{}}

The command creates this symbol: enter image description here

Is there a way to change the code so that it can take an argument? I would like to change the word "HM" to different words, possibly with different length.

By the way, is there a place where I can learn to write more advanced LaTeX codes, like the one above, by myself?

Thank you very much!

  • 1
    \widecheck{abc} would be found by reading texdoc symbols – vv01f Nov 25 '16 at 0:34

Browse other questions tagged or ask your own question.