prophecy 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/Overview.md +44 -0
  6. data/README.md +35 -0
  7. data/Rakefile +1 -0
  8. data/bin/kindlegen +18 -0
  9. data/bin/kindlegen.exe +0 -0
  10. data/bin/kindlegen_linux +0 -0
  11. data/bin/kindlegen_mac +0 -0
  12. data/bin/prophecy +4 -0
  13. data/docs/licenses/kindlegen/.empty_directory +0 -0
  14. data/docs/licenses/kindlegen/EULA.txt +61 -0
  15. data/docs/licenses/kindlegen/KindleGen Legal Notices 2009-11-10 Linux.txt +21 -0
  16. data/docs/licenses/kindlegen/KindleGen Legal Notices 2009-11-10 Mac.txt +21 -0
  17. data/docs/licenses/kindlegen/KindleGen OSS Notices 2009-07-29-Windows.txt +19 -0
  18. data/features/assets.feature +14 -0
  19. data/features/book.feature +10 -0
  20. data/features/generator.feature +15 -0
  21. data/features/support/hooks.rb +5 -0
  22. data/features/support/setup.rb +3 -0
  23. data/lib/prophecy/assets/.gitignore +2 -0
  24. data/lib/prophecy/assets/config.rb +20 -0
  25. data/lib/prophecy/assets/epub_template/META-INF/com.apple.ibooks.display-options.xml +6 -0
  26. data/lib/prophecy/assets/epub_template/META-INF/container.xml +6 -0
  27. data/lib/prophecy/assets/epub_template/OEBPS/.gitkeep +0 -0
  28. data/lib/prophecy/assets/epub_template/OEBPS/chapters/.gitkeep +0 -0
  29. data/lib/prophecy/assets/epub_template/OEBPS/content.opf.erb +114 -0
  30. data/lib/prophecy/assets/epub_template/OEBPS/toc.ncx.erb +18 -0
  31. data/lib/prophecy/assets/epub_template/mimetype +1 -0
  32. data/lib/prophecy/assets/fonts/Crimson-Bold.otf +0 -0
  33. data/lib/prophecy/assets/fonts/Crimson-BoldItalic.otf +0 -0
  34. data/lib/prophecy/assets/fonts/Crimson-Italic.otf +0 -0
  35. data/lib/prophecy/assets/fonts/Crimson-Roman.otf +0 -0
  36. data/lib/prophecy/assets/fonts/Crimson-Semibold.otf +0 -0
  37. data/lib/prophecy/assets/fonts/Crimson-SemiboldItalic.otf +0 -0
  38. data/lib/prophecy/assets/fonts/GenBasB.ttf +0 -0
  39. data/lib/prophecy/assets/fonts/GenBasBI.ttf +0 -0
  40. data/lib/prophecy/assets/fonts/GenBasI.ttf +0 -0
  41. data/lib/prophecy/assets/fonts/GenBasR.ttf +0 -0
  42. data/lib/prophecy/assets/fonts/GenBkBasB.ttf +0 -0
  43. data/lib/prophecy/assets/fonts/GenBkBasBI.ttf +0 -0
  44. data/lib/prophecy/assets/fonts/GenBkBasI.ttf +0 -0
  45. data/lib/prophecy/assets/fonts/GenBkBasR.ttf +0 -0
  46. data/lib/prophecy/assets/fonts/GentiumPlus-I.ttf +0 -0
  47. data/lib/prophecy/assets/fonts/GentiumPlus-R.ttf +0 -0
  48. data/lib/prophecy/assets/helpers/check_typos.sh +27 -0
  49. data/lib/prophecy/assets/helpers/helpers.rb +0 -0
  50. data/lib/prophecy/assets/helpers/pali_typos +2 -0
  51. data/lib/prophecy/assets/helpers/sed_chars +5 -0
  52. data/lib/prophecy/assets/helpers/sed_dumb_ebook +18 -0
  53. data/lib/prophecy/assets/helpers/sed_tex2uni +62 -0
  54. data/lib/prophecy/assets/helpers/tex2html.sh +112 -0
  55. data/lib/prophecy/assets/helpers/tex2md.sh +10 -0
  56. data/lib/prophecy/assets/helpers/tidy_quotes +1 -0
  57. data/lib/prophecy/assets/helpers/tidy_quotes.sh +8 -0
  58. data/lib/prophecy/assets/helpers/to-html.sh +9 -0
  59. data/lib/prophecy/assets/latex_template/Makefile +37 -0
  60. data/lib/prophecy/assets/latex_template/anecdote.cls +163 -0
  61. data/lib/prophecy/assets/latex_template/book-core-first.sty +673 -0
  62. data/lib/prophecy/assets/latex_template/book-core-last.sty +40 -0
  63. data/lib/prophecy/assets/latex_template/book_main.tex.erb +31 -0
  64. data/lib/prophecy/assets/latex_template/booklet_main.tex +15 -0
  65. data/lib/prophecy/assets/latex_template/chapters/.gitkeep +0 -0
  66. data/lib/prophecy/assets/latex_template/cover_main.tex +48 -0
  67. data/lib/prophecy/assets/latex_template/mylayout.sty +2 -0
  68. data/lib/prophecy/assets/layouts/page.xhtml.erb +20 -0
  69. data/lib/prophecy/assets/sass/_booktheme.sass +3 -0
  70. data/lib/prophecy/assets/sass/_byronic.sass +263 -0
  71. data/lib/prophecy/assets/sass/_colors.sass +7 -0
  72. data/lib/prophecy/assets/sass/_epub-css-starter-kit.sass +734 -0
  73. data/lib/prophecy/assets/sass/_font-existence.scss +12 -0
  74. data/lib/prophecy/assets/sass/_font-source-sans-pro.scss +75 -0
  75. data/lib/prophecy/assets/sass/_fontfaces.scss +11 -0
  76. data/lib/prophecy/assets/sass/_mixins.sass +4 -0
  77. data/lib/prophecy/assets/sass/print.sass +6 -0
  78. data/lib/prophecy/assets/sass/style-epub.sass +7 -0
  79. data/lib/prophecy/assets/sass/style-mobi-kf8.sass +7 -0
  80. data/lib/prophecy/assets/sass/style-mobi.sass +9 -0
  81. data/lib/prophecy/assets/stylesheets/print.css +3 -0
  82. data/lib/prophecy/assets/stylesheets/style-epub.css +401 -0
  83. data/lib/prophecy/assets/stylesheets/style-mobi-kf8.css +401 -0
  84. data/lib/prophecy/assets/stylesheets/style-mobi.css +317 -0
  85. data/lib/prophecy/assets/webfonts/existence-light.ttf +0 -0
  86. data/lib/prophecy/assets/webfonts/sourcesanspro-bold.ttf +0 -0
  87. data/lib/prophecy/assets/webfonts/sourcesanspro-extralight.ttf +0 -0
  88. data/lib/prophecy/assets/webfonts/sourcesanspro-italic.ttf +0 -0
  89. data/lib/prophecy/assets/webfonts/sourcesanspro-light.ttf +0 -0
  90. data/lib/prophecy/assets/webfonts/sourcesanspro-lightitalic.ttf +0 -0
  91. data/lib/prophecy/assets/webfonts/sourcesanspro-regular.ttf +0 -0
  92. data/lib/prophecy/assets/webfonts-extra/sourcesanspro-bolditalic.ttf +0 -0
  93. data/lib/prophecy/assets/webfonts-extra/sourcesanspro-extralightitalic.ttf +0 -0
  94. data/lib/prophecy/assets/webfonts-extra/sourcesanspro-semibold.ttf +0 -0
  95. data/lib/prophecy/assets/webfonts-extra/sourcesanspro-semibolditalic.ttf +0 -0
  96. data/lib/prophecy/book.rb +281 -0
  97. data/lib/prophecy/chapter.rb +359 -0
  98. data/lib/prophecy/cli.rb +144 -0
  99. data/lib/prophecy/generators/assets.rb +29 -0
  100. data/lib/prophecy/generators/book/.gitignore +7 -0
  101. data/lib/prophecy/generators/book/LICENSE.txt +5 -0
  102. data/lib/prophecy/generators/book/README.md.tt +4 -0
  103. data/lib/prophecy/generators/book/book.yml.tt +55 -0
  104. data/lib/prophecy/generators/book/build/epub/.empty_directory +0 -0
  105. data/lib/prophecy/generators/book/build/latex/.empty_directory +0 -0
  106. data/lib/prophecy/generators/book/build/mobi/.empty_directory +0 -0
  107. data/lib/prophecy/generators/book/epub_mobi.yml +26 -0
  108. data/lib/prophecy/generators/book/example-book.yml +78 -0
  109. data/lib/prophecy/generators/book/images/cover.jpg +0 -0
  110. data/lib/prophecy/generators/book/images/cover.xcf +0 -0
  111. data/lib/prophecy/generators/book/images/publisher-logo.jpg +0 -0
  112. data/lib/prophecy/generators/book/manuscript/glossary.md +7 -0
  113. data/lib/prophecy/generators/book/manuscript/nameless-labyrinth.markdown +34 -0
  114. data/lib/prophecy/generators/book/manuscript/preface.md +5 -0
  115. data/lib/prophecy/generators/book/manuscript/the-sway-of-reason.markdown +22 -0
  116. data/lib/prophecy/generators/book/manuscript/unhuman-massiveness.markdown +27 -0
  117. data/lib/prophecy/generators/book/manuscript/xhtml/.gitkeep +0 -0
  118. data/lib/prophecy/generators/book/manuscript/xhtml/cover.xhtml.erb +21 -0
  119. data/lib/prophecy/generators/book/manuscript/xhtml/titlepage.xhtml.erb +31 -0
  120. data/lib/prophecy/generators/book/manuscript/xhtml/toc.xhtml.erb +16 -0
  121. data/lib/prophecy/generators/new.rb +22 -0
  122. data/lib/prophecy/manifest.rb +72 -0
  123. data/lib/prophecy/version.rb +3 -0
  124. data/lib/prophecy.rb +18 -0
  125. data/prophecy.gemspec +36 -0
  126. data/spec/book_spec.rb +9 -0
  127. data/spec/chapter_spec.rb +0 -0
  128. data/spec/manifest_spec.rb +0 -0
  129. metadata +366 -0
@@ -0,0 +1,673 @@
1
+ \ProvidesPackage{book-core-first}
2
+
3
+ \RequirePackage[\ARU@babelLanguage]{babel}
4
+ \RequirePackage{nag}
5
+ \RequirePackage{xparse}
6
+ \RequirePackage{soul}
7
+ \RequirePackage{textcomp}
8
+ \RequirePackage[cmyk]{xcolor}
9
+ \RequirePackage{graphicx}
10
+ \graphicspath{{../../assets/images/}}
11
+ \RequirePackage{eso-pic}
12
+ \RequirePackage{ccicons}
13
+ \RequirePackage{multicol}
14
+ \RequirePackage{ifthen}
15
+ \RequirePackage{titletoc}
16
+ \RequirePackage{enumitem}
17
+ \RequirePackage{tikz}
18
+
19
+ % === Define colors ===
20
+
21
+ \definecolor{textbody}{gray}{0.15}
22
+ \definecolor{footnoterule}{gray}{0.5}
23
+ \definecolor{chapternum}{gray}{0.8}
24
+ \definecolor{chaptertitle}{gray}{0.3}
25
+ \definecolor{chapterauthor}{gray}{0.3}
26
+ \definecolor{chapternote}{gray}{0.3}
27
+ \definecolor{section}{gray}{0.3}
28
+ \definecolor{tocleftside}{gray}{0.5}
29
+ \definecolor{tocleftsidepart}{gray}{0.2}
30
+ \definecolor{partname}{gray}{0.5}
31
+ \definecolor{parttitle}{gray}{0.5}
32
+
33
+ % === Load fonts ===
34
+
35
+ \RequirePackage{fontspec}
36
+ \defaultfontfeatures{Ligatures={TeX}}
37
+
38
+ % If -- dashes don't work for your font, try
39
+ % Renderer = Basic
40
+ % http://tex.stackexchange.com/questions/20580/how-to-enable-ligatures-for-emdash-endash-in-luatex
41
+
42
+ \setmainfont[
43
+ SmallCapsFont = Crimson Roman,
44
+ SmallCapsFeatures= { Ligatures = TeX, Letters = SmallCaps },
45
+ BoldFont = Gentium Book Basic Bold,
46
+ ]{Gentium}
47
+
48
+ \newfontfamily\crimsonRomanFont[
49
+ BoldFont = Crimson Semibold,
50
+ ItalicFont = Crimson Italic,
51
+ ]{Crimson Roman}
52
+ \newfontfamily\crimsonRomanFontOldNum[
53
+ Numbers = OldStyle,
54
+ ]{Crimson Roman}
55
+ \newfontfamily\gentiumFont{Gentium}
56
+
57
+ % header and footer
58
+
59
+ \newfontfamily\footFont[Renderer = Basic]{Shaker Pali}
60
+
61
+ \newcommand{\footSize}
62
+ {\@setfontsize\footSize{9}{9}}
63
+
64
+ % chapter
65
+
66
+ \newfontfamily\partTitleFont[
67
+ ItalicFont = Shaker 2 Light Italic,
68
+ Renderer = Basic,
69
+ ]{Shaker 2 Light}
70
+
71
+ \newfontfamily\chapterNameFont{Crimson Roman}
72
+ \newfontfamily\chapterTitleFont{Crimson Roman}
73
+ \newfontfamily\chapterNumberFont{Crimson Roman}
74
+ \newfontfamily\chapterAuthorFont{Crimson Roman}
75
+ \newfontfamily\chapterNoteFont[
76
+ BoldFont = Crimson Semibold,
77
+ ItalicFont = Crimson Italic,
78
+ ]{Crimson Roman}
79
+
80
+ \newcommand{\chapterNameSize}
81
+ {\@setfontsize\chapterNameSize{22}{24}}
82
+ \newcommand{\chapterNumberSize}
83
+ {\@setfontsize\chapterNumberSize{22}{24}}
84
+ \newcommand{\chapterTitleSize}
85
+ {\@setfontsize\chapterTitleSize{13}{16.5}}
86
+ \newcommand{\chapterAuthorSize}
87
+ {\@setfontsize\chapterAuthorSize{12}{14}}
88
+ \newcommand{\chapterNoteSize}
89
+ {\@setfontsize\chapterNoteSize{10}{13}}
90
+
91
+ % section
92
+
93
+ \newfontfamily\sectionFont[
94
+ BoldFont = Crimson Semibold,
95
+ ItalicFont = Crimson Italic,
96
+ ]{Crimson Roman}
97
+
98
+ \newcommand{\sectionSize}
99
+ {\@setfontsize\sectionSize{13}{15}}
100
+
101
+ % other sizes
102
+
103
+ \newcommand{\smaller}
104
+ {\@setfontsize\smaller{9}{11}}
105
+
106
+ % === hyperref ===
107
+
108
+ \RequirePackage{hyperref}
109
+ \hypersetup{
110
+ colorlinks=true,
111
+ unicode=true,
112
+ linkcolor=textbody,
113
+ citecolor=textbody,
114
+ filecolor=textbody,
115
+ urlcolor=textbody
116
+ }
117
+ \RequirePackage[
118
+ open,
119
+ openlevel=2
120
+ ]{bookmark}
121
+
122
+ % === penalties and hyphenation ===
123
+
124
+ % memoir's more allowing penalties
125
+ \midsloppy
126
+
127
+ \renewcommand\britishhyphenmins{{3}{3}}
128
+
129
+ % The lastparline or the parfillskip solution is overkill in many
130
+ % places. It is optimal for larger paragraphs, but creates too much
131
+ % strech in every other case, particulary not in the main text, such as
132
+ % the TOC and so on.
133
+ %
134
+ % It can be useful with a limited scope, but for general application it
135
+ % becomes more of a problem to check where it has gone too far in
136
+ % adjusting line breaks.
137
+
138
+ % lastparline:
139
+ % ``Ensures that the last line of a paragraph is at least as long as the
140
+ % double value of \parindent. When LuaTEX is used, the solution provided
141
+ % by Patrick Gundlach is used. With other rendering engines, it is the
142
+ % native solution provided by Enrico Gregorio that serves as an
143
+ % implementation.''
144
+ % http://tex.stackexchange.com/questions/28357/ensure-minimal-length-of-last-line/
145
+
146
+ % Load with draft option to visualize inserted nobreaks.
147
+ % \RequirePackage[lastparline]{impnattypo}
148
+
149
+ % Alternatively, egreg's native solution:
150
+ % http://tex.stackexchange.com/a/28358/831
151
+ %\setlength{\parfillskip}{0pt plus\dimexpr\textwidth-2\parindent}
152
+
153
+ % Last line at least 20% of textwidth
154
+ %\parfillskip 0pt plus 0.8\textwidth
155
+
156
+ \hyphenpenalty=700
157
+ \exhyphenpenalty=50
158
+ \doublehyphendemerits=900
159
+ \brokenpenalty=990
160
+
161
+ \RequirePackage[defaultlines=2,all]{nowidow}
162
+
163
+ % === common hyphenation exceptions and corrections ===
164
+
165
+ \hyphenation{season wisdom develop-ment respon-sible pheno-mena
166
+ philo-sophical munindo amaravati thai-land}
167
+
168
+ %\hyphenation{accur-ately argu-men-ta-tive attach Ayu-dhaya becomes
169
+ %ben-e-fi-cial capa-bil-ity car-ry car-ry-ing cere-monies cere-mony
170
+ %ces-sa-tion chal-lenge chal-leng-ing clas-si-fi-ca-tion
171
+ %clas-si-fi-ca-tions clas-si-fied com-mu-nity con-di-tion
172
+ %con-di-tioned con-struc-tions con-tem-plate con-tem-plat-ing
173
+ %con-tem-pla-tion cul-ti-vate cul-ti-vates cul-ti-vat-ing
174
+ %cul-ti-vation def-i-ni-tion de-ter-mine de-ter-mined dhamma dhammas
175
+ %dis-cern-ment dis-con-tent dis-cur-sive dying em-pha-size
176
+ %enlight-ened equa-nim-ity es-pe-cial-ly estab-lish exist-ence
177
+ %ex-pe-ri-ence hap-pen-ing having ig-no-rance immedi-ately
178
+ %im-per-ma-nent in-nu-mer-a-ble in-se-cu-ri-ty in-spir-ing
179
+ %in-struct-ed in-ves-ti-gate in-ves-ti-ga-tion iso-late iso-lat-ed
180
+ %Keuan lay-peo-ple ma-te-ri-al mat-u-ra-tion medi-tate medi-ta-tion
181
+ %medi-ta-tive mental mon-as-teries mon-as-tery Nana-chat or-dain
182
+ %or-dain-ed or-di-na-tion orig-inate oth-er-wise pene-trat-ing
183
+ %per-son-al per-son-al-ity phe-nom-e-na phe-nom-e-non po-si-tion
184
+ %pow-er pow-ers pre-vi-ous pro-lif-er-ate pro-lif-er-ating
185
+ %pro-lif-er-a-tions puthu-jjana quest-ion rec-i-ta-tion
186
+ %sat-is-fac-tory sen-sa-tion sen-sa-tions sim-i-lar suf-fer-ing
187
+ %sup-po-si-tion syn-on-y-mous tem-per-a-ment tem-per-a-ments tong-rat
188
+ %tran-scend tran-scend-ent tran-scends un-con-di-tioned under-stand
189
+ %under-stood un-hap-pi-ness un-sat-is-fac-tori-ness un-sat-is-fac-tory
190
+ %ven-er-able wea-ri-ness what-ev-er when-ever wher-ever whole-hearted
191
+ %whole-heart-edly wrong-do-ing}
192
+
193
+ % === soul settings ===
194
+
195
+ \sodef\soTocChapter{}{.1em}{.5em plus.1em}{.1em plus.1em minus.1em}
196
+ \sodef\soSection{}{.07em}{.4em plus.1em}{.1em plus.1em minus.1em}
197
+ \sodef\soChapter{}{.06em}{.4em plus.1em}{.1em plus.1em minus.1em}
198
+
199
+ % === Custom commands and environments ===
200
+
201
+ \newcommand\dividerRule{%
202
+ {\centering\bigskip
203
+ {\color[gray]{0.6}\rule{0.6\linewidth}{0.2pt}}
204
+ \par\bigskip}%
205
+ }
206
+
207
+ \newcommand\emptysheet{%
208
+ \cleardoublepage
209
+ \thispagestyle{empty}\mbox{}\newpage
210
+ \thispagestyle{empty}\mbox{}\newpage
211
+ }
212
+
213
+ \newcommand\emptydoublepage\emptysheet
214
+
215
+ \newcommand\emptypage{%
216
+ \clearpage
217
+ \thispagestyle{empty}\mbox{}\newpage
218
+ }
219
+
220
+ \newcommand*{\subtitle}[1]{\def\@thesubtitle{#1}}
221
+ \newcommand*{\editionInfo}[1]{\def\@theEditionInfo{#1}}
222
+ \newcommand*{\printedByInfo}[1]{\def\@thePrintedByInfo{#1}}
223
+ \newcommand*{\ISBN}[1]{\def\@theISBN{#1}}
224
+
225
+ \newcommand\thesubtitle{\@thesubtitle}
226
+ \newcommand\theEditionInfo{\@theEditionInfo}
227
+ \newcommand\thePrintedByInfo{\@thePrintedByInfo}
228
+ \newcommand\theISBN{\@theISBN}
229
+
230
+ \newsavebox{\quotepagebox}
231
+ \newenvironment{quotepage}[1]
232
+ {\begin{lrbox}{\quotepagebox}\begin{minipage}{#1}
233
+ \setlength{\parskip}{0.6\baselineskip}
234
+ \setlength{\parindent}{0pt}}
235
+ {\end{minipage}\end{lrbox}%
236
+ \begin{tikzpicture}[remember picture,overlay]
237
+ \node at (current page.center) {\usebox{\quotepagebox}};
238
+ \end{tikzpicture}}
239
+
240
+ \newenvironment{packeditemize}%
241
+ {\begin{itemize}[
242
+ itemindent=0pt,
243
+ leftmargin=15pt,
244
+ rightmargin=0pt,
245
+ itemsep=2pt,
246
+ topsep=0pt,
247
+ parsep=0pt,
248
+ partopsep=0pt,
249
+ ]%
250
+ }{\end{itemize}}
251
+
252
+ \newlength\qw
253
+ \setlength\qw{17pt}% same as parindent for smallpage
254
+
255
+ \newcommand{\question}[1]{%
256
+ \smallskip%
257
+ \par\noindent\hangindent=\qw%
258
+ \ifthenelse{\equal{#1}{}}{\textit{Q:}\space}{\textit{#1:}\space}%
259
+ }
260
+
261
+ \newcommand{\questionBi}[2]{%
262
+ \smallskip%
263
+ \par\noindent\hangindent=\qw%
264
+ \textit{Q: #1}
265
+ \smallskip%
266
+ \par\noindent\hangindent=\qw%
267
+ \textit{Q: #2}
268
+ }
269
+
270
+ \newcommand{\answer}[1]{%
271
+ \smallskip%
272
+ \par\noindent%
273
+ \ifthenelse{\equal{#1}{}}{\textit{A:}\space}{\textit{#1:}\space}%
274
+ }
275
+
276
+ % === Renewing package macros ===
277
+
278
+ \let\mainmatterOrig=\mainmatter
279
+ \renewcommand{\mainmatter}{%
280
+ \mainmatterOrig%
281
+ \addtocontents{toc}{\addvspace{10pt}}%
282
+ }
283
+
284
+ \let\backmatterOrig=\backmatter
285
+ \renewcommand{\backmatter}{%
286
+ \backmatterOrig%
287
+ \addtocontents{toc}{\addvspace{15pt}}%
288
+ }
289
+
290
+ \renewenvironment{quote}%
291
+ {\small
292
+ \list{}{\rightmargin\leftmargin}%
293
+ \item[]}%
294
+ {\endlist}
295
+
296
+ \newcommand\quoteref[1]{%
297
+ \par
298
+ {\footnotesize #1}
299
+ \par
300
+ }
301
+
302
+ \renewcommand\footnoterule{%
303
+ \vspace*{\baselineskip}%
304
+ \kern-3\p@
305
+ {\color{footnoterule}\hrule height 0.25pt width \columnwidth}
306
+ \kern2.6\p@}
307
+
308
+ \renewcommand*{\notesname}{Notes}
309
+ \renewcommand*{\notedivision}{\chapter{\notesname}}
310
+ %\renewcommand*{\notedivision}{\section*{\notesname}}
311
+ \renewcommand*{\pagenotesubhead}[3]{}
312
+ \renewcommand*{\notenumintext}[1]{\textsuperscript{\thinspace [#1]}}
313
+ \renewcommand{\prenoteinnotes}{\par\noindent\hangindent=17pt}
314
+ \renewcommand{\postnoteinnotes}{\par\vspace*{0.5\baselineskip}}
315
+
316
+ % === Page styles ===
317
+
318
+ \nouppercaseheads
319
+
320
+ % define page styles with names about "what it does"
321
+
322
+ \newcommand{\sepline}{%
323
+ \hspace{6pt}%
324
+ \raisebox{-0.3\baselineskip}{\rule{0.2pt}{1.2\baselineskip}}%
325
+ \hspace{6pt}%
326
+ }
327
+ \makepagestyle{topbottomcentered}
328
+ \makeevenhead{topbottomcentered}{}{\textit{\rightmark}}{}
329
+ \makeevenfoot{topbottomcentered}{}{\thepage}{}
330
+ \makeoddhead{topbottomcentered}{}{\textit{\leftmark}}{}
331
+ \makeoddfoot{topbottomcentered}{}{\thepage}{}
332
+
333
+ \makepagestyle{bottomcorner}
334
+ \makeevenhead{bottomcorner}{}{}{}
335
+ \makeevenfoot{bottomcorner}{%
336
+ \footFont\footSize%
337
+ \thepage \sepline \leftmark%
338
+ }{}{}
339
+ \makeoddhead{bottomcorner}{}{}{}
340
+ \makeoddfoot{bottomcorner}{}{}{%
341
+ \footFont\footSize%
342
+ \rightmark \sepline \thepage%
343
+ }
344
+
345
+ \makepagestyle{bottomcenter}
346
+ \makeevenhead{bottomcenter}{}{}{}
347
+ \makeevenfoot{bottomcenter}{}{%
348
+ \footFont\footSize%
349
+ \thepage%
350
+ }{}
351
+ \makeoddhead{bottomcenter}{}{}{}
352
+ \makeoddfoot{bottomcenter}{}{%
353
+ \footFont\footSize%
354
+ \thepage%
355
+ }{}
356
+
357
+ % alias the pagestyles into semantic names, "where it is used"
358
+
359
+ \aliaspagestyle{normalpage}{bottomcorner}
360
+ \aliaspagestyle{chapter}{bottomcenter}
361
+ \aliaspagestyle{part}{empty}
362
+ \aliaspagestyle{afterpart}{empty}
363
+
364
+ \pagestyle{normalpage}
365
+
366
+ % === TOC settings ===
367
+
368
+ \maxtocdepth{section}
369
+
370
+ % Fixes Undefined control sequence error for \@chapapp@head
371
+ \renewcommand\chapternumberline[1]{\numberline{#1}}
372
+ \renewcommand\partnumberline[1]{\numberline{#1}}
373
+
374
+ % Fixes Missing number error when chapter number is not numeric, as in
375
+ % Appendix A
376
+ \let\ttll@appendix\ttll@chapter
377
+
378
+ \newcommand*\l@chapternote{\@nodottedtocline{0}{6pc}{1pc}{1pc}}
379
+
380
+ \def\@nodottedtocline#1#2#3#4#5#6{%
381
+ \ifnum #1>\c@tocdepth \else
382
+ %\vskip \z@ \@plus.2\p@
383
+ \vspace*{-3pt}
384
+ {\footnotesize\itshape\crimsonRomanFont
385
+ \leftskip #2\relax
386
+ \rightskip \@tocrmarg
387
+ \advance\rightskip #3\relax
388
+ \parfillskip -\rightskip
389
+ \parindent #2\relax\@afterindenttrue
390
+ \interlinepenalty\@M
391
+ \leavevmode
392
+ \@tempdima #4\relax
393
+ \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
394
+ {#5}\nobreak
395
+ \leaders\hbox{$\m@th
396
+ \mkern \@dotsep mu\hbox{\,}\mkern \@dotsep
397
+ mu$}\hfill
398
+ \nobreak
399
+ \hb@xt@\@pnumwidth{\hfil\normalsize\normalfont}%
400
+ \par}%
401
+ \fi}
402
+
403
+ \def\tocChapterNote#1{%
404
+ \addcontentsline{toc}{chapternote}{%
405
+ \noexpand\numberline{}#1}%
406
+ }
407
+
408
+ % the right TOC margin
409
+ \contentsmargin{0pt}
410
+
411
+ \newlength\tocLeftWidth
412
+ \setlength\tocLeftWidth{6pc}
413
+
414
+ % FIXME: the first Part heading in the TOC will also add that 20pt
415
+ % vspace. How to add it only before a Part that follows a Chapter?
416
+
417
+ \titlecontents{part}[\tocLeftWidth]
418
+ {\addvspace{20pt}%
419
+ \normalsize\crimsonRomanFont}%
420
+ {%
421
+ \contentsmargin{0pt}%
422
+ \makebox[0pt][r]{%
423
+ {\color{tocleftsidepart}\partname~\thecontentslabel}%
424
+ \hspace*{0.5em}$\cdot$\hspace*{0.5em}}%
425
+ }
426
+ {\contentsmargin{0pt}}
427
+ {\hfill\normalsize\crimsonRomanFont\thecontentspage}
428
+ [\addvspace{5pt}]
429
+
430
+ \titlecontents{chapter}[\tocLeftWidth]
431
+ {\normalsize\crimsonRomanFont}%
432
+ {%
433
+ \contentsmargin{0pt}%
434
+ \makebox[0pt][r]{%
435
+ {\color{tocleftside}%
436
+ \chaptername~{\crimsonRomanFontOldNum\thecontentslabel}}%
437
+ \hspace*{0.5em}$\cdot$\hspace*{0.5em}%
438
+ }%
439
+ }
440
+ {\contentsmargin{0pt}%
441
+ \itshape}
442
+ {\hfill\normalsize\crimsonRomanFont\thecontentspage}
443
+
444
+ \titlecontents{appendix}[\tocLeftWidth]
445
+ {\normalsize\crimsonRomanFont}%
446
+ {%
447
+ \contentsmargin{0pt}%
448
+ \makebox[0pt][r]{%
449
+ {\color{tocleftside}%
450
+ \appendixname~{\crimsonRomanFontOldNum\thecontentslabel}}%
451
+ \hspace*{0.5em}$\cdot$\hspace*{0.5em}%
452
+ }%
453
+ }
454
+ {\contentsmargin{0pt}%
455
+ \itshape}
456
+ {\hfill\normalsize\crimsonRomanFont\thecontentspage}
457
+
458
+ \titlecontents{section}[\tocLeftWidth]
459
+ {\addvspace{-2pt}%
460
+ \small\crimsonRomanFont}
461
+ {\contentslabel[\thecontentslabel]{\tocLeftWidth}}
462
+ {}
463
+ {\hfill\normalsize\crimsonRomanFont\thecontentspage}
464
+
465
+ \titlecontents*{subsection}[\tocLeftWidth]
466
+ {\addvspace{-1pt}%
467
+ \small\crimsonRomanFont}
468
+ {}
469
+ {}
470
+ {\ --- \thecontentspage}
471
+ [ \textbullet\ ][]
472
+
473
+ \renewcommand{\tableofcontents}{%
474
+ \chapterstyle{hightitle}
475
+ \chapter*{\contentsname}
476
+ \markboth{\contentsname}{\contentsname}
477
+ \chapterstyle{lowtitle}
478
+ \@starttoc{toc}
479
+ }
480
+
481
+ % === Book styles ===
482
+
483
+ % === Part styles ===
484
+
485
+ \newif\ifthisparthastitle
486
+ \thisparthastitletrue
487
+
488
+ \newif\ifthisparthasnote
489
+ \thisparthasnotefalse
490
+
491
+ \newcommand*{\thePartNote}{}
492
+ \newcommand*{\partNote}[1]{%
493
+ \thisparthasnotetrue%
494
+ \renewcommand*\thePartNote{#1}%
495
+ }
496
+
497
+ \renewcommand{\partnamefont}{\Huge\partTitleFont\color{partname}}
498
+ \renewcommand{\partnumfont}{\Huge\partTitleFont\color{partname}}
499
+ \renewcommand{\parttitlefont}{\large\partTitleFont\color{parttitle}\MakeUppercase}
500
+ \renewcommand*{\midpartskip}{\par\vskip 10pt}%
501
+
502
+ % FIXME: Currently, if there isn't a part title, we have to do
503
+ % \part{\space} to still create the part line in the TOC and the
504
+ % bookmark index.
505
+ %
506
+ % It would be better if the index had ``Part One'', and the TOC would
507
+ % handle it better too.
508
+
509
+ \long\def\@part[#1]#2{%
510
+ \M@gettitle{#1}%
511
+ \phantomsection
512
+ \ifnum \c@secnumdepth >-2\relax
513
+ \refstepcounter{part}%
514
+ \addcontentsline{toc}{part}%
515
+ {\protect\partnumberline{\thepart}#1}%
516
+ \mempartinfo{\thepart}{#1}{#2}%
517
+ \else
518
+ \addcontentsline{toc}{part}{#1}%
519
+ \mempartinfo{}{#1}{#2}%
520
+ \fi
521
+ \partmark{#1}%
522
+ {%
523
+ \raggedright
524
+ \hspace*{\chapterTitleLeftSkip}%
525
+ \begin{minipage}{\linewidth - \chapterTitleLeftSkip}
526
+ \raggedright
527
+ \interlinepenalty \@M
528
+ \parskip\z@
529
+ \ifthisparthasnote
530
+ \thePartNote
531
+ \par
532
+ \global\thisparthasnotefalse
533
+ \midpartskip
534
+ \fi
535
+ \normalfont
536
+ \ifnum \c@secnumdepth >-2\relax
537
+ \resizebox{2.8cm}{!}{\printpartname \partnamenum \printpartnum}
538
+ \par\vskip 20pt
539
+ \fi
540
+ \ifthisparthastitle
541
+ \printparttitle{#2}
542
+ \else
543
+ \global\thisparthastitletrue
544
+ \fi
545
+ \par%
546
+ \end{minipage}%
547
+ \par%
548
+ }%
549
+ \@endpart}
550
+
551
+ % === Chapter styles ===
552
+
553
+ \setsecnumdepth{chapter}
554
+
555
+ % define chapter styles with "fantasy" names
556
+
557
+ \newif\ifchapterauthor
558
+ \chapterauthorfalse
559
+
560
+ \newcommand*{\theChapterAuthor}{}
561
+ \newcommand*{\chapterAuthor}[1]{%
562
+ \chapterauthortrue%
563
+ \renewcommand*{\theChapterAuthor}{#1}%
564
+ }
565
+
566
+ \newcommand\chapterAuthorFmt[1]{%
567
+ \chapterAuthorFont\chapterAuthorSize\color{chapterauthor}%
568
+ #1%
569
+ }
570
+
571
+ \newif\ifchapternote
572
+ \chapternotefalse
573
+
574
+ \newcommand\chapterNoteFmt[1]{%
575
+ \chapterNoteFont\chapterNoteSize\color{chapternote}%
576
+ \itshape #1%
577
+ }
578
+
579
+ \newcommand*{\theChapterNote}{}
580
+ \newcommand*{\chapterNote}[1]{%
581
+ \chapternotetrue%
582
+ \renewcommand*\theChapterNote{#1}%
583
+ }
584
+
585
+ \newif\ifchapterfootnote
586
+ \chapterfootnotefalse
587
+
588
+ \newcommand*{\theChapterFootnoteMark}{}
589
+ \newcommand*{\theChapterFootnoteText}{}
590
+ \newcommand*{\chapterFootnote}[2][\footnotemark]{%
591
+ \chapterfootnotetrue%
592
+ \renewcommand*\theChapterFootnoteMark{#1}%
593
+ \renewcommand*\theChapterFootnoteText{\footnotetext{#2}}%
594
+ }
595
+
596
+ \newlength\chapterTitleLeftSkip
597
+ \setlength{\chapterTitleLeftSkip}{17pt}
598
+
599
+ \makechapterstyle{lowtitle}{
600
+ \chapterstyle{default}
601
+ \setlength{\beforechapskip}{30mm}
602
+ \setlength{\chapterTitleLeftSkip}{17pt}
603
+ \renewcommand\printchaptername{}
604
+ \renewcommand\chapternamenum{}
605
+ \renewcommand\chapnumfont{\chapterNumberFont\chapterNumberSize}
606
+ \renewcommand\printchapternum{%
607
+ \chapnumfont\color{chapternum}%
608
+ \hspace*{\chapterTitleLeftSkip}\thechapter%
609
+ }
610
+ \setlength{\midchapskip}{2\onelineskip}
611
+ \renewcommand\afterchapternum{\par\nobreak\vskip \midchapskip}
612
+ \renewcommand\printchapternonum{}
613
+ \renewcommand\chaptitlefont{\chapterTitleFont\chapterTitleSize}
614
+ \renewcommand*\printchaptertitle[1]{%
615
+ \raggedright\hspace*{\chapterTitleLeftSkip}%
616
+ \parbox{\linewidth - \chapterTitleLeftSkip}{%
617
+ \raggedright\chaptitlefont\color{chaptertitle}%
618
+ \MakeUppercase{\soChapter{##1}}%
619
+ \ifchapterfootnote%
620
+ \hspace*{2pt}\theChapterFootnoteMark%
621
+ \fi%
622
+ \ifchapterauthor%
623
+ \vskip 0.5\onelineskip%
624
+ \chapterAuthorFmt{\theChapterAuthor}%
625
+ \global\chapterauthorfalse%
626
+ \fi%
627
+ \ifchapternote%
628
+ \vskip 0.5\onelineskip%
629
+ \chapterNoteFmt{\theChapterNote}%
630
+ \global\chapternotefalse%
631
+ \fi%
632
+ }%
633
+ \ifchapterfootnote%
634
+ \theChapterFootnoteText%
635
+ \global\chapterfootnotefalse%
636
+ \fi%
637
+ }
638
+ \setlength{\afterchapskip}{2.5\onelineskip}
639
+ \renewcommand\afterchaptertitle{\par\nobreak\vskip \afterchapskip}%
640
+ }
641
+
642
+ \makechapterstyle{hightitle}{
643
+ \chapterstyle{lowtitle}
644
+ \setlength{\beforechapskip}{0pt}
645
+ \setlength{\chapterTitleLeftSkip}{6pc}
646
+ }
647
+
648
+ % alias the "fantasy" names into semantic chapter names
649
+
650
+ % TODO: use a semantic name for normal chapters and alias to it
651
+ \chapterstyle{lowtitle}
652
+
653
+ % === Section styles ===
654
+
655
+ \raggedbottomsection
656
+
657
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}
658
+ \setaftersecskip{2.3ex \@plus .2ex}
659
+
660
+ \newcommand\sectionFmt[1]{%
661
+ \sectionFont\sectionSize\color{section}%
662
+ \memRTLraggedright%
663
+ \itshape #1%
664
+ }
665
+ \setsecheadstyle{\sectionFmt}
666
+
667
+ \setsubsecheadstyle{%
668
+ \sectionFont\large\itshape\memRTLraggedright%
669
+ }
670
+ \setsubsubsecheadstyle{%
671
+ \sectionFont\normalsize\itshape\memRTLraggedright%
672
+ }
673
+
@@ -0,0 +1,40 @@
1
+ \ProvidesPackage{book-core-last}
2
+
3
+ % === Packages to be loaded LAST ===
4
+
5
+ \RequirePackage[perpage,multiple,stable]{footmisc}
6
+
7
+ \RequirePackage[final,babel=true]{microtype}
8
+
9
+ %% =================
10
+ %% PDF/X-3:2002 info
11
+ %% =================
12
+
13
+ % \pdfobjcompresslevel=0%
14
+ % \pdfminorversion=3%
15
+ % \pdfinfo{
16
+ % /Title (\thetitle)
17
+ % /Author (\theauthor)
18
+ % /Subject (buddhism)
19
+ % /Keywords (buddhism)
20
+ % /GTS_PDFXVersion (PDF/X-3:2002)
21
+ % }%
22
+ % \pdfpageattr{
23
+ % /MediaBox [0 0 369.00000 594.00000]
24
+ % /BleedBox [0.00000 0.00000 369.00000 594.00000]
25
+ % /CropBox [0 0 369.00000 594.00000]
26
+ % /TrimBox [0.00000 0.00000 369.00000 594.00000]
27
+ % }
28
+ % \pdfcatalog{
29
+ % /PageMode /UseNone
30
+ % /OutputIntents [ <<
31
+ % /Info (none)
32
+ % /Type /OutputIntent
33
+ % /S /GTS_PDFX
34
+ % /OutputConditionIdentifier (Blurb.com)
35
+ % /RegistryName (http://www.color.org/)
36
+ % >> ]
37
+ % }%
38
+
39
+ %% ==============
40
+