-
Notifications
You must be signed in to change notification settings - Fork 0
/
MCMthesis.sty
223 lines (204 loc) · 6.87 KB
/
MCMthesis.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% MCM Contest Report Template
%% Template by latexstudio, <latexstudio@hotmail.com>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{MCMthesis}[2013/02/02 v5.0 MCM thesis]
\typeout{MCMthesis for MCM Version 5.0}
% packages
\RequirePackage{xcolor} % color image and color definition
\RequirePackage{fancyhdr,fancybox} % personalize page header
\RequirePackage{graphicx} % include graphics
\RequirePackage{ifthen} % logic options
\RequirePackage{lastpage} % refer to the number of last page
\RequirePackage{listings} % format source code
\RequirePackage[toc,page,title,titletoc,header]{appendix}%附录制作
\RequirePackage{paralist}
%======数学公式===========
\RequirePackage{amsthm,amsfonts}
\RequirePackage{amsmath,bm} % AMSLaTeX
\RequirePackage{amssymb,mathrsfs} % AMSLaTeX sym-bols
\RequirePackage{latexsym}
\RequirePackage{longtable,multirow,hhline,tabularx,array} %@@表格相关
\RequirePackage{flafter}
\RequirePackage{pifont,calc}
\RequirePackage{colortbl,booktabs}
\RequirePackage[a4paper,left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}%0.75in
\RequirePackage[T1]{fontenc}
\RequirePackage[scaled]{berasans}
\definecolor{grey}{rgb}{0.91,0.91,0.91}
% Declare Options
\newcommand{\MCM@control}{2012}
\newif\if@sheet \@sheettrue
\newif\if@abstract \@abstracttrue
\DeclareOption{nosheet}{\@sheetfalse}
\DeclareOption{noabstract}{\@abstractfalse}
\DeclareOption*
{
\edef\MCM@control{\CurrentOption}
}
% Process Options
\ProcessOptions
\newcommand{\control}{\MCM@control}
\newcommand{\team}{Team \#\ \MCM@control}
% if we are running pdflatex?
\RequirePackage{ifpdf}
% style: hyperlinked references
\ifpdf
\RequirePackage{epstopdf}
\DeclareGraphicsExtensions{.pdf,.jpg,.jpeg,.png}
\RequirePackage[bookmarks=true,%
linkcolor=black,%
citecolor=black,%
pagecolor=black,%
colorlinks=true, %注释掉此项则交叉引用为彩色边框(将colorlinks和pdfborder同时注释掉)
pdfborder=001, %注释掉此项则交叉引用为彩色边框
linkcolor=black,%
citecolor=black,%
pagecolor=black,%
urlcolor=black]{hyperref}
\else
\DeclareGraphicsExtensions{.eps,.ps}
\RequirePackage[dvipdfm, %pdflatex,pdftex 这里决定运行文件的方式不同
pdfstartview=FitH,%
CJKbookmarks=true,%
bookmarksnumbered=true,%
bookmarksopen=true,%
colorlinks=true, %注释掉此项则交叉引用为彩色边框(将colorlinks和pdfborder同时注释掉)
pdfborder=001, %注释掉此项则交叉引用为彩色边框
linkcolor=black,%
citecolor=black,%
pagecolor=black,%
urlcolor=black]{hyperref}
\fi
% 使整篇文章的首段都有缩进
\let\@afterindentfalse\@afterindenttrue\@afterindenttrue
%define the table of contents
\renewcommand\tableofcontents{%
\centerline{\normalfont\Large\bfseries\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\vskip 5ex%
\@starttoc{toc}%
}
% style: float counter
\setcounter{totalnumber}{6}
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{3}
%很多人发现缺省的浮动参数过于严格了。下面的命令
\renewcommand{\textfraction}{0.15}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{0.65}
\renewcommand{\floatpagefraction}{0.60}
%将浮动参数重新设置为更宽松的值。---选自《Using Import graphics in LATEX2e》
\def\@maketitle{%
\if@sheet%
\makesheet%
\fi
\null
}
\def\keywordsname{\bf }
\def\@abstract{}%
\newbox\@abstract%
\setbox\@abstract\hbox{}%
\long\def\abstract{\bgroup\global\setbox\@abstract\vbox\bgroup\hsize\textwidth\leftskip1cm\rightskip1cm}%
%\if@sheet\fontfamily{fvs}\fontseries{m}\selectfont\fi}
\def\endabstract{\egroup\egroup}
\newbox\@keywords
\setbox\@keywords\hbox{}
\def\keywords{\bgroup\global\setbox\@keywords\vbox\bgroup\noindent\leftskip0cm}
\def\endkeywords{\egroup\egroup}%
\def\make@abstract{%
\par%
\centerline{\bf\abstractname}\vskip5pt\par%
\noindent\usebox\@abstract\par%
\noindent\hskip1cm\keywordsname\ \usebox\@keywords%
\vskip10pt%
}
% style: table & figure caption font size and face
\renewcommand{\figurename}{Figure}
\renewcommand{\tablename}{Table}
% style: table vertical merged cells
\newcommand{\thline}{\hline\par\hline\par\hline}
% style: figure include path
\graphicspath{{./}{./img/}{./fig/}{./image/}{./figure/}{./picture/}}
%define the the bibliography like MCM collenction
\newtheorem{Theorem}{Theorem}[section]%
\newtheorem{Lemma}[Theorem]{Lemma}%
\newtheorem{Corollary}[Theorem]{Corollary}%
\newtheorem{Proposition}[Theorem]{Proposition}%
\newtheorem{Definition}[Theorem]{Definition}%
\newtheorem{Example}[Theorem]{Example}%
% style: list typesetting
\definecolor{grey}{rgb}{0.8,0.8,0.8}
\definecolor{darkgreen}{rgb}{0,0.3,0}
\definecolor{darkblue}{rgb}{0,0,0.3}
\def\lstbasicfont{\fontfamily{pcr}\selectfont\footnotesize}
\lstset{%
% indexing
% numbers=left,
% numberstyle=\small,%
% character display
showstringspaces=false,
showspaces=false,%
tabsize=4,%
% style
frame=lines,%
basicstyle={\footnotesize\lstbasicfont},%
keywordstyle=\color{darkblue}\bfseries,%
identifierstyle=,%
commentstyle=\color{darkgreen},%\itshape,%
stringstyle=\color{black}%
}
\lstloadlanguages{C,C++,Java,Matlab,Mathematica}
% style: COMAP required header
\setcounter{page}{1}
\pagestyle{fancy}
\lhead{\small \team}
\chead{}
\rhead{\small Page \thepage\ of \pageref{LastPage}}
\lfoot{}
\cfoot{}
\rfoot{}
\newcommand{\@problem}[1]{}
\newcommand{\problem}[1]{\gdef\@problem{#1}}
\def\makesheet{%
\null%
\vskip 3em%
\begingroup\fontfamily{fvs}\fontseries{m}\selectfont%
\thispagestyle{empty}%
\noindent\begin{tabularx}{0.3\textwidth}{lX}%
\multicolumn{2}{l}{For office use only}\\
T1&\rule{3cm}{0.5pt}\\
T2&\rule{3cm}{0.5pt}\\
T3&\rule{3cm}{0.5pt}\\
T4&\rule{3cm}{0.5pt}\\
\end{tabularx}\hspace{\fill}
\begin{minipage}{0.33\textwidth}
\centering
Team Control Number\\[10pt]
{\fontsize{38pt}{25pt}\selectfont \textbf{\MCM@control} }\normalsize\\[10pt]
Problem Chosen\\[10pt]
{\fontsize{20pt}{\baselineskip}\selectfont \textbf{\@problem}}\normalsize\\
\end{minipage}\hspace{\fill}
\begin{tabularx}{0.28\textwidth}{lX}%
\multicolumn{2}{l}{For office use only}\\
F1&\rule{3cm}{0.5pt}\\
F2&\rule{3cm}{0.5pt}\\
F3&\rule{3cm}{0.5pt}\\
F4&\rule{3cm}{0.5pt}\\
\end{tabularx}
%\vspace*{-1em}
\noindent\rule{\textwidth}{0.5pt}%
\begin{center}
\textbf{\the\year}\\
\textbf{MCM/ICM}\\
\textbf{Summary Sheet}\\
(Your team's summary should be included as the first page of your electronic submission.)
\end{center}
\par%
\vskip 1.5em%
\centerline{\large\bf\abstractname}
\noindent\usebox\@abstract%
\endgroup}
\endinput