0

I have the following equation.

\begin{equation}
\begin{split}
E_\textrm{el}&=\sum_{i}^{\textrm{occ.}}n_i\bra{\psi_i}H\ket{\psi_i}+\frac{1}{2}\sum_{\textrm{A,B}}^{}\sum_{l\textrm{(A)}}^{}\sum_{l'\textrm{(B)}}^{}p_l^\textrm{A}p_l'^\textrm{B}\gamma_{\textrm{AB,}ll'} \\
&+\frac{1}{3}\sum_{\textrm{A}}^{}\Gamma_\textrm{A}q_\textrm{A}^3-T_\textrm{el}S_\textrm{el}
\end{split}
\end{equation}

When I try to compile it, I get the following error.

! Missing } inserted.
<inserted text> 
                }
l.203 \end{split}

I've put in what seems to be necessary to fix
the current column of the current alignment.
Try to go on, since this might almost work.

! Extra }, or forgotten $.
<inserted text> }

l.203 \end{split}

I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.

I know this error occurs when I forget some curly brackets, but I checked the code many times and I cannot figure out where I am missing something.

Also, the error is very confusing. First, it adds a curly but in the next error it says extra curly. I don't get it...

1 Answer 1

3

You didn't provide a test file but you can simplify it to just using equation (for debugging, I realise I have destroyed any mathematical meaning in that simplification)

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\frac{1}{2}\sum_{\textrm{A,B}}^{}\sum_{l\textrm{(A)}}^{}\sum_{l'\textrm{(B)}}^{}p_l^\textrm{A}p_l'^\textrm{B}\gamma_{\textrm{AB,}ll'}
\end{equation}
\end{document}

which has the advantage that the error is reported where it is found, not at the end of the environment

! Missing { inserted.
<to be read again> 
                   }
l.5 ...'\textrm{(B)}}^{}p_l^\textrm{A}p_l'^\textrm
                                                  {B}\gamma_{\textrm{AB,}ll'}
? 

always brace superscripts (x^{\mathrm{xxx}} not x^\mathrm{xxx}) and using ' and ^ on the same base would be a double superscript error. Also it is better to use \mathrm as math variables should not depend on the current font before the expression.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\frac{1}{2}\sum_{\mathrm{A,B}}^{}\sum_{l\mathrm{(A)}}^{}\sum_{l'\mathrm{(B)}}^{}p_l^{\mathrm{A}}{p_l'}^{\mathrm{B}}\gamma_{\mathrm{AB,}ll'}
\end{equation}
\end{document}

You must log in to answer this question.

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