0

I have a problem in writing section in arabic using polyglossia and titlesec

\PassOptionsToPackage{svgnames}{xcolor}
\documentclass[12.5pt,a4paper]{scrartcl}


\usepackage[usestackEOL]{stackengine}
\usepackage{graphicx}
\usepackage{psvectorian}
\usepackage[object=vectorian]{pgfornament}
\usepackage{fancybox}
\usepackage{fancyhdr}
\usepackage{array}
\usepackage[most]{tcolorbox}
\usepackage[left=0.29cm,right=0.85cm,top=1.7cm,bottom=2cm]{geometry}
%%%%%%%%%%%%%%%%%%%%%%
\usepackage{transparent}
\usepackage[printwatermark]{xwatermark}
\newsavebox\mydrft

\usepackage{tikz,varwidth,multicol}
\usetikzlibrary{calc}
\usetikzlibrary{shadows.blur}
\usetikzlibrary{shapes.symbols}
\tcbuselibrary{listings}

\usepackage{fontspec}

\usepackage{pgffor}
\usepackage[novoc,utf]{arabxetex}
\usepackage{polyglossia}

\usepackage[utf8]{inputenc}

\setotherlanguage{french}
\newfontfamily\arabicfont[Script=Arabic,Scale=1.1]{amiri-regular.ttf}

\newfontfamily\alfont[Script=Arabic,Scale=1.1]{Cairo-Regular.ttf}
\newfontfamily\sffont[Script=Arabic,Scale=1.4]{arabswell_1.ttf}
\newfontfamily\nffont[Script=Arabic,Scale=1]{Tajawal-Medium.ttf}
\newfontfamily\dffont[Script=Arabic,Scale=1.1]{aref.ttf}

\newfontfamily\mffont[Script=Arabic,Scale=1.2]{arabswell_1.ttf}
\newfontfamily\lffont[Script=Arabic,Scale=1.5]{arabswell_1.ttf}

\lstset{language=[LaTeX]TeX,escapeinside={*}{*}}
\usepackage{multicol}
\usepackage{fmultico}
\usepackage{amsmath,amsfonts,amssymb}
\setlength{\columnseprule}{0pt}
\usepackage{color}
\usepackage{pifont}
\usepackage{tabularx}

\usepackage{lastpage}
\pagestyle{fancy}
\usepackage{pgf,tikz}
\usepackage{enumitem}
\usepackage{enumerate}
\usepackage{varwidth}
\usetikzlibrary{arrows}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{1,5pt}
\fancypage{}{\setlength{\fboxsep}{1mm}
\setlength{\fboxrule}{0.0mm}
\fbox}
\fancyfoot[C]{
}
 \fancyfoot[R]{\nffont{
\textbf{\textcolor{DarkRed}{  abdo.bayoud2@gmail.com -- mathsahla.fnhost.com
}}}}
%%%%%%%%%%%%%%%%%%
\newcommand{\lr}[1]{\left(#1\right)}
%%%%%%%%%%%%%%%%%%%%%%%%%exercice%%%%%%%%%
\tcbuselibrary{breakable}
\usetikzlibrary{decorations.pathmorphing}
 \tcbuselibrary{skins}
\newtcolorbox{exo}[2][breakable, ]{enhanced,
before skip=2mm,after skip=2mm, boxsep=0pt,
colback=black!5,colframe=black!50,boxrule=0.7mm,
attach boxed title to top right={xshift=-0.8cm,yshift*=1mm-\tcboxedtitleheight},
varwidth boxed title*=-3cm,sharp corners,
boxed title style={frame code={
\path[fill=tcbcol@back!30!black]
([yshift=-1mm,xshift=-1mm]frame.north west)
arc[start angle=0,end angle=180,radius=1mm]
([yshift=-1mm,xshift=1mm]frame.north east)
arc[start angle=180,end angle=0,radius=1mm];
\path[left color=tcbcol@back!60!black,right color=tcbcol@back!60!black,
middle color=tcbcol@back!80!black]
([xshift=-2mm]frame.north west) -- ([xshift=2mm]frame.north east)
[rounded corners=1mm]-- ([xshift=1mm,yshift=-1mm]frame.north east)
-- (frame.south east) -- (frame.south west)
-- ([xshift=-1mm,yshift=-1mm]frame.north west)
[sharp corners]-- cycle;
},interior engine=empty,
},
fonttitle=\bfseries,
title={#2},#1}
%%%%%%%% redifine \overrightarrow%%%%%
\usepackage{esvect}
\usepackage{changepage}  %% change line width
\usepackage{tabularx}
\usepackage{mathtools}

%%%%%%%%%% site web 

\usepackage{pgfplots}   
\pgfplotsset{compat=newest} 
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\usetikzlibrary{plotmarks}
\usepackage{pgfplotstable}   

\pgfplotsset{compat=newest} 
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns}
\usetikzlibrary{plotmarks}
\usepackage{pgfplotstable}
\usetikzlibrary{calc}
\pgfplotstableread[col sep=space,row sep=newline,header=true]{
ts   val
-2.0  -0.5
-0.0  -1.0
1.0  -2.0
2.0  0.0
4.0  1.5
%2.5  3.0
}\mytable
%%% site web 
%%%% numbered list%%%%%%%%%
%%% \newcommand*\squared[1]{\tikz[baseline=(char.base)]{%
            %\node[shape=square,fill=blue!20,draw,inner sep=2pt] (char) {#1};}}

%\usepackage{enumitem}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %%%%%%%%% small \in %%%%%%
\newcommand{\smallerrel}[1]{\mathrel{\mathpalette\smallerrelaux{#1}}}
\newcommand{\smallerrelaux}[2]{\raisebox{.1ex}{\scalebox{.75}{$#1#2$}}}

\newcommand{\smallin}{\smallerrel{\in}}
\newcommand{\smallnotin}{\smallerrel{\notin}}
%%%%%%%%%%%%%%%%%%%
%\usepackage[dvips,xelatex]{graphicx} 
 %for include img

%%%%%%%%%%%%%%%%%%%
%\usepackage[novoc,utf]{arabxetex} 
%---------------------|carree outeur la question|------------------------%
\newcommand*\squared[1]{\tikz[baseline=(char.base)]{%        
        \node[rectangle,fill=red!40,draw,inner sep=3pt,opacity=0.8,text opacity=1] (char) {#1};}}
%--------------------| conteur arabic |--------------------%
\def\cnt{\stepcounter{enumi}\arabic{enumi}}
%\def\cnt2{\stepcounter{enumi}\arabic{enumi}}
%------------------| vecteur|--------------------------------%

\newcommand*{\norme}[1]{\left\lVert\overrightarrow{#1}\right\rVert} 

%------------------| norme|--------------------------------%

\newcommand*{\vect}[1]{\overrightarrow{#1}} 



%%%%%%%%%%%%%%%%%%%%%
\usepackage{enumitem}

    \usepackage{sectsty}
\subsubsectionfont{\color{gray}}
%%%%%%%% styling section %%%%%%%%%%%%
\definecolor{amber(orange)}{rgb}{1.0, 0.49, 0.0}
\definecolor{almond}{rgb}{0.94, 0.87, 0.8}
\usepackage[explicit,calcwidth]{titlesec}

\titleformat{\section}
  {\addtolength{\titlewidth}{0.3pc}\normalfont\normalsize\sffamily\bfseries}
  {\colorbox{amber(orange)}{\parbox{0.6cm}{\strut\color{white}\hfill\thesection}}}
  {0.3em}{}
  [{\titleline*[l]{\color{amber(orange)}\titlerule[2.6pt]}}]
\titleformat{\subsection}
  {\addtolength{\titlewidth}{1pc}\normalfont\large\sffamily}
  {\colorbox{orange}{\parbox{2cm}{\strut\color{white}\hfill\thesubsection}}}
  {1em}{}
  [{\titleline*[l]{\color{amber(orange)}\titlerule[2pt]}}]



%%%%%%%% styling section%%%%%%%%%%%%



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}


  \textarabic
%Use the tikzpicture for the document banner

\begin{tikzpicture}[remember picture,overlay]

\coordinate [below=2.1cm] (midpoint) at (current page.north);

\node [name=colourbar,
anchor=base,
fill=blue!40,
text = white,
minimum width=\paperwidth,
minimum height=1.3cm] at (midpoint){\Large{\textarabic{ \mffont \Large
الحساب العددي 
}}};

% Define the point where the logo will go
\coordinate [left=3.5cm] (logo) at (colourbar.est);

% Set coordinate system origin
\begin{scope}[shift=(logo)]
% Draw the outline
\filldraw [white,draw=blue!40] (2.3,0.95) -- (-2,0.95) -- (-2.9,-0.95) -- (2.3,-0.95) --cycle;
% Include the logo
\node [width=4cm]{\Large{\textarabic{ \nffont
  الدرس الأول
 }\EightFlowerPetalRemoved}};
\end{scope}

\end{tikzpicture}


%Fill up the rest off the d

\mathversion{bold}

\begin{tikzpicture}[remember picture, overlay]
    \node[color=DarkRed,text opacity=0.85,rotate=90,font=\fontsize{10}{8}\selectfont]
        at (current page.center) {\textit{\textbf----\small\cffont{ \ www.mathprofs.byethost13.com \ ----- \ www.mathprofs.byethost13.com \ ---- \ www.mathprofs.byethost13.com  } }};
\end{tikzpicture}
\begin{tikzpicture}[remember picture, overlay]
    \node[color=DarkRed,text opacity=0.85,rotate=90,font=\fontsize{10}{8}\selectfont]
        at ( [xshift=--9.32cm,yshift=-18cm] .south east) {\textit{\textbf----\small\cffont{ www.mathprofs.byethost13.com \ -- }}};
\end{tikzpicture}
\begin{tikzpicture}[remember picture, overlay]
    \node[color=DarkRed,text opacity=0.85,rotate=90,font=\fontsize{10}{8}\selectfont]
        at ( [xshift=-11.12cm,yshift=-5.1cm] .north west) {\textit{\textbf--\small\cffont{ www.mathprofs.byethost13.com \ -- } }};
\end{tikzpicture}
\vspace*{0.1cm}
\textarabic{
\section{
النسبة المئوية
}
 \vspace*{0.1cm}

\begin{exo}[colbacktitle=blue!40 ]{\textcolor{ white}{
{\alfont{
التمرين الأول
$:$
}}}} 
  لتكن 
  $f$
  دالة معرفة على المجال
  $\left[-1;4\right]$
  منحناها كما يلي:
  \begin{center}


  \begin{tikzpicture}   %%%%%%%%%%%%%%%% figure3
     \begin{axis}[grid=both,
          grid style={line width=.3pt, draw=black},
          major grid style={line width=.2pt,draw=black!50},
          xmax=4.0,ymax=3.5,
          xmin=-3,ymin=-3.5,
          xtick={-3,-2,-1,0,...,4},
          ytick={-3,-2,-1,0,...,4}, yticklabel style = {font=\small,xshift=0.6ex},
            xticklabel style = {font=\small,yshift=0.6ex},
          axis lines=middle,
          enlargelimits]

          \pgfplotstableread[col sep=space,row sep=newline,header=true]{
            ts   val

            4   2.0
            2.9    2.99
            2   0
            1    -2
            0   -0.5

            -1  0


              }\mytable

        \addplot[smooth, red, mark size=0.3pt ,line width=1.2pt ] table {\mytable} node[left] {$\mathcal{C}_f$};


      \end{axis}
    \end{tikzpicture}

  \end{center}    




\begin{enumerate}
\item[\squared{\cnt}] {
حدد صور الأعداد التالية:
\ $\ ; \ -1 \ ;  \ 0 \ ; \ 4 $
 بالدالة 
 $f$}

\item[\squared{\cnt}] {
 ضع جدول التغيرات الدالة $f$.
}
\item[\squared{\cnt}] {
حدد قيمة قصوى للدالة $f$ على المجال
$\left[-1;4\right]$.
}
\item[\squared{\cnt}] {
حدد قيمة دنيا للدالة $f$
على المجال $\left[-1;4\right]$.

}

\item[\squared{\cnt}] {
حل المعادلات:\ \ \ 
$f(x)=0 \ ; \ f(x)=1$


}

\item[\squared{\cnt}] {
حل المتراجة: \ \ \ 
$0<f(x)$


}
\end{enumerate}

 \end{exo}

    \vspace*{0.3cm}



}
%%%%%%%

\end{document}

enter image description here

Thank you for any help !

  • Welcome back to TeX.SE! When you say 'I have a problem', what do you mean exactly? Do you get an error message? What is the output you expect, what is the output you get? Also, it would be helpful if you can make your example code much shorter, so that people who try to answer your question don't have to read all this code that is not relevant for the issue. Remove at least all the pgfplots, tikz, tcolorbox stuff. When you use custom fonts, please mention where these fonts come from, try to reduce the number of different fonts and/or substitute them by more standard fonts. – Marijn May 19 at 14:01

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.