summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/quran-ur/quran-ur.sty
blob: c2974295a9da8ee99fb17e69495d1878aceb3ce9 (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
%% This is file `quran-ur.sty', and it's completely relies on the quran package.
%%
%% Copyright © 2019-2020 by Seiied-Mohammad-Javad Razavian
%% <javadr@gmail.com>
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% This work is “author-maintained” (as per LPPL maintenance status)
%% by Seiied-Mohammad-Javad Razavian..
%% The Current Maintainer of this work is Seiied-Mohammad-Javad Razavian.
%%
%% This work consists of the files quran-ur.sty,
%% qurantext-uri.translation.def, qurantext-urii.translation.def,
%% qurantext-uriii.translation.def, qurantext-uriv.translation.def,
%% qurantext-urv.translation.def, qurantext-urvi.translation.def,
%% qurantext-urvii.translation.def, qurantext-urviii.translation.def,
%% quran-ur-doc.tex, quran-ur-doc.pdf, and quran.png.
%%
%% To one having devoted his life to the Holy Quran
%%
\NeedsTeXFormat{LaTeX2e}
\def\quranurdate{2021/02/02}
\def\quranurversion{0.21}
\ProvidesPackage{quran-ur}[%
\quranurdate\space v\quranurversion\space^^J
Urdu translations extension to the quran package.%
]
\RequirePackage{xstring}
\RequirePackage{biditools}
\RequirePackage{xkeyval}
\define@boolkeys{quran-ur.sty}[ur@]{ahmedali,jalandhry,jawadi,junagarhi,kanzuliman,maududi,najafi,qadri,all}[true]
\DeclareOptionX*{\PassOptionsToPackage{\CurrentOption}{quran}}
\DeclareOption*{\PackageWarning{quran-ur}{Unknown option ‘\CurrentOption’}}
\ProcessOptionsX\relax
\ifur@all
    \ExecuteOptionsX{ahmedali,jalandhry,jawadi,junagarhi,kanzuliman,maududi,najafi,qadri}
\else
    \ExecuteOptionsX{jalandhry}
\fi
\RequirePackage{quran}
\ifqt@wordwise%
    \let\qt@newcmd\newcommand
\else%
    \let\qt@newcmd\bidi@newrobustcmd
\fi%
\input{qurantext-urii.translation.def}%
%
\ifur@maududi%
    \PackageInfo{quran-ur}{Abul A'ala Maududi's translation is chosen.}%
\fi%
\ifur@kanzuliman%
    \PackageInfo{quran-ur}{Ahmed Raza Khan's translation is chosen.}%
\fi%
\ifur@ahmedali%
    \PackageInfo{quran-ur}{Ahmed Ali's translation is chosen.}%
\fi%
\ifur@jalandhry%
    \PackageInfo{quran-ur}{Fateh Muhammad Jalandhry's translation is chosen.}%
\fi%
\ifur@qadri%
    \PackageInfo{quran-ur}{Tahir ul Qadri's translation is chosen.}%
\fi%
\ifur@jawadi%
    \PackageInfo{quran-ur}{Syed Zeeshan Haider Jawadi's translation is chosen.}%
\fi%
\ifur@junagarhi%
    \PackageInfo{quran-ur}{Muhammad Junagarhi's translation is chosen.}%
\fi%
\ifur@najafi%
    \PackageInfo{quran-ur}{Muhammad Hussain Najafi's translation is chosen.}%
\fi%
\newcount\trans@ur
\trans@ur=\@ne
\define@choicekey*+{quran-ur}{trans}[\val\nr]{ahmedali,jalandhry,jawadi,junagarhi,kanzuliman,maududi,najafi,qadri}{%
    \ifcase\nr\relax
        \global\trans@ur=\z@\relax
    \or
        \global\trans@ur=\@ne\relax
    \or
        \global\trans@ur=\tw@\relax
    \or
        \global\trans@ur=\thr@@\relax
    \or
        \global\trans@ur=4\relax
    \or
        \global\trans@ur=5\relax
    \or
        \global\trans@ur=6\relax
    \or
        \global\trans@ur=7\relax
 \fi}{%
    \PackageWarning{quran-ur}{\string \urSetTrans' paramenter should be one of  `maududi', `kanzuliman', `ahmedali', `jalandhry', `qadri', `jawadi', `junagarhi', or `najafi'. The package sets to `jalandhry' by default.}{}%
    \global\trans@ur=\@ne\relax
}%
\newcommand*{\urGetTrans}{%
    \ifcase\trans@ur
        ahmedali%
    \or
        jalandhry%
    \or
        jawadi%
    \or
        junagarhi%
    \or
        kanzuliman%
    \or
        maududi%
    \or
        najafi%
    \or
        qadri%
    \fi%
}
\newcommand{\urSetTrans}[1]{%
\IfInteger{#1}%
{%Yes
\count255=#1%
\advance\count255 by -1\relax%
\trans@ur=\count255}%
{%NO
\setkeys{quran-ur}{trans=#1}}%
%
%\makeatother
%\let\bidi@newrobustcmd\bidi@renewrobustcmd
%\makeatletter
\ifqt@wordwise%
    \makeatother\let\qt@newcmd\renewcommand\makeatletter%
\else%
    \makeatother\let\qt@newcmd\bidi@renewrobustcmd\makeatletter%
\fi%
\ifcase\trans@ur%0
    \ifur@ahmedali%
        \ifx\basmalahur\relax\else%
            \def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
        \fi%
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-uri.translation.def}%
    \else%
        \PackageError{quran-ur}{Ahmed Ali's translation has not been loaded}{}%
    \fi%
\or%1
    \ifur@jalandhry
        \ifx\basmalahur\relax\else%
            \def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-urii.translation.def}%
    \else%
        \PackageError{quran-ur}{Fateh Muhammad Jalandhry's translation has not been loaded}{}%
    \fi
\or%2
    \ifur@jawadi
        \ifx\basmalahur\relax\else%
            \def\basmalahur{عظیم اور دائمی رحمتوں والے خدا کے نام سے \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{عظیم اور دائمی رحمتوں والے خدا کے نام سے \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-uriii.translation.def}%
    \else%
        \PackageError{quran-ur}{Syed Zeeshan Haider Jawadi's translation has not been loaded}{}%
    \fi
\or%3
    \ifur@junagarhi
        \ifx\basmalahur\relax\else%
            \def\basmalahur{شروع کرتا ہوں اللہ تعالیٰ کے نام سے جو بڑا مہربان نہایت رحم واﻻ ہے \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{شروع کرتا ہوں اللہ تعالیٰ کے نام سے جو بڑا مہربان نہایت رحم واﻻ ہے \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-uriv.translation.def}%
    \else%
        \PackageError{quran-ur}{Muhammad Junagarhi's translation has not been loaded}{}%
    \fi
\or%4
    \ifur@kanzuliman
        \ifx\basmalahur\relax\else%
            \def\basmalahur{اللہ کے نام سے شروع جو بہت مہربان رحمت والا \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{اللہ کے نام سے شروع جو بہت مہربان رحمت والا \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-urv.translation.def}%
    \else%
        \PackageError{quran-ur}{Ahmed Raza Khan's translation has not been loaded}{}%
    \fi
\or%5
    \ifur@maududi
        \ifx\basmalahur\relax\else%
            \def\basmalahur{اللہ کے نام سے جو رحمان و رحیم ہے \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{اللہ کے نام سے جو رحمان و رحیم ہے \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-urvi.translation.def}%
    \else%
        \PackageError{quran-ur}{Abul A'ala Maududi's translation has not been loaded}{}%
    \fi
\or%6
    \ifur@najafi
        \ifx\basmalahur\relax\else%
            \def\basmalahur{(شروع کرتا ہوں) اللہ کے نام سے جو بڑا مہربان نہایت رحم والا ہے۔ \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{(شروع کرتا ہوں) اللہ کے نام سے جو بڑا مہربان نہایت رحم والا ہے۔ \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-urvii.translation.def}%
    \else%
        \PackageError{quran-ur}{Muhammad Hussain Najafi's translation has not been loaded}{}%
    \fi
\or%7
    \ifur@qadri
        \ifx\basmalahur\relax\else%
            \def\basmalahur{اللہ کے نام سےشروع جو نہایت مہربان ہمیشہ رحم فرمانےوالا ہے \qt@par}%
        \fi
        \bidi@renewrobustcmd\ToggleBasmalahur{%
            \ifx\basmalahur\relax%
                \def\basmalahur{اللہ کے نام سےشروع جو نہایت مہربان ہمیشہ رحم فرمانےوالا ہے \qt@par}%
            \else%
                \let\basmalahur\relax%
            \fi%
        }%
        \input{qurantext-urviii.translation.def}%
    \else%
        \PackageError{quran-ur}{Tahir ul Qadri's translation has not been loaded}{}%
    \fi
\else%
    \PackageError{quran-ur}{\string \urSetTrans{} paramenter should be between 1 to 8}{}%
\fi
}%
\bidi@newrobustcmd\ToggleBasmalahur{%
    \ifx\basmalahur\relax%
        \ifcase\trans@ur% ahmedali
            \def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
        \or% jalandhry
            \def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
        \or% jawadi
            \def\basmalahur{عظیم اور دائمی رحمتوں والے خدا کے نام سے \qt@par}%
        \or% junagarhi
            \def\basmalahur{شروع کرتا ہوں اللہ تعالیٰ کے نام سے جو بڑا مہربان نہایت رحم واﻻ ہے \qt@par}%
        \or% kanzuliman
            \def\basmalahur{اللہ کے نام سے شروع جو بہت مہربان رحمت والا \qt@par}%
        \or% maududi
            \def\basmalahur{اللہ کے نام سے جو رحمان و رحیم ہے \qt@par}%
        \or% najafi
            \def\basmalahur{(شروع کرتا ہوں) اللہ کے نام سے جو بڑا مہربان نہایت رحم والا ہے۔ \qt@par}%
        \or% qadri
            \def\basmalahur{اللہ کے نام سےشروع جو نہایت مہربان ہمیشہ رحم فرمانےوالا ہے \qt@par}%
        \fi%
    \else%
        \let\basmalahur\relax%
    \fi%
}%
\let\qt@doqt@orig\qt@doqt
%%%%%%%%%%%%%%%%%%%%%%%%%%
\bidi@apptocmd{\ToggleBasmalah}{\ToggleBasmalahur}{}{}
\let\ToggleBasmalah@orig\ToggleBasmalah
\def\basmalahur{شروع الله کا نام لے کر جو بڑا مہربان نہایت رحم والا ہے \qt@par}%
\def\Basmalahur{%
        \begingroup%
        \let\par\relax%
        \def\qt@no##1{\relax}%
        \quranayahur[1][1][1]%
        \endgroup%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand\qt@dour{ o o }{%
    \addtocounter{qt@count}{1}%
    \def\@qtexp{}%
    \loop%
        \global\xdef\@qtexp{\@qtexp\csname qurantrans@ur@\roman{qt@count}\endcsname\ifnum\value{qt@count}=\qt@max\else\space\fi\qt@par}%
        \ifnum\value{qt@count}<\qt@max\relax%
        \addtocounter{qt@count}{1}%
    \repeat%
    \IfNoValueTF{#1}%
    {\@qtexp}%true
    {\qt@WordCount=0\relax\c@qt@start=\numexpr#1-1\relax%
    \readlist*\qt@words{\@qtexp}%
        \IfNoValueTF{#2}%
        {\c@qt@end=\numexpr\qt@wordslen+1\relax}{\c@qt@end=\numexpr#2+1\relax}%
        \foreachitem\qt@word\in\qt@words{%
            \ifnum\qt@wordcnt>\c@qt@start\ifnum\qt@wordcnt<\c@qt@end\qt@word\ifnum\qt@wordcnt=\numexpr\c@qt@end-1\relax\else\xspace\fi\fi\fi%
        }%
        \qt@showitems{\ifdefined\arabicfont\arabicfont\fi\showitems\qt@words}%
    }%false
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\qurantextur}{ s O{\qt@default} o t{+} }{%
    \IfBooleanTF{#4}{\def\qt@showitems##1{\footnote{##1}}}{\def\qt@showitems##1{\relax}}%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\IfBooleanTF{#4}{\qurantext*[#2][#3]+}{\qurantext*[#2][#3]}}%
    {\IfBooleanTF{#4}{\qurantext[#2][#3]+}{\qurantext[#2][#3]}}%
    \let\qt@doqt\qt@doqt@orig%
    \def\qt@showitems##1{\relax}%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand\quransurahur{ s O{\qt@surah@default} }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quransurah*[#2]}%
    {\quransurah[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranayahur}{ s o o o t{+} }{%
    \let\qt@doqt\qt@dour%
    \let\ToggleBasmalah\ToggleBasmalahur%
    \IfBooleanTF{#1}%
    {\IfBooleanTF{#5}{\quranayah*[#2][#3][#4]+}{\quranayah*[#2][#3][#4]}}%
    {\IfBooleanTF{#5}{\quranayah[#2][#3][#4]+}{\quranayah[#2][#3][#4]}}%
    \let\qt@doqt\qt@doqt@orig%
    \let\ToggleBasmalah\ToggleBasmalah@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranjuzur}{ s o }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quranjuz*[#2]}%
    {\quranjuz[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranpageur}{ s o }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quranpage*[#2]}%
    {\quranpage[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranquarterur}{ s o }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quranquarter*[#2]}%
    {\quranquarter[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranrukuur}{ s o }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quranruku*[#2]}%
    {\quranruku[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranhizbur}{ s o }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quranhizb*[#2]}%
    {\quranhizb[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\DeclareDocumentCommand{\quranmanzilur}{ s o }{%
    \let\qt@doqt\qt@dour%
    \IfBooleanTF{#1}%
    {\quranmanzil*[#2]}%
    {\quranmanzil[#2]}%
    \let\qt@doqt\qt@doqt@orig%
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%
%% End of file `quran-ur.sty'.