\usepackage{ifxetex}
\ifxetex
   \usepackage{fontspec}
   %\usepackage{microtype}
  %\usepackage{xunicode}
   \usepackage{polyglossia}
   \usepackage{xltxtra}
   \setdefaultlanguage{french}
   \setotherlanguage{english}
   \defaultfontfeatures{Mapping=tex-text} % To support LaTeX quoting style
   %\setmainfont{Caviar Dreams}
   \newfontfamily\headingfont[]{Caviar Dreams}
   \usepackage{titlesec}
   \defaultfontfeatures{Ligatures=TeX}
   % Set sans serif font to Calibri
   \setsansfont{LiberationSans}
   % Set serifed font to Cambria
   \setmainfont{LiberationSans}
\else
   \usepackage[utf8]{inputenc}
   \usepackage[T1]{fontenc}
   \usepackage{amsfonts}
   \usepackage[english, francais]{babel}
\fi
\usepackage{pifont}
\usepackage{geometry}
\usepackage{fancybox}
\usepackage{verbatim}
\usepackage{eurosym}
%\usepackage{color}
\usepackage[svgnames,table]{xcolor}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{lastpage}
%\usepackage{enumitem}
\usepackage{makeidx}
\usepackage{tocbibind}
\usepackage[backend=biber,hyperref=true,backref=true]{biblatex}
\addbibresource{biblio.bib}
\usepackage{url}
\renewcommand{\baselinestretch}{1.3}
\addto\captionsfrench{\renewcommand{\contentsname}{Sommaire}}
\usepackage{graphicx}
\usepackage{pdfpages}
\usepackage{menukeys}
\usepackage{minted}
\makeindex

%
% Tableaux
%
\usepackage{array}
\usepackage{booktabs}
\usepackage{colortbl}

% Default
\newcolumntype{1}{l}
\newcolumntype{2}{l}
\newcolumntype{3}{l}
\newcolumntype{4}{l}
\newcolumntype{5}{l}
\newcolumntype{6}{l}
\newcolumntype{7}{l}
\newcolumntype{8}{l}
\newcommand*\heading{}
\newcommand*\beforeheading{}
\newcommand*\afterheading{}
\newcommand*\normalline{}
\newcommand*\lastline{}

%\renewcommand*\toprule{\arrayrulecolor{red}{\hline}}

% Nice looking rules, centered cells
\newcolumntype{1}{c}
\newcolumntype{2}{c}
\newcolumntype{3}{c}
\newcolumntype{4}{c}
\newcolumntype{5}{c}
\newcolumntype{6}{c}
\newcolumntype{7}{c}
\newcolumntype{8}{c}
\renewcommand*\heading[1]{\chapterfont\MakeUppercase{#1}}
\renewcommand*\beforeheading{\arrayrulecolor{CadolesBlue}\toprule}
\renewcommand*\afterheading{\midrule}
\renewcommand*\normalline{}
\renewcommand*\lastline{\bottomrule}

\definecolor{CadolesBlue}{rgb}{.16,.50,.69}
\definecolor{CadolesLightBlue}{rgb}{.31,.506,.741}
\newfontfamily\cadolesfont{Caviar Dreams}
\newfontfamily\chapterfont[Color=CadolesBlue]{Caviar Dreams}
\newfontfamily\sectionfont[Color=CadolesBlue]{Caviar Dreams}
\newfontfamily\subsectionfont[Color=CadolesLightBlue]{Caviar Dreams}
\newfontfamily\subsubsectionfont[Color=CadolesLightBlue]{Caviar Dreams}

\newcommand{\tickYes}{\color{Green}\checkmark}
\newcommand{\tickNo}{\color{red}{\hspace{1pt}\ding{55}}}
\newcommand{\wlink}[1]{\textcolor{CadolesBlue}{\underline{#1}}}
\newcommand{\classname}[1]{\texttt{\textbf{#1}}}
%\newcommand{\cadoles}{\chapterfont{Cadoles}}
\newcommand{\cadoles}{\cadolesfont\textcolor{black}{Cad}\textcolor{CadolesBlue}{ole}\textcolor{black}{s}}
\newcommand{\TitleRule}{\rule[0.5ex]{12cm}{0.5mm}}
\newcommand\espace{\vrule height 20pt width 0pt}
\newcommand{\titre}[1]{{\color{DarkBlue}\normalfont\LARGE\bfseries #1\smallskip\hrule height 1pt}\bigskip}
\renewcommand*\abstractname{Summary}
%\renewcommand{\FrenchLabelItem}{\color{DarkBlue}{\ding{68}}}
\let\oldfootnoterule\footnoterule
\renewcommand\footnoterule{\vspace*{-3pt}%
\noindent\rule{3in}{0.4pt}\vspace*{2.6pt}}% -3 + 0.4 + 2.6 = 0

%\pagestyle{headings}  
\makeatletter
\renewcommand{\thesection}{}
\titleformat{\chapter}{\LARGE\chapterfont}{\thesection}{0ex}{}[\color{CadolesBlue}\hrule height 1pt]
\titleformat{\section}{\Large\sectionfont}{\thesection}{0ex}{}[\color{CadolesBlue}\hrule height 1pt]
\titleformat{\subsection}{\large\subsectionfont}{\thesection}{0ex}{}
\titleformat{\subsubsection}{\itshape\subsubsectionfont}{\thesection}{0ex}{}

\skbinput[from=rep]{style/00-entete-pied-de-page}

\def\maketitle{
\skbfigure[center]{cadoles/logo_01}
   \vspace{4.5cm}
   
   \begin{flushleft}
      \textbf{\Huge \cadolesfont\textcolor{CadolesBlue}{\@title}}
   \end{flushleft}
   \begin{center}
      \color{CadolesBlue}\TitleRule
   \end{center}
   \begin{flushright}
      \vspace{-1.5ex}
      \textbf{\huge \cadolesfont\textcolor{DarkGrey}{\departement}}
   \end{flushright}
   \vspace{2.5cm}
   \pagebreak
}

\def\destinataire{
   \vspace{2cm}
   \begin{flushright}
      \begin{minipage}[r]{8cm}
	      \skbinput[from=rep]{style/Destinataire}
      \end{minipage}
   \end{flushright}
  
}

\def\origine{
   \vspace{1.5cm}
   \begin{flushleft}
      \begin{minipage}[l]{8cm}
         \skbinput{style/00-Coordonnees}
      \end{minipage}
   \end{flushleft}
}
%
% Box pour citations
%
\newsavebox{\fmbox}
\newenvironment{fmpage}[1]
     {\begin{lrbox}{\fmbox}\begin{minipage}{#1}}
     {\end{minipage}\end{lrbox}\fbox{\usebox{\fmbox}}}

\hypersetup{
       backref=true,                           % Permet d'ajouter des liens dans
       pagebackref=true,                       % les bibliographies
       hyperindex=true,                        % Ajoute des liens dans les index.
       colorlinks=true,                        % Colorise les liens.
       breaklinks=true,                        % Permet le retour à la ligne dans les liens trop longs.
       urlcolor= CadolesBlue,                  % Couleur des hyperliens.
       linkcolor= CadolesBlue,                        % Couleur des liens internes.
       bookmarks=true,                         % Créé des signets pour Acrobat.
       bookmarksopen=true,                     % Si les signets Acrobat sont créés,
                                               % les afficher complètement.
       pdftitle={\@title},  % Titre du document.
                                               % Informations apparaissant dans
       pdfauthor={Cadoles},                    % dans les informations du document
       pdfsubject={Proposition Commerciale}    % sous Acrobat.
}



%\topmargin 0in
%\leftmargin 2.5cm
%\rightmargin 2.5cm

\setlength{\hoffset}{-18pt}        
\setlength{\oddsidemargin}{0pt} % Marge gauche sur pages impaires
\setlength{\evensidemargin}{9pt} % Marge gauche sur pages paires
\setlength{\marginparwidth}{54pt} % Largeur de note dans la marge
%\setlength{\textwidth}{481pt} % Largeur de la zone de texte (17cm)
\setlength{\voffset}{-18pt} % Bon pour DOS
\setlength{\marginparsep}{7pt} % Séparation de la marge
\setlength{\topmargin}{0pt} % Pas de marge en haut
\setlength{\headheight}{13pt} % Haut de page
\setlength{\headsep}{10pt} % Entre le haut de page et le texte
\setlength{\footskip}{27pt} % Bas de page + séparation
\setlength{\textheight}{660pt} % Hauteur de la zone de texte (25cm)


