3

I want to place the Persian translation of quran package =\quransurahfa*[1] right below the original text=\quransurah*[1] of this code :

\documentclass[b5paper,11pt]{memoir}
\usepackage[left=1.8cm,right=1.8cm,top=3cm]{geometry}
\usepackage{arabxetex}
\usepackage[trans=fa]{quran}
\usepackage{xepersian}
\settextfont[Scale=0.7]{Yas}

\newfontfamily\Amiri[Script=Arabic]{Amiri}


\begin{document}
\begin{arab}
\noindent\Amiri\quransurah*[1]
\end{arab}
\noindent
\quransurahfa*[1]
\end{document}

which produces : enter image description here

to appear like this:

enter image description here

2 Answers2

2

Here's an attempt at doing this with the expex package which is especially for linguistics.

Updated answer using \quranayah

You can use \quranayah[1][1] to insert each ayah. The problem is that the whole ayah is placed in a box which can't be broken across lines. So if you leave things justified you will get ugly overfull or underfull boxes everywhere. You could also try using \raggedleft but this doesn't look great either. My best option is to use a combination of \quranayah and manually broken lines as shown in the following MWE. I've adjusted a few other spacing settings to improve the output.

MWE

\documentclass{article}
\usepackage{xepersian}
\settextfont{Yas}

\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\usepackage[trans=fa]{quran}
\usepackage{expex}
\makeatletter
\lingset{%
  everygl=\def\qt@no##1{ \hfill ##1},
  everygla=\arabicfont\large\rule{0pt}{5ex},
  everyglb=\footnotesize,
  glrightskip=0pt,
  glhangstyle=none,
  glspace=.5em plus 3em minus .15em
}
\makeatother

\pagestyle{empty}
\begin{document}

\begingl
  \gla
    \quranayah*[1][1]
    \quranayah*[1][2]
    \quranayah*[1][3]
    \quranayah*[1][4]
    \quranayah*[1][5]
    {اهدِنَا الصِّراطَ} {المُستَقيمَ \hfill ﴿٦﴾}
    \quranayah*[1][7]
    //
  \glb
    \quranayahfa*[1][1]
    \quranayahfa*[1][2]
    \quranayahfa*[1][3]
    \quranayahfa*[1][4]
    \quranayahfa*[1][5]
    {ما را به راه راست} {هدايت فرما، \hfill (6)}
    \quranayahfa*[1][7]
    //
\endgl

\end{document}

MWE output

Original answer

Sorry that I've probably lined up the words wrong as I don't understand Arabic or Persian.

One issue is that I'm having trouble changing the line spacing. It seems to be the same issue as here. I've used the same work-around as in that question.

There are lots of options for controlling these structures in expex. Have a look at §9 of the manual.

MWE

I used the Qur'an text and Farsi translation from qurantext-simple.def and qurantext-fa.translation.def respectively.

I gave up at ayah 5 because ayah 6 was too confusing for me to decide what should go under what :).

I was unable to get it working with the quran package for the text. I think this is because \quransurah is not expandable.

\documentclass{article}
\usepackage{xepersian}
\settextfont{Yas}

\newfontfamily\arabicfont[Script=Arabic]{Amiri}

\usepackage{expex}
\lingset{everygla=\arabicfont\large\rule{0pt}{25pt}, everyglb=\footnotesize,
  glwordalign=center}

\begin{document}

\begingl
  \gla بِسمِ اللَّهِ الرَّحمٰنِ الرَّحيمِ ۝١
    الحَمدُ لِلَّهِ رَبِّ العالَمينَ ۝٢
    الرَّحمٰنِ الرَّحيمِ ۝٣
    مالِكِ يَومِ الدّينِ ۝٤
    إِيّاكَ نَعبُدُ وَإِيّاكَ نَستَعينُ ۝٥
    //
  \glb {به نام} خداوند رحمتگر مهربان (١)
    ستايش خدايى {را كه پروردگار} جهانيان، (٢)
    رحمتگر مهربان، (٣)
    {[و] خداوند} روز جزاست. (٤)
    {[بار الها] تنها تو را} مى‌پرستيم، {و تنها از تو يارى} مى‌جوييم. (٥)
    //
\endgl

\end{document}

MWE output

David Purton
  • 25,884
1

Here is an answer. (i don't have Yas font so Amiri is used for both Arabe and Persian).

\documentclass[b5paper,11pt]{memoir}
\usepackage[left=1.8cm,right=1.8cm,top=3cm]{geometry}
\usepackage{arabxetex}
\usepackage[trans=fa]{quran}
\usepackage{xepersian}
\settextfont[Scale=.7]{Amiri}

\newfontfamily\Amiri[Script=Arabic]{Amiri}

\newif\ifwecanrepeat
\newsavebox\quranar
\newsavebox\quranfr
\newsavebox\qurantemp

\makeatletter 
\newcommand{\quransurahAF}[1][\qt@surah@default]{%
\setbox\quranar=\vbox{%
  \begin{arab}
    \noindent\Amiri\quransurah*[#1]
  \end{arab}}%
\setbox\quranfr=\vbox{%
  \noindent
  \quransurahfa*[#1]}%
\loop
  \ifvoid\quranar
    \wecanrepeatfalse\unvbox\quranfr
  \else\ifvoid\quranfr
    \wecanrepeatfalse\unvbox\quranar
  \else
    \wecanrepeattrue
    \setbox\qurantemp=\vsplit\quranar to \baselineskip \unvbox\qurantemp
    \setbox\qurantemp=\vsplit\quranfr to \baselineskip \unvbox\qurantemp
  \fi\fi
\ifwecanrepeat\repeat}
\makeatother

\begin{document}
\quransurahAF[97]
\end{document}
touhami
  • 19,520
  • Dear @touhami, usually the number of characters of the translated text exceed the original one, so they wont end at the same time (especially for long texts e.g. \quransurahAF[2] in the code) . Do you think is it possible to have the numbers placed below each other? – Alireza Farhadi K. Jun 01 '19 at 13:50
  • @AlirezaFarhadiK. Sorry, but no. – touhami Jun 01 '19 at 16:13