If I am in Math mode, and I want to name a variable, say max-color, here max and color are treated as two different variables and two spaces are placed around the minus sign. Now, what I really meant was a single variable called max-color. How to achieve this inside Math mode.
You can take benefit of
The additional pair of braces will keep the object from being considered an operator as far as spacing is concerned. If you want the variable name to appear in italics, change the definition into
In the following minimal example I use
In order to match the font of the other variables, it is probably best to use
You can conveniently package this as a command via
EDIT I originally thought an extra level of braces around the definition would be needed to make this directly usable in a sub-/superscripts, but T.Verron pointed out they are not necessary in this case.
|show 1 more comment|