Sign up ×
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 am trying to write an algorithm using algorithmicxand I need to put a function with no parameters.

I use

\Function {foo}{}

latex produces:

function FOO

However I need:

function FOO()

(The same goes for calling a function (i.e. when using \Call{foo}{})

share|improve this question

1 Answer 1

up vote 5 down vote accepted





This way you're passing these macros a non-empty, non-printing argument. Here is a mock example taken from the algorithmicx documentation:

enter image description here

  \caption{Euclid’s algorithm}\label{euclid}
    \Function{Euclid}{\null}\Comment{The g.c.d. of a and b}
      \State $r\gets a\bmod b$
      \While{$r\not=0$}\Comment{We have the answer if r is 0}
        \State $a\gets b$
        \State $b\gets r$
        \State $r\gets a\bmod b$
      \State \textbf{return} $b$\Comment{The gcd is b}
            \State \Call{foo}{\null}
share|improve this answer

Your Answer


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.