% Loading packages
\usepackage{fontspec}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{bbm}
\usepackage{stmaryrd}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{listings}
\usepackage{lstautogobble}
\usepackage{svg}
\usepackage{tikz}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{tcolorbox}
\usepackage{mdframed}
\usepackage{proof}
\usepackage{xparse}
\usepackage{cprotect}
\usepackage{xpatch}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{txfonts}
\usepackage{yade}
\usepackage{environ}
\usepackage{pifont}
\usepackage{transparent}
\usepackage{ulem}
\usepackage[backend=biber,style=numeric]{biblatex}
\usepackage{hyperref}
\usepackage{array}
\usepackage{arydshln}

\usepackage[lighttt]{lmodern}
\usetikzlibrary{shapes.geometric,positioning,backgrounds}

% Macros caractères globales
\newcommand{\pgrph}{\P}
\newcommand{\hsep}{\vspace{.2cm}\centerline{\rule{0.8\linewidth}{.05pt}}\vspace{.4cm}}
\renewcommand{\P}{\mathbb{P}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\1}{\scalebox{1.2}{$\mathbbm{1}$}}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\littleO}{o}
\newcommand{\bigO}{\mathcal{O}}
\newcommand{\longdash}{\:\textrm{---}\:}
\newcommand\hole{\left[\raisebox{-0.25ex}{\scalebox{1.2}{$\cdot$}}\right]}
\newcommand\bracket[1]{\!\left[#1\right]}
\newcommand\spacebar{\;|\;}
\def\nDownarrow{\not\mspace{1mu}\Downarrow}
\let\pprec\preccurlyeq

% Création des environnement globaux
\newtheorem{property}{Property}
\newtheorem{remark}{Remark}

\newcounter{rule}

% Commandes logiques globales
\newcommand{\ifnullthenelse}[3]{
	\ifnum\value{#1}=0
	#2
	\else
	#3
	\fi
}

%%% Commande \newtag permettant de changer le label d'une equation
\makeatletter
\newcommand\newtag[2]{#1\def\@currentlabel{#1}\label{#2}}
\makeatother


% Macros caractères spécifiques au document
\newfontface\russian{Liberation Serif}
\newcommand\BB{{\ensuremath{\mathcal{B}}}}
\newcommand\en{{\text{\russian н}}}
\newcommand\TT{{\ensuremath{\mathcal{T}}}}
\newcommand\UU{{\ensuremath{\mathcal{U}}}}
\newcommand\CC{{\ensuremath{\mathcal{C}}}}
\newcommand\El{{\ensuremath{\operatorname{\mathcal{E}l}}}}
\newcommand\ii{{\ensuremath{\mathbf{i}}}}
\newcommand\Con{{\ensuremath{\operatorname{Con}}}}
\newcommand\Ty{{\ensuremath{\operatorname{Ty}}}}
\newcommand\Tm{{\ensuremath{\operatorname{Tm}}}}
\newcommand\XCon{{\ensuremath{\operatorname{\mathbf{Con}}}}}
\newcommand\XTy{{\ensuremath{\operatorname{\mathbf{Ty}}}}}
\newcommand\XTm{{\ensuremath{\operatorname{\mathbf{Tm}}}}}
\newcommand\Cstr{{\ensuremath{\operatorname{\mathcal{C}str}}}}
\newcommand\Rtsc{{\ensuremath{\operatorname{\mathcal{R}tsc}}}}
\newcommand\Cat{{\ensuremath{\operatorname{\mathcal{C}at}}}}
\newcommand\Set{{\ensuremath{\operatorname{\mathcal{S}et}}}}
\newcommand\FamSet{{\ensuremath{\operatorname{\mathcal{F}am\mathcal{S}et}}}}
\newcommand\Obj{{\ensuremath{\operatorname{\mathcal{O}bj}}}}
\newcommand\Hom{{\ensuremath{\operatorname{\mathcal{H}om}}}}
\newcommand\this{{\ensuremath{\operatorname{\texttt{this}}}}}
\newcommand\one{{\ensuremath{\mathbf{1}}}}
\newcommand\dash{{\;\textrm{---}\;}}
\renewcommand\enquote[1]{``#1''}
\newcommand\tl{{\triangleleft}}

\DeclareMathOperator{\inj}{inj}
\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\Id}{\mathcal{I}d}

\newcommand\TSet{{\ensuremath{\left[\TT,\Set\right]}}}
\newcommand\TSetObject[3]{{\ensuremath{
			\left[
			\begin{tikzpicture}[baseline=(base)]
				\node (U) at (0,0) {\UU};
				\node (El) at (0,1) {\El};
				\draw[->] (El) -- node[anchor=east] {\ensuremath{\scriptstyle p}} (U);
				
				\node (XU) at (1.5,0) {\ensuremath{#3}};
				\node (XEl) at (1.5,1) {\ensuremath{#1}};
				\draw[->] (XEl) -- node[anchor=west] {\ensuremath{\scriptstyle #2}} (XU);
				
				\draw[|->] (.3,0) -- (1,0);
				\draw[|->] (.3,0.5) -- (1,0.5);
				\draw[|->] (.3,1) -- (1,1);
				
				\coordinate (base) at (.5,.4);
			\end{tikzpicture}
			\right]
}}}

\newcommand\simpleArrow[3]{
	\begin{tikzpicture} 
		\node (0) at (0,0) {$#1$}; 
		\node (1) at (6,0) {$#3$};
		\path[->] (0) edge["${\scriptstyle #2}$", pos=0.5, fore, black,=>, ] (1); 
	\end{tikzpicture}
}
\newcommand\simpleUpDownArrow[3]{
	\begin{tikzpicture} 
		\node (0) at (0,1) {$#1$}; 
		\node (1) at (0,0) {$#3$};
		\path[->] (0) edge["${\scriptstyle #2}$", pos=0.5, fore, black,=>, ] (1); 
	\end{tikzpicture}
}
\newcommand\labeledupdownarrow[1]{
	\begin{tikzpicture} 
		\path[->] (0,1) edge["${\scriptstyle #1}$", pos=0.5, fore, black,=>, ] (0,0); 
	\end{tikzpicture}
}

\newcommand\diagram[1]{\begin{tcolorbox}\begin{center}\vspace{1.5cm}\Huge \texttt{\textbf{#1}}\vspace{1.5cm}\end{center}\end{tcolorbox}}

\newcommand\todo[1]{\begin{tcolorbox}[colback=red!20!white,colframe=red!85!black,boxrule=4pt] #1 \end{tcolorbox}}
\newcommand\inlinetodo[1]{\colorbox{orange}{#1}}

\newcommand{\backupbegin}{
	\newcounter{finalframe}
	\setcounter{finalframe}{\value{framenumber}}
}
\newcommand{\backupend}{
	\setcounter{framenumber}{\value{finalframe}}
}

\addbibresource{Bilibibio.bib}

\usetheme{Madrid}

\makeatletter
\setbeamertemplate{frametitle}{%
	\nointerlineskip
	\begin{beamercolorbox}[sep=1.6ex,wd=\paperwidth,leftskip=.5cm,rightskip=0cm]{frametitle}%
		\usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\beamer@frametitle\\
		\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle
	\end{beamercolorbox}%
}
\makeatother

\hypersetup{pdfpagemode=FullScreen}
% Transition en fade-in par défaut
%\addtobeamertemplate{background canvas}{\transfade[duration=0.4]}{}

\addtobeamertemplate{frametitle}{
	\let\insertframetitle\insertsubsectionhead}{}
\makeatletter
\CheckCommand*\beamer@checkframetitle{\@ifnextchar\bgroup\beamer@inlineframetitle{}}
\renewcommand*\beamer@checkframetitle{\global\let\beamer@frametitle\relax\@ifnextchar\bgroup\beamer@inlineframetitle{}}
\makeatother

\setbeamertemplate{itemizeitem}{\scriptsize$\diamond$}
\newcommand\sectocframe[1][]{
	\begin{frame}
		\pdfpcnote{#1}
		\tableofcontents[currentsection,hideothersubsections,sections=\value{section}]
	\end{frame}
}
