# Itemize inside algorithm block Lonely \item error

\documentclass{article}

\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode}%

\begin{document}

\begin{algorithm}
\State \textbf{Inputs:}

\begin{itemize}
\item Input 1
\item Input 2
\end{itemize}

\For{each pixel at row, column (x,y)}
\State Formula 1
\State Formula 2
\State Formula 3
\State Formula 4
\EndFor
\end{algorithm}

\end{document}

I want the text to look exactly like the image here. However, the above latex file gives error "Lonely \item--perhaps a missing list environment". It still compiles and gives the correct output, but the error keeps popping up.

The other answer I found on StackExchange either have no text bullet, or all text bullet.

How can I put itemize inside algorithm like this?

algorithm just provide the algorithm float. You need an algorithmic environment to set the algorithm:

\documentclass{article}

\usepackage{algorithm}
\usepackage{algpseudocode}%

\begin{document}

\begin{algorithm}
\begin{algorithmic}[0]
\State \textbf{Inputs:}

\begin{itemize}
\item Input 1
\item Input 2
\end{itemize}

\For{each pixel at row, column $(x,y)$}
\State Formula 1
\State Formula 2
\State Formula 3
\State Formula 4
\EndFor
\end{algorithmic}
\end{algorithm}

\end{document}
• It still gives "Missing \endcsname inserted" at line "Inputs" and "For{...}" – Duke Le Dec 25 '20 at 6:17
• Nevermind. The problem was using both "algorithmic" and "algpseudocode" packages. It works now, thanks! – Duke Le Dec 25 '20 at 6:26
• @DukeLe: True. algpseudocode is what you actually need from algorithmicx since it includes all the necessary components for use within the algorithmic environment. – Werner Dec 25 '20 at 16:04