%!TEX encoding = UTF-8 Unicode
%
% My own curriculum vitae class
% Author: Matthieu Guerquin-Kern
%
% This class is inspired from European curriculum vitae class
% subject to the LaTeX Project Public License.
% See  http://www.ctan.org/tex-archive/help/Catalogue/licenses.lppl.html
% for the details of that license

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{cvitae}[2007/10/29]

\DeclareOption{french}{
  \AtEndOfPackage{%
\def\persdatakey{Informations personnelles} 
\def\namekey{Nom / Pr\'enom}
\def\nationalitykey{Nationalit\'es}
\def\birthkey{Date de naissance}
\def\adresskey{Adresse}
\def\telkey{T\'el\'ephone}
\def\emailkey{Courriel}
\def\homepagekey{Page web}
 }%
}

\DeclareOption{english}{
\def\persdatakey{Personal information} 
\def\namekey{Surname / First name}
\def\nationalitykey{Nationalities}
\def\birthkey{Date of birth}
\def\adresskey{Address}
\def\telkey{Telephone}
\def\emailkey{Email}
\def\homepagekey{Home page}
}

\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}

\ExecuteOptions{english,noflag,logo,hrule} % Default options
\ProcessOptions

\LoadClass{article}
\RequirePackage[utf8]{inputenc}
\RequirePackage{graphicx}
\RequirePackage{ifpdf}
\ifpdf
  \RequirePackage[pdftex,colorlinks]{hyperref}
\else
  \RequirePackage[hypertex,colorlinks]{hyperref}
\fi
\RequirePackage[T1]{fontenc}
\RequirePackage{lmodern}
\RequirePackage[paper=a4paper,
   tmargin=2cm,           % haut
   bmargin=2cm,           % bas
   lmargin=1.5cm,             % gauche
   rmargin=1.5cm]{geometry}
\RequirePackage{fancyhdr}
\RequirePackage{longtable}
\RequirePackage{array}
\RequirePackage{multirow}

\renewcommand{\rmdefault}{phv}
\renewcommand{\sfdefault}{phv}
\fontsize{9}{9pt}\selectfont



\AtBeginDocument{%
\pagestyle{fancy}
\fancyfoot[L]{\begin{footnotesize}Curriculum Vit\ae\end{footnotesize}}
\fancyfoot[C]{\begin{footnotesize}\myname\end{footnotesize}}
\fancyfoot[R]{\begin{footnotesize}Page \thepage\end{footnotesize}}
\fancyhead{}
\renewcommand{\headrulewidth}{0pt}

\begin{center}\begin{LARGE}
Curriculum Vit\ae\end{LARGE}
\end{center}
}

\newenvironment{cv}{\begin{longtable}{>{\raggedleft}p{0.18\linewidth}@{\hspace{0.02\linewidth}}|p{0.6\linewidth}>{\raggedleft}p{0.18\linewidth}}}
{\end{longtable}}
\newcommand{\cvsection}[1]{
\multicolumn{3}{p{\linewidth}}{}\tabularnewline
\cline{1-1}
&&\tabularnewline
\centering\large{\textbf{#1}} &  &\tabularnewline\nopagebreak
&&\tabularnewline
}

\newcommand{\cvitem}[3]{ #1 & #2 \newline& #3\tabularnewline[10pt]}

\newcommand*{\cvname}[1]{\def\myname{#1}} % Replaces the above
\newcommand*{\cvaddress}[1]{\def\myaddress{#1}}
\newcommand*{\cvtelephone}[2][]{\def\mytelephone{#2}\def\mymobile{#1}}
\newcommand*{\cvemail}[1]{\def\myemail{#1}}
\newcommand*{\cvhomepage}[1]{\def\myhomepage{#1}}
\newcommand*{\cvnationality}[1]{\def\mynationality{#1}}
\newcommand*{\cvdateofbirth}[1]{\def\mybirth{#1}}
% Personal picture
\newlength{\mypictureheight}
\newcommand*{\cvpicture}[2][0pt]{\setlength{\mypictureheight}{#1}\def\pictest{#2}\def\mypicture{\includegraphics[height=\mypictureheight]{#2}}}

\cvname{Default name (precise yours)}
\cvpicture{}
\cvnationality{}
\cvdateofbirth{}
\cvaddress{}
\cvtelephone{}
\cvemail{}
\cvhomepage{}

\newcommand{\cvpersonalinfo}[1]{
\cline{1-1}

\ifx\@empty\pictest &&\tabularnewline \else
\addtolength{\mypictureheight}{-0.5cm}&\raggedleft\mypicture &\tabularnewline[-\mypictureheight]
&&\tabularnewline
\fi
\centering\large{\textbf{\persdatakey}} & &\tabularnewline\nopagebreak
&&\tabularnewline
\cvitem{\namekey}{\large{\myname}}{}
\ifx\@empty\mynationality\else
\cvitem{\nationalitykey}{\mynationality}{}
\fi
\ifx\@empty\mybirth\else
\cvitem{\birthkey}{\mybirth}{}
\fi
\ifx\@empty\myaddress\else
\cvitem{\adresskey}{\myaddress}{}
\fi
\ifx\@empty\mytelephone \else
\cvitem{\telkey}{\mytelephone}{}
\fi
\ifx\@empty\myemail\else
\cvitem{\emailkey}{\myemail}{}
\fi
\ifx\@empty\myhomepage\else
\cvitem{\homepagekey}{\myhomepage}{}
\fi
}

\endinput