2

I got the error while creating a pseudocode for my report. The following is my code in LaTeX. This gives out an stating "undefined control sequence \BState ->\State \algbackskip \BState". Kindly help me out with this.

\documentclass{article}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\begin{document}
\begin{algorithm}[H]
  \begin{algorithmic}[1]
    \BState \emph{\textbf{Key(s)}}:
  \end{algorithmic}
\end{algorithm}
\end{document}
Werner
  • 603,163
SUGMAR
  • 23

1 Answers1

2

The part that is causing this problem is an underfined \@algbackskip (which forms part of \BState).

The main algorithmicx package code - algorithmicx.sty - contains a definitions for \@algbackskip, but it's been commented out:

%\def\algbackskip{\hskip-\ALG@thistlm}

My assumption is that this might be a mistake and should be corrected.

enter image description here

\documentclass{article}
\usepackage[noend]{algpseudocode}

\makeatletter
% Reinsert missing \algbackskip
\def\algbackskip{\hskip-\ALG@thistlm}
\makeatother

\begin{document}

\begin{algorithmic}[1]
  \State something
  \If{this}
    \State do this
    \BState do that
  \EndIf
  \BState now this
\end{algorithmic}

\end{document}
Werner
  • 603,163