# Difference between \mskip and \mkern

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 with mu; conversely, \hskip and \kern (which are also allowed in formulas) must never give units in mu.

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.

I quote from TeX By Topic, which is freely available via texdoc texbytopic:

The \kern command specifies a kern item in whatever mode TeX is currently in. A kern item is much like a glue item without stretch or shrink. It differs from glue in that it is in general not a legal breakpoint. Thus in

.. text .. \hbox{a}\kern0pt\hbox{b}


TeX will not break lines in between the boxes; in

.. text .. \hbox{a}\hskip0pt\hbox{b}


a line can be broken in between the boxes. However, if a kern is followed by glue, TEX can break at the kern (provided that it is not in math mode). In horizontal mode both the kern and the glue then disappear in the break.

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 in mu units, just like \mskip.

The difference between \mkern and \mskip is only that the latter can have stretchability and shrinkability. For instance, the spacing between an ordinary symbol and a relation symbol is obtained by \mskip\thickmuskip (TeX automatically does it); conversely \joinrel, which is internally used for joining dashes in order to build a longer arrow, is \mathrel{\mkern-3mu}, so it will give a fixed (negative) spacing independent on the stretching or shrinking the line will be subject to for justification.

The two commands must be followed by length specifications in mu units (but the stretch or shrink components of a \mskip can be expressed in fil(l)(l) units): 18mu is the em width of the current math symbol font (TeXnically, the font in family 2). Thus 1mu in a superscript will be smaller than 1mu in normal size.

Another usage of \mkern is in \pmod that's used in contexts such as

$42 \equiv 2 \pmod{5}$


that gives

42 ≡ 2 (mod 5)

The definition is

\def\pmod#1{%
\allowbreak\mkern18mu({\operator@font mod}\,\,#1)}


Why is this notable? Because it shows an important feature: TeX only breaks lines inside math formulas only at penalties that it usually adds automatically after relation or operation symbols, but can be inserted manually as in this case. Since \allowbreak means \penalty 0, TeX is allowed to break before the space preceding the open parenthesis. The mkern, if a break is taken there, will disappear.

Actually, saying \mskip18mu instead of \mkern18mu would be the same, as the glue has no stretchability. So the choice between \mkern and \mskip is more conceptual than practical. If logically there should be a kern, use \mkern: this is more efficient (very slightly, to be honest) when macro expansion is concerned, because when TeX has seen the mu unit that ends the specification it won't expand tokens in search for a plus or minus component.

TeX has three "muskip" parameters: \thinmuskip, \medmuskip and \thickmuskip, whose values are usually assigned by

\thinmuskip=3mu
\medmuskip=4mu plus 2mu minus 4mu
\thickmuskip=5mu plus 5mu


If one says \mkern\medmuskip the stretch and shrink components are ignored, just like it happens when a glue parameter is used as argument to \kern.

TeX has also 256 "mskip" registers \muskip0 to \muskip255, but these are rarely used.

• What do you mean by fil(l)(l)? – Lover of Structure May 5 '13 at 12:20
• @LoverofStructure You can use fil, fill or even filll for specifying the various "orders of infinity". – egreg May 5 '13 at 12:23

The other answers have described the difference between kerns and skips (glue) however to pick up on one comment in your question. \mkern (like \kern) does not parse and silently accept plus and minus glue stretch expressions. If given a skip register it will accept that and silently discard the stretch components, and use the natural length, but if passes a literal length it stops after the natural length component, so any following plus or minus is simply typeset:

$1\mskip\thickmuskip a$

$2\mkern\thickmuskip a$

$3 \mskip 5mu plus 5mu a$

$4 \mkern 5mu plus 5mu a$

\def\mythickmuskip{5mu plus 5mu }

$5\mskip\mythickmuskip a$

$6\mkern\mythickmuskip a$

\bye