1
\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

3
  • 2
    Welcome to LaTeX! Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem.
    – Moriambar
    May 17, 2017 at 20:42
  • %\usepackage[latin1]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{makeidx} \usepackage{graphicx} \usepackage{physics} I have used these
    – Hafeez
    May 17, 2017 at 20:44
  • please edit the question, do not post it in the comments
    – Moriambar
    May 17, 2017 at 20:45

2 Answers 2

3

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

2
  • 2
    I disagree. Problem is error in writing of sub script with \textbf{...} . Instead of \Gamma_\textbf{P} should be \Gamma_{\textbf{P}} . However, use of \textbf{...} in maths expresion is not right way. It should be replaced - as you mentioned in answer -- by mathbf, etc.
    – Zarko
    May 17, 2017 at 21:02
  • @Zarko I'll correct the answer right away
    – Moriambar
    May 17, 2017 at 21:04
2

You don't want \textbf for vectors, but \vec. “Wait!” you'll say, “I don't want vectors with an arrow above their head!”

Don't worry! Neither do I!

What I mean is that you should use a semantic command for your objects and \vec is a good choice.

The main problem in your code is \textbf{v\vdot\textbf{r}}: \textbf starts text mode, and \vdot is only valid in math mode. Anyway, also

\mathbf{v\vdot\mathbf{r}}

is wrong and should be \mathbf{v}\vdot\mathbf{r}. Better yet, use \vec (or other semantic command named as you prefer) like below.

\documentclass[12pt,a4paper]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bm}% for the second choice
\usepackage{physics}

\renewcommand{\vec}[1]{\mathbf{#1}}
%\renewcommand{\vec}[1]{\bm{#1}}

\begin{document}

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

\end{document}

By the way, a subscript should be braced, if it doesn't consist in a single letter or number (but bracing also these doesn't harm). Also align should not be used for single displayed equations.

enter image description here

Should you change your mind and decide that bold italic for vectors is better, just switch the comment sign % and enable

\renewcommand{\vec}[1]{\bm{#1}}

to get, upon rerunning LaTeX,

enter image description here

1
  • Nice explanation!
    – Zarko
    May 18, 2017 at 9:02

You must log in to answer this question.

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