haskell-lectures/common/beamer_configuration.tex

85 lines
2.4 KiB
TeX

% packages
\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{minted}
\usepackage{xparse}
% for \verb inside \item
\usepackage[T1]{fontenc}
\usepackage[Q=yes]{examplep}
% color definition
\definecolor{solarized}{HTML}{002B36}
\definecolor{mygreen}{HTML}{009900}
\definecolor{mygrey}{rgb}{0.95,0.95,0.95}
% package configuration
\DeclareGraphicsExtensions{.pdf,.png,.jpg}
\beamertemplatenavigationsymbolsempty
\setbeamertemplate{footline}[frame number]
% minted
%% fix the minted@colorbg environment
\makeatletter
\renewenvironment{minted@colorbg}[1]
{\def\minted@bgcol{#1}%
\noindent
\begin{lrbox}{\minted@bgbox}
\begin{minipage}{\linewidth-2\fboxsep}}
{\end{minipage}%
\end{lrbox}%
\setlength{\topsep}{\smallskipamount}% set the vertical space
\trivlist\item\relax % ensure going to a new line
\colorbox{\minted@bgcol}{\usebox{\minted@bgbox}}%
\endtrivlist % close the trivlist
}
\makeatother
\usemintedstyle{friendly}
\newminted{haskell}{bgcolor=mygrey,frame=single,numbers=left}
\newminted{cpp}{bgcolor=mygrey,frame=single,numbers=left}
\newminted{c}{bgcolor=mygrey,frame=single,numbers=left}
\renewcommand{\theFancyVerbLine}{\ttfamily
\textcolor[rgb]{0.0,0.0,0.0}{\footnotesize
\oldstylenums{\arabic{FancyVerbLine}}}}
% macros and environments
\newcommand{\code}[1]{\texttt{#1}}
\newcommand{\slidep}{\onslide<+->}
\newenvironment{itemizep}
{\begin{itemize}[<+->]}
{\end{itemize}}
\NewDocumentCommand {\slide} { m O{} O{} }
{\begin{frame}{#3}
\frametitle{\thesection.\ifnum\thesubsection=0\else\thesubsection.\fi\ \currentname {#2}}
\input{#1}
\end{frame}}
\NewDocumentCommand {\slidetoc} { }
{\begin{frame}
\frametitle{\thesection. \currentname}
\tableofcontents[currentsection,hideothersubsections]
\end{frame}}
% sections numbered
\setbeamertemplate{section in toc}[sections numbered]
\setbeamertemplate{subsection in toc}[subsections numbered]
\defbeamertemplate{subsubsection in toc}{subsubsections numbered}
{\leavevmode\leftskip=3em%
\rlap{\hskip-3em\inserttocsectionnumber.\inserttocsubsectionnumber.\inserttocsubsubsectionnumber}%
\inserttocsubsubsection\par}
\setbeamertemplate{subsubsection in toc}[subsubsections numbered]
% get current section name
\usepackage{nameref}
\makeatletter
\newcommand*{\currentname}{\@currentlabelname}
\makeatother