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{}$}}}

\ensuremathif the new command is used in a mathematical environment$...\bhat{x}...$?I would suggest
– Jérôme Dequeker Oct 28 '16 at 05:28\newcommand{\bhat}[1]{\ensuremath{\hat{\mathbf{#1}}}}, then you do not need to put the\bhatcommand between dollars.\ensuremathfor math macro? – Werner Oct 28 '16 at 05:33\bhatcommand is only a letter, but thank you to notice we should not put dollars in the arguments. – Jérôme Dequeker Oct 28 '16 at 05:52\ensuremath. – egreg Oct 28 '16 at 06:40