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)?
Thanks in advance.
algorithmicx
package, loadsalgorithmicx
also. Excerpt of algorithmicx's documentation "The main difference is that while the algorithmic package doesn’t allow you to modify predefined structures, or to create new ones,thealgorithmicx
package gives you full control over the definitions". Related tex.stackexchange.com/q/63450\newcommand{\TRUE}{\textbf{true}}
in preamble as done inalgorithmic.sty
or may be flag based\algdef
provided byalgorithmicx
for defining macro.\TRUE
is only a keyword that can appear inside an algorithm, as I suppose, the right definition is\algnewcommand\TRUE{\textkeyword{true}\space}
\algnewcommand\True{\textbf{true}}
did the trick :)\textkeyword
is defined only if you loadalgpascal
oralgc
. Anyway, leave\space
at the end if something can follow\True
.