%\documentclass[xcolor=dvipsnames,notes=show,handout]{beamer} % pour mes notes de présentateur
%\documentclass[xcolor=dvipsnames,handout]{beamer} % pour impression
\documentclass[xcolor=dvipsnames]{beamer} % pour présentation

%\usepackage[latin1]{inputenc} %commenté par fred

\usepackage[T1]{fontenc} %ajout Lucie output police
\usepackage{verbatim} %ajout Lucie
\usepackage{wasysym} %ajout Lucie pour caractère spéciaux

\usepackage[utf8]{inputenc} %décommenté par fred
%
\usepackage{caption} %Ajout par Luciano - mettre les captions des figures au centre
\usepackage{textpos} %Ajout par Luciano  - 
\usepackage{fancyvrb} %Ajout par Luciano  - draw a frame around verbatim

\AtBeginSection{\frame{\sectionpage}} %ajout Fred, pages de sections

\usepackage{amsmath}
\usepackage{graphicx}
\logo{\includegraphics[height=0.5cm]{Polytechnique}}%%----Aussi la possibilité de mettre le logo de HEC, de McGill, UQAM ou autre
\usepackage{frcursive}
\usepackage{epstopdf}
\usepackage{tikz} 
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\green}[1]{\textcolor{green!50!black}{#1}}

%---------------------
%packages de Fred
%

%écrire en courrier
\RequirePackage{atbegshi}
\usepackage{courier}
\usepackage{listings}
\usepackage{animate}
\usepackage{calc}
\usepackage{fp}
%\usepackage{times}
%\usepackage[latin1]{inputenc}
\usetikzlibrary{arrows,automata,shapes,calc}
\usepackage{tkz-graph}
\usepackage{courier}
\usepackage{listings}

\usepackage{tkz-graph}

%\usetikzlibrary{arrows}

%\usetikzlibrary{calc}
%\usetikzlibrary{shapes}
%\usetikzlibrary{backgrounds}

\usetikzlibrary{patterns}

%\usetikzlibrary{graphs}

\usetikzlibrary{decorations.pathreplacing}

%\usetikzlibrary{intersections}
%\usetikzlibrary{positioning}
%\usetikzlibrary{shadows}
%\usetikzlibrary{trees}
%---------------------

\usepackage[francais,english]{babel}
\definecolor{titre}{rgb}{0,82,155}
\definecolor{sous-titre}{cmyk}{90,60,0,0}
\usepackage{xcolor}

\definecolor{BGERAD}{RGB}{0,82,155}%BleuGERAD
\definecolor{OGERAD}{RGB}{178,92,18}%OrangeGERAD
\definecolor{BEGERAD}{RGB}{247,238,212}%BeigeGERAD
\usecolortheme[named=BGERAD]{structure}
%\mode{presentation}

\graphicspath{{Figures/}}
\newcommand{\TikZ}{Ti\textit{k}{Z}}

\parindent=0pt % indentation du paragraphe
%\parskip=15pt  % espacement entre les paragraphes

\usetheme{Goettingen}
\setbeamertemplate{caption}[numbered]
\setbeamercovered{transparent}
\setbeamertemplate{navigation symbols}{\insertlogo}
%\setbeamertemplate{navigation symbols}{}
\usebeamertemplate{footline}
\setbeamertemplate{footline}{%
~~~{\large\strut}{\tiny \textcolor{BGERAD}{\insertframenumber$/89$}}
}

\makeatletter
\setbeamertemplate{sidebar canvas \beamer@sidebarside}[vertical shading][top=BEGERAD!100,bottom=BEGERAD!10]%%----Aussi la possibilité de mettre le Bleu GERAD en commantant la ligne de cette commande, ce qui active celle-ci: \usecolortheme[named=BGERAD]{structure}----%% 
\makeatother 

%\title[\textcolor{BGERAD}{Tutoriel\ TikZ}]{\hspace*{-2.7cm}\includegraphics[width=5cm]{butterfly}
\title[\textcolor{BGERAD}{Tutoriel\ TikZ}]{\hspace*{-2.7cm}\input{imagetitre.tex}
\\
\vspace*{-5cm}\hspace*{-4cm}\textcolor{BGERAD}{Introduction \`a TikZ}}

\author[]{{\hspace*{6.5cm}\textcolor{BGERAD}{\footnotesize Luciano~Costa}\\
\hspace*{6.5cm}\textcolor{BGERAD}{\footnotesize Karine H\'ebert}}\\
\hspace*{6.5cm}\textcolor{BGERAD}{\footnotesize Fr\'{e}d\'{e}ric~Quesnel}}

\institute{\hspace*{6,5cm}\textcolor{BGERAD}{\footnotesize GERAD}\\
\hspace*{6.5cm}\textcolor{BGERAD}{\footnotesize HEC Montr\'eal}}
     
\date{\hspace*{6.5cm}\textcolor{BGERAD}{2018}}
\newcounter{cnt}
\setcounter{cnt}{0}
\newcommand{\ANDLER}[4]
{   
	\draw[-latex] (0,0) -- (8.5,0) node[right]{\tiny $b$};
	\draw[-latex] (0,0) -- (0,5.5) node[left]{\tiny $K_G K_L K_B$};
	\pgfmathsetmacro\vkl{#1}
	\pgfmathsetmacro\vkb{#3}
	\pgfmathsetmacro\vP{#2}
	\pgfmathsetmacro\vM{#4}
	\pgfmathsetmacro\bOpt{10* sqrt( (2 * \vkb * \vM) / (\vkl) / ( \vP) )}
	\pgfmathsetmacro\bOpta{ \bOpt /10}
	\pgfmathsetmacro\Kmin{ sqrt( 2 * \vkl * \vP * \vkb)  * sqrt(  \vM * 0.01)}
	\pgfmathsetmacro\Kmina{ \Kmin/20}   
	\FPround{\Kmin}{\Kmin}{2}
	\FPround{\bOpt}{\bOpt}{2}
	
	\draw[dotted] (\bOpta,4.5) -- (\bOpta,-0.5) node[below]
	{\tiny $b_{opt}=\sqrt{\frac{2\cdot #3 \cdot #4 \cdot100}{#1 \cdot #2}} = \bOpt$};
	\draw[dotted]   (-0.5,\Kmina) -- (5.5,\Kmina) node[right]
	{\tiny $K_G(b_{opt})=
		\sqrt{\frac{2\cdot #1 \cdot #2 \cdot #3 \cdot #4}{100}}=\Kmin$};
	\foreach \x  in {1,...,8}{
		\pgfmathsetmacro\xtext{ \x * 10}
		\draw (\x cm,1pt) -- (\x cm,-1pt) node[below] {\tiny $\xtext$};
	}
	\foreach \y  in {1,...,5}{
		\pgfmathsetmacro\ytext{ \y * 20}
		\draw (1pt,\y cm) -- (-1pt,\y cm) node[left]  {\tiny $\ytext$};}%                    
	\foreach \kl/\P/\kb/\M in {#1/#2/#3/#4}{
		\draw[color=black, ultra thick] plot[id=#1#2#3#4a]
		function{(0.5*\kl*0.01*\P*(x*10)+\kb*\M/(x*10))/20};
		\node[color=black, very thick] at (4.5,5)
		{\scriptsize$K_G(b)=\textcolor{red}{\frac{1}{2}\cdot\frac{k_l\cdot P}{100} \cdot b}
			+\textcolor{blue}{\frac{M\cdot k_b}{b}}=
			\textcolor{red}{\frac{1}{2}\cdot\frac{\kl\cdot\P}{100} \cdot b}
			+\textcolor{blue}{\frac{\M\cdot\kb}{b}}$};                           
		\draw[color=red,thick  ] plot[id=#1#2#3#4b] function{(0.5*\kl*0.01*\P*(x*10))/20};                      
		\draw[color=blue,thick  ] plot[id=#1#2#3#4c] function{(\kb*\M/(x*10))/20};
	}
	
}
\begin{document}

\begin{frame}
\titlepage
\end{frame}


\include{debut}
\include{base}
\setbeamercovered{invisible}
\include{graphes}
\setbeamercovered{transparent}
\include{faciliter_la_vie}
\include{puissance_TikZ}
\nocite{Cremer2011}
\nocite{Tantau2012}
\nocite{Tisseau2012}

%\section*{}

\begin{frame}{Références}
\bibliographystyle{plain}
\bibliography{Document}
\end{frame}

% Local background must be enclosed by curly braces for grouping.
{
\usebackgroundtemplate{\includegraphics[width=.85\paperwidth]{logo_G}}
\begin{frame}

\begin{center}
	\huge{Merci pour votre attention!}
	
	\vfill
	
	\footnotesize{Copyright 2017--2018 \copyright Luciano Costa, Lucie Desfontaines,\break Frédéric Quesnel, Gerad}
\end{center}
\end{frame}
}

\section{\includegraphics[height=1.5cm]{logo}}
% Local background must be enclosed by curly braces for grouping.
%{
%\usebackgroundtemplate{\includegraphics[width=\paperwidth]{logo_G}}
%\begin{frame}
%%\includegraphics[height=8cm]{logo_G}
%Copyright 2017--2018 \copyright Luciano Costa, Lucie Desfontaines, Frédéric Quesnel, Gerad
%\end{frame}
%}
\end{document}
