A Beamer snippet for remote presentations

Back in June 2020 when I was preparing my first virtual presentation, I tried leaving the top-right corner of my slides free to include a video of myself in the recordings. Checking that the content of each frame was not overlapping with the webcam was slowing me down, as I needed to open OBS each time to perform as visual check. To avoid the OBS part, I created a small macro that draws a filled rectangle at the webcam’s location in the slides:

% Required packages:
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand{\addwebcamrectangle}[3][orange]{
  % color (defaults to orange), aspect ratio, width
  \newcommand{\drawrectangle}[3]{
    \begin{tikzpicture}[remember picture,overlay]
      \fill[#1] ($(current page.north east)+(-#3,-{#3/#2})$) rectangle (current page.north east);
    \end{tikzpicture}
    }
  \addtobeamertemplate{frametitle}{}{\drawrectangle{#1}{#2}{#3}}
  \addtobeamertemplate{title page}{}{\drawrectangle{#1}{#2}{#3}}
  \addtobeamertemplate{section page}{}{\drawrectangle{#1}{#2}{#3}}
}

% want another color? \addwebcamrectangle[black]{1.33}{3.5}

Adding \addwebcamrectangle{1.33}{3.5} before the \begin{document} draws a rectangle of $4/3$ aspect ratio, on each slide of the document. Now, I only have to check the PDF slides.

Example screenshot:

png