cv/twentysecondcv.cls

350 lines
10 KiB
TeX

\ProvidesClass{twentysecondcv}[2017/01/08 CV class]
\LoadClass{article}
\NeedsTeXFormat{LaTeX2e}
%-------------------------------------------------------------------------------
% REQUIRED PACKAGES
%-------------------------------------------------------------------------------
\RequirePackage[sfdefault]{ClearSans}
\RequirePackage[T1]{fontenc}
\RequirePackage{tikz}
\RequirePackage{xcolor}
\RequirePackage[absolute,overlay]{textpos}
\RequirePackage{ragged2e}
\RequirePackage{etoolbox}
\RequirePackage{ifmtarg}
\RequirePackage{ifthen}
\RequirePackage{pgffor}
\RequirePackage{marvosym}
\RequirePackage{parskip}
\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
\pagestyle{empty} % Disable headers and footers
\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}
% Define a new length to hold the remaining line width after the section title is printed
\newlength{\TotalSectionLength}
% Define a new length to hold the width of the section title
\newlength{\SectionTitleLength}
\newcommand{\profilesection}[1]{
% Set the total line width
\setlength\TotalSectionLength{\linewidth}
% Calculate the width of the section title
\settowidth{\SectionTitleLength}{\huge #1 }
% Subtract the section title width from the total width
\addtolength\TotalSectionLength{-\SectionTitleLength}
% Modifier to remove overfull box warning
\addtolength\TotalSectionLength{-2.22221pt}
% Whitespace before the section title
\vspace{8pt}
% Print the title and auto-width rule
{\color{black!80} \huge #1 \rule[0.15\baselineskip]{\TotalSectionLength}{1pt}}
}
\newcommand{\profilesubsection}[1]{
% Print the sub-title
{\color{black!80} \large \textbf{#1}}
}
% Define custom commands for CV info
\newcommand{\cvdate}[1]{\renewcommand{\cvdate}{#1}}
\newcommand{\cvmail}[1]{\renewcommand{\cvmail}{#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 skills
\newcommand\programminglanguages[1]{
\renewcommand{\programminglanguages}{
\begin{itemize}
\foreach [count=\i] \x in {#1}{
\item \x
}
\end{itemize}
}
}
\newcommand\programmingskills[1]{
\renewcommand{\programmingskills}{
\begin{itemize}
\foreach [count=\i] \x in {#1}{
\item \x
}
\end{itemize}
}
}
\newcommand\techskills[1]{
\renewcommand{\techskills}{
\begin{itemize}
\foreach [count=\i] \x in {#1}{
\item \x
}
\end{itemize}
}
}
% Command for printing skills text
\newcommand\softskills[1]{
\renewcommand{\softskills}{
\begin{itemize}
\foreach [count=\i] \x in {#1}{
\item \x
}
\end{itemize}
}
}
% Command for printing skill progress bars
\newcommand\languages[1]{
\renewcommand{\languages}{
\begin{itemize}
\foreach [count=\i] \x/\y in {#1}{
\item \x$ : $\y
}
\end{itemize}
}
}
%-------------------------------------------------------------------------------
% MULTIPLE LANGUAGE SUPPORT
%-------------------------------------------------------------------------------
% Either English or French toggle
\newtoggle{english}
% Use \toggletrue{english} for English language
% Use \togglefalse{english} for French language
\toggletrue{english}
%\togglefalse{english}
% Shorthand to have multi-language text
\newcommand{\enfr}[2]{\iftoggle{english}{#1}{#2}}
% Shorthand for month abbreviations
\newcommand{\jan}{\enfr{Jan}{Jan}}
\newcommand{\feb}{\enfr{Feb}{Fév}}
\newcommand{\mar}{\enfr{Mar}{Mar}}
\newcommand{\apr}{\enfr{Apr}{Avr}}
\newcommand{\may}{\enfr{May}{Mai}}
\newcommand{\jun}{\enfr{Jun}{Juin}}
\newcommand{\jul}{\enfr{Jul}{Juil}}
\newcommand{\aug}{\enfr{Aug}{Août}}
\newcommand{\sep}{\enfr{Sep}{Sep}}
\newcommand{\oct}{\enfr{Oct}{Oct}}
\newcommand{\nov}{\enfr{Nov}{Nov}}
\newcommand{\dec}{\enfr{Dec}{Déc}}
%-------------------------------------------------------------------------------
% SIDEBAR LAYOUT
%-------------------------------------------------------------------------------
\newcommand{\makeprofile}{
\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}{}}{}{
\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}
}
%------------------------------------------------
{\Huge\color{mainblue}\cvname}
%------------------------------------------------
{\Large\color{black!80}\cvjobtitle}
%------------------------------------------------
\renewcommand{\arraystretch}{1.6}
\begin{tabular}{p{0.5cm} @{\hskip 0.5cm}p{5cm}}
\ifthenelse{\equal{\cvdate}{}}{}{\textsc{\Large\icon{\Info}} & \cvdate\\}
\ifthenelse{\equal{\cvaddress}{}}{}{\textsc{\Large\icon{\Letter}} & \cvaddress\\}
\ifthenelse{\equal{\cvnumberphone}{}}{}{\textsc{\Large\icon{\Telefon}} & \cvnumberphone\\}
\ifthenelse{\equal{\cvsite}{}}{}{\textsc{\Large\icon{\Mundus}} & \href{\cvsite}{\cvsite}\\}
\ifthenelse{\equal{\cvmail}{}}{}{\textsc{\large\icon{@}} & \href{mailto:\cvmail}{\cvmail}}
\end{tabular}
%------------------------------------------------
\ifthenelse{\equal{\aboutme}{}}{}{
\profilesection{\enfr{About me}{À propos de moi}}
\begin{flushleft}
\aboutme
\end{flushleft}
}
%------------------------------------------------
\profilesection{\enfr{Languages}{Langues}}
\languages
%------------------------------------------------
\profilesection{\enfr{Skills}{Compétences}}
\profilesubsection{\enfr{Programming Languages}{Langages de Programmation}}
\programminglanguages
\profilesubsection{\enfr{General Programming}{Programmation Générale}}
\programmingskills
\profilesubsection{Technologies}
\techskills
\profilesubsection{\enfr{Soft Skills}{Autres Compétences}}
\softskills
%------------------------------------------------
\end{textblock}
}
%-------------------------------------------------------------------------------
% 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[left=7.6cm,top=0.1cm,right=1cm,bottom=0.2cm,nohead,nofoot]{geometry}
\RequirePackage{hyperref}