-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcv.sty
More file actions
441 lines (394 loc) · 15.1 KB
/
cv.sty
File metadata and controls
441 lines (394 loc) · 15.1 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
% This theme has been heavily inspired on the Awesome-CV
% https://github.com/posquit0/Awesome-CV/tree/master
\ProvidesPackage{cv}[2025/11/26 v1.0 Template to create amazing CVs]
% **************************************************
% Class options
% **************************************************
\RequirePackage{kvoptions}
\SetupKeyvalOptions{family=cv,prefix=cv@}
\DeclareDefaultOption{
\PassOptionsToPackage{\CurrentOption}{utils}
}
\ProcessKeyvalOptions*
\RequirePackage[hyperref, lists]{utils}
\RequirePackage{etoolbox} % For list management
% **************************************************
% Layout
% **************************************************
\RequirePackage{geometry} % To set the page layout
\geometry{left=1.2cm, right=1.2cm, top=0.8cm, bottom=1.15cm, footskip=0cm}
%% Header & Footer
\RequirePackage{fancyhdr}
\fancyhfoffset{0em} % Set offset to each header and footer
\renewcommand{\headrulewidth}{0pt} % Remove head rule
\fancyhf{} % Clear all header & footer fields
\pagestyle{fancy} % Use fancy page style
% **************************************************
% Fonts
% **************************************************
\RequirePackage{fontspec}
\setmainfont{Helvetica}
% **************************************************
% Other Packages
% **************************************************
% Needed to make fixed length table
\RequirePackage{array}
% Needed to handle text alignment
\RequirePackage{ragged2e}
% Needed to use \ifxetex-\else-\fi statement
\RequirePackage{ifxetex}
% Needed to use \if-\then-\else statement
\RequirePackage{xifthen}
% Needed to strip chars from telephone number
\RequirePackage{xstring}
% Needed for the photo ID
\RequirePackage[skins]{tcolorbox}
\RequirePackage[english]{babel}
% Needed for bibliography support
\RequirePackage[
backend=biber,
style=numeric,
sorting=ydnt,
maxbibnames=99,
giveninits=true,
doi=true,
url=true,
isbn=false
]{biblatex}
%-------------------------------------------------------------------------------
% Configuration for colors
%-------------------------------------------------------------------------------
% Text colors
\colorlet{darktext}{black}
\colorlet{text}{black}
\colorlet{graytext}{black}
\colorlet{lighttext}{black}
\colorlet{sectiondivider}{black}
%-------------------------------------------------------------------------------
% Configuration for styles
%-------------------------------------------------------------------------------
% Configure styles for each CV elements
% For fundamental structures
\newcommand*{\headernamestyle}[1]{{\fontsize{24pt}{1em}\selectfont\scshape\color{text}#1}}
\newcommand*{\headerpositionstyle}[1]{{\fontsize{9pt}{1em}\selectfont\scshape\color{accent}#1}}
\newcommand*{\headeraddressstyle}[1]{{\fontsize{9pt}{1em}\selectfont\itshape\color{lighttext}#1}}
\newcommand*{\headersocialstyle}[1]{{\fontsize{9pt}{1em}\selectfont\color{text}#1}}
\newcommand*{\headersummarystyle}[1]{{\fontsize{9pt}{1.2em}\selectfont\color{text}#1}}
\newcommand*{\footerstyle}[1]{{\fontsize{9pt}{1em}\selectfont\scshape\color{lighttext}#1}}
\newcommand*{\sectionstyle}[1]{{\fontsize{12pt}{1em}\selectfont\scshape\color{text}#1}}
% For elements of entry
\newcommand*{\entrytitlestyle}[1]{{\fontsize{11pt}{1em}\selectfont\bfseries #1}}
\newcommand*{\entrycompanystyle}[1]{{\fontsize{9pt}{1em}\selectfont #1}}
\newcommand*{\entrysummarystyle}[1]{{\fontsize{9pt}{1em}\selectfont #1}}
\newcommand*{\entrydatestyle}[1]{{\fontsize{9pt}{1em}\selectfont #1}}
\newcommand*{\entrylocationstyle}[1]{{\fontsize{9pt}{1em}\selectfont #1}}
% For subsections
\newcommand*{\subsectionstyle}[1]{{\fontsize{11pt}{1em}\selectfont\bfseries #1}}
% For elements of honor
\newcommand*{\honortitlestyle}[1]{{\fontsize{11pt}{1em}\bfseries\color{darktext} #1}}
\newcommand*{\honorpositionstyle}[1]{{\fontsize{9pt}{1em}\color{graytext} #1}}
\newcommand*{\honordatestyle}[1]{{\fontsize{9pt}{1em}\color{graytext} #1}}
\newcommand*{\honorlocationstyle}[1]{{\fontsize{9pt}{1em}\slshape\color{accent} #1}}
% For elements of skill
\newcommand*{\skilltypestyle}[1]{{\fontsize{9pt}{1em}\bfseries\color{darktext} #1}}
\newcommand*{\skillsetstyle}[1]{{\fontsize{9pt}{1em}\color{text} #1}}
% For hyperlinks
\newcommand*{\cvhref}[1]{\href{#1}{\entryurlstyle{More info}}}
% For bibliography entries
\newcommand*{\bibliographytitlestyle}[1]{{\fontsize{9pt}{10.8pt}\selectfont #1}}
\newcommand*{\bibliographyauthorstyle}[1]{{\fontsize{9pt}{10.8pt}\selectfont #1}}
\newcommand*{\bibliographyvenuestyle}[1]{{\fontsize{9pt}{10.8pt}\selectfont\itshape #1}}
\newcommand*{\bibliographydatestyle}[1]{{\fontsize{9pt}{10.8pt}\selectfont #1}}
\newcommand*{\bibliographyurlstyle}[1]{{\fontsize{9pt}{10.8pt}\selectfont\underline{#1}}}
%-------------------------------------------------------------------------------
% Commands for personal information
%-------------------------------------------------------------------------------
% Define photo ID
% Usage: \photo[circle|rectangle,edge|noedge,left|right]{<path-to-image>}
\newcommand{\photo}[2][circle,edge,left]{%
\def\@photo{#2}
\@for\tmp:=#1\do{%
\ifthenelse{\equal{\tmp}{circle} \or \equal{\tmp}{rectangle}}%
{\let\@photoshape\tmp}{}%
\ifthenelse{\equal{\tmp}{edge} \or \equal{\tmp}{noedge}}%
{\let\@photoedge\tmp}{}%
\ifthenelse{\equal{\tmp}{left} \or \equal{\tmp}{right}}%
{\let\@photoalign\tmp}{}%
}%
}
\def\@photoshape{circle}
\def\@photoedge{edge}
\def\@photoalign{left}
% Define writer's name
% Usage: \name{<firstname>}{<lastname>}
% Usage: \firstname{<firstname>}
% Usage: \lastname{<lastname>}
% Usage: \familyname{<familyname>}
\newcommand*{\name}[2]{\def\@firstname{#1}\def\@lastname{#2}}
\newcommand*{\firstname}[1]{\def\@firstname{#1}}
\newcommand*{\lastname}[1]{\def\@lastname{#1}}
\newcommand*{\familyname}[1]{\def\@lastname{#1}}
\def\@familyname{\@lastname}
% Define writer's address
% Usage: \address{<address>}
\newcommand*{\address}[1]{\def\@address{#1}}
% Define writer's position
% Usage: \position{item1, item2, item3, ...}
% Example: \position{Cloud Computing, DevOps, System Architecture}
\newcommand*{\position}[1]{%
\def\@position{#1}%
}
% Defines social information as a list
% Usage: \social{item1, item2, item3, ...}
% Example: \social{contact@example.com, github.com/username, linkedin.com/in/username}
\newcommand*{\social}[1]{%
\def\@sociallinks{#1}%
}
% Defines a social item with custom display text and hyperlink
% Usage: \socialitem{<display text>}{<url>}
% Example: \socialitem{Email}{mailto:contact@example.com}
% Example: \socialitem{GitHub}{https://github.com/username}
\newcommand*{\socialitem}[2]{\href{#2}{#1}}
% Defines writer's summary (optional)
% Usage: \summary{<summary>}
\newcommand*{\summary}[1]{\def\@summary{#1}}
%-------------------------------------------------------------------------------
% Commands for extra
%-------------------------------------------------------------------------------
%% Define helper macros a user can change easily
% Header
\newcommand{\headernamedelim}{\space}
\newcommand{\afternameskip}{0.2em}
\newcommand{\afterpositionskip}{0.2em}
\newcommand{\afteraddressskip}{0em}
\newcommand{\socialseparator}{\quad\textbar\quad}
\newcommand{\aftersocialskip}{0.75em}
\newcommand{\aftersummaryskip}{0em}
% Internal list for social links
\def\@sociallinks{}
% Others
\newcommand{\sectiontopskip}{0.35em}
\newcommand{\sectioncontenttopskip}{0.2em}
%-------------------------------------------------------------------------------
% Commands for utilities
%-------------------------------------------------------------------------------
% Use to align an element of tabular table
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
% Use to execute conditional statements by checking empty string
\newcommand*{\ifempty}[3]{\ifthenelse{\isempty{#1}}{#2}{#3}}
%-------------------------------------------------------------------------------
% Commands for elements of CV structure
%-------------------------------------------------------------------------------
% Define a header for CV
% Usage: \makecvheader
\newcommand*{\makecvheader}[1][C]{%
\newcommand*{\drawphoto}{%
\ifthenelse{\isundefined{\@photo}}{}{%
\newlength{\photodim}
\ifthenelse{\equal{\@photoshape}{circle}}%
{\setlength{\photodim}{1.3cm}}%
{\setlength{\photodim}{1.8cm}}%
\ifthenelse{\equal{\@photoedge}{edge}}%
{\def\@photoborder{darkgray}}%
{\def\@photoborder{none}}%
\begin{tikzpicture}%
\node[\@photoshape, draw=\@photoborder, line width=0.3mm, inner sep=\photodim, fill overzoom image=\@photo] () {};
\end{tikzpicture}
}%
}
\newlength{\headertextwidth}
\newlength{\headerphotowidth}
\ifthenelse{\isundefined{\@photo}}{
\setlength{\headertextwidth}{\textwidth}
\setlength{\headerphotowidth}{0cm}
}{%
\setlength{\headertextwidth}{0.76\textwidth}
\setlength{\headerphotowidth}{0.24\textwidth}
}%
\begin{minipage}[c]{\headerphotowidth}%
\ifthenelse{\equal{\@photoalign}{left}}{\raggedright\drawphoto}{}
\end{minipage}
\begin{minipage}[c]{\headertextwidth}
\vspace*{\fill}
\ifthenelse{\equal{#1}{L}}{\raggedright}{\ifthenelse{\equal{#1}{R}}{\raggedleft}{\centering}}
\headernamestyle{\@firstname\headernamedelim\@lastname}%
\\[\afternameskip]%
\ifthenelse{\isundefined{\@position}}{}{%
\headerpositionstyle{%
\def\@sep{}%
\@for\@item:=\@position\do{%
\@sep\@item%
\def\@sep{\socialseparator}%
}%
}\\[\afterpositionskip]%
}%
\ifthenelse{\isundefined{\@address}}{}{\headeraddressstyle{\@address\\[\afteraddressskip]}}%
\ifx\@sociallinks\@empty%
\else%
\headersocialstyle{%
\def\@sep{}%
\@for\@link:=\@sociallinks\do{%
\@sep\@link%
\def\@sep{\socialseparator}%
}%
} \\[\aftersocialskip]%
\fi%
\ifthenelse{\isundefined{\@summary}}{}{\raggedright\headersummarystyle{\@summary}\\[\aftersummaryskip]}%
\vspace*{\fill}
\end{minipage}%
\begin{minipage}[c]{\headerphotowidth}%
\ifthenelse{\equal{\@photoalign}{right}}{\raggedleft\drawphoto}{}
\end{minipage}
}
% Define a footer for CV
% Usage: \makecvfooter{<left>}{<center>}{<right>}
\newcommand*{\makecvfooter}[3]{%
\fancyfoot{}
\fancyfoot[L]{\footerstyle{\today\ifempty{#1}{}{\socialseparator#1}}}
\fancyfoot[C]{\footerstyle{\ifdefined\version\version\fi\ifempty{#2}{}{\socialseparator#2}}}
\fancyfoot[R]{\footerstyle{\thepage\ifempty{#3}{}{\socialseparator#3}}}
}
% Renew the section command to add a divider
\renewcommand{\section}[1]{%
\vspace{\sectiontopskip}
\sectionstyle{#1}
\vspace{-\baselineskip}
\par\noindent\color{sectiondivider}\hrule height 1pt
}
% Renew the subsection command to match entry title styling
\renewcommand{\subsection}[1]{%
\vspace{\sectioncontenttopskip}
\subsectionstyle{#1}
}
% Usage: \cventry{<position>}{<title>}{<info>}{<location>}{<date>}
\newcommand*{\cventry}[5]{%
\vspace{\sectioncontenttopskip}%
{%
\entrytitlestyle{#1}%
\hfill%
\entrydatestyle{#5} \\%
}%
\ifstrempty{#2#3#4}%
{}%
{%
\entrycompanystyle{#2}%
\ifempty{#3}{}{\entrysummarystyle{{\socialseparator}#3}}%
\hfill%
\entrylocationstyle{#4} \\%
}%
\vspace{-\baselineskip}%
}
% Define an environment for cv entry with itemize
% Usage:
% \begin{cvitemizeentry}{<position>}{<date>}{<title>}{<info>}{<location>}
% \item First bullet point
% \item Second bullet point
% \end{cvitemizeentry}
\newenvironment{cvitemizeentry}[5]{%
\vspace{\sectioncontenttopskip}%
\entrytitlestyle{#1}%
\hfill%
\entrydatestyle{#2}
\newline
\ifstrempty{#3#4#5}%
{}%
{%
\entrycompanystyle{#3}%
\ifempty{#4}{}{\entrysummarystyle{{\socialseparator}#4}}%
\hfill%
\entrylocationstyle{#5}
\newline
\vspace{-\baselineskip}%
}
\begin{itemize}%
}{%
\end{itemize}%
}
% Usage: \cvhonor{<position>}{<title>}{<url>}{<date>}
\newcommand*{\cvhonor}[4]{%
\vspace{\sectioncontenttopskip}%
\honortitlestyle{#1}\ifempty{#2}{}{,} \honorpositionstyle{#2}\ifempty{#4}{}{ \honordatestyle{(#4)}} & \ifempty{#3}{}{\cvhref{#3}} \\%
\vspace{-\baselineskip}%
}
% Define an environment for cvskill
\newenvironment{cvskills}{%
\vspace{\sectioncontenttopskip}%
\begin{center}%
\setlength\tabcolsep{1ex}%
\setlength{\extrarowheight}{0pt}%
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r L{\textwidth * \real{0.9}}}%
}{%
\end{tabular*}%
\end{center}%
}
% Define a line of cv information(skill)
% Usage: \cvskill{<type>}{<skillset>}
\newcommand*{\cvskill}[2]{%
\skilltypestyle{#1} & \skillsetstyle{#2} \\
}
% **************************************************
% Lists
% **************************************************
\@ifpackageloaded{enumitem}{
\setlist[itemize]{leftmargin=1em, noitemsep, itemsep=0.2em, label=\textbullet, before=\raggedright}
\setlist[enumerate]{leftmargin=1em, noitemsep, itemsep=0.2em, before=\raggedright}
}{}
% **************************************************
% Bibliography Configuration
% **************************************************
% Customize biblatex formatting to match CV style
\AtBeginDocument{
\@ifpackageloaded{biblatex}{
% Remove "In:" before journal/booktitle
\renewbibmacro{in:}{}
% Enable URL line breaking at various points
\setcounter{biburlnumpenalty}{100}% Allow breaking after numbers
\setcounter{biburlucpenalty}{100}% Allow breaking after uppercase letters
\setcounter{biburllcpenalty}{100}% Allow breaking after lowercase letters
% Format bibliography entries with numeric labels [1], [2], etc.
\defbibenvironment{bibliography}
{\list
{\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}}}
{%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{0.5em}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemindent}{0pt}%
\setlength{\itemsep}{\sectioncontenttopskip}%
\setlength{\parsep}{0pt}%
}%
}
{\endlist}
{\item\raggedright}
% Customize field formats
\DeclareFieldFormat[article,inproceedings,incollection,book,thesis]{title}{\bibliographytitlestyle{#1}}
\DeclareFieldFormat[article]{journaltitle}{\bibliographyvenuestyle{#1}}
\DeclareFieldFormat[inproceedings,incollection]{booktitle}{\bibliographyvenuestyle{#1}}
\DeclareFieldFormat{url}{\bibliographyurlstyle{\url{#1}}}
\DeclareFieldFormat{doi}{\bibliographyurlstyle{DOI: \href{https://doi.org/#1}{#1}}}
% Remove quotes from titles
\DeclareFieldFormat*{title}{#1}
% Customize name format
\renewcommand*{\mkbibnamegiven}[1]{\bibliographyauthorstyle{#1}}
\renewcommand*{\mkbibnamefamily}[1]{\bibliographyauthorstyle{#1}}
\renewcommand*{\mkbibnameprefix}[1]{\bibliographyauthorstyle{#1}}
\renewcommand*{\mkbibnamesuffix}[1]{\bibliographyauthorstyle{#1}}
% Format date
\renewcommand*{\mkbibdatelong}[3]{\bibliographydatestyle{\iffieldundef{#1}{}{\thefield{#1}}}}
}{}
}
% Define command to add bibliography on a new page
% Usage: \makecvbibliography{<section-title>}
% Example: \makecvbibliography{References}
% Note: You must add \addbibresource{yourfile.bib} in the preamble before \begin{document}
\newcommand*{\makecvbibliography}[1]{%
\clearpage
\section{#1}
\vspace{\sectioncontenttopskip}%
\printbibliography[heading=none]
}