0

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}
4
  • 1
    You are missing a \documentclass{...} command
    – user30471
    Commented Nov 1, 2016 at 3:27
  • You don't need TikZ, though.
    – cfr
    Commented Nov 1, 2016 at 3:29
  • 1
    Why do you use \textit in math mode? Variables are set in italics by default in math
    – siracusa
    Commented Nov 1, 2016 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
    Commented Nov 1, 2016 at 6:13

2 Answers 2

3
\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}

enter image description here

1
  • 1
    +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
    Commented Nov 1, 2016 at 6:19
1

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{}

You must log in to answer this question.

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