Overfull \hbox When Using Overprint in Beamer

Encountered a curiosity and hope to learn something from it.

In the following MWE, the first slide is created without any fuss, but the second slide, which uses the overprint feature, results in two Overfull \hbox... messages in the log:

\documentclass{beamer}

\begin{document}

\begin{frame}\frametitle{First Slide}
\includegraphics[width=0.9\linewidth]{jpgimage1}
\end{frame}

\begin{frame}\frametitle{Second Slide}
\begin{overprint}
\includegraphics<1>[width=0.1\linewidth]{jpgimage1}
\includegraphics<2>[width=0.1\linewidth]{jpgimage2}
\end{overprint}
\end{frame}

\end{document}


Note that I've made the images in the second slide really small, in an attempt to avoid said Overfull... squawks, but with no success in doing so. Feel free to use any images you may have on hand, I think you'll get the same result I did.

Why does this happen? FYI, I found a "workaround" in David Carlisle's answer to this question: Why does the \onslide command in beamer reset the dimension \hfuzz?, but still don't understand what is really going on.

Any enlightenment will be much appreciated.

You can prevent the overfull box by specifying a width wide enough to accommodate your image by using \begin{overprint}[0.11\linewidth].

\documentclass{beamer}

\begin{document}

\begin{frame}\frametitle{First Slide}
\includegraphics[width=0.9\linewidth]{example-image}
\end{frame}

\begin{frame}\frametitle{Second Slide}
\begin{overprint}[0.11\linewidth]
\includegraphics<1>[width=0.1\linewidth]{example-image}
\includegraphics<2>[width=0.1\linewidth]{example-image}
\end{overprint}
\end{frame}

\end{document}

• Interesting, @samcarter...your addition clears up the subject Overfull \hbox... squawk even when I replace same with [0\linewidth]. – Digger Jun 17 '17 at 21:47
• Also, @samcarter, is your solution preferable to adding a \hfuzz=maxdimen line to the code prior to the \begin{overprint} command? – Digger Jun 17 '17 at 21:56
• @Digger There is no general answer which is better - this depends on the situation and your frame layout. Specifying the optional argument of the overprint has the advantage that this width is reserved and in case you have some elements right of the overprint they won't jump between slides. As for the \hfuzz approach, this effectively suppresses the warning, you should make sure that you understand where the warning is coming from and that it does not cause any problems. – user36296 Jun 17 '17 at 22:22