3

I am trying to write a pseudocode and would like to remove the then statements showing up after if or else if statements.

\documentclass[ijoc,nonblindrev]{informs3}
\usepackage[linesnumbered,ruled,lined, noend]{algorithm2e}

\begin{document}
  \begin{algorithm}
\DontPrintSemicolon
            \uIf{A}{
                do A\\
             }\uElseIf{B}{
                do B\\
            }\Else{
                skip\\
            }
\end{algorithm}
\end{document}

enter image description here

A similar question has been asked here before, but it did not help me in my case.

1 Answer 1

3

Redefine how the if-related keywords are set:

enter image description here

\documentclass{article}

\usepackage[linesnumbered,ruled,lined,noend]{algorithm2e}

% Original definition
% \SetKwIF{If}{ElseIf}{Else}{if}{then}{else if}{else}{end if}%
\SetKwIF{If}{ElseIf}{Else}{if}{}{else if}{else}{end if}%

\begin{document}

\begin{algorithm}
  \uIf{A}{
    do A\;
  }\uElseIf{B}{
    do B\;
  }\Else{
    skip\;
  }
\end{algorithm}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .