I am trying to define a function in LaTeX pseudocode, as shown below.

```
\begin{algorithm}
\begin{algorithmic}[1]
\Function{Increment}{$a$}
.....
\EndFunction
\end{algorithmic}
\end{algorithm}
```

However, when I compile, I get the error, `undefined control sequence \Function{Increment}{$a$}.`

What mistake am I doing here and how can I solve it?

## Best Answer

Like Vikram said: use

`algpseudocode`

from the`algorithmicx`

package, it’s superior to the other pseudocode packages.Then you can do the following: