[Tex/LaTex] Undefined control sequence. \end{frame}

beamerundefined

I'm using beamer and TexStudio. I am trying to pin down the cause of the error, but I just failed. The problem seems to be quite localized, as other posts with the same problem indicates. The error appears three times, pointing to \end{frame}.

MWE:

\documentclass[10pt,aspectratio=169,hideothersubsections]{beamer}
\usetheme{default}
\usefonttheme[onlymath]{serif}
\usepackage[british]{babel}
\usepackage{amsmath,amsfonts,amssymb,appendixnumberbeamer,array,caption,subcaption,enumerate,lmodern,microtype,multirow,multicol,setspace,pgfplots,tikz,textpos}
\setbeamertemplate{footline}{}
\setbeamertemplate{headline}{}
\usepgfplotslibrary{fillbetween}
\setbeamertemplate{navigation symbols}{}
\setcounter{tocdepth}{1}


\pgfplotsset{ 
    labels at axis tips/.style 2 args={
        compat=1.12,
        xlabel=#1,
        x label style={
            at={(current axis.right of origin)},
            anchor=west
        },
        ylabel=#2,
        y label style={
            at={(current axis.above origin)},
            anchor=south,rotate=-90,
        },
    },
    labels at axis tips/.default={$x$}{$y$}
}

\begin{document}

    \newcommand\lognormal[2]{1/(x*#2*sqrt(2*pi))*exp(-((ln(x)-#1)^2)/(2*#2^2))} % Log-normal function, parameters mu and sigma


\begin{frame}{Test}
    \framesubtitle{\hfill}

    \only<1>{
        Test
    }

    \only<2>{

        \begin{column}[t]{.33\textwidth}
            \begin{figure}
                \centering
                \caption*{1 task}
                \begin{tikzpicture}[scale=0.6]
                \begin{axis}[
                samples=100,
                smooth,
                axis x line=bottom,
                axis y line=left,
                ytick=\empty,
                xtick=\empty,
                %xticklabels={0,$\mu$},
                labels at axis tips={$\eta_{m}$}{$f(\eta_{m})$},
                enlargelimits=upper]
                \addplot[name path=A,thick,domain=0:10] {\lognormal{1}{0.5}};
                \end{axis}
                \end{tikzpicture}   
            \end{figure}
        \end{column}
        \begin{column}[t]{.33\textwidth}
            \begin{figure}
                \centering
                \caption*{2 task}
                \begin{tikzpicture}[scale=0.6]
                \begin{axis}[
                samples=100,
                smooth,
                axis x line=bottom,
                axis y line=left,
                ytick=\empty,
                xtick=\empty,
                %xticklabels={0,$\mu$},
                labels at axis tips={$\eta_{r}$}{$f(\eta_{r})$},
                enlargelimits=upper]
                \addplot[name path=A,thick,domain=0.5:7] {\lognormal{1}{0.3}};          
                \end{axis}
                \end{tikzpicture}       
            \end{figure}
        \end{column}
        \begin{column}[t]{.33\textwidth} % each column can also be its own environment
            \begin{figure}
                \centering
                \caption*{3 task}
                \begin{tikzpicture}[scale=0.6]
                \begin{axis}[
                samples=200,
                smooth,
                axis x line=bottom,
                axis y line=left,
                ytick=\empty,
                xtick=\empty,
                %xticklabels={0,$\mu$},
                labels at axis tips={$\eta_{a}$}{$f(\eta_{a})$},
                enlargelimits=upper]
                \addplot[name path=A,thick,domain=-15:15] {\lognormal{1}{0.8}};
                \end{axis}
                \end{tikzpicture}   
            \end{figure}
        \end{column}
    }

\end{frame}

\end{document}

Best Answer

You are missing the \begin{columns} and \end{columns} around your columns

Related Question