-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmuthesis.cls
256 lines (207 loc) · 7.48 KB
/
cmuthesis.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
%% dkoes 5/10/2006
\LoadClassWithOptions{book}
\RequirePackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
%% dkoes - Here's a bunch of stuff taken from mjz-titlepage.sty that makes
% a pretty CMU techreport acceptable title page
%% titlepage parameters
%% required: title, author, date, Year, trnumber, committee
%% optional: permission, support, disclaimer, keywords
\def\title#1{\gdef\@title{#1}}
\def\author#1{\gdef\@author{#1}}
\def\authorChinese#1{\gdef\@authorChinese{#1}}
\def\date#1{\gdef\@date{#1}}
\def\Year#1{\gdef\@Year{#1}}
\def\trnumber#1{\gdef\@trnumber{#1}}
\def\committee#1{\gdef\@committee{#1}}
\def\permission#1{\gdef\@permission{#1}}
\def\support#1{\gdef\@support{#1}}
\def\disclaimer#1{\gdef\@disclaimer{#1}}
\def\keywords#1{\gdef\@keywords{#1}}
\newsavebox{\@copyrightbox}
%\def\@copyrightnotice#1{{\small\sbox{\@copyrightbox}{#1}\ifthenelse{\lengthtest{\wd\@copyrightbox > \linewidth}}{\noindent #1 \par}{\begin{center} #1 \end{center}}}}
\def\@copyrightnotice#1{{\small\sbox{\@copyrightbox}{#1}\ifdim\wd\@copyrightbox>\linewidth \noindent #1 \par\else\begin{center} #1 \end{center}\fi}}
\def\maketitle{
\thispagestyle{empty}
% calculate skip needed to ensure that title appears in the cut-out
\newlength{\@cutoutvskip}
\setlength{\@cutoutvskip}{2.1875 true in} % position of cut-out
\addtolength{\@cutoutvskip}{-1 true in} % printer margin
\addtolength{\@cutoutvskip}{-\topmargin}
\addtolength{\@cutoutvskip}{-\headheight}
\addtolength{\@cutoutvskip}{-\headsep}
%% Centered things on the title page must be *physically* centered
%% on the page, so they line up with the cut-out window. So we hardwire
%% the margins for the title page so that left margin = right margin:
%% left margin = (8.5in - textwidth)/2
\oddsidemargin=8.5in
\advance\oddsidemargin by -\textwidth
\oddsidemargin=.5\oddsidemargin
\advance\oddsidemargin by -1in % TeX sux
% enable footnoterule
% \let\footnoterule\relax
\vglue\@cutoutvskip
\begin{center}
%\begin{minipage}[t]{4.875in} % must be a minipage due to \thanks
\begin{minipage}[t]{4.8in} % hackery
\vbox to 2in{
\vfill
\begin{center}
{\LARGE \strut \@title\par}
\vspace{2em}
{\large\bf \begin{tabular}[t]{c}\@author\end{tabular}\par}
{\large\bf \begin{tabular}[t]{c}\@authorChinese\end{tabular}\par}
\vspace{1em}
{\sc \@trnumber\par}
\smallskip
{\large October 2024\par}
\end{center}
\vfill}
\end{minipage}
\end{center}
\vskip 3em
\begin{center}
Software and Societal Systems Department \\
School of Computer Science \\
Carnegie Mellon University \\
Pittsburgh, PA 15213
\end{center}
\vskip 2em
\vspace{2em}
\begin{center}
{\bf Thesis Committee:} \\
\@committee
\end{center}
\vspace{1em}
\begin{center}
\em
Submitted in partial fulfillment of the requirements \\
for the degree of Doctor of Philosophy in Software Engineering.
\end{center}
\vfill
\@ifundefined{@permission}{\@copyrightnotice{Copyright \copyright\ \@Year\ \@author}}{\@copyrightnotice{Copyright \copyright\ \@Year\ \@author. \@permission}}
\@ifundefined{@support}{}{{\medskip\scriptsize\noindent\@support\par}}
\@ifundefined{@disclaimer}{}{{\medskip\footnotesize\noindent\@disclaimer\par}}
% keywords go at bottom of page ii (the rear of the titlepage)
% if keywords are omitted, this page is blank
\clearpage
\thispagestyle{empty}
\@ifundefined{@keywords}{}{\vspace*{\fill} {\bf Keywords:} \@keywords}
\cleardoublepage
}
\newenvironment{dedication}
{\cleardoublepage \thispagestyle{empty} \vspace*{\stretch{1}} \begin{center} \em}
{\end{center} \vspace*{\stretch{3}} \clearpage}
\newenvironment{psuedochapter}[1]
{
% LaTeX can be amazingly confusing
% https://tex.stackexchange.com/questions/65698/newpage-clearpage-and-cleardoublepage-not-working
\null\cleardoublepage
% \clearpage
\thispagestyle{empty}
\vspace*{\stretch{1}}
\begin{center} \large {\bf #1} \end{center}
% \addcontentsline{toc}{chapter}{\numberline{}#1} --not yet mjz
\begin{quotation}}
{\end{quotation}
\vspace*{\stretch{3}}
\clearpage
}
\newenvironment{abstract}
{\begin{psuedochapter}{Abstract}}{\end{psuedochapter}}
\newenvironment{acknowledgments}
{\begin{psuedochapter}{Acknowledgments}}{\end{psuedochapter}}
%% dkoes - what follows is just a result of my personal style preferences
% most things are shamelessly ripped from various conference class files
% Utilities
% ---------
\newcommand{\centeroncapheight}[1]{%
{\setbox\@tempboxa = \hbox{#1}%
\@measurecapheight{\@tempdima}% % Calculate ht(CAP) - ht(text)
\advance \@tempdima by -\ht\@tempboxa % ------------------
\divide \@tempdima by 2 % 2
\raise \@tempdima \box\@tempboxa}}
\newbox{\@measbox}
\def \@measurecapheight #1{% {\dimen}
\setbox\@measbox = \hbox{ABCDEFGHIJKLMNOPQRSTUVWXYZ}%
#1 = \ht\@measbox}
\long\def \@titlefootnote #1#2{%
\insert\footins{%
\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
%%% \protected@edef\@currentlabel{%
%%% \csname p@footnote\endcsname\@thefnmark}%
\color@begingroup
\def \@makefnmark {$^{#1}$}%
\@makefntext{%
\rule\z@\footnotesep\ignorespaces#2\@finalstrut\strutbox}%
\color@endgroup}}
% Lists
% -----
\setlength{\topsep}{1pt}
\setlength{\itemsep}{1pt}
\setlength{\parsep}{3pt}
\renewcommand{\labelitemi}{{\small \centeroncapheight{\textbullet}}}
\renewcommand{\labelitemii}{\centeroncapheight{\rule{2.5pt}{2.5pt}}}
\renewcommand{\labelitemiii}{$-$}
\renewcommand{\labelitemiv}{{\Large \textperiodcentered}}
\renewcommand{\@listi}{%
\leftmargin = \leftmargini
\listparindent = 0pt}
\let \@listI = \@listi
\renewcommand{\@listii}{%
\leftmargin = \leftmarginii
\topsep = 1pt
\labelwidth = \leftmarginii
\advance \labelwidth by -\labelsep
\listparindent = \parindent}
\renewcommand{\@listiii}{%
\leftmargin = \leftmarginiii
\labelwidth = \leftmarginiii
\advance \labelwidth by -\labelsep
\listparindent = \parindent}
\renewcommand{\@listiv}{%
\leftmargin = \leftmarginiv
\labelwidth = \leftmarginiv
\advance \labelwidth by -\labelsep
\listparindent = \parindent}
% A simple style file to provide a draft marking in the background of
% a file
% Thank you to Will Uther who provided the base code that I rolled
% into this package
% ChangeLog
% 1.1: shrunk and shifted the stamp so that it avoid the unprintable
% area at the top of the page
% 1.2 dkoes - made it big and rotated and light
% 1.3 dkoes - made it small, and unrotated since Jonathan Aldrich complained
% 1.4 comar - moved it below the page number to avoid problem with synctex
\RequirePackage{graphicx}
\RequirePackage{eso-pic}
\RequirePackage{color}
%Got this from Will ([email protected])
%usage: \draftstamp{date}{label}
\newcommand{\draftstamp}[2]{\definecolor{DraftGrey}{gray}{0.7}
\ClearShipoutPicture\AddToShipoutPicture{
\begin{minipage}[b][0.11\paperheight][t]{\paperwidth}
\centering
\vspace{.4in}
\textcolor{DraftGrey}{\renewcommand{\baselinestretch}{1.0}\normalsize
\begin{tabular}{c}
#1 \\
#2
\end{tabular}
}
\end{minipage}
}}
% mainmatter is ignoring openany, fix
\renewcommand\mainmatter{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\@mainmattertrue
\pagenumbering{arabic}}