-
Notifications
You must be signed in to change notification settings - Fork 0
/
twentysecondcv.cls
280 lines (231 loc) · 9.07 KB
/
twentysecondcv.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
\ProvidesClass{twentysecondcv}[2018/11/24 CV class]
\LoadClass{article}
\NeedsTeXFormat{LaTeX2e}
% Adapted for use with the Rmarkdown template by
% Rob J Hyndman. 24 November 2018
%----------------------------------------------------------------------------------------
% REQUIRED PACKAGES
%----------------------------------------------------------------------------------------
\RequirePackage[sfdefault]{ClearSans}
\RequirePackage[utf8]{inputenc}
\RequirePackage[T1]{fontenc}
\RequirePackage{tikz}
\RequirePackage{fontawesome}
\RequirePackage{xcolor}
\RequirePackage[absolute,overlay]{textpos}
\RequirePackage{ragged2e}
\RequirePackage{etoolbox}
\RequirePackage{ifmtarg}
\RequirePackage{ifthen}
\RequirePackage{pgffor}
\RequirePackage{marvosym}
\RequirePackage{parskip}
\RequirePackage[left=7.6cm,top=0.1cm,right=1cm,bottom=0.1cm,nohead,nofoot]{geometry}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions\relax
%----------------------------------------------------------------------------------------
% COLOURS
%----------------------------------------------------------------------------------------
\definecolor{white}{RGB}{255,255,255}
\definecolor{gray}{HTML}{4D4D4D}
\definecolor{sidecolor}{HTML}{E7E7E7}
\definecolor{mainblue}{HTML}{0E5484}
\definecolor{maingray}{HTML}{B9B9B9}
%----------------------------------------------------------------------------------------
% MISC CONFIGURATIONS
%----------------------------------------------------------------------------------------
\renewcommand{\bfseries}{\color{gray}} % Make \textbf produce coloured text instead
\def\endfirstpage{\newpage\newgeometry{left=1.5cm,top=1.5cm,right=1.5cm,bottom=1.5cm}}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lfoot{\sf\textcolor[gray]{0.4}{Curriculum Vitae: \@name}}
\rfoot{\sf\textcolor[gray]{0.4}{\thepage}}
\cfoot{}
\def\headrule{}
\def\footrule{{\color[gray]{0.4}\hrule\@height\headrulewidth\@width\headwidth \vskip 3pt}}
\setlength{\parindent}{0pt} % Disable paragraph indentation
%----------------------------------------------------------------------------------------
% SIDEBAR DEFINITIONS
%----------------------------------------------------------------------------------------
\setlength{\TPHorizModule}{1cm} % Left margin
\setlength{\TPVertModule}{1cm} % Top margin
\newlength\imagewidth
\newlength\imagescale
\pgfmathsetlength{\imagewidth}{5cm}
\pgfmathsetlength{\imagescale}{\imagewidth/600}
\newlength{\TotalSectionLength} % Define a new length to hold the remaining line width after the section title is printed
\newlength{\SectionTitleLength} % Define a new length to hold the width of the section title
\newcommand{\profilesection}[1]{%
\setlength\TotalSectionLength{\linewidth}% Set the total line width
\settowidth{\SectionTitleLength}{\huge #1 }% Calculate the width of the section title
\addtolength\TotalSectionLength{-\SectionTitleLength}% Subtract the section title width from the total width
\addtolength\TotalSectionLength{-2.22221pt}% Modifier to remove overfull box warning
\vspace{8pt}% Whitespace before the section title
{\color{black!80} \huge #1 \rule[0.15\baselineskip]{\TotalSectionLength}{1pt}}% Print the title and auto-width rule
}
% Define custom commands for CV info
\newcommand{\cvdate}[1]{\renewcommand{\cvdate}{#1}}
\newcommand{\cvmail}[1]{\renewcommand{\cvmail}{#1}}
\newcommand{\cvtwitter}[1]{\renewcommand{\cvtwitter}{#1}}
\newcommand{\cvlinkedin}[1]{\renewcommand{\cvlinkedin}{#1}}
\newcommand{\cvgithub}[1]{\renewcommand{\cvgithub}{#1}}
\newcommand{\cvnumberphone}[1]{\renewcommand{\cvnumberphone}{#1}}
\newcommand{\cvaddress}[1]{\renewcommand{\cvaddress}{#1}}
\newcommand{\cvsite}[1]{\renewcommand{\cvsite}{#1}}
\newcommand{\aboutme}[1]{\renewcommand{\aboutme}{#1}}
\newcommand{\profilepic}[1]{\renewcommand{\profilepic}{#1}}
\newcommand{\cvname}[1]{\renewcommand{\cvname}{#1}}
\newcommand{\cvjobtitle}[1]{\renewcommand{\cvjobtitle}{#1}}
% Command for printing the contact information icons
\newcommand*\icon[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=1pt, fill=mainblue,mainblue,text=white] (char) {#1};}}
% Command for printing skill progress bars
\newcommand\skills[1]{
\renewcommand{\skills}{
\begin{tikzpicture}
\foreach [count=\i] \x/\y in {#1}{
\draw[fill=maingray,maingray] (0,\i) rectangle (6,\i+0.4);
\draw[fill=white,mainblue](0,\i) rectangle (\y,\i+0.4);
\node [above right] at (0,\i+0.4) {\x};
}
\end{tikzpicture}
}
}
% Command for printing skills text
\newcommand\skillstext[1]{
\renewcommand{\skillstext}{
\begin{flushleft}
\foreach [count=\i] \x/\y in {#1}{
\x$ \star $\y
}
\end{flushleft}
}
}
%----------------------------------------------------------------------------------------
% SIDEBAR LAYOUT
%----------------------------------------------------------------------------------------
\newcommand{\makeprofile}{
\thispagestyle{empty}
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=sidecolor, anchor=north, minimum width=9cm, minimum height=\paperheight+1cm] (box) at (-5cm,0.5cm){};
\end{tikzpicture}
%------------------------------------------------
\begin{textblock}{6}(0.5, 0.2)
%------------------------------------------------
\ifthenelse{\equal{\profilepic}{}}{\vspace*{0.5cm}}{
\begin{center}
\begin{tikzpicture}[x=\imagescale,y=-\imagescale]
\clip (600/2, 567/2) circle (567/2);
\node[anchor=north west, inner sep=0pt, outer sep=0pt] at (0,0) {\includegraphics[width=\imagewidth]{\profilepic}};
\end{tikzpicture}
\end{center}
}
%------------------------------------------------
{\raggedright\huge\textcolor{mainblue}{\textbf{\cvname}}}
%------------------------------------------------
{\Large\color{black!80}\cvjobtitle}
\ifthenelse{\equal{\cvdate}{}}{}{\cvdate}
\vspace*{0.4cm}
%------------------------------------------------
\renewcommand{\arraystretch}{1.6}
\begin{tabular}{p{0.5cm} @{\hskip 0.5cm}p{5cm}}
\ifthenelse{\equal{\cvaddress}{}}{}{\Large\faicon{map-marker} & \cvaddress\\}
\ifthenelse{\equal{\cvnumberphone}{}}{}{\Large\faicon{phone} & \cvnumberphone\\}
\ifthenelse{\equal{\cvsite}{}}{}{\Large\faicon{home} & \cvsite\\}
\ifthenelse{\equal{\cvmail}{}}{}{\Large\faicon{envelope} & \cvmail\\}
\ifthenelse{\equal{\cvtwitter}{}}{}{\Large\faicon{twitter} & \cvtwitter\\}
\ifthenelse{\equal{\cvgithub}{}}{}{\Large\faicon{github} & \cvgithub\\}
\ifthenelse{\equal{\cvlinkedin}{}}{}{\Large\faicon{linkedin} & \cvlinkedin}
\end{tabular}
%------------------------------------------------
\ifthenelse{\equal{\aboutme}{}}{}{
\profilesection{About me}
\begin{flushleft}
\aboutme
\end{flushleft}
}
%------------------------------------------------
% \profilesection{Skills}
% \skills
% \skillstext
% \scriptsize
% (*)[The skill scale is from 0 (Fundamental Awareness) to 6 (Expert).]
%------------------------------------------------
\end{textblock}
%\AddThispageHook{\newpage\restoregeometry}
}
%----------------------------------------------------------------------------------------
% COLOURED SECTION TITLE BOX
%----------------------------------------------------------------------------------------
% Command to create the rounded boxes around the first three letters of section titles
\newcommand*\round[2]{%
\tikz[baseline=(char.base)]\node[anchor=north west, draw,rectangle, rounded corners, inner sep=1.6pt, minimum size=5.5mm, text height=3.6mm, fill=#2,#2,text=white](char){#1};%
}
\newcounter{colorCounter}
\newcommand{\sectioncolor}[1]{%
{%
\round{#1}{
\ifcase\value{colorCounter}%
maingray\or%
mainblue\or%
maingray\or%
mainblue\or%
maingray\or%
mainblue\or%
maingray\or%
mainblue\or%
maingray\or%
mainblue\else%
maingray\fi%
}%
}%
\stepcounter{colorCounter}%
}
\renewcommand{\section}[1]{
{%
\color{gray}%
\Large\sectioncolor{#1}%
}
}
\renewcommand{\subsection}[1]{
\par\vspace{.5\parskip}{%
\large\color{gray} #1%
}
\par\vspace{.25\parskip}%
}
%----------------------------------------------------------------------------------------
% LONG LIST ENVIRONMENT
%----------------------------------------------------------------------------------------
\setlength{\tabcolsep}{0pt}
% New environment for the long list
\newenvironment{twenty}{%
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
\end{tabular*}
}
\newcommand{\twentyitem}[4]{%
#1&\parbox[t]{0.83\textwidth}{%
\textbf{#2}%
\hfill%
{\footnotesize#3}\\%
#4\vspace{\parsep}%
}\\
}
%----------------------------------------------------------------------------------------
% SMALL LIST ENVIRONMENT
%----------------------------------------------------------------------------------------
\setlength{\tabcolsep}{0pt}
% New environment for the small list
\newenvironment{twentyshort}{%
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}ll}
}{%
\end{tabular*}
}
\newcommand{\twentyitemshort}[2]{%
#1&\parbox[t]{0.83\textwidth}{%
\textbf{#2}%
}\\
}
%----------------------------------------------------------------------------------------
% MARGINS AND LINKS
%----------------------------------------------------------------------------------------
\RequirePackage{hyperref}