# Why can't this table compile?

I had wrote following table in TexMaker, when I write it without \usepackage{xepersian} it works but when I want to compile it with that package too, program will hang! But I don't see any mistakes and my entries are these.

\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}‎‎
\usepackage{xepersian}‎
\settextfont[Scale=1]{XB Niloofar}‎‎
\title{A Table}
\begin{document}
‎\begin{flushleft}
‎\begin{tabular}{|l|l|l|l|l|l|}
\hline $\nabla_{X_{i}}X_{j}$ & $\Gamma_{i,j}^{2}$ & $\Gamma_{i,j}^{1}$ & k & j & i  \\
\hline $\frac{-1}{x_{2}}X_{2}$ & $‎\begin{array}{l} ‎\;‎ \\ \frac{-1}{x_{2}} \end{array}$‎‎ & $‎\begin{array}{l} - \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ \\
\hline $\frac{-1}{x_{2}}X_{1}‎‎$‎ & $‎\begin{array}{l} ‎\;‎ \\ - \end{array}$‎‎ & $‎\begin{array}{l} \frac{-1}{x_{2}} \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l}1 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ \\
\hline $\frac{-1}{x_{2}}X_{1}$ & $‎\begin{array}{l} ‎\;‎ \\ - \end{array}$‎‎ & $‎\begin{array}{l} \frac{-1}{x_{2}} \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 2 ‎‎\end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2 \end{array}$‎‎ \\
\hline $\frac{-3}{x_{2}}X_{2}$ & $‎\begin{array}{l} ‎\;‎ \\ \frac{-3}{x_{2}} \end{array}$‎‎ & $‎\begin{array}{l} - \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2\end{array}$‎‎ \\
\hline
\end{tabular} ‎
\end{flushleft}‎‎
\end{document}‎

-
@Kutt , thank you too. – AmirHosein SadeghiManesh Dec 21 '12 at 17:50
First of all remove the call to the inputenc package. Are you using XeLaTeX to compile the document when xepersian is loaded? – egreg Dec 21 '12 at 17:52
@egreg , yes I use XeLaTex, when I want to compile a tex that will use xe-packages. But about inputenc? – AmirHosein SadeghiManesh Dec 21 '12 at 18:01
The package inputenc should never be used with XeLaTeX. In your source there are many strange invisible characters, which may be the cause for the problem. If I use the Scheherazade font and remove the invisible characters, the table compiles. – egreg Dec 21 '12 at 18:03
@egreg , I had removed \usepackage[latin1]{inputnec} but my file doesn't work yet! and about invisible characters, I don't anything, all my file is above. – AmirHosein SadeghiManesh Dec 21 '12 at 18:07

As @egreg commented you have control characters in your preamble. If I convert the characters into Unicode names, you will see after most of your \usepackage lines you have BIDI controls. If you just delete the line and retype it just with the ascii characters then things work better. Also remove inputenc.

Note that they produces errors ie TeX should stop with a message. It then more or less hangs or at least takes ages looking for the font, so I changed it to Arial. The result is at the end.

LATIN SMALL LETTER U
LATIN SMALL LETTER S
LATIN SMALL LETTER E
LATIN SMALL LETTER P
LATIN SMALL LETTER A
LATIN SMALL LETTER C
LATIN SMALL LETTER K
LATIN SMALL LETTER A
LATIN SMALL LETTER G
LATIN SMALL LETTER E
LEFT CURLY BRACKET
LATIN SMALL LETTER A
LATIN SMALL LETTER M
LATIN SMALL LETTER S
LATIN SMALL LETTER S
LATIN SMALL LETTER Y
LATIN SMALL LETTER M
LATIN SMALL LETTER B
RIGHT CURLY BRACKET
LEFT-TO-RIGHT MARK
LEFT-TO-RIGHT MARK
LINE FEED (LF)
LINE FEED (LF)
REVERSE SOLIDUS
LATIN SMALL LETTER U
LATIN SMALL LETTER S
LATIN SMALL LETTER E
LATIN SMALL LETTER P
LATIN SMALL LETTER A
LATIN SMALL LETTER C
LATIN SMALL LETTER K
LATIN SMALL LETTER A
LATIN SMALL LETTER G
LATIN SMALL LETTER E
LEFT CURLY BRACKET
LATIN SMALL LETTER X
LATIN SMALL LETTER E
LATIN SMALL LETTER P
LATIN SMALL LETTER E
LATIN SMALL LETTER R
LATIN SMALL LETTER S
LATIN SMALL LETTER I
LATIN SMALL LETTER A
LATIN SMALL LETTER N
RIGHT CURLY BRACKET
LEFT-TO-RIGHT MARK
LINE FEED (LF)


\documentclass[12pt,a4paper]{article}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{xepersian}
%\settextfont[Scale=1]{XB Niloofar}‎‎
\settextfont{Arial}
\title{A Table}
\begin{document}
‎\begin{flushleft}
‎\begin{tabular}{|l|l|l|l|l|l|}
\hline $\nabla_{X_{i}}X_{j}$ & $\Gamma_{i,j}{2}$ & $\Gamma_{i,j}^{1}$ & k & j & i  \\
\hline $\frac{-1}{x_{2}}X_{2}$ & $‎\begin{array}{l} ‎\;‎ \\ \frac{-1}{x_{2}} \end{array}$‎‎ & $‎\begin{array}{l} - \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ \\
\hline $\frac{-1}{x_{2}}X_{1}‎‎$‎ & $‎\begin{array}{l} ‎\;‎ \\ - \end{array}$‎‎ & $‎\begin{array}{l} \frac{-1}{x_{2}} \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l}1 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ \\
\hline $\frac{-1}{x_{2}}X_{1}$ & $‎\begin{array}{l} ‎\;‎ \\ - \end{array}$‎‎ & $‎\begin{array}{l} \frac{-1}{x_{2}} \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 2 ‎‎\end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 1 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2 \end{array}$‎‎ \\
\hline $\frac{-3}{x_{2}}X_{2}$ & $‎\begin{array}{l} ‎\;‎ \\ \frac{-3}{x_{2}} \end{array}$‎‎ & $‎\begin{array}{l} - \\ ‎\;‎ \end{array}$‎‎ & $‎\begin{array}{l} 1 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2 \end{array}$‎‎ & $‎\begin{array}{l} 2 \\ 2\end{array}$‎‎ \\
\hline
\end{tabular} ‎
\end{flushleft}‎‎
\end{document}

-