-
Notifications
You must be signed in to change notification settings - Fork 7
/
bookstyle.sty
315 lines (258 loc) · 9.97 KB
/
bookstyle.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
% !TEX root = main.tex
% -------------------------------------------------------------------
% Bookstyle for কম্বিনেটরিকসে হাতেখড়ি (Intro to Combinatorics)
% E-mail: [email protected]
% Released under the GNU Public License 3 or later
% ----------------------------------------------------------------
% This is the template for the first Bengali book written with
% LaTeXbangla, a package I have written some years ago. I hope
% this style file will simplify a number of steps in producing high
% quality Bengali books in LaTeX.
% ------------------------------------------------------------------
% Copyright (C) 2019 by Adib Hasan [email protected]
% This work may be distributed and/or modified under the
% conditions of the GPL v.3. If you do write a book with it,
% please consider giving me credit and providing a link to this
% repo in the acknowledgement section of your book, so that
% future authors may also benefit from this template.
% --------------------------------------------------------------
% space between line as percentage
\linespread{1.15}
% space between paragraphs.
\setlength{\parskip}{4pt}
% paragraph indent
\setlength{\parindent}{0pt}
% discourage breaking of footnote text accorss multiple pages.
\interfootnotelinepenalty=1000
% to take care of nonbreakingspace issue in EU1 format of the .bbl
\DeclareTextCommandDefault{\nobreakspace}{\leavevmode\nobreak\ }
% REQUIRED PACKAGES
%%%%%%%%%%%%%%%%%%%%%
% latexbangla with all features
\RequirePackage[banglamainfont=SolaimanLipi,
banglattfont=Siyam Rupali,
]{latexbangla}
% \inlcudegraphics
\RequirePackage{graphicx}
% for citation. they will be sorted and appear in text like [21].
% see natbib manual for more available styles
\RequirePackage[sort, square, numbers]{natbib}
% hyperlinks
\RequirePackage[colorlinks=false,
bookmarksopen=true,
hidelinks,
unicode,
naturalnames
]{hyperref}
% URL font is latex default Latin Modern Teletype. If you don't like that
% change it to something else.
\renewcommand\UrlFont{\fontencoding{OT1}\fontfamily{lmtt}\selectfont}
% autoref name for example env. when you call "In \autoref{blah}",
% it will output "In udahoron blah"
\newcommand\exampleautorefname{উদাহরণ}
% translating autoref name for existing commands.
\appto{\blockextras@bengali}{%
\renewcommand*{\equationautorefname}{সমীকরণ}%
}
\appto{\blockextras@bengali}{%
\renewcommand*{\chapterautorefname}{অধ্যায়}%
}
\appto{\blockextras@bengali}{%
\renewcommand*{\sectionautorefname}{সেকশন}%
}
\appto{\blockextras@bengali}{%
\renewcommand{\figureautorefname}{চিত্র}%
}
% packages from American Mathematical Society
% they provide some very useful commands and fonts.
% search in the internet for details.
\RequirePackage{amsfonts, amssymb, amsmath, amsthm}
% equation number inside parenthesis in citation
\let\oldtheequation\theequation
\renewcommand\tagform@[1]{\maketag@@@{\ignorespaces#1\unskip\@@italiccorr}}
\renewcommand\theequation{(\oldtheequation)}
%to allow long align env. to break between pages
\allowdisplaybreaks
\RequirePackage{xpatch}
% replace the dot after 'proof' with colon
\xpatchcmd{\proof}{\@addpunct{.}}{\@addpunct{:}}{}{}
% make proof bold, upshape instead of italic
\xpatchcmd{\proof}{\itshape}{\bfseries}{}{}
% because polyglossia defines proofname as \itshape "proman"
\addto\captionsbengali{\renewcommand\proofname{\bfseries প্রমাণ}}
% title and section formatting
\RequirePackage{titlesec}
% section sign before section number
\titleformat{\section}[hang]{\raggedright\Large\bfseries}{{\uccoff\fontfamily{lmr}\selectfont\large§\,\uccon}\thesection}{0.5em}{}
% chapter title
\RequirePackage{xcolor}
\definecolor{mygray}{RGB}{60,60,60}
\titleformat{\chapter}[display]
{\bfseries\color{mygray}}
{\filleft%
\begin{tikzpicture}
\node[
outer sep=0pt,
text width=2.4cm,
minimum height=2.5cm,
fill=mygray,
font=\color{white}\fontsize{75}{80}\selectfont,
align=center
] (num) {\thechapter};
\node[
rotate=90,
anchor=south,
font=\color{black}\Large
] at ([xshift=-5pt]num.west) {\chaptertitlename};
\end{tikzpicture}%
}
{-30pt}
{\fontsize{22}{24}\selectfont}
% [\titlerule[2.5pt]\vskip3pt\titlerule\vskip4pt]
[{\titlerule[2.5pt]\vskip3pt\titlerule\vskip-1em}]
% better double border intersection
\RequirePackage{hhline}
% enlarged first letter
\RequirePackage{lettrine}
\newcommand{\firstword}[2]{\lettrine[lraise=0.25, nindent=0pt, findent=2pt]{#1}{#2}}
% table of contents formatting
\RequirePackage{tocloft}
\def\cftchapteraftersnum{.}
% footnote in tables appear the end of page
\RequirePackage{footnote}
\makesavenoteenv{tabular}
% better float management
\RequirePackage{placeins}
% multiple columns
\RequirePackage{multicol}
% compilation time decreases significantly with this package
% although it produces a warning
\RequirePackage{subfig}
% breakable tables
\RequirePackage{longtable}
% NEW ENVIRONMENTS
%%%%%%%%%%%%%%%%%%%%%%%%%%
% new font for quotation
\newfontfamily\quotefont[%
Scale= 1.1,
WordSpace=1.4,
AutoFakeSlant=1.2,
AutoFakeBold=1.2
]{[Monotype Corsiva]}
% a chapquote environment for chapter quotes
\newenvironment{chapquote}[2][2em]
{\setlength{\@tempdima}{#1}%
\def\chapquote@author{#2}%
\parshape 1 \@tempdima \dimexpr\textwidth-2\@tempdima\relax%
\uccoff\quotefont
}
{\par\hfill―\ \uccon\chapquote@author\hspace*{\@tempdima}\par\bigskip}
% a new solution environment
\newenvironment{solution}[1][সমাধান]{\proof[\bfseries #1]}{\endproof}
\newtheoremstyle{custom}% name
{3pt}% space above
{3pt}% space below
{\rm}% body font
{}% indent amount
{\bfseries}% theorem head font
{:}% punctuation after theorem head
{.5em}% space after theorem head
{\thmname{#1}\thmnumber{ \bfseries#2}\thmnote{ (#3)}}% theorem head spec
\theoremstyle{custom}
\newtheorem*{remark}{\bfseries মন্তব্য}
% for customizable boxes
\RequirePackage[many]{tcolorbox}
% nije koro box
\newtcolorbox{diybox}{%
tikznode boxed title,
freelance,
breakable,
enlargepage flexible=\baselineskip,
arc=1mm,
left=4pt, right=4pt, bottom=4pt,
colframe=black,
colback=white,
boxrule=0.7pt,
interior style={white},
attach boxed title to top center= {yshift=-\tcboxedtitleheight/2},
fonttitle=\bfseries,
colbacktitle=white,coltitle=black,
boxed title style={size=normal,colframe=white,boxrule=0pt},
before skip=8pt plus 2pt minus 4pt,
title={নিজে করো}}
% mone rakhbe box
% there is an optional parameter, when provided, replaces "mone rakhbe"
\newtcolorbox{theorem}[1][মনে রাখবে]{%
freelance,
breakable,
enlargepage flexible=\baselineskip,
arc=1mm,
left=3pt, right=3pt, bottom=2pt, top=8pt,
colframe=black,
boxrule=0.7pt,
colback=white,
attach boxed title to top center= {yshift=-\tcboxedtitleheight/2},
fonttitle=\bfseries,
colbacktitle=white,coltitle=black,
title={#1},
before skip=8pt plus 2pt minus 4pt,
boxed title style={size=fbox, colback=white, freelance,boxrule=0.7pt,colframe=black,frame code={ \path[tcb fill frame] ([xshift=-2mm]frame.west) -- (frame.north west) -- (frame.north east) -- ([xshift=2mm]frame.east)-- (frame.south east) -- (frame.south west) -- cycle; },
interior code={ \path[tcb fill interior] ([xshift=-2mm]interior.west)-- (interior.north west) -- (interior.north east)-- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west)-- cycle;}}
}
% udahoron box
% use \begin{example}[label=blah]...\end{example} to call \autoref{blah}.
\newcounter{example}[chapter]
\newtcolorbox[use counter=example, number freestyle={\noexpand\thechapter.\noexpand\tobangla{\tcbcounter}}]{example}[1][]{
colback=white,
colframe=black,%gray!80,
fonttitle=\bfseries,
colbacktitle=white,%gray!40,
arc=1mm,
top=8pt, left=3pt, right=3pt, bottom=2pt,
coltitle=black,
boxrule=0.7pt,
freelance,
breakable,
enlargepage flexible=\baselineskip,
before skip=8pt plus 2pt minus 2pt,
after skip=4pt plus 2pt minus 0pt,
attach boxed title to top left={yshift=-9pt,xshift=6pt},
boxed title style={size=fbox,boxrule=0.7pt,colframe=black, arc=1mm},
title={উদাহরণ \thetcbcounter},
#1
}
% list with no indentation and special labels
\newcommand{\diamondlabel}{\raisebox{2.5pt}{\includegraphics[height=8pt, angle=135]{img/listbullet01}}}
\newcounter{noindlistcounter}
\newenvironment{noindlist}
{\begin{list}{\diamondlabel\;\;}{\labelsep=0em \labelwidth=2em \itemindent=0em \leftmargin=1.5em}}{\end{list}}
% a list of exercises. appear as "somossa #:"
\newcounter{exercisecounter}
\counterwithin{exercisecounter}{chapter}
\newenvironment{exercise}
{\begin{list}{\textbf{সমস্যা \thechapter.\tobangla{exercisecounter}:~}}{\usecounter{exercisecounter} \labelsep=0em \labelwidth=0em \leftmargin=0em \itemindent=0em}}{\end{list}}
% MISCELLANEOUS COMMANDS
%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\partof}{অংশবিশেষ}
\newcommand{\simplified}{সরলীকৃত}
% old factorial symbol |__
\RequirePackage{rotating}
\RequirePackage{tkz-berge}
\RequirePackage[misc]{ifsym}
\RequirePackage{tabu}
\usetikzlibrary{calc}
\newcommand{\oldfactorial}[1]{%
\tikz[baseline]{\node[anchor=base,inner sep=0.3ex](mynode){\ensuremath{#1}};\draw(mynode.north west)--(mynode.south west)--(mynode.south east);\path[use as bounding box]($(mynode.south west)+(-0.3ex,-0.3ex)$)rectangle($(mynode.north east)+(0.3ex,0.3ex)$);}
}
% permutation and combination
\newcommand*{\perm}[2]{{}^{#1}\!P_{#2}}
\newcommand*{\comb}[2]{{}^{#1}\!C_{#2}}
% counting continued commands
\DeclareRobustCommand{\stirl}{\genfrac\{\}{0pt}{}}
\DeclareRobustCommand{\dstirl}{\genfrac\{\}{0pt}{0}}
% space character
\newcommand\spacesymbol[1][.3em]{%
\mbox{\kern.06em\vrule height.3ex}%
\vbox{\hrule width#1}%
\hbox{\vrule height.3ex}}
\endinput