latex使用algorithm2e 宏包,即可得到伪代码.
\documentclass
\usepackage[linesnumbered,ruled,lined]{algorithm2e} %导入宏包
\begin{document}
\begin{algorithm}
\caption{abcd}
\LinesNumbered
\KwIn{input}
\KwOut{output}
\For{i in ls}{
l1\\
l2\\
l3
}
\end{algorithm}
\end{document}