-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMcECEThesis.sty
279 lines (245 loc) · 8.13 KB
/
McECEThesis.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
% Style file for LaTeX2e
% - for use with documentclass report
% \usepackage [fancyhdr]{McECEThesis}
% $Id: McECEThesis.sty,v 1.1 2005/06/09 12:48:17 kabal Exp $
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{McECEThesis}[2005/02/15]
\newif\if@fancyhdr
\DeclareOption{fancyhdr}{\@fancyhdrtrue}
\DeclareOption{plainhdr}{\@fancyhdrfalse}
\ExecuteOptions{plainhdr}
\ProcessOptions
%================== page layout
\newdimen \insidemargin
\newdimen \outsidemargin
\newdimen \abovemargin
\newdimen \belowmargin
%===== page layout defined by 4 dimensions, others are calculated from these
% Define the side margins for a right-side page
\insidemargin = 1.3in % Actual space
\outsidemargin = 0.8in
% Above margin is space above the header
% Below margin is space below footer
\abovemargin = 1.1in % Actual space
\belowmargin = 0.75in
%=====
% Leave more space for the header (originally 12pt)
\headheight = 15pt
% Other parameters retain their default values (values for 12pt documents)
% \headsep - space from bottom of header to top of text (25pt)
% \footskip - distance from the bottom of text to bottom of footer (30pt)
% The rest of the dimensions are calculated from the above values
% (compensation for TeX 1in margin offsets is done here)
\textwidth = \paperwidth
\advance\textwidth by -\insidemargin
\advance\textwidth by -\outsidemargin
\textheight = \paperheight
\advance \textheight by -\abovemargin
\advance \textheight by -\headheight
\advance \textheight by -\headsep
\advance \textheight by -\belowmargin
\advance \textheight by -\footskip
\topmargin = \abovemargin
\advance \topmargin by -1in
\oddsidemargin = \insidemargin
\advance\oddsidemargin by -1in
\if@twoside
\evensidemargin = \outsidemargin
\advance\evensidemargin by -1in
\else
\evensidemargin = \oddsidemargin
\fi
%========= Redefine \cleardoublepage to use pagestyle plain
% Notes:
% \include xxx
% expands to \clearpage \input xxx.tex \clearpage
% \chapter
% expands to \clearpage OR \cleardoublepage
% \thispagestyle{plain}
% ...
% \cleardoublepage is modified to output an empty page with pagestyle plain
% for headings and footers.
\renewcommand{\cleardoublepage}{%
\clearpage
\if@twoside
\ifodd\c@page
\else
\hbox{}\thispagestyle{plain}\newpage
\if@twocolumn \hbox{}\newpage \fi
\fi
\fi}
%========= Redefine \thebibliography to put a entry in the TOC
%========= Change the name from "Bibliography" to "References"
\renewcommand\bibname{References}
\let\SV@thebibliography\thebibliography
\renewcommand{\thebibliography}[1]{%
\if@twoside
\cleardoublepage
\else
\clearpage
\fi
\addcontentsline{toc}{chapter}{\bibname}
\SV@thebibliography{#1}}
%========= Dummy definitions if datestamp package is not loaded
\ifx\datestampbox\@undefined
\def\datestampbox{}
\def\rcs #1{}
\def\resetdatestamp{}
\fi
%========= Fancy headings setup
% Single-sided printing
% header: 3.2 Section 5
% --------------------
% Double-sided printing
% header: 4 Chapter
% even --------------------
%
% header: 3.2 Section 5
% odd --------------------
%
\if@fancyhdr
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\if@twoside
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
\fancyhf{} % clear all fields
\fancyhead[LE,RO]{\bfseries \thepage}
\fancyhead[LO]{\bfseries \nouppercase{\rightmark}}
\fancyhead[RE]{\bfseries \nouppercase{\leftmark}}
\fancyfoot[LO,RE]{\datestampbox}
\else
\renewcommand{\chaptermark}[1]{\markright{\thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\fancyhf{} % clear all fields
\fancyhead[RE,RO]{\bfseries \thepage}
\fancyhead[LE,LO]{\bfseries \nouppercase{\rightmark}}
\fancyfoot[LO,RE]{\datestampbox}
\fi
\renewcommand{\footrulewidth}{0pt}
\renewcommand{\headrulewidth}{0.4pt}
\def\headrule{{\headrulehook
\hrule height\headrulewidth width\headwidth
\vskip-\headrulewidth}}
\def\headrulehook{}
% Notes:
% - \nouppercase is to knock out the hardwired uppercase in
% contents and bibliography
% - \headrulehook can used for colour, e.g. \def\headrulehook{color{red}}
% Redefine plain style (used by \chapter) to just a page number at the top
\fancypagestyle{plain}{%
\fancyhf{} % clear all fields
\fancyhead[LE,RO]{\bfseries \thepage}%
\fancyfoot[LO,RE]{\datestampbox}}
\fi
%================== title page
% Date set as "August 1996"
\def\Month{\ifcase\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}
\date{\Month\ \number\year}
% Organization
\newcommand\organization[1]{\def\@organization{#1}}
\def\@organization{\@latex@warning@no@line{No \noexpand\organization given}}
% Note
\newcommand\note[1]{\def\@note{#1}}
\def\@note{\@latex@warning@no@line{No \noexpand\note given}}
% Redefine the \maketitle macro (separate page) with new layout
% This is a simplified version of the LaTeX \maketitle macro, since we
% need only worry about a single author and a single institution.
\renewcommand\maketitle{\begin{titlepage}%
\let\footnotesize\small
\let\footnoterule\relax
\let \footnote \thanks
% Reset the page style to empty
\pagestyle{empty}
% -- vertical space --
% Title with \LARGE \bfseries
% Author with \Large \itshape
% Organization with \large
% Date with \large
% -- vertical space --
% Note
\begin{center}%
\null\vfil \vskip 60\p@ % vertical centering (extra 60pt at top)
{\LARGE \bfseries \@title \par}%
\vskip 10ex%
{\Large \itshape \@author}%
\vskip 3ex%
{\large
\lineskip 0.5em%
\begin{tabular}[t]{c}%
\@organization
\end{tabular}\par}%
\vskip 3ex%
{\large \@date \par}%
\vskip 5em%
\vfil\null % vertical centering
\@note
\end{center}\par
\@thanks
\end{titlepage}%
% Reset macros
\setcounter{footnote}{0}%
\global\let\thanks\relax
\global\let\maketitle\relax
\global\let\@thanks\@empty
\global\let\@author\@empty
\global\let\@date\@empty
\global\let\@title\@empty
\global\let\title\relax
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
}
%================== general changes
% Smaller section and subsection heads, ragged right
% [classes.dtx]
\def\veryraggedright{\advance\rightskip by 0pt plus 1fil\relax}
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\large\bfseries\veryraggedright}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{-3.25ex\@plus -1ex \@minus -.2ex}%
{1.5ex \@plus .2ex}%
{\normalfont\bfseries\veryraggedright}}
% Placement of figures and tables htbp instead of tbp
% Figure name, Table name in bold
% [classes.dtx]
\renewcommand\fps@figure{htbp}
\renewcommand\fps@table{htbp}
\renewcommand\fnum@figure{{\reset@font\bfseries\figurename~\thefigure}}
\renewcommand\fnum@table{{\reset@font\bfseries\tablename~\thetable}}
% Less space between the number and the section title (1em -> 0.5em)
% [ltsect.dtx]
\renewcommand\@seccntformat[1]{\csname the#1\endcsname\hskip 0.5em}
% Float captions
% - Prove a \Tcaption for "top" captions
% - Remove ":" separating the number from the caption
% - Typeset the caption in \small
% - Set the caption in a narrower (80%) parbox
% [classes.dtx]
% Note: use "\hbox to" rather than "\hb@xt@" for older latex2e's
\def\captiontextfraction{0.8}
\def\captionfontsize{\small}
\newdimen\aboveTcaptionskip \aboveTcaptionskip=\belowcaptionskip
\newdimen\belowTcaptionskip \belowTcaptionskip=0.5\abovecaptionskip
\def\Tcaption{%
\abovecaptionskip=\aboveTcaptionskip
\belowcaptionskip=\belowTcaptionskip
\caption}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{\captionfontsize #1\quad #2}%
\ifdim \wd\@tempboxa >\captiontextfraction\hsize
\hbox to \hsize{\hfil%
\parbox{\captiontextfraction\hsize}{\captionfontsize #1\quad #2}%
\hfil}%
\else
\global \@minipagefalse
\hbox to \hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
% Figure name becomes "Fig." (was "Figure")
\renewcommand\figurename{Fig.}