-
Notifications
You must be signed in to change notification settings - Fork 0
/
mathesis.sty
executable file
·213 lines (183 loc) · 5.83 KB
/
mathesis.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mathesis}
\usepackage[utf8]{inputenc}
\RequirePackage[l2tabu, orthodox]{nag}
\RequirePackage{etoolbox}
\usepackage{pgfkeys}
\usepackage{pgfopts}
\pgfkeys{
/mathesis/.cd,
biblatex/.store in = \mathesis@biblatex,
bib/.store in = \mathesis@bib,
initials/.store in = \mathesis@initials,
initials=ma,
}
\ProcessPgfPackageOptions*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LAYOUT AND LOOKS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Bibliography with ToC entry %%%%
\ifdef{\mathesis@biblatex}{
\ifdef{\mathesis@bib}{
\usepackage[backend=bibtex,url=false,isbn=false,doi=false,firstinits=true,maxbibnames=99,style=numeric]{biblatex}
\addbibresource{\mathesis@bib}
\@ifclassloaded{book}{
\AtEndEnvironment{document}{%
\printbibliography[heading=bibintoc]%
}{}{}
}{
\AtEndEnvironment{document}{%
\addcontentsline{toc}{section}{\refname}\printbibliography%
}{}{}
}
}{}
}{
\ifdef{\mathesis@bib}{
\AtEndEnvironment{document}{%
\bibliography{\mathesis@bib}{}\bibliographystyle{plain}%
}
}{}
}
%%% Page size %%%%
\@ifclassloaded{book}{
\usepackage[inner=1.4in, outer=1.1in]{geometry}
}{
\@ifclassloaded{sciposter}{}{
\usepackage[bottom=1in, top=1.5in,right=2cm,left=2cm]{geometry}
}
}
%%%% Headers and footers %%%%
\usepackage{fancyhdr}
\fancyhead{}
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\thepage}
\usepackage{setspace}
%%%% Chapter headings %%%%
\@ifclassloaded{book}{
\usepackage{titlesec}
\titleformat{\chapter}[display]{\normalfont\huge\bfseries}{}{0pt}{\Huge}%Put stuff before title in last brackets
\titlespacing*{\chapter}{0pt}{20pt}{40pt}
}{}
%%%% Figures %%%%
\usepackage{scalerel}
\@ifclassloaded{sciposter}{}{
\usepackage[labelfont=bf]{caption}
\captionsetup[algorithm]{labelfont=rm,labelsep=period}
\usepackage{subcaption}
}
%%%% Typography %%%%
\usepackage{microtype}
\usepackage{lmodern}
\usepackage[USenglish]{babel}
\usepackage[T1]{fontenc}
%%%% Float placement %%%%
\usepackage{flafter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%% STRUCTURE COMMANDS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Theorems %%%%
%% The actual theorem, corollary,... definitions need to be after cleverref
%% according to the documentaiton of cleverref.
\usepackage{amsthm}
%%%% Abstract %%%%
\@ifclassloaded{book}{
\newenvironment{abstract}{%
\clearpage\null \vfill\begin{center}%
\bfseries \abstractname \end{center}%
}{%
\vfill\null%
}%
}
%%%% Emphasized matter by frame with left bar %%%%
\usepackage{framed}
\renewenvironment{leftbar}[1][\hsize]%
{%
\def\FrameCommand%
{%
\vrule width 3pt \hspace{-4pt}
\fboxsep=\FrameSep\colorbox{Lavender!25}%
}%
\MakeFramed{\hsize#1\advance\hsize-\width\FrameRestore}%
}%
{\endMakeFramed}
%%%% Align with left tags %%%%
\usepackage{environ}
\NewEnviron{Lalign}{\tagsleft@true\begin{align}\BODY\end{align}}
%%%% Blank page %%%%
\newcommand{\blankpage}{\clearpage\mbox{}\thispagestyle{empty}\clearpage}
%%%%%%%%%%%%%%%%%%%%% MORE COMMANDS AND PACKAGES %%%%%%%%%%%%%%%%%%%%%
%%%% Math %%%%
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{madefs}
%%%% Algorithms %%%%
\usepackage{algorithm}
\usepackage{algpseudocode}
%%%% Various %%%%
\usepackage{blindtext}
%%%% Graphics %%%%
\usepackage{pgfplots,tikz}
\usetikzlibrary{matrix,arrows}
\usepackage{epstopdf}
%%%% Counting %%%%
\usepackage{chngcntr}
%%%% Float placement %%%%
\usepackage{afterpage}
%%%% Various %%%%
\usepackage{etoolbox} % Needed for \pretocmd{\chapter} %% CHECK UNUSED
\usepackage{bm} % Bold math symbols. Just as good as textbf and mathbf. Never use bfseries
\usepackage{bbm} % Blackboard Numbers \mathbbm{1}
\usepackage{csquotes} % \enquote
\usepackage{enumerate} % change to enumitem
%%%% Structuring %%%%
\usepackage{appendix} %%CHECK USAGE
%%%% Typing superscript numbers %%%%
\usepackage{nth}
%%%% Typing Roman Numbers %%%%
\newcommand{\romath}[1]{%
\textup{\uppercase\expandafter{\romannumeral#1}} % Roman numbers from input
}
%%%% Adding %%%%
\newcommand\add[2]{\the\numexpr(#1)+(#2)\relax}
%%%% Miscellaneous %%%%
\newcommand{\condinput}[1]{
\ifcsname#1\endcsname%
\input{#1}
\fi%
}
%%%%%%%%%%%%%%%%%%%%%% THINGS THAT MUST COME AT THE END %%%%%%%%%%%%%%%%%%%%%%
%%%% Links %%%%
%% Must come before cleveref accoring to cleveref, but at the end according
%% to hyperref. It seems to work here
\usepackage{hyperref}
%%%% Referencing %%%%
\usepackage[capitalize]{cleveref}
%%%% Annotations, must come after amsthm %%%%
\usepackage[mode=multiuser]{fixme}
\fxsetup{layout=pdfcnote,targetlayout=color}
\fxusetheme{signature}
\FXRegisterAuthor{\mathesis@initials}{an\mathesis@initials}{\mathesis@initials}
\crefname{definition}{Definition}{Definitions}
\crefname{remark}{Remark}{Remarks}
\crefname{corollary}{Corollary}{Corollaries}
\crefname{theorem}{Theorem}{Theorems}
\crefname{algo}{Algorithm}{Algorithms}
\crefname{lemma}{Lemma}{Lemmas}
\crefname{example}{Example}{Examples}
\crefname{proposition}{Proposition}{Propositions}
\crefname{defpro}{Definition and Proposition}{}
\crefname{equation}{Equation}{Equations}
%%%% Theorem definitions %%%%
%% Must come after cleveref, according to cleveref
\theoremstyle{plain}
\@ifclassloaded{book}{
\newtheorem{definition}{Definition}[chapter]
}{
\newtheorem{definition}{Definition}[section]
}
\newtheorem{remark}{Remark}
\newtheorem{example}{Example}
\theoremstyle{plain}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{algo}[definition]{Algorithm}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{proposition}[definition]{Proposition}
\newtheorem{defpro}[definition]{Definition and Proposition}