# How do I reduce the space between operators in math mode? [duplicate]

I have these operators +=, -= etc. in Math mode. LaTeX introduces space around single character operators. So I get + = and - = instead.

However, in my case I want no space between the + and the =, and similarly between the - and the = in the second operator.

How do I make them near each other such that there are is no horizontal space between them? I tried to put them in \mathit but it didn't have any effect.

## marked as duplicate by egreg math-mode StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); May 7 '15 at 19:41

• i'm sure this has been asked before, hence a comment, not an answer. wrap each operator in braces, and wrap the whole thing in \mathrel, like this: \mathrel{{+}{=}}' and \mathrel{{=}{+}}. – barbara beeton May 7 '15 at 19:13
• Cheers, I tried to look around but sometimes its a problem to find these things without the right keywords! – jbx May 7 '15 at 19:35
• If you are trying to write C code, you might look at the listings package. – John Kormylo May 7 '15 at 19:44
• @JohnKormylo Thanks. No its not source code. Its still in math mode, defining a transition function of a state with numeric variables. (Its a bit weird I know, I didn't invent it) – jbx May 7 '15 at 23:41

the two symbols aren't in the same class, so they'll invariably get some space in between.

to turn an operator or a relation into an "ordinary" character, wrap it in braces. then, combine them and wrap the whole thing in braces, applying \mathbin or \mathrel as appropriate:

\documentclass{article}
\begin{document}
$a \mathbin{{+}{=}} b \mathrel{{=}{+}} c$
\end{document}


(i'm still sure this has been covered before.)

The operator can also be defined in the preamble so that it can be reused:

\newcommand{\pluseq}{\mathbin{{+}{=}}}

• It has been touched here: tex.stackexchange.com/questions/55701/… – hpekristiansen May 7 '15 at 19:34
• Thanks. I think one can actually also define an operator as follows: \DeclareMathOperator{\pluseq}{\mathbin{{+}{=}}} – jbx May 7 '15 at 19:37
• @jbx No, \DeclareMathOperator is not the right way; just \newcommand is what you need. – egreg May 7 '15 at 19:47
• @egreg Thanks. Yes with \DeclareMathOperator it seems to show it in a different way. For example the *` is vertically aligned to the top, while with your way its correct. Not sure why, but at least it works fine. – jbx May 7 '15 at 23:40