[Tex/LaTex] How to nest \Call in algorithmicx

algorithmserrors

I tried to show something like: Min(Right(x)), when I input the following in my LaTeX manuscript:

\begin{algorithmic}[1]
...
  \State \Return \Call{Min}{\Call{Right}{$x$}}
...
\end{algorithmic}

it report the following error:

! Argument of \equal has an extra }.

                \par 
l.652 ...e \Return \Call{Min}{ \Call{Right}{$x$} }

Any ideas?

Hi,

I just find a quick and dirty way by looking up algpseudocode.sty:

\State \Return \textproc{Min}(\Call{Right}{$x$})

But any better solution are appreciated.

Best Answer

I've stumbled upon this problem before, and found that merely making the command robust fixes it:

\documentclass{article}

\usepackage{fixltx2e}
\usepackage{algpseudocode}

\MakeRobust{\Call}

\begin{document}

\begin{algorithmic}[1]
  \State \Return \Call{Min}{\Call{Right}{$x$}}
\end{algorithmic}

\end{document}