-
Notifications
You must be signed in to change notification settings - Fork 1
/
gp.cls
231 lines (208 loc) · 7.97 KB
/
gp.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
% Begin `gp.cls' --- alpha version
%
% A Simple Scientific Research Grant Proposal Document Class
%
% Written by Chi-kwan Chan (Fall 2017)
%
%==============================================================================
% Identification
%------------------------------------------------------------------------------
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{gp}[%
2017/11/18%
Black Hole Initiative, Harvard University%
A Simple Scientific Research Grant Proposal Document Class%
]
%==============================================================================
% Initialize and declare options
%-----------------------------------------------------------------------------
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
%==============================================================================
% Package loading
%------------------------------------------------------------------------------
\LoadClass{article}
\RequirePackage{multicol,multirow,rotating}
\RequirePackage{hyperref}
\RequirePackage{graphicx,eso-pic}
%==============================================================================
% Layout/Format
%------------------------------------------------------------------------------
% Page layout:
% 1 inch = 72 pt
\setlength{\hoffset }{ 0pt}
\setlength{\voffset }{ 0pt}
\setlength{\oddsidemargin }{ 0pt}
\setlength{\evensidemargin}{ 0pt} % most people don't understand LaTeX!
\setlength{\topmargin }{ 4pt}
\setlength{\headheight }{ 12pt}
\setlength{\headsep }{ 20pt} % at least 0.25 inch = 18 pt so we are good
\setlength{\textheight }{612pt} % = 8.5 inches, giving 1 inch bottom margin
\setlength{\textwidth }{468pt} % = 6.5 inches, giving 1 inch right margin
\setlength{\marginparsep }{ 4pt}
\setlength{\marginparwidth}{ 32pt}
\setlength{\footskip }{ 36pt}
%------------------------------------------------------------------------------
% Spacing:
\newcommand\gp@parsep{1.ex}
\newcommand\gp@subsep{.5ex}
\newcommand\gp@tlssep{.5ex}
\newcommand\gp@ilssep{.5ex}
%------------------------------------------------------------------------------
% Page style:
\newcommand\gp@srule{\hspace{-\linewidth}\rule[-1.ex]{\linewidth}{0.4pt}}
\newcommand\gp@frule{\hspace{-\linewidth}\rule[-.8ex]{\linewidth}{1.2pt}%
\hspace{-\linewidth}\rule[-1.ex]{\linewidth}{0.4pt}}
\newcommand{\ps@fancy}{
\let\@mkboth\@gobbletwo
\def\@oddhead {\reset@font\huge\textsc\@title\hfil\textsc\@author\gp@frule}
\def\@evenhead{\reset@font\huge\textsc\@author\hfil\textsc\@title\gp@frule}
}
\renewcommand{\ps@plain}{
\let\@mkboth\@gobbletwo
\def\@oddhead {\reset@font\textsc\rightmark\hfil\textsc\@author\gp@srule}
\def\@evenhead{\reset@font\textsc\@author\hfil\textsc\leftmark \gp@srule}
}
\pagestyle{plain}
%------------------------------------------------------------------------------
% Redefine subsubsection and paragraphs:
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{\gp@parsep}{1.0ex \@plus 1.0ex}{\normalfont\normalsize\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
{\gp@parsep}{-1em}{\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%
{\gp@subsep}{-1em}{\normalfont\normalsize\bfseries}}
%------------------------------------------------------------------------------
% Tabbed list
\newenvironment{tlist}{\list{}
{\parskip\z@\topsep\z@\partopsep\z@
\itemsep\gp@tlssep\itemindent\z@
\parsep\z@\listparindent\z@
\labelsep\z@
\labelwidth1in
\leftmargin1in
\rightmargin\z@
\let\makelabel\tlistlabel}}
{\endlist}
\newcommand*\tlistlabel[1]{\normalfont #1\hfill}
% Wide tabbed list
\newenvironment{Tlist}{\list{}
{\parskip\z@\topsep\z@\partopsep\z@
\itemsep\gp@tlssep\itemindent\z@
\parsep\z@\listparindent\z@
\labelsep\z@
\labelwidth1.25in
\leftmargin1.25in
\rightmargin\z@
\let\makelabel\Tlistlabel}}
{\endlist}
\newcommand*\Tlistlabel[1]{\normalfont #1\hfill}
% Inverse enumerate list
\RequirePackage[parskip=0pt,topsep=0pt,partopsep=0pt,
itemsep=\gp@ilssep,itemindent=0pt,
parsep=0pt,listparindent=0pt,
labelsep=.5em,
labelwidth=2.em,
leftmargin=2.em,
rightmargin=0pt]{etaremune}
\newenvironment{ilist}{\etaremune{}{}}{\endetaremune}
%------------------------------------------------------------------------------
% References
\usepackage[square,comma,super]{natbib}
\bibliographystyle{unsrtapj}
\renewcommand\bibfont{\footnotesize}%{\small}
\setlength\bibsep{\z@}
%\renewcommand\bibpreamble{\begin{multicols}{2}}
%\renewcommand\bibpostamble{\end{multicols}}
\renewcommand\bibsection{\section{%
\refname\@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}}
%==============================================================================
% Main code
%------------------------------------------------------------------------------
% Title page information:
\newcommand\info [1]{\gdef\gp@info {#1}}
\newcommand\phone [1]{\gdef\gp@phone {#1}}
\newcommand\email [1]{\gdef\gp@email {#1}}
\newcommand\website[1]{\gdef\gp@website {#1}}
\newcommand\repos [1]{\gdef\gp@repos {#1}}
\newcommand\address[1]{\gdef\gp@address {#1}}
% Cover letter
\newcommand\background[1]{\gdef\cl@background{#1}}
\newcommand\sender [1]{\gdef\cl@address {#1}}
\newcommand\recipient [1]{\gdef\cl@recipient {#1}}
\newcommand\greetto [1]{\gdef\cl@greetto {#1}}
\newcommand\closing [1]{\gdef\cl@closing {#1}}
\background{}
\sender{}
%------------------------------------------------------------------------------
% E-mail
\newcommand\mailto[1]{\href{mailto:#1}{\texttt{#1}}}
% Redefine \part[]{}
\def\@part[#1]#2{%
\thispagestyle{fancy}
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
\addcontentsline{toc}{part}{\thepart\hspace{1em}#2}%
\else
\addcontentsline{toc}{part}{#2}%
\fi
\title{#1}
\markboth{#2}{#2}
\@afterheading}
% Redefine \part*{}, which takes only one argument
\def\@spart#1{\markboth{#1}{#1}\@afterheading}
%------------------------------------------------------------------------------
% Set Page Title
\newcommand\pagetitle[1]{\markboth{#1}{#1}}
%------------------------------------------------------------------------------
% Make cover letter
\newcommand\makecover[1]{
\thispagestyle{empty}
\vspace*{-36pt} % - \topmargin - \headheight - \headsep
{
\setlength\parindent{0pt}
\setlength\parskip{0.7em}
{\raggedleft\begin{tabular}{l@{}}
\ignorespaces%
\ifx\@empty\cl@address\gp@address\else\cl@address\fi\\*[\parskip]
\@date
\end{tabular}\par}
\cl@recipient\par\vspace{\parskip}
\cl@greetto\par
\input{#1}\strut\par\nobreak\vspace{\parskip}
\noindent\hspace*{.67\textwidth}
\parbox{.33\textwidth}{\strut\raggedright
\cl@closing\\*[2\medskipamount]
\includegraphics[scale=0.125]{signature}\\
\@author}
}
\ifx\@empty\cl@background\else % add background
\AddToShipoutPicture*{\put(0,0){\parbox[b][\paperheight]{\paperwidth}{%
\vfill\centering%
\includegraphics[width=\paperwidth,height=\paperheight,%
keepaspectratio]{\cl@background}%
}}}%
\fi
}
%------------------------------------------------------------------------------
% Make Resume
\let\maketitle\undefined % don't need maketitle
\newcommand\makeinfo{
\thispagestyle{fancy}
{
\parindent\z@
\begin{minipage}{0.50\linewidth}\raggedright
\gp@address\\
\gp@info
\end{minipage}
\begin{minipage}{0.50\linewidth}\raggedleft
Phone:~\gp@phone\\
E-mail:~\mailto{\gp@email}\\
Website:~\url{\gp@website}\\
\url{\gp@repos}
\end{minipage}
}
\vspace*{-3.5pt}
}
%==============================================================================
% End `gp.cls'