# Defining the minimal amount of space around an operator

How do I define the minimal (and possibly maximal) amount of horizontal space around an operator? Something similar to wrapping the operator with \,s.

Here's a picture:

And a minimal example (sorry, I have no idea how to do this with standalone):

\documentclass[12pt]{article}
\usepackage[paperwidth=4.25in,paperheight=5.5in]{geometry}

\usepackage{amssymb}
\usepackage{savetrees}

\begin{document}
Ut consequat place sollicitudin, at sollicitudin nisi
vestibulum varius $\mathbb{C} \setminus A$ semper dolor
lectus, quis lacinia sem hendrerit.
\end{document}

-
you can tweak some of the default spaces, e.g. \setlength{\medmuskip}{0.5mu} \setlength{\thinmuskip}{1mu} \setlength{\thickmuskip}{2mu} or something like \thickmuskip=4.4mu plus 3mu minus 1mu \medmuskip=3.6mu plus 2mu minus 3mu - found this somewhere when trying to do something similar, but can't remember where – prettygully Feb 25 '14 at 4:30
There are two “incarnation” of the reversed slash; one is \setminus, classified as a binary operation (for set difference), the other one is \backslash, which behaves like / (that is, as an ordinary symbol). Usually the set difference is treated as a binary operation. Are you asking about this particular symbol or in general for binary operation symbols? – egreg Feb 25 '14 at 13:49
@egreg: General binary operations. This one along with \cup/\cap are usually the worst. – Blender Feb 25 '14 at 21:50

\setminus is a binary operator, thus TeX inserts \medmuskip around it. To get rid of the space, \setminus can be put into curly braces, then {\setminus} becomes a subformula with spacing rules of an ordinary math atom (\mathord). or \medmuskip can be changed, examples:

\documentclass[12pt]{article}
\usepackage{amssymb}
\begin{document}
\noindent
$\mathbb{C}\setminus A$\\
$\mathbb{C} {\setminus} A$\\
$\medmuskip=0mu \mathbb{C} \setminus A$\\
$\medmuskip=10mu \mathbb{C} \setminus A$
\end{document}


-
One should note that setting \medmuskip affects all binary operation symbols in the formula and that the value current at the end of the formula is used in every instance inside the formula. – egreg Feb 25 '14 at 9:40
Or just use \backslash. – Manuel Feb 25 '14 at 10:34
@Manuel: \backslash is defined int fontmath.ltx as \DeclareMathDelimiter{\backslash}{\mathord}{symbols}{"6E}{largesymbols}{"0F}. – Heiko Oberdiek Feb 25 '14 at 11:26
@HeikoOberdiek Yes, I know. Just saying, in case he wants a \mathord. – Manuel Feb 25 '14 at 12:42

The amount of space around a binary operation symbol is stored in the internal parameter \medmuskip; the standard value is set in fontmath.ltx, which is read at format creation, together with the values of its siblings \thinmuskip (the space inserted between a math operator and an ordinary symbol and in other situations) and \thickmuskip (the space around a relation symbol)

\thinmuskip=3mu
\medmuskip=4mu plus 2mu minus 4mu
\thickmuskip=5mu plus 5mu


The unit mu is 1/18 of an em in the math symbol font, so it adjusts itself according to the font settings.

In the standard Computer Modern fonts at 10pt size, the em in the math symbol font is 10pt (12pt at 12pt font size). It scales when the size is changed by commands such as \large, \small and similar.

So the space is 4mu, extendable to 6mu (or more, if need be, because stretchable glue can stretch without limit, but stretching it more than stated increases the badness of the line) and shrinkable to 0mu.

In order to change it, just add a declaration similar to the default one, say

\setlength{\medmuskip}{6mu plus 1mu minus 6mu}


Note that this glue is automatically inserted, but it's never inserted in subscripts or superscripts. It's compulsory to use mu units.

-
Tried this and got: Illegal unit of measure (pt inserted). – isomorphismes Aug 13 '14 at 13:51
@isomorphismes You are probably loading the calc package; in this case you have to use a lower level instruction: \medmuskip=6mu plus 1mu minus 6mu\relax – egreg Aug 13 '14 at 14:05
Thanks! I bet that Tufte-LaTeX loads it. Wouldn't have caught that myself, thank you for the super-quick response! – isomorphismes Aug 13 '14 at 14:21
@isomorphismes See tex.stackexchange.com/a/188221/4427 – egreg Aug 13 '14 at 14:24