%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% One LaTeX template designed to make Beamer slides (with naereen.sty)
%%
%% by Lilian Besson, (c) 2013 - v1.3 26-12-2013
%%  http://lbesson.bitbucket.org/
%%  mailto:Lilian.BESSON[@]ens-cachan[.]fr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Permission is granted to freely use, copy, and distribute
%% without restriction. Permission is also granted to distribute
%% modified versions and incorporate into your own macro packages
%% if a brief acknowledgement is given.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% Packages
%% --------
%% hyperref, fancyhdr, geometry are NOT imported.
%% do it your self in your .tex AFTER \usepackage{naereenbeamer}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{naereenbeamer}[2016/08/21 v1.4 Naereen Package for Beamer presentation]
\message{<Naereen LaTeX2e Beamer Package. Ask to naereen(@)crans(.)org for any problem.>}

\usepackage{lmodern}    % http://ctan.org/pkg/lm
\usepackage{etoolbox}   % http://ctan.org/pkg/etoolbox

%%%%%%%%%%%%%%%
%% Beamer theme
% choose one from http://deic.uab.es/~iblanes/beamer_gallery/
% or http://www.hartwork.org/beamer-theme-matrix/
%\usetheme{Warsaw}
\usetheme{CambridgeUS}

%%%%%%%%%%%%%%%%%%%%%%
%% Beamer color theme
%% default albatross beaver beetle crane dolphin dove fly lily
%% orchid rose seagull seahorse whale wolverine

%\usecolortheme{seahorse}  %% very lighty
\usecolortheme{dolphin}    %% nice blue
\usecolortheme{orchid}     %% dark red ?
\usecolortheme{whale}      %% black and blue as Warsaw

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Define your own colors
\definecolor{blackblue}{rgb}{19,19,59}  % rgb(48,48,150)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Change the theme
%\setbeamercolor{alerted text}{fg=orange}
%\setbeamercolor{background canvas}{bg=white}
%\setbeamercolor{block body alerted}{bg=normal text.bg!90!black}
%\setbeamercolor{block body}{bg=normal text.bg!90!black}
%\setbeamercolor{block body example}{bg=normal text.bg!90!black}
%\setbeamercolor{block title alerted}{use={normal text,alerted text},fg=alerted text.fg!75!normal text.fg,bg=normal text.bg!75!black}
%\setbeamercolor{block title}{bg=blue}
%\setbeamercolor{block title example}{use={normal text,example text},fg=example text.fg!75!normal text.fg,bg=normal text.bg!75!black}
%\setbeamercolor{fine separation line}{}
\setbeamercolor{frametitle}{fg=black}
%\setbeamercolor{item projected}{fg=black}
%\setbeamercolor{normal text}{bg=black,fg=yellow}
%\setbeamercolor{palette sidebar primary}{use=normal text,fg=normal text.fg}
%\setbeamercolor{palette sidebar quaternary}{use=structure,fg=structure.fg}
%\setbeamercolor{palette sidebar secondary}{use=structure,fg=structure.fg}
%\setbeamercolor{palette sidebar tertiary}{use=normal text,fg=normal text.fg}
%\setbeamercolor{section in sidebar}{fg=brown}
%\setbeamercolor{section in sidebar shaded}{fg= grey}
\setbeamercolor{separation line}{}
%\setbeamercolor{sidebar}{bg=red}
%\setbeamercolor{sidebar}{parent=palette primary}
%\setbeamercolor{structure}{bg=black, fg=green}
%\setbeamercolor{subsection in sidebar}{fg=brown}
%\setbeamercolor{subsection in sidebar shaded}{fg= grey}
%\setbeamercolor{title}{fg=blackblue}
%\setbeamercolor{titlelike}{fg=blackblue}


%%%%%%%%%%%%%%%%%%%%%%%
%% Other beamer options
%\setbeamercovered{transparent}
% Permet de laisser en gris le texte qui n'est pas encore apparu (lorsqu'on utilise les commandes avec des <1,2> ou <4-9>.

%\setbeamercolor{normal text}{fg=black,bg=white}

%%%%%%%%%%%%%%%%%%%%%%%
%% Change Beamer fonts
% \usefonttheme{default}
% \usefonttheme[onlymath]{serif}
\usefonttheme{serif}

\setbeamerfont{title}{family=\rm}
\setbeamerfont{titlelike}{family=\rm}
\setbeamerfont{frametitle}{family=\rm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% innertheme
%% rectangles circles inmargin rounded
% \useinnertheme{rounded}  % XXX My preference
\useinnertheme{circles}    % XXX

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% outertheme
%% infolines miniframes shadow sidebar smoothbars smoothtree split tree
%\useoutertheme{infolines}

%% No navigation symbol.
\setbeamertemplate{navigation symbols}{}
\beamertemplatenavigationsymbolsempty

% Other options
%\setbeamertemplate{footline}[page number]

\beamertemplateballitem
\setbeamertemplate{itemize item}[square]


%\setbeamertemplate{footnote}{%
%  \hangpara{2em}{1}%
%  \makebox[2em][l]{\insertfootnotemark}\footnotesize\insertfootnotetext\par%
%}

%% FIXME experiment with the presenter-side notes ?
%% http://texdoc.net/texmf-dist/doc/latex/beamer/doc/beameruserguide.pdf#page=199&zoom=auto,-32,721
%\usepackage{pgfpages}
%% Ref: https://zeekish.wordpress.com/2011/03/18/latex-beamer-presentation-on-dual-display-laptop-projector/
%\setbeameroption{show notes on second screen=left}

% Better spacing for section and subsection in table of contents Cf. https://tex.stackexchange.com/questions/188773/enumerate-table-of-contents-in-beamer
% \setbeamertemplate{section in toc}{\hspace*{1em}\inserttocsectionnumber.~\inserttocsection\par}
% \setbeamertemplate{subsection in toc}{\hspace*{2em}\inserttocsectionnumber.\inserttocsubsectionnumber.~\inserttocsubsection\par}

% % Si on veut faire apparaître le sommaire courant à chaque nouvelle section.
\AtBeginSection[]
{
	\subsection*{\hfill{} Local outline}
	\begin{frame}<beamer>[t]
	\frametitle{Local outline}  % Translate the name of the slide
		\begin{large}  % XXX large font for this slide?
		\tableofcontents[currentsection, currentsubsection, sectionstyle=show/hide, subsectionstyle=show/show/hide]
		\end{large}  % XXX Large font for this slide?
	\end{frame}
	\addtocounter{framenumber}{-1}  % Correct total frame count
}

\newcounter{captureframe}
\setcounter{captureframe}{0}
\newcounter{finalframe}
\setcounter{finalframe}{0}

\newcommand{\appendixBeamer}{
	\appendix{}
%	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	%% Remove <frame #> / <total frame #> from footline template
%	\makeatletter
%	\patchcmd{\beamer@@tmpl@footline}% <cmd>
%	  {\insertframenumber{} / \inserttotalframenumber}% <search>
%	  {Annexe \insertframenumber{} / \inserttotalframenumber}% <replace>
%	  {}% <success>
%	  {}% <failure>
%	\makeatother
	%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	\setcounter{captureframe}{\value{framenumber}}% Store/capture current frame
	%% Replace <frame #> in footline template
	\makeatletter
	\patchcmd{\beamer@@tmpl@footline}% <cmd>
	  {\insertframenumber}% <search>
	  {\thecaptureframe}% <replace>
	  {}% <success>
	  {}% <failure>
	\makeatother

	% From http://www.stanford.edu/~dgleich/notebook/2009/05/appendix_slides_in_beamer_cont_1.html
	\setcounter{finalframe}{\value{framenumber}}
	%% Backup frames
	\setcounter{framenumber}{\value{finalframe}}
}

%% END of naereenbeamer.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
