\def\filedate{16 July 2020}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Document class for lecture slides.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Version History
% v1.0 Initial version
% v1.0.1 Removed obsolete pgfarrows package.
% v1.0.2 Changed package loading order to ensure that hyperref is last.
% v1.0.3 Tweaked formatting of teaching period output on title page.
% Moved in some useful miscellaneous macros.
% v1.1 Added nochapters option.
% v1.2 Added TikZ package and grid macro, and deprecated PGF.
% v1.3 Added support for configurable class types.
% v1.3.1 Fixed regression that eliminated paper title from title page.
% v1.3.2 Added text highlighting and \alertbf macros.
% v1.3.3 Corrected trailing spacing of \highlight.
% v1.3.4 Added hack to increase itemsep of top-level list items.
% v1.3.5 Added normalem option to ulem package.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[2001/06/01]
\ProvidesClass{lectureslides}%
[2020/07/16 INFO lecture slides style, v.1.3.5]
% "Stream of conciousness" chapters vs. explicit individual classes. NOTE:
% you can't have both chapters and classes! This is because we use the same
% chapter macros for both cases, but they're applied differently (e.g., if
% nochapters is set, then \insertchapternumber represent the class number).
\newif\if@chapters \@chapterstrue
\DeclareOption{nochapters}{\@chaptersfalse}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{beamer}}
\ProcessOptions
\LoadClass{beamer}
% Load required packages.
\RequirePackage{tikz}
\RequirePackage{pgf} % DEPRECATED: only included for backwards compatibility
\RequirePackage[normalem]{ulem}
\RequirePackage{pifont}
\RequirePackage{xr}
\RequirePackage{multido}
% DO NOT REMOVE THE NEXT LINE! The lecturecommon package loads a bunch
% of other packages, some of which are referenced below.
\RequirePackage{lecturecommon}
% Package initialisation.
% Beamer setup.
\mode<presentation>
{
\usetheme{OtagoPlain}
\setbeamertemplate{navigation symbols}{}
}
\if@chapters
\SetClassType{Chapter}
\fi
% hyperref setup. We have to use a slightly convoluted method, because the
% macros referenced here haven't been set yet. Define the hyperref setup
% as a new macro, and call this AFTER initialising the paper and chapter
% variables.
\newcommand{\inithyperref}{%
\hypersetup{%
pdftitle={\PaperCode\ \ClassType\ \thechapter\ Slides},%
pdfsubject={\ShortClassTitle},%
colorlinks=false%
}%
}
% B-I-G braces {} with a text label
%
% Arguments: [#1] height of brace; if missing, defaults to the height of the label box
% {#2} width of box for label
% {#3} the text of the label
%
% TODO: This could possibly be refactored into a single macro with a l/r argument?
\newcommand{\BIGL}[3][]{%
\( \left\}%
\ifx&\else\parbox[c][#1]{0cm}{}\right.\fi%
\begin{minipage}{#2}\flushleft\mbox{}#3\end{minipage}%
\ifx&\right.\fi%
\)%
}
\newcommand{\BIGR}[3][]{%
\( \ifx&\left.\fi%
\begin{minipage}{#2}\flushright\mbox{}#3\end{minipage}%
\ifx&\else\left.\parbox[c][#1]{0cm}{}\fi%
\right\{%
\)%
}
% Bold-face text using the structure or alert colour.
\newcommand<>{\structurebf}[1]{\structure#2{\textbf{#1}}}
\newcommand<>{\alertbf}[1]{\alert#2{\textbf{#1}}}
% Define the standard beamer colours as actual colours, as we use them
% in \color and \textcolor rather a lot.
\usebeamercolor*[fg]{structure}\colorlet{beamerstructure}{fg}
\usebeamercolor*[fg]{alerted text}\colorlet{beameralert}{fg}
% Beamer-aware strikeout.
\newcommand<>{\strikeout}[1]{\alt#2{\sout{#1}}{#1}}
% Coloured highlighting of text (via Mark George).
% \vphantom gives correct ascender and descender height for box.
\newcommand{\highlight}[2][yellow!75]{\setlength{\fboxsep}{1pt}\hskip-1pt\colorbox{#1}{\vphantom{dy}#2}\hskip-1pt}
% Uses the same spacing as \highlight, but does no highlighting. Use on the
% original code when using incremental highlighting.
\newcommand{\nohighlight}[1]{\highlight[white!0]{#1}}
\newcommand{\error}[1]{\highlight[red!75]{#1}}
% Document setup.
\author{}
\if@chapters
\title{\PaperCode}
\else
\title{\PaperCode \\ \PaperTitle}
\fi
\subtitle{\ClassType\ \insertchapternumber: \ClassTitle}
\institute{Department of \DepartmentName}
\date{\TeachingPeriod, \YearOffered}
% Some useful miscellaneous macros.
% Create an "invisible" cell in a table for consistent spacing purposes.
% It does so by taking the width of the supplied text and generating an
% empty box 1pt wider.
\newcommand{\InvisibleCell}[2]{%
\multicolumn{1}{#1}{\makebox[\widthof{#2} + 1pt]{}}%
}
% Draw a grid to aid PGF picture drawing/debugging.
% DEPRECATED: Use \DrawGridTikZ instead.
\newcommand{\DrawGrid}[2]{%
\begin{pgfscope}%
\color{lightgray}%
\pgfsetlinewidth{0.5pt}%
\pgfpathgrid[step={\pgfxy(0.2,0.2)}]{\pgfxy(0,0)}{\pgfxy(#1,#2)}%
\pgfusepath{stroke}%
\pgfsetlinewidth{1pt}%
\pgfpathgrid[step={\pgfxy(1,1)}]{\pgfxy(-0.1,-0.1)}{\pgfxy(#1+0.1,#2+0.1)}%
\pgfusepath{stroke}%
\pgfputat{\pgfxy(0,-0.2)}{\pgfbox[center,top]{\tiny 0}}%
\pgfputat{\pgfxy(-0.2,0)}{\pgfbox[right,center]{\tiny 0}}%
\multido{\nx=1+1}{#1}{\pgfputat{\pgfxy(\nx,-0.2)}{\pgfbox[center,top]{\tiny\nx}}}%
\multido{\ny=1+1}{#2}{\pgfputat{\pgfxy(-0.2,\ny)}{\pgfbox[right,center]{\tiny\ny}}}%
\end{pgfscope}%
}
% Draw a grid to aid TikZ picture drawing/debugging.
\newcommand{\DrawGridTikZ}[2]{%
\begin{scope}[color=lightgray]
\draw[thin,step=1mm] (0.0,0.0) grid (#1,#2);%
\draw[thick,step=1cm] (-0.1,-0.1) grid (#1+0.1,#2+0.1);%
\pgftext[top,at={\pgfxy(0.0,-0.2)}]{\tiny 0}%
\pgftext[right,at={\pgfxy(-0.2,0.0)}]{\tiny 0}%
\foreach \x in {1,...,#1} {\pgftext[top,at={\pgfxy(\x,-0.2)}]{\tiny\x}}%
\foreach \y in {1,...,#2} {\pgftext[right,at={\pgfxy(-0.2,\y)}]{\tiny\y}}%
\end{scope}
}
% For numbered notes, add note number references to the slides when generating notes.
\ifbeamer@notes
\newcounter{noteitem}[page]
\newcommand<>{\noteitem}[1]{\only#2{\refstepcounter{noteitem}\unskip\ \fbox{\textbf{\scriptsize\thenoteitem}}\note[item]{#1}}}
\else
\newcommand<>{\noteitem}[1]{\only#2{\note[item]{#1}}}
\fi
% Sometimes we want to put a comment in tiny text on the next line, but the default line skip
% will insert too much vertical space. Put a \tinyskip at the end of the line instead.
\def\tinyskip{\\[-0.33\baselineskip]}
% Increase item separation of level 1 list items. Can't use enumitem because it breaks beamer lists :(.
% See: <https://tex.stackexchange.com/a/31524>
\makeatletter
\patchcmd{\@listI}{\itemsep3\p@}{\itemsep6\p@}{}{}
\makeatother
\endinput