Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

2 Answers 2

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

 
discard

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.