Skip to main content

Arabic colored box with a graphic side by side

       

              To make an exercise inside a box with a graphic aside, after looking for a solution I found that I can put two minipages separated by a \hfill which fit the box entirely..let's break it down:
The following  source code is for the exercise body :



%--------document class
\documentclass{article}          %--------packages 
\usepackage{amsfonts,amssymb,enumitem}
%--------polyglossia package
\usepackage{polyglossia}
\setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic}
\newfontfamily\arabicfont[Script=Arabic, Scale=1]{Amiri} 
%--------new commands 
 \newcommand{\R}{\mathbb{R}}
 \begin{document}
 لتكن 
$f$
و
$g$
الدالتين المعرفتين على 
$\R$
بمنحنيهما
$(C_f)$
 و 
$(C_g)$
 و
 $A$
نقطة زوج احداثياتها هو 
$(\frac{3}{2};\frac{1}{2})$
.
(انظر الشكل) 
\begin{enumerate}[label={\arabic*)}]
\item\begin{enumerate}
\item[(a]
حدد جدول تغيرات الدالة
$f$
على  المجال
$[-4;3]$
\item[(b]
حدد مطاريف الدالة
$f$
على كل من   المجالات
$[-4;3]$
و
$[-1;1]$
و
$[-4;0]$
\item[(c]
حدد مبيانيا, حلول المعادلة
 $f(x)=0$
في  المجال
 $[-4;3]$
 \item[(d]
حدد مبيانيا , حلول المعادلة
  $g(x)=0$
في  المجال
 $[-2;0]$
 \item[(e]
حدد مبيانيا:
$f\big([-2;0]\big) $
و
$g\big([-1;0]\big) $
\end{enumerate}
\item 
حدد مبيانيا 
في  المجال
 $[-2;1]$
, حلول المتراجحات
  $g(x)>0$
و
 $f(x)\leqslant 0$
 و
 $f(x)\leqslant g(x)$
 \item
 نعتبر الدالة
 $h$
 المعرفة على  المجال
 $[-1;1]$
  بما يلي :
 $h=f\circ g$
 ,
 باستعمال خاصية مركب  دالتين حدد  رتابة الدالة
$h$
على  المجال
$[-1;1]$
\end{enumerate}
 
 

 \end{document}

which produces :

If you haven't noticed, the exercise is based on the graphic below:


the trick with the minipages that I mentioned earlier has for code :

 \begin{minipage}[t]{0.4\linewidth}

   %%%%%  exercise body       %%%%%%%

 \end{minipage}
 
 \hfill
   
 \begin{minipage}[t]{0.56\linewidth}
  
     \includegraphics[width=\linewidth]{figure11}

 \end{minipage}

 

 

the first mini page will contain the mathematics with  40% of the width of the page,   you can change  it in the option area  "{0.4\linewidth} ". The " \hfill " will ensure the right alignment of the two mini pages, and the last mini page has the  \includegraphics[width=\linewidth]{figure11} which import our figure with specification on the size of its width:



the issue with this result is the unwanted vertical space of the first mini, so to overcome it I had to add the command  \vspace*{0pt} at the top of each minipage :



Now that we prepared our body, let's put it inside a colored box ( if you want to know more about colored boxes look at this article   Colored arabic document ) ,  note that I added a few packages

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



to the previous preambule giving I'm going to use a colored box:

%--------document class \documentclass{article} %--------packages \usepackage[head=20pt,foot=0pt,top=1.2cm, bottom=1.9cm, left=1cm, right=2cm,footskip=1pt]{geometry} \usepackage{amsfonts,amssymb,enumitem} \usepackage[most]{tcolorbox} \tcbuselibrary{skins} \usetikzlibrary{shadings,shadows} \usepackage{xcolor,pgf,tikz,pgfplots} %--------polyglossia package \usepackage{polyglossia} \setdefaultlanguage[calendar=gregorian,numerals=maghrib]{arabic} \newfontfamily\arabicfont[Script=Arabic, Scale=1]{Amiri} %--------new commands \newcommand{\R}{\mathbb{R}} \begin{document} %----the box begins \begin{tcolorbox}[skin=enhanced,fonttitle=\bfseries,center title,title = تمرين 1 ,frame style={upper left=blue,upper right=red,lower left=yellow,lower right=green}, interior style={white,opacity=0.9},segmentation style={black,solid,opacity=0.2,line width=1pt}] % -----the first mini \begin{minipage}[t]{0.4\linewidth} \vspace*{0pt} لتكن $f$ و $g$ الدالتين المعرفتين على $\R$ بمنحنيهما $(C_f)$ و $(C_g)$ و $A$ نقطة زوج احداثياتها هو $(\frac{3}{2};\frac{1}{2})$ . (انظر الشكل) \begin{enumerate}[label={\arabic*)}] \item\begin{enumerate} \item[(a] حدد جدول تغيرات الدالة $f$ على المجال $[-4;3]$ \item[(b] حدد مطاريف الدالة $f$ على كل من المجالات $[-4;3]$ و $[-1;1]$ و $[-4;0]$ \item[(c] حدد مبيانيا, حلول المعادلة $f(x)=0$ في المجال $[-4;3]$ \item[(d] حدد مبيانيا , حلول المعادلة $g(x)=0$ في المجال $[-2;0]$ \item[(e] حدد مبيانيا: $f\big([-2;0]\big) $ و $g\big([-1;0]\big) $ \end{enumerate} \item حدد مبيانيا في المجال $[-2;1]$ , حلول المتراجحات $g(x)>0$ و $f(x)\leqslant 0$ و $f(x)\leqslant g(x)$ \item نعتبر الدالة $h$ المعرفة على المجال $[-1;1]$ بما يلي : $h=f\circ g$ , باستعمال خاصية مركب دالتين حدد رتابة الدالة $h$ على المجال $[-1;1]$ \end{enumerate} \end{minipage} \hfill % -----the second mini \begin{minipage}[t]{0.56\linewidth} \vspace*{0pt} \includegraphics[width=\linewidth]{figure11} \end{minipage} \end{tcolorbox}
that last source code should work with you if you   save the graphic in the same file with the tex and compile it under Xelatex. Let me know if you have any questions.

Comments

  1. Thank you so much for your efforts. After the compilation, it gave me a single color (pink) in the box. Instead of blue, red,yellow and green.

    ReplyDelete
  2. Thank you so much for your efforts. After the compilation, it gave me a single color (pink) in the box. Instead of blue, red,yellow and green.

    ReplyDelete

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