我有以下 MWE。所需的输出是一行一个制表符的缩进。你看到哪里错了吗?
\documentclass{article}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{geometry,nccmath}
\usepackage{booktabs,caption}
\usepackage{algpseudocode}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\algorithmic}
{\ALG@tlm\z@}{\leftmargin\z@\ALG@tlm\z@}
{}{}
\makeatother
\begin{document}
\begin{algorithm}[H]
\SetArgSty{textnormal}
\SetAlgoLined
\begin{algorithmic}
\Function{Initialization}{$A$,$B$,$C$}
\State{\For{$i \gets 1$ \KwTo $N$,}{\For{$i \gets 1$ \KwTo $nPop$,}{ $A \gets B$\;} \For{$j \gets{} 1$ \KwTo $M$,}{$C\gets 5$\;}}}
\EndFunction
\end{algorithmic}
\caption{Initialization}
\end{algorithm}
\end{document}