TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I write a list of C/C++ operators of the following form : \texttt{operator+=}, \texttt{operator-=}, \texttt{operator*=}...

The problem is that \texttt{operator\^=}, \texttt{operator>>=}, \texttt{operator<<=} are interpreted by latex and are not rendered as the other ones.

How to solve this problem ?

share|improve this question
up vote 11 down vote accepted

You can use \verb|operator^=| to print text verbatim.

Or with the listings package you can use \lstinline|^=| to set verbatim text.

If you do this a lot, you can use the command \lstMakeShortInline| to allow you to just type |^=| to set these things. You need to pick a character that won't appear inside your verbatim text. That is, you couldn't do \lstMakeShortInline* if you had verbatim text that included the * character.

share|improve this answer

Try to use \verb or escape it like \texttt{operator\^{}=}.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.