Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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

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

share|improve this question

marked as duplicate by Sean Allred, Peter Jansson, Martin Schröder, Stephen, Benedikt Bauer Mar 6 at 20:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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

1 Answer 1

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}

enter image description here

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}

enter image description here

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

enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.