Undefined control sequence. <recently read> \INPUT

Code:

\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}

\begin{document}

\begin{algorithm}[t]
\caption{Dolphinn: Preprocessing (data structure)}
\label{DolphinnPrep}
\begin{algorithmic}
\INPUT{Metric $(\MM, d_{\MM})$, radius $r>0$, approximation factor $c>1$, LSH family $F=F(c,r)$, data set $P \subset \MM$, parameter $d'$.}
\STATE Initialize empty hashtable $T$.
\FOR{$i = 1$ to $d'$}
\STATE Sample $h_i \in F$ u.a.r.
\FOR{each $x \in h_i(P)$}
\STATE{Flip a fair coin and assign the result to $f_i(x)$.}
\ENDFOR
\ENDFOR
\STATE{For all $p \in P$, $f(p)=(f_1(h_1(p)), \ldots, f_{d'}(h_{d'}(p)))$.}
\STATE{For all $p \in P$, add $p$ to the bucket of $T$ with key $f(p)$.}
\end{algorithmic}
\end{algorithm}

\end{document}

Error:

./sample.tex:11: Undefined control sequence.

l.11     \INPUT
{Metric $(\MM, d_{\MM})$, radius $r>0$, approximation factor ...

?

How to fix this?

• The documentation of algorithmic doesn't mention \INPUT. Why do you believe that it should work? – Ulrike Fischer Feb 22 '17 at 11:14
• I was given that code from an overleaf document of another student and he said it works fine @UlrikeFischer, damn! :/ Are you aware of any workaround? I mean by discarding that \INPUT! – gsamaras Feb 22 '17 at 11:15
• look in the document where it works, and copy the definition of \INPUT from there, otherwise hard to guess. defining \INPUT to anything would make the error go away, but wouldn't necessarily do what it does in the other document. – David Carlisle Feb 22 '17 at 11:25
• Yes @DavidCarlisle, this is what I tried to do, but there no other mention of \INPUT, I wonder if I am missing something with that overleaf, never tried it... – gsamaras Feb 22 '17 at 11:28
• put \show\INPUT in the document where it works and TeX will stop and show its definition – David Carlisle Feb 22 '17 at 11:31

You maybe want \INPUTS:

\documentclass{article}
\usepackage{algorithm}
\usepackage{algorithmic}

\newcommand{\MM}{MM}% ???

\begin{document}

\begin{algorithm}[t]
\caption{Dolphinn: Preprocessing (data structure)}
\label{DolphinnPrep}

\begin{algorithmic}
\INPUTS
\STATE Metric $(\MM, d_{\MM})$, radius $r>0$, approximation factor $c>1$,
LSH family $F=F(c,r)$, data set $P \subset \MM$, parameter $d'$.
\ENDINPUTS
\STATE Initialize empty hashtable $T$.
\FOR{$i = 1$ to $d'$}
\STATE Sample $h_i \in F$ u.a.r.
\FOR{each $x \in h_i(P)$}
\STATE Flip a fair coin and assign the result to $f_i(x)$.
\ENDFOR
\ENDFOR
\STATE For all $p \in P$, $f(p)=(f_1(h_1(p)), \ldots, f_{d'}(h_{d'}(p)))$.
\STATE For all $p \in P$, add $p$ to the bucket of $T$ with key $f(p)$.
\end{algorithmic}

\end{algorithm}

\end{document} • Thanks egreg, I will accept your answer as a generic solution. But for my case, the student had forgotten to show me this: \newcommand{\INPUT}{\item[\algorithmicinput]}. – gsamaras Feb 22 '17 at 11:41
• @gsamaras It should be \algorithmicinputs anyway. – egreg Feb 22 '17 at 11:44