2

I'm using the interlinear text model here described in Doing an interlinear text, but for other purposes I want to write a interlinear Arabic / Russian Text, but I don't understand why my code doesn't run.

I can not put the Arabic text in the XeLaTeX file.

Here is the code:

\documentclass[11pt]{book}
\usepackage[margin=1in]{geometry}
\usepackage{titlesec}
\usepackage{polyglossia}
\defaultfontfeatures{Ligatures=TeX}
\setmainlanguage{brazil}
\setotherlanguage[variant=ancient]{greek}
\setotherlanguage[arabic]
\setmainfont{Linux Libertine O}
\usepackage{expex}
\usepackage{hologo}

\usepackage{fontspec}
\titleformat{\chapter}[display]
{\normalfont\filcenter}
 {\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
 {1pc}
 {\vspace{1pc}%
   \LARGE}
\titlespacing{\chapter}
{0pt}{0pt}{10pt}

\titleformat{\section}[leftmargin]
 {\normalfont
  \vspace{0pt}%
   \bfseries\Large\filleft}
{\thesection}{.5em}{} 
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{0pt}

\renewcommand{\thesection}{\arabic{chapter}:\arabic{section}}

\lingset{glhangstyle=none}
\begin{document}
\setcounter{chapter}{1}
\chapter{O sonhou Nabucodonsor}
\section{}
\begingl
\gla  \begin{Arabic}
هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن الترك
\end{Arabic}//

\glb {εν τω} έτει τω δευτέρω της βασιλείας Ναβουχοδονόσορ ενυπνιάσθη Ναβουχοδονόσορ
     ενύπνιον και εξέστη το πνεύμα αυτού και ο {ύπνος αυτού} {εγένετο απ 'αυτού}//

\glc No ano {} segundo do reinado {de Nabucodonosor} sonhou Nabucodonsor
    {um sonho,} e desconcertou-se o espirito dele, e o {sono dele} {se lhe fugiu.}//
\endgl
\section{}
\begingl
\gla это текст-"рыба", часто используемый в печати и вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на латинице с начала XVI века.//

\glb  και  είπεν  ο  βασιλεύς  καλέσαι  τονς  επαοιδούς  και  τονς  μάγους  και
     τονς  φαρμακούς   και  τονς  Χαλδαίούς   τον   αναγγείλαι   τω   βασιλεί
     τα {ενύπνια αυτού}  και  ήλθον  και  έστησαν  ενώπιον  του  βασιλεύς //

\glc  E  mandou   o   rei   chamar   os   encantadores,   e   os  magos,   e 
     os  {ministradores de poções,}  e  os   Caldeus,   para  anunciar   ao  rei 
    {as \emph{coisas}} {dos sonhos dele.}   e  vieram  E  {postaram-se}  diante
    de  rei//
\endgl


\end{document}
3

Since you need to have your \gla lines be in Arabic and you want those lines to be set RTL, it's best to set the whole example in an {Arabic} environment, and then make the other gloss lines to use the correct font for those lines. Here's a fully worked out example. (You may need to change fonts to ones you have to get this to compile.)

I've also added some spacing to the section formatting so that the number is not so close to the beginning of the line.

% !TEX TS-program = XeLaTeX

\documentclass[11pt]{book}
\usepackage[margin=1in]{geometry}
\usepackage{titlesec}
\usepackage{polyglossia}
\defaultfontfeatures{Ligatures=TeX}
\setmainlanguage{brazil}
\setotherlanguage[variant=ancient]{greek}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic]{Scheherazade}
\newfontfamily\greekfont{Linux Libertine O}
\newfontfamily\brazilfont{Linux Libertine O}
\setmainfont{Linux Libertine O}
\usepackage{expex}
\usepackage{hologo}


\titleformat{\chapter}[display]
{\normalfontlatin\filcenter}
 {\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
 {1pc}
 {\vspace{1pc}%
   \LARGE}
\titlespacing{\chapter}
{0pt}{0pt}{10pt}

\titleformat{\section}[leftmargin]
 {\normalfont
  \vspace{0pt}%
   \bfseries\Large\filleft}
{\thesection}{.5em}{} 
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{10pt}

\renewcommand{\thesection}{\arabic{chapter}:\arabic{section}}

\lingset{glhangstyle=none,everygla=\arabicfont,everyglb=\greekfont, everyglc=\brazilfont}
\begin{document}
\setcounter{chapter}{1}
\chapter{O sonhou Nabucodonsor}
\section{}
\begin{Arabic}
\begingl
\gla 
هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن الترك
//

\glb {εν τω} έτει τω δευτέρω της βασιλείας Ναβουχοδονόσορ ενυπνιάσθη Ναβουχοδονόσορ
     ενύπνιον και εξέστη το πνεύμα αυτού και ο {ύπνος αυτού} {εγένετο απ 'αυτού}//

\glc No ano {} segundo do reinado {de Nabucodonosor} sonhou Nabucodonsor
    {um sonho,} e desconcertou-se o espirito dele, e o {sono dele} {se lhe fugiu.}//
\endgl
\end{Arabic}
\end{document}

output of code

1

Here some remarks on your code

  • Package polyglossia call Package fontspec by default, so you can remove \usepackage{fontspec}.

  • \setotherlanguage{arabic} instead of \setotherlanguage[arabic].

  • You must define font which contain arabic script with \newfontfamily\arabicfont[Script=Arabic]{name_of_font}

  • Use \textarabic{arabic-text} rather then Arabic environment which produce extra space after \end{Arabic}.


Code

\documentclass[11pt]{book}
\usepackage[margin=1in]{geometry}
\usepackage{titlesec}
\usepackage{polyglossia}
\defaultfontfeatures{Ligatures=TeX}
\setmainlanguage{brazil}
\setotherlanguage[variant=ancient]{greek}
\setotherlanguage{arabic}
\newfontfamily\arabicfont[Script=Arabic]{Amiri}
\setmainfont{Linux Libertine O}
\usepackage{expex}
\usepackage{hologo}


\titleformat{\chapter}[display]
{\normalfont\filcenter}
 {\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
 {1pc}
 {\vspace{1pc}%
   \LARGE}
\titlespacing{\chapter}
{0pt}{0pt}{10pt}

\titleformat{\section}[leftmargin]
 {\normalfont
  \vspace{0pt}%
   \bfseries\Large\filleft}
{\thesection}{.5em}{} 
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{0pt}

\renewcommand{\thesection}{\arabic{chapter}:\arabic{section}}

\lingset{glhangstyle=none}
\begin{document}
\setcounter{chapter}{1}
\chapter{O sonhou Nabucodonsor}
\section{}
\begingl
\gla 
 \textarabic{
هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن الترك
}//

\glb {εν τω} έτει τω δευτέρω της βασιλείας Ναβουχοδονόσορ ενυπνιάσθη Ναβουχοδονόσορ
     ενύπνιον και εξέστη το πνεύμα αυτού και ο {ύπνος αυτού} {εγένετο απ 'αυτού}//

\glc No ano {} segundo do reinado {de Nabucodonosor} sonhou Nabucodonsor
    {um sonho,} e desconcertou-se o espirito dele, e o {sono dele} {se lhe fugiu.}//
\endgl
\section{}
\begingl
\gla это текст-"рыба", часто используемый в печати и вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на латинице с начала XVI века.//

\glb  και  είπεν  ο  βασιλεύς  καλέσαι  τονς  επαοιδούς  και  τονς  μάγους  και
     τονς  φαρμακούς   και  τονς  Χαλδαίούς   τον   αναγγείλαι   τω   βασιλεί
     τα {ενύπνια αυτού}  και  ήλθον  και  έστησαν  ενώπιον  του  βασιλεύς //

\glc  E  mandou   o   rei   chamar   os   encantadores,   e   os  magos,   e 
     os  {ministradores de poções,}  e  os   Caldeus,   para  anunciar   ao  rei 
    {as \emph{coisas}} {dos sonhos dele.}   e  vieram  E  {postaram-se}  diante
    de  rei//
\endgl


\end{document}
  • But now the enviroment of interlinear text do not work, the russian text was put interlinear with the others, but the arabic not, why I can write the arabic with this enviroment? Your command consider all the arabic text as 1 block, and do not put a word-by-word translation. Thanks a lot! – Gergian Jul 2 '16 at 14:09
0

maybe like this

\documentclass[11pt]{book}
\usepackage[margin=1in]{geometry}
\usepackage{titlesec}

\usepackage{fontspec}
%\defaultfontfeatures{Ligatures=TeX}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\newfontfamily\arabicfont[Script=Arabic,Mapping=arabicdigits]{Amiri}

\usepackage{polyglossia}
\setmainlanguage{brazil}
\setotherlanguage[variant=ancient]{greek}
\setotherlanguage{arabic}

\usepackage{expex}
\usepackage{hologo}

\titleformat{\chapter}[display]
{\normalfont\filcenter}
 {\LARGE\MakeUppercase{\chaptertitlename} \thechapter}
 {1pc}
 {\vspace{1pc}%
   \LARGE}
\titlespacing{\chapter}
{0pt}{0pt}{10pt}

\titleformat{\section}[leftmargin]
 {\normalfont
  \vspace{0pt}%
   \bfseries\Large\filleft}
{\thesection}{.5em}{} 
\titlespacing{\section}
{4pc}{1.5ex plus .1ex minus .2ex}{0pt}

\renewcommand{\thesection}{\arabic{chapter}:\arabic{section}}

\lingset{glhangstyle=none}
\begin{document}
\setcounter{chapter}{1}
\chapter{O sonhou Nabucodonsor}
\section{}
\begingl
%\gla
%\begin{Arabic}
%هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن الترك
%\end{Arabic}//
\gla{\RL{\textarabic{
    هناك حقيقة مثبتة منذ زمن طويل وهي أن المحتوى المقروء لصفحة ما سيلهي القارئ عن الترك
}}}//

\glb {εν τω} έτει τω δευτέρω της βασιλείας Ναβουχοδονόσορ ενυπνιάσθη Ναβουχοδονόσορ
     ενύπνιον και εξέστη το πνεύμα αυτού και ο {ύπνος αυτού} {εγένετο απ 'αυτού}//

\glc No ano {} segundo do reinado {de Nabucodonosor} sonhou Nabucodonsor
    {um sonho,} e desconcertou-se o espirito dele, e o {sono dele} {se lhe fugiu.}//
\endgl
\section{}
\begingl
\gla это текст-"рыба", часто используемый в печати и вэб-дизайне. Lorem Ipsum является стандартной "рыбой" для текстов на латинице с начала XVI века.//

\glb  και  είπεν  ο  βασιλεύς  καλέσαι  τονς  επαοιδούς  και  τονς  μάγους  και
     τονς  φαρμακούς   και  τονς  Χαλδαίούς   τον   αναγγείλαι   τω   βασιλεί
     τα {ενύπνια αυτού}  και  ήλθον  και  έστησαν  ενώπιον  του  βασιλεύς //

\glc  E  mandou   o   rei   chamar   os   encantadores,   e   os  magos,   e 
     os  {ministradores de poções,}  e  os   Caldeus,   para  anunciar   ao  rei 
    {as \emph{coisas}} {dos sonhos dele.}   e  vieram  E  {postaram-se}  diante
    de  rei//
\endgl

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.