\newcommand*{\middlefoot}{\textrm{\thepage{}}}
\newcommand*{\righthead}{\small\insertsep{\tb@var@numero}{--}{{\bf \tb@var@titrecourt}}}

\ifthenelse{\boolean{tb@mode@ficheprog}}{%
  \renewcommand*{\righthead}{\small\tb@var@numero{}}
}{}%

\AtBeginDocument{%
  \lhead{\small\insertsep{\tb@var@code}{--}{{\sc \tb@var@matiere}}}
  \chead{}
  \rhead{\righthead}
  \cfoot{\middlefoot}
  \lfoot{\scriptsize\insertsep{TELECOM Bretagne}{--}{\tb@var@type}}
  \rfoot{\scriptsize \@date{}}
  \colorlet{background}{gray!30}
  \colorlet{backgroundCorrection}{red!10}
}

\ifthenelse{\boolean{tb@mode@devoir}}{%
  \RequirePackage{devoir}
  \ifthenelse{\boolean{tb@mode@correction}}{\withoutIdentity}{}
}{%
  \newcommand*\cartouche{}
}

\ifthenelse{\boolean{tb@boolean@handout} \OR \boolean{tb@mode@devoir}}{
  \RequirePackage{url}
}{%
  \RequirePackage{ifpdf}
  \ifpdf
    \RequirePackage[pdftex]{hyperref}
  \else
    \RequirePackage[dvips]{hyperref}
  \fi
}
\RequirePackage{amsthm}
\theoremstyle{definition}
\newtheorem{definition}{\translate{Definition}}

\RequirePackage[a4paper,textwidth=17.5cm,textheight=24.5cm,bmargin=2cm]{geometry}
\setlength{\parindent}{0pt}
\setlength{\parskip}{4pt}
\setlength{\headsep}{15pt}
\setlength{\headheight}{14pt}
\pagestyle{fancy}

\ifthenelse{\boolean{tb@boolean@handout}}{%
  \RequirePackage{pgfpages}
  \pgfpagesuselayout{2 on 1}[a4paper,landscape]
}{}

% The title page
\renewcommand{\maketitle}{
  \par
  \begin{center}
    \includegraphics[width=4cm]{logotb}
    \vspace*{1.0em}\par
    \color{blue}\LARGE\bf% 
    \ifx\tb@var@numero\@empty%
    \else%
      \tb@var@numero{} -- %
    \fi%
    \tb@var@titre%
    % Attention les titres et sous titres sont des \long qui valent {} quand elles sont vides
    \ifx\tb@var@soustitre\tb@empty@title%
    \else%
      \\[2mm]\Large\bf \tb@var@soustitre%
    \fi%
    \ifthenelse{\boolean{tb@boolean@withDate}}{
      \\[2mm]\large\bf \@date%
    }{}
    \ifthenelse{\boolean{tb@boolean@withAuthors}}{
      \\[2mm]\bf\sc \@author%
    }{}
    \ifthenelse{\boolean{tb@mode@correction}}{%
      \\[2mm]{\color{red}\Large\bf Correction}%
    }{}
  \end{center}%
  \thispagestyle{plain}
  \addvspace{2em}
  \begin{center}
    \cartouche
  \end{center}
}
\newcommand{\maketitlenew}{
  \par
  \begin{center}
    \includegraphics[width=4cm]{get_bretag_cont_rgb}
    \vspace*{1.0em}\par
    \color{blue}\LARGE\bf% 
    \ifx\tb@var@numero\@empty%
    \else%
      \tb@var@numero{} -- %
    \fi%
    \tb@var@titre%
    % Attention les titres et sous titres sont des \long qui valent {} quand elles sont vides
    \ifx\tb@var@soustitre\tb@empty@title%
    \else%
      \\[2mm]\Large\bf \tb@var@soustitre%
    \fi%
    \ifthenelse{\boolean{tb@boolean@withDate}}{
      \\[2mm]\large\bf \@date%
    }{}
    \ifthenelse{\boolean{tb@boolean@withAuthors}}{
      \\[2mm]\bf\sc \@author%
    }{}
    \ifthenelse{\boolean{tb@mode@correction}}{%
      \\[2mm]{\color{red}\Large\bf Correction}%
    }{}
  \end{center}%
  \thispagestyle{plain}
  \addvspace{2em}
  \begin{center}
    \cartouche
  \end{center}
}

