1

I need to make the following produce two opposite lists in English (aligned to the left) and Arabic (aligned to the right) while understanding the reason behind the warning

Language 'Arabic' not available for font(fontspec) 'Scheherazade' with script 'Arabic'.

Additionally, why aren't the \hrules drawn before and after the tcbraster?

enter image description here

\documentclass[12pt, a4paper]{article}

\usepackage[tuenc,no-math]{fontspec} \setmainfont[ Ligatures = { NoCommon, % liga NoRare,% dlig } ]{Latin Modern Roman}

\newfontfamily\arabicfont{Scheherazade}[ Script = Arabic, RawFeature={+anum}, Scale = 1]

\usepackage[english, bidi = basic]{babel} \babelprovide[import, onchar = ids fonts]{arabic} \babelfont[arabic]{rm}{Scheherazade} % [Scale = 2]{Scheherazade} \babelfont[arabic]{sf}{Scheherazade}

\usepackage[xparse,breakable,raster,skins, fitting]{tcolorbox}

\usepackage{ulem, enumitem}

\parindent=0pt

\begin{document} \begin{tcbraster}[ raster columns = 2, valign = center, raster before skip = 1ex, raster after skip = 1ex, blankest, height = 3em, before = \hrule, after = \hrule ] \tcboxfit[ halign = flush left , right = 1ex ]{

        \textbf{\uline{Important Rules:}}

        \begin{itemize}[
            label = \textbullet, leftmargin=*, labelsep = \fontdimen2\font, itemsep = 0.5\baselineskip, %nosep
            topsep = 0.5\baselineskip, 
            font=\bfseries, before=\bfseries % https://tex.stackexchange.com/a/164268/2288
            ]
            \item First rule.

            \item Second rule
        \end{itemize}%
    }
    \tcboxfit[ halign = flush right, left = 1ex ]{%
            \textbf{\uline{%
                    قواعد هامة:%
            }}
            \begin{itemize}[
                label = \textbullet, leftmargin=*, labelsep=\fontdimen2\font, itemsep = 0\baselineskip, %nosep
                topsep = 0.5\baselineskip, font=\bfseries, before=\bfseries
                ]
                \item القاعدة الأولى
                \item القاعدة الثانية
            \end{itemize}%
    }%
\end{tcbraster}%

\end{document}

Diaa
  • 9,599
  • As to the first warning, see https://tex.stackexchange.com/a/478541/5735 . – Javier Bezos Jul 06 '21 at 17:10
  • @JavierBezos may I know why the Arabic items are not right justified and the bullets are not drawn at the right margin? – Diaa Jul 06 '21 at 20:06
  • Because the layout direction has not been changed. babel can’t know when to switch it and it must be done explicitly. See the muzimuzhi Z's answer. – Javier Bezos Jul 07 '21 at 16:32

1 Answers1

3

Additionally, why aren't the \hrules drawn before and after the tcbraster?

tcbraster environment is not derived from tcolorbox, but more like a simple minipage. Therefore tcolorbox options before=<code> and after=<code> are ignored.

Furthermore, \hrule will only work inside tabular-like environments. Try \par\noindent\hrulefill\par instead.

To typeset arabic texts right-to-left, the \begin{otherlanguage}{arabic} ... \end{otherlanguage} environment is added (see a guide on Overleaf.com), and the option halign = flush right is removed from the second \tcbboxfit.

% !TeX TS-program = lualatex
\documentclass[12pt, a4paper]{article}

\usepackage[tuenc,no-math]{fontspec} \setmainfont[ Ligatures = { NoCommon, % liga NoRare,% dlig } ]{Latin Modern Roman}

\newfontfamily\arabicfont{Scheherazade}[ Script = Arabic, RawFeature={+anum}, Scale = 1]

\usepackage[english, bidi = basic]{babel} \babelprovide[import, onchar = ids fonts]{arabic} \babelfont[arabic]{rm}{Scheherazade} % [Scale = 2]{Scheherazade} \babelfont[arabic]{sf}{Scheherazade}

\usepackage[xparse,breakable,raster,skins, fitting]{tcolorbox}

\usepackage{ulem, enumitem}

\parindent=0pt

\begin{document} \noindent\hrulefill\par \begin{tcbraster}[ raster columns = 2, valign = center, raster before skip = 1ex, raster after skip = 1ex, blankest, height = 3em, before = abc\hrulefill, after = \hrulefill ] \tcboxfit[ halign = flush left , right = 1ex ]{

        \textbf{\uline{Important Rules:}}

        \begin{itemize}[
            label = \textbullet, leftmargin=*, labelsep = \fontdimen2\font, itemsep = 0.5\baselineskip, %nosep
            topsep = 0.5\baselineskip, 
            font=\bfseries, before=\bfseries % https://tex.stackexchange.com/a/164268/2288
            ]
            \item First rule.

            \item Second rule
        \end{itemize}%
    }
    \tcboxfit[ left = 1ex ]{%
      \begin{otherlanguage}{arabic}
            \textbf{\uline{%
                    قواعد هامة:%
            }}
            \begin{itemize}[
                label = \textbullet, leftmargin=*, labelsep=\fontdimen2\font, itemsep = 0\baselineskip, %nosep
                topsep = 0.5\baselineskip, font=\bfseries, before=\bfseries
                ]
                \item القاعدة الأولى
                \item القاعدة الثانية
            \end{itemize}%
      \end{otherlanguage}
    }%
\end{tcbraster}%
\noindent\hrulefill\par

\end{document}

enter image description here

muzimuzhi Z
  • 26,474
  • For the right half of the Arabic text, the bullets and their respective items should be drawn at the right since Arabic is a right to left language. Can you please fix it? – Diaa Jul 06 '21 at 20:05
  • @Diaa Answer updated – muzimuzhi Z Jul 06 '21 at 23:30
  • Shouldn't the bullets in the Arabic text be aligned with the right margin as in the English text instead of going outside? – Diaa Jul 07 '21 at 21:14
  • @Diaa I find the problem of different amount of \item margin reproduces even without tcolorbox nor enumitem. I'm not familiar with typesetting Arabic in LaTeX. Perhaps you can open a new question with a simplified example. – muzimuzhi Z Jul 07 '21 at 21:33