# “Square hat” accent [duplicate]

I have seen in a book the following "square hat" symbol to denote the discrete Fourier transform:

I would like to use the same symbol, but I cannnot find the corresponding command. Can anyone help me, please?

-

## marked as duplicate by Sean Allred, Peter Jansson, Martin Schröder, Stephen, Benedikt BauerMar 6 '14 at 20:40

Try \overbracket{u}; see p. 60 of The Comprehensive LaTeX Symbol List. (You will need \usepackage{mathtools}.) – Adam Liter Mar 6 '14 at 18:48
And welcome to TeX.SX! – Adam Liter Mar 6 '14 at 18:50

Here's one you can tailor and which fits to the argument:

\documentclass{article}
\usepackage{stackengine}
\def\rlwd{.4pt}
\def\rlht{1.1pt}
\def\shatvrule{\rule{\rlwd}{\rlht}}
\def\shat#1{%
\setbox0=\hbox{$#1$}%
\stackon[0pt]{\stackon[1pt]{\ensuremath{#1}}{%
\shatvrule\kern\wd0\kern-\rlwd\kern-\rlwd\shatvrule}}%
{\rule{\wd0}{\rlwd}}%
}
\begin{document}
$\shat u(\omega,t) = \shat{XYZ}$
\end{document}


The 1pt is the gap below the hat to the letter, which can be changed, the \rlht is the height of the vertical strut, and \rlwd is the rule thickness.

If you need it to work across math styles, here is a slight variation:

\documentclass{article}
\usepackage{stackengine}
\usepackage{scalerel}
\def\rlwd{.4pt}
\def\rlht{1.1pt}
\def\shatvrule{\rule{\rlwd}{\rlht}}
\def\shat#1{%
\ThisStyle{%
\setbox0=\hbox{$\SavedStyle#1$}%
\stackon[0pt]{\stackon[1pt]{\ensuremath{\SavedStyle#1}}{%
\shatvrule\kern\wd0\kern-\rlwd\kern-\rlwd\shatvrule}}%
{\rule{\wd0}{\rlwd}}%
}%
}
\begin{document}
$\shat u(\omega,t) = \shat{XYZ}$

$\scriptscriptstyle\shat u(\omega,t) = \shat{XYZ}$
\end{document}


And if I wanted to get really fancy, I could introduce variable rule height, thickness and stacking gap, all of which scale with the math style, as described at the bottom of this answer: wavy division sign wanted. Without reiterating that code, the result would look like

-