# missing } error

Why doesn't this code compile?

\usepackage{tikz}
\begin{document}

We will let $P_2\textit{n}+1 = v_0v_1v_2…v_2\textit{n}$ be a path of
length $2\textit{n}+1$. We will plant an end vertex of a path $P_a$
of length \textit{a} to $v_4\textit{i}-3$ and an end vertex of a path
$P_\textit{a}+2$ of length $\textit{a}+2$ to $v_4\textit{i}-1$ for
$\textit{i}$ = $1,2,…,\textit{n}$.

\end{document}

• You are missing a \documentclass{...} command – Andrew Nov 1 '16 at 3:27
• You don't need TikZ, though. – cfr Nov 1 '16 at 3:29
• Why do you use \textit in math mode? Variables are set in italics by default in math – siracusa Nov 1 '16 at 4:39
• I don't get any compilation errors if I use the article document class. (Of course, one shouldn't be using \textit for math-mode material, but that doesn't generate a compilation error.) Which document class do you use? – Mico Nov 1 '16 at 6:13

\documentclass{article}

\begin{document}

We will let $P_{2n+1} = v_0v_1v_2 \dots v_{2n}$ be a path of length
$2n+1$. We will plant an end vertex of a path $P_a$ of length $a$ to
$v_{4i-3}$ and an end vertex of a path $P_{a+2}$ of length $a+2$ to
$v_{4i-1}$ for $i = 1, 2, \dots, n$.

\end{document}


• +1. I believe you identified the OP's issue, which was not a compilation error per se but, rather, a failure to use grouping to typeset the subscript terms correctly. (Separately, you also -- correctly! -- removed the \textit wrappers.) It would be useful if you wrote up in words what exactly you've done. – Mico Nov 1 '16 at 6:19

This one works fine:

\documentclass{article}

\begin{document}

We will let $P_2 n+1 = v_0v_1v_2…v_2 n$ be a path of
length $2n+1$. We will plant an end vertex of a path $P_a$
of length $a$ to $v_4i-3$ and an end vertex of a path
$P_a+2$ of length $a+2$ to $v_4i-1$ for
$i$ = $1,2,\ldots,n$.

\end{document}


By placing $..$ within the math equations will be italic mode. So you do not need \textit{}