我有以下算法代码
\begin{algorithm}[t]
\caption{my algo}
\label{my algo}
\begin{algorithmic}[]
\State \textbf{Input:}{ abc}
\State \textbf{Output:}{ xyz}
\State \textbf{Launch:}{I want to indent the body of this algo afterwards }
% I want to indent the following body:
\For{i=0,i<5,i++}
\For {j=0,i<5,j++ }
\State{Kill}
\State{Now}
\State{There}
\If {this}
\State{then this}}
\EndIf
\For {z=0,z<10,z++ }
\State{Action performed on z}
\EndFor
\State{abc processed }
\State{xyz produced}
\EndFor
% \State{processing done}
\EndFor
\end{algorithmic}
\end{algorithm}
在第三个“State”语句之后,我想缩进算法主体,从 for 循环开始。我该怎么做?目前,for 循环直接从“Launch”语句下开始。
答案1
我用这个技巧解决了同样的问题(改为\transparent{0.5}
用于\transparent{0}
生产)。
\begin{algorithm}[!t]
\caption{}\label{}
\begin{algorithmic}
\STATE whatever
\transparent{0.5}
\vspace{-1\baselineskip}
\IF fake indentation
\transparent{1}
\FOR {this for loop gets now indented}
\STATE whatever
\ENDFOR
\transparent{0.5}
\vspace{-1\baselineskip}
\ENDIF
\transparent{1}
\end{algorithmic}
\end{algorithm}