I am looking for a package that will allow me to write pseudocode
of algorithms. The pseudocode may include mathematical symbols, like
\forall, \in and subscripts. But I would like also to "talk" about
variables contained in the pseudocode in my text, so be able to say "In figure ...
variable foobar corresponds .." and make the word foobar have the same appearance
as in the pseudocode example.
I found that with the listings package
I can add mathematical symbols by using: \begin{lstlisting}[mathescape]. The problem
with this package is that I don't know how to make just one word have the
same appearance as the words appearing inside \begin{lstlisting} ... \end{lstlisting}.
Any ideas how to do this? Or perhaps of another package that will help solve the above mentioned problem?

algorithm2eandalgorithmic– egreg Jul 21 '12 at 09:57keywordis used for this purpose" andkeywordwill have the same style/font as in the algorithm. – foobar Jul 21 '12 at 18:15\begin{lstlisting}\end{lstlisting}is\lstinline{}– knittl Jul 22 '12 at 08:39