I would like to not type $\mathbf{\hat{x}}$ every time I want a bold x with a hat over it. I've used \def successfully for other things, but with this I am not sure how to properly use \def or \newcommand in order for me to just type \bhat{x} and have it bold the input letter (whatever that may be - could be an x, y, z, etc.).

I've tried this, but it does not work:

\newcommand{\mathbf{\hat{}}}[1][1]{\bhat} % or...
\def\bhat{{\mbox{$\hat \mathbf{}$}}}

2 Answers 2


Hope this is what you want:

some text $\bhat{x}$ or \bhat{y} 


enter image description here

  • Why not using \ensuremath if the new command is used in a mathematical environment $...\bhat{x}...$ ? I would suggest \newcommand{\bhat}[1]{\ensuremath{\hat{\mathbf{#1}}}}, then you do not need to put the \bhat command between dollars. Oct 28, 2016 at 5:28
  • 1
    Relevant: When not to use \ensuremath for math macro?
    – Werner
    Oct 28, 2016 at 5:33
  • @JérômeDequeker: Edited to add \ensuremath Oct 28, 2016 at 5:35
  • @Werner: Thanks for the link. I think in this kind of usage, the argument in the \bhat command is only a letter, but thank you to notice we should not put dollars in the arguments. Oct 28, 2016 at 5:52
  • Has the hat to be bold too ? If Yes, @AmbikaVanchinathan knows what to edit in the answer. Oct 28, 2016 at 5:54

\def \hope#1{\bf{\hat{#1}}} \begin{document} This is $\hope{V}$ \end{document}% this works for me. You can use any term inside curly bracket where V is added. It gives proper result.

  • 3
    The command \bf has been deprecated more than 20 years ago. And no, this doesn't give proper results, because $\hope{V}W$ will make bold also the W.
    – egreg
    Oct 28, 2016 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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