\documentclass[8pt,aspectratio=169,notes]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[most, minted]{tcolorbox}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fancyvrb}
\usepackage{tikz}
\usepackage{colortbl}
\usepackage{booktabs}
\usepackage[super]{nth}
\usepackage{amssymb}
\usepackage[binary-units=true]{siunitx}
\usepackage{booktabs}
\usepackage{pgfpages}

%\setbeameroption{show notes on second screen=left}

\usemintedstyle{emacs}

\makeatletter
% Define commands to select the folder where the Beamer theme lies in
\def\beamer@calltheme#1#2#3{%
  \def\beamer@themelist{#2}
  \@for\beamer@themename:=\beamer@themelist\do
  {\usepackage[{#1}]{\beamer@themelocation/#3\beamer@themename}}}

\def\usefolder#1{
  \def\beamer@themelocation{#1}
}
\def\beamer@themelocation{}

% Patch Table of Content to insert fixed spaces between items instead of vfills
\patchcmd{\beamer@sectionintoc}
  {\vfill}
  {\vskip\itemsep}
  {}
  {}

% New counter for line numbers
\newcounter{verbatim@cnt}

% This is for color band on the linenos in listings
\AtEndEnvironment{Verbatim}{%
  \stepcounter{verbatim@cnt}%
  \protected@write\@auxout{}{%
    \global\protect\@namedef{verbatim@numwidth@\the\c@verbatim@cnt}{%
      \ifnum\c@FancyVerbLine>999
        7.5mm%
      \else\ifnum\c@FancyVerbLine>99
        6mm%
      \else
        4mm%
      \fi\fi
    }%
  }%
}

\def\minted@auto@numwidth#1{%
  \ifcsname verbatim@numwidth@\the\numexpr\c@verbatim@cnt#1\relax\endcsname
    \csname verbatim@numwidth@\the\numexpr\c@verbatim@cnt#1\relax\endcsname
  \else
    4mm%
  \fi
}

\tcbset{bashstyle/.style={
    colframe=black!70,
    listing engine=minted,
    listing only,
    minted style=colorful,
    minted language=console,
    size=fbox,
    breakable,
    enhanced,
    minted options={
      autogobble=true,
      breaklines=true,
      breakbefore=.,
      numbersep=2mm,
    },
  }}

\tcbset{cxx/.style={
    colframe=black!70,
    listing engine=minted,
    listing only,
    minted style=emacs,
    minted language=C++,
    size=fbox,
    breakable,
    enhanced,
    minted options={
      autogobble=true,
      linenos,
      breaklines=true,
      breakbefore=.,
      numbersep=2mm,
      escapeinside=||,
    },
    overlay={%
      \begin{tcbclipinterior}
        \fill[gray!25] (frame.south west) rectangle ([xshift=\dimexpr\minted@auto@numwidth{}\relax]frame.north west);
      \end{tcbclipinterior}
    },
    % in "left", \c@verbatim@cnt is not stepped yet, hence the argument "+1"
    left=\dimexpr\minted@auto@numwidth{+1}\relax,
  }}

% \EscMintinline[options]{<language>}{<backslash-escaped text>}
\def\EscMintinline{%
  \FVExtraRobustCommand
  \RobustEscMintinline
  \FVExtraUnexpandedReadOArgMArgEscVArg}

\NewExpandableDocumentCommand \FVExtraUnexpandedReadOArgMArgEscVArg { o m m } {%
  \IfNoValueTF{#1}
  {\FVExtraAlwaysUnexpanded
    {\FVExtraUnexpandedReadOArgMArgEscVArg{#2}{#3}}}
  {\FVExtraAlwaysUnexpanded
    {\FVExtraUnexpandedReadOArgMArgEscVArg[#1]{#2}{#3}}}%
}

\newrobustcmd\RobustEscMintinline[2][]{%
  % similar to \mintinline
  \begingroup
  \setboolean{minted@isinline}{true}%
  \minted@configlang{#2}%
  \setkeys{minted@opt@cmd}{#1}%
  \minted@fvset
  \begingroup
  \@ifnextchar\bgroup
  {\FVExtraDetokenizeREscVArg{\minted@inline@iii}}%
  {\PackageError{minted}%
    {\string\EscMintinline\space delimiters must be paired curly braces in this context}%
    {Delimit argument with curly braces}}}
\makeatother

\newtcblisting{bashcode}{%
  colframe=black!70,
  width=\linewidth,
  bashstyle,
}

\newtcblisting{consoleoutput}{%
  colback=black,
  colupper=gray!50,
  colframe=black!70,
  listing engine=minted,
  listing only,
  minted style=monokai,
  minted language=console,
  size=fbox,
  breakable,
  enhanced,
  minted options={
    autogobble=true,
    breaklines=true,
    breakbefore=.,
    numbersep=2mm,
  },
%  width=80ex,
}

\newtcblisting{cxxcode}[2][]{
  cxx,
  title={#2},
  #1,
}

\newtcbinputlisting{cxxfile}[2][]{%
  cxx,
  minted options app={
    fontsize=\small,
  },
  listing file={#2},
 % width=80ex,
  #1
}

\newcommand{\cxxinline}[1]{\EscMintinline{C++}{#1}}
\newcommand{\cmd}[1]{\EscMintinline[style=colorful]{console}{#1}}
%newmintinline[cmd]{console}{style=colorful,autogobble}
\newcommand{\code}[1]{\texttt{\bf #1}}

\DeclareSIUnit\flop{FLOP}
\DeclareSIUnit\transfer{T}
\DeclareSIUnit\cycle{c}
\DeclareSIUnit\flops{\flop\per\second}
\DeclareSIUnit\chf{CHF}
\sisetup{per-mode=symbol}
\sisetup{exponent-product = \cdot}
\sisetup{group-separator={\mathrm{'}}}

\definecolor{blue0}{HTML}{002255}
\definecolor{blue1}{HTML}{003380}
\definecolor{blue2}{HTML}{0044AA}
\definecolor{blue3}{HTML}{0055D4}
\definecolor{blue4}{HTML}{0066FF}
\definecolor{blue5}{HTML}{2A7FFF}
\definecolor{blue6}{HTML}{5599FF}
\definecolor{blue7}{HTML}{80B3FF}
\definecolor{blue8}{HTML}{AACCFF}
\definecolor{blue9}{HTML}{D5E5FF}

\definecolor{yellowbrown0}{HTML}{554400}
\definecolor{yellowbrown1}{HTML}{806600}
\definecolor{yellowbrown2}{HTML}{AA8800}
\definecolor{yellowbrown3}{HTML}{D4AA00}
\definecolor{yellowbrown4}{HTML}{FFCC00}
\definecolor{yellowbrown5}{HTML}{FFD42A}
\definecolor{yellowbrown6}{HTML}{FFDD55}
\definecolor{yellowbrown7}{HTML}{FFE680}
\definecolor{yellowbrown8}{HTML}{FFEEAA}
\definecolor{yellowbrown9}{HTML}{FFF6D5}

\definecolor{colShellBg}{HTML}{F5EDE4}
\definecolor{links}{HTML}{2A1B81}
\hypersetup{colorlinks,linkcolor=,urlcolor=links}

\usefolder{scitas_theme}
\usetheme{scitas}

\newcommand{\FIGREP}{figures}
\renewcommand{\arraystretch}{1.3}

% Remove numbering from the ToC when it's spread on multiple frames
\setbeamertemplate{frametitle continuation}{}

\title{{\huge Compiling codes and using MPI/OpenMP}}
\author[M. Peybernes, E. Lanti]{Mathieu Peybernes \\ Emmanuel Lanti}
\date{\nth{18} of February 2022}

\begin{document}
\begin{frame}[plain]
  \titlepage
\end{frame}

% \section{Table of Contents}
% \begin{frame}[allowframebreaks=0.8]
%   \frametitle{Table of Contents}
%   \tableofcontents%[hideallsubsections]
% \end{frame}

% Administration
\input{src/serial/serial}

% Model slide (to be removed)
\input{src/model/model}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-command-extra-options: "-shell-escape"
%%% TeX-master: t
%%% End:
