I've already benefited from parbox command to apply some indentation to some lines of my algorithm.
Now, I need to apply indentation to then keyword. As then is automatically generated by \If or ElsIf, I can not use the typical trick of parbox for that.
What I need is depicted in following figure: each then keyword must be aligned w.r.t. its corresponding else if:
My MWE:
\documentclass[letterpaper, 10pt, conference]{IEEEconf}
\let\proof\relax
\let\endproof\relax
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{algorithm}
\usepackage{algorithmicx,algpseudocode}
\newcommand\Sth[1]{S^{#1}\mkern-3mu(\mkern-2.5mu\theta^{\mkern-1mu#1}\mkern-2mu)}
\title{My Title*}
\author{Guy$^{1}$
\thanks{*This work was not supported by any organization}
\thanks{$^{1}$Guy is with Hell, {\tt\small guy@hell.edu}}
}
\algnewcommand\algorithmicforeach{\textbf{for each}}
\algdef{S}[FOR]{ForEach}[1]{\algorithmicforeach\ #1\ \algorithmicdo}
\let\oldReturn\Return
\renewcommand{\Return}{\State\oldReturn}
\begin{document}
\maketitle
\thispagestyle{empty}
\pagestyle{empty}
\begin{abstract}
ABSTRACT
\end{abstract}
\section{INTRODUCTION}
\begin{algorithm}
\renewcommand{\thealgorithm}{}
\caption{algorithm}
\label{euclid}
\begin{algorithmic}[1]
\While{true}
\ForEach{xxx}
\State do $A$
\If{nothing happened}
\State \parbox[t]{\dimexpr\linewidth-\algorithmicindent}{$\text{updated var} \gets \varnothing$\strut}
\ElsIf{objects lie inside the same operating space}
\ForEach{object with sweeping function $S$}
\State \parbox[t]{\dimexpr\linewidth-\algorithmicindent}{$\text{updated var} \gets S$\strut}
\EndFor
\ElsIf{objects lie inside different operating space}
\ForAll{functions $B$}
\ForAll{functions $C$}
\State \parbox[t]{\dimexpr\linewidth-\algorithmicindent}{$\text{updated adjacency} \gets S$\strut}
\EndFor
\EndFor
\EndIf
\Return updated var
\EndFor
\EndWhile\label{euclidendwhile}
\end{algorithmic}
\end{algorithm}
\end{document}



thenand its indentation. – Feb 11 '17 at 21:50