summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/xelatex/quran/quran-doc.tex
blob: ff440129dd124457fa43cd82d5ee9244ab1c24e7 (plain)
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
\documentclass{ltxdoc}
%\usepackage{caption}
\usepackage{forloop}
\usepackage{pgf}
%\usepackage{pgfcalendar}
\usepackage{framed}
\usepackage{holtxdoc}
\usepackage{url}
\usepackage{quran}
\usepackage{listings}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fontspec}
\newfontfamily\quran{Scheherazade}
% because of definition of \XeTeX and \XeLaTeX symbols in bidi, I should undef these macro that are also defined in holtxdoc package. 
\makeatletter
\bidi@undef\XeTeX
\bidi@undef\XeLaTeX
\makeatother
\usepackage{bidi}
\makeatletter
\bidi@preto\qurantext{\quran}
\makeatother

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

\def\boxcs#1{\leftline{\fbox{\mcs{#1}}}}
\def\mcs#1{\lr{\texttt{\textbackslash{}#1}}}
\def\tt#1{\lr{\texttt{#1}}}
\lstdefinestyle{BashInputStyle}{
  language=bash,
  basicstyle=\footnotesize\sffamily,
%  numbers=left,
%  numberstyle=\tiny,
%  numbersep=3pt,
  frame=tb,
  columns=fullflexible,
  backgroundcolor=\color{gray!10},
%  linewidth=0.9\linewidth,
%  xleftmargin=0.1\linewidth
}
\def\qp#1{
\begin{minipage}{.6\textwidth}
    #1
\end{minipage}
}

% Define box and box title style
\tikzstyle{mybox} = [draw=black, fill=gray!20, very thick,
    rectangle, rounded corners, inner sep=10pt, inner ysep=20pt]
\tikzstyle{fancytitle} =[fill=gray, text=white]

\def\mx#1#2{\mybox{#1}{#2}{.45\textwidth}}
\def\mxf#1#2{\mybox{#1}{#2}{\textwidth}}

\def\mybox#1#2#3{
\begin{tikzpicture}
\setRTL
\node [mybox] (box){%
    \begin{minipage}[t]{#3}
        #2
    \end{minipage}
};
\node[fancytitle, anchor=west, right=10pt] at (box.north west) {\small \cs{#1}};
\node (hole) [anchor=north east, left=5pt ] at (box.north east) { \tikz\fill[very thick,white] (0,0) circle (12pt); };
\node[ ] at (hole.center) {\includegraphics[width=.05\textwidth]{quran.png}};
\end{tikzpicture}%
}

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

\title{\includegraphics[scale=.3]{quran.png}\\
The \xpackage{quran} Package\footnote{to one who has devoted his life to Quran}}
\author{Seiied Mohammad Javad Razavian\\\xemail{javadr@gmail.com}}

\date{November 8, 2016}

\begin{document}
\maketitle

\begin{framed}
This manual is incomplete and the package is under development. \par 
\centerline{ver 1.22}
\end{framed}

\tableofcontents
\newpage

\section{Introduction}
This package is prepared for typesetting the Holy Quran. This work is inspired by \xpackage{lipsum} and 
\xpackage{ptext} packages, provides several macros for
typesetting the whole or any parts of the Holy Quran based on its popular division.

\section{Loading Package}
You can load the package in the ordinary way
\cs{usepackage[option]\{quran\}}.
After loading the package, it writes some information about itself to the
terminal and to the log file, too. The information is something like:

\begin{lstlisting}[style=BashInputStyle, language=tex]
Package: quran 2016/05/15 v1.14 An easy way to typeset the whole or any part of The Holy Quran
\end{lstlisting}

\section{Typesetting The Holy Quran}
For typesetting any parts or whole of The Holy Quran there are several macros in the package.

\subsection{Surah/Sovar}
\begin{declcs}{quransurah}\oarg{m}
\end{declcs}
This macro can typeset any Surah of Quran. As you know there are 114 Sovar, so \textit{m} could 
be an integer between 1 to 114. The macro also could accept the transliteration of surah's name, 
e.g. both of \cs{quransurah[1]} and \cs{quransurah[Al-Fatiha]} have the same effect. For using 
surah's name instead of their order see table~\ref{tab1}.
\marginpar{\cs{quransurah[1]}}\marginpar{\cs{quransurah[Al-Fatiha]}}
    \centerline{\hbox{\mx{quransurah[94]}{\quransurah[94]}\hfill
    \mx{quransurah[At-Tin]}{\quransurah[At-Tin]}}}
    
\begin{declcs}{quransurah}\oarg{m-n}
\end{declcs}
This acts like above but can typeset \textit{m}$^{th}$ Surah to \textit{n}$^{th}$  one. 

\begin{declcs}{quransurah}\oarg{m{-}{-}n}
\end{declcs}
In this case m and n are tranliterations of surah's names, e.g. \cs{quransurah[An-Nasr--An-Nas]}.
\marginpar{\cs{quransurah[An-Nasr--An-Nas]}}

    \centerline{\hbox{\mx{quransurah[109-110]}{\quransurah[109-110]}\hfill
    \mx{quransurah[Al-Masadd--Al-Ikhlas]}{\quransurah[Al-Masadd--Al-Ikhlas]}}}
    
\newcounter{ct}
\def\mycell#1{
    \surahname[\value{#1}]
    \addtocounter{#1}{38}
}
\begin{table}[tbhp]
    \centering
    \fontsize{8}{10}\selectfont
    \begin{tabular}{|*{3}{c|l|}}
    \hline
     order & surahname & order  & surahname  & order  & surahname  \\
    \hline\hline%
    \forloop{ct}{1}{\value{ct} < 38}{%
        \thect & \mycell{ct} & \thect & \mycell{ct} & \thect & \mycell{ct}  \\
        \addtocounter{ct}{-114}
    }%
    \thect & \mycell{ct} & \thect & \mycell{ct} & \thect & \mycell{ct}\\%
    \hline
    \end{tabular}
    \protect\caption{Surah's name trasliteration.}\label{tab1}
\end{table}
    

\begin{declcs}{quransurah}
\end{declcs}
Using \cs{quransurah} without its optional argument typeset the default Surah--Al-Ikhlas.

\centerline{\mx{quransurah}{\quransurah}}

To change the default Surah use \cs{setsurahdefault\{m\}}, again m must be between 1 and 114; 
as know noticed package's default is 112.
\marginpar{\cs{setsurahdefault}}

After changing package's default surah to 107 by \cs{setsurahdefault\{107\}}, the output would be like below:

    \setsurahdefault{107}
    \centerline{\mx{quransurah}{\quransurah}}



\subsection{Ayah/Ayat}
\begin{declcs}{quranayah}\oarg{l}\oarg{n}
\end{declcs}
The above macro typeset the \textit{n}$^{th}$ Ayah of \textit{l}$^{th}$ Surah. 

    \centerline{\hbox{\mx{quranayah[33][33]}{\quranayah[33][33]}\hfill
    \mx{quranayah[Al-Ahzab][33]}{\quranayah[Al-Ahzab][33]}}}
    
If you just typeset the first Ayah of any Surah, then the Basmalah will not be printed.
In this case if you need Basmalah, then you can use the \cs{basmalah} macro before.
\marginpar{\cs{basmalah}}

    \centerline{\hbox{\mx{quranayah[Ibrahim][1]}{\quranayah[Ibrahim][1]}\hfill
    \mx{basmalah\textbackslash{}quranayah[14][1]}{\quran\basmalah\quranayah[14][1]}}}

\begin{declcs}{quranayah}\oarg{l}\oarg{m-n}
\end{declcs}
This macro typeset the \textit{m}$^{th}$ to \textit{n}$^{th}$ Ayat of l$^{th}$ Surah. 

\par
\addvspace{4.5ex plus 1ex}%
\vskip -\parskip
\noindent\textit{l} could be an integer less than or equal to 114. It also could be 
the transliteration of  l$^{th}$ Surah's name, see table~\ref{tab1}. 
\textit{n} is diffirent by every Surah and it relies on the number of the Surah's verses. 
\textit{m} should be between 1 and a number less than \textit{n}. 

    \centerline{\hbox{\mx{quranayah[Ash-Shura][22-26]}{\quranayah[Ash-Shura][22-26]}\hfill
    \mx{quranayah[42][22-26]}{\quranayah[42][22-26]}}}

\subsection{Page/Pages}
\begin{declcs}{quranpage}\oarg{n}
\end{declcs}
Typeset the \textit{n}$^{th}$ page of Quran and the macro below typeset \textit{m}$^{th}$ to 
\textit{n}$^{th}$ pages of Quran. 

\begin{declcs}{quranpage}\oarg{m-n}
\end{declcs}
The numbers should be between $1$ to $604$, based on Uthmani text. 

    \centerline{\hboxR{\mx{quranpage*[249]}{\quranpage*[249]}
    \hfill
    \mx{quranpage*[250]}{\quranpage*[250]}}}
    
    * starred version of macros are explained in page~\pageref{starred}; concisely it means
    typesetting that part of the Holy Quran in one paragraph. 
    
    \centerline{\mxf{quranpage*[1-3]}{\quranpage*[1-3]}}
    
\subsection{Juz/Ajza}
\begin{declcs}{quranjuz}\oarg{n}
\end{declcs}
Above macro typesets the \textit{n}$^{th}$ juz of Quran and below macro typesets m$^{th}$ to n$^{th}$ juzzes of Quran. 
\begin{declcs}{quranjuz}\oarg{m-n}
\end{declcs}
The numbers should be between $1$ to $30$.

\subsection{Hizb/Ahzab}
Each juz of Quran is devided into two ahzab (group),  so there are 60 ahzab.
Following macros typeset hizb/ahzab of Quran. 

\begin{declcs}{quranhizb}\oarg{n}
\end{declcs}
\vspace{-12mm}
\begin{declcs}{quranhizb}\oarg{m-n}
\end{declcs}

\subsection{Quarter/Quarters}
Eash hizb of Quran is devided into four quarters, making eight quarters per juz, called maqra. 
There are 240 of these quarters (of hizb) in the Quran. These maqra are often used as sections for revision when memorizing the Quran.\footnote{\url{https://en.wikipedia.org/wiki/Juz'}}
\begin{declcs}{quranquarter}\oarg{n}
\end{declcs}

\vspace{-12mm}

\begin{declcs}{quranquarter}\oarg{m-n}
\end{declcs}

Above macros typeset the \textit{n}$^{th}$ or m$^{th}$ to n$^{th}$ quarter(s) of Quran.   

    \centerline{\mxf{quranquarter*[110]}{\quranquarter*[110]}}
    
\subsection{Ruku/Rukus}
``The term ruk\= uʿ --- roughly translated to ``passage", ``pericope" or ``stanza" --- is also used to denote a group of thematically related verses in the Qur'an. Longer suras (chapters) in the Qur'an are usually divided into several ruk\= us, so that the reciters could identify when to make ruk\= u in Salat without breaking an ongoing topic in the Quranic text."\footnote{\url{https://en.wikipedia.org/wiki/Ruku}}

The following macros can typeset rukus of The Holy Quran the way the above macros act. 

\begin{declcs}{quranruku}\oarg{n}
\end{declcs}

    \centerline{\mxf{quranruku*[363]}{\quranruku*[363]}}
    
\begin{declcs}{quranruku}\oarg{m-n}
\end{declcs}
The numbers should be between $1$ to $556$.

    \centerline{\mxf{quranruku*[58-59]}{\quranruku*[58-59]}} 

    
\subsection{Manzil/Manazil}
``For the convenience of people who wish to read the Qur'an in a week the text may be divided into 7 portions, each portion is known as Manzil.

The following division to 7 equal portions is by Hamza Al-Zayyat (d.156/772):
\begin{enumerate}
    \item Al-Fatihah (chapter 1) through An-Nisa' (chapter 4) consisting of 4 surahs.
    \item Al-Ma'ida (chapter 5) through At-Tawba (chapter 9) consisting of 5 surahs.
    \item Yunus (chapter 10) through An-Nahl (chapter 16) consisting of 7 surahs.
    \item Al Isra' (chapter 17) through Al-Furqan (chapter 25) consisting of 9 surahs.
    \item Ash-Shuara' (chapter 26) through Ya-Seen (chapter 36) consisting of 11 surahs.
    \item As-Saaffat (chapter 37) through Al-Hujarat (chapter 49) consisting of 13 surahs.
    \item Qaf (chapter 50) through An-Nass (chapter 114) consisting of 65 surahs.''\footnote{\url{https://en.wikipedia.org/wiki/Manzil}}
\end{enumerate}

Following macros typeset manzil/manazil of Quran.

\begin{declcs}{quranmanzil}\oarg{n}
\end{declcs}
\vspace{-12mm}
\begin{declcs}{quranmanzil}\oarg{m-n}
\end{declcs}

\subsection{Text of Quran}
The following macro is the heart of all macros that can typeset any range of Quran. As you know there 
are $6236$ Ayat in Quran. This macro can typeset a specific Ayah or any range of Ayat. 

\begin{declcs}{qurantext}\oarg{n}
\end{declcs}
Typesets the \textit{n}$^{th}$ Ayah of Quran. 

\centerline{\mxf{qurantext[1023]}{\begingroup\qurantext[1023]\endgroup}}

\begin{declcs}{qurantext}\oarg{m-n}
\end{declcs}
Typesets any range of Ayat from the \textit{m}$^{th}$ to \textit{n}$^{th}$ Ayah. 

    \centerline{\mxf{qurantext*[4111-4117]}{\begingroup\qurantext*[4111-4117]\endgroup}}
 
Using \cs{qurantext} without its optional argument typeset [1-7] --Al-Hamd. To
change the default text use \cs{setqurantextdefault\{m-n\}}
\marginpar{\cs{qurantext}}
\marginpar{\cs{setqurantextdefault\{m-n\}}}

    \centerline{\mx{qurantext}{\qurantext}}
    
    below, the default is changed to \cs{setqurantextdefault\{4128-4147\}}:
    
    \setqurantextdefault{4128-4147}
    \centerline{\mxf{qurantext*}{\qurantext*}}

\subsection{Whole of The Holy Quran}
The following macros can typeset whole of The Holy Quran:

\begin{itemize}
    \item \cs{quransurah[1-114]}
    \item \cs{quranjuz[1-30]}
    \item \cs{quranpage[1-604]}
    \item \cs{qurantext[1-6236]}
    \item \cs{quranhizb[1-60]}
    \item \cs{quranquarter[1-240]}
    \item \cs{quranruku[1-556]}
    \item \cs{quranmanzil[1-7]}
\end{itemize}

\section{Miscellaneous}

\subsection{Name of Surah}
\begin{declcs}{surahname}\oarg{m}
\end{declcs}
This macro returns the tranliteration of \textit{m}$^{th}$ Surah.

\begin{declcs}{surahname*}\oarg{m}
\end{declcs}
This macro returns the arabic name of \textit{m}$^{th}$ Surah.

    \centerline{\hbox{\mx{surahname[19]}{\surahname[19]}
    \hfill
    \mx{surahname*[19]}{\quran\surahname*[19]}}}
    
\subsection{Basmalah}
\begin{declcs}{basmalah}
\end{declcs}
It provides the basmalah in arabic text which every Surah is started by that.

    \centerline{\mx{basmalah}{\quran\basmalah}}
    
\subsection{Index Converting}
\begin{declcs}{indexconvert}\marg{index}\marg{surah macro}\marg{ayah macro}
\end{declcs}
This command converts an index number between 1 to 6236 
to its exact surah's index and ayah's index. The index must be a number or
\TeX{} counter, the surah macro and ayah macro must be \TeX{} macro names. They
will be set to numbers representing the surah and ayah of the given index in whole of Quran.

\section{Options to The Package}
All text generated by macros of this package will be separated by the macro \cs{par}. Sometimes, 
a version of text without \cs{par} is desired. Therefore the package provides the option 
\texttt{nopar}\marginpar{\texttt{nopar}}
that causes no macros of the package terminated by \cs{par}.
Another way for achieving this, is using the starred version of macros. All macros of the package
has a starred version that omit the \cs{par} macro in typesetting the text of Quran. 

\label{starred}
In some cases maybe user wants to typeset the Ayat without their following numbers that can be seen in printed version of The Holy Quran. The \texttt{nonumber}\marginpar{nonumber} 
option tells the package that print no number after ayah.
But sometimes we want to typeset just some Ayat without theirs, so there is a \cs{ToggleAyahNumber} macro
that can cause numbers will be omitted. With \texttt{nonumber} option this macro acts vice versa, it mean it 
causes that Ayat number will be printed.

    \centerline{\mxf{ToggleAyahNumber\textbackslash{}quransurah*[89]}
    {\ToggleAyahNumber\quransurah*[89]}}  
    
By default, the package typesets the text of The Holy Quran in simple script, but if you prefer the Uthmani script you can use \texttt{uthmani} \marginpar{uthmani} 
option. Compare the following text to figure out the differences between default and uthmani script.
    \centerline{\hbox{
    \mx{quransurah*[1] (default)}{\includegraphics{defaulttext.pdf}}
    \hfill
    \mx{quransurah*[1] (uthmani)}{\includegraphics{uthmanitext.pdf}}
    }}
    
\section{Acknowledgment}
At first, I should appreciate Vafa Khaligi by preparing such adorable packages --\xpackage{bidi} and 
\xpackage{xepersian}. Secondly, the costly \url{http://tanzil.net/} for providing the text of The Holy Quran that 
is developed by Hamid Zarrabi-Zadeh. And finally, people in Parsi\LaTeX\footnote{\url{http://parsilatex.com/}}
group who tested and commented this work in advance. 

\section{Frequently Asked Questions}
    \subsection{What is the best font for typesetting quran text?}
    We strongly recommend you to use "Scheherazade" font.%
    \footnote{\url{http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=scheherazade}} 
    Scheherazade is released under the SIL Open Font License (OFL), version 1.1. Copyright (c) 2004-2015,
    SIL International (http://scripts.sil.org/) with Reserved Font Names "Scheherazade" and "SIL". Therefore
    you can freely download it. 
    All examples in this document use this font.  
    
    \subsection{How to use \xpackage{quran} package?}
    As you've noticed, for typesetting quran text you need a package that can typeset text
    in RTL mode in additon to using UTF8 fonts. The \xpackage{polyglossia}, 
    \xpackage{fontspec}, and \xpackage{bidi} will do that for you. 
    You can also use \xpackage{xepersian} that depends on \xpackage{fontspec}, too. 
    Below, we demonstrated two examples for both approaches:

\begin{lstlisting}[style=BashInputStyle, language=tex, title=``example: with polyglossia{,} 
fontspec{,} and bidi"]
\documentclass[12pt]{article}

\usepackage{quran}

%%% for typesetting arabic text
\usepackage{polyglossia}
\setotherlanguage{arabic}

\usepackage{fontspec}
\setmainfont{Scheherazade}

%%% for typesetting in Rigth-To-Left direction
\usepackage{bidi}

\begin{document}

\setRTL % tell bidi to typeset the text in Rigth-To-Left direction
\textarabic{\quransurah}

\end{document}
\end{lstlisting}    
    

\begin{lstlisting}[style=BashInputStyle, language=tex, title=``example: with xepersian"]
\documentclass[12pt]{article}

\usepackage{quran}

%%% for typesetting Persian/Arabic text in Rigth-To-Left direction
\usepackage{xepersian}
\settextfont{Scheherazade}

\begin{document}

\quransurah

\end{document}
\end{lstlisting}  
    
    \subsection{How to set quran default font?}
        If you want to automatically change the font of quran text in your document, you 
        can put your willing font in precede of \cs{qurantext} like below:
        
        In case you are using \xpackage{xepersian}, put below commands in preamble:
        
\begin{lstlisting}[style=BashInputStyle]
\defpersianfont\quran{Scheherazade}
\makeatletter
\bidi@preto\qurantext{\quran}
\makeatother
\end{lstlisting}

    In case you are using \xpackage{fontspec}, put below commands in preamble:
\begin{lstlisting}[style=BashInputStyle]
\usepackage{etoolbox}
\newfontfamily\quran{Scheherazade}
\preto\qurantext{\quran}
\end{lstlisting}

    \subsection{How to typeset a portion of the Holy Quran in one paragraph
    with no ayah number without affecting the behaviour of \xpackage{quran} package 
    in other cases?}
    
    Just put the code that was describled on page~\pageref{starred} in a group like:
\begin{lstlisting}[style=BashInputStyle]
{\ToggleAyahNumber\quransurah*}
\end{lstlisting}    

\end{document}