3

What is the difference between math mode horizontal spacing and text mode horizontal spacing?

Actually, I want to understand, why are few commands used in math mode only (say : and \;) while commands like \quad , \qquad are used in math mode as well as in text mode?

4

Spacing commands for text mode can also be used in math mode, but not conversely, unless you load amsmath (for a couple of them).

The LaTeX kernel defines \, \: and \; for \mskip\thinmuskip, \mskip\medmuskip and \mskip\thickmuskip respectively. For reference

  • \, is the space between an ordinary symbol and an operator or conversely (like in 2\sin x) or after a punctuation symbol;

  • \: is the space around a binary operation symbol (like in a+b);

  • \; is the space around a relation symbol (like in a>b).

However, the LaTeX kernel defines \, to be also used in text mode, inserting a kern of width 0.1667em (3/18-th of an em). If amsmath is loaded, also \: and \; can be used in text mode, inserting kerns of 0.2222em (4/18-th of an em) and 0.2777em (5/18-th of an em). These width are the same natural widths of the math mode spacings, expressed in em units (but the em can differ).

Specific math mode spacing indeed uses mu units, where 18mu is the same as 1em in the math symbol font. Such units can only be used as arguments to \mskip or \mkern, which is legal only in math mode. On the other hand, standard units and \hskip or \kern can appear in math mode as well as in text mode (and em will refer to the font current when math mode was started).

This explains why \quad and \qquad can be used in math mode: they will add 1em of space referring to the current text font. In some rare occasions \hspace can turn out to be useful (notice the emphasis, though).

Further readings

What commands are there for horizontal spacing?

Lengths and when to use them

Difference between \mskip and \mkern

How can we decide a glue or a kern when we are writing a macro?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.