-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbook-core-first.sty
250 lines (199 loc) · 7.42 KB
/
book-core-first.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
\ProvidesPackage{book-core-first}
\RequirePackage{t1enc}
%\RequirePackage[latin2]{inputenc}
\RequirePackage[\ARU@babelLanguage]{babel}
\RequirePackage{nag}
\RequirePackage{xparse}
\RequirePackage{soul}
\RequirePackage{textcomp}
\RequirePackage[cmyk]{xcolor}
\RequirePackage{graphicx}
\graphicspath{{../../assets/images/}}
\RequirePackage{eso-pic}
\RequirePackage{ccicons}
\RequirePackage{multicol}
\RequirePackage{ifthen}
\RequirePackage{titletoc}
\RequirePackage{enumitem}
\RequirePackage{tikz}
% === Define colors ===
\definecolor{textbody}{gray}{0.1}
\definecolor{drop}{gray}{0.7}
\definecolor{capsline}{gray}{0.3}
\definecolor{chapnum}{gray}{0.5}
\definecolor{chaptitle}{gray}{0.3}
\definecolor{chapsubtitle}{gray}{0.6}
\definecolor{footnoterule}{gray}{0.5}
% === Load fonts ===
\RequirePackage{fontspec}
\defaultfontfeatures{Ligatures={TeX}}
\setmainfont
[ Ligatures = TeX,
BoldFont = Crimson Semibold,
ItalicFont = TeX Gyre Pagella Italic,
ItalicFeatures = { Ligatures = TeX, Scale = 0.9 } ]
{Crimson Roman}
\newfontfamily\oldNumFont[Numbers = OldStyle]{Crimson Roman}
\newfontfamily\dropFont{Arno Pro Light Display}
\newfontfamily\chapTitleFont{Arno Pro}
\newfontfamily\chapNameFont{Arno Pro}
\newfontfamily\chapNumFont{Arno Pro}
\newfontfamily\sectionFont{Arno Pro}
\newfontfamily\headFont{Arno Pro}
\newfontfamily\footFont{Gentium}
\newfontfamily\tocPageNumFont{Gentium}
% If -- dashes don't work for your font, try
% Renderer = Basic
% http://tex.stackexchange.com/questions/20580/how-to-enable-ligatures-for-emdash-endash-in-luatex
% sizes
\newcommand{\smaller}
{\@setfontsize\smaller{9}{11}}
\newcommand{\chapnamesize}
{\@setfontsize\chapnamesize{22}{24}}
\newcommand{\chaptitlesize}
{\@setfontsize\chaptitlesize{13}{20}}
\newcommand{\sectiontitlesize}
{\@setfontsize\sectiontitlesize{11.5}{18}}
% === hyperref ===
\RequirePackage{hyperref}
\hypersetup{
colorlinks=true,
unicode=true,
linkcolor=textbody,
citecolor=textbody,
filecolor=textbody,
urlcolor=textbody
}
\RequirePackage[
open,
openlevel=2
]{bookmark}
% === penalties and hyphenation ===
% memoir's more allowing penalties
\midsloppy
%\renewcommand\britishhyphenmins{{3}{3}}
% The lastparline or the parfillskip solution is overkill in many
% places. It is optimal for larger paragraphs, but creates too much
% strech in every other case, particulary not in the main text, such as
% the TOC and so on.
%
% It can be useful with a limited scope, but for general application it
% becomes more of a problem to check where it has gone too far in
% adjusting line breaks.
% lastparline:
% ``Ensures that the last line of a paragraph is at least as long as the
% double value of \parindent. When LuaTEX is used, the solution provided
% by Patrick Gundlach is used. With other rendering engines, it is the
% native solution provided by Enrico Gregorio that serves as an
% implementation.''
% http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/
% Load with draft option to visualize inserted nobreaks.
% \RequirePackage[lastparline]{impnattypo}
% Alternatively, egreg's native solution:
% http://tex.stackexchange.com/a/28358/831
%\setlength{\parfillskip}{0pt plus\dimexpr\textwidth-2\parindent}
% Last line at least 20% of textwidth
%\parfillskip 0pt plus 0.8\textwidth
\hyphenpenalty=700
\exhyphenpenalty=50
\doublehyphendemerits=900
\brokenpenalty=990
\RequirePackage[defaultlines=2,all]{nowidow}
% === common hyphenation exceptions and corrections ===
\hyphenation{season wisdom develop-ment respon-sible pheno-mena
philo-sophical munindo amaravati thai-land}
%\hyphenation{accur-ately argu-men-ta-tive attach Ayu-dhaya becomes
%ben-e-fi-cial capa-bil-ity car-ry car-ry-ing cere-monies cere-mony
%ces-sa-tion chal-lenge chal-leng-ing clas-si-fi-ca-tion
%clas-si-fi-ca-tions clas-si-fied com-mu-nity con-di-tion
%con-di-tioned con-struc-tions con-tem-plate con-tem-plat-ing
%con-tem-pla-tion cul-ti-vate cul-ti-vates cul-ti-vat-ing
%cul-ti-vation def-i-ni-tion de-ter-mine de-ter-mined dhamma dhammas
%dis-cern-ment dis-con-tent dis-cur-sive dying em-pha-size
%enlight-ened equa-nim-ity es-pe-cial-ly estab-lish exist-ence
%ex-pe-ri-ence hap-pen-ing having ig-no-rance immedi-ately
%im-per-ma-nent in-nu-mer-a-ble in-se-cu-ri-ty in-spir-ing
%in-struct-ed in-ves-ti-gate in-ves-ti-ga-tion iso-late iso-lat-ed
%Keuan lay-peo-ple ma-te-ri-al mat-u-ra-tion medi-tate medi-ta-tion
%medi-ta-tive mental mon-as-teries mon-as-tery Nana-chat or-dain
%or-dain-ed or-di-na-tion orig-inate oth-er-wise pene-trat-ing
%per-son-al per-son-al-ity phe-nom-e-na phe-nom-e-non po-si-tion
%pow-er pow-ers pre-vi-ous pro-lif-er-ate pro-lif-er-ating
%pro-lif-er-a-tions puthu-jjana quest-ion rec-i-ta-tion
%sat-is-fac-tory sen-sa-tion sen-sa-tions sim-i-lar suf-fer-ing
%sup-po-si-tion syn-on-y-mous tem-per-a-ment tem-per-a-ments tong-rat
%tran-scend tran-scend-ent tran-scends un-con-di-tioned under-stand
%under-stood un-hap-pi-ness un-sat-is-fac-tori-ness un-sat-is-fac-tory
%ven-er-able wea-ri-ness what-ev-er when-ever wher-ever whole-hearted
%whole-heart-edly wrong-do-ing}
% === soul settings ===
\sodef\soTocChapter{}{.1em}{.5em plus.1em}{.1em plus.1em minus.1em}
\sodef\soSection{}{.1em}{.5em plus.1em}{.1em plus.1em minus.1em}
\sodef\soChapter{}{.1em}{.5em plus.1em}{.1em plus.1em minus.1em}
\sodef\soDropcapsA{}{.1em}{.3em plus.1em}{.4em plus.1em minus.1em}
\sodef\soDropcapsB{}{.1em}{.3em plus.1em}{.4em plus.1em minus.1em}
% === Custom commands and environments ===
\newcommand\dividerRule{%
{\centering\bigskip
{\color[gray]{0.6}\rule{0.6\linewidth}{0.2pt}}
\par\bigskip}%
}
\newcommand\emptysheet{%
\cleardoublepage
\thispagestyle{empty}\mbox{}\newpage
\thispagestyle{empty}\mbox{}\newpage
}
\newcommand\emptydoublepage\emptysheet
\newcommand\emptypage{%
\clearpage
\thispagestyle{empty}\mbox{}\newpage
}
\newcommand*{\subtitle}[1]{\def\@thesubtitle{#1}}
\newcommand*{\editionInfo}[1]{\def\@theEditionInfo{#1}}
\newcommand*{\printedByInfo}[1]{\def\@thePrintedByInfo{#1}}
\newcommand*{\ISBN}[1]{\def\@theISBN{#1}}
\newcommand\thesubtitle{\@thesubtitle}
\newcommand\theEditionInfo{\@theEditionInfo}
\newcommand\thePrintedByInfo{\@thePrintedByInfo}
\newcommand\theISBN{\@theISBN}
\newsavebox{\quotepagebox}
\newenvironment{quotepage}[1]
{\begin{lrbox}{\quotepagebox}\begin{minipage}{#1}
\setlength{\parskip}{0.6\baselineskip}
\setlength{\parindent}{0pt}}
{\end{minipage}\end{lrbox}%
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {\usebox{\quotepagebox}};
\end{tikzpicture}}
\newlength\qw
\setlength\qw{17pt}% same as parindent for smallpage
\newcommand{\question}[1]{%
\smallskip%
\par\noindent\hangindent=\qw%
\ifthenelse{\equal{#1}{}}{\textit{Q:}\space}{\textit{#1:}\space}%
}
\newcommand{\questionBi}[2]{%
\smallskip%
\par\noindent\hangindent=\qw%
\textit{Q: #1}
\smallskip%
\par\noindent\hangindent=\qw%
\textit{Q: #2}
}
\newcommand{\answer}[1]{%
\smallskip%
\par\noindent%
\ifthenelse{\equal{#1}{}}{\textit{A:}\space}{\textit{#1:}\space}%
}
% === Renewing package macros ===
\renewcommand\footnoterule{%
\vspace*{\baselineskip}%
\kern-3\p@
{\color{footnoterule}\hrule height 0.1pt width \columnwidth}
\kern2.6\p@}
\renewcommand*{\notesname}{Notes}
\renewcommand*{\notedivision}{\section*{\notesname}}
\renewcommand*{\pagenotesubhead}[3]{}
\renewcommand*{\notenumintext}[1]{\textsuperscript{\thinspace [#1]}}
\renewcommand{\prenoteinnotes}{\par\noindent}
\renewcommand{\postnoteinnotes}{\par\vspace*{0.5\baselineskip}}