20
0
Files
cdsc_tex/slides_template/example.tex
Benjamin Mako Hill 3aadf6cbeb Tag beamer frame titles as H1 headings for PDF accessibility
Patches the frametitle template to emit tagpdf H1 structure tags,
addressing accessibility reports about missing headings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 15:02:21 -07:00

285 lines
7.5 KiB
TeX

\DocumentMetadata{
pdfversion=2.0,
lang=en-US,
}
\documentclass[10pt,xcolor=dvipsnames,aspectratio=169]{beamer}
\usetheme{metropolis}
\usepackage{appendixnumberbeamer}
\usepackage{tagpdf}
\tagpdfsetup{activate-all}
% Tag frame titles as H1 headings for PDF accessibility
\addtobeamertemplate{frametitle}{%
\tagstructbegin{tag=H1}%
\tagmcbegin{tag=H1}%
}{%
\tagmcend%
\tagstructend%
}
\usepackage{pgfpages}
\input{notes.config}
\usepackage{pgfplots}
\usepgfplotslibrary{dateplot}
\usepackage{booktabs}
\usepackage[scale=2]{ccicons}
% optional metro things
\metroset{numbering=fraction} % page numbering format
\metroset{progressbar=foot} % progress bar in footer
\metroset{sectionpage=none, subsectionpage=none}
\metroset{block=fill}
% \metroset{background=light}
\setsansfont{OpenSans}[
Path = ./fonts/OpenSans/,
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic
]
\setmonofont{RobotoMono}[
Path = ./fonts/RobotoMono/,
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic
]
\definecolor{makopurple1}{RGB}{57,39,91}
\definecolor{makopurple2}{RGB}{137,119,173}
\definecolor{makopurple3}{RGB}{29,13,59}
\definecolor{makopurple4}{RGB}{124,99,173}
% \definecolor{makopurple1}{HTML}{3b255b}
\definecolor{makogreen1}{HTML}{0b7a75}
\definecolor{makovanilla1}{HTML}{d7c9aa}
\definecolor{makoumber1}{HTML}{7b2d26}
\definecolor{makowhite1}{HTML}{f0f3f5}
\setbeamercolor{normal text}{fg=black, bg=white}
\setbeamercolor{alerted text}{fg=makopurple4}
\setbeamercolor{example text}{fg=makoumber1}
\setbeamercolor{palette primary}{bg=makopurple1, fg=normal text.bg}
\setbeamercolor{palette secondary}{bg=makogreen1,fg=normal text.bg}
\setbeamercolor{palette tertiary}{bg=makovanilla1,fg=normal text.bg}
\setbeamercolor{palette quaternary}{bg=makoumber1,fg=normal text.bg}
\setbeamercolor{structure}{fg=makopurple1, bg=normal text.bg} % itemize, enumerate, etc
\setbeamercolor{section in toc}{fg=makopurple1, bg=normal text.bg} % TOC sections
% \setbeamercolor{progress bar}{fg=makopurple1}
% \setbeamercolor{title separator}{fg=makopurple1}
% \setbeamercolor{progress bar in head/foot}{fg=makopurple1}
% \setbeamercolor{progress bar in section page}{fg=makopurple1}
% this is a fix for a bug with XeTeX and notes pages
% see: https://tex.stackexchange.com/questions/232168/normal-text-is-invisible-when-using-beamer-with-notes-and-xelatex
\usepackage{ifthen}
\makeatletter
\def\beamer@framenotesbegin{% at beginning of slide
\ifthenelse{\not \boolean{metropolis@standout}}{%
\usebeamercolor[fg]{normal text}%
\gdef\beamer@noteitems{}%
\gdef\beamer@notes{}%
}{\gdef\beamer@noteitems{}%
\gdef\beamer@notes{}%
}
}
% redfine the notes type to clear things (working around the same bug)
% https://tex.stackexchange.com/questions/28966/change-beamer-notes-list-type-for-in-frame-notes
\def\beamer@setupnote{%
\gdef\beamer@notesactions{%
\beamer@outsideframenote{%
\beamer@atbeginnote%
{\normalfont%
\parskip 0.5em%
\usebeamercolor[fg]{normal text}%
\beamer@notes%
\ifx\beamer@noteitems\@empty\else
\beamer@noteitems%
\fi%
\par}
\beamer@atendnote%
}%
\gdef\beamer@notesactions{}%
}
}
\makeatother
\usepackage{xspace}
\usepackage{relsize}
% add tikz and a bunch of tikz foo
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.misc,backgrounds,fit,positioning}
\tikzstyle{every picture}+=[overlay,remember picture]
% add functions to circle parts of slides (e.g., in tables)
\newcommand\marktopleft[1]{\tagmcbegin{artifact}\tikz \node (marker-#1-a) at (0,1.5ex) {};\tagmcend}
\newcommand\markbottomright[1]{%
\tagmcbegin{artifact}\tikz{\node (marker-#1-b) at (0,0) {};}\tagmcend
\tagmcbegin{artifact}\tikz[dashed,inner sep=3pt]{\node[violet!75,ultra thick,draw,rounded rectangle,fit=(marker-#1-a.center) (marker-#1-b.center)] {};}\tagmcend}
% create an empty quotetxt so we can reuse it
\newcommand{\quotetxt}{}
% more flexible non-tikz alternative with no dropshadow
\newlength{\centertxtlen}
\makeatletter
\newcommand\centertext[2]{%
\setlength{\centertxtlen}{#1}%
\setlength{\centertxtlen}{0.48\centertxtlen}%
{\centering
\fontsize{#1}{2\centertxtlen}\selectfont
\e{#2}
}
}
% packages i use in essentially every document
\usepackage{graphicx}
\usepackage{url}
% \usepackage{dcolumn}
% \usepackage{booktabs}
% replace footnotes with symbols instead of numbers
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\usepackage{perpage}
\MakePerPage{footnote}
% \hypersetup{colorlinks=true, linkcolor=Black, citecolor=Black, filecolor=makopurple1,
% urlcolor=Plum, unicode=true}
% create a new \e{} command to make things purple and bold
\newcommand{\e}[1]{\alert{#1}}
% remove the nagivation symbols
\setbeamertemplate{navigation symbols}{}
\newcommand{\credit}[1]{%
\tikz[overlay]{\node at (current page.south west)
[anchor=south west, yshift=3pt, xshift=2pt]
{\tagmcbegin{artifact}\smaller \smaller {[}#1{]}\tagmcend};}}
\setlength{\parsep}{1em}
\title{Presentation Title}
\subtitle{Presentation Subtitle}
\author[Benj. Mako Hill]{\textbf{Benjamin Mako Hill}\\
makohill@uw.edu}
\institute[UW/Harvard]{\textbf{University of Washington}\\
Department of Communication\\
\emph{Associate Professor}\\
\hspace{1pt}\\
\textbf{Harvard University}\\
Berkman Klein Center\\
\emph{Faculty Associate}}
\date{December 2, 1980}
\begin{document}
% remove some of the space in the itemize to make it quite compact
% \let\olditemize\itemize
% \renewcommand\itemize{\olditemize\itemsep-1pt}
%% SLIDE: Title Slide
\begin{frame}
\titlepage
\tikz{\node at (current page.center) [anchor=center, yshift=-0.5in, xshift=1in]
{\includegraphics[width=0.25\textwidth,alt={Community Data Science Collective logo}]{figures/logo.pdf}};
}
% include version control stuff
\input{vc}
\credit{Revision:\ \VCRevision\ (\VCDateTEX)}
\end{frame}
\section{Introduction}
\begin{frame}
\sectionpage
\note{This is an example section page.}
\end{frame}
%% SLIDE: Slide 2
\begin{frame}{A sample slide, A sample slide, A sample slide, A sample
slide, A sample slide, A sample slide}
A displayed formula:
\[
\int_{-\infty}^\infty e^{-x^2} \, dx = \sqrt{\pi}
\]
An itemized list:
\begin{itemize}
\item<1-> itemized item 1
\item<2-> itemized item 2
\item<3-> itemized item 3
\end{itemize}
\visible<2->{
\begin{example}
\emph{In a right triangle, the square of hypotenuse equals
the sum of squares of two other sides.}
\end{example}
}
\credit{Image credit: Shaw and Hill, 2099.}
\note{These are the slide 2 notes.}
\end{frame}
\begin{frame}
\frametitle{Short frame title}
\e{A first} paragraph.
And then \e{a second} paragraph.
\end{frame}
\subsection{Introductory Subsection}
\begin{frame}
\subsectionpage
\note{This is an example subsection page.}
\end{frame}
\appendix
\begin{frame}[standout]
Example and Data Appendix
\end{frame}
\begin{frame}{A sample slide}
Final Sample Slide
\texttt{Monospace font?}
\note{These are the slide 4 notes.}
\end{frame}
\end{document}
% LocalWords: xcolor dvipsnames beamer ugm phv sep pageofpages px
% LocalWords: titleline alternativetitlepage titlepagelogo Torino
% LocalWords: watermarkheight watermarkheightmult bg makopurple fg
% LocalWords: noparskip colback colframe coltext coltitle fonttitle
% LocalWords: colorlinks linkcolor citecolor filecolor urlcolor
% LocalWords: unicode frametitle subbody subsubbody