-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanglatex.sty
405 lines (318 loc) · 16 KB
/
banglatex.sty
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
% Copyright 2013 by M.A.H. Newton [email protected]
% This file may be distributed and/or modified freely.
% The author has no liability under any circumstances.
% Use sample.tex for usage/installation details
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{banglatex}[2013/08/02 M.A.H. Newton's XeLatex Style File for Bengali]
\RequirePackage{ltxcmds}
\newcommand{\IfPackageLoaded}[2]{\ltx@ifpackageloaded{#1}{#2}{}}
\RequirePackage{xunicode}
\RequirePackage{xltxtra}
\RequirePackage{fontspec}
\RequirePackage{polyglossia}
\RequirePackage{fancyhdr}
\RequirePackage{amsmath}
\RequirePackage{xcolor}
\definecolor{bnred}{cmyk}{0,1,1,0}
\definecolor{bnblue}{cmyk}{1,1,0,0}
\definecolor{bngreen}{cmyk}{1,0,1,0.25}
\definecolor{bncyan}{cmyk}{1,0,0,0}
\definecolor{bnmagenta}{cmyk}{0,1,0,0}
\definecolor{bnyellow}{cmyk}{0,0,1,0}
\definecolor{bnblack}{cmyk}{0,0,0,1}
\definecolor{bnwhite}{cmyk}{0,0,0,0}
\definecolor{bngrey}{cmyk}{0,0,0,0.5}
\newfontface\bengalifont[Script=Bengali]{SolaimanLipi} % Default font
\setromanfont{NikoshLight} % roman font
\setsansfont{SolaimanLipi} % sans font
\setmonofont[Scale=0.85]{Siyam Rupali} % mono font
\setmainlanguage[numerals=Bengali]{bengali}
\selectlanguage{bengali}
\selectbackgroundlanguage{bengali}
% Font files to be used for different semantic elements.
% You can change the fonts as you wish
\newfontface\bnrm[Script=Bengali,Scale=1.12]{NikoshLight} % Bengali substitution for roman
\newfontface\bnbr[Script=Bengali,Scale=1.12]{Nikosh} % Bengali substitution for bold roman
\newfontface\bnsf[Script=Bengali]{SolaimanLipi} % Bengali substitution for sanface
\newfontface\bnbs[Script=Bengali]{SolaimanLipi Bold} % Bengali substitution for bold-sanface
\newfontface\bnit[Script=Bengali,Scale=1.0]{Ekushey Durga} % Bengali substitution for italic
\newfontface\bnbi[Script=Bengali,Scale=1.11]{Ekushey Puja} % Bengali substitution for bold-italic
\newfontface\bnbf[Script=Bengali, Scale=0.81]{Likhan} % Bengali substitution for fashion
\newfontface\bnem[Script=Bengali,Scale=0.91]{Ekushey Punarbhaba}% Bengali substitution for emphasis
\newfontface\bntt[Script=Bengali,Scale=0.85]{Siyam Rupali} % Bengali substitution for teletype
\newfontface\ensr[Script=Bengali,Scale=1.0]{Kalpurush} % Bengali substitution for english-serif
\newfontface\ensn[Script=Bengali,Scale=1.0]{Lalsalu} % Bengali substitution for english-sans
\newcommand{\brm}[1]{{\bnrm {#1}}} % command for bangla roman text
\newcommand{\bbr}[1]{{\bnbr {#1}}} % command for bangla bold roman text
\newcommand{\bsf}[1]{{\bnsf {#1}}} % command for bangla sansface text
\newcommand{\bbs}[1]{{\bnbs {#1}}} % command for bangla bold sansface text
\newcommand{\bit}[1]{{\bnit {#1}}} % command for bangla italic text
\newcommand{\bbi}[1]{{\bnbi {#1}}} % command for bangla bold italic text
\newcommand{\bbf}[1]{{\bnbf {#1}}} % command for bangla boldface text
\newcommand{\bem}[1]{{\bnem {#1}}} % command for bangla emphasis text
\newcommand{\btt}[1]{{\bntt {#1}}} % command for bangla teletype text
\newcommand{\esr}[1]{{\ensr {#1}}} % command for bangla with english-roman
\newcommand{\esn}[1]{{\ensn {#1}}} % command for bangla with enslish-serif
\newcommand\mathen[1]{\mathnormal{{#1}}} % English letters in math mode
\newcommand\mathbn[1]{\mathit{{#1}}} % Bangla letters in math mode
\newcommand\men[1]{\mathen{{#1}}} % Short form of \mathen
\newcommand\mbn[1]{\mathbn{{#1}}} % Short form of \mathbn
\newenvironment{bnroman}{{\bnrm}{}} % environment for bangla roman
\newenvironment{bnboldroman}{\bnbr{}{}} % environment for bangla bold roman
\newenvironment{bnsansface}{\bnsf{}{}} % environment for bangla sansface
\newenvironment{bnboldsansface}{\bnbs{}{}} % environment for bangla bold sansface
\newenvironment{bnitalic}{\bnit{}{}} % environment for bangla italic
\newenvironment{bnbolditalic}{\bnbi{}{}} % environment for bangla bold italic
\newenvironment{bnboldface}{\bnbf{}{}} % environment for bangla boldface
\newenvironment{bnemphasis}{\bnem{}{}} % environment for bangla emphasis
\newenvironment{bnteletype}{\bntt{}{}} % environment for bangla teletype
\newenvironment{enserif}{\ensr{}{}} % environment for bangla with eng-roman
\newenvironment{ensans}{\ensn{}{}} % environment for bangla with eng-sans
%Change this captions as you need
\def\captionsbengali{%
\def\refname{তথ্যসূত্রাবলী}%
\def\abstractname{সারাংশ}%
\def\bibname{গ্রন্থসূত্রাবলী}%
\def\prefacename{পূর্বকথা}%
\def\chaptername{অধ্যায়}%
\def\sectionname{অনুচ্ছেদ}%
\def\subsectionname{উপচ্ছেদ}%
\def\subsubsectionname{উপউপচ্ছেদ}%
\def\paragraphname{পরিচ্ছেদ}
\def\subparagraphname{উপপরিচ্ছেদ}%
\def\appendixname{পরিশিষ্ট}%
\def\contentsname{সূচীপত্র}%
\def\listfigurename{নকশা তালিকা}%
\def\listtablename{সারণী তালিকা}%
\def\listalgorithmname{সংকেত তালিকা}%
\def\lstlistlistingname{ফিরিস্তি তালিকা}%
\def\indexname{সূচক}%
\def\figurename{নকশা}%
\def\tablename{সারনী}%
\def\algorithmname{সংকেত}%
\def\procedurename{প্রণালী}%
\def\functionname{বিপাতক}%
\def\lstlistingname{ফিরিস্তি}
\def\partname{খন্ড}%
\def\pagename{পৃষ্ঠা}%
\def\seename{দেখুন}%
\def\alsoname{আরও দেখুন}%
\def\enclname{সংযুক্তি}%
\def\ccname{অনুলিপি}%
\def\headtoname{প্রতি}%
\def\proofname{প্রমাণ}%
\def\glossaryname{পরিভাষা}%
\def\solutionname{সমাধান}
\def\theoremname{উপপাদ্য}
\def\lemmaname{প্রতিপাদ্য}
\def\corollaryname{অনুসিদ্ধান্ত}
\def\problemname{সমস্যা}
\def\constructionname{সম্পাদ্য}
\def\propositionname{প্রতিজ্ঞা}
\def\definitionname{সংজ্ঞা}
\def\axiomname{স্বতঃসিদ্ধ}
\def\postulatename{স্বীকার্য}
\def\observationname{পর্যবেক্ষণ}
\def\explanationname{ব্যাখ্যা}
\def\remarkname{মন্তব্য}
\def\equationname{সমীকরণ}
\def\examplename{উদাহরণ}
\def\exercisename{অনুশীলনী}
}
% Fix the part number
\ifdefined\thepart
\renewcommand\thepart{\bengalinumber{\arabic{part}}}
\fi
% Fix the footnote, paragraph, subparagraph numbering styles
\renewcommand\thefootnote{\bengalinumber{\arabic{footnote}}}
\renewcommand\theparagraph{\bengalinumber{\arabic{paragraph}}}
\renewcommand\thesubparagraph{\bengalinumber{\arabic{subparagraph}}}
% Fix the chapter, section, subsection, subsubsection numbering styles
\ifx\thechapter\undefined
\renewcommand\thesection{\bengalinumber{\arabic{section}}}
\renewcommand\thesubsection{\bengalinumber{\arabic{section}}.\bengalinumber{\arabic{subsection}}}
\renewcommand\thesubsubsection{\bengalinumber{\arabic{section}}.\bengalinumber{\arabic{subsection}}.\bengalinumber{\arabic{subsubsecton}}}
\renewcommand{\thefigure}{\bengalinumber{\arabic{figure}}}
\renewcommand{\thetable}{\bengalinumber{\arabic{table}}}
\renewcommand{\theequation}{\bengalinumber{\arabic{equation}}}
\AtBeginDocument{
\IfPackageLoaded{listings}
{
\renewcommand{\thelstnumber}{\bengalinumber{\arabic{lstnumber}}}
\renewcommand{\thelstlisting}{\bengalinumber{\arabic{lstlisting}}}
}{}
\IfPackageLoaded{algorithm}
{
\floatname{algorithm}{\algorithmname}
\renewcommand{\thealgorithm}{\bengalinumber{\arabic{algorithm}}}
}{}
\IfPackageLoaded{algorithm2e}
{
\SetAlgorithmName{\algorithmname}{\algorithmname}{\listalgorithmname}
\SetAlgoProcName{\procedurename}{\procedurename}
\SetAlgoFuncName{\functionname}{\functionname}
\renewcommand{\thealgocf}{\bengalinumber{\arabic{algocf}}}
\renewcommand{\theAlgoLine}{\bengalinumber{\arabic{AlgoLine}}}
}{}
}
\else
\renewcommand\thechapter{\bengalinumber{\arabic{chapter}}}
\renewcommand\thesection{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{section}}}
\renewcommand\thesubsection{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{section}}.\bengalinumber{\arabic{subsection}}}
\renewcommand\thesubsubsection{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{section}}.\bengalinumber{\arabic{subsection}}.\bengalinumber{\arabic{subsubsection}}}
\renewcommand{\thefigure}{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{figure}}}
\renewcommand{\thetable}{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{table}}}
\renewcommand{\theequation}{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{equation}}}
\AtBeginDocument{
\IfPackageLoaded{listings}
{
\renewcommand{\thelstnumber}{\bengalinumber{\arabic{lstnumber}}}
\renewcommand{\thelstlisting}{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{lstlisting}}}
}{}
\IfPackageLoaded{algorithm}
{
\floatname{algorithm}{\algorithmname}
\renewcommand{\thealgorithm}{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{algorithm}}}
}{}
\IfPackageLoaded{algorithm2e}
{
\SetAlgorithmName{\algorithmname}{\algorithmname}{\listalgorithmname}
\SetAlgoProcName{\procedurename}{\procedurename}
\SetAlgoFuncName{\functionname}{\functionname}
\renewcommand{\thealgocf}{\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{algocf}}}
\renewcommand{\theAlgoLine}{\bengalinumber{\arabic{AlgoLine}}}
}{}
}
\fi
% Fix the enumeration numbering style
\renewcommand\theenumi{\bengalinumber{\@arabic\c@enumi}}
\renewcommand\theenumii{\bengaliconso{\@arabic\c@enumii}}
\renewcommand\theenumiii{\bengalivowel{\@arabic\c@enumiii}}
\renewcommand\theenumiv{\bengalinumber{\@arabic\c@enumiv}}
% Fix the enumeration labelling style
\renewcommand{\labelenumi}{\theenumi. }
\renewcommand{\labelenumii}{\theenumii) }
\renewcommand{\labelenumiii}{(\theenumiii) }
\renewcommand{\labelenumiv}{\theenumiv। }
% Fix nobreakspace
\def\nobreakspace{\nobreak\space\nobreak}
% Mathmetical theorems and environments
\ifx\thechapter\undefined
\newtheorem{theorem}{{\bnbs\theoremname}}
\newtheorem{lemma}[theorem]{{\bnbs\lemmaname}}
\newtheorem{corollary}[theorem]{{\bnbs\corollaryname}}
\newtheorem{problem}[theorem]{{\bnbs\problemname}}
\newtheorem{construction}[theorem]{{\bnbs\constructionname}}
\newtheorem{proposition}[theorem]{{\bnbs\propositionname}}
\newtheorem{axiom}[theorem]{{\bnbs\axiomname}}
\newtheorem{postulate}[theorem]{{\bnbs\postulatename}}
\newtheorem{observation}[theorem]{{\bnbs\observationname}}
\newtheorem{remark}[theorem]{{\bnbs\remarkname}}
\newtheorem{definition}{{\bnbs\definitionname}}
\newtheorem{explanation}[definition]{{\bnbs\explanationname}}
\newtheorem{example}[definition]{{\bnbs\examplename}}
\newtheorem{exercise}{{\bnbs\exercisename}}
\renewcommand{\thetheorem}{{\bnbs\bengalinumber{\arabic{theorem}}:}}
\renewcommand{\thelemma}{{\bnbs\bengalinumber{\arabic{lemma}}:}}
\renewcommand{\thecorollary}{{\bnbs\bengalinumber{\arabic{corollary}}:}}
\renewcommand{\theproblem}{{\bnbs\bengalinumber{\arabic{problem}}:}}
\renewcommand{\theconstruction}{{\bnbs\bengalinumber{\arabic{construction}}:}}
\renewcommand{\theproposition}{{\bnbs\bengalinumber{\arabic{proposition}}:}}
\renewcommand{\theaxiom}{{\bnbs\bengalinumber{\arabic{axiom}}:}}
\renewcommand{\thepostulate}{{\bnbs\bengalinumber{\arabic{postulate}}:}}
\renewcommand{\theobservation}{{\bnbs\bengalinumber{\arabic{observation}}:}}
\renewcommand{\theremark}{{\bnbs\bengalinumber{\arabic{remark}}:}}
\renewcommand{\thedefinition}{{\bnbs\bengalinumber{\arabic{definition}}:}}
\renewcommand{\theexplanation}{{\bnbs\bengalinumber{\arabic{explanation}}:}}
\renewcommand{\theexample}{{\bnbs\bengalinumber{\arabic{example}}:}}
\renewcommand{\theexercise}{{\bnbs\bengalinumber{\arabic{exercise}}:}}
\else
\newtheorem{theorem}{{\bnbs\theoremname}}[chapter]
\newtheorem{lemma}[theorem]{{\bnbs\lemmaname}}
\newtheorem{corollary}[theorem]{{\bnbs\corollaryname}}
\newtheorem{problem}[theorem]{{\bnbs\problemname}}
\newtheorem{construction}[theorem]{{\bnbs\constructionname}}
\newtheorem{proposition}[theorem]{{\bnbs\propositionname}}
\newtheorem{axiom}[theorem]{{\bnbs\axiomname}}
\newtheorem{postulate}[theorem]{{\bnbs\postulatename}}
\newtheorem{observation}[theorem]{{\bnbs\observationname}}
\newtheorem{remark}[theorem]{{\bnbs\remarkname}}
\newtheorem{definition}{{\bnbs\definitionname}}[chapter]
\newtheorem{explanation}[definition]{{\bnbs\explanationname}}
\newtheorem{example}[definition]{{\bnbs\examplename}}
\newtheorem{exercise}{{\bnbs\exercisename}}[chapter]
\renewcommand{\thetheorem}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{theorem}}:}}
\renewcommand{\thelemma}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{lemma}}:}}
\renewcommand{\thecorollary}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{corollary}}:}}
\renewcommand{\theproblem}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{problem}}:}}
\renewcommand{\theconstruction}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{construction}}:}}
\renewcommand{\theproposition}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{proposition}}:}}
\renewcommand{\theaxiom}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{axiom}}:}}
\renewcommand{\thepostulate}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{postulate}}:}}
\renewcommand{\theobservation}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{observation}}:}}
\renewcommand{\theremark}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{remark}}:}}
\renewcommand{\thedefinition}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{definition}}:}}
\renewcommand{\theexplanation}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{explanation}}:}}
\renewcommand{\theexample}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{example}}:}}
\renewcommand{\theexercise}{{\bnbs\bengalinumber{\arabic{chapter}}.\bengalinumber{\arabic{exercise}}:}}
\fi
\newenvironment{proof}{\par\noindent{\bnbs\proofname:}}{\par}
\newenvironment{solution}{\par\noindent{\bnbs\solutionname:}}{\par}
% Fix page numbering in the table of contents, list of figures and list of tables
\AtBeginDocument{
\let\Contentsline\contentsline
\renewcommand\contentsline[3]{\Contentsline{#1}{#2}{\bengalinumber{#3}}}
}
% reset bengali page number to zero
\newcommand{\resetbengalipage}{
\pagenumbering{arabic}
}
% Set bengali page numbering to fancy number
\newcommand{\bengalipagefancynumber}{
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[C]{\bengalinumber{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{fancy}
\fancyfoot[C]{\bengalinumber{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\addtolength{\headheight}{3pt}
}
% Set bengali page numbering to fancy alpha
\newcommand{\bengalipagefancyalpha}{
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[C]{\bengaliconso{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{fancy}
\fancyfoot[C]{\bengaliconso{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\addtolength{\headheight}{3pt}
}
% Set bengali page numbering to plain number
\newcommand{\bengalipageplainnumber}{
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[C]{\bengalinumber{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{plain}
}
% Set bengali page numbering to plain alpha
\newcommand{\bengalipageplainalpha}{
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[C]{\bengaliconso{\thepage}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}
\pagestyle{plain}
}
% Set bengali page numbering to empty
\newcommand{\bengalipageempty}{
\pagestyle{empty}
}
% Set default bengali page style plain number
\bengalipageplainnumber
\endinput