[Tex/LaTex] Using \textbf vs. \mathbf in Math mode


Is there any preference for using \textbf or \mathbf in math mode; or \textbf works exactly the same as \mathbf in math mode? I know for example, the \textit does not work in some cases in math mode, e.g. $\textit{text1^{text2}}$ gives an error, but $\mathit{text1^{text2}}$ is valid. On the other hand, \textcolor is "usually" a better choice than \color in math mode [Ref: This post]

Best Answer

Spaces are ignored in the arguments of \mathbf and \mathit, but not in the arguments of \textbf and \textit.

enter image description here

Also, you can't combine \mathbf and \mathit. E.g., \mathbf{\mathit{xyz}} produces xyz rather than xyz.

And, of course, the outputs of \mathbf and \textbf will differ if you use different fonts for math-mode and text-mode material.

$\textbf{abc def}$ 

$\mathbf{abc def}$

$\textit{abc def}$

$\mathit{abc def}$
Related Question