I let the MWE speak for itself.
\documentclass{minimal}
% remove babel and it works
% remove one language and it works
% reorder the languages and it works
\usepackage[italian,spanish,UKenglish]{babel}
% remove the color package and it works
\usepackage{color}
\begin{document}
hi
\end{document}
which outputs
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
…
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ! Missing = inserted for \ifnum. <to be read again> \let l.400 \newcount\nofMPsegments
Best Answer
This is a complement to egreg's answer
The source of the problem is that
etoolbox
henceetex
will be loaded at a time where<
is active. This is not completely catastrophic though, because even with<
active, it might well expand to a catcode 12<
hence could work ok in\ifnum
tests. However when packagecolor
is loaded and used with driverpdftex
it then loads support filesupp-pdf.mkii
for MPS to PDF conversion. This file temporarily modifies the definition of\protect
. And the active<
then gives something unacceptable to\ifnum
.With only
\usepackage[italian,spanish]{babel}
and withoutcolor
there is thus no error.For some reason
spanish.ldf
temporarily makesmakes<
and>
activeduring the time it is loaded byat the very end ofbabel
spanish.ldf
. This activity is cancelled for the rest of the preamble until\AtBeginDocument
by code executed immediately afterbabel.sty
is loaded. In the order\usepackage[spanish, italian]{babel}
the loading ofetoolbox
which was demanded byitalian.ldf
at the end of package Babel is thus executed after the code, also at end of package Babel, which resets to unactive the catcodes of the activated characters by spanish (edit: activated at the very end ofspanish.ldf
itself).In the order of
\usepackage[italian,spanish]{babel}
the end of package Babel demands ofitalian
(which include the loading of packageetoolbox
hence also of packageetex
) are executed before those ofspanish
. As a result this is done at a time where<
is active. Henceetex
definition of\alloc@
is done with an active<
. This is recipe for disaster although as seen above in some circumstances it may remain hidden, becasue the active<
still will extend to a catcode 12<
.I do not know enough the innards of Babel, but it appears to me that
spanish.ldf
should not demand to Babel to reset the catcodes of... in fact I am not sure<
and>
at the end of loading ofbabel.sty
[snip] but do it him/herself at the end ofspanish.ldf
spanish.ldf
makes any explicit demand of this type what I see is that<
and>
,12
,spanish.ldf
one sees it re-activates<
and>
.Babel by default I think resets to
12
the catcodes for the rest of the preamble when the activation was done properly (I do not investigate more, but I tested it in the case ofspanish
by itself).Thus, I recommend this issue should be raised to the
spanish.ldf
andbabel.sty
maintainers. In fact, it would seem that the\csname activatequoting\endcsname
at the end ofspanish.ldf
might be a bug (perhaps should be from what I understand only\let\es@quoting\activatequoting
but not do\shorthandon{<>}
?), as anyhow Babel resets for the rest of the preamble the catcodes to12
.