3

I am using the following command to display unit vectors for my report:

\newcommand{\ihat}{\boldsymbol{\hat{\textbf{\i}}}}
\newcommand{\jhat}{\boldsymbol{\hat{\textbf{\j}}}}

This is my result:

enter image description here

What am I doing wrong? Any help is greatly appreciated!

2
  • Could you give a full example, how to obtain such unexpected result, please? Sep 7, 2015 at 11:46
  • Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – Symbol 1
    Sep 7, 2015 at 11:50

2 Answers 2

1

In proper method, which you can also see in the log. Try this (memoir class not related, just happens to be the basic class in my editor):

\documentclass[a4paper]{memoir}
\usepackage{amsmath,amssymb,bm,mathtools}

\newcommand{\ihat}{\boldsymbol{\hat{\imath}}}
\newcommand{\jhat}{\boldsymbol{\hat{\jmath}}}

\begin{document}

\[
\ihat \quad  \jhat 
\]


\end{document}

enter image description here

EDIT: If you want them upright, then with the packages I used, you code should work. If not, then as usual on this site, please provide a full minimal example that we can compile and test. Sniplets like this usually does not help much

3
  • Why double \bm? Note that bm.sty redefines \boldsymbol to do \bm.
    – egreg
    Sep 7, 2015 at 12:08
  • @egreg, typo. I never use \boldsymbol. \bm removed
    – daleif
    Sep 7, 2015 at 12:12
  • So made your answer identical to mine.
    – egreg
    Sep 7, 2015 at 12:59
2

I'm not sure how you're obtaining that strange output, but here's how you can get a (bold) hat over a bold letter.

\documentclass{article}
\usepackage{amsmath,bm}

\begin{document}

\begin{equation*}
\bm{\hat{\imath}}+\bm{\hat{\jmath}}+\bm{\hat{k}}
\end{equation*}

\end{document}

enter image description here

Should the hat not be boldface, switch the positions of \hat and \bm:

\begin{equation*}
\hat{\bm{\imath}}+\hat{\bm{\jmath}}+\hat{\bm{k}}
\end{equation*}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .