1

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 Answers1

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 ^.

enter image description here

\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}}}

enter image description here

Sandy G
  • 42,558