Skip to main content

Colored Arabic Document



             In Order to create a colored document, I needed the package tcolorbox giving the huge possibilities that it contain like we are going to explain in this article. However, it doesn't work with the arabart  document class (which by the way I used to make this previous documents :
 A LANDSCAPE two columns pages of exercices
How to make a serie of exercices in two columns
A typical Arabic exam of high school's mathematics ).

         So I moved to using the package polyglossia where compilation must be done with XeLaTeX .
The tcolorbox package (2012) originates from the first edition of the book «LATEX – Einführung in das Textsatzsystem » in about 2006 writing by Dr. Thomas F. Sturm, it provides an environment for colored and framed text boxes with a heading
line.
As for Polyglossia, it is a package for facilitating multilingual typesetting with XeLaTeX.

Let's start with an exemple :
the source code below is for a simple box :

\documentclass[10pt]{article} \usepackage{tcolorbox}
\begin{document}

\begin{tcolorbox}
This is a \textbf{tcolorbox}.
\end{tcolorbox}

  \end{document}

which result to :

            With polygossia  The default language of a document is specified by means of the command:
 \setdefaultlanguage[⟨options⟩]{⟨lang⟩}
for the arabic language we use the following source code :
\documentclass[10pt]{article}
 \usepackage{tcolorbox}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}
 \begin{document}

\begin{tcolorbox}
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}


\end{document}

which result to:

Now let's add some colors in options of the environment tcolorbox:

\begin{tcolorbox}["options"]
environment content

\end{tcolorbox}

The "options" control the appearance and several functions of the boxes, in the following exemple we added colors  to the back and frame of the box  : 
\documentclass[10pt]{article}
 \usepackage{tcolorbox}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}
 \begin{document}

\begin{tcolorbox}[colback=green!50,colframe=green!35!black]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}


\end{document}
the result is :

For the title, we can easly add a heading line with a text as content :
\documentclass[10pt]{article}
\usepackage{tcolorbox}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}
\begin{document}

\begin{tcolorbox}[title= عنوان للنص من اختيارك]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}

\end{document}
and the result:

combined with color :
\documentclass[10pt]{article}
\usepackage{tcolorbox}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}
\begin{document}

\begin{tcolorbox}[title= عنوان للنص من اختيارك,colback=green!30,colframe=green!20!black]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}

\end{document}
result to :

For more modifications on the appearance of the box, here is some examples:
width : it change the width of  the box

\documentclass[10pt]{article}
\usepackage{tcolorbox}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}
\begin{document}

\begin{tcolorbox}[title= عنوان للنص من اختيارك,colback=green!30,colframe=green!20!black,width=\linewidth/2]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}
\begin{tcolorbox}[title= عنوان للنص من اختيارك,colback=green!30,colframe=green!20!black]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}

\end{document}

result :

as you see it's aligned from left to right, to overcome this issue I put the entire boxes inside the flushright environment :
\documentclass[10pt]{article}
\usepackage{tcolorbox}
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}

\begin{document}
\begin{flushright}

\begin{tcolorbox}[title= عنوان للنص من اختيارك,colback=green!30,colframe=green!20!black,width=\linewidth/2]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}

\begin{tcolorbox}[title= عنوان للنص من اختيارك,colback=green!30,colframe=green!20!black]
هذا النص مكتوب بلغة الضاد عن طريق 
\LaTeX
\end{tcolorbox}

\end{flushright}
\end{document}
result to :




Here is the source code of the front article document ( don't forget to compile it under Xelatex engine ):
\documentclass[12pt,a4paper]{article}

\usepackage[head=30pt,foot=30pt,top=1.5cm, bottom=1.5cm, left=1cm, right=1cm]{geometry}
%\usepackage[a4paper]{geometry}
\usepackage{ntheorem}

%
%\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{latexsym}
%\usepackage{a4wide}
\usepackage{array}

\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\usetikzlibrary{shadings,shadows}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{pgf,tikz,pgfplots}



\definecolor{LightGreen}{rgb}{0.56, 0.93, 0.56}
\definecolor{DarkGreen}{rgb}{0.0, 0.2, 0.13}
\definecolor{FireBrick}{rgb}{0.7,0.13,0.13}
\definecolor{Salmon}{rgb}{1.0,0.55,0.41}


\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pgfplotsset{compat=1.10}




\usepackage{multicol}
\usepackage{multirow}
\usepackage{blindtext}

%fontspec\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage{lmodern}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%








\usepackage{fancyhdr}
\usepackage{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\dis}{\displaystyle}
\newcommand{\ve}{ \overrightarrow}
\mathchardef\times="2202
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%\thispagestyle{empty}

%---EN-TETE-ET-PIED-DE-PAGE----------------------------------------------------
\pagestyle{fancy}
%\renewcommand{\headrulewidth}{1,5pt}
%\renewcommand{\footrulewidth}{1 pt}

\fancyhead[C]{\begin{tcolorbox}[skin=enhanced,fonttitle=\bfseries ,toggle enlargement=forced,center title,width=\linewidth ,boxrule=1mm ,coltext=white,
 frame style={draw=FireBrick,fill=Salmon,drop shadow},
 interior style={draw=FireBrick,top color=Salmon!80,bottom color=Salmon!30},
 segmentation style={draw=FireBrick,solid,decorate,
decoration={coil,aspect=0,segment length=10.1mm}}]
\textbf{ثانوية  .......... التأهيلية}
\hfill
\textbf{مادة الريــــاضـــيــــــــات }
\hfill
\textbf{الأستاذ: ............}
\end{tcolorbox}
} % clear all header fields
\fancyhead[L]{}
\fancyhead[R]{}
%\fancyfoot{} % clear all footer fields
\fancyfoot[R]{}
\fancyfoot[L]{}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\setlength{\columnseprule}{0.25pt}






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%---EN-TETE-ET-PIED-DE-PAGE----------------------------------------------------
%\pagestyle{empty}
%\renewcommand{\headrulewidth}{1,5pt}
%\renewcommand{\footrulewidth}{1 pt}

%\lhead{fhgfgd}
%\cfoot{ygghg}
\newcommand{\C}{\mathbb{C}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\setotherlanguage{french}
\usepackage{fontspec}
%\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Aldhabi}
%\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Sakkal Majalla}
%\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Andalus}
\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Simplified Arabic}
%\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Amiri}
%\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Traditional Arabic}
%\newfontfamily\arabicfont[Script=Arabic, Scale=1.2]{Urdu Typesetting}







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



\theoremstyle{plain}
%\theorembodyfont{\normalfont}
\theoremseparator{~--}
\newtheorem{exo}{تمرين}%[section]% 
%\theoremcolor{red}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newtcbtheorem{mytheo}{تمرين}{colback=green!5,colframe=green!35!black,fonttitle=\bfseries}{th}



\newtcbtheorem{theo}{تمرين}{skin=enhanced,fonttitle=\bfseries ,toggle enlargement=forced,center title,width=\linewidth ,boxrule=1mm ,
 frame style={draw=FireBrick,fill=Salmon,drop shadow},
 interior style={draw=FireBrick,top color=Salmon!10,bottom color=Salmon!50},
 segmentation style={draw=FireBrick,solid,decorate,
decoration={coil,aspect=0,segment length=10.1mm}}}{th}


\begin{document}

\begin{flushright}

%\vspace{0.2cm}
\begin{theo}{}{theoexample}


لتكن
$(u_n)$
المتتالية العددية المعرفة بما يلي:

\[
 \left\lbrace
 \begin{array}{ll}
 u_0=\dis\frac{1}{4}\\ 
 u_{n+1}=u_n^2+\frac{1}{2}u_n\quad;\quad n\in\N\\
 
 \end{array}
 \right.
\]
    
  
\begin{enumerate}
  
 \item
  \begin{enumerate}
   \item
  احسب
$u_1$
و
$u_2$
.
 
  \item
 بين  ان
$(\forall n \in \N);\quad 0<u_n\leqslant \frac{1}{4}$
.
 \end{enumerate}
  \item
   
 بين أن 
 $(u_n)$
 تناقصية
 .
 \item
   \begin{enumerate}

  \item
 
 بين أن
 
 $$(\forall n\in\N);\quad u_{n+1}\leqslant \dis\frac{3}{4} u_n $$
 
 \quad  \item
 استنتج أن
 $(\forall n \in \N );\quad u_n\leqslant (\frac{3}{4})^nu_0<(\frac{3}{4})^n$
 .
  \end{enumerate}
 \end{enumerate}
\end{theo}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%exercice 3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{theo}{}{theoexample}
%\vspace{0.2cm}

لكل 
$x$
من
$\R$
نضع
\quad$h(x)=2\cos^3(x)-\cos(x)+2\sin(x)-2\sin^3(x)$
\begin{enumerate}
  
 \item
\begin{enumerate}
  
 \item
بين أنه
لكل 
$x$
من
$\R$
:
\quad\quad$\sin(x)-\sin^3(x)=\frac{1}{2}\sin(2x)\cos(x)$
 
و
\quad\quad$2\cos^3(x)-\cos(x)=\cos(2x)\cos(x)$
.

\item
استنتج أن
لكل 
$x$
من
$\R$
:
\quad\quad$h(x)=\sqrt{2}\cos\Big(2x-\dis\frac{\pi}{4}\Big)\cos(x)$
.
\end{enumerate}

\item
حل في
$\R$
المعادلة
$h(x)=0$

  و مثل الحلول في الدائرة المثلثية.


\item
بين أنه لكل
$x$
من المجال
$\Big[-\dis\frac{\pi}{8};\dis\frac{\pi}{4}\Big]$
لدينا
:
$$h(x)\geqslant 0$$
.
\end{enumerate}
\end{theo}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%exercice 3%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{theo}{}{theoexample}
بين أنه لكل 
$x$
من
$\R$
بحيث 
$x\neq 2k\pi /k\in \Z$ 
و
$n$  
من
$\N^*$
لدينا
:
$$2\dis\sum_{k=1}^{n}\cos(kx)=\dis\frac{\sin\Big((n+\frac{1}{2})x\Big)}{\sin(\frac{1}{2}x)}-1$$


\end{theo}
\end{flushright}
\end{document}

Comments

Post a Comment

Multitude of Heart Pattern

Buy on Amazon

Crimson Passion Vivid Red Heart

Buy on Amazon

The Formula of Us

Buy on Amazon

Abstract Love Heart

Buy on Amazon

The Formula of Us

Buy on Amazon

forget your voice

Buy on Amazon

Valentine's Verdure

Buy on Amazon

Cushion Closeness: Cherishing Our Bond

Buy on Amazon