# Beamer won't let me add an algorithm environment

I am writing a beamer presentation and I keep trying to add an algorithm to it with no success.

I have:

\begin{frame}{Proposed Solutions}{Curve Projection}
\begin{block}{}
Ellipses are implicit surfaces, we can use their gradient to our advantage!
\end{block}

\begin{minipage}{0.45\textwidth}
\begin{algorithmic}[1]

\end{algorithmic}
\end{minipage}
\end{frame}


Which fails to compile with error

Something's wrong, perhaps a mising \item. \end{frame}

Removing the algorithm environment lets it compile,

Adding anything to the algorithm environment. eg:

\begin{frame}{Proposed Solutions}{Curve Projection}
\begin{block}{}
Ellipses are implicit surfaces, we can use their gradient to our advantage!
\end{block}

\begin{minipage}{0.45\textwidth}
\begin{algorithmic}[1]
\Procedure{Find\_distance}{$p_1, p_2$}
\end{algorithmic}
\end{minipage}
\end{frame}


Does not fix the problem

• Try with [fragile] frame option. If this does not help, please add a MWE – samcarter_is_at_topanswers.xyz Apr 15 '18 at 21:06
• Did you load any algorithm-related packages? If so, which ones? – Mico Apr 15 '18 at 21:15

If you have fragile content within the frame, you need the fragile frame option.

\documentclass{beamer}
\usepackage{algpseudocode}

\begin{document}

\begin{frame}[fragile]{Proposed Solutions}{Curve Projection}
\begin{block}{}
Ellipses are implicit surfaces, we can use their gradient to our advantage!
\end{block}

\begin{minipage}{0.45\textwidth}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{minipage}
\end{frame}

\end{document}