0

Consider two LaTeX files.

The first (test1.tex):

\documentclass[12pt]{article}

% extra packages
\usepackage[margin=0.5in]{geometry}
\usepackage{expex}
\usepackage{polyglossia}
\usepackage{setspace}

% dimensions
\newlength{\defparindent}
\setlength{\defparindent}{\parindent}
\setlength{\parindent}{0pt}

% custom ling styles
\definelingstyle{Text}{aboveexskip=0pt,belowexskip=0pt,
  belowglpreambleskip=0pt,aboveglftskip=0pt,glwordalign=center,
  glftpos=right,glhangstyle=none,ssratio=.60,
  everygla=\arabicfont\Large,everyglb=\englishfont\normalsize,
  everyglft=\englishfont\normalsize}

% font
\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\newfontfamily\englishfont{Linux Libertine Display O}


\pagestyle{empty}

\setmainlanguage{english}
\setotherlanguage{arabic}

\begin{document}

\onehalfspacing
\exdisplay[lingstyle=Text]
\begin{Arabic}
\begingl
\gla
عائِلَةُ مازِن نَجّار
//
\glb
\textenglish{nuclear family} Mazen Najjar
//
\glft
\textenglish{Mazen Najjar's Family}
//
\endgl
\end{Arabic}

\end{document}

The second (test2.tex):

\documentclass[12pt]{article}

% extra packages
\usepackage[margin=0.5in]{geometry}
\usepackage{expex}
\usepackage{polyglossia}
\usepackage{setspace}

% dimensions
\newlength{\defparindent}
\setlength{\defparindent}{\parindent}
\setlength{\parindent}{0pt}

% custom ling styles
\definelingstyle{Text}{aboveexskip=0pt,belowexskip=0pt,
  belowglpreambleskip=0pt,aboveglftskip=0pt,glwordalign=center,
  glftpos=right,glhangstyle=none,ssratio=.60,
  everygla=\arabicfont\Large,everyglb=\englishfont\normalsize,
  everyglft=\englishfont\normalsize}

% font
\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\newfontfamily\englishfont{Linux Libertine Display O}


\pagestyle{empty}

\setmainlanguage{english}
\setotherlanguage{arabic}

\begin{document}

\onehalfspacing
\exdisplay[lingstyle=Text]
\begin{Arabic}
\begingl
\gla
عائِلَةُ مازِن نَجّار
//
\glb
\textenglish{nuclear family} Mazen Najjar
//
\glft
\begin{english}
Mazen Najjar's Family
\end{english}
//
\endgl
\end{Arabic}

\end{document}

Looking at the differences with GNU diff:

  $ diff -u test1.tex test2.tex
--- test1.tex   2017-03-11 23:55:32.914015840 -0600
+++ test2.tex   2017-03-11 23:55:37.630039225 -0600
@@ -41,7 +41,9 @@
 \textenglish{nuclear family} Mazen Najjar
 //
 \glft
-\textenglish{Mazen Najjar's Family}
+\begin{english}
+Mazen Najjar's Family
+\end{english}
 //
 \endgl
 \end{Arabic}

Both files produce different output. Why?

Output of test1.tex: enter image description here

Output of test2.tex: enter image description here

2
  • 2
    \textenglish{text} essentially does \foreignlanguage{english}{text}, whereas \begin{english}text\end{english} does \begin{otherlanguage}{english}text\end{otherlanguage}; thus they are supposed to do different things.
    – egreg
    Mar 12, 2017 at 9:52
  • What accounts for the difference in vertical and horizontal spacing? The "Mazen Najjar's Family" text in the test1.tex output is aligned vertically just the way I want (i.e. the base of the line matches up with the Arabic. It seems that when I use \begin{english}..\end{english} or \begin{center}..\end{center} or \begin{flushright}...\end{flushright}, it throws the vertical alignment off. Wondering how to undo this. Mar 13, 2017 at 18:52

1 Answer 1

1

To get what you want in test1.tex, just add \raggedleft to your custom lingstyle under everyglft.

% custom ling styles
\definelingstyle{Text}{aboveexskip=0pt,belowexskip=0pt,
  belowglpreambleskip=0pt,aboveglftskip=0pt,glwordalign=center,
  glftpos=right,glhangstyle=none,ssratio=.60,
  everygla=\arabicfont\Large,everyglb=\englishfont\normalsize,
  everyglft=\englishfont\normalsize\raggedleft}

enter image description here

You must log in to answer this question.

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