-
Notifications
You must be signed in to change notification settings - Fork 0
/
VTthesis.cls
executable file
·329 lines (289 loc) · 8.77 KB
/
VTthesis.cls
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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
% v2.0 by Erich L Foster 01 May 2013
%%% IDENTIFICATION --------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}[01/01/10]
\ProvidesClass{VTthesis}[24/07/2013 v3.0 Virginia Tech Thesis Proposal and Thesis Class]
\RequirePackage{etoolbox}
%Declaration of options
\def\@@ptsize{12pt}
\newbool{@sig}
\boolfalse{@sig}
\newbool{@proposal}
\boolfalse{@proposal}
\newbool{@dft}
\boolfalse{@dft}
\newbool{@dbl}
\boolfalse{@dbl}
\DeclareOption{10pt}{\def\@@ptsize{10pt}}
\DeclareOption{11pt}{\def\@@ptsize{11pt}}
\DeclareOption{12pt}{\def\@@ptsize{12pt}}
\DeclareOption{13pt}{\def\@@ptsize{13pt}}
\DeclareOption{sig}{\booltrue{@sig}}
\DeclareOption{nosig}{\boolfalse{@sig}}
\DeclareOption{proposal}{\booltrue{@proposal}}
\DeclareOption{draft}{\booltrue{@dft} \booltrue{@dbl}}
\DeclareOption{doublespace}{\booltrue{@dbl}}
%%% EXECUTION OF OPTIONS --------------------------------------------------
%% default to:
\ExecuteOptions{nosig}
\ProcessOptions
%%% PACKAGE LOADING -------------------------------------------------------
%% based on std report class
\LoadClass[\@@ptsize,letterpaper]{report}%book}
\RequirePackage{lmodern}
%used for List of Figures and table magic
\RequirePackage{etoolbox}
%% AMSLaTeX math environments and symbols
\RequirePackage{amsmath,amsthm,amssymb}
\RequirePackage[normalem]{ulem}
\RequirePackage[hmargin=1in,vmargin=1in,footskip=.25in,headsep=.25in,nomarginpar]{geometry}
\RequirePackage{enumerate}
\RequirePackage{paralist}
\RequirePackage[page]{appendix}
%double space option
\RequirePackage{setspace}
\ifbool{@dbl}{\doublespace}{}
%links for references
\RequirePackage[final]{hyperref}
%For including pdf images
\RequirePackage[final]{graphicx}
\RequirePackage{float}
%draft watermark
\ifbool{@dft}{
\PassOptionsToPackage{final}{hyperref}
\PassOptionsToPackage{final}{graphicx}
\usepackage[firstpage]{draftwatermark}}{}
%MATLAB Code formatting
\RequirePackage{listings}
\PassOptionsToPackage{final}{listings}
\RequirePackage{verbatim}
%define theorems and such
\newtheorem{proposition}{Proposition}[chapter]
\newtheorem{theorem}[proposition]{Theorem}
\newtheorem{lemma}[proposition]{Lemma}
\newtheorem{corollary}[proposition]{Corollary}
\newtheorem{conjecture}[proposition]{Conjecture}
\newtheorem{example}[proposition]{Example}
\newtheorem{definition}[proposition]{Definition}
\newtheorem{remark}[proposition]{Remark}
\lstset{% command to set programming language parameter(s)
frame=single,
showstringspaces=false,
showlines=false, %get rid of trailing white lines
emptylines=1, %allow blank line
breaklines=true, %get rid of overflow lines and enter \n
numbers=left, %line number
numberstyle=\scriptsize, %make line numbers small
stepnumber=1, %line number every line
numbersep=5pt,
tabsize=2, %set tabs to two spaces
basicstyle=\small, % print whole listing small
keywordstyle=\bfseries,% green keywords
stringstyle=\ttfamily % typewriter type for strings
}
% \author, \title are defined in book; here are the rest of the
% front matter defining macros
\def\@title{}
\def\@author{}
\def\@degree{Doctor of Philosophy}
\def\@institute{Virginia Polytechnica Institute and State University}
\def\@location{Blacksburg, Virginia}
\def\@program{Mathematics}
\def\@submitdate{\the\day \space \ifcase\the\month\or
January\or February\or March\or April\or May\or June\or
July\or August\or September\or October\or November\or December\fi
\space \number\the\year}
\def\type#1{\gdef\@type{#1}}
\def\degree#1{\gdef\@degree{#1}}
\def\institute#1{\gdef\@institute{#1}}
\def\location#1{\gdef\@location{#1}}
\def\program#1{\gdef\@program{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\ifnum\month>9
\@tempcnta=\year \advance\@tempcnta by 1
\edef\@copyrightyear{\number\the\@tempcnta}
\else
\def\@copyrightyear{\number\the\year}
\fi
%committee information
\newbool{@1st}
\boolfalse{@1st}
\newbool{@2nd}
\boolfalse{@2nd}
\newbool{@3rd}
\boolfalse{@3rd}
\newbool{@4th}
\boolfalse{@4th}
\newbool{@5th}
\boolfalse{@5th}
\def\@principaladvisor{}
\def\@firstreader{}
\def\@secondreader{}
\def\@thirdreader{}
\def\@fourthreader{}
\def\@fifthreader{}
\def\principaladvisor#1{\gdef\@principaladvisor{#1}}
\def\firstreader#1{\booltrue{@1st} \gdef\@firstreader{#1}}
\def\secondreader#1{\booltrue{@2nd} \gdef\@secondreader{#1}}
\def\thirdreader#1{\booltrue{@3rd} \gdef\@thirdreader{#1}}
\def\fourthreader#1{\booltrue{@4th} \gdef\@fourthreader{#1}}
\def\fifthreader#1{\booltrue{@5th} \gdef\@fifthreader{#1}}
%abstract, acknowledgements, dedication, and keywords setup
\def\@abstract{}
\def\@acknowledge{}
\def\@dedication{}
\def\@keywords{}
\newbool{@key}
\boolfalse{@key}
\newbool{@abs}
\boolfalse{@abs}
\newbool{@ack}
\boolfalse{@ack}
\newbool{@ded}
\boolfalse{@ded}
\long\def\abstract#1{\booltrue{@abs} \gdef\@abstract{#1}}
\long\def\acknowledge#1{
\ifbool{@dft}{}
{\booltrue{@ack} \gdef\@acknowledge{#1}}
}
\long\def\dedication#1{
\ifbool{@dft}{}
{\booltrue{@ded} \gdef\@dedication{#1}}
}
\def\keywords#1{\booltrue{@key} \gdef\@keywords{#1}}
\newcommand{\@vtcopyright}{Copyright \@copyrightyear, \@author}
% Setup the header and footer
\RequirePackage{fancyhdr}
\pagestyle{fancy}
%the following is a hack to deal with the possibility of having no figures
\AtEndEnvironment{figure}{\gdef\there@is@a@figure{}}
\AtEndDocument{\ifdefined\there@is@a@figure\label{fig:was:used:in:doc}\fi}
\newcommand{\conditionalLoF}{\@ifundefined{r@fig:was:used:in:doc}{}{\listoffigures}}%
%the following is a hack to deal with the possibility of having no tables
\AtEndEnvironment{table}{\gdef\there@is@a@table{}}
\AtEndDocument{\ifdefined\there@is@a@table\label{tab:was:used:in:doc}\fi}
\newcommand{\conditionalLoT}{\@ifundefined{r@tab:was:used:in:doc}{}{\listoftables}}%
%setup up frontmatter, mainmatter, backmatter
%the formatting for these sections will be different
\newcommand{\frontmatter}{
\cleardoublepage
\pagenumbering{roman}
\fancyhead[L,R]{}
\ifbool{@dft}{\fancyhead[C]{\textbf{DRAFT}}}{\fancyfoot[C]{\thepage}}{\fancyfoot[C]{\thepage}}
\fancyfoot[L,R]{}
\renewcommand\headrulewidth{0.0pt}
\maketitle
\tableofcontents
\conditionalLoT
\conditionalLoF
}
\newcommand{\mainmatter}{
\cleardoublepage
\pagenumbering{arabic}
\fancyhead[L]{\@author}
\fancyhead[C]{\chaptername\ \thechapter}
\fancyhead[R]{\thepage}
\ifbool{@dft}{\fancyfoot[C]{\textbf{DRAFT}}}{\fancyfoot[C]{}}
\fancyfoot[L,R]{}
\renewcommand\headrulewidth{0.0pt}}
\newcommand{\biblio}{
\cleardoublepage
\addcontentsline{toc}{chapter}{\bibname}
\fancyhead[C]{\bibname}}
\newcommand{\backmatter}{
\cleardoublepage
\fancyhead[C]{\appendixname\ \thechapter}
}
%redefine the appendix to show up as sections in the TOC with Appendices as the Chapter
\newcommand\appendix@chapter[1]{%
\refstepcounter{chapter}%
\orig@chapter*{{\huge Appendix \@Alph\c@chapter}\\[0.75em] #1}%
\addcontentsline{toc}{section}{\@Alph\c@chapter\ \ #1}%
}
\let\orig@chapter\chapter
\g@addto@macro\appendix{\let\chapter\appendix@chapter}
%have the bibliography show in the TOC and make sure the header says bibliography
\pretocmd{\bibliography}{\biblio}{}{}
%add the appendices to the TOC
\pretocmd{\appendix}{\addcontentsline{toc}{chapter}{Appendices}}{}{}
\apptocmd{\appendix}{\backmatter}{}{}
%setup title page, abstract page, dedication page, and acknowledgement page
\def\titlepage{%
\thispagestyle{empty}
\begin{center}
{\Large \@title}\\
\vfill
\rm \@author\\
\vfill
\ifbool{@proposal}{
\noindent Thesis proposal for}
{\noindent Dissertation submitted to the Faculty of the \\
\@institute \\
in partial fulfillment of the requirements for the degree of \\}
\vfill
\@degree \\
in \\
\@program \\
\vfill
\noindent \@principaladvisor, Chair \\
\ifbool{@1st}{\@firstreader\\}{}
\ifbool{@2nd}{\@secondreader\\}{}
\ifbool{@3rd}{\@thirdreader\\}{}
\ifbool{@4th}{\@fourthreader\\}{}
\ifbool{@5th}{\@fifthreader\\}{}
\vfill
\@submitdate\\
\@location\\
\ifbool{@key}{\vfill
Keywords: \@keywords\\}{}
\vfill
\@vtcopyright \\
\end{center}
\newpage
\addtocounter{page}{1}
}
\def\abspage{
\thispagestyle{empty}
\begin{center}
\noindent {\Large \@title} \\
\vfill
\noindent \@author \\
\vfill
(ABSTRACT)
\end{center}
\vfill
\@abstract
\newpage
}
\def\ackpage{
\chapter*{Acknowledgments}
\@acknowledge
\newpage
}
\def\dedpage{
\vspace*{\fill}
\begingroup
\begin{center}
\emph{\@dedication}
\end{center}
\endgroup
\vspace*{\fill}
\newpage
}
%This is where the main magic happens
\renewcommand\maketitle{
%\ifbool{@sig}{
% \pdfbookmark[1]{Signature Page}{sigpage}
% \sigpage}{}
\setcounter{page}{0}
\pdfbookmark[1]{Titlepage}{titlepage}
\titlepage
\ifbool{@abs}{
\pdfbookmark[1]{Abstract}{abstract}
\abspage}{}
\ifbool{@ded}{
\pdfbookmark[1]{Dedication}{dedication}
\dedpage}{}
\ifbool{@ack}{
\pdfbookmark[1]{Acknowledgements}{acknowledgements}
\ackpage}{}
}