Help with Interlinear RTL Text (Persian/Farsi and English)

I'm trying to create an interlinear text that interleaves Farsi (Persian) and English but am having a couple of problems: 1) The interlinear portion of it seems to work but the actual Persian text doesn't display (middle line of squares in image below). 2) The "free translation" changes the English text into Persian characters.

I'm using TexWorks and XeLaTeX. Thanks!

% !TEX TS-program =XeLaTeX
% !TEX encoding = UTF-8

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{farsi}

\usepackage{fontspec}
\newfontfamily\englishfont[Mapping=tex-text]{Latin Modern Roman}
\newfontfamily\farsifont{Pars Ziba - Draft}

\usepackage{xepersian}
\settextfont{Pars Ziba - Draft}
\setlatintextfont{Latin Modern Roman}

\usepackage{expex}
\lingset{everygla=\englishfont\beginL\footnotesize\it, everyglc=\englishfont\beginL\footnotesize}

\begin{document}

\begin{farsi}
\ex [everyglft=\englishfont\beginL\footnotesize\sc]
\begingl
\gla dar ebtedâ Khodâ âsemân-hâ vah zamin râ .âfarid //
\glb در ابتدا، خدا آسمانها و زمین‌ را آفرید //
\glc In beginning God heavens and earth {*} created//
\glft
In the beginning God created the heavens and the earth.//
\endgl\xe
\end{farsi}

\end{document}


In order to get polyglossia to properly switch between fonts, you should specify the script that each font will be used for. Adding Script=Arabic to the selection of Farsi font fixed the problem for me. For more information, see the polyglossia manual.

Here is my version of your code, although I don't have your fonts installed, so I used Times New Roman and Arial. That means that I can't rule out potential problems with the Farsi font you're using.

For your free translation, since it's English, you should tell polyglossia that, by using \textenglish{...}.

% !TEX TS-program =XeLaTeX
% !TEX encoding = UTF-8

\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{farsi}

\usepackage{fontspec}
\newfontfamily\englishfont[Script=Latin,Mapping=tex-text]{Times New Roman}
\newfontfamily\farsifont[Script=Arabic]{Arial}

\usepackage{xepersian}
\settextfont{Arial}
\setlatintextfont{Times New Roman}

\usepackage{expex}
\lingset{everygla=\englishfont\beginL\footnotesize\it, everyglc=\englishfont\beginL\footnotesize}

\begin{document}

\begin{farsi}
\ex [everyglft=\englishfont\beginL\footnotesize\sc]
\begingl
\gla dar ebtedâ Khodâ âsemân-hâ vah zamin râ .âfarid //
\glb در ابتدا، خدا آسمانها و زمین‌ را آفرید //
\glc In beginning God heavens and earth {*} created//
\glft
\textenglish{In the beginning God created the heavens and the earth.}//
\endgl\xe
\end{farsi}

\end{document}


This is the output that I get:

I suggest looking at the ArabTeX package instead of using direct input to polyglossia. It has the immense advantage to create transliteration and original Persian in Arabic script from the same source. The documentation has examples of interlinear text.

• I would strongly recommend avoiding that package and, instead, to use direct unicode input with LuaLaTeX (or XeLaTeX). – ClintEastwood Mar 5 '16 at 8:24
• @ClintEastwood: You are aware of the fact, that ArabTeX also supports utf-8 input? – jknappen Mar 5 '16 at 9:55
• yes, but I still do not see any reason for using it. – ClintEastwood Mar 5 '16 at 9:58