When a statement of if is long, its then part is printed misaligned as following example:
while
if statement
then
undertand_this
Origin of code comes from following solution. I have following code:
\documentclass[10pt,journal,compsoc]{IEEEtran}
\usepackage[table]{xcolor}
\usepackage{eulervm}
\usepackage{booktabs}
\usepackage{algorithmicx}
\usepackage{tabularx, longtable}
\usepackage{algorithm}
\usepackage[LGR, T1]{fontenc}
\usepackage[noend]{algpseudocode}
\newcommand{\quot}{\textup{\textquotesingle}}
\algnewcommand{\algorithmicor}{$ $ \mathrm{or} $ $}
\algnewcommand{\FALSE}{\textit{false}}
\algnewcommand{\TRUE}{\textit{true}}
\algnewcommand{\NOT}{\textbf{not }}
\algnewcommand{\OR}{\vee}
\algnewcommand{\AND}{\wedge}
\begin{document}
\begin{algorithm}
\caption{The Function}
\hspace{\algorithmicindent} \textbf{Input:} {}
\begin{algorithmic}[1]
\While{$TRUE$}
\If{\begin{tabular}{@{\hspace{}}l@{}}
$alper \AND understand_some_more \AND understand$
\end{tabular}}
\State{}$X = 1$
\EndIf{}
\EndWhile{}~\label{lwhileend:algo-storage}
\end{algorithmic}
\end{algorithm}
\end{document}
It is possible to fix indent of the then, wanted output would be, where then is written inside the if statement:
1: while TRUE do
2: if alper ∧ understand_some_more ∧ underst and
then
3: X = 1



algorithm2epackage, while you usealgpseudocode. Hence it seems thetabulartrick doesn't work for you, and can be removed. – muzimuzhi Z May 18 '22 at 06:39