22

I'm trying to change medmuskip while using mathtools:

\documentclass{article}
\usepackage{mathtools}
\setlength{\medmuskip}{0mu}
\begin{document}
\end{document}

But this results in an error:

! Illegal unit of measure (pt inserted).
<to be read again>
                   m
l.3 \setlength{\medmuskip}{0mu}

Without mathtools, this works.

Why and what should I do to be able to change medmuskip?

beerbajay
  • 333
  • Probably not really helpful, but if I put \setlength{\medmuskip}{0mu} before \usepackage{mathtools}, it works for me. – MaxD Jul 06 '14 at 13:21

1 Answers1

25

With the usual definition, \setlength{<parameter>}{<value>} is just a wrapper for

<parameter>=<value>\relax

so

\setlength{\medmuskip}{0mu}

is legal, because it translates to

\medmuskip=0mu\relax

which is perfectly legal, as \medmuskip should be assigned values only in mu units (also fil, fill or filll units for the plus and minus parts).

However, when calc is loaded (it's required by mathtools), \setlength changes meaning and mu units are not allowed any more, because calc is oriented to standard lengths only.

There's not much you can do about it other than defining a wrapper yourself:

\newcommand{\setmuskip}[2]{#1=#2\relax}

and do

\setmuskip{\medmuskip}{0mu}

or, say

\setmuskip{\medmuskip}{4mu plus 2mu minus 4mu}

(which is the default).

egreg
  • 1,121,712
  • Nice! So in this case, why not use only \medmuskip=0mu\relax? What is the advantage using a new command? – Sigur Jul 06 '14 at 14:02
  • 3
    @Sigur Uniformity of syntax. – egreg Jul 06 '14 at 14:02
  • @egreg A minor detail, but \medmuskip is 4mu plus 2mu minus 4mu by default (at least according to Section 11.1 in Math mode – v. 2.47). – Tor Jan 12 '16 at 15:59