%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This file is part of the CEL beamer template 
%% containing the commonly used macros and settings
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%          Misc commands 
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Schlagwort
\newcommand\schlagwort[1]{\textbf{\textcolor{kit-green100}{#1}}}
% Pointing finger onthe right for noting important things
\newcommand{\mind}{ { \textbf{\textcolor{kit-red}{\bf \HandLeft} } } }

% footnote without footnotemark in the text
\newcommand\nomarkfootnote[1]{%
  \begingroup
  \renewcommand\thefootnote{}\footnote{#1}%
  \addtocounter{footnote}{-1}%
  \endgroup
}
% \newenvironment{nomarkfootnoteenv}{begdef}{enddef}

% colored small box representing end of a proof
\def\endofproof{
	\ifmmode
		\text{\hfill} \textcolor{kit-green}{\rule{2mm}{2mm}}
	\else
		$\hfill \textcolor{kit-green}{\rule{2mm}{2mm}}$
	\fi}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%   Notes page with grid lines
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% put a page with grid lines for live notes
% #1 is an index associated with the page, to be used with \refnotes{#1}
% #2 is the title of the notes page
\newcommand{\pagesNotes}[2]{
	% \bgroup
	\begin{frame}[c, shrink]{\ifgerman{Notizen}\else{Notes}\fi}{#2}
		% [c] means centered, [t] means top-aligned, [b] means bottom-aligned
		% [shrink] means to shrink the content to fit the frame
        \label{pagesNotes:#1}
		\vspace*{0.2ex}\hspace*{0ex}
			\begin{tikzpicture}
			%\draw[lightgray, line width = .0 mm, step=.25] (0,0) grid (18.5,7);
			[domain=0:1,scale=3.6]%
			\draw[very thin,color=white!70!gray,xstep=0.1,ystep=0.1] (0,0) grid (8.71, 3.61);%
			\end{tikzpicture}
	\end{frame}
	% \egroup
}
% Command for showing that some notes will be taken (blackboard, slides,...)
% #1 is the label for the page of the note
\newcommand{\refnotes}[1]{\hyperlink{pagesNotes:#1}{ \textbf{\textcolor{kit-red}{\bf \PencilLeftUp} } } }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%        CEL reference style
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% References on bottom of slide
\newcommand{\addreference}[1]{%
\scriptsize\textcolor{kit-green}{
	\begin{tabular}{lp{0.88\columnwidth}}
	\supercite{#1} & {\fullcite{#1}}
	% \supercite{#1} & {#2}
	\end{tabular}}%
}

\makeatletter
\newcommand{\addreferences}{%
\begin{scriptsize}
\begin{tabular}{lp{0.88\textwidth}}
  \@addreferencesi
}
\newcommand\@addreferencesi{
	\@ifnextchar\stopreferences{\@addreferencesend}{\@addreferencesii}
	}

\newcommand\@addreferencesii[1]{%
  \textcolor{kit-green100}{\supercite{#1}} & {\fullcite{#1}} \\
  \@addreferencesi % restart the recursion
}
\newcommand\@addreferencesend[1]{% The argument is \stopimages
\end{tabular}
\end{scriptsize}
}
\makeatother


\newcommand{\citereference}[1]{\textcolor{kit-green}{\scriptsize\textbf{\supercite{#1}}}}
\newcommand{\citereferencewhite}[1]{\textcolor{white}{\textbf{\scriptsize\textbf{\supercite{#1}}}}}

% Add reference in the footnote - buggy: when the last reference has two lines, the slide will split into two slides, one only has the title and one only has the content.
\newcommand{\footaddreference}[2]{%
% \nomarkfootnote{%
% \begin{minipage}[t]{0.1\linewidth}
%   \scriptsize\textcolor{kit-green}{[#1]}
% \end{minipage}%
% \begin{minipage}[t]{0.86\linewidth}
%   \scriptsize#2
% \end{minipage}}%
\addtocounter{footnote}{-1}%
  \renewcommand\thefootnote{}\footnote{%
	\scriptsize%
	\ifspaceforface{
	\makebox[0.1\linewidth][l]{\textcolor{kit-green}{[#1]}}%
	\parbox[t]{0.86\linewidth}{#2}%
	}%
	\else{
	\makebox[0.06\linewidth][l]{\textcolor{kit-green}{[#1]}}%
	\parbox[t]{0.90\linewidth}{#2}%
	}%
  \fi%
  }%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%        Math macros
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\doubracket}[1]{\llbracket#1\rrbracket}
\newcommand{\myspan}[1]{\ensuremath{\left\langle #1\right\rangle}}

\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}

% j and differential calc
% \def\j{{\mathrm{j}}}
\def \dd{\, {\mathrm{d}}}
% \newcommand{\dd}{\,\mathrm{d}} % differential operator

% Real part
\def\real{{\mathrm{Re}}}
\def\imag{{\mathrm{Im}}}

% sinc and rect
\newcommand\sinc{\,{\mathrm{sinc}}}
\newcommand\rect{\,{\mathrm{rect}}}

% fields
\def\rz{\ifmmode{\mathds{R}}%
    \else{\hbox{$\mathds{R}$}}\fi} 
\def\nz{\ifmmode{\mathbb{N}}%
    \else{\hbox{$\mathds{N}$}}\fi} 
\def\gz{\ifmmode{\mathds{Z}}%
   \else{\hbox{$\mathds{Z}$}}\fi} 
\def\cz{\ifmmode{\mathds{C}}
    \else{\hbox{$\mathds{C}$}}\fi}%
\def\qz{\ifmmode{\mathds{Q}}%
    \else{\hbox{$\mathds{Q}$}}\fi}%   
\def\K{\ifmmode{\mathds{K}}%
    \else{\hbox{$\mathds{K}$}}\fi}%   

% Math bold symbols
\newcommand{\0}{\bm{0}}
\newcommand{\ba}{\bm{a}}
\newcommand{\bb}{\bm{b}}
\newcommand{\bc}{\bm{c}}
\newcommand{\bd}{\bm{d}}
\newcommand{\be}{\bm{e}}
\newcommand{\bff}{\bm{f}} % \bf is already defined 
\newcommand{\bh}{\bm{h}}
\newcommand{\bi}{\bm{i}}
\newcommand{\bj}{\bm{j}}
\newcommand{\bk}{\bm{k}}
\newcommand{\bl}{\bm{l}}
\newcommand{\bmm}{\bm{m}} % \bm is already defined in the package bm
\newcommand{\bn}{\bm{n}}
\newcommand{\bo}{\bm{o}}
\newcommand{\bp}{\bm{p}}
\newcommand{\bq}{\bm{q}}
\newcommand{\br}{\bm{r}}
\newcommand{\bs}{\bm{s}}
\newcommand{\bt}{\bm{t}}
\newcommand{\bu}{\bm{u}}
\newcommand{\bv}{\bm{v}}
\newcommand{\bw}{\bm{w}}
\newcommand{\bx}{\bm{x}}
\newcommand{\by}{\bm{y}}
\newcommand{\bz}{\bm{z}}

\newcommand{\bA}{\bm{A}}
\newcommand{\bB}{\bm{B}}
\newcommand{\bC}{\bm{C}}
\newcommand{\bD}{\bm{D}}
\newcommand{\bE}{\bm{E}}
\newcommand{\bF}{\bm{F}}
\newcommand{\bG}{\bm{G}}
\newcommand{\bH}{\bm{H}}
\newcommand{\bI}{\bm{I}}
\newcommand{\bJ}{\bm{J}}
\newcommand{\bK}{\bm{K}}
\newcommand{\bL}{\bm{L}}
\newcommand{\bM}{\bm{M}}
\newcommand{\bN}{\bm{N}}
\newcommand{\bO}{\bm{O}}
\newcommand{\bP}{\bm{P}}
\newcommand{\bQ}{\bm{Q}}
\newcommand{\bR}{\bm{R}}
\newcommand{\bS}{\bm{S}}
\newcommand{\bT}{\bm{T}}
\newcommand{\bU}{\bm{U}}
\newcommand{\bV}{\bm{V}}
\newcommand{\bW}{\bm{W}}
\newcommand{\bX}{\bm{X}}
\newcommand{\bY}{\bm{Y}}
\newcommand{\bZ}{\bm{Z}}

% blackboard bold lettersk
\newcommand{\F}{\ensuremath{\mathbb{F}}}
\newcommand{\Fq}{\ensuremath{\mathbb{F}_q}}
\newcommand{\Fqm}{\ensuremath{\mathbb{F}_{q^m}}}
\newcommand{\cA}{\ensuremath{\mathcal{A}}}
\newcommand{\cB}{\ensuremath{\mathcal{B}}}
\newcommand{\cC}{\ensuremath{\mathcal{C}}}
\newcommand{\cD}{\ensuremath{\mathcal{D}}}
\newcommand{\cE}{\ensuremath{\mathcal{E}}}
\newcommand{\cF}{\ensuremath{\mathcal{F}}}
\newcommand{\cG}{\ensuremath{\mathcal{G}}}
\newcommand{\cH}{\ensuremath{\mathcal{H}}}
\newcommand{\cI}{\ensuremath{\mathcal{I}}}
\newcommand{\cJ}{\ensuremath{\mathcal{J}}}
\newcommand{\cK}{\ensuremath{\mathcal{K}}}
\newcommand{\cL}{\ensuremath{\mathcal{L}}}
\newcommand{\cM}{\ensuremath{\mathcal{M}}}
\newcommand{\cN}{\ensuremath{\mathcal{N}}}
\newcommand{\cO}{\ensuremath{\mathcal{O}}}
\newcommand{\cP}{\ensuremath{\mathcal{P}}}
\newcommand{\cQ}{\ensuremath{\mathcal{Q}}}
\newcommand{\cR}{\ensuremath{\mathcal{R}}}
\newcommand{\cS}{\ensuremath{\mathcal{S}}}
\newcommand{\cT}{\ensuremath{\mathcal{T}}}
\newcommand{\cU}{\ensuremath{\mathcal{U}}}
\newcommand{\cV}{\ensuremath{\mathcal{V}}}
\newcommand{\cW}{\ensuremath{\mathcal{W}}}
\newcommand{\cX}{\ensuremath{\mathcal{X}}}
\newcommand{\cY}{\ensuremath{\mathcal{Y}}}
\newcommand{\cZ}{\ensuremath{\mathcal{Z}}}
\newcommand{\bcA}{\ensuremath{\boldsymbol{\mathcal{A}}}}
\newcommand{\bcB}{\ensuremath{\boldsymbol{\mathcal{B}}}}

% blackboard letters
\newcommand{\bbA}{\ensuremath{\mathbb{A}}}
\newcommand{\bbB}{\ensuremath{\mathbb{B}}}
\newcommand{\bbC}{\ensuremath{\mathbb{C}}}
\newcommand{\bbD}{\ensuremath{\mathbb{D}}}
\newcommand{\bbE}{\ensuremath{\mathbb{E}}}
\newcommand{\bbF}{\ensuremath{\mathbb{F}}}
\newcommand{\bbG}{\ensuremath{\mathbb{G}}}
\newcommand{\bbH}{\ensuremath{\mathbb{H}}}
\newcommand{\bbI}{\ensuremath{\mathbb{I}}}
\newcommand{\bbJ}{\ensuremath{\mathbb{J}}}
\newcommand{\bbK}{\ensuremath{\mathbb{K}}}
\newcommand{\bbL}{\ensuremath{\mathbb{L}}}
\newcommand{\bbM}{\ensuremath{\mathbb{M}}}
\newcommand{\bbN}{\ensuremath{\mathbb{N}}}
\newcommand{\bbO}{\ensuremath{\mathbb{O}}}
\newcommand{\bbP}{\ensuremath{\mathbb{P}}}
\newcommand{\bbQ}{\ensuremath{\mathbb{Q}}}
\newcommand{\bbR}{\ensuremath{\mathbb{R}}}
\newcommand{\bbS}{\ensuremath{\mathbb{S}}}
\newcommand{\bbT}{\ensuremath{\mathbb{T}}}
\newcommand{\bbU}{\ensuremath{\mathbb{U}}}
\newcommand{\bbV}{\ensuremath{\mathbb{V}}}
\newcommand{\bbW}{\ensuremath{\mathbb{W}}}
\newcommand{\bbX}{\ensuremath{\mathbb{X}}}
\newcommand{\bbY}{\ensuremath{\mathbb{Y}}}
\newcommand{\bbZ}{\ensuremath{\mathbb{Z}}}

% sf letters
\newcommand{\sfA}{\mathsf{A}}
\newcommand{\sfB}{\mathsf{B}}
\newcommand{\sfC}{\mathsf{C}}
\newcommand{\sfD}{\mathsf{D}}
\newcommand{\sfE}{\mathsf{E}}
\newcommand{\sfF}{\mathsf{F}}
\newcommand{\sfG}{\mathsf{G}}
\newcommand{\sfH}{\mathsf{H}}
\newcommand{\sfI}{\mathsf{I}}
\newcommand{\sfJ}{\mathsf{J}}
\newcommand{\sfK}{\mathsf{K}}
\newcommand{\sfL}{\mathsf{L}}
\newcommand{\sfM}{\mathsf{M}}
\newcommand{\sfN}{\mathsf{N}}
\newcommand{\sfO}{\mathsf{O}}
\newcommand{\sfP}{\mathsf{P}}
\newcommand{\sfQ}{\mathsf{Q}}
\newcommand{\sfR}{\mathsf{R}}
\newcommand{\sfS}{\mathsf{S}}
\newcommand{\sfT}{\mathsf{T}}
\newcommand{\sfU}{\mathsf{U}}
\newcommand{\sfV}{\mathsf{V}}
\newcommand{\sfW}{\mathsf{W}}
\newcommand{\sfX}{\mathsf{X}}
\newcommand{\sfY}{\mathsf{Y}}
\newcommand{\sfZ}{\mathsf{Z}}

\newcommand{\sfa}{\mathsf{a}}
\newcommand{\sfb}{\mathsf{b}}
\newcommand{\sfc}{\mathsf{c}}
\newcommand{\sfd}{\mathsf{d}}
\newcommand{\sfe}{\mathsf{e}}
\newcommand{\sff}{\mathsf{f}}
\newcommand{\sfg}{\mathsf{g}}
\newcommand{\sfh}{\mathsf{h}}
\newcommand{\sfi}{\mathsf{i}}
\newcommand{\sfj}{\mathsf{j}}
\newcommand{\sfk}{\mathsf{k}}
\newcommand{\sfl}{\mathsf{l}}
\newcommand{\sfm}{\mathsf{m}}
\newcommand{\sfn}{\mathsf{n}}
\newcommand{\sfo}{\mathsf{o}}
\newcommand{\sfp}{\mathsf{p}}
\newcommand{\sfq}{\mathsf{q}}
\newcommand{\sfr}{\mathsf{r}}
\newcommand{\sfs}{\mathsf{s}}
\newcommand{\sft}{\mathsf{t}}
\newcommand{\sfu}{\mathsf{u}}
\newcommand{\sfv}{\mathsf{v}}
\newcommand{\sfw}{\mathsf{w}}
\newcommand{\sfx}{\mathsf{x}}
\newcommand{\sfy}{\mathsf{y}}
\newcommand{\sfz}{\mathsf{z}}
