16

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.

Larry
  • 163
  • Hi, welcome to TeX.SX. Note that almost all questions here are about LaTeX so you don't need to mentioned it in the title. Also there is no need to start your post with an opening or closing. We like to have it short. :-) You should indent (La)TeX code by four spaces or use the '101010' button to do this, instead of using pre HTML tags. This way you get correct syntax highlighting. – Martin Scharrer Apr 18 '11 at 08:01

2 Answers2

16

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}
Andrey Vihrov
  • 22,325
  • Including \usepackage{fixltx2e} somehow breaks my figures, says: ! Extra }, or forgotten \endgroup. when using figure*. Any clues? – the swine Feb 01 '14 at 10:14
12

\Call does some internal checking that messes up formatting in some situations. I’ve redefined \Call in my thesis template to omit these checks. The result works quite well:

\renewcommand*\Call[2]{\textproc{#1}(#2)}

However, this means that \Call will now always have parentheses, even if it has no arguments. Personally, I think this is good but it’s no longer the same as the original author intended.

Konrad Rudolph
  • 39,394
  • 22
  • 107
  • 160