[Tex/LaTex] (! LaTeX Error: Not in outer par mode) in presentation

beamerfloats

I am making a presentation and I am trying to add a figure and a caption in a particular frame. But I keep getting this error in the following line

\begin{frame}
    \begin{figure*}[t]
        \includegraphics[scale=0.2]{Case1.pdf}
    \end{figure*}
\end{frame}

when I comment out the \begin{figure} and \end{figure} the error is removed.
And if I remove the begin and end figure I am not able to add the caption below the figure.

Best Answer

beamer supports floats, but doesn't make them float as it does not help or make sense within a presentation. So, drop the float specifier [t]. Additionally, the figure* environment is meant to used in a twocolumn setup that is not natively supported in beamer. So, use figure instead.

Furthermore, there is no need to use a figure environment if you just want to place an image. For that you can just use \includegraphics[.]{..}. However, if you must, you can use figure with a \caption.

enter image description here

\documentclass{beamer}

\begin{document}

\begin{frame}
  % Frame with a "float" and \caption
  \frametitle{Frame title 1}
  \begin{figure}
    \includegraphics[scale=0.2]{example-image}
    \caption{A figure}
  \end{figure}
\end{frame}

\begin{frame}
  % Frame with an image and "caption"
  \frametitle{Frame title 2}
  \centering
  \includegraphics[scale=0.2]{example-image}

  A figure
\end{frame}

\end{document}

Note how beamer doesn't print a number with the \caption within a figure. That's because it's better to repeat a figure than to refer to it much later in the presentation using a number. Consider your audience when using references and perhaps consider using \againframe (if needed).

Related Question