1

I am following this answer, but no luck as you can see:

enter image description here

The frame is being split into two slides, but the first slide is left empty! How to fix this?


\documentclass{beamer}

\def\RR{{\mathbb R}}
\def\Ss{{\mathbb S}}
\def\EE{{\mathbb E}}
\def\Pr{{\mathrm Pr}}
\def\dd{{\mathrm d}}
\def\ee{{\mathrm e}}
\def\MM{{\mathcal M}}
\def\sign{{\mathrm sign}}

\usepackage{algorithm}
\usepackage{algorithmic}
\newcommand{\algorithmicinput}{\textbf{input}}
\newcommand{\INPUT}{\item[\algorithmicinput]}
\newcommand{\algorithmicoutput}{\textbf{output}}
\newcommand{\OUTPUT}{\item[\algorithmicoutput]}

\begin{document}

\begin{frame}[allowframebreaks]{Search}
\begin{algorithm}[H]
    \caption{Dolphinn: Query Algorithm}
    \label{DolphinnQuery}
    \begin{algorithmic}
    \INPUT{Metric $(\MM, d_{\MM})$, LSH family $F$, data set $P \subset \MM$, parameter $d'$, integer StopSearch, query $q$. (We assume that this algorithm has access to the ANN data structure created in Algorithm \ref{DolphinnPrep})}
    \OUTPUT{Point $p \in P$ or "no"}
    %\STATE{Compute $f(q)=(f_1(h_1(q)), f_2(h_2(q)), \ldots, f_{d'}(h_{d'}(q)))$ as folows:}
    \FOR{$i = 1$ to $d'$}
        \IF{$f_i(h_i(q))$ is not defined in Algorithm \ref{DolphinnPrep}}
            \STATE{Flip a fair coin and assign the result to $f_i(h_i(q))$.}
        \ELSE
            \STATE{Compute $f_i(h_i(q))$.}
        \ENDIF
    \ENDFOR

    \STATE{i=0}
    \FOR{\textbf{each} $x$ in $f(P)$ s.t. $\|x-f(q)\|_1\leq  0.5 \cdot d' \cdot (1-p_1)$ }
    \FOR{\textbf{each} point $p$ inside the bucket with key $x$}
    \IF{$d_{\MM}(p,q)\leq c\cdot r$}
        \STATE \textbf{return} $p$.
         \ENDIF
      \STATE{$i\gets i+1$}
     \IF{$i>StopSearch$}
        \STATE \textbf{return} "no". 
       \ENDIF

    \ENDFOR
    \ENDFOR
    \STATE{\textbf{return} "no"}

\end{algorithmic}
\end{algorithm}
\end{frame}
\end{document}
2
  • try removing the "algorithm" environment?
    – mimuller
    Mar 1, 2017 at 20:17
  • Thanks for adding the code. However even after adding the obviously missing documentclass etc. I cannot compile your code due to many Undefined control sequence. errors. Can you make a compilable MWE? Mar 1, 2017 at 22:22

1 Answer 1

4

May something like this do the job?

\documentclass{beamer}

\def\RR{{\mathbb R}}
\def\Ss{{\mathbb S}}
\def\EE{{\mathbb E}}
\def\Pr{{\mathrm Pr}}
\def\dd{{\mathrm d}}
\def\ee{{\mathrm e}}
\def\MM{{\mathcal M}}
\def\sign{{\mathrm sign}}

\usepackage{algorithm}
\usepackage{algorithmic}
\newcommand{\algorithmicinput}{\textbf{input}}
\newcommand{\INPUT}{\item[\algorithmicinput]}
\newcommand{\algorithmicoutput}{\textbf{output}}
\newcommand{\OUTPUT}{\item[\algorithmicoutput]}


\usepackage{caption}

\begin{document}

\begin{frame}[allowframebreaks]{Search}
\rule{\textwidth}{0.5pt}
\captionof{algorithm}{Dolphinn: Query Algorithm}%
\vspace*{-0.5cm}
\rule{\textwidth}{0.5pt}%
\vspace*{-0.5cm}
%\begin{algorithm}[H]
%    \caption{Dolphinn: Query Algorithm}
    \label{DolphinnQuery}
    \begin{algorithmic}
    \INPUT{Metric $(\MM, d_{\MM})$, LSH family $F$, data set $P \subset \MM$, parameter $d'$, integer StopSearch, query $q$. (We assume that this algorithm has access to the ANN data structure created in Algorithm \ref{DolphinnPrep})}
    \OUTPUT{Point $p \in P$ or "no"}
    %\STATE{Compute $f(q)=(f_1(h_1(q)), f_2(h_2(q)), \ldots, f_{d'}(h_{d'}(q)))$ as folows:}
    \FOR{$i = 1$ to $d'$}
        \IF{$f_i(h_i(q))$ is not defined in Algorithm \ref{DolphinnPrep}}
            \STATE{Flip a fair coin and assign the result to $f_i(h_i(q))$.}
        \ELSE
            \STATE{Compute $f_i(h_i(q))$.}
        \ENDIF
    \ENDFOR

    \STATE{i=0}
    \FOR{\textbf{each} $x$ in $f(P)$ s.t. $\|x-f(q)\|_1\leq  0.5 \cdot d' \cdot (1-p_1)$ }
    \FOR{\textbf{each} point $p$ inside the bucket with key $x$}
    \IF{$d_{\MM}(p,q)\leq c\cdot r$}
        \STATE \textbf{return} $p$.
         \ENDIF
      \STATE{$i\gets i+1$}
     \IF{$i>StopSearch$}
        \STATE \textbf{return} "no". 
       \ENDIF

    \ENDFOR
    \ENDFOR
    \STATE{\textbf{return} "no"}

\end{algorithmic}
%\end{algorithm}
\end{frame}
\end{document}

enter image description here

3
  • I am getting Undefined control sequence. <inserted text> ...\textwidth }{0.5pt} \captionof {algorithm}{Dolphinn: Quer... l.184 \end{frame}, any idea?
    – gsamaras
    Mar 2, 2017 at 12:18
  • Did you \usepackage{caption}? Mar 2, 2017 at 12:19
  • No, that was it! =)
    – gsamaras
    Mar 2, 2017 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.