# How can I assign a specific `medmuskip`/`thickmuskip` for a particular binary op./rel., without affected the spacing for other operators?

I know that one can mess with `medmuskip` for binary operators, and `thickmuskip` for binary relations, to change the spacing around them: How to change default for spacing around binary relations?

However, LaTeX does not naturally associate a particular `medmuskip` with a particular operator, instead it associates it with all binary operators: https://tex.stackexchange.com/a/391879/49339

One could define custom spacing around an operator, by making LaTeX forget about any spacing rules it would normally use, and instead use your custom spacing: How to redefine infix (binary, relational) operator spacing so that precedence can be communicated visually?

But the obvious disadvantage of this last solution is that it means you can no longer use the nice things LaTeX does in terms of figuring out how a particular character should be spaced: How does TeX figure out whether a `-` should be typeset as unary, or binary?

The Question: Is there any sort of middle ground? Can I have a symbol that is defined as a math binary operator (e.g. `\mathbin{\&}`) but have it use a custom `\medmuskip= Xmu plus Ymu minus Zmu`, which is different from the `medmuskip` of some other binary operator? In other words, instead of having one `medmuskip` for N operators, can you have N `medmuskips` for N operators?

My guess is: no, not unless you parse math expressions yourself, and then assign custom spacing. Here, PythonTeX and LuaTeX could come in useful (see the discussion here: How does TeX figure out whether a `-` should be typeset as unary, or binary?). However, I'd like to confirm this with the community (since it is much more experienced than I am) that this would not be possible with plain old LaTeX.

• As I already told you, TeX uses a single value of `\medmuskip` (or of the other similar parameters) in a formula. If you do `\newcommand{\myand}{\mskip\muexpr-\medmuskip+Xmu plus Ymu minus Zmu\relax\mathbin{\&}\mskip\muexpr-\medmuskip+Xmu plus Ymu minus Zmu\relax}`, then `\myand` will do what you want, but only when in the context of a Bin atom; when used as a unary operator, this would break. – egreg Sep 19 '17 at 22:53
• as @egreg said, I think this is just re-asking what has been answered previously. – David Carlisle Sep 19 '17 at 22:56
• @egreg I am finding though that applying that solution doesn't make the operator behave like a traditional `mathbin`: instead, it just sticks the specified spacing to the front, and the back, regardless of the placement of the operator. For instance: in an align operator, the custom operator per your suggestion do not align with the operator proper, but instead at the start of the "front" glue. Does that make sense? – user89 Sep 20 '17 at 1:19
• @egreg sorry, that should read: "For instance, in an align environment, a custom operator defined per your answer does not align the operator with `&`, but instead the beginning of the whitespace with the `&`". Hopefully that makes more sense. – user89 Sep 20 '17 at 7:24
• @user89 I didn't test this case, but there is no such thing as the whitespace with the `&`. Anyway, I don't think your idea of showing operator precedence via spacing is really viable. – egreg Sep 20 '17 at 8:34