TL;DR: I want LaTeX Beamer to lay out elements in a frame exactly as usual, but give me the final say about the order in which overlapping elements occlude each other.
Some context
In CSS, the z-index of an element specifies its position on the axis into or out of the screen. An element with z = 0 is occluded by an overlapping element with z = 1, regardless of where in the CSS code the two elements are defined relative to each other.
In MS PowerPoint's GUI, it is trivial for an element to be "moved to front" and "moved to back".
For LaTeX Beamer, I can only find one 7-y/o thread about this issue, and it is clearly unsatisfactory w.r.t. the above two descriptions of z-index: the answer messes with the background theme, and doesn't actually allow to specify a z-index.
Goal
I have fairly standard Beamer frame code that puts this image under some equation text. The placement is good, but the text and image overlap slightly. Although the image is white where they overlap, Beamer doesn't want to put the image behind my text. Hence, some of it is occluded.
I want to customise their order, whilst using the same environments etc. that I have used. Ideally, I'd wrap some of my code in an unintrusive \zindex{index}{content}
. Even better: a z-index option for the existing environments. Wrapping them in a TikZ picture will probably not work, because that means I have to deal with x-y positioning, which Beamer does correctly already.
I'm quite surprised this isn't a standard Beamer feature. In my experience, it's not uncommon for PDF figures to have plenty of white space near one of their corners, allowing for overlap there without creating an ugly, "PowerPoint-ian" collage.
Two MWEs with their outputs
The following MWE contains the code I'd like to alter minimally:
%%% DOCUMENT %%%
\documentclass{beamer}
\usetheme{Antibes}
\usebeamercolor{dolphin}
%%% IMPORTS %%%
\usepackage{mathtools}
\usepackage{tikz}
%%% MAIN %%%
\begin{document}
\title{Stochastics and statistics -- Slides}
\section{Stochastic variables}
\subsection{Transformations}
\begin{frame}
\frametitle{Example of linear transform}
% Equations
\begin{align*}
f_X(x) &= \begin{dcases}
e^{-x} \qquad &(x\geq 0)\\
0 \qquad &(x<0)
\end{dcases}\\
&\Bigg\downarrow\qquad Y = 2X + 1 \quad\Leftrightarrow\quad X = \frac{Y-1}{2}\\
f_Y(y) &= \begin{dcases}
\frac{1}{2} e^{-\frac{y-1}{2}} \qquad &(y\geq 1)\\
0 \qquad &(y < 1)
\end{dcases}
\end{align*}
\vspace{-1.5cm}
% Figure and warning
\begin{columns}\hspace{0.5cm}
\begin{column}{0.5\paperwidth}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{fig/graph}
\end{figure}
\end{column}
\begin{column}{0.425\paperwidth}
\begin{itemize}
\item Warning: don't forget to transform the bounds!
\end{itemize}
\end{column}
\end{columns}
\end{frame}
\end{document}
The following MWE contains the very unpractical code I have gotten away with currently:
%%% DOCUMENT %%%
\documentclass{beamer}
\usetheme{Antibes}
\usebeamercolor{dolphin}
%%% IMPORTS %%%
\usepackage{mathtools}
\usepackage{tikz}
%%% MAIN %%%
\begin{document}
\title{Stochastics and statistics -- Slides}
\section{Stochastic variables}
\subsection{Transformations}
\begin{frame}
\frametitle{Example of linear transform}
% Space pretending to be equations
{\color{white}\begin{align*}
f_X(x) &= \begin{dcases}
e^{-x} \qquad &(x\geq 0)\\
0 \qquad &(x<0)
\end{dcases}\\
&\Bigg\downarrow\qquad Y = 2X + 1 \quad\Leftrightarrow\quad X = \frac{Y-1}{2}\\
f_Y(y) &= \begin{dcases}
\frac{1}{2} e^{-\frac{y-1}{2}} \qquad &(y\geq 1)\\
0 \qquad &(y < 1)
\end{dcases}
\end{align*}}
\vspace{-1.5cm}
% Figure and warning first
\begin{columns}\hspace{0.5cm}
\begin{column}{0.5\paperwidth}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{fig/graph}
\end{figure}
\end{column}
\begin{column}{0.425\paperwidth}
\begin{itemize}
\item Warning: don't forget to transform the bounds!
\end{itemize}
\end{column}
\end{columns}
% Equations last, floating in a TikZ figure
\begin{tikzpicture}[overlay,remember picture]
\node[text width=10cm, anchor=south west] at (0.25cm,2.75cm) {
\begin{align*}
f_X(x) &= \begin{dcases}
e^{-x} \qquad &(x\geq 0)\\
0 \qquad &(x<0)
\end{dcases}\\
&\Bigg\downarrow\qquad Y = 2X + 1 \quad\Leftrightarrow\quad X = \frac{Y-1}{2}\\
f_Y(y) &= \begin{dcases}
\frac{1}{2} e^{-\frac{y-1}{2}} \qquad &(y\geq 1)\\
0 \qquad &(y < 1)
\end{dcases}
\end{align*}
};
\end{tikzpicture}
\end{frame}
\end{document}
Do not mind the quality of the graph please (we are refurbishing old PowerPoint slides).