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
Post a Comment