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.
1 Answer
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}}} - Thanks a lot! Is it possible, though, to make the "hat" wider?wedelfach– wedelfach2022-10-11 13:04:20 +00:00Commented Oct 11, 2022 at 13:04
- @wedelfach: You could use
\scalebox{1.5}[1]{\ensuremath{\string^}}(or any stretch factor you want).Sandy G– Sandy G2022-10-11 13:29:20 +00:00Commented Oct 11, 2022 at 13:29

