I'm using the following packages:

\usepackage{algpseudocode}
\usepackage{algorithm}


but I don't understand what package is algpseudocode, since I can't find the documentation. I have followed this page. What's the difference between it and algorithmicx?

Also, how do I make calls inside a function (e.g. a recursion?) without using \text{...} (the font will be different and it does not look like a function). Here is an example:

\begin{algorithm}
\begin{algorithmic}[1]
\Function {foo}{$a$}
...
\State \Return \text{foo($a-1$)}
\EndFunction
\end{algorithmic}
\end{algorithm}


And how do I make a new line (for instance if a \text{...} is too long)?

Finally, how do I define a \TRUE macro (like the algorithmic package)?

• algpseudocode is part of algorithmicx package, loads algorithmicx also. Excerpt of algorithmicx's documentation "The main diﬀerence is that while the algorithmic package doesn’t allow you to modify predeﬁned structures, or to create new ones,the algorithmicx package gives you full control over the deﬁnitions". Related tex.stackexchange.com/q/63450 – texenthusiast Aug 27 '13 at 12:23
• may be something like this \newcommand{\TRUE}{\textbf{true}} in preamble as done in algorithmic.sty or may be flag based \algdef provided by algorithmicx for defining macro. – texenthusiast Aug 27 '13 at 12:59
• If \TRUE is only a keyword that can appear inside an algorithm, as I suppose, the right definition is \algnewcommand\TRUE{\textkeyword{true}\space} – karlkoeller Aug 27 '13 at 13:43
• Thanks to both of you, \algnewcommand\True{\textbf{true}} did the trick :) – Simon Aug 27 '13 at 15:09
• @Simon You are right, \textkeyword is defined only if you load algpascal or algc. Anyway, leave \space at the end if something can follow \True. – karlkoeller Aug 27 '13 at 15:21

Thanks to the help of texenthusiast and karlkoeller I solved everything.
algpseudocode is part of algorithmicx package (documentation).
For nested function I just did

\begin{algorithm}
\begin{algorithmic}[1]
\Function {foo}{$a$}
...
\State \Return \Call{foo}{$a-1$}
\EndFunction
\end{algorithmic}
\end{algorithm}


To split a long line

\State \parbox[t]{.7\linewidth}{a very very very very very very very very very very very long line}


And for the \True macro I added \algnewcommand\True{\textbf{true}\space} at the beginning of the document.

Here's a fully compilable code:

\documentclass{report}
\usepackage[noend]{algpseudocode}
\usepackage{algorithm}
\algnewcommand\True{\textbf{true}\space}
\algnewcommand\False{\textbf{false}\space}
\begin{document}
\begin{algorithm}
\begin{algorithmic}[1]
\Function {foo}{$a$}
\State \parbox[t]{.7\linewidth}{a very very very very very very very very very very very long line}
\State \Return \Call{foo}{$a-1$}
\EndFunction
\end{algorithmic}
\end{algorithm}
\end{document}