缩进 Latex 算法编号

缩进 Latex 算法编号

我正在使用算法和算法包来纠正算法。但在某些时候,算法编号的缩进混淆了,请参阅代码和图像。

\begin{algorithm}[H]
\begin{algorithmic}[1]
\caption{Decision Tree induction algorithm}
\Function{TreeGrowth}{$E,F$}
\If{$stopping\_cod(E,F) = true$}
\State \emph{leaf}=createNode()
\State \emph{leaf}.label=\(\displaystyle Classify(E) \)
\State return $\emph{leaf}$
\Else
\State root =\(\displaystyle CreateNode() \)
\State root.test_cond=\(\displaystyle find\_best\_split(E,F) \)
\State let \(\displaystyle V \)={\(\displaystyle v|v \) is a possible outcome of \(\displaystyle root.test\_cond\)}
\For{ each $v$ $\in$ $V$ }
\State $E_v$= \{$\emph{e}$\|root.test\_cond($e$)=$v$\,and\,\\\hspace{.02cm} $\emph{e}$\in $E$\}
\State $\emph{child}$ = $TreeGrowth(E_v,F)$
\State add \emph{child} as descendent of \emph{root} and label the end (\emph{root} $\to$ $\emph{child}$ as $\emph{v}$
\EndFor
\EndIf
\end{algorithmic}
\end{algorithm} 

算法的输出

相关内容