Help solving “double superscript”

Hi i keep having a double superscript in this part of mi latex document, may some of you help me finding it?

$K=\sum_{i}\frac{1}{2}m_{i}v_{i}^{2}=\sum_{i}\frac{1}{2}m_{i}(\vec{v'}_{i}+\vec{v_{cm}}) (\vec{v'}_{i}+\vec{v_{cm}})=\sum_{i}\frac{1}{2}m_{i}v'_{i}^{2}+ \frac{1}{2}(\sum_{i}m_{i}v'_{i})(\vec{v_{cm}})+ +\frac{1}{2}\vec{v_{cm}}(\sum_{i}m_{i}v'_{i})+\frac{1}{2} (\sum_{i}m_{i})\vec{v}_{cm}^{2}= =K'+\frac{1}{2}M\vec{v}_{cm}^{2}$
\\\textbf{Secondo}: $\vec{p}_{tot}=m\vec{v_{cm}}\quad\vec{p'}_{tot}=0\quad\vec{L}_{i}= =\vec{r}_{i}\times\vec{p}_{i}= =(\vec{r}'_{i}+\vec{r}_{cm})\times m_{i}(\vec{v'}_{i}+ +\vec{v_{cm}})\quad\vec{L}_{tot}=\sum\vec{L}_{i}=\sum\vec{r}'_{i}\times m_{i}\vec{v'}_{i}+ +\sum\vec{r}_{cm}\times m_{i}\vec{v'}_{i}+\sum\vec{r}'_{i}\times m_{i}\vec{v}_{cm}+ \vec{r}_{cm}\times\sum m_{i}\vec{v}_{cm}$

• Welcome to TeX SX! Could you post a full compilable code? – Bernard Sep 11 '17 at 10:44

The prime is a superscript; you can just move the subscript earlier

v_{i}'^{2}


because LaTeX will not run in the problem, since it knows how to manage this kind of construction.

With the input v'_{i}^{2}, the superscripts are separated by the subscript and so the error ensues.

Having \vec{v}'_{i}^{2} is immaterial and the solution is the same, but see How to typeset a primed vector for help in priming arrowed vectors.

The log file points to the fatal error...

Since ' is a superscripted quantity, v'^{} is a double superscript. This problem can be alleviated by grouping the v' in braces:

\documentclass{article}
\begin{document}
%$v'_{i}^{2}$ % DOUBLE SUPERSCRIPT
${v'}_{i}^{2}$
\end{document}


Fixing that one construction allows the, dare I say, unsightly result to compile in its full g[l]ory.

• \smash[t]{v'}_{i}^{2} would look nicer, in my opinion. – Bernard Sep 11 '17 at 11:52
• @Bernard that's a nice variant, though I see your esvect solution looks rather more like my own attempt. – Steven B. Segletes Sep 11 '17 at 11:58
• Do you mean the displayed equations rather than inline maths? – Bernard Sep 11 '17 at 12:17
• I mean the first v'^2 near the beginning of the 2nd line of your output. By the way, egreg of course can get the same result with his sleight of hand, just by switching the order of the scripts. – Steven B. Segletes Sep 11 '17 at 12:20
• Well I thought of this looking at your solution (it's always easier to see how to improve other people's solutions ;o)). But I've fixed it now. In the place of using \smash[t], one also may code v_{i}^{\prime 2}. – Bernard Sep 11 '17 at 12:27

In TeX, in math mode prime symbol is considered as in superscript position by default, so this error was produced, please use the updated code below:

$K=\sum_{i}\frac{1}{2}m_{i}v_{i}^{2}=\sum_{i}\frac{1}{2}m_{i}(\vec{v'}_{i}+\vec{v_{cm}}) (\vec{v'}_{i}+\vec{v_{cm}})=\sum_{i}\frac{1}{2}m_{i}v^{\prime2}_{i}+ \frac{1}{2}(\sum_{i}m_{i}v'_{i})(\vec{v_{cm}})+ +\frac{1}{2}\vec{v_{cm}}(\sum_{i}m_{i}v'_{i})+\frac{1}{2} (\sum_{i}m_{i})\vec{v}_{cm}^{2}= =K'+\frac{1}{2}M\vec{v}_{cm}^{2}$
\\\textbf{Secondo}: $\vec{p}_{tot}=m\vec{v_{cm}}\quad\vec{p'}_{tot}=0\quad\vec{L}_{i}= =\vec{r}_{i}\times\vec{p}_{i}= =(\vec{r}'_{i}+\vec{r}_{cm})\times m_{i}(\vec{v'}_{i}+ +\vec{v_{cm}})\quad\vec{L}_{tot}=\sum\vec{L}_{i}=\sum\vec{r}'_{i}\times m_{i}\vec{v'}_{i}+ +\sum\vec{r}_{cm}\times m_{i}\vec{v'}_{i}+\sum\vec{r}'_{i}\times m_{i}\vec{v}_{cm}+ \vec{r}_{cm}\times\sum m_{i}\vec{v}_{cm}$


Here, I modified v'_{i}^{2} to v^{\prime2}_{i}

This is due to v'_{i}^{2}.

I can propose this, using the vector arrows from esvect:

\documentclass{article}
\usepackage{geometry}%
\usepackage{mathtools, nccmath}
\usepackage[b]{esvect}

\begin{document}

\begin{align*} K & =∑_{i}\mfrac{1}{2}m_{i}v_{i}^{2}=∑_{i}\mfrac{1}{2}m_{i}(\vv*{v}{\!i}'+\vv*{v}{\!cm})
(\vv*{v}{\!i}'+\vv*{v}{\!cm}) \\
& = ∑_{i}\mfrac{1}{2}m_{i}{v'_{i}}^{2}+
\mfrac{1}{2}\bigl(∑_{i}m_{i}v'_{i}\bigr)(\vv*{v}{\!cm})
+\mfrac{1}{2}\vv*{v}{\!cm}(∑_{i}m_{i}v'_{i})+\mfrac{1}{2}
\bigl(∑_{i}m_{i}\bigr)\vv*{v}{\!cm}^{2}
=K'+\mfrac{1}{2}M\vv*{v}{\!cm}^{2}
\end{align*}
\textbf{Secondo}: \begin{align*}