1

I would like to us polyglossia to be able to write in arabic and english on the following code beautiful section styles

It's compile without errors but the output doesn't show any Arabic language

enter image description here

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage[explicit]{titlesec}
\usepackage{soul}

\definecolor{titleblue}{HTML}{4a7aa4}

\title{Probability}
\author{Educ}
\date{\today}

\newbox\TitleUnderlineTestBox
\newcommand*\TitleUnderline[1]
  {%
    \bgroup
    \setbox\TitleUnderlineTestBox\hbox{\colorbox{titleblue}\strut}%
    \setul{\dimexpr\dp\TitleUnderlineTestBox-.3ex\relax}{.3ex}%
    \ul{#1}%
    \egroup
  }
\newcommand*\SectionNumberBox[1]
  {%
    \colorbox{titleblue}
      {%
        \makebox[2.5em][c]
          {%
            \color{white}%
            \strut
            \csname the#1\endcsname
          }%
      }%
    \TitleUnderline{\ \ \ }%
  }
\titleformat{\section}
  {\Large\bfseries\sffamily\color{titleblue}}
  {\SectionNumberBox{section}}
  {0pt}
  {\TitleUnderline{#1}}
\titleformat{\subsection}
  {\large\bfseries\sffamily\color{titleblue}}
  {\SectionNumberBox{subsection}}
  {0pt}
  {\TitleUnderline{#1}}

\usepackage{polyglossia}
\setmainlanguage[numerals=maghrib]{arabic}
\setotherlanguage{english}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.2,AutoFakeSlant=-0.02]{Traditional Arabic}
\setsansfont[Script=Arabic,Scale=1.5]{Traditional Arabic}

\begin{document}

\maketitle

\newpage
\chapter{الاحتمالات}
\section{الاحتمالات الحزء الاول }
\subsection{الاحتمالات الحزء الاول}
\subsection{الاحتمالات الحزء الاول}
\section{الاحتمالات الحزء الاول الاحتمالات الحزء الاول}

\section
  {الاحتمالات الحزء الاول and text in English }

\end{document}
  • 2
    Doesn't work is a pretty bad description of your problem. Does it throw compile errors (if yes, which)? Or is the output unpleasant? – TeXnician Jul 4 '18 at 7:46
  • 1
    To maybe state the obvious, if you delete all the code for the fancy sectioning and then run it, the arabic appears in the sections. So the issue is in the section style code. – AML Jul 5 '18 at 14:47
  • The soul use a font which do not contain arabic script. – Salim Bou Jul 18 '18 at 12:40

Your Answer

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

Browse other questions tagged or ask your own question.