-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathyalcv.cls
299 lines (262 loc) · 7.61 KB
/
yalcv.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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{yalcv}[2022/03/11 Yet Another LaTeX CV Class]
\LoadClass{article}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage[english]{babel}
\RequirePackage[default]{gillius2}
\RequirePackage{moresize}
\RequirePackage{xcolor}
\RequirePackage{etoolbox}
\RequirePackage{tikz}
\RequirePackage{tabularx}
\RequirePackage{setspace}
\RequirePackage{fontawesome5}
\RequirePackage[hidelinks]{hyperref}
\RequirePackage{bm}
\RequirePackage{silence}
\WarningFilter{etex}{Extended allocation}
\RequirePackage{worldflags}
\RequirePackage[a4paper,vmargin=5pt,hmargin=5pt]{geometry}
\pagestyle{empty}
%%% Fonts
%\renewcommand*\familydefault{\sfdefault}
%%% Colors
\definecolor{darkboxbgcolor}{HTML}{303E4C}
\definecolor{darkboxfgcolor}{HTML}{FFFFFF}
\definecolor{lightboxbgcolor}{HTML}{BAC7CE}
\definecolor{lightboxfgcolor}{HTML}{FFFFFF}
\definecolor{bgcolor}{HTML}{FFFFFF}
\definecolor{fgcolor}{HTML}{000000}
\definecolor{gray0}{HTML}{B5BBBD}
\definecolor{gray1}{HTML}{869092}
\definecolor{accent}{HTML}{F9A620}
\pagecolor{bgcolor}
\newbool{isleft}
\setbool{isleft}{true}
%%% Lengths
\newlength{\cv@body@width}
\newlength{\cv@sidebar@gap}
\newlength{\cv@sidebar@width}
\newlength{\cv@body@height}
\newlength{\cv@footer@gap}
\newlength{\cv@footer@height}
\newlength{\icon@adjustment}
\deflength{\cv@body@width}{0.75\textwidth}
\deflength{\cv@sidebar@gap}{5pt}
\deflength{\cv@sidebar@width}{\dimexpr\textwidth-\cv@sidebar@gap-\cv@body@width-2\fboxsep\relax}
{
\small%
\global\deflength{\cv@footer@height}{\baselineskip}
}
\deflength{\cv@footer@gap}{0pt}
\deflength{\cv@body@height}{\dimexpr\textheight-4\fboxsep-\cv@footer@gap-\cv@footer@height\relax}
\deflength{\topskip}{0pt}
\deflength{\parindent}{0pt}
%%% New Commands
\newcounter{ii}
%% defines standard space between icon and text
\newcommand*{\cviconskip}{\;}
%% draws a single arrow pointing to the left or the right (#1)
%% using color #2
\newcommand*{\arrow}[2][left]{
\begin{tikzpicture}[scale=0.58]
\ifstrequal{#1}{left}{%
\filldraw[fill=#2,draw=#2] (0,0)--(0.2,0)--(0.3,0.2)--(0.2,0.4)--(0,0.4)--(0.1,0.2)--cycle;%
}{%
\filldraw[fill=#2,draw=#2] (0,0.2)--(0.1,0)--(0.3,0)--(0.2,0.2)--(0.3,0.4)--(0.1,0.4)--cycle;
}%
\end{tikzpicture}
}
%% draws multiple arrows (n = #2) poinitng to direction #1 and color #3
\newcommand*{\narrow}[3][left]{%
\defcounter{ii}{0}%
\whileboolexpr{test {\ifnumless{\value{ii}}{#2}}}{%
\stepcounter{ii}%
\arrow[#1]{#3}%
\ifnumless{\value{ii}}{#2}{%
\hspace{-6pt}}{%
}%
}%
}
%% draws a double arrow with color #2 pointing to direction #1
\newcommand*{\doublearrow}[2][left]{%
\narrow[#1]{2}{#2}%
}
%% draws a triple arrow with color #2 pointing to direction #1
\newcommand*{\triplearrow}[2][left]{%
\narrow[#1]{3}{#2}%
}
%% gets the current width adjusting for the box seperators on left and right
\newcommand*{\currentwidth}{\dimexpr\linewidth-2\fboxsep\relax}
%% creates a box used for the title (#2) optionally appended by a string #1
\newcommand*{\cvheader}[2][CV]{
\colorbox{darkboxbgcolor}{%
\HUGE%
\makebox(\currentwidth,\baselineskip){%
\color{darkboxfgcolor}%
\uppercase{#2}
\ifblank{#1}{}{%
\textbullet\
\uppercase{#1}}
}%
}%
}
%% creates a footer box with 3 elements which are separated by a bullet point
\newcommand*{\cvfooter}[3]{
\par%
\nointerlineskip%
\vspace*{\cv@footer@gap}%
\colorbox{lightboxbgcolor}{%
\small%
\makebox(\currentwidth,\cv@footer@height){%
\color{lightboxfgcolor}%
#1 \textbullet\
#2 \textbullet\
#3%
}%
}%
}
%% creates a section title wiht text #2 in the main body optionally prepended by
%% #1 (typically and icon or arrows)
\newcommand*{\cvbodysection}[2][]{
\par%
\colorbox{darkboxbgcolor}{%
\makebox(\currentwidth,\baselineskip)[l]{%
\color{darkboxfgcolor}%
\ifblank{#1}{}{#1\ }%
\textbf{%
\uppercase{#2}%
}%
}%
}%
\medskip%
}
%% creates a section in the sidebar with title #1
\newcommand*{\cvsidebarsection}[1]{
\centering{
\large{%
\uppercase{#1}%
}%
\par
\rule[.5\baselineskip]{.7\currentwidth}{0.4pt}%
\par%
\vspace{-\medskipamount}
}%
}
%% creates a quote (#1) surrounded by 2 double arrows
\newcommand*{\cvquote}[1]{%
\parbox{\currentwidth}{%
\begin{quote}
\doublearrow{gray0}%
#1%
\doublearrow[right]{gray0}%
\end{quote}%
}%
}
\DeclareListParser*{\for@nl@list}{\\}
%% creates an entry for the CV with:
%% #1: Period, e.g. 2020/01 -- current
%% #2: Jobtitle, e.g. Data Scientist
%% #3: Employer
%% #4: A list of items separated by \\ which are then put into an itemize env
\newcommand{\cventry}[4]{%
\renewcommand{\labelitemi}{\arrow{gray1}}
\begin{tabularx}{\currentwidth}{Xlcl}
\textbf{#2} & \textcolor{accent}{#3} & \textcolor{gray0}{\textbullet} & \textcolor{gray1}{#1}
\end{tabularx}
\textcolor{gray0}{\hrule}
\begin{itemize}
\deflength{\itemsep}{0pt}
\for@nl@list{\item}{#4}
\end{itemize}
}
%% creates a fontawesome #2 icon with the given color #1
\newcommand*{\cvicon}[2][]{%
{%
\ifstrempty{#1}{}{\color{#1}}%
\faIcon{#2}%
}%
}
%% aligns text #3 and a fontawesome icon #2 with the given color #1 vertically
\newcommand*{\cv@text@aligned@icon}[3][]{%
\setbox0\hbox{#3}
\setbox1\hbox{\cvicon[#1]{#2}}
\deflength{\icon@adjustment}{\dimexpr\ht0-\ht1\relax}
\raisebox{\dimexpr\icon@adjustment/2\relax}{\cvicon[#1]{#2}}
}
%% creates an fontawesom icon #2
\newcommand*{\cvicontext}[3][]{%
\cv@text@aligned@icon[#1]{#2}{#3}\cviconskip#3%
}
\newcommand*{\cviconlink}[4][]{%
\cv@text@aligned@icon[#1]{#2}{#3}\cviconskip\href{#4}{#3}
}
\newcommand*{\cviconemail}[4][]{%
\cv@text@aligned@icon[#1]{#2}{#3}\cviconskip\href{mailto:#4}{#3}
}
\newcommand*{\cvlanguage}[3][7pt]{%
\worldflag[width=#1]{#2}\cviconskip#3
}
\newcommand*{\cvrating}[5][10]{%
\begin{onehalfspace}
\cvicontext[#5]{#4}{#3}%
\par%
\defcounter{ii}{0}%
\whileboolexpr{test {\ifnumless{\value{ii}}{#1}}}{%
\ifnumless{\value{ii}}{#2}{%
\cvicon[accent]{star}}{%
\cvicon{star}%
}%
\stepcounter{ii}%
}%
\end{onehalfspace}%
\medskip%
}
%% Environments
\newsavebox{\sidebarbox}
\newenvironment*{cvsidebar}{%
\ignorespaces%
\begin{lrbox}{\sidebarbox}%
\begin{minipage}[t][\cv@body@height][t]{\cv@sidebar@width}%
\vspace{0pt}% need this to ensure minipages align c.f. https://bit.ly/3pioFT7
\bigskip%
\color{darkboxfgcolor}%
}{%
\end{minipage}%
\end{lrbox}%
\colorbox{darkboxbgcolor}{%
\usebox{\sidebarbox}%
}%
\ifbool{isleft}{%
\hspace*{\cv@sidebar@gap}%
\global\setbool{isleft}{false}%
}{%
\global\setbool{isleft}{true}%
}%
\ignorespacesafterend%
}
\newenvironment*{cvbody}{%
\ignorespaces%
\begin{minipage}[t][\cv@body@height][t]{\cv@body@width}%
\vspace{-\fboxsep}%
}{%
\end{minipage}%
\ifbool{isleft}{%
\hspace*{\cv@sidebar@gap}%
\global\setbool{isleft}{false}%
}{%
\global\setbool{isleft}{true}%
}%
\ignorespacesafterend%
}
\newenvironment*{cvsidebarbox}[1][]{%
\ignorespaces%
\ifstrequal{#1}{b}{\vfill}{}%
\begin{spacing}{1.5}
\centering
}{%
\end{spacing}
\vspace{2\baselineskip}
\ignorespacesafterend%
}