-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwenycv.cls
248 lines (218 loc) · 5.4 KB
/
wenycv.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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{wenycv}[2022/08/21 A CV template based on the Curriculum Vitae of Alex Chi Zhang]
\LoadClass[10pt]{article} % based on article class
%
\RequirePackage[
a4paper,
left=0.8in,
right=0.8in,
top=0.5in,
bottom=0.5in,
nohead
]{geometry}
\RequirePackage{fancyhdr}
% For font setting
\RequirePackage[T1]{fontenc}
\RequirePackage{fontspec}
\RequirePackage{titlesec}
% For color
\RequirePackage{xcolor}
% For smarter command definition
\RequirePackage{xifthen}
\RequirePackage{xparse}
% For hyperlink customization
\RequirePackage[hidelinks]{hyperref}
\RequirePackage{fontawesome5} % icons
% For list environment customizations
\RequirePackage{enumitem}
%% ----------------- END OF PACKAGES ----------------- %%
% Footer
%%% Only add "updated" footer to last page
\pagestyle{fancy}
\fancypagestyle{default}{
\fancyhf{}
\RenewDocumentCommand{\headrulewidth}{}{0pt}
}
\fancypagestyle{lastpage}{
\fancyhf{}
\RenewDocumentCommand{\headrulewidth}{}{0pt}
\rfoot{\color{gray}Updated on \today}
}
% Spacings
\setlength{\footskip}{4pt}
\setlength{\parindent}{0pt}
\setlist[itemize]{
leftmargin=36pt,
itemsep=-\parsep,
topsep=-\partopsep-\parskip,
}
% Font size macros
\newcommand{\HUGE}{\@setfontsize\HUGE{24pt}{18}}
\renewcommand\Huge{\@setfontsize\Huge{22pt}{18}}
\renewcommand\huge{\@setfontsize\huge{20pt}{18}}
\renewcommand\LARGE{\@setfontsize\LARGE{18pt}{18}}
\renewcommand\Large{\@setfontsize\Large{12pt}{18}}
\renewcommand\large{\@setfontsize\large{11pt}{18}}
% mainfont: XCharter
\IfFontExistsTF{XCharter}{
\setmainfont{XCharter}
}{
\setmainfont{XCharter}[ % in case XCharter is not installed
Path = ./fonts/,
Extension = .otf,
BoldFont = XCharter-Bold,
ItalicFont = XCharter-Italic,
BoldItalicFont = XCharter-BoldItalic,
BoldSlantedFont = XCharter-BoldSlanted,
SlantedFont = XCharter-Slanted,
RomanFont = XCharter-Roman,
]
}
% heading font: Avenir Next
\IfFontExistsTF{Avenir Next LT Pro}{
\newfontfamily{\headingfont}{Avenir Next LT Pro}
}{
\IfFontExistsTF{Avenir Next}{
\newfontfamily{\headingfont}{Avenir Next}
}{
% use local font in ./fonts folder
\newfontfamily{\headingfont}{AvenirNextLTPro}[
Path = ./fonts/,
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
]
}
}
% format for section title
\titleformat{\section}
{\headingfont\Large} % shape
{} % format
{0em} % label
{\vspace{-2ex}{\color{gray}\hrule}} % before-code
[] % after-code
\titlespacing{\section}
{0pt} % left spacing
{0pt} % before spacing
{0pt} % after spacing
% format for subseciton title
\titleformat{\subsection}
{\large} % shape
{} % format
{0em} % label
{} % beforcode
[] % aftercode
\titlespacing{\subsection}
{12pt} % left spacing
{\parskip} % before spacing
{\parskip} % after spacing
\NewDocumentCommand{\cventry}{ m m o o }
{
\subsection[#1]{\textbf{#1} \hfill #2}
\IfNoValueTF{#3}
{}
{{\parindent=12pt\par #3 \hfill #4 \par}}
}
\NewDocumentCommand{\name}{ m }
{{\headingfont\Huge#1}}
\NewDocumentEnvironment{compactlist}{}
{
\begin{itemize}[
label={},
leftmargin=12pt,
itemsep=-\parsep,
topsep=0pt-\partopsep-\parskip,
]
}
{
\end{itemize}
}
\newcounter{infonum}
\NewDocumentCommand{\infomark}{}{}
\NewDocumentEnvironment{basicinfo}{ o }
{%
\par\vspace{1ex}
\setcounter{infonum}{0}
\IfValueTF{#1}{
\RenewDocumentCommand{\infomark}{}{#1}
}
{
}
}
{%
}
\NewDocumentCommand{\info}{ m }{
\stepcounter{infonum}
\ifthenelse{\theinfonum = 1}{
#1
}{
$\mid$ #1
}
}
% defines one's email
% usage: \email{<email>}
\NewDocumentCommand{\email}{ m }{
\faEnvelope\ \underline{\href{mailto:#1}{#1}}\hspace{-14pt}
}
% defines one's phone
% usage: \phone{<phone>}
\NewDocumentCommand{\phone}{ m }{
\faPhone\ {#1}\hspace{-14pt}
}
% defines one's linkedin
% usage: \linkedin{<linkedin>}
\NewDocumentCommand{\linkedin}{ m o }{
\faLinkedinIn\IfNoValueTF{#2}{
\underline{\href{#1}{#1}}
}{
\underline{\href{#2}{#1}}
}
\hspace{-20pt}
}
\NewDocumentCommand{\linkedinsquare}{ m o }{
\faLinkedin\IfNoValueTF{#1}{
\underline{\href{#1}{#1}}
}{
\underline{\href{#2}{#1}}
}
\hspace{-20pt}
}
% defines one's GitHub
% usage: \github{<github>}
\NewDocumentCommand{\github}{ m o }{
\faGithub\IfNoValueTF{#2}{
\underline{\href{#1}{#1}}
}{
\underline{\href{#2}{#1}}
}
\hspace{-20pt}
}
% defines one's homepage
% usage: \homepage{<homepage>}
\NewDocumentCommand{\homepage}{ m o }{
\faGlobe\IfNoValueTF{#2}{
\underline{\href{#1}{#1}}
}{
\underline{\href{#2}{#1}}
}
\hspace{-20pt}
}
% Customize icon link
% usage: \iconlink[<icon:fontawesome>][<text>]{<url>}
\NewDocumentCommand{\iconlink}{ o o m }{
\IfNoValueTF{#1}{
\let\icon\faLink
}{
\let\icon#1
}
\IfNoValueTF{#2}{
\hspace{-12pt}\underline{\href{#3}{\icon}}
}{
\hspace{-12pt}\underline{\href{#3}{\icon\ #2}}
}
\hspace{-8pt}
}
% Set up pagestyle
\pagestyle{default}
\AtEndDocument{\thispagestyle{lastpage}}