-
Notifications
You must be signed in to change notification settings - Fork 1
/
ntu_thesis.sty
209 lines (174 loc) · 5.21 KB
/
ntu_thesis.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
%% To use 'times roman' font:
% For XeLaTeX
%\usepackage[no-math]{fontspec}
%\setmainfont{Times New Roman}
% For pdfLaTeX:
\usepackage{times}
%% Below command is only for pdfLaTeX:
% https://tex.stackexchange.com/questions/23235/eliminate-edit-pdf-properties-added-by-pdflatex
% \pdfsuppressptexinfo=-1 %Suppress PTEX.Fullbanner and info of imported PDFs
\usepackage{lipsum} % just for dummy text.
%To avoid font size substitution:
%\usepackage{lmodern}
%\usepackage{latexsym} % The LaTeX symbol fonts for use with LaTeX2e.
% For figures
\usepackage[dvips]{graphicx}
\usepackage[caption=false]{subfig}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage[bookmarksnumbered=true,
pdfstartview=Fit,
colorlinks=false,
pdfpagelayout=SinglePage,
hidelinks]{hyperref}
\usepackage[open,openlevel=1]{bookmark}
%For theothms
\usepackage{amsthm} % use this before fonts: conflit with 'newtxmath'
%For maths and math fonts
%\usepackage{amsmath} % must be loaded before newtxmath
\usepackage{newtxtext} % it will cover font citing before
\usepackage{newtxmath} % it requires 'amsmath', SO no need to reload.
\interdisplaylinepenalty=2500
%reduce hypenation
\hyphenpenalty=2000
%\tolerance=1000
%For tables
\usepackage{makecell}
\usepackage{multirow}
\usepackage{booktabs}
\renewcommand{\arraystretch}{1}
%For algorithm
\usepackage{algorithmic}
%spacings
\newcommand{\spacing}{1.5}
\renewcommand{\baselinestretch}{\spacing}
\setlength{\parskip}{6pt}
%define new style for sections
\usepackage{titlesec}
%% toc
\usepackage[subfigure]{tocloft}
\usepackage{calc}
\setlength{\cftbeforetoctitleskip}{0pt}
\setlength{\cftaftertoctitleskip}{20pt}
\setlength{\cftbeforeloftitleskip}{0pt}
\setlength{\cftafterloftitleskip}{20pt}
\setlength{\cftbeforelottitleskip}{0pt}
\setlength{\cftafterlottitleskip}{20pt}
\setlength{\cftbeforechapskip}{5pt}
\setlength{\cftbeforefigskip}{0pt}
\setlength{\cftbeforetabskip}{0pt}
\renewcommand{\cfttoctitlefont}{\normalfont\Large\bfseries}
\renewcommand{\cftloftitlefont}{\normalfont\Large\bfseries}
\renewcommand{\cftlottitlefont}{\normalfont\Large\bfseries}
\setlength{\cftfigindent}{0pt}
\setlength{\cfttabindent}{0pt}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
%https://tex.stackexchange.com/questions/123519/aligning-long-table-captions-in-the-list-of-tables-using-tocloft
\renewcommand{\cftchappresnum}{Chapter~}
\renewcommand\cftfigpresnum{Figure~}
\renewcommand\cftfigaftersnum{~}
\renewcommand\cfttabpresnum{Table~}
\renewcommand\cfttabaftersnum{~}
\AtBeginDocument{%
\addtolength\cftchapnumwidth{\widthof{\cftchappresnum}}
\addtolength\cftfignumwidth{\widthof{\cftfigpresnum\cftfigaftersnum}}
\addtolength\cfttabnumwidth{\widthof{\cfttabpresnum\cfttabaftersnum}}
}
%define the title
\newcommand{\makeThesisTitle}[5]{%
\thispagestyle{empty}
\begin{center}
\textbf{\MakeUppercase{\Large #1}} \\
\vspace{\fill}
\MakeUppercase{\Large{#2}} \\
\vspace{\fill}
\Large{#3}
~\\
\large{#4}
~\\
\Large{\textbf{#5}}
\end{center}
}
\oddsidemargin = 1cm
\evensidemargin = 1cm
\textwidth = 13.6cm
%\textheight = 19.76cm
\headheight = 15pt
\headsep = 20pt
\topmargin = 0cm
\footskip = 1.90cm
%% For floats
%\floatsep = 0.21in
\textfloatsep = \floatsep
\intextsep = \floatsep
%For citations
\usepackage{cite}
%For bibliography
\bibliographystyle{IEEEtran}
\setcounter{secnumdepth}{6}
\setcounter{tocdepth}{3}
%spacing problem
\titleformat{\chapter}[display]
{\bfseries\Large}
{\chaptertitlename~\thechapter}
{1.2em}{}[]
\titleformat{\section}[hang]
{\bfseries\large}
{\thesection}
{1.5em}{}[]
\titlespacing{\chapter}{0pt}{0pt-\headsep}{30pt}
%% Define the heading and footing styles
\fancypagestyle{plaincnt}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[LO,RE]{\leftmark}
\fancyhead[LE,RO]{ %
\ifnum\value{chapter}>0
{\chaptername~\thechapter}
\else
{}
\fi
}
\fancyfoot[C]{\thepage} % except the center
\renewcommand{\headrulewidth}{0.4pt}
}
\fancypagestyle{tablestyle}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[LE,RO]{\nouppercase\leftmark}
\fancyhead[LO,RE]{}
\fancyfoot[C]{\thepage} % except the center
\renewcommand{\headrulewidth}{0.4pt}
}
% For theorems and corollaries.
\newtheorem{cor}{Corollary}
\newtheorem{thm}{Theorem}
% For bibliography
\newlength{\bibitemsep}\setlength{\bibitemsep}{.2\baselineskip plus .05\baselineskip minus .05\baselineskip}
\newlength{\bibparskip}\setlength{\bibparskip}{0pt}
\let\ps@plain=\ps@fancy
\let\oldthebibliography\thebibliography
\renewcommand\thebibliography[1]{%
\linespread{1.25}\selectfont
\oldthebibliography{#1}%
\setlength{\parskip}{\bibitemsep}%
\setlength{\itemsep}{\bibparskip}%
}
\setlength{\bibitemsep}{.2\baselineskip plus .05\baselineskip minus .05\baselineskip}
% force to add to double page
\newcommand*\forcedoublepage{%
\ifodd\value{page}
\newpage\null\thispagestyle{empty}\newpage
\else
{}
\fi
}
%% pasted from IEEEtrans.cls
% Modify Latex2e \@citex to separate citations with "], ["
\renewcommand{\citepunct}{], [}
\renewcommand{\citedash}{]--[}
%https://tex.stackexchange.com/questions/1681/how-to-remove-headers-and-footers-for-pages-between-chapters
\renewcommand*{\cleardoublepage}{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}%
\thispagestyle{empty}%
\newpage%
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
%% End