Beamer custom class

Making Beamer not look like Beamer

Prem Mallappa

2 minute read

What is Beamer

Beamer is a presentation making tool using LaTeX. Now, one may ask

What is LaTeX ?
In short, its a document typeset system.

LaTeX(Created by computer hacker Leslie B. Lamport) is a set of macros on top of the raw TeX (A very powerful typesetting system created by Sir Don Knuth.)

Using Metropolis template

\usetheme{metropolis}

Some macros

Here we are re-defining the minted environment not to report errors when it cannot parse.

And using includegraphics to include image which keeps the aspect ratio.

\AtBeginEnvironment{minted}{\renewcommand{\fcolorbox}[4][]{#4}}
\AtBeginSection[]{\begin{frame}<beamer>\frametitle{Topic}\tableofcontents[currentsection]\end{frame}}
\LetLtxMacro{\OldIncludegraphics}{\includegraphics}
\renewcommand{\includegraphics}[2][]{\OldIncludegraphics[height=0.8\textheight,keepaspectratio, #1]{#2}}

The header

Use the metropolis theme to construct the pages, here we are selecting a 16:9 aspect ratio to beamer.

\documentclass[presentation,t,aspectratio=169,allowframebreaks,10pt]{beamer}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\tolerance=1000
\usepackage[outputdir=build/]{minted}
\usepackage{xcolor}
\usepackage[english]{babel}

\usepackage{draftwatermark}
\SetWatermarkText{Confidential}
\SetWatermarkScale{3}
\SetWatermarkFontSize{2cm}
\titlegraphic{\hfill \includegraphics[height=1.5cm]{images/VISHAARGA-logo.png}}
\institute[INST]{Vishaarga Software (P) Ltd. \\\url{http://www.vishaarga.com}}
\usepackage{vspl-beamer-template}

\author{Prem Mallappa}
\date{\today}
\title{Advanced \\ C Programming}

\usepackage{multicol}
\usetheme[sectionpage=none, subsectionpage=progressbar]{metropolis} % Use metropolis theme 

Style

Defining the document colors

\definecolor{vsplblue}{HTML}{00a1e5}
\definecolor{vsplbggray}{HTML}{efefef}
\definecolor{vsplRed}{RGB}{255,  92, 168}
\definecolor{vsplGreen}{RGB}{90, 168,   0}
\definecolor{vsplBlue}{RGB}{0, 152, 233}
\definecolor{vsplYellow}{RGB}{242, 147,  24}
\colorlet{vsplViolet}{vsplRed!50!vsplBlue}
\colorlet{vsplBrown}{vsplRed!50!vsplGreen}
\colorlet{vsplOrange}{vsplRed!50!vsplYellow}
\colorlet{vsplCyan}{vsplGreen!50!vsplBlue}

Now set the document colors using the above definitions

\setbeamercolor{section in toc}{fg=vsplblue,bg=vsplbggray}
\setbeamercolor{subsection in toc}{fg=vsplblue,bg=vsplbggray}
\setbeamercolor{alerted text}{fg=vsplblue!80!gray}
\setbeamercolor*{palette primary}{fg=vsplblue!60!black,bg=gray!30!white}
\setbeamercolor*{palette secondary}{fg=vsplblue!70!black,bg=gray!15!white}
\setbeamercolor*{palette tertiary}{bg=vsplblue!80!black,fg=gray!10!white}
\setbeamercolor*{palette quaternary}{fg=vsplblue,bg=gray!5!white}

\setbeamercolor*{sidebar}{fg=vsplblue,bg=gray!15!white}
\setbeamercolor{progress bar}{fg=vsplYellow}

\setbeamercolor*{palette sidebar primary}{fg=vsplblue!10!black}
\setbeamercolor*{palette sidebar secondary}{fg=white}
\setbeamercolor*{palette sidebar tertiary}{fg=vsplblue!50!black}
\setbeamercolor*{palette sidebar quaternary}{fg=gray!10!white}

%\setbeamercolor*{titlelike}{parent=palette primary}
\setbeamercolor{titlelike}{parent=palette primary,fg=vsplblue}
\setbeamercolor{frametitle}{bg=vsplbggray,fg=vsplblue}
\setbeamercolor{frametitle right}{bg=gray!60!white}

\setbeamercolor{background canvas}{bg=vsplbggray}

Fonts

I have mainly used OSWALD font for headings, and Merriweather for normal font.

Let the fonts rule

\defaultfontfeatures{Ligatures=TeX} % makes this a feature of all selected fonts

\newfontfamily{\titleFont}[%
		Path = fonts/oswald/, %
		UprightFont = *-Regular, %
		ItalicFont = *-RegularItalic, %
		BoldFont = *-Bold,
]{Oswald}
\newenvironment{titlefont}{\titleFont}{\par}
\DeclareTextFontCommand{\texttitleFont}{\titleFont}

\setmainfont[%
	Path= fonts/merriweather/,%
	UprightFont = *-Regular,%
	ItalicFont = *-Italic,%
	BoldFont = *-Bold,%
	SmallCapsFont = *-Regular,%
]{MerriweatherSans}

\setsansfont[%
	Path= ./fonts/merriweather/,%
	UprightFont = *-Regular,%
	ItalicFont = *-Italic,%
	BoldFont = *-Bold,%
	SmallCapsFont = *-Regular,
]{Merriweather}

Set the fonts

\setmonofont{Fira Mono} % sets the monospace font

\setbeamerfont{title}{size=\Huge,family=\titleFont}
\setbeamerfont{section title}{size=\LARGE,family=\titleFont}
\setbeamerfont{frametitle}{size=\LARGE,series=\mdseries,family=\titleFont}

\defbeamertemplate{section in toc}{mine stupid}{%
	{\LARGE\titleFont %
	\inserttocsection\par}}
\setbeamertemplate{section in toc}[mine stupid]

\defbeamertemplate{subsection in toc}{mine stupid}{%
	{\normalsize\titleFont %
	\inserttocsubsection\par}}
\setbeamertemplate{subsection in toc}[mine stupid]

Finally the subsectionpage

\AtBeginSubsection[]
{
  \begin{frame}[plain, t]
	\begin{multicols}{2}
	\vspace*{0.3\textheight}
	{\color{vsplBlue}{\LARGE\titleFont\insertsection}}
	\begin{minipage}{.9\linewidth}
		{\color{vsplYellow}\hrule width \hsize height 1pt} \kern .5mm %
		%{\color{vsplBlue}\hrule width \hsize height 1pt} \kern .5mm %
		%{\color{vsplGreen}\hrule width \hsize height 1pt}
    %\insertprogressbar
	\end{minipage}%
	\vfill
	\pagebreak
       \tableofcontents[%currentsection,
	       currentsubsection, 
         %hideothersubsections, 
         sectionstyle=hide,
         subsectionstyle=show/shaded,
       ]
	\vfill
	\end{multicols}
  \end{frame}
}

The result

Beamer cover page Beamer cover page Beamer cover page split-page