I'm writing about programming language Haskell and I need to describe operators named >>= and >>. I wrap all references to names from the programming language in \texttt{ ... }, for example:
We use operator \texttt{+} to add two numbers.
But when I write \texttt{>>}:
We use operator \texttt{>>} to sequence two actions.
I got the "much greater than" sign, which is not what I want (see the image).
I found some questions asking similar problem (“<<” sign in Latex), but the solutions proposed there don't work for me:
The only solution I found is to break \texttt{>>} to \texttt{>}\texttt{>}, but it gets painful when I use longer expressions; for example:
To sequence many actions, use \texttt{a1 >> a2 >> a3 >> ... >> a4}
must be broken to
To sequence many actions, use \texttt{a1 >}\texttt{> a2 >}\texttt{> a3 >}\texttt{> ... >}\texttt{> a4}
I'd rather avoid using \verb, because:
- I want to be consistent with the rest of the text using
\texttt - I sometimes need to use formatting in the code snippets to emphasize a variable or something
P.S.: I do use
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

listingsfor the code sequences – Feb 05 '13 at 13:16listingspackage for automatic formatting of source code, or if you are on *nix, themintedpackage based on Python/Pygments for even superior syntax coloring. – marczellm Feb 05 '13 at 13:17listingsfor multi-line code listings, but didn't know about\lstinline. I'll have a closer look at\lstMakeShortInline, but it doesn't seem to work in\item[...]. – Jan Špaček Feb 05 '13 at 13:43