1

This question is based on my previous question, List labels on left with Arabic using Polyglossia, however, it can be read by itself as well.

NOTE: You will have to use XeLaTeX and probably change the Arabic font if you are not using Windows.

I have the following MWE,

\documentclass{article}
\usepackage{lipsum}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[numerals=maghrib]{arabic}

\newfontfamily\arabicfont[
Script=Arabic,%
Scale=1.5%
]{Traditional Arabic}

\newenvironment{Arabicitem}{\begin{minipage}{\linewidth}\begin{Arabic}}
{\end{Arabic}\end{minipage}}

\begin{document}
\begin{enumerate}
\item \parbox[t][][t]{\linewidth}{\lipsum[1]}
\end{enumerate}

\begin{enumerate}
  \def\labelenumi{\arabic{enumi}.}
  \item
  \begin{Arabicitem}اللَّهُمَّ بَاعِدْ بَيْنِي وَبَيْنَ خَطَايَايَ، كَمَا بَاعَدْتَ بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ، اللَّهُمَّ نَقِّنِي مِنْ خَطَايَايَ، كَمَا يُنَقَّى الثَّوْبُ الأَبْيَضُ مِنَ الدَّنَسِ، اللَّهُمَّ اغْسِلْنِي مِنْ خَطَايَايَ بِالثَّلْجِ وَالْمَاءِ وَالْبَرَد.\end{Arabicitem}

  ``O Allāh! Separate me (far) from my sins as you have separated (far) the East and West. O Allāh! Cleanse me of my sins as white cloth is cleansed from dirt. O Allāh! Wash me of my sins with water, ice, and snow.'' He used to say this in obligatory prayers.\footnote{Abū Dāwūd and al-Ḥākim, who declared it \emph{ṣaḥīḥ} and al-Dhahabī concurred.}
\end{enumerate}
\end{document}

Which generates the following,

MWE output

My problem is the alignment of the enumerate label with the minipage. I was able to fix this when using a parbox by using the t option.

I have tried doing the same for the minipage environment by changing the first argument of the newenvironment command to:

\newenvironment{Arabicitem}{\begin{minipage}[t]{\linewidth}\begin{Arabic}}

However, this made the label higher than the Arabic text as shown below.

MWE Edited output

How can I fix this so that the label is aligned with the first line of Arabic as is the case for the lipsum item?

1
  • Thanks for accepting my answer. You can upvote it as well :-)
    – Masroor
    Commented Aug 23, 2017 at 10:41

2 Answers 2

1

There can be other solutions, but the simplest trick I can think of is to put \vspace{-\baselineskip} in the minipage.

\documentclass{article}
\usepackage{lipsum}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[numerals=maghrib]{arabic}

\newfontfamily\arabicfont[
Script=Arabic,%
Scale=1.5%
]{Traditional Arabic}

\newenvironment{Arabicitem}{\begin{minipage}[t]{\linewidth}%
    \vspace{-\baselineskip}
    \begin{Arabic}}
    {\end{Arabic}\end{minipage}}

\begin{document}
\begin{enumerate}
\item \parbox[t][][t]{\linewidth}{\lipsum[1]}
\end{enumerate}

\begin{enumerate}
  \def\labelenumi{\arabic{enumi}.}
  \item  \begin{Arabicitem}اللَّهُمَّ بَاعِدْ بَيْنِي وَبَيْنَ خَطَايَايَ، كَمَا بَاعَدْتَ بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ، اللَّهُمَّ نَقِّنِي مِنْ خَطَايَايَ، كَمَا يُنَقَّى الثَّوْبُ الأَبْيَضُ مِنَ الدَّنَسِ، اللَّهُمَّ اغْسِلْنِي مِنْ خَطَايَايَ بِالثَّلْجِ وَالْمَاءِ وَالْبَرَد.\end{Arabicitem}

  ``O Allāh! Separate me (far) from my sins as you have separated (far) the East and West. O Allāh! Cleanse me of my sins as white cloth is cleansed from dirt. O Allāh! Wash me of my sins with water, ice, and snow.'' He used to say this in obligatory prayers.\footnote{Abū Dāwūd and al-Ḥākim, who declared it \emph{ṣaḥīḥ} and al-Dhahabī concurred.}
\end{enumerate}
\end{document}

enter image description here

0

I don't understand why you are using a minipage at all. Beside this: The main point is to start the paragraph with \leavevmode before switching the language:

\documentclass{article}
\usepackage{lipsum}

\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[numerals=maghrib]{arabic}

\newfontfamily\arabicfont[
Script=Arabic,%
Scale=1.5%
]%{Traditional Arabic}
 {Arial Unicode MS}

\newenvironment{ArabicitemA}{\begin{minipage}[t]{\linewidth}\leavevmode\otherlanguage{arabic}}
{\end{minipage}}

\newenvironment{ArabicitemB}{\leavevmode\otherlanguage{arabic}}
{}

\newenvironment{ArabicitemC}{\begin{minipage}[t]{\linewidth}\leavevmode\begin{Arabic}}
{\end{Arabic}\end{minipage}}

\newenvironment{ArabicitemD}{\leavevmode\begin{Arabic}}
{\end{Arabic}}
\begin{document}
\begin{enumerate}
  \def\labelenumi{\arabic{enumi}.}
  \item
  \begin{ArabicitemA}اللَّهُمَّ بَاعِدْ بَيْنِي وَبَيْنَ خَطَايَايَ، كَمَا بَاعَدْتَ بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ، اللَّهُمَّ نَقِّنِي مِنْ خَطَايَايَ، كَمَا يُنَقَّى الثَّوْبُ الأَبْيَضُ مِنَ الدَّنَسِ، اللَّهُمَّ اغْسِلْنِي مِنْ خَطَايَايَ بِالثَّلْجِ وَالْمَاءِ وَالْبَرَد.\end{ArabicitemA}

  \item 
  \begin{ArabicitemB}اللَّهُمَّ بَاعِدْ بَيْنِي وَبَيْنَ خَطَايَايَ، كَمَا بَاعَدْتَ بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ، اللَّهُمَّ نَقِّنِي مِنْ خَطَايَايَ، كَمَا يُنَقَّى الثَّوْبُ الأَبْيَضُ مِنَ الدَّنَسِ، اللَّهُمَّ اغْسِلْنِي مِنْ خَطَايَايَ بِالثَّلْجِ وَالْمَاءِ وَالْبَرَد.\end{ArabicitemB}

  \item
  \begin{ArabicitemC}اللَّهُمَّ بَاعِدْ بَيْنِي وَبَيْنَ خَطَايَايَ، كَمَا بَاعَدْتَ بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ، اللَّهُمَّ نَقِّنِي مِنْ خَطَايَايَ، كَمَا يُنَقَّى الثَّوْبُ الأَبْيَضُ مِنَ الدَّنَسِ، اللَّهُمَّ اغْسِلْنِي مِنْ خَطَايَايَ بِالثَّلْجِ وَالْمَاءِ وَالْبَرَد.\end{ArabicitemC}

    \item
  \begin{ArabicitemD}اللَّهُمَّ بَاعِدْ بَيْنِي وَبَيْنَ خَطَايَايَ، كَمَا بَاعَدْتَ بَيْنَ الْمَشْرِقِ وَالْمَغْرِبِ، اللَّهُمَّ نَقِّنِي مِنْ خَطَايَايَ، كَمَا يُنَقَّى الثَّوْبُ الأَبْيَضُ مِنَ الدَّنَسِ، اللَّهُمَّ اغْسِلْنِي مِنْ خَطَايَايَ بِالثَّلْجِ وَالْمَاءِ وَالْبَرَد.\end{ArabicitemD}


\end{enumerate}
\end{document}

enter image description here

Btw: I wonder if "you have separated (far) the East and West" is the suitable quote for a site like this where east and west are quite near.

5
  • What do you recommend besides minipage? Commented Aug 23, 2017 at 10:01
  • None of your solutions work for Arabic as it has to be right-aligned. Commented Aug 23, 2017 at 10:05
  • If you want a full arabic paragraph why do you want the number to be on the left side? That leads to conflicting paragraph settings. I don't see a necessity for a box, or do you want to suppress pagebreaks inside the text? But if you want numbers left then you will have to do something like \item\leavevmode\par\vspace{-\baselineskip}. Commented Aug 23, 2017 at 10:29
  • The main language of the document is in English. The list item is in Arabic followed by its translation. Commented Aug 23, 2017 at 10:37
  • I do understand this, but this means that the paragraph should now be at the same time left-to-right (for the number) and right-to-left (for the arabic) and so you get problems and negative vspace is probably the only way to get around it, even if it is ugly. Commented Aug 23, 2017 at 11:05

You must log in to answer this question.

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