Skip to main content

How to Create a Fine Looking Series of Exercises in Arabic using LaTeX

Introduction

In this tutorial, we'll delve into the art of crafting elegant LaTeX documents in Arabic, with a special focus on two crucial elements: backgrounds and boxes. You'll learn how to design unobtrusive backgrounds that enhance readability and how to construct structured boxes that frame your content beautifully.

Importance of a Good Background

A good background is important in enhancing the readability and aesthetic appeal of LaTeX documents. The right background choice for Arabic scripts is particularly crucial due to their intricate designs.

Simple Background Setup

The background package is an easy tool for beginners. Here's a basic example of adding a subtle background to your document:

\usepackage{background}
\backgroundsetup{
  scale=1,
  color=black,
  opacity=0.05,
  angle=0,
  contents={}
}

The code snippet above will add a very light grey background to your document, enhancing readability without causing distraction.

Changing Background Color

To modify the background color, you can adjust the background package settings as follows:

\backgroundsetup{contents={}, color=gray!20}

This changes the background to a slightly darker shade of grey, suitable for documents with more visual elements.

Don't Forget the Readability

It is very important to keep the background subtle, especially for Arabic script, to ensure that the text remains the focal point.

Our Background Setup

\backgroundsetup{
 position=current page.center,
 angle=0,
 scale=1,
 contents={%
  \begin{tikzpicture}%
     \foreach \x in {7.3,7.5,...,25}
    \draw[green!30! white] (0,\x) -- (15in,\x);
   \foreach \y in {7.3,8.1,...,25}
    \draw[thick, DeepSkyBlue4!70,] (0,\y) -- (15in,\y);
    %\draw[very thick, red] (7.33in,0) -- (7.33in,13in);
      \foreach \z in {0.2,1,...,31}
    \draw[thick, DeepSkyBlue4!70] (\z,0) -- (\z,13 in);
  \end{tikzpicture}%
}}

The code snippet I've provided above is for setting up a customized background in a LaTeX document using the background package and TikZ. This code creates a patterned background with horizontal and vertical lines. Here's a breakdown of what each part of the code does:

\backgroundsetup{}

  • This command is from the background package and is used to configure the background of your LaTeX document.
  • position=current page.center, angle=0, scale=1:
    • position=current page.center positions the background in the center of the current page.
    • angle=0 ensures that the background is not rotated.
    • scale=1 means the background is at its original size without any scaling.
  • contents={}: This is where you define what the background will actually contain.

\begin{tikzpicture} ... \end{tikzpicture}:

This environment is used to create the background using TikZ, a powerful tool for creating graphics in LaTeX.

Line Drawing Commands

  • \foreach \x in {7.3,7.5,...,25}: This loop draws horizontal lines across the page. The color of these lines is green!30! white, which means 30% green mixed with white.
  • \foreach \y in {7.3,8.1,...,25}: This loop creates another set of horizontal lines. The color DeepSkyBlue4!70 indicates a 70% blend of the DeepSkyBlue4 color.
  • \foreach \z in {0.2,1,...,31}: This loop draws vertical lines. The color is the same as the second set of horizontal lines.
  • Line Dimensions: The dimensions (0,\x) -- (15in,\x) and similar for \y and \z specify the start and end points of the lines in inches, creating a grid-like pattern.

This background setup creates a subtle, grid-like pattern with alternating colors, adding a layer of visual texture to the page without being too distracting. It's a good choice for documents where you want a design element that's more interesting than a plain background but still maintains a high level of readability for the text, particularly important for intricate scripts like Arabic.


Result:



Custom LaTeX Box with tcolorbox

We conclude our exploration with a detailed look at a custom LaTeX box created using the tcolorbox package. This box, defined by the \newtcbtheorem command, is not just a container for content but a visually striking element of its own.

\newtcbtheorem{mytheo}{تمرين}{
  enhanced jigsaw,
  opacityframe=0.5,
  opacityback=1,
  opacitybacktitle=1,
  opacitytext=1,
  breakable,
  attach boxed title to top center={xshift=-0.1cm,yshift=-3mm},
  fonttitle=\Andalus,
  arc=10pt,
  sharp corners=downhill,
  coltitle=white!50!white,
  drop lifted shadow,
  interior style={white},
  before skip=5pt,
  after skip=5pt,
  fontupper=\small,
  boxed title style={
    boxrule=0.01mm,
    colframe=black,
    interior style={DeepSkyBlue4!70},
    drop lifted shadow
  }
}{th}

The frame's opacity is set at 50%, while the background remains fully opaque, ensuring the content stands out. A subtle drop shadow adds depth to the box, making it 'lift' off the page. The box's title, styled with the Andalus font, is elegantly positioned at the top center, slightly offset for a dynamic look. Sharp corners downhill and a fine border of black color accentuate its crisp appearance. The interior style, set to white with a DeepSkyBlue4 shade at 70% opacity, offers a soothing contrast, perfect for highlighting important text or exercises. This box is more than just a functional element; it's a testament to the power of LaTeX in creating beautifully structured and visually appealing documents. And finally, we get this: 



Comments

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

Popular posts from this blog

A French template: serie of exercises by Latex

The screenshot above come from my french serie of exercises, by clicking on it you will be directed to the overleaf  document with all the details. In this article, I present you a French template that may help you with typing maths in french. the code source I work with is  this : %%%%%%%%%%%%%%%------Document class -------%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass [twocolumn,french]{article} %%%%%%%%%%%%%%%%%%------ packages --------%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage [top=2. 5cm , bottom=2. 5cm , left=0. 5cm , right=0. 5cm ]{geometry} \usepackage [T1]{fontenc} \usepackage [utf8]{inputenc} \usepackage {lmodern} \usepackage { ntheorem } \usepackage {babel} \usepackage {multicol} \usepackage { multirow } \usepackage {fancyhdr} \usepackage {amsfonts} \usepackage {amsmath} \usepackage {amssymb} \usepackage { latexsym } \usepackage {array} \usepackage {graphicx} %%%%%%%%%%%%%%-----NEW COMMAND-------%%%%%%%%%%%%%%%%%%%%%%%%%%%%

How to make a serie of exercises in two columns

For making a two-column document, we need to add an option in the document class in the input file : \documentclass[a4paper,10pt,twocolumn]{arabart} for exemple, the following code show how it looks like when the content is just blind text using the blindtext package: \documentclass [10pt,a4paper,twocolumn]{arabart} \usepackage [utf8]{inputenc}  \usepackage [LAE]{fontenc}  \usepackage [arabic]{babel}   \usepackage {blindtext} %%blind text package%%%%  \begin {document}   \blindtext  \blindtext  \blindtext  \blindtext  \blindtext  \end {document} And for result: You can see it from write latex also : Finally, we propose a typical serie in two column in write latex:

A typical Arabic exam of high school's mathematics written by LaTeX

The following pdf is a result of a .tex file, as you see it produce a pro document:  If you are interested in typing such a pdf file, you can copy the input file (code source) from   here at Write Latex

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 bo

A LANDSCAPE two columns pages of exercises

For making a two-column document, we need to add an option in the document class in the input file \documentclass [ 14pt ,a4paper,twocolumn, landscape ]{ arabart } I propose the following code that generate the document showed in the picture above: \documentclass [ 14pt ,a4paper,twocolumn,landscape]{ arabart } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%% importants packages %%%%%%%%%%%%%%%%%%%%%% \usepackage [top=0. 5cm , bottom=1. 5cm , left= 1cm , right= 1cm ]{geometry} \usepackage [utf8]{inputenc} \usepackage [ LAE ]{fontenc} \usepackage [ arabic ]{babel} \usepackage {multicol} \usepackage { multirow } \usepackage {tabularx} \usepackage {amssymb} \usepackage {array} \usepackage {graphicx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%% new command %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand { \dis }{ \displaystyle } \mathchardef\times="2202 \newcommand { \C }{ \mathbb {C}}

arabic in Latex, is that possible?

   How to create an Arabic paper with the equations in the usual Latin in Latex?? This question is usually asked by people who need to write a scientific document in the Arabic language, specially scientific students or teachers who needs to make their reports, series or exams.    Many solutions are avalaible, the most used is the one using Arabtex package. It uses a transliteration system so that you may  typeset Arabic using latin letters, but it take a lot of time for the user to be familiar with the transiliteration. the following Latex code use the Arabtex package:( or you can visualise it at write LaTeX   here ) \documentclass [12pt]{article} \usepackage {arabtex} \begin {document} \setarab % choose the language specific conventions \vocalize % switch diacritics for short vowels on \transtrue % additionally switch on the transliteration \arabtrue % print arabic text ... is on by default anyway \centerline {\RL{^gu.hA wa-.himAruhu}} \begin {RLtext} '

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]$ \ite

Produce your first Arabic document with Latex!

The first line of the input file should normally be like: \documentclass[a4paper,12pt]{article} We can change the commend article with letter or book, but here we will employ arabart: \documentclass[a4paper,12pt]{arabart} If one merly wishes to type in ordinary text, without complicated mathematical formulae or special effects, then one merly can use the command article and type it in as it is. However, arabart has to be applied to avoid errors when Arabic characters are mixed with the Latin ones.  Here is an exemple of a typical Arab Latex input file with the pdf result: As you can  see, this is an exercice of mathematic writed in arabic with formulae in the usual Latin: \documentclass [11pt,a4paper]{ arabart } \usepackage [utf8]{inputenc} \usepackage [ LAE ]{fontenc} \usepackage [ arabic ]{babel} \begin {document} تمرين \\ نعتبر الدالة العددية $f$ للمتغير الحقيقي $x$ المعرفة ب: $ f(x)=\displaystyle\frac{-x^2-x+6}{x^2+2x-8}$ \\ $1$ )

Video : How to get graphic's code from Geogebra to Latex