summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/cv4tw/cv4tw-theme-core.sty
blob: 24011b03451d016c192f7e1dcd3cd8af59ac5ce7 (plain)
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
\RequirePackage[left=1cm,right=1cm,top=1cm,bottom=1.8cm]{geometry}
\RequirePackage{libertine}
\RequirePackage{multicol}
\RequirePackage{pifont}
\RequirePackage{pbox}
\RequirePackage{needspace}
\RequirePackage{amssymb}
\RequirePackage{fontspec}
\RequirePackage{fontawesome}
\RequirePackage{realboxes}
\RequirePackage{array}
\RequirePackage{forloop}

\setcvcontactszone[main]{%
\rendercontactifdefined{custom0}%
\rendercontactifdefined{custom1}%
\rendercontactifdefined{custom2}%
\rendercontactifdefined{email}%
\rendercontactifdefined{homepage}%
\rendercontactifdefined{homepagessl}%
\rendercontactifdefined{customhomepage}%
\rendercontactifdefined{cellphone}%
\rendercontactifdefined{phone}%
\rendercontactifdefined{fax}%
}%

\setcvcontactszone[social]{%
\rendercontactifdefined{custom3}%
\rendercontactifdefined{custom4}%
\rendercontactifdefined{custom5}%
\rendercontactifdefined{github}%
\rendercontactifdefined{linkedin}%
\rendercontactifdefined{twitter}%
\rendercontactifdefined{googleplus}%
\rendercontactifdefined{facebook}%
\rendercontactifdefined{vk}%
\rendercontactifdefined{pinterest}%
}%
\setcvcontactszone[extra]{%
\rendercontactifdefined{custom6}%
\rendercontactifdefined{custom7}%
\rendercontactifdefined{custom8}%
\rendercontactifdefined{custom9}%
\rendercontactifdefined{age}%
\rendercontactifdefined{spokenlanguages}%
\rendercontactifdefined{address}%
}%

\AtBeginDocument{\maketitle}

% Set \emph command with "em" color
\DeclareTextFontCommand{\emph}{\color{main}}

% Default header & footer
\fancypagestyle{cvsimple}{
 \renewcommand{\headrulewidth}{0pt}
 \renewcommand{\footrulewidth}{0pt}
 \fancyhf{}
 \lfoot{\mystyle[footnote]\@cvfirstname~\@cvlastname}
 \cfoot{\mystyle[footnote]\@ifundefined{@cvtitle}{}{\@cvtitle}}
 \rfoot{\mystyle[footnote]\thepage/\pageref{LastPage}}
}
\pagestyle{cvsimple}


%Useful lengths
\newlength{\cvleftwidth}\setlength{\cvleftwidth}{4.5cm}
\newlength{\cvrightwidth}\setlength{\cvrightwidth}{14cm}
\newlength{\cvfielditemparskip}\setlength{\cvfielditemparskip}{0.5em}
\newlength{\cvskillitemparskip}\setlength{\cvskillitemparskip}{-0.8em}
\newlength{\cvmissionsitemsep}\setlength{\cvmissionsitemsep}{0em}
\newlength{\cvfieldsep}\setlength{\cvfieldsep}{0em}
\newlength{\sectionrule}\setlength{\sectionrule}{\textwidth}
\setlength{\parindent}{0cm}

\newcounter{currentrate}
\newcounter{fieldsbyrow}
\newcounter{maxrate}
\newcounter{fieldscurrentcolumn}
% Set \emph command with "em" color
\DeclareTextFontCommand{\emph}{\color{main}}

% Section title
\renewcommand*{\section}[1]{
\needspace{4\baselineskip}
\begin{center}
  {\mystyle[sectiontitle] #1}\\[-0.8em]
  {\color{sectionrule}\rule{\sectionrule}{0.05pt}}
\end{center}
}

% Write a story relevant about you (job, education, journey, ...)
\renewcommand*{\story}[5]{
	\begin{flushleft}
	\begin{minipage}[t]{\cvleftwidth}
		{\mystyle[cvstorydatelocation] #3}
		\if\relax\detokenize{#4}\relax
		\relax
		\else 
			\\[1em]
			{\mystyle[cvstoryquicknotes] #4}
		\fi
	\end{minipage}
	\begin{minipage}[t]{\cvrightwidth}
  		\vspace*{-0.7em}
		{\mystyle[cvstorytitle] #1}{\mystyle[cvstoryshort],~#2}
		\if\relax\detokenize{#5}\relax
		\relax
		\else
			\\[0.8em]
			{\mystyle[cvstorydescription] #5}
		\fi
	\end{minipage}
	\end{flushleft}
}

% Rate fields related to a profile
\renewenvironment*{fields}[3]{
	\setcounter{fieldsbyrow}{#2}
	\addtocounter{fieldsbyrow}{-1}
	\setcounter{maxrate}{#3}
	\addtocounter{maxrate}{-1}
	\setcounter{fieldscurrentcolumn}{0}
	\newcommand{\formatfieldcell}[2]{
	\makeatletter
		\ifnum\value{fieldscurrentcolumn}=\value{fieldsbyrow}
			\setcounter{fieldscurrentcolumn}{0}
			\expandafter\@firstoftwo
		\else
			\stepcounter{fieldscurrentcolumn}
			\expandafter\@secondoftwo
		\fi
		{{\mystyle[field] ##1} & ##2 \\[\cvfielditemparskip] }
		{{\mystyle[field] ##1} & ##2 & }
			
	\makeatother
	}

	\newcommand*{\field}[2]{
		\formatfieldcell{##1}{
			\forloop{currentrate}{0}{\value{currentrate} < #3}{
			\ifnum##2>\value{currentrate}\mystyle[fieldratefull]\else\mystyle[fieldrateempty]\fi
			}
		}
	}
	\begin{minipage}[t]{\textwidth}
	{\hspace*{\cvleftwidth}\mystyle[subsectiontitle] #1}\\[1.5em]
	\begin{tabular}[t]{*{#2}{rl}}
}{
	\end{tabular}\\[2em]
	\end{minipage}
}

% Describe missions related to a job
\renewenvironment*{missions}{
	\begin{list}{\mystyle[missionbullet]}{ \setlength{\itemsep}{\cvmissionsitemsep} \setlength{\leftmargin}{2em}\mystyle[mission] }
}{
	\end{list}
}

% Skills environment (use \skill command to add items)
\renewenvironment*{skills}[1]{ 
	\newcommand*{\skill}[2][]{ ##1\hspace*{2ex} & ##2 \\[\cvskillitemparskip] }
	\begin{minipage}[t]{\textwidth}
	{\hspace*{\cvleftwidth}\mystyle[subsectiontitle] #1}\\[-0.4em]
	\begin{tabular}[t]{@{}>{\mystyle[cvskillname]\hfill}p{\cvleftwidth}@{}>{\mystyle[cvskilldescription]}p{\cvrightwidth}@{}} } 
	{ \end{tabular}\\[2em] \end{minipage} }
\endinput