-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStandard.cls
More file actions
executable file
·246 lines (200 loc) · 7.05 KB
/
Standard.cls
File metadata and controls
executable file
·246 lines (200 loc) · 7.05 KB
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
% This style requires Old Standard TT.
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{style}
%% Class loading and defaults: %%
\LoadClass[ebook, 14pt, openany, twoside, extrafontsizes, showtrims]{memoir}
\RequireXeTeX
%% Custom metadata: %%
\newcommand{\draftinfo}{} % Default to empty
\newcommand{\publicationdetailsinfo}{}
%% Checking if empty: %%
\RequirePackage{ifmtarg}
\newcommand{\ifexpandsnotmt}[2]{\expandafter\@ifnotmtarg\expandafter{#1}{#2}}
%% Font and language setup: %%
\RequirePackage{fontspec, polyglossia}
\setmainlanguage[variant=uk,ordinalmonthday=false]{english}
\setmainfont{Old Standard TT}
\newfontfamily{\ostt}{Old Standard TT}
\newcommand{\subs}[1]{\raisebox{-.35ex}{\scriptsize #1}}
\newcommand{\supers}[1]{\raisebox{.7ex}{\scriptsize #1}}
\RequirePackage{metalogo}
\RequirePackage{newunicodechar}
\newunicodechar{⸺}{\makebox[2em][s]{\textemdash\hss\textemdash\hss\textemdash}} % Old Standard TT requires adjustment to remove space
%% Emphasis: %%
\usepackage[normalem]{ulem} % This option for alliance with bookgen.sty
\ULforem
%% Page geometry: %%
\settypeblocksize{486.9pt}{*}{*} % This gives 28 lines per page which is my preferred text height
\setlrmarginsandblock{.75in}{.75in}{*}
\setulmargins{*}{*}{1} % Equal vertical margins
\setheadfoot{\baselineskip}{28pt}
\setheaderspaces{*}{14pt}{*}
% \setstocksize{11in}{8.5in} % This sets the page up on letter stock
% \setpagecc{\paperheight}{\paperwidth}{*} % This centres the page on the stock
% \trimFrame
\showtrimsoff
\checkandfixthelayout[nearest]
\newlength{\smallheight}
\newlength{\smallwidth}
\setlength{\smallheight}{468.9pt} % Half an inch shorter
\setlength{\smallwidth}{263.75pt} % This gives a 9:16 ratio with the small height
%% Empty last page: %%
\AtEndDocument{\atendtext\cleartoevenpage[\null\thispagestyle{cleared}]\null\pagestyle{cleared}}
%% Frame formatting: %%
\setlength{\fboxrule}{4.5pt}
\setlength{\fboxsep}{5pt}
%% Stamp marks: %%
\RequirePackage[usenames,dvipsnames,svgnames,table]{xcolor}
\RequirePackage[pages=some]{background}
\newcommand{\textmark}{\backgroundsetup{
contents={\ostt\Huge\bfseries\framebox{\MakeUppercase{\titleinfo}}},
color={black},
angle={24},
opacity={1},
scale={1},
position={-5pc,-4pc},
nodeanchor={north west}
}\BgThispage}
%% List formatting: %%
\RequirePackage[inline]{enumitem}
%% Date/time setup: %%
\RequirePackage[english, cleanlook]{isodate}
%% Quotation setup: %%
\RequirePackage[style=french,french=guillemets]{csquotes}
\DeclareQuoteStyle[guillemets]{french}{« }[» ]{ »}{« }[» ]{ »}
%% Footnote formatting: %%
\footmarkstyle{#1.\hfill}
\setlength{\footmarkwidth}{1.7em}
\setlength{\footmarksep}{-1.7em}
\setlength{\footparindent}{1.7em}
\setlength{\footnotesep}{\onelineskip}
\setfootins{24pt plus 14pt minus 9pt}{19pt}
\feetbelowfloat
\renewcommand{\@makefntext}[1]{\makefootmark #1}
\renewcommand{\foottextfont}{\scriptsize}
%% Chapter formatting: %%
\makechapterstyle{ANDY}{
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\afterchapternum}{\enspace}
\renewcommand*{\printchapternonum}{}
\renewcommand*{\chapnumfont}{\ostt\huge\bfseries}
\renewcommand*{\chaptitlefont}{\ostt\huge\bfseries}
\setlength{\beforechapskip}{48pt}
\setlength{\afterchapskip}{34pt plus 6pt minus 2pt}
}
\makechapterstyle{SANDY}{
\renewcommand{\chapterheadstart}{\vspace*{\beforechapskip}\hspace{1.5em}\textmark}
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\afterchapternum}{\enspace}
\renewcommand*{\printchapternonum}{}
\renewcommand*{\chapnumfont}{\ostt\huge\bfseries}
\renewcommand*{\chaptitlefont}{\ostt\huge\bfseries}
\setlength{\beforechapskip}{48pt}
\setlength{\afterchapskip}{34pt plus 6pt minus 2pt}
}
\copypagestyle{chapter}{plain}
\makeevenhead{chapter}{}{\tiny\copyrightinfo}{}
\makeoddhead{chapter}{}{\tiny\copyrightinfo}{}
%% Lettrines: %%
\newcommand*{\lettrine}[1]{\textbf{#1}\quad}
%% Breaks: %%
\setlength{\pfbreakskip}{37pt}
\renewcommand*{\pfbreakdisplay}{\bigskip·\quad ·\quad ·\quad ·\quad ·\bigskip}
%% The title: %%
\RequirePackage{graphicx}
\renewcommand{\maketitle}{
\pagestyle{empty}
{\large\descriptioninfo}
\cleartorecto
\begin{center}
\begin{minipage}[t]{\smallwidth}
\parindent=0pt\centering\bfseries\ostt
{\large~\seriesinfo~} % Spaces ensure this line is printed even if blank
\par\bigskip
\par\Huge\MakeUppercase{\titleinfo}
\end{minipage}
\end{center}
\clearpage\null\cleartorecto
\begin{center}
\begin{minipage}[t][\smallheight][t]{\smallwidth}
\parindent=0pt\centering\ostt
\vfill
{\large~\seriesinfo~}
\par\bigskip\HUGE\bfseries\framebox{\MakeUppercase{\titleinfo}}
\par\vfill
\par{\huge \authorinfo}
\par\vfill
\par\vfill
\par\vfill
\par{\Large ⁖~\publisherinfo~\reflectbox{⁖}}
\end{minipage}
\end{center}
\clearpage
}
%% The copyright: %%
\newcommand{\makecopyright}{
\vfill
{
\parindent=0pt\tiny
\ifexpandsnotmt{\publicationdetailsinfo}{\publicationdetailsinfo\par\bigskip}
\ifexpandsnotmt{\thecopyright}{\thecopyright\par\medskip}
This draft compiled \today{} at \printtime.
\par\styleinfo{} Edition, \draftinfo{}.
\par\bigskip
Book design by KIBI Gô.
\par\medskip
This work is formatted via \XeLaTeX{}.
Body text has been set in 12pt Old Standard TT.
\par\bigskip
\par\vfill
}
}
%% Option handling: %%
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}}
\ProcessOptions\relax
%% Defaults: %%
\RequirePackage{fmtcount}
\renewcommand{\thechapter}{\padzeroes[2]{\decimal{chapter}}}
\newcommand*{\nonmaintitle}{SANDY}
\newcommand{\beforefulltext}{\renewcommand*{\nonmaintitle}{ANDY}\renewcommand{\atendtext}{}}
\setsecnumdepth{chapter}
\pagenumbering{arabic}
\openany
\pagestyle{simple}
\chapterstyle{SANDY}
\newcommand{\atendtext}{\par\vfill\centering\pagebreak[1]\null\vfill\parbox[b]{\smallwidth}{\tiny\ifexpandsnotmt{\publicationdetailsinfo}{\leavevmode\publicationdetailsinfo\nolinebreak\qquad}\ifexpandsnotmt{\thecopyright}{\thecopyright{} }Text design by KIBI Gô. This work was formatted via \XeLaTeX{}, and this draft was compiled \today{} at \printtime{}.\nolinebreak\qquad Body text has been set in 14pt Old Standard TT.\nolinebreak\qquad This has been the \ordinalstring{chapter} chapter of \seriesinfo{} – \titleinfo{}. Thank you for reading.\lastlinerulefill}}
\tolerance=5000
%% Matter handling: %%
\newcounter{lastfmpage}
\renewcommand{\frontmatter}{
\cleardoublepage
\openright
\pagenumbering{roman}
\pagestyle{simple}
\chapterstyle{\nonmaintitle}
\makeevenhead{chapter}{}{}{}
\makeoddhead{chapter}{}{}{}
}
\renewcommand{\mainmatter}{
\cleardoublepage
\setcounter{lastfmpage}{\value{page}}
\pagenumbering{arabic}
\openany
\pagestyle{simple}
\setcounter{chapter}{0}
\chapterstyle{SANDY}
\makeevenhead{chapter}{}{}{}
\makeoddhead{chapter}{}{}{}
}
\renewcommand{\backmatter}{
\cleardoublepage
\pagenumbering{roman}
\setcounter{page}{\value{lastfmpage}}
\openright
\addtocontents{toc}{\vspace{12pt}}
\chapterstyle{\nonmaintitle}
\makeevenhead{chapter}{}{}{}
\makeoddhead{chapter}{}{}{}
}