Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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 8:01
add comment

2 Answers 2

up vote 1 down vote accepted

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}
share|improve this answer
    
Including \usepackage{fixltx2e} somehow breaks my figures, says: ! Extra }, or forgotten \endgroup. when using figure*. Any clues? –  the swine Feb 1 at 10:14
add comment

\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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.