What are the differences between \mskip
and \mkern
? The TeXbook writes the following (ch. 18):
You can insert math glue into any formula just by giving the command
‘\mskip
⟨muglue⟩’. […] Similarly, you can use the command ‘\mkern
’ when there is no stretching or shrinking; […]. TeX insists that\mskip
and\mkern
be used only withmu
; conversely,\hskip
and\kern
(which are also allowed in formulas) must never give units inmu
.
Is there anything else to know? Are there standard practices or minor syntactic usage differences to be aware of? For example, \thickmuskip
is defined as 5mu plus 5mu
, but \(X X \mkern\thickmuskip X X\)
(as opposed to \(X X \mskip\thickmuskip X X\)
) compiles just fine, so it seems like \mkern
disables stretching or shrinking but doesn't forbid such expressions for its argument.
Best Answer
I quote from TeX By Topic, which is freely available via
texdoc texbytopic
:The only difference between glue and kerns, aside from stretchability, is whether or not a line or page can break at them. This is equally true in math mode, which can also be broken across lines and pages (though with far fewer legal breakpoints).
Thus, the correct use of
\kern
or\mkern
is to "move the cursor", as for placing symbols on top of each other, eliminating an unwanted space when piecing together a big and notionally unified object from smaller ones, or (dually) creating a space between two objects that ought to appear together anyway.Again, this has nothing to do with math mode, except that
\mkern
must be given its argument inmu
units, just like\mskip
.