\documentclass[dvipsnames]{beamer}

\usepackage{xltxtra}
\usepackage{etoolbox}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{polyglossia}
\usepackage[style=american]{csquotes}
\usepackage[backend=biber]{biblatex-chicago}
\usepackage{booktabs}
\usepackage{verse}
\usepackage{tikz}
\usepackage{lipsum}
\usepackage[normalem]{ulem}
\usepackage{multicol}
\usepackage[cache=false]{minted}
\usepackage{ragged2e}
\usepackage{indentfirst}
\usepackage{comment}
\usepackage{wrapfig}
\usepackage{hyperref}

\definecolor{burgundy}{HTML}{990000}
\hypersetup{colorlinks,linkcolor=,urlcolor=burgundy}
\setdefaultlanguage{english}
\usefonttheme{serif}
\setmainfont{Junicode}
\setsansfont{Junicode}
\usetikzlibrary{decorations.text,tikzmark,positioning}
\settowidth{\versewidth}{line length indicated thus}
\setlength{\vrightskip}{-7em}
%\setlength{\vleftskip}{2em}
\setlength{\vgap}{1em}
\newlength{\rightquotedist}
\setlength{\rightquotedist}{85mm}
\newlength{\rightprosequotedist}
\setlength{\rightprosequotedist}{100mm}
\newlength{\longversewidth}
\settowidth{\longversewidth}{length of a hypermetric or Middle Engl verse line}
\verselinenumbersleft
\newcommand{\caes}{\hspace*{1em}}
\newcommand{\halflinegap}{\hspace*{8em}}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{bibliography item}{}
\setbeamerfont{quote}{shape=\upshape,family=\rmfamily}
\addbibresource{slides.bib}

\DefineBibliographyStrings{american}{%
  references = {Bibliography},
}

\newcommand{\lmr}{\fontfamily{lmr}\selectfont}
\newcommand{\cmr}{\fontfamily{cmr}\selectfont}
\let\oldLaTeX\LaTeX
\renewcommand{\LaTeX}{{\lmr\oldLaTeX}\,}
\let\oldXeLaTeX\XeLaTeX
\renewcommand{\XeLaTeX}{{\lmr\oldXeLaTeX}}
\let\oldTeX\TeX
\renewcommand{\TeX}{{\lmr\oldTeX}}
\let\oldXeTeX\XeTeX
\renewcommand{\XeTeX}{{\lmr\oldXeTeX}}

\AtBeginSection[]
{
  \begin{frame}
    \tableofcontents[currentsection]
  \end{frame}
}

\title{The \LaTeX \texttt{beamer} Class}
\date{20 December 2018}
\author{\includegraphics[scale=.44]{by}\newline \href{http://langeslag.org}{P. S. Langeslag}}

\begin{document}

\maketitle

\section{\texttt{biblatex} Questions}

\begin{frame}
	\frametitle{\texttt{biblatex} Questions}
\begin{itemize}
	\item Entry types and character styles
	\item \href{https://tex.stackexchange.com/a/415940/45456}{Disabling the serial comma}
\end{itemize}

\begin{block}{Remember:}
	\begin{itemize}
		\item Separate names with “and”, no comma
		\item Specify page range in format \texttt{5--15}, no “p.” or hyphen
		\item Make use of the \texttt{subtitle} (and \texttt{booksubtitle}) field
		\item Specify a \texttt{langid} for foreign titles
	\end{itemize}
\end{block}
\end{frame}

\section{Overdue Formatting}

\begin{frame}[fragile]
	\frametitle{Paragraph Formatting}

\begin{minted}{latex}
\setlength{\parindent}{2em} % set first-line indent
                            %   (default: 15pt)
\usepackage{parskip}        % load before changing
                            %   parskip length
\setlength{\parskip}{0pt}   % set vertical distance
                            %   between paragraphs
\indent                     % indent current paragraph
\noindent                   % do not indent paragraph
\hangindent=7mm             % use hanging indent
\hangafter{2}               % start hanging after n lines
                            %   (default: 1)
\linespread{1.5}            % set line height
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Document Formatting}
	\begin{block}{Tweaking Space}
\begin{minted}{latex}
\vspace*{3mm}
\vspace*{-3em}
\hspace*{4pt}
\hspace*{-1.2cm}
\hfill
\vfill
\end{minted}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Document Formatting}
	\begin{block}{The \texttt{fullpage} Package}
\begin{minted}{latex}
\documentclass[12pt]{article}
\usepackage{fullpage}
\end{minted}
	\end{block}

	\begin{block}{The \texttt{draft} Option and \texttt{draftwatermark} Package}
\begin{minted}{latex}
% For visual indications of end-of-line
% hyphenation and spacing issues
% (also suppresses images):
\documentclass[draft]{article}

% To print a large (grey)
% "draft" watermark on every page:
\usepackage{draftwatermark}
\end{minted}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{The \texttt{minipage} Environment}
\begin{minted}{latex}
\begin{minipage}[t]{0.6\textwidth}
  \lipsum[2]
\end{minipage}
\hfill
\begin{minipage}[t]{0.37\textwidth}
  \includegraphics{filename}
\end{minipage}
\end{minted}

\begin{block}{Selected Options}
	\begin{itemize}
		\item \texttt{t}: Vertically align baselines of top lines/elements
		\item \texttt{b}: Vertically align baselines of bottom lines/elements
	\end{itemize}
\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{The \texttt{comment} Package}
\begin{minted}{latex}
\usepackage{comment}

\begin{document}

\lipsum[1]

\begin{comment}
\lipsum[2]
\end{comment}

\lipsum[3]
\end{document}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Hyperlinking with the \texttt{hyperref} Package}
\begin{minted}{latex}
\usepackage{hyperref}

\hypersetup{colorlinks,urlcolor=blue,citecolor=}

\begin{document}

Link \href{https://mufi.info}{thus}.
Email links look like \href{mailto:ava@mit.edu}{this}.

\end{document}
\end{minted}

\vspace*{3mm}

Load the \texttt{hyperref} package as late as possible.
\end{frame}

\begin{frame}[fragile]
	\frametitle{Hyperlinking with the \texttt{hyperref} Package}
	\begin{itemize}
		\item Options may be loaded in \mintinline{latex}{\usepackage} or \mintinline{latex}{\hypersetup}
		\item Default visualization is a coloured box; set the \texttt{colorlinks} option to colour the font instead
		\item Separate visualization for URLs, cross-references, citations
		\item Leaving the value field empty means inherit paragraph color
	\end{itemize}

	\begin{table}
		\begin{tabular}{ll}
\toprule
\texttt{urlcolor} & web/email links\\
\texttt{citecolor} & bibliographical links\\
\texttt{linkcolor} & internal links/cross-references\\
\texttt{filecolor} & links to local files\\
\bottomrule
		\end{tabular}
	\end{table}
\end{frame}

\begin{frame}[fragile=singleslide]
	\frametitle{Colour with the \texttt{xcolor} Package}
\begin{minted}{latex}
\usepackage[dvipsnames]{xcolor}
\end{minted}

\begin{block}{Predefined in \texttt{xcolor}, Even without Options}
	\textcolor{black}{black}, \textcolor{blue}{blue}, \textcolor{brown}{brown}, \textcolor{cyan}{cyan}, \textcolor{darkgray}{darkgray}, \textcolor{gray}{gray}, \textcolor{green}{green}, \textcolor{lightgray}{lightgray}, \textcolor{lime}{lime}, \textcolor{magenta}{magenta}, \textcolor{olive}{olive}, \textcolor{orange}{orange}, \textcolor{pink}{pink}, \textcolor{purple}{purple}, \textcolor{red}{red}, \textcolor{teal}{teal}, \textcolor{violet}{violet}, \colorbox{lightgray}{\textcolor{white}{white}}, \textcolor{yellow}{yellow}

	\vspace*{3mm}

	Options like \texttt{dvipsnames} define further colours; see \href{http://mirrors.ctan.org/macros/latex/contrib/xcolor/xcolor.pdf}{manual} §4.

\end{block}

\begin{block}{Defining Your Own Colours}
\begin{minted}{latex}
\definecolor{burgundy}{HTML}{990000}
\end{minted}
\begin{table}
	\begin{tabular}{ll}
\toprule
\bfseries{Model} & \bfseries{Format}\\
\midrule
\texttt{RGB} & \texttt{255,0,12}\\
\texttt{HTML} & \href{https://htmlcolorcodes.com/}{\texttt{CC66FF}}\\
\texttt{cmyk} & \texttt{0,0.5,1,0}\\
Many more! & See manual\\
\bottomrule
	\end{tabular}
\end{table}
\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Colour with the \texttt{xcolor} Package}
	\begin{block}{Applying Colour}
\begin{minted}{latex}
\textcolor{cyan}{Text goes here.} % typical use

\color{orange}Text goes here.     % in a bounded scope

\colorbox{pink}{Text goes here.}  % background colour

\colorbox{pink}{\color{purple}Text goes here.}

\hypersetup{citecolor=purple,urlcolor=blue}
\end{minted}
	\end{block}
\end{frame}

\begin{frame}[fragile=singleslide]
	\frametitle{Syntax Highlighting with the \texttt{minted} Package}
	\begin{verbatim}
\begin{minted}{latex}
  \documentclass{article}
  \usepackage{minted}

  \begin{document}

   \emph{Commands} are now \textbf{highlighted}.

  \end{document}
 \end{minted}
	\end{verbatim}

Inline: \verb|\mintinline{latex}{\printbibliography}|

\begin{itemize}
	\item[\textcolor{red}{!}] Requires you to have \texttt{Pygments} installed.
\end{itemize}

Or use the stock \texttt{verbatim} environment and \mintinline{latex}{\verb} inline command (no highlighting).
\end{frame}

\section{The \texttt{beamer} Class}

\begin{frame}[fragile=singleslide]
	\frametitle{Using The \LaTeX \texttt{beamer} Class}

\begin{minted}{latex}
\documentclass{beamer}

\begin{document}

\begin{frame}
    \frametitle{This Is the First Slide}
    Content goes here
\end{frame}

\begin{frame}
    \frametitle{This Is the Second Slide}
    Content goes here
\end{frame}

\frame{This syntax is also permitted}

\end{document}
\end{minted}
\end{frame}

\begin{frame}
	\frametitle{\texttt{beamer \textbackslash documentclass} Options}
	\begin{table}
		\begin{tabular}{ll}
			\toprule
			\texttt{aspectratio=43}	&		4:3 aspect ratio (default)\\
			\texttt{aspectratio=169}	&	16:9 aspect ratio (160mm x 90mm)\\
			\texttt{aspectratio=1610}	&	16:10 aspect ratio (160mm x 100mm)\\
			\texttt{c}					&	Vertically centre all slides (default)\\
			\texttt{t}					&	Top-align all slides\\
			\texttt{b}					&	Bottom-align all slides\\
			\texttt{10pt}				&	Smaller font\\
			\texttt{12pt}				&	Larger font\\
			\texttt{handout}			&	Suppress overlays (print handout)\\
			\texttt{trans}				&	Suppress overlays (print transparencies)\\
			\texttt{xcolor=...}			&	Load \texttt{xcolor} options\\
			\texttt{hyperref=...}		&	Load \texttt{hyperref} options\\
			\bottomrule
		\end{tabular}
	\end{table}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\texttt{frame} Options}
	\begin{table}
		\begin{tabularx}{\textwidth}{lX}
			\toprule
			\texttt{c}	&	Vertically centre content (default)\\
			\texttt{t}	&	Vertically align content at top\\
			\texttt{b}	&	Vertically align content at bottom\\
			\texttt{allowframebreaks}	&	Move surplus content to next slide\\
			\texttt{fragile}	&	Protect against package conflicts\\
			\texttt{plain}	&	Use all available space for content\\
			\texttt{shrink}	&	Shrink font size to maximize text content\\
			\bottomrule
		\end{tabularx}
	\end{table}

	\vspace*{3mm}
	Best use \texttt{allowframebreaks} for bibliographies only.
\end{frame}

\begin{frame}[fragile=singleslide]
	\frametitle{\texttt{beamer} Document Structure}
	\begin{block}{\texttt{\textbackslash part}, \texttt{\textbackslash section}, \texttt{\textbackslash subsection}, and \texttt{\textbackslash subsubsection}}
		No visible output by default; the following changes this:

\begin{minted}{latex}
\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}
\end{minted}
	\end{block}
\begin{block}{\texttt{\textbackslash tableofcontents}}
Relies on \mintinline{latex}{\part}, \mintinline{latex}{\section}, \mintinline{latex}{\subsection}, and \mintinline{latex}{\subsubsection}.
\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Themes}
\begin{minted}{latex}
\usetheme{themeName}
\end{minted}

\begin{block}{Themes}
\begin{multicols}{3}
\begin{itemize}
	\item default
	\item AnnArbor
	\item Antibes
	\item Bergen
	\item Berkeley
	\item Berlin
	\item boxes
	\item CambridgeUS
	\item Copenhagen
	\item Darmstadt
	\item Dresden
	\item Frankfurt
	\item Goettingen
	\item Hannover
	\item Ilmenau
	\item JuanLesPins
	\item Luebeck
	\item Madrid
	\item Malmoe
	\item Marburg
	\item Montpellier
	\item PaloAlto
	\item Pittsburgh
	\item Rochester
	\item Singapore
	\item Szeged
	\item Warsaw
\end{itemize}
\end{multicols}
\end{block}

See comparison matrix at \href{https://hartwork.org/beamer-theme-matrix/}{hartwork.org/beamer-theme-matrix/}.
\end{frame}

\begin{frame}[fragile]
	\frametitle{Colour Themes}
\begin{minted}{latex}
\usecolortheme{colorThemeName}
\end{minted}

\begin{block}{Colour Themes}
\begin{multicols}{3}
\begin{itemize}
	\item default
	\item albatross
	\item beaver
	\item beetle
	\item crane
	\item dolphin
	\item dove
	\item fly
	\item lily
	\item orchid
	\item rose
	\item seagull
	\item seahorse
	\item whale
	\item wolverine
\end{itemize}
\end{multicols}
\end{block}

See comparison matrix at \href{https://hartwork.org/beamer-theme-matrix/}{hartwork.org/beamer-theme-matrix/}.
\end{frame}

\begin{frame}[fragile]
	\frametitle{Pick and Mix}
	\begin{minted}{latex}
\useoutertheme{outerThemeName}
\useinnertheme{innerThemeName}
	\end{minted}

	\begin{block}{Outer Themes}
		\begin{multicols}{3}
			\begin{itemize}
				\item infolines
				\item miniframes
				\item shadow
				\item sidebar
				\item smoothbars
				\item smoothtree
				\item split
				\item tree
			\end{itemize}
		\end{multicols}
	\end{block}

	\begin{block}{Inner Themes}
		\begin{multicols}{3}
			\begin{itemize}
				\item rectangles
				\item circles
				\item inmargin
				\item rounded
			\end{itemize}
		\end{multicols}
	\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Font Themes}
\begin{minted}{latex}
\usefonttheme{serif}
\end{minted}

	\begin{block}{Available Font Themes}
		\begin{minipage}[t]{0.42\textwidth}
			\begin{itemize}
				\item \texttt{default}
				\item \texttt{professionalfonts}
				\item \texttt{serif}
			\end{itemize}
		\end{minipage}
		\hfill
		\begin{minipage}[t]{0.56\textwidth}
			\begin{itemize}
				\item \texttt{structurebold}
				\item \texttt{structureitalicserif}
				\item \texttt{structuresmallcapsserif}
			\end{itemize}
		\end{minipage}

		\vspace*{3mm}
		
		Several have options, e.g.:

		\begin{minted}{latex}
\usefonttheme[stillsansseriflarge]{serif}
		\end{minted}

See the \texttt{beamer} manual for details.
	\end{block}

\end{frame}

\begin{frame}[fragile]
	\frametitle{\texttt{beamer} Template Design}
\begin{minted}{latex}
\setbeamertemplate{navigation symbols}{}

\setbeamertemplate{bibliography item}{}

\setbeamertemplate{blocks}[rounded][shadow=true]

\setbeamertemplate{background canvas}[vertical shading]
[top=palette primary.bg,middle=white,bottom=palette
 primary.bg]

\setbeamertemplate{sidebar canvas left}[horizontal
 shading][left=white!40!black,right=black]
\end{minted}
\end{frame}

\begin{frame}[fragile]
\frametitle{\texttt{beamer} Colours}
\begin{minted}{latex}
\setbeamercolor{background canvas}{bg=white}

\setbeamercolor{normal text}{bg=white,fg=cyan}

\setbeamercolor{alerted text}{fg=purple}

\setbeamercolor{block title}{fg=red}

\setbeamercolor{frametitle}{fg=blue}

\setbeamercolor{title}{fg=violet}

\setbeamercolor{quote}{fg=blue}

\setbeamercolor{bibliography item}{fg=black}
\end{minted}

. . . and many more; see manual or WikiBooks.
\end{frame}

\begin{comment}
\begin{frame}[fragile]
\frametitle{\texttt{beamer} Colour Palettes}
To ensure colour themes work across themes, outerthemes rely on these colour definitions:

\begin{itemize}
	\item \texttt{palette primary}
	\item \texttt{palette secondary}
	\item \texttt{palette tertiary}
	\item \texttt{palette quaternary}
\end{itemize}

These are set as one would set any colour:

\begin{minted}{latex}
\setbeamercolor{palette primary}{fg=BlueViolet}
\end{minted}

\end{frame}
\end{comment}



\begin{frame}[fragile]
	\frametitle{\texttt{beamer}-Specific Page, Font, and Paragraph Defaults}
	\begin{itemize}
		\item Landscape
		\item Sans serif
		\item Block paragraphs (nonzero \mintinline{latex}{\parskip}; zero \mintinline{latex}{\parindent})
		\item \texttt{quote} environments produce italics
	\end{itemize}

	\vspace*{6mm}

You may reset that last value thus:

\begin{minted}{latex}
\setbeamerfont{quote}{shape=\upshape}
\end{minted}

And, if you like, set off its appearance using colour instead:

\begin{minted}{latex}
\setbeamercolor{quote}{fg=blue}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{\texttt{beamer}-Specific Float Defaults}
	\begin{itemize}
		\item Centred
		\item Unnumbered
		\item Placed “here”
	\end{itemize}

	\vspace*{6mm}

	You may number your floats as follows:

\begin{minted}{latex}
\setbeamertemplate{caption}[numbered]
\end{minted}

\end{frame}

\begin{frame}[fragile]
	\frametitle{Using \texttt{hyperref}}
	Loaded by default in \texttt{beamer}; set options using \mintinline{latex}{\hypersetup} or as follows:

\vspace*{3mm}

\begin{minted}{latex}
\documentclass[hyperref={colorlinks,urlcolor=red}]{beamer}
\end{minted}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Using \texttt{xcolor}}
	Loaded by default in \texttt{beamer}; set options as follows:

\vspace*{3mm}

\begin{minted}{latex}
\documentclass[xcolor=dvipsnames]{beamer}
\end{minted}

\vspace*{3mm}

instead of

\vspace*{3mm}

\begin{minted}{latex}
\documentclass{beamer}
\usepackage[dvipsnames]{xcolor}
\end{minted}
\end{frame}

\begin{frame}[fragile=singleslide]
	\frametitle{Withholding Part of a Frame}
	\begin{minipage}[t]{0.48\textwidth}
	\begin{block}{Using \textbackslash pause}
	\begin{minted}[autogobble]{latex}
\begin{frame}

  Element 1

  \pause

  Element 2

  \pause

  Element 3

\end{frame}
\end{minted}
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t]{0.48\textwidth}
	\begin{block}{One Item Per Slide}
\begin{minted}{latex}
\begin{itemize}[<+->]
  \item 1...
  \item 2...
  \item 3...
\end{itemize}
\end{minted}
\end{block}
\end{minipage}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Columns}
	As an alternative to \texttt{minipage} environments, in \texttt{beamer} you can use \texttt{columns}:

\begin{minted}{latex}
\begin{columns}[c] % vertically centred
  \column{.5\textwidth}
    Content goes here
  \column{.5\textwidth}
    Content goes here
\end{columns}
\end{minted}

\begin{block}{Selected Options}
\begin{itemize}
	\item \texttt{t}: Vertically align baselines of columns’ first lines
	\item \texttt{T}: Vertically align tops of columns’ first lines
	\item \texttt{c}: Vertically centre
	\item \texttt{b}: Vertically align columns’ bottom lines
\end{itemize}
\end{block}
\end{frame}

\begin{frame}[fragile]
	\frametitle{The \texttt{block} Environments}
\begin{minted}{latex}
\begin{block}{A Regular Block}
  Content goes here.
\end{block}

\begin{alertblock}{An Alert Block}
  Content goes here.
\end{alertblock}

\begin{exampleblock}{An Example Block}
  Content goes here.
\end{exampleblock}
\end{minted}
\end{frame}

\begin{frame}[fragile=singleslide]
	\frametitle{Bibliography Slides}
	\begin{verbatim}
\begin{frame}[t,allowframebreaks]
  \printbibliography
\end{frame}
	\end{verbatim}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Breakage}

	\begin{block}{Known Issues}
		\begin{itemize}
			\item \texttt{xcolor} and \texttt{tikz}
				\begin{itemize}
					\item Load \texttt{xcolor} options in \mintinline{latex}{\documentclass}
				\end{itemize}
			\item \texttt{minted}
				\begin{itemize}
					\item use the \texttt{fragile} or \texttt{fragile=singleslide} option on \texttt{frame}
				\end{itemize}
			\item \texttt{polyglossia} and \mintinline{latex}{\usefonttheme{}}
				\begin{itemize}
					\item Issue \mintinline{latex}{\usefonttheme{}} \emph{before} loading \texttt{polyglossia}:
				\end{itemize}
		\end{itemize}

\begin{minted}{latex}
\usepackage{fontspec}
\usefonttheme{serif}
\usepackage{polyglossia}
\end{minted}
	\end{block}

	\vspace*{3mm}

	(Otherwise your \mintinline{latex}{\usefonttheme{}} command has no effect.)
\end{frame}

\begin{frame}[t]
\frametitle{Bibliography}
\nocite{beamer}
\nocite{xcolor}
\nocite{wikibooklatex}
\printbibliography
\end{frame}

\end{document}
