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.
\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\myandwill 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:53mathbin: 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? – bzm3r Sep 20 '17 at 01:19&, but instead the beginning of the whitespace with the&". Hopefully that makes more sense. – bzm3r Sep 20 '17 at 07:24&. Anyway, I don't think your idea of showing operator precedence via spacing is really viable. – egreg Sep 20 '17 at 08:34&" is ambiguous: I mean "the beginning of the whitespace of the custom operator is aligned with the&, rather than the body of the custom operator". Anyway, I expected this wouldn't really be possible, but I just wanted to run it by the community one last time...should I delete this question in your opinion? – bzm3r Sep 20 '17 at 16:11\plfor a+, etc. Eventually, it just all becomes a string of macros, which is difficult to reason with in the un-compiled form (I am not someone who writes everything out on paper first, beforing TeXing it). Overall, I think I ought to ditch the visual precedence idea, and stick to the same old. – bzm3r Sep 20 '17 at 16:14\+instead of\plif you don't need the other uses of those commands (and anyway you can save the old use as\let\oldplus\+) – David Carlisle Sep 20 '17 at 16:31