I have a math mode expression which requires a spacing that doesn't seem to be possible using just the spacing commands like \!, \;, etc. The closest appears to be \!\!, but it has too much space. Is there a way to customize spacing in math mode?
- 539
1 Answers
You don't give many clues but the default values are
\thinmuskip=3mu
\medmuskip=4mu plus 2mu minus 4mu
\thickmuskip=5mu plus 5mu
Although they may be changed by the document class or packages you are using.
so \!\! is -6mu and \!\!\!\; is a stretch length of -4mu plus 5mu (that is will be between -4mu and +1mu depending on the surrounding context).
It is not clear how you are using these values, but (with amsmath) you can use \mspace{..} with arbitrary mu values or (almost always preferable) you can adjust the values of the three mathskips to change the spacing in all cases without adding explicit spacing to each formula.
Note that the reason for the named space commands like \, is they match the space added by TeX's automatic spacing between atoms of different classes, so you can emulate or negate that spacing in some contexts.
x\,x
will always have the same space that Tex adds automatically to a construct such as
\log x
so whatever values a document class gives to \thinmuskip these constructs will change in a consistent way.
However a construct such as
x\!\!\;x
Gives no consistency at all: it might be a positive or negative space depending on the values set for \thinmuskip and \thickmuskip any formula using such a construct is fragile and probably would need editing if typeset with different fonts using different spacing defaults.
If you really need to add explicit space distinct from the named spaces, amsmath provides \mspace as a LaTeX syntax version of \mskip (cf \vspace and \hskip) so you can use
x\mspace{6mu plus 2mu}x
Or whatever space you need.
- 757,742
-
-
@Someone yes, you could have just tried it:-)
\documentclass{article}\usepackage{amsmath}\begin{document}\Huge zz\\$x\mspace{2mu}x$\\$x\mspace{.5mu}\mspace{1.5mu}\mspace{.5mu}x$\end{document}– David Carlisle Oct 11 '20 at 20:54 -
-
@Someone the default values are stretchy not fixed so you may want to specify stretchy values 6mu plus 2mu has a natural length of 6mu and can stretch to 8mu on lines that need stretching (minus components are shrink amounts) – David Carlisle Oct 21 '20 at 13:14
\mkern, for example: https://www.tutorialspoint.com/tex_commands/mkern.htm – Sebastiano Oct 10 '20 at 22:21\mkern x muand choose the value of $x$ that fits your needs. – Bernard Oct 10 '20 at 22:22\!\!you can use\mspace{5mu}or whatever – David Carlisle Oct 10 '20 at 22:22\!\!is negative space of2\thinmuskip\!\!\!\;is space of\thickmuskip-3\thinmuskipwhy would you use these amounts? – David Carlisle Oct 10 '20 at 22:25\!is -3 and\:is +4 and\;is +5. Thus\!\:is +1 and\!\;is +2 and\,is +3 ... and so on. Similarly,\!\!\;is -1 and\!\!\:is -2 ... – Symbol 1 Oct 10 '20 at 22:33\:and\;are rubber glue lengths of variable size, but you can use the values directly no need to use weird combinations of the named lengths. Also one should try to avoid explicit spacing in almost all cases. – David Carlisle Oct 10 '20 at 22:35\mkern? that will lose the plus and minus components ? – David Carlisle Oct 10 '20 at 22:48\mkernand I have written this command. – Sebastiano Oct 11 '20 at 07:52\mskip 2mu plus 1mu minus 2muis half of\:\mkern 2mu plus 1mu minus 2muis a kern of 2mu and then typesetsplus 1mu minus 2muas text, so why\mkernrather than\mskip(or the latex version,\mspace) ? – David Carlisle Oct 11 '20 at 08:46