Motivation: giving lectures using beamer, I would like to hide answers from the students' handout. On one slide, I want to ask a question, show the answer after a \pause, ask a second question after a \pause, then show the answer, etc. I applied three solutions found on StackExchange (\hideit, \only<beamer>, and \mode<beamer>).
As the MWE below will show, the PDF when compiled with beamer contains more slides that it should (slides 6 and 10). Indeed, those two slides display all the information and do not make use of the \pause. When using handout, everything is as I want it. I would like the slides under Atmospheric pressure to behave like under Standard Climate Statistics. I am not sure where the code goes awry in the second \frame.
\documentclass[xcolor={dvipsnames},t,serif,mathserif,aspectratio=1610]{beamer}
%%% To create a handout version of the presentation
%\documentclass[xcolor={dvipsnames},handout,serif,mathserif,aspectratio=1610]{beamer}
\mode<presentation>
{
\usetheme{Goettingen}
\usecolortheme{seagull}
}
%To hite text in handout from https://tex.stackexchange.com/questions/266116/trying-to-hide-blocks-of-text-in-beamer
\newcommand\hideit[1]{%
\only<0| handout:1>{\mbox{}}%
\invisible<0| handout:1>{#1}}
\begin{document}
\section{Climate statistics}
%%----------------------------------------------------------%
\begin{frame}[c]{Standard climate statistics}
\begin{itemize}
\item \textcolor{ForestGreen}{Arithmetic mean} (or average)
\pause
\item Sum of the values, x$_i$, divided by the number of observations, N
\end{itemize}
\begin{align}
\hideit{\bar{x_i} = \dfrac{\sum x_i}{N}}
\end{align}
%\begin{align}
% \only<beamer>{\bar{x_i} = \dfrac{\sum x_i}{N}}
%\end{align}
%\mode<beamer>{%
%\begin{align}
% \bar{x_i} = \dfrac{\sum x_i}{N}
%\end{align}
%}
\pause
\begin{itemize}
\item A measure of variability such as \textcolor{ForestGreen}{standard deviation}, S$_n$
\end{itemize}
\pause
\begin{align}
\hideit{S_n = \sqrt{\dfrac{1}{N} \sum^N_{i=1} (x_i - \bar{x_i})^2}}
\end{align}
%\begin{align}
% \only<beamer>{S_n = \sqrt{\dfrac{1}{N} \sum^N_{i=1} (x_i - \bar{x_i})^2}}
%\end{align}
%\mode<beamer>{%
%\begin{align}
% S_n = \sqrt{\dfrac{1}{N} \sum^N_{i=1} (x_i - \bar{x_i})^2}
%\end{align}
%}
\end{frame}
%%----------------------------------------------------------%
\begin{frame}[c]{Atmospheric pressure}
\begin{itemize}
\item How can we calculate the dry air density, $\rho_{air}$?
\end{itemize}
\pause
\begin{align}
\hideit{\rho_{air} =\pause \dfrac{m_{air}}{V_{air}}}
\end{align}
%\begin{align}
% \only<beamer>{\rho_{air} =\pause \dfrac{m_{air}}{V_{air}}}
%\end{align}
%\mode<beamer>{%
%\begin{align}
% \rho_{air} =\pause \dfrac{m_{air}}{V_{air}}
%\end{align}
%}
\pause
\begin{itemize}
\item How can we calculate the mass of a given dry air parcel, $m_{air}$?
\end{itemize}
\pause
\begin{align}
\hideit{m_{air} =\pause n_{air} MM_{air}}
\end{align}
%\begin{align}
% \only<beamer>{m_{air} =\pause n_{air} MM_{air}}
%\end{align}
%\mode<beamer>{%
%\begin{align}
% m_{air} =\pause n_{air} MM_{air}
%\end{align}
%}
\end{frame}
\end{document}