[Tex/LaTex] Missing $ inserted. \end{align}

equations

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{physics}

\begin{align}
    \Gamma_\textbf{P}(\textbf{r})=-\frac{2\pi}{m}\int \frac{\dd[3]{k}}{(2\pi)^3} e^{-i\textbf{k\vdot\textbf{r}}}f_p(\textbf{k})
    \end{align}

\nocite{}
\bibliographystyle{}
\bibliography{hafiz}
\end{document}

The output is fine but giving lot of same error message. Please help

Best Answer

Your problem arises from the misuse of \textbf in the first subscript: as @Zarko pointed out, for it to work, instead of \Gamma_\textbf{P} you could use \Gamma_{\textbf{P}}. Nevertheless this is not recommended, since textbf is a text command. In order to have bold text in math mode you'd better use:

  • mathbf which uses an upright bold math font, or

  • \usepackage{bm} and then the bm command, which gives an italic bold math font

  • mix and match the two.

Also, is quite pointless to have an align environment without alignments. I substituted it with a plain equation.

Example with mathbf

\documentclass{article}
\usepackage{amsmath} 
\usepackage{amsfonts}
 \usepackage{amssymb} 
 \usepackage{makeidx} 
 \usepackage{graphicx} 
 \usepackage{physics} 
\begin{document}
\begin{equation}
\Gamma_\mathbf{P}(\mathbf{r})=-\frac{2\pi}{m}\int \frac{\dd[3]{k}}{(2\pi)^3} e^{-i\mathbf{k\cdot\mathbf{r}}}f_p(\mathbf{k})
\end{equation}
\end{document}

enter image description here

Example with bm

\documentclass{article}
\usepackage{amsmath} 
\usepackage{amsfonts}
 \usepackage{amssymb} 
 \usepackage{makeidx} 
 \usepackage{graphicx} 
 \usepackage{physics} 
 \usepackage{bm}
\begin{document}
\begin{equation}
\Gamma_{\bm{P}}(\bm{r})=-\frac{2\pi}{m}\int \frac{\dd[3]{k}}{(2\pi)^3} e^{-i\bm{k\cdot\bm{r}}}f_p(\bm{k})
\end{equation}
\end{document}

enter image description here