-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathbook.tex
More file actions
253 lines (227 loc) · 9.56 KB
/
Copy pathbook.tex
File metadata and controls
253 lines (227 loc) · 9.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
\documentclass[10pt, a4paper]{book}
\usepackage[svgnames,table,dvipsnames]{xcolor} % For color names
\usepackage{fontspec} % font selecting commands
\usepackage[breakable, skins]{tcolorbox} % For colored boxes
\usepackage{graphicx} % For pictures
\usepackage{polyglossia} % Babel alternative in XeLaTex
\usepackage{fancyhdr} % For page headers
\usepackage[top=2.5cm, bottom=2.5cm, left=3cm, right=2cm]{geometry} % To control page margins
\usepackage{listings} % For source code
\usepackage[breaklinks,
colorlinks,
linkcolor=Black,
urlcolor=RedOrange,
unicode=true,
pdflang=ar,
pdftitle={تعلّم البرمجة بلغة C},
pdfauthor={عدن بلواضح,حمزة عباد,أحمد زبوشي},
pdfdisplaydoctitle=true,
pdfduplex=DuplexFlipLongEdge]{hyperref} % For hyperlinks and PDF metadata
\usepackage{float}
\usepackage{tabu,booktabs}
\usepackage{pdfpages}
\usepackage{bidi}
% Font settings
\defaultfontfeatures{Ligatures=TeX, Path=Fonts/, Extension=.ttf, Scale=0.8}
\newfontfamily\arabicfont{amiri-}[
Script=Arabic,
Scale=1,
UprightFont=*regular,
BoldFont=*bold,
ItalicFont=*slanted,
BoldItalicFont=*boldslanted
] % An arabic font
\newfontfamily\englishfont{LiberationSans-}[
Script=Latin,
UprightFont=*Regular,
BoldFont=*Bold,
ItalicFont=*Italic,
BoldItalicFont=*BoldItalic
] % Font used for latin text in the document
\newfontfamily\arabicfonttt{LiberationMono-}[
Script=Latin,
UprightFont=*Regular,
BoldFont=*Bold,
ItalicFont=*Italic,
BoldItalicFont=*BoldItalic
] % Monospace font, for displaying codes
\renewcommand{\dots}{...\enskip}
% Colors
\colorlet{questionback}{white!80!black}
\colorlet{questionframe}{white!85!black}
\colorlet{questiontitle}{white!40!black}
\colorlet{criticalback}{red!20}
\colorlet{criticalframe}{red!10}
\colorlet{criticaltitle}{red!80}
\colorlet{warningback}{orange!20}
\colorlet{warningframe}{orange!10}
\colorlet{warningtitle}{orange!80}
\colorlet{infoback}{cyan!20}
\colorlet{infoframe}{cyan!10}
\colorlet{infotitle}{cyan!80}
\colorlet{chapter}{green!30!blue!80}
\colorlet{section}{orange}
% Language settings
\setmainlanguage[locale=algeria]{arabic}
\setotherlanguage{english}
\addto\captionsarabic{ % Without this, changes won't take effect, because of Polyglossia
\renewcommand{\partname}{الجزء}
\renewcommand{\chaptername}{الفصل}
\renewcommand{\contentsname}{جدول المحتويات}
}
% Boxes definitions
\tcbset{arc=2pt, enhanced,
attach boxed title to top right={yshift=-\tcboxedtitleheight/3*2, xshift=\tcboxedtitlewidth/5*2},
boxrule=0.5mm, fonttitle=\Large, boxed title style={circular arc, square, halign=center, valign=center}}
\newtcolorbox{question}{colback=questionback, colframe=questionframe, title=؟, coltitle=questiontitle,
boxed title style={colback=questionback}} % Used for question boxes
\newtcolorbox{critical}{colback=criticalback, colframe=criticalframe, title=\textenglish{X}, coltitle=criticaltitle,
boxed title style={colback=criticalback}} % Used for critical warning boxes
\newtcolorbox{warning}{colback=warningback, colframe=warningframe, title=!, coltitle=warningtitle, fonttitle=\LARGE,
boxed title style={colback=warningback}} % Used for warning boxes
\newtcolorbox{information}{colback=infoback, colframe=infoframe, title=م, coltitle=infotitle,
boxed title style={colback=infoback}} % Used for information boxes
\newcommand\InlineCode[1]{\fcolorbox{LightGray}{Snow}{\ttfamily \LR{#1}}}
% Titles settings (Make them orange or blue)
\makeatletter
\let\oldpart\part
\newcommand{\@partstar}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{part}{#1}{\color{section}\oldpart*{#1}}}
\newcommand{\@partnostar}[1]{{\color{section}\oldpart{#1}}}
\renewcommand{\part}{\@ifstar{\@partstar}{\@partnostar}}
\let\oldchapter\chapter
\newcommand{\@chapterstar}[1]{\cleardoublepage\phantomsection\addcontentsline{toc}{chapter}{#1}{\color{chapter}\oldchapter*{#1}}\markboth{#1}{}}
\newcommand{\@chapternostar}[1]{{\color{chapter}\oldchapter{#1}}}
\renewcommand{\chapter}{\@ifstar{\@chapterstar}{\@chapternostar}}
\let\oldsection\section
\newcommand{\@sectionstar}[1]{\phantomsection\addcontentsline{toc}{section}{#1}{\color{section}\oldsection*{#1}}\markright{#1}}
\newcommand{\@sectionnostar}[1]{{\color{section}\oldsection{#1}}}
\renewcommand\section{\@ifstar{\@sectionstar}{\@sectionnostar}}
\makeatother
% Pictures settings
\graphicspath{{Pictures/}} % Folder of pictures
\newcommand\Picture[2][]{ % This command automatically centers the picture and fits its size to the page. It supports captions too.
\begin{center}
\includegraphics[max size={0.8\textwidth}{0.5\textheight}]{#2}\\
#1
\end{center}
}
% Paragraphs settings
\setlength{\parskip}{4mm plus 2mm minus 2mm} % Spacing between paragraphs (+/-)
% Page header and footer settings
\setlength{\headheight}{15pt}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{ \markboth{{\chaptername~\thechapter.~#1}}{} }
\renewcommand{\sectionmark}[1]{ \markright{\thesection.~#1} }
\fancyhead{}
\fancyhead[OR]{\rightmark}
\fancyhead[EL]{\leftmark}
\setlength{\footskip}{1.5cm}
% Fixing the issues of the numbering
\renewcommand{\thepart}{\Alph{part}}
%\renewcommand{\thechapter}{\Alph{part}.\arabic{chapter}}
\renewcommand{\thesection}{\arabic{section}.\arabic{chapter}}
%\renewcommand{\thesection}{\Alph{part}.\arabic{section}.\arabic{chapter}}
%\renewcommand{\thesubsection}{\Alph{part}.\arabic{subsection}.\arabic{section}.\arabic{chapter}}
%\renewcommand{\thesubsubsection}{\Alph{part}.\arabic{subsubsection}.\arabic{subsection}.\arabic{section}.\arabic{chapter}}
\setcounter{secnumdepth}{1}
\setcounter{tocdepth}{1}
% Global settings for code and console
\lstset{frame=single, basicstyle=\ttfamily, breaklines=true, showlines, aboveskip=\parskip, extendedchars}
% C source code
\lstdefinestyle{C}{language=C, showstringspaces=false, numbers=left, escapechar=§,
keywordstyle=\bfseries\color{RoyalBlue}, commentstyle=\itshape\color{Gray},
numberstyle=\color{Gray}, stringstyle=\color{Crimson},
directivestyle=\color{DarkOrange},
deletekeywords={return,if,else,switch,for,while,do,const,static,sizeof},
morekeywords={SDL_Surface,Uint32,SDL_Rect,SDL_Event,SDL_TimerID,SDL_NewTimerCallback,TTF_Font,SDL_Color,
FMOD_SYSTEM,FMOD_RESULT,FMOD_SOUND,FMOD_CHANNEL,FMOD_CHANNELGROUP,FMOD_BOOL,FMOD_DSP_FFT_WINDOW,size_t},
morekeywords=[2]{return,if,else,switch,for,while,do,const,static,sizeof}, keywordstyle=[2]\bfseries\color{Magenta},
morekeywords=[3]{printf,scanf,fprintf,fscanf,fputc,fgetc,fputs,fgets,fopen,fclose,fseek,ftell,rewind,srand,rand,
time,SDL_Delay,SDL_GetTicks,SDL_AddTimer,SDL_RemoveTimer,TTF_OpenFont,TTF_CloseFont,TTF_Init,TTF_GetError,TTF_Quit,
malloc,free,SDL_CreateRGBSurface,SDL_FreeSurface,SDL_BlitSurface,SDL_LoadBMP,SDL_WM_SetIcon,IMG_Load,SDL_GetError,
SDL_Init,SDL_Quit,SDL_SetVideoMode,SDL_WM_SetCaption,SDL_FillRect,SDL_Flip,SDL_MapRGB,SDL_SetAlpha,SDL_SetColorKey,
SDL_PollEvent,SDL_WaitEvent,SDL_EnableKeyRepeat,SDL_ShowCursor,SDL_WarpMouse,TTF_RenderText_Blended,
TTF_SetFontStyle,sprintf,TTF_RenderText_Shaded,FMOD_System_Create,FMOD_System_Init,FMOD_System_Close,
FMOD_System_Release,FMOD_System_CreateSound,FMOD_System_PlaySound,FMOD_Sound_Release,FMOD_System_GetChannel,
FMOD_System_GetMasterChannelGroup,FMOD_Sound_SetLoopCount,FMOD_Channel_GetPaused,FMOD_Channel_SetPaused,
FMOD_Sound_Release,FMOD_ChannelGroup_GetPaused,FMOD_ChannelGroup_SetPaused,FMOD_Channel_GetSpectrum,
SDL_LockSurface,SDL_UnlockSurface},
keywordstyle=[3]\color{RoyalBlue},
}
\lstnewenvironment{Csource}{\lstset{style=C}\setLTR}{\unsetLTR}
% Console
\lstnewenvironment{Console}{\setLTR}{\unsetLTR}
% Table settings
\setlength{\tabulinesep}{2pt}
\setlength{\arrayrulewidth}{2pt}
\taburulecolor{White}
\newenvironment{Table}[1]{ % Accepts 1 parameter which is the number of columns
\taburowcolors[2] 2{LightGray!40 .. LightGray!80}
\begin{center}
\begin{tabu}{*{#1}{|r}|}
\toprule
\rowfont{\bfseries\color{White}}
\rowcolor{OrangeRed}
\everyrow{\hline}
}{
\end{tabu}
\end{center}
}
\newenvironment{Table*}[1]{
\taburowcolors[1] 2{LightGray!40 .. LightGray!80}
\begin{center}
\begin{tabu}{*{#1}{|r}|}
\toprule
\everyrow{\hline}
}{
\end{tabu}
\end{center}
}
% Footnote rule
\renewcommand{\footnoterule}{\rule[5pt]{0.6\textwidth}{0.5pt}}
\begin{document}
\includepdf{FrontCover.pdf}
\setcounter{page}{-2}
\include{Title_page}
\include{Project_page}
\include{Introduction}
\include{Introduction_original}
\tableofcontents
\part{أساسيّات البرمجة بلغة \textenglish{C}}
\include{Chapter_I-1}
\include{Chapter_I-2}
\include{Chapter_I-3}
\include{Chapter_I-4}
\include{Chapter_I-5}
\include{Chapter_I-6}
\include{Chapter_I-7}
\include{Chapter_I-8}
\include{Chapter_I-9}
\part{تقنيات متقدّمة في لغة \textenglish{C}}
\include{Chapter_II-1}
\include{Chapter_II-2}
\include{Chapter_II-3}
\include{Chapter_II-4}
\include{Chapter_II-5}
\include{Chapter_II-6}
\include{Chapter_II-7}
\include{Chapter_II-8}
\include{Chapter_II-9}
\include{Chapter_II-10}
\part{إنشاء الألعاب ثنائية الأبعاد باستخدام \textenglish{SDL}}
\include{Chapter_III-1}
\include{Chapter_III-2}
\include{Chapter_III-3}
\include{Chapter_III-4}
\include{Chapter_III-5}
\include{Chapter_III-6}
\include{Chapter_III-7}
\include{Chapter_III-8}
\include{Chapter_III-9}
\part{هياكل البيانات}
\include{Chapter_IV-1}
\include{Chapter_IV-2}
\include{Chapter_IV-3}
\include{Conclusion}
\includepdf{BackCover.pdf}
\end{document}