3

When I try to use the expression

$\textbf{a \cdot (a \times b)}$

It returns

! Missing $ inserted.<inserted text>$ Identiteten $ \textbf{a \cdot (a \times b)}

and lots of warnings like this:

! Extra }, or forgotten $.\textdef@ ...th {#1}\let \f@size 
#2\selectfont #3}}        Identiteten $ \textbf{a \cdot (a \times b)}

What is wrong with my code?

2

2 Answers 2

5

You're using the wrong markup: surround each variable by \mathbf:

$\mathbf{a} \cdot (\mathbf{a} \times \mathbf{b})$

Better yet, define a macro for your vectors:

\documentclass{article}
\usepackage{amsmath}

\newcommand{\vect}[1]{\mathbf{#1}}

\begin{document}

$\vect{a} \cdot (\vect{a} \times \vect{b})$

\end{document}

The result will be the same, but you have semantic markup, which is better and you'll know why when you'll need to modify how vectors are printed or to extend the definition for covering also Greek letters.

4

\textbf{} is meant for text mode only, i.e. non-math characters and symbols. To use a bold font (if really needed) \mathbf{} is to be used, for bold symbols like the \times \bm{} from bm package can be applied or the \boldmath command.

\documentclass{article}
\usepackage{bm}  % bold math 
\begin{document}
\begin{itemize}
\item Normal weight

$a \cdot (a \times b)$

\item Bold

$\mathbf{a \cdot (a \times b)}$

\item Bold symbols

$\mathbf{a \cdot (a \bm{\times} b)}$

\end{itemize}
\end{document}

enter image description here

If a and b are vectors, the dot product here is of course zero ;-)

3
  • Do you mind just adding one with bm at the outer level and no be inside, just for comparison. So the OP can see that bm actually gives bold italic
    – daleif
    Commented Sep 14, 2015 at 17:50
  • @daleif: No go ahead, although I wanted to restrict the \bm for the \times in this example, but... go ahead
    – user31729
    Commented Sep 14, 2015 at 17:52
  • Restricted to a tablet, so I cannot make the image
    – daleif
    Commented Sep 14, 2015 at 17:56

You must log in to answer this question.

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