# Alternative of \rule in ConTeXt for lifting \hat slightly up

In ConTeXt, I want to lift a \hat slightly up, since \hat is too low and touches the variable. Now, this post is exactly what I want. It suggests:

\hat{\rule{0ex}{1.2ex}\mkern-3mu x}_{t+1}


However, ConTeXt seemingly doesn't recognize \rule. I don't understand the nature of \rule, and I can't find explanation in The TEXbook nor in TEX for the Impatient. Is \rule a LaTeX function? Where can I find the function definition, and how can I implement it using (perhaps) plain TEX and ConTeXt functions? Or are there other ways to achieve the result?

• Which font are you using? I think that it should be possible to adjust the "height" of x using a font goodie file. Mar 13, 2019 at 21:49
• @Aditya TeX Gyre Pagella Math Mar 14, 2019 at 10:05

In ConTeXt the command is named \blackrule instead of \rule. In contrast to LaTeX's \rule it follows the intuitive key-value syntax.

\starttext

$\hat{x}_{t+1}$
$\hat{\blackrule[width=0ex,height=1.2ex]\mkern-3mu x}_{t+1}$

\stoptext


\vphantom works in ConTeXt. You just need to use a character that has the height you want. In the example, < is used since it is slightly taller than x.

\define[1]\hihat{\hat{\vphantom{<}#1}}

\starttext

$\hat{x}_{t+1}\hihat{x}_{t+1}$

\stoptext