Is there any way to get a hat wider than widehat?
Why doesn't
\widehat{abcdefghijklmnopqrstuvwxyz}
really go over all of it?
Is there any way to get a hat wider than widehat?
Why doesn't
\widehat{abcdefghijklmnopqrstuvwxyz}
really go over all of it?
The question wasn't "should it be done?" But, for the same reason men climb mountains, "could it be done?" The answer, with the scalerel package, is yes. Thus, we introduce \reallywidehat [EDITED to add phantom rule below argument, so that baseline of result matches baseline of original argument. RE-EDITED to \ensuremath
on the \widthof
calculation (thanks to Thruston)]
See also my answer at Serious problem with \widebar for a related approach.
NEW ANSWER WITH stackengine
This answer is an improvement because it handles vertical space much better than the earlier solution.
\documentclass{article}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
{\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{\textheight}%
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\parskip 1ex
\begin{document}
$\reallywidehat{zbcdefghijklm}$
$\reallywidehat{zbcdefghijk}$
$\reallywidehat{zbcdefghi}$
$\reallywidehat{zbcdefg}$
$\reallywidehat{zbcde}$
$\reallywidehat{zbc}$
$\reallywidehat{zb}$
$x\cdot\reallywidehat{a_1+a_2}\cdot y$
\end{document}
ALTERNATE ANSWER USING \mathchar"0362
(the \widehat
accent) RATHER THAN \bigwedge
EDITED to use \mathchar"0362
rather than the normal carat accent (\mathchar"305E
)
A comment requested this alternate form, which is perhaps superior to the given form above.
\documentclass{article}
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern.1pt\mathchar"0362\kern.1pt}%
{\rule{0ex}{\textheight}}%WIDTH-LIMITED CIRCUMFLEX
}{\textheight}%
}{2.4ex}}%
\stackon[-6.9pt]{#1}{\tmpbox}%
}
\parskip 1ex
\begin{document}
$\reallywidehat{zbcdefghijklm}$
$\reallywidehat{zbcdefghijk}$
$\reallywidehat{zbcdefghi}$
$\reallywidehat{zbcdefg}$
$\reallywidehat{zbcde}$
$\reallywidehat{zbc}$
$\reallywidehat{zb}$
$x\cdot\reallywidehat{a_1+a_2}\cdot y$
$\widehat{zb}$ is actual widehat
\end{document}
EARLIER ANSWER WITH array
\documentclass{article}
\usepackage{scalerel}
\newcommand\reallywidehat[1]{\arraycolsep=0pt\relax%
\begin{array}{c}
\stretchto{
\scaleto{
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.5pt\bigwedge\kern-.5pt}
{\rule[-\textheight/2]{1ex}{\textheight}} %WIDTH-LIMITED BIG WEDGE
}{\textheight} %
}{0.5ex}\\ % THIS SQUEEZES THE WEDGE TO 0.5ex HEIGHT
#1\\ % THIS STACKS THE WEDGE ATOP THE ARGUMENT
\rule{-1ex}{0ex}
\end{array}
}
\begin{document}
$\reallywidehat{zbcdefghijklm}$
$\reallywidehat{zbcdefghijk}$
$\reallywidehat{zbcdefghi}$
$\reallywidehat{zbcdefg}$
$\reallywidehat{zbcde}$
$\reallywidehat{zbc}$
$\reallywidehat{zb}$
$x\cdot\reallywidehat{a_1+a_2}\cdot y$
\end{document}
\ensuremath{}
inside your \widthof{}
call... otherwise it fails if the argument to reallywidehat
contains any real maths. For example try it with \reallywidehat{a_1+a_2}
.
– Thruston
Apr 14 '15 at 20:38
newtxmath
issue.
– Steven B. Segletes
Jan 29 at 17:57
While echoing the sentiment expressed in the earlier answer -- "this stuff really shouldn't be encouraged" -- I can't resist pointing out that \widehat
can easily be made super-wide with the help of the mtpro2
(MathTime Professional II) package. Note that this package isn't free of charge and can't be downloaded from the CTAN. However, its "lite" subset -- which is all that's needed to create superwide "widehat" accents -- is free of charge and may be downloaded from this site.
\documentclass{article}
\usepackage[lite]{mtpro2}
\begin{document}
$ \widehat{abcdefghijklmnopqrstuvwxyz} $
\end{document}
I tried some of these except the {mtpro2} since for submitting articles that might not be acceptable by publishers!
As I was not satisfied by the previous methods mentioned above, I tried to tailor another method, you can apply the following code, play with the scale factors and positions and choose which one you prefer. The last two I recommend but I myself prefer the last, which I am going to use myself:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[ngerman]{babel}
\usepackage{stackengine}
\usepackage{scalerel}
\begin{document}
\[\widehat{ABCDEF}\]
\[\stackon[0pt]{ABCDEF}{\hstretch{7.0}{\wedge}}\]
\[\stackon[-8pt]{ABCDEF}{\vstretch{1.5}{\hstretch{9.0}{\widehat{\phantom{\;}}}}}\]
\[\stackon[-8pt]{ABCDEF}{\vstretch{1.5}{\hstretch{2.4}{\widehat{\phantom{\;\;\;\;\;\;\;\;}}}}}\]
\end{document}
The result would be something like this:
Have fun
Ehsan Tavakoli
\wedge
is not the best option, and$(abcdefg)\widehat{\phantom{x}}$
would do a better job, but that it a matter of choice. – yo' Mar 2 '13 at 15:18\mathcal{F}(f)
for the Fourier transform off
; this is how I'd do it for longer expressions. – Hendrik Vogt Mar 3 '13 at 15:52