-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaltacv.cls
More file actions
464 lines (409 loc) · 13.3 KB
/
altacv.cls
File metadata and controls
464 lines (409 loc) · 13.3 KB
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
%%%%%%%%%%%%%%%%%
% This is altacv.cls (v1.1.5, 1 December 2018) written by
% LianTze Lim (liantze@gmail.com).
%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%%
% Contributions:
% - https://github.com/akreuzer Added ragged2e option (5 Nov 2018)
% - https://github.com/stefanogermano Fixed bad boxes and undefined font shape (July 2018)
% - https://github.com/foohyfooh Fixed blank spaces in \cvevent and bad link in README.md (June 2018)
% - https://github.com/klairecodes A lot of custom modifications
%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
%% v1.4: Detect TL2018 to handle accented characters in class information
\@ifl@t@r\fmtversion{2018/04/01}{\UseRawInputEncoding}{}
\ProvidesClass{altacv}[2018/12/01 AltaCV v1.1.5, yet another alternative class for a résumé/curriculum vitae.]
%% v1.1: Optionally load academicons
\newif\if@academicons
\DeclareOption{academicons}{\@academiconstrue}
%% v1.1.3: Choice of round/square photo
\newif\if@normalphoto
\DeclareOption{normalphoto}{\@normalphototrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\newif\if@raggedtwoe
\DeclareOption{ragged2e}{\@raggedtwoetrue}
\ProcessOptions\relax
\LoadClass{extarticle}
\RequirePackage[margin=2cm]{geometry}
\RequirePackage{fontawesome5}
\RequirePackage{ifxetex,ifluatex}
\RequirePackage{scrlfile}
\RequirePackage{hyperref}
\usepackage{darkmode}
%% v1.1.5: added for convenience
\newif\ifxetexorluatex
\ifxetex
\xetexorluatextrue
\else
\ifluatex
\xetexorluatextrue
\else
\xetexorluatexfalse
\fi
\fi
%% v1.1: Optionally load academicons
%% v1.1.5: Handle different versions of academicons
\if@academicons
\ifxetexorluatex
\RequirePackage{fontspec}
%% academicons in TL2018 doesn't require
%% Academicons to be installed in OS fonts
%% so can be loaded directly
\@ifl@t@r\fmtversion{2018/04/01}{%
\RequirePackage{academicons}
}{%
% TL2017
\@ifl@t@r\fmtversion{2017/04/01}{%
\@ifpackagelater{academicons}{2018/03/01}{%
\RequirePackage{academicons}
}{%
\let\ori@newfontfamily\newfontfamily%
\renewcommand{\newfontfamily}[2]{}
\RequirePackage{academicons}
\let\newfontfamily\ori@newfontfamily
\newfontfamily{\AI}{academicons.ttf}
}
}{% TL2016 requires the package to be loaded before
% the version can be checked. Only added because
% Overleaf v1 still runs TL2016; will be removed
% when v1 is completely retired.
\let\ori@newfontfamily\newfontfamily%
\renewcommand{\newfontfamily}[2]{}
\RequirePackage{academicons}
\let\newfontfamily\ori@newfontfamily
\newfontfamily{\AI}{academicons.ttf}
}
}
\else
\ClassError{AltaCV}{academicons unsupported by latex or pdflatex. Please compile with xelatex or lualatex}{Please compile with xelatex or lualatex to use the academicons option}
\fi
\fi
\if@raggedtwoe
\RequirePackage[newcommands]{ragged2e}
\fi
%% Environment variables. Yes I'm serious.
\ExplSyntaxOn
\NewDocumentCommand{\getenv}{om}
{
\sys_get_shell:nnN { kpsewhich ~ --var-value ~ #2 } { } \l_tmpa_tl
\tl_trim_spaces:N \l_tmpa_tl
\IfNoValueTF { #1 }
{
\tl_use:N \l_tmpa_tl
}
{
\tl_set_eq:NN #1 \l_tmpa_tl
}
}
\ExplSyntaxOff
% FIXME attempting to enabled dark mode with an environment variable
%\getenv[\DARK]{DARK}
%%\ifx\DARK\undefined
%%\enabledarkmode
%%\else
%%\fi
%\if\relax\detokenize{\DARK}
%\enabledarkmode
%\else\relax
%\fi
\RequirePackage{xcolor}
%\enabledarkmode
% Sets colors based on if dark mode is enabled or not (via "\enabledarkmode")
\IfDarkModeTF{
\definecolor{accent}{HTML}{b2c7c7}
% \definecolor{bigline}{HTML}{328484}
\definecolor{bigline}{HTML}{b2c7c7}
\definecolor{highlight}{HTML}{4c4c4c}
% \colorlet{accent}{blue!70!black}
\colorlet{heading}{white}
\colorlet{emphasis}{white}
\colorlet{body}{white!80!black}
}{
\definecolor{accent}{HTML}{004747}
\definecolor{bigline}{HTML}{004747}
\definecolor{highlight}{HTML}{4c4c4c}
\colorlet{heading}{black}
\colorlet{emphasis}{black}
\colorlet{body}{black!80!white}
}
\newcommand{\itemmarker}{{\small\textbullet}}
\newcommand{\ratingmarker}{\faCircle}
\RequirePackage{tikz}
\usetikzlibrary{arrows}
\RequirePackage[skins]{tcolorbox}
\RequirePackage{enumitem}
\setlist{leftmargin=*,labelsep=0.5em,nosep,itemsep=0.25\baselineskip,after=\vskip0.25\baselineskip}
\setlist[itemize]{label=\itemmarker}
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\RequirePackage{dashrule}
\RequirePackage{multirow,tabularx}
\RequirePackage{changepage}
% \RequirePackage{marginfix}
\setlength{\parindent}{0pt}
\newcommand{\divider}{\textcolor{body!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip}
\newenvironment{fullwidth}{%
\begin{adjustwidth}{}{\dimexpr-\marginparwidth-\marginparsep\relax}}
{\end{adjustwidth}}
\newcommand{\emailsymbol}{\faAt}
\newcommand{\phonesymbol}{\faPhone}
\newcommand{\homepagesymbol}{\faChain}
\newcommand{\locationsymbol}{\faMapMarker}
\newcommand{\linkedinsymbol}{\faLinkedin}
% \newcommand{\github}{\faGithub}
\newcommand{\twittersymbol}{\faTwitter}
\newcommand{\githubsymbol}{\faGithub}
\newcommand{\orcidsymbol}{\aiOrcid}
\newcommand{\mailsymbol}{\faEnvelope}
\newcommand{\sitesymbol}{\faCoffee}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\name}[1]{\def\@name{#1}}
\newcommand{\tagline}[1]{\def\@tagline{#1}}
\newcommand{\photo}[2]{\def\@photo{#2}\def\@photodiameter{#1}}
\newcommand{\email}[1]{\printinfo{\emailsymbol}{#1}}
\newcommand{\mailaddress}[1]{\printinfo{\mailsymbol}{#1}}
\newcommand{\phone}[1]{\printinfo{\phonesymbol}{#1}}
\newcommand{\homepage}[1]{\printinfo{\homepagesymbol}{#1}}
\newcommand{\twitter}[1]{\printinfo{\twittersymbol}{#1}}
\newcommand{\linkedin}[1]{\printinfo{\linkedinsymbol}{#1}}
\newcommand{\github}[1]{\printinfo{\githubsymbol}{#1}}
\newcommand{\orcid}[1]{\printinfo{\orcidsymbol}{#1}}
\newcommand{\location}[1]{\printinfo{\locationsymbol}{#1}}
\newcommand{\site}[1]{\printinfo{\sitesymbol}{#1}}
\newcommand{\personalinfo}[1]{\def\@personalinfo{#1}}
\newcommand{\makecvheader}{%
\begingroup
%\ifdef{\@photodiameter}{\begin{minipage}{\dimexpr\linewidth-\@photodiameter-2em}}{}%
\raggedright\color{emphasis}%
{\fontsize{36}{36}\bfseries\MakeUppercase{\@name}\par}
\medskip
{\large\bfseries\color{accent}\@tagline\par}
\medskip
{\footnotesize\bfseries\@personalinfo\par}
%\ifdef{\@photodiameter}{%
%\end{minipage}\hfill%
%\begin{minipage}{\@photodiameter}
%\if@normalphoto
%\includegraphics[width=\linewidth]{\@photo}
%\else
%\tikz\path[fill overzoom image={\@photo}]circle[radius=0.5\linewidth];
%\fi%
%\end{minipage}\par}{}%
\endgroup\medskip
}
\renewenvironment{quote}{\color{accent}\itshape\large}{\par}
\newcommand{\cvsection}[2][]{%
\bigskip%
\ifstrequal{#1}{}{}{\marginpar{\vspace*{\dimexpr1pt-\baselineskip}\raggedright\input{#1}}}%
{\color{heading}\LARGE\bfseries\MakeUppercase{#2}}\\[-1ex]%
{\color{bigline}\rule{\linewidth}{2pt}\par}\medskip
}
\newcommand{\cvsubsection}[1]{%
{\color{emphasis}\large\bfseries{#1}\par}\medskip
}
% v1.1.4: fixes inconsistent font size
\newcommand{\cvevent}[4]{%
{\color{emphasis}#1\par}
\smallskip\normalsize
\ifstrequal{#2}{}{}{
\footnotesize\textbf{\color{accent}#2}\par
\smallskip}
\ifstrequal{#3}{}{}{{\small\makebox[0.5\linewidth][l]{\scriptsize\color{accent}\faCalendar\hspace{0.5em}\color{black}#3}}}%
\ifstrequal{#4}{}{}{{\small\makebox[0.5\linewidth][l]{\faMapMarker\hspace{0.5em}#4}}}\par
\medskip\normalsize
}
\newcommand{\adate}[1]{
{\scriptsize| \color{accent}\faCalendar\textbf{ #1}}
}
% 1: School
% 2: Major
% 3: Graduation Date
% 4: Immersion
% 5: Concentration
\newcommand{\cvedu}[5]{
{\color{emphasis}#1}\newline
\footnotesize
\color{accent}\textbf{#2} \hfill\color{accent}\faCalendar{ #3}\par
\color{accent}\scriptsize{#4} \par
\color{accent}\scriptsize{#5} \par
}
\newcommand{\cvachievement}[3]{%
\begin{tabularx}{\linewidth}{@{}p{2em} @{\hspace{1ex}} >{\raggedright\arraybackslash}X@{}}
\multirow{4}{*}{\Large\color{accent}#1} & \bfseries\textcolor{emphasis}{#2} \\
& #3
\end{tabularx}%
%\smallskip
}
% 1: Position
% 2: Company
% 3: Bullet list
% 4: Date
% 5: Skill list
\newcommand{\cvexperience}[5]{%
{\color{emphasis}\textbf{#1}\hfill {\footnotesize\textbf{\color{accent}#2}}
| \color{highlight} \textbf{\scriptsize\color{accent}#4}\par}
\smallskip
{\footnotesize\color{body}#3\par}
\smallskip
{\footnotesize#5}
\medskip
}
% 1: Project Name
% 2: Link(s)
% 3: Bullet list
% 4: Skills
\newcommand{\cvproject}[4]{%
{\color{emphasis}\textbf{#1} \hfill \color{highlight}}
{\footnotesize\textbf{\color{accent}#2}\par}
\smallskip
{\footnotesize\color{body}#3\par}
\smallskip
{\footnotesize#4}
\medskip
}
% 1: Activity Name
% 2: Position(s)
% 3: Bullet list
\newcommand{\cvactivity}[3]{%
\normalsize
{\color{emphasis}\textbf{#1}\hfill\par}
\footnotesize
#2
\smallskip
\begin{itemize}
{\small\color{body}#3\par}
\end{itemize}
\smallskip
}
% TODO: having this separate class is silly, generify \cvactivity
% 1: Activity Name
% 2: Position(s)
\newcommand{\cvactivityshort}[3]{%
\normalsize
{\color{emphasis}\textbf{#1}\hfill\par}
\footnotesize
\begin{itemize}
#3
\end{itemize}
\smallskip
}
\newcommand{\cvcourse}[2]{%
{\color{black}\textbf{#1}\par}
{\smallskip\footnotesize#2\par\medskip}
}
\newcommand{\cvtag}[1]{%
\tikz[baseline]\node[
anchor=base,
draw=body!40,
thick,
rounded corners,
inner xsep=1ex,
inner ysep =0.75ex,
text height=1.5ex,
text depth=.25ex
]
{#1};
}
\newcommand{\cvtagsmall}[1]{%
\tikz[baseline]\node[
anchor=base,
draw=body!40,
rounded corners,
inner xsep=1ex,
inner ysep =0.25ex,
text height=1.0ex,
text depth=.25ex
]
{#1};
}
\newcommand{\cvskill}[2]{%
\textcolor{emphasis}{\textbf{#1}}\hfill
\foreach \x in {1,...,5}{%
\space{\ifnumgreater{\x}{#2}{\color{body!30}}{\color{accent}}\ratingmarker}}\par%
}
% Adapted from @Jake's answer at http://tex.stackexchange.com/a/82729/226
\newcommand{\wheelchart}[4][0]{%
\begingroup\centering
\def\innerradius{#3}%
\def\outerradius{#2}%
% Calculate total
\pgfmathsetmacro{\totalnum}{0}%
\foreach \value/\colour/\name in {#4} {%
\pgfmathparse{\value+\totalnum}%
\global\let\totalnum=\pgfmathresult%
}%
\begin{tikzpicture}
% Calculate the thickness and the middle line of the wheel
\pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
\pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}
\pgfmathsetmacro{\totalrot}{-90 + #1}
% Rotate so we start from the top
\begin{scope}[rotate=\totalrot]
% Loop through each value set. \cumnum keeps track of where we are in the wheel
\pgfmathsetmacro{\cumnum}{0}
\foreach \value/\width/\colour/\name in {#4} {
\pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}
% Calculate the percent value
\pgfmathsetmacro{\percentage}{\value/\totalnum*100}
% Calculate the mid angle of the colour segments to place the labels
\pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}
% This is necessary for the labels to align nicely
\pgfmathparse{
(-\midangle>180?"west":"east")
} \edef\textanchor{\pgfmathresult}
\pgfmathparse{
(-\midangle>180?"flush left":"flush right")
} \edef\textalign{\pgfmathresult}
\pgfmathsetmacro\labelshiftdir{1-2*(-\midangle<180)}
% Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
\filldraw[draw=white,fill=\colour] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
(-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;
% Draw the data labels
\draw [*-,thin,emphasis] node [append after command={(\midangle:\midradius pt) -- (\midangle:\outerradius + 1ex) -- (\tikzlastnode)}] at (\midangle:\outerradius + 1ex) [xshift=\labelshiftdir*0.5cm,inner sep=1ex, outer sep=0pt, text width=\width,anchor=\textanchor,align=\textalign,font=\small,text=body]{\name};
% Set the old cumulated angle to the new value
\global\let\cumnum=\newcumnum
}
\end{scope}
% \draw[gray] (0,0) circle (\outerradius) circle (\innerradius);
\end{tikzpicture}\par
\endgroup
}
\newcommand{\cvref}[3]{%
\smallskip
\textcolor{emphasis}{\textbf{#1}}\par
\begin{description}[font=\color{accent},style=multiline,leftmargin=1.35em]
\item[\normalfont\emailsymbol] #2
\item[\small\normalfont\mailsymbol] #3
\end{description}
% \medskip
}
\newenvironment{cvcolumn}[1]{\begin{minipage}[t]{#1}\raggedright}{\end{minipage}}
%\RequirePackage[backend=biber,style=authoryear,sorting=ydnt]{biblatex}
%% For removing numbering entirely when using a numeric style
% \setlength{\bibhang}{1em}
% \DeclareFieldFormat{labelnumberwidth}{\makebox[\bibhang][l]{\itemmarker}}
% \setlength{\biblabelsep}{0pt}
%\defbibheading{pubtype}{\cvsubsection{#1}}
%\renewcommand{\bibsetup}{\vspace*{-\baselineskip}}
%\AtEveryBibitem{\makebox[\bibhang][l]{\itemmarker}}
%\setlength{\bibitemsep}{0.25\baselineskip}
% v1.1.2: make it easier to add a sidebar aligned with top of next page
\RequirePackage{afterpage}
\newcommand{\addsidebar}[2][]{\marginpar{%
\ifstrequal{#1}{}{}{\vspace*{#1}}%
\input{#2}}%
}
\newcommand{\addnextpagesidebar}[2][]{\afterpage{\addsidebar[#1]{#2}}}
\AtBeginDocument{%
\pagestyle{empty}
\color{body}
\raggedright
}