How can I define a command that would put hat with parenthesis over its argument? The command has to work in a math mode. I know that question is very similar to this one but I did not manage to modify any of the proposed solutions to fit my problem.
Asked
Active
Viewed 154 times
1 Answers
2
Linespacing will be badly affected if you use this inline, but you could make a new accent with the accents package. To get the spacing within the parentheses right I used trimbox from the trimclip package to remove whitespace below the ^.
\documentclass{article}
\usepackage{accents}
\usepackage{trimclip}
\DeclareRobustCommand*{\phat}[1]{{\accentset{(!\trimbox{0pt 1.1ex}{\ensuremath{\string^}}!)}{#1}}}
\begin{document}
$\phat{A}$
\end{document}
For a wider hat, you could use \scalebox with a horizontal (but not vertical) stretch factor. Here it is set to 2:
\DeclareRobustCommand*{\phat}[1]{{\accentset{(\!\!\trimbox{0pt 1.1ex}{\scalebox{2}[1]{\ensuremath{\string^}}}\!\!)}{#1}}}
Sandy G
- 42,558
-
-
@wedelfach: You could use
\scalebox{1.5}[1]{\ensuremath{\string^}}(or any stretch factor you want). – Sandy G Oct 11 '22 at 13:29

