\setboolean{tb@boolean@withSection}{true}
\setboolean{tb@boolean@withAuthors}{true}

% Choix de la présentation des exercices
\SetSimple

\usetheme{TELECOMBretagne}

\def\inserttitle{\tb@var@titre}%
\def\beamer@shorttitle{\tb@var@titrecourt}%
\def\insertsubtitle{\tb@var@soustitre}%
\def\beamer@shortsubtitle{\tb@var@soustitrecourt}%

\renewcommand{\insertdocumentref}{
  \tb@var@type{} %
  \ifx\tb@var@code\@empty%
    \ifx\tb@var@matiere\@empty%
    \else%
      -- \tb@var@matiere{} %
    \fi%
  \else%
    -- \tb@var@code{} %
  \fi%
  \ifx\tb@var@numero\@empty%
  \else%
    -- \tb@var@numero{}%
  \fi%
}

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

\AtBeginSection{%
  \ifthenelse{\boolean{tb@boolean@withSection}}{%
    \ifx\insertpart\empty%
      \begin{frame}{Avancement}
        \tableofcontents[sectionstyle=show/shaded,subsectionstyle=hide]
      \end{frame}
    \else%
      \begin{frame}{\insertpart}
        \tableofcontents[sectionstyle=show/shaded,subsectionstyle=hide]
      \end{frame}
    \fi%
  }{}%
}
\AtBeginPart{
  \begin{frame}{Partie \insertromanpartnumber{} : \insertpart}
    \tableofcontents[subsectionstyle=hide]
  \end{frame}
}

\AtBeginDocument{
  \colorlet{blackgreen}{green!50!black}
  \colorlet{background}{yellow!60}
}

\setbeamertemplate{title page}[colsep=-4bp,rounded=true,shadow=true]
\pgfdeclareimage[width=2cm]{logo}{logotb}%
\titlegraphic{\pgfuseimage{logo}}%

% Une modif de beamer pour retirer l'espace si on hide
\def\beamer@sectionintoc#1#2#3#4#5{%
  \ifnum\c@tocdepth>0%
  \ifnum#4=\beamer@showpartnumber%
  {
    \beamer@saveanother%
    \gdef\beamer@todo{}%
    \beamer@slideinframe=#1\relax%
    \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
        \beamer@tempcount=#5\relax%
        \advance\beamer@tempcount by\beamer@sectionadjust%
        \edef\inserttocsectionnumber{\the\beamer@tempcount}%
        \def\inserttocsection{\hyperlink{Navigation#3}{#2}}%
        \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@cs\else\beamer@toc@os\fi}%
        {
          \ifbeamer@pausesections\pause\fi%
          % Modif Ici
          % \ifx\beamer@toc@ooss\beamer@hidetext
          % \vskip1.5em
          % \else
          \vfill
          % \fi
          {%
            \hbox{\vbox{%
                \def\beamer@breakhere{\\}%
                \beamer@tocact{\ifnum\c@section=#1\beamer@toc@cs\else\beamer@toc@os\fi}{section in toc}}}%
            \par%
          }%
        }%
      }
    }%
    \beamer@restoreanother%
  }
  \beamer@todo%
  \fi\fi%
}

