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.
Best Answer
Thanks to the help of texenthusiast and karlkoeller I solved everything.
algpseudocode
is part ofalgorithmicx
package (documentation).For nested function I just did
To split a 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: