-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsimplecv.cls
199 lines (163 loc) · 5.36 KB
/
simplecv.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
\ProvidesClass{simplecv}[2020/04/25 v1.0.0 Simple CV class]
% Set up the fonts according to options
\def\mainfontsize{11pt}
\def\mainfontface{Times New Roman}
\DeclareOption{calibri}{%
\def\mainfontface{Calibri}
}
\ProcessOptions\relax
% Set font size and paper type
\LoadClass[letterpaper,\mainfontsize]{article}
% Set document margins
\usepackage[left=0.75in,top=0.6in,right=0.75in,bottom=0.6in]{geometry}
% Set font face
\usepackage{fontspec}
\setmainfont[SmallCapsFeatures={Renderer=Basic},
Ligatures={TeX, NoCommon, NoDiscretionary}]{\mainfontface}
% Remove paragraph indentation
\usepackage[parfill]{parskip}
% Required for boldface (\bf and \bfseries) tabular columns
\usepackage{array}
% Required for ifthenelse statements
\usepackage{etoolbox}
% Suppress page numbers
\pagestyle{empty}
% Flexible tables
\usepackage{tabu}
% For custom margins
\usepackage{changepage}
% To customize lists
\usepackage{enumitem}
% Remove left margin from lists, suppress vertical item separation and set top
% separation to a negative value to suppress a single parskip before lists
\setlist{leftmargin=*, noitemsep, topsep=-1\parskip}
% For adjusting spacing based on the platform used
\usepackage{ifthen}
\usepackage{ifplatform}
% For spcaed small caps
\usepackage{microtype}
\DeclareMicrotypeSet*{smallcapsi} {
encoding = {OT1,T1,T2A,LY1,OT4,QX,T5,TS1,EU1,EU2},
shape = {sc*,si,scit}
}
%--------------------------------------------------------------------------------
% Constants -
%--------------------------------------------------------------------------------
\ifthenelse{\equal{\platformname}{\notwindowsname}}{
\def\namespaceskip{0.575em}
\def\afterheaderspace{1.1pt}
\def\beforesectionheaderspace{5pt}
\def\sectionheadermargin{6pt}
\def\beforesectionheaderhrulespace{2.85pt}
\def\sectionheaderhrlueheight{0.518pt}
\def\aftersectionheaderspace{-5.8pt}
\def\aftersinglelinesubsectionheaderspace{-20.25pt}
\def\afterdoublelinesubsectionheaderspace{-11.75pt}
\def\aftermultilinesubsectionheaderspace{-7.75pt}
\def\afteremptysubsectionheaderspace{1.25pt}
\def\subsectionmargin{9pt}
\def\aftersubsectionspace{2.1pt}
}{
\def\namespaceskip{0.4em}
\def\afterheaderspace{3pt}
\def\beforesectionheaderspace{4.75pt}
\def\sectionheadermargin{6pt}
\def\beforesectionheaderhrulespace{3pt}
\def\sectionheaderhrlueheight{0.5pt}
\def\aftersectionheaderspace{-4pt}
\def\aftersinglelinesubsectionheaderspace{-18.5pt}
\def\afterdoublelinesubsectionheaderspace{-10pt}
\def\aftermultilinesubsectionheaderspace{-6pt}
\def\afteremptysubsectionheaderspace{3pt}
\def\subsectionmargin{9pt}
\def\aftersubsectionspace{4pt}
}
%--------------------------------------------------------------------------------
% Header Setup and Printing -
%--------------------------------------------------------------------------------
% Address
\makeatletter
\newcommand\address[1]{\def\@address{#1}}
\address{}
\newcommand\printaddress{
\small{\@address}
}
\makeatother
% Name
\makeatletter
\newcommand\name[1]{\def\@name{#1}}
\name{}
\newcommand\printname{
\typeout {kokoko}
\typeout \spaceskip
\spaceskip \namespaceskip \relax
\textbf{\LARGE\textls[110]{\textsc{\@name}}}
}
\makeatother
% Contacts
\makeatletter
\newcommand\contacts[1]{\def\@contacts{#1}}
\contacts{}
\newcommand\printcontacts{
\small{\@contacts}
}
\makeatother
\makeatletter
\newcommand\makeheader{
\begin{center}
\begin{tabu} to 1\textwidth { X[l,m] X[2,c,m] X[r,m] }
\printaddress & \printname & \printcontacts \\
\end{tabu}
\end{center}
\vspace*{\afterheaderspace}
}
\makeatother
%--------------------------------------------------------------------------------
% Sections and Subsections -
%--------------------------------------------------------------------------------
% Print a section header
\makeatletter
\newenvironment{cvsection}[1]{
\vspace*{\beforesectionheaderspace}
% Set text margins to equal \tabcolsep (6pt by default)
\begin{adjustwidth}{\sectionheadermargin}{\sectionheadermargin}
\textsc{\textbf{#1}}
\end{adjustwidth}
\vspace*{\beforesectionheaderhrulespace}
\hrule height \sectionheaderhrlueheight
\vspace*{\aftersectionheaderspace}
}{}
\makeatother
% Print a subsection
\makeatletter
% Define toggles checking if titles were defined
\newtoggle{lefttitledefined}
\newtoggle{centertitledefined}
\newtoggle{righttitledefined}
\newenvironment{cvsubsection}[4][1]{
\notblank{#2}{\toggletrue{lefttitledefined}}{}
\notblank{#3}{\toggletrue{centertitledefined}}{}
\notblank{#4}{\toggletrue{righttitledefined}}{}
\ifboolexpr{togl {lefttitledefined} or togl {centertitledefined} or togl {righttitledefined}}{
\begin{tabu} to 1\textwidth { X[l,p] X[c,p] X[r,p] }
\textbf{#2} & \textbf{#3} & \textbf{#4} \\
\end{tabu}
% Add space according to the specidied number of lines
\ifnumcomp{#1}{=}{1}{\vspace*{\aftersinglelinesubsectionheaderspace}}{
\ifnumcomp{#1}{=}{2}{\vspace*{\afterdoublelinesubsectionheaderspace}}{
\vspace*{\aftermultilinesubsectionheaderspace}
}
}
}{
\vspace*{\afteremptysubsectionheaderspace}
}
\togglefalse{lefttitledefined}
\togglefalse{centertitledefined}
\togglefalse{righttitledefined}
\begin{adjustwidth}{\subsectionmargin}{\subsectionmargin}
}
{
\end{adjustwidth}
\vspace*{\aftersubsectionspace}
}
\makeatother