You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

416 lines
14 KiB

% scale
\newcommand\cvscale{1}
% font
\newcommand\cvfont{ppl}
\newcommand\cvheadertitlefontscale{2.25}
\newcommand\cvheadersubtitlefontscale{1.5}
\newcommand\cvsectionfontscale{1.75}
\newcommand\cvnamefontscale{1.25}
\newcommand\cvdescriptionfontscale{1}
% margin
\newcommand\cvheadermargin{5}
\newcommand\cvtopmargin{10}
\newcommand\cvbottommargin{10}
\newcommand\cvleftmargin{20}
\newcommand\cvrightmargin{10}
% header
\newcommand\cvavatarradius{25}
\newcommand\cvavatarborderwidth{1}
\newcommand\cvheaderoffset{5}
% timelline
\newcommand\cvtimelineoffset{12}
\newcommand\cvtimelinewidth{0.5}
% miain
\newcommand\cvmainspace{3}
\newcommand\cvmainbubbleradius{6}
\newcommand\cvmainbubbleborderwidth{1}
% event
\newcommand\cveventdatewidth{20}
\newcommand\cveventbubbleradius{2.75}
\newcommand\cveventbubbleborderwidth{1}
% sidebar
\newcommand\cvsidebarspace{3}
\newcommand\cvsidebarbubbleradius{6}
\newcommand\cvsidebarbubbleborderwidth{1}
\newcommand\cvsidebaroffset{2}
\newcommand\cvseparatorscale{1}
% column
\newcommand\cvcolumnratio{0.4}
\newcommand\cvspacebetweencolumns{12}
% color
\usepackage{xcolor}
\definecolor{cvcolor}{RGB}{20, 20, 20}
\definecolor{cviconcolor}{RGB}{255, 255, 255}
\definecolor{cvbordercolor}{RGB}{255, 255, 255}
\definecolor{cvavatarbordercolor}{RGB}{255, 255, 255}
\definecolor{cvtimelinecolor}{RGB}{0, 0, 0}
\definecolor{cvlightcolor}{RGB}{245, 245, 245}
% rescale
\usepackage{fp}
\FPeval{\cvavatarradius}{\cvscale*\cvavatarradius}
\FPeval{\cvavatarborderwidth}{\cvscale*\cvavatarborderwidth}
\FPeval{\cvmainspace}{\cvscale*\cvmainspace}
\FPeval{\cvmainbubbleradius}{\cvscale*\cvmainbubbleradius}
\FPeval{\cvmainbubbleborderwidth}{\cvscale*\cvmainbubbleborderwidth}
\FPeval{\cveventdatewidth}{\cvscale*\cveventdatewidth}
\FPeval{\cveventbubbleradius}{\cvscale*\cveventbubbleradius}
\FPeval{\cveventbubbleborderwidth}{\cvscale*\cveventbubbleborderwidth}
\FPeval{\cvsidebarspace}{\cvscale*\cvsidebarspace}
\FPeval{\cvsidebarbubbleradius}{\cvscale*\cvsidebarbubbleradius}
\FPeval{\cvsidebarbubbleborderwidth}{\cvscale*\cvsidebarbubbleborderwidth}
\FPeval{\cvseparatorscale}{\cvscale*\cvseparatorscale}
%settings]
\newcommand\packagename{bubblecv}
\usepackage[a4paper]{geometry}
\geometry{top=\cvtopmargin mm, bottom=\cvbottommargin mm, left=\cvleftmargin mm, right=\cvrightmargin mm}
\setlength{\topskip}{0mm}
\setlength{\parindent}{0mm}
\pagenumbering{gobble}
\usepackage{enumitem}
\setlist[itemize]{noitemsep, nolistsep, leftmargin=*}
\usepackage[utf8]{inputenc}
\usepackage{xparse}
\usepackage{ifthen}
\usepackage{tabularx}
\usepackage{hyperref}
\usepackage{paracol}
\setlength{\columnsep}{\cvspacebetweencolumns mm}
\newcommand\iscvsidebar{0}
\usepackage{relsize}
\usepackage{fontawesome}
\DeclareFontFamily{U}{fontawesomeOne}{}
\DeclareFontShape{U}{fontawesomeOne}{m}{n}{<-> FontAwesome--fontawesomeone}{}
\DeclareRobustCommand\FAone{\fontencoding{U}\fontfamily{fontawesomeOne}\selectfont}
%----------------------------------------------------------------------------------------
% TIMELINE
%----------------------------------------------------------------------------------------
\usepackage{silence}
\WarningsOff[everypage] % disable warning about problems with background package
\usepackage{background}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{cvtimelinecolor}
\SetBgContents{\rule{\cvtimelinewidth mm}{\textheight}}
\SetBgHshift{\dimexpr(\cvtimelineoffset mm - 105 mm)}
\newcommand{\timelinespace}{\the\numexpr\cvleftmargin - \cvtimelineoffset\relax}
\setlength{\skip\footins}{0.25\baselineskip}
% Convert RGB to decode array.
% Parameter 1: RGB color.
% Parameter 2: Variable to which the array will be assigned.
\newcommand{\rgbtoarray}[2]{%
\extractcolorspecs{#1}\ParseResultModel\ParseResultColor%
\convertcolorspec\ParseResultModel\ParseResultColor{rgb}\ParseRgb%
\let#2\@empty%
\@for\ParseValue:=\ParseRgb\do{%
\edef#2{%
#2%
\ifx#2\@empty%
\else%
\space%
\fi%
\ParseValue\space 1%
}%
}%
}%
% Draw a circle with the image inside.
% Parameter 1 (optional): Path to image resource.
% Parameter 2 (optional): Image scale.
% Parameter 3 (optional): Image color in RGB.
% Parameter 4: Circle radius in millimeters.
% Parameter 5: Circle border width in millimeters.
% Parameter 6: Circle background color in RGB.
% Parameter 7: Circle border color in RGB.
\NewDocumentCommand{\drawcircle}{O{} O{1} O{} m m m m}{%
\ifthenelse{\equal{#3}{}}{}{%
\rgbtoarray{#3}\customdecodearray%
}{}%
\begin{tikzpicture}%
\draw[%
draw=#7, fill=#6, line width=#5mm,%
path picture={%
\ifthenelse{\equal{#1}{}}{}{%
\node at (path picture bounding box.center){%
\ifthenelse{\equal{#3}{}}{%
\includegraphics[%
width=#2\dimexpr#4mm\relax,%
height=#2\dimexpr#4mm\relax]{#1}%
}{%
\includegraphics[%
width=#2\dimexpr#4mm\relax,%
height=#2\dimexpr#4mm\relax,%
decodearray={\customdecodearray}]{#1}%
}%
};%
}%
}%
] (0,0) circle (\dimexpr#4mm-#5mm/2\relax);%
\end{tikzpicture}%
}%
% Main CV function that prepares the entire layout.
% Parameter 1 (optional): Path to avatar resource.
% Parameter 2 (optional): Avatar scale.
% Parameter 3 (optional): Avatar color in RGB.
% Parameter 4: Name.
% Parameter 5: Description.
\NewDocumentEnvironment{cv}{O{} O{2} O{} m m m}{%
\relscale{\cvscale}%
\fontfamily{\cvfont}%
\vspace*{\cvheadermargin mm}%
\vspace*{-\cvtopmargin mm}%
\hspace{-\timelinespace mm}%
\hspace{-\cvavatarradius mm}%
\begin{minipage}{\dimexpr(\cvavatarradius mm + \cvavatarradius mm)}%
\protect\ifthenelse{\equal{#1}{}}%
{\drawcircle{\cvavatarradius}
{\cvavatarborderwidth}
{cvcolor}
{cvavatarbordercolor}}%
{\drawcircle[resources/#1][#2][#3]{\cvavatarradius}
{\cvavatarborderwidth}
{cvcolor}
{cvavatarbordercolor}}%
\end{minipage}%
\hspace{\cvheaderoffset mm}%
\begin{minipage}{\dimexpr(\linewidth + \timelinespace mm - \cvavatarradius mm - \cvheaderoffset mm)}%
\textscale{\cvheadertitlefontscale}{#4}%
\cvseparator[3]%
\textscale{\cvheadersubtitlefontscale}{#5}%
\cvseparator[1]%
#6% Affichage du texte du 6ème paramètre
\end{minipage}%
\columnratio{\cvcolumnratio}%
\begin{paracol}{2}%
}{%
\end{paracol}%
}%
% Groups events, items and skills inside one block.
% Parameter 1 (optional): Path to icon resource.
% Parameter 2 (optional): Icon scale.
% Parameter 3 (optional): Icon color in RGB.
% Parameter 4: Section title.
\NewDocumentCommand{\cvsection}{O{} O{1} O{cviconcolor} m}{%
\ifthenelse{\equal{\iscvsidebar}{1}}{%
\vspace{\cvsidebarspace mm}%
\hspace{-\cvsidebarbubbleradius mm}%
\begin{minipage}{\dimexpr(\cvsidebarbubbleradius mm + \cvsidebarbubbleradius mm)}%
\protect\ifthenelse{\equal{#1}{}}%
{\drawcircle{\cvsidebarbubbleradius}
{\cvsidebarbubbleborderwidth}
{cvcolor}
{cvbordercolor}}%
{\drawcircle[resources/#1][#2][#3]{\cvsidebarbubbleradius}
{\cvsidebarbubbleborderwidth}
{cvcolor}
{cvbordercolor}}%
\end{minipage}%
\hspace{\cvsidebaroffset mm}%
\begin{minipage}{\dimexpr(\linewidth - \cvsidebarbubbleradius mm - \cvsidebaroffset mm)}%
\textscale{\cvsectionfontscale}{\textbf{#4}}%
\end{minipage}%
\cvseparator%
}{%
\vspace{\cvmainspace mm}%
\hspace{-\timelinespace mm}%
\hspace{-\cvmainbubbleradius mm}%
\begin{minipage}{\dimexpr(\cvmainbubbleradius mm + \cvmainbubbleradius mm)}%
\ifthenelse{\equal{#1}{}}%
{\protect\drawcircle{\cvmainbubbleradius}
{\cvmainbubbleborderwidth}
{cvcolor}
{cvbordercolor}}%
{\protect\drawcircle[resources/#1][#2][#3]{\cvmainbubbleradius}
{\cvmainbubbleborderwidth}
{cvcolor}
{cvbordercolor}}%
\end{minipage}%
\hspace{\dimexpr(\timelinespace mm - \cvmainbubbleradius mm)}%
\begin{minipage}{\linewidth}%
\textscale{\cvsectionfontscale}{\textbf{#4}}%
\end{minipage}%
\cvseparator%
}%
}%
% Contains information about the event.
% Parameter 1 (optional): Start date of the event.
% Parameter 2 (optional): End date of the event.
% Parameter 3: Content.
\NewDocumentEnvironment{cvevent}{O{} O{} +b}{%
\ifthenelse{\equal{\iscvsidebar}{1}}{%
\hspace{-\cveventbubbleradius mm}%
\hspace{-\timelinespace mm}%
\begin{minipage}[t]{\cveventdatewidth mm}%
\begin{flushright}%
\textbf{#1}\par%
\ifthenelse{\equal{#2}{}}{}{%
\textbf{\,#2}%
}%
\end{flushright}%
\end{minipage}%
\begin{minipage}{\dimexpr(\cveventbubbleradius mm + \cveventbubbleradius mm)}%
\protect\drawcircle{\cveventbubbleradius}
{\cveventbubbleborderwidth}
{cvcolor}
{cvbordercolor}%
\end{minipage}%
\hspace{\dimexpr(\timelinespace mm - \cveventbubbleradius mm)}%
\begin{minipage}[t]{\dimexpr(\linewidth - \cveventdatewidth mm)}%
#3%
\end{minipage}%
\par%
}{%
\PackageError{\packagename}{The cvevent can be used only in the sidebar column}{}%
}%
}{}
% Vertical space between paragraphs.
% Parameter 1 (optional): Space size in millimeters.
\NewDocumentCommand{\cvseparator}{O{1}}{\vspace{#1\dimexpr\cvseparatorscale mm\relax}\par}
% The title of the event header.
% Parameter 1: Event title.
\newcommand{\cvname}[1]{\textscale{\cvnamefontscale}{\textbf{#1}}\cvseparator}
% The description of the event header.
% Parameter 1: Event description.
\newcommand{\cvdescription}[1]{\textscale{\cvdescriptionfontscale}{\textit{\textbf{#1}}}\cvseparator[2]}
% Switches the main column to the sidebar.
\newcommand{\cvsidebar}[0]{%
\ifthenelse{\equal{\iscvsidebar}{0}}{%
\switchcolumn%
\renewcommand{\iscvsidebar}{1}%
}{%
\PackageError{\packagename}
{The cvsidebar can be used only once}{}%
}%
}%
% List item with a label.
% Parameter 1 (optional): Icon name from fontawesome package.
% Parameter 2 (optional): Icon size in milimeters.
% Parameter 3: Content.
\NewDocumentEnvironment{cvitem}{O{Circle} O{2.5} +b}{%
\ifthenelse{\equal{\iscvsidebar}{0}}{%
\begin{minipage}{\cvscale\dimexpr#2mm\relax}%
\makebox(0, 0){\textcolor{cvcolor}
{\fontsize{\cvscale\dimexpr#2mm\relax}
{\cvscale\dimexpr#2mm\relax}\csname fa#1\endcsname}}%
\end{minipage}%
\hspace{\cvsidebaroffset mm}%
\begin{minipage}
{\dimexpr(\linewidth - \cvsidebaroffset mm - \cvscale\dimexpr#2mm\relax)}%
#3%
\end{minipage}%
\par%
}{%
\PackageError{\packagename}
{The cvitem can be used only in the main content column}{}%
}%
}{}
% List item with an icon and text aligned to the right of the picture.
% Parameter 1 (optional): Icon name from fontawesome package.
% Parameter 2 (optional): Text content.
\NewDocumentEnvironment{qright}{O{Circle} O{}}{%
\ifthenelse{\equal{\iscvsidebar}{0}}{%
\begin{minipage}[c][\dimexpr0.5\linewidth][c]{0.5\linewidth}%
\centering
\makebox(0, 0){\textcolor{cvcolor}
{\textscale{\cvnamefontscale}
{\csname fa#1\endcsname}}}%
\end{minipage}%
\begin{minipage}[c][\dimexpr0.5\linewidth][c]{0.5\linewidth}%
\raggedleft
\textscale{\cvnamefontscale}{#2} %
\end{minipage}%
}{%
\PackageError{\packagename}
{The qright environment can be used only in the main content column}{}%
}%
\par %
}{}
% List item with an icon and text aligned to the right of the picture.
% Parameter 1 (optional): Icon name from fontawesome package.
% Parameter 2 (optional): Text content.
\NewDocumentEnvironment{qrleft}{O{Circle} O{}}{%
\ifthenelse{\equal{\iscvsidebar}{0}}{%
\begin{minipage}[c][\dimexpr0.5\linewidth][c]{0.5\linewidth}%
\raggedleft
\textscale{\cvnamefontscale}{#2} % Apply the font scale of cvent
\end{minipage}%
\begin{minipage}[c][\dimexpr0.5\linewidth][c]{0.5\linewidth}%
\centering
\makebox(0, 0){\textcolor{cvcolor}
{\textscale{\cvnamefontscale}
{\csname fa#1\endcsname}}}%
\end{minipage}%
}{%
\PackageError{\packagename}
{The qrleft environment can be used only in the main content column}{}%
}%
\par %
}{}
% Renders a progress-bar to indicate a certain skill in percent.
% Parameter 1: Name of skill.
% Parameter 2: Skill level.
% Parameter 3: Percent of the progress-bar in range [0, 1].
\newcommand{\cvskill}[3]{%
\ifthenelse{\equal{\iscvsidebar}{0}}{%
\begin{tabularx}{\linewidth}{>{\raggedright\arraybackslash}X>{\raggedleft\arraybackslash}X}%
\textcolor{black}{\textbf{#1}} & \textcolor{cvcolor}{#2}%
\end{tabularx}%
\begin{tikzpicture}[scale=1,rounded corners=\cvscale*0.5mm,very thin]%
\fill [cvlightcolor] (0,0) rectangle (\linewidth, 0.15*\cvscale);%
\fill [cvcolor] (0,0) rectangle (#3\linewidth, 0.15*\cvscale);%
\end{tikzpicture}%
\cvseparator[2]%
}{%
\PackageError{\packagename}
{The cvskill can only be used in the main content}{}%
}%
}