3

I'm pretty new to LaTeX. I'm trying to write a pretty simple graphic into a presentation with an aspect ratio of 16:9. I'm using the beamer package and the TikZ package, and this is what I have, which runs fine.

\documentclass[aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{tikzmark, arrows.meta}

\begin{document}

\begin{frame}[aspectratio=169]
\[
\begin{tikzpicture}[baseline=(m.center), every node/.append style={font=\small}]
    \node (m) at (-6,0) {
    $\begin{bmatrix}
        0 & d_{1,2} & \cdots & d_{1,n} \\
        d_{2,1} & 0 & \cdots & d_{2,n} \\
        \vdots  & \vdots  & \ddots & \vdots  \\
        d_{n,1} & d_{n,2} & \cdots & 0 \\
    \end{bmatrix}$
    }; \pause
    
    \node (eq) at (-.5, 0) {
    $\begin{aligned}
        \pi_1 &= \{S^1_1, S^1_2, \ldots, S^1_{q_1}\} \\
        \pi_2 &= \{S^2_1, S^2_2, \ldots, S^2_{q_2}\} \\
        \vdots \\
        \pi_B &= \{S^B_1, S^B_2, \ldots, S^B_{q_B}\} \\
    \end{aligned}$
    }; 
    \draw[->, thick, shorten >=5pt, shorten <=5pt] (m.east) -- (eq.west) node[midway, above, font=\tiny] {sampling} node[midway, below, font=\tiny] {EPA distribution};
    \pause
    
    \node (pi_est) at (4.5, 1.5) {$\pi_{\text{estimate}}$};

    \node (pngs) at (4.5, -2) {$\textbf{IMAGES}$};
    
    \draw[->, thick, shorten >=5pt, shorten <=5pt] (eq.east) -- (pi_est.west) node[midway, sloped, above, font=\tiny] {estimation} node[midway, sloped, below, font=\tiny] {SALSO};

    \draw[->, thick, shorten >=5pt, shorten <=5pt] (eq.east) -- (pngs.west) node[midway, sloped, above, font=\tiny] {Uncertainty Quantification};

\end{tikzpicture}
\]
\end{frame}
\end{document}

Like I said, it runs fine and produces exactly what I want, but at the \end{frame} line it throws me a warning that says "Package keyval Error: aspectratio undefined". Anybody know what's wrong with my code? Thanks!

1
  • Unrelated to your question, but I wouldn't use \pause inside of a tikzpicture. This can have surprising side effects, like making footlines disappear. Tikz comamnds like \draw and \node are overlay aware. It is really not necessary to use such a crude command like \pause. Commented Jun 9, 2023 at 21:43

1 Answer 1

7

aspectratio is only a class option. You must not use it as frame option. What you get is not a warning, it is an error. The code does not run "fine". You should never ignore errors. After an error, latex only recovers enough to syntax check the rest of the document, producing something which might or might not be a valid pdf.

The solution is simple: remove the invalid frame option from your code:

\documentclass[aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{tikzmark, arrows.meta}

\begin{document}

\begin{frame}
\[
\begin{tikzpicture}[baseline=(m.center), every node/.append style={font=\small}]
    \node (m) at (-6,0) {
    $\begin{bmatrix}
        0 & d_{1,2} & \cdots & d_{1,n} \\
        d_{2,1} & 0 & \cdots & d_{2,n} \\
        \vdots  & \vdots  & \ddots & \vdots  \\
        d_{n,1} & d_{n,2} & \cdots & 0 \\
    \end{bmatrix}$
    }; \pause
    
    \node (eq) at (-.5, 0) {
    $\begin{aligned}
        \pi_1 &= \{S^1_1, S^1_2, \ldots, S^1_{q_1}\} \\
        \pi_2 &= \{S^2_1, S^2_2, \ldots, S^2_{q_2}\} \\
        \vdots \\
        \pi_B &= \{S^B_1, S^B_2, \ldots, S^B_{q_B}\} \\
    \end{aligned}$
    }; 
    \draw[->, thick, shorten >=5pt, shorten <=5pt] (m.east) -- (eq.west) node[midway, above, font=\tiny] {sampling} node[midway, below, font=\tiny] {EPA distribution};
    \pause
    
    \node (pi_est) at (4.5, 1.5) {$\pi_{\text{estimate}}$};

    \node (pngs) at (4.5, -2) {$\textbf{IMAGES}$};
    
    \draw[->, thick, shorten >=5pt, shorten <=5pt] (eq.east) -- (pi_est.west) node[midway, sloped, above, font=\tiny] {estimation} node[midway, sloped, below, font=\tiny] {SALSO};

    \draw[->, thick, shorten >=5pt, shorten <=5pt] (eq.east) -- (pngs.west) node[midway, sloped, above, font=\tiny] {Uncertainty Quantification};

\end{tikzpicture}
\]
\end{frame}
\end{document}
2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .