-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUNBMathStyle.sty
281 lines (229 loc) · 8.79 KB
/
UNBMathStyle.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
% % % % % % % % % % % % %
% % % % % % % %
% %
% % Style common to both Calculus and Linear Algebra textbooks
% %
% % % % % % % %
% % % % % % % % % % % % %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Colour common to both texts
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Links and urls colour
\definecolor{linkcolour}{HTML}{013030}
% Colour for grey square in page header
\definecolor{headersquarecolour}{HTML}{BDBDBD}
%Lyryx blue
\definecolor{lyryxcolour}{HTML}{000033}
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% . . . End of Colours . . .
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The following commands changes the position of floats by overriding the Latex defaults.
% Changes the fraction of floats appearing at the top and bottom, and the fraction of the page that is text
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\renewcommand\floatpagefraction{.9}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.9}
\renewcommand\textfraction{.1}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Headers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Chapter Header
\titleformat{\chapter}[display]
{\color{chaptertitlecolour}\bf\Huge}
{\hspace*{-20pt}\thechapter.~#1} %-70
{-20pt}
{\hspace*{-20pt}{\color{chaptertitlecolour}\rule{\dimexpr\textwidth+40pt\relax}{2pt}}\Huge} %-110
\titleformat{name=\chapter,numberless}[display]
{\color{chaptertitlecolour}\bf\Huge}
{\hspace*{-20pt}#1}
{-20pt}
{\hspace*{-20pt}{\color{chaptertitlecolour}\rule{\dimexpr\textwidth+40pt\relax}{2pt}}\Huge}
[
\addcontentsline{toc}{chapter}{#1}
\setcounter{section}{0}
\markboth{#1}{#1}
]
\titlespacing*{\chapter}{0pt}{10pt}{10pt}
% Section Header
\titleformat{\section}[display]
{\bigskip\bigskip\hypersetup{linkcolor=sectiontitlecolour}\color{sectiontitlecolour}\bf\LARGE}
{\hspace*{0pt}\thesection~#1}
{-15pt}
{\hspace*{0pt}{\color{sectiontitlecolour}\rule{\dimexpr\textwidth\relax}{2pt}}\LARGE}
\titleformat{name=\section,numberless}[display]
{\bigskip\bigskip\hypersetup{linkcolor=sectiontitlecolour}\color{sectiontitlecolour}\bf\LARGE}
{\hspace*{0pt}#1}
{-15pt}
{\hspace*{0pt}{\color{sectiontitlecolour}\rule{\dimexpr\textwidth\relax}{2pt}}\LARGE}
\titlespacing*{\section}{0pt}{0pt}{10pt}
% Subsection header
\titleformat{\subsection}[display]
{\color{subsectiontitlecolour}\bf\large}
{\hspace*{0pt}\thesubsection.~#1}
{-10pt}
{\hspace*{0pt}{\color{subsectiontitlecolour}\rule{\dimexpr\textwidth\relax}{2pt}}\large}%{\hspace*{0pt}{\color{subsectiontitlecolour}\rule{.3\textwidth\relax}{0pt}}\large}
\titleformat{name=\subsection,numberless}[display]
{\color{subsectiontitlecolour}\bf\large}
{\hspace*{0pt}#1}
{-10pt}
{\hspace*{0pt}{\color{subsectiontitlecolour}\rule{\dimexpr\textwidth\relax}{2pt}}\large}%{\hspace*{0pt}{\color{subsectiontitlecolour}\rule{.5\textwidth}{0pt}}\large}
\titlespacing*{\subsection}{0pt}{10pt}{10pt}
% Subsubsection header
\titleformat{\subsubsection}[display]
{\color{subsubsectiontitlecolour}\bf\normalsize}
{\hspace*{0pt}\thesubsubsection.~#1}
{-10pt}
{\hspace*{0pt}{\color{subsubsectiontitlecolour}\rule{\dimexpr\textwidth\relax}{2pt}}\large}%{\hspace*{0pt}{\color{subsectiontitlecolour}\rule{.3\textwidth\relax}{0pt}}\large}
\titleformat{name=\subsubsection,numberless}[display]
{\color{subsubsectiontitlecolour}\bf\normalsize}
{\hspace*{0pt}#1}
{-10pt}
{\hspace*{0pt}{\color{subsubsectiontitlecolour}\rule{\dimexpr\textwidth\relax}{2pt}}\large}%{\hspace*{0pt}{\color{subsectiontitlecolour}\rule{.5\textwidth}{0pt}}\large}
\titlespacing*{\subsubsection}{0pt}{10pt}{10pt}
% To allow numbering of subsubsections
\setcounter{secnumdepth}{3}
% To include subsubsections in the TOC
\setcounter{tocdepth}{3}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Fancy page header commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand\graysquare{\textcolor{headersquarecolour}{\rule{1ex}{1ex}}} % gray square between page number and chapter/section name
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\fancyhf{}
\fancyhead[RO]{\rightmark\hspace{0.5em}\graysquare\hspace{0.5em}\thepage}
\fancyhead[LE]{\thepage\hspace{0.5em}\graysquare\hspace{0.5em}\leftmark}
\renewcommand{\headrulewidth}{0pt}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Boxes on title page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% For the main box containing 'Lyryx with Open Texts' and four images
\newtcolorbox{titlemainbox}{colback=titlemainboxcolour,colframe=titlemainboxcolour,before={\par\bigskip\pagebreak[0]\parindent=0pt},after={\par\bigskip},top=1em,bottom=1em}
% For the Lyryx marketing page paragraph header boxes
\newtcolorbox{lscshdrbox}{colback=lscshdrboxcolour,colframe=lscshdrboxcolour,top=0mm,bottom=0mm,width=40em}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Defines setup and colours for hyperlinks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\hypersetup{
pdfborder=0 0 0,
colorlinks=true,
allcolors=linkcolour, % Default color
linkcolor=linkcolour, % Chapter/Section links, figures, tables, etc
urlcolor=linkcolour, % Exploration links
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Exercises & Solutions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
% Counter for exercises
%\newcounter{ex}[chapter]
\newcounter{ex}[section]
\renewcommand{\theex}{\thesection.\arabic{ex}}
% ex env
% can \def\myextitle{#1} if we want to save the title for use in the solution
\newenvironment{ex}{
\par\medskip\noindent\refstepcounter{ex}\textbf{ \theex}\hspace{0.25em}\itshape
}{
\par\medskip
}
% answers package will place solutions in an solout env
\newenvironment{solout}[1]{
\par\medskip\noindent\textbf{#1}\par
}{
\par\medskip
}
% answers package uses this command to copy params from exercise environment to solout
\newcommand{\soloutparams}{{\theex}}
% exsolution env, where output is sent to exsolutions file and text placed in exsolout envs
\Newassociation{sol}{Answer}{solutions}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Redefining enumerate styles for only part of the book
% Changes all first level items in listed to (a),(b),(c),etc
\newenvironment{enumialphparenastyle}{
\let\oldlabelenumi=\labelenumi
\renewcommand{\labelenumi}{\textrm{(\alph{enumi})}}
}{
\let\labelenumi=\oldlabelenumi
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Used for Lyryx with Open Text icons (4 of them) on back cover of text
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Font used in componentnode
\newcommand*{\cmpfont}{\fontfamily{phv}\selectfont}
% Tikz node with \footnotesize text, center aligned, white font (Used in text under Lyryx icons on print-cover and back cover)
\tikzset{
componentnode/.style={
font=\scriptsize\cmpfont,
align=center,
white,
execute at begin node=\setlength{\baselineskip}{1.25em} % increases space between lines of text
}
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Creates page on left side (used on back cover)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newcommand*\cleartoleftpage{%
\clearpage
\ifodd\value{page}\hbox{}\newpage\fi
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A hack to do something like the center environment, but without spaces around it
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\newenvironment{center*}[0]{\bgroup \centering}
{
\egroup
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Special commands and shorthand commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% These commands may be used to update older Latex commands...?
\def\xrefn#1{\ref{#1}} % References
\def\figrdef#1{\label{#1}} % Labelling
% Shorthand command for displaystyle -- shows mathematical symbols in their full size
\def\ds{\displaystyle}
% Shorthand command for the symbol for the Set of Real Numbers
\def\R{\mathbb{R}}
% Change appearance of numbered equations
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
% Bold font for definitions
\def\dfont#1{{\bf{#1}}}
% Italicized font for emphasis
\def\ifont#1{{\it{{#1}}}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%