-
Notifications
You must be signed in to change notification settings - Fork 28
/
friggeri-letter.cls
142 lines (113 loc) · 3.42 KB
/
friggeri-letter.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{friggeri-letter}[2015/10/31 Cover letter for friggeri resume]
\DeclareOption{print}{\def\@cv@print{}}
\DeclareOption*{%
\PassOptionsToClass{\CurrentOption}{letter}%
}
\ProcessOptions\relax
\LoadClass{letter}
\newcommand*{\header}[3]{
\def\firstname{#1}
\def\lastname{#2}
\def\subtitle{#3}
}
%%%%%%%%%%
% Colors %
%%%%%%%%%%
\RequirePackage{xcolor}
\definecolor{white}{RGB}{255,255,255}
\definecolor{darkgray}{HTML}{333333}
\definecolor{gray}{HTML}{4D4D4D}
\definecolor{lightgray}{HTML}{999999}
\definecolor{green}{HTML}{C2E15F}
\definecolor{orange}{HTML}{FDA333}
\definecolor{purple}{HTML}{D3A4F9}
\definecolor{red}{HTML}{FB4485}
\definecolor{blue}{HTML}{6CE0F1}
\ifdefined\@cv@print
\colorlet{green}{gray}
\colorlet{orange}{gray}
\colorlet{purple}{gray}
\colorlet{brown}{gray}
\colorlet{red}{gray}
\colorlet{blue}{gray}
\colorlet{fillheader}{white}
\colorlet{fromcolor}{blue}
\colorlet{header}{gray}
\else
\colorlet{fillheader}{gray}
\colorlet{fromcolor}{red}
\colorlet{header}{white}
\fi
\colorlet{textcolor}{gray}
\colorlet{headercolor}{gray}
%%%%%%%%%
% Fonts %
%%%%%%%%%
\RequirePackage[quiet]{fontspec}
% https://tex.stackexchange.com/questions/353136/compilation-error-option-unknown-unicode-math
%\RequirePackage[math-style=TeX,vargreek-shape=unicode]{unicode-math} % https://tex.stackexchange.com/questions/353136/compilation-error-option-unknown-unicode-math
\RequirePackage[]{unicode-math}
\newfontfamily\bodyfont[]{Roboto-Regular}
\newfontfamily\thinfont[]{Roboto-Thin}
\newfontfamily\headingfont[]{Roboto-Medium}
\newfontfamily\positionfont[]{Roboto-LightItalic}
\defaultfontfeatures{Mapping=tex-text}
\setmainfont[Mapping=tex-text, Color=textcolor]{Roboto-Light}
%\setmathfont{XITS Math}
%%%%%%%%%%
% Header %
%%%%%%%%%%
\RequirePackage{tikz}
\newcommand{\rolefont}{%
\fontsize{14pt}{24pt}\selectfont%
\positionfont%
\color{white}%
}
%The letter template changes where current page.north is
%let's reset it
\setlength\headheight{0\p@}
\renewcommand*{\opening}[1]{
\begin{tikzpicture}[remember picture,overlay]
\node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=4cm] (box) at (current page.north){};
\node [anchor=center] (name) at (box) {%
\fontsize{40pt}{72pt}\color{header}%
{\thinfont \firstname}{\bodyfont \lastname}
};
\node [anchor=north] at (name.south) {%
\fontsize{14pt}{24pt}\color{header}%
\thinfont \subtitle%
};
\end{tikzpicture}
%\vspace{2.5cm}
\vspace{-2\parskip}
%\def\rectshift{0cm}
%\vspace{-\rectshift}
%\begin{tikzpicture}[remember picture,overlay]
% \node [rectangle, fill=fillheader, anchor=north, minimum width=\paperwidth, minimum height=4cm] (box) at (current page.north) {};
%\ifx\@empty\fromaddress
% \thispagestyle{firstpage}%
% {\raggedleft\@date\par}%
% \else % home address
% %\thispagestyle{empty}%
% \node [anchor=east,text=fromcolor,align=left] at (box.east) [text=red] {%
% \fromaddress%
% };
% \fi
% \end{tikzpicture}
% \vspace{\rectshift}
% \vspace{-2\parskip}
% \vspace{2\parskip}%
\ifx\@empty\fromaddress
\thispagestyle{firstpage}%
{\raggedleft\@date\par}%
\else % home address
\thispagestyle{empty}%
{\raggedleft\begin{tabular}{l@{}}\ignorespaces
\fromaddress \\*[2\parskip]%
\@date \end{tabular}\par}%
\fi
{\raggedright \toname \\ \toaddress \par}%
\vspace{2\parskip}%\\
#1\par\nobreak}
%\pagestyle{empty}