-
Notifications
You must be signed in to change notification settings - Fork 2
/
allanwang-resume.cls
190 lines (159 loc) · 6.3 KB
/
allanwang-resume.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Changelog
%
% v1.1
% * Added \stats function
% * Added lots of commands for links
% * Added color options
%
% v1.0
% * Initial release
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Intro Options
\ProvidesClass{allanwang-resume}[2021/07/12 CV class]
\NeedsTeXFormat{LaTeX2e}
\DeclareOption{print}{\def\@cv@print{}}
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{article}
}
\ProcessOptions\relax
\LoadClass{article}
% Variable Declarations
% Do the branching between * and normal version
\newcommand{\DeclareAuthorVariable}{%
\@ifstar{\ting@DeclareAuthorVariable{\ting@mandatory@var}}
{\ting@DeclareAuthorVariable{\ting@optional@var}}%
}
% The main command; the internal version of \foo is \ting@foo
% The macro \ting@foo is initialized to give an error or an info
% message when used, so if the user doesn't provide a value for a
% mandatory variable, we'll catch the issue
\newcommand{\ting@DeclareAuthorVariable}[2]{%
\@namedef{ting@#2}{#1{#2}}%
\@namedef{#2}##1{\@namedef{ting@#2}{##1}}%
}
% The error and info messages
\newcommand{\ting@mandatory@var}[1]{%
\ClassError{ting}
{Missing value for mandatory variable
\expandafter\string\csname#1\endcsname}
{You have to provide a value with
\expandafter\string\csname#1\endcsname{...}}%
}
\newcommand{\ting@optional@var}[1]{%
\ClassInfo{ting}
{Missing value for optional variable
\expandafter\string\csname#1\endcsname}%
}
\DeclareAuthorVariable*{firstname}
\DeclareAuthorVariable*{lastname}
\DeclareAuthorVariable*{github}
\DeclareAuthorVariable*{email}
\DeclareAuthorVariable*{website}
\DeclareAuthorVariable*{phone}
\usepackage{array,keycommand}
% Package Imports
\usepackage[hmargin=1.25cm, vmargin=0.75cm]{geometry}
\usepackage[hidelinks]{hyperref}
% Publications
\usepackage{cite}
\renewcommand\refname{\vskip -1.5cm}
% Color definitions
\usepackage[usenames,dvipsnames]{xcolor}
\definecolor{date}{HTML}{666666}
\definecolor{primary}{HTML}{2b2b2b}
\definecolor{headings}{HTML}{6A6A6A}
\definecolor{subheadings}{HTML}{333333}
\definecolor{accent}{HTML}{224d93}
% Set main fonts
\usepackage{fontspec}
\setmainfont[Color=primary, Path = fonts/lato/,BoldItalicFont=Lato-RegIta,BoldFont=Lato-Reg,ItalicFont=Lato-LigIta]{Lato-Lig}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text, Path = fonts/raleway/]{Raleway-ExtraLight}
% Font Awesome
\defaultfontfeatures{
Path = fonts/fa/ }
\usepackage{fontawesome}
\usepackage{hyperref,xparse}
% Date command
\usepackage[absolute]{textpos}
\usepackage[USenglish]{isodate}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}
\newcommand{\lastupdated}{\begin{textblock}{60}(155,5)
\color{date}\fontspec[Path = fonts/raleway/]{Raleway-ExtraLight}\fontsize{8pt}{10pt}\selectfont
Last Updated on \today
\end{textblock}}
% Name command
\newcommand{\namesection}[2]{
\fontsize{40pt}{60pt}
\fontspec[Path = fonts/lato/]{Lato-Hai}\selectfont #1
\fontspec[Path = fonts/lato/]{Lato-Lig}\selectfont #2
}
\newcommand{\headertable}[4]{
\fontspec[Path = fonts/lato/]{Lato-Lig}
\fontsize{12pt}{12pt}
\selectfont
\renewcommand{\arraystretch}{2}
\begin{tabular}{l l}
#1 & #2 \\
#3 & #4
\end{tabular}
}
\newcommand{\githublink}[3]{\lowercase{\href{https://www.github.com/#1/#2}}{#3}}
\NewDocumentCommand{\mygithub}{mo}
{\githublink{\ting@github}{#1}{\IfValueTF{#2}{#2}{#1}}}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcommand{\header}[0]{
\hspace*{-\parindent}%
\begin{minipage}{0.4\textwidth}
\newdimen\headerheight
\headerheight=\textheight
\namesection{\ting@firstname}{\ting@lastname}
\end{minipage}
\begin{minipage}{0.6\textwidth}
\hfill
\headertable{\textcolor{accent}{\faPhone} \, \ting@phone}
{\href{https://www.\ting@website}{\textcolor{accent}{\faChain} \, \ting@website}}
{\href{mailto:\ting@email}{\textcolor{accent}{\faEnvelope} \, \ting@email}}
{\href{https://www.github.com/\ting@github}{\textcolor{accent}{\faGithub} \, github.com/\ting@github}}
\end{minipage} \\
}
% Section seperators
\usepackage{titlesec}
\titlespacing{\section}{0pt}{0pt}{0pt}
\titlespacing{\subsection}{0pt}{0pt}{0pt}
\newcommand{\sectionsep}{\vspace{8pt}}
% Headings command
\titleformat{\section}{\color{headings}
\scshape\fontspec[Path = fonts/lato/]{Lato-Lig}\fontsize{16pt}{24pt}\selectfont \raggedright\uppercase}{}{0em}{}
% Subeadings command
\titleformat{\subsection}{
\color{subheadings}\fontspec[Path = fonts/lato/]{Lato-Bol}\fontsize{12pt}{12pt}\selectfont\bfseries\uppercase}{}{0em}{}
\newcommand{\runsubsection}[1]{
\color{subheadings}\fontspec[Path = fonts/lato/]{Lato-Bol}\fontsize{12pt}{12pt}\selectfont\bfseries\uppercase {#1} \normalfont}
\newcommand{\project}[3]{
\color{subheadings}\fontspec[Path = fonts/lato/]{Lato-Bol}\fontsize{12pt}{12pt}\selectfont\bfseries\uppercase {#1} \normalfont
\color{subheadings}\raggedright\scshape\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{13pt}
\selectfont {| \, \textcolor{accent}{#2} \hfill \textcolor{date}{#3} \\} \normalfont}
\newcommand{\involvement}[2]{
\color{subheadings}\fontspec[Path = fonts/lato/]{Lato-Bol}\fontsize{12pt}{12pt}\selectfont\bfseries\uppercase {#1} \normalfont
\color{subheadings}\raggedright\scshape\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{13pt}
\selectfont { \hfill #2 \\} \normalfont}
% Descriptors command
\newcommand{\descript}[1]{
\color{subheadings}\raggedright\scshape\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{11pt}{13pt}\selectfont {#1 \\} \normalfont}
\newcommand{\content}[1]{
\color{accent}\raggedright\fontspec[Path = fonts/raleway/]{Raleway-Medium}\fontsize{10pt}{12pt}\selectfont #1\\ \normalfont}
% Bullet Lists with fewer gaps command
\newenvironment{tightemize}{
\vspace{-0.7\topsep}\begin{itemize}\itemsep1pt \parskip0pt \parsep0pt}
{\end{itemize}\vspace{-0.7\topsep}}
\newcommand{\tb}[0]{\textbullet{\,}}
\newkeycommand{\stats}[downloads=0,stars=0, forks=0]{
\ifnum\commandkey{downloads} > 0 \textcolor{date}{\faDownload} \, \commandkey{downloads} \quad \fi
\ifnum\commandkey{stars} > 0 \textcolor{date}{\faStar} \, \commandkey{stars} \quad \fi
\ifnum\commandkey{forks} > 0 \textcolor{date}{\faCodeFork} \, \commandkey{forks} \quad \fi
}
\newcommand{\pair}[2]{#1 \, {\addfontfeature{Color=date}| \, #2}}
\newcommand{\playstorelink}[2]{\lowercase{\href{https://play.google.com/store/apps/details?id=#1}}{#2}}