This minimal working example doesn't compile under lualatex on my machine:



results in:

Runaway argument?
undefined\@nil \hat  \@tempa {\check } \@tempa {\tilde } \@tempa {\acute \ETC.
! Paragraph ended before \@tempb was complete.
<to be read again> 
l.950         \noindent##1\par

I am using MacTeX 2015, all packages updated.


2 Answers 2


While egreg is correct to observe that changing the package order fixes this, the test in amsmath.sty could be changed (Barbara:-) to not fall over, specifically it can not cope with the accent command it is testing being undefined (as \meaning does not have the expected form in that case) As a test this makes the original just give warnings not weird internal errors

\def\hat{?? }
\def\check{?? }
\def\tilde{?? }
\def\acute{?? }
\def\grave{?? }
\def\dot{?? }
\def\ddot{?? }
\def\breve{?? }
\def\bar{?? }
\def\vec{?? }



One possible fix would be if amsmath.sty (line 578-9) said

\def\@tempa#1{\@xp\@tempb\meaning#1\@nil#1>? \@nil#1\\}
\def\@tempb#1>#2#3 #4\@nil#5#6\\{%

instead of

\def\@tempb#1>#2#3 #4\@nil#5{%
  • 2
    i sure do wish i could change lots of things in amsmath. the bugs list is more than ten years old, and the overhaul originally put on the schedule about eight years ago and annually shoved off until the next year has now been removed from the department schedule entirely. management thinks that other things are more important. i wish i knew how to remedy the situation, but the best i can do under the circumstances is add this recommendation to the (growing) list. (thanks for being specific with your code.) Commented Oct 12, 2015 at 12:45

Fix the order of the packages; in general, amsmath should be loaded before fontspec. Also, if you plan to declare \setmainfont, you also need to fix an encoding problem due to eulervm having being written before XeTeX and LuaTeX coming into play.



% fix the font used for operators and \mathrm

foo $1+\sin x$

Remove the euler-digits option if you want text digits in math.

enter image description here

  • Note that loading eulervm before fontspec+\setmainfont leads to wrong font being used in \mathrm.
    – yo'
    Commented Oct 12, 2015 at 9:11
  • @yo' That has already been discussed, IIRC. And it's independent of the loading order. I'll add the fix.
    – egreg
    Commented Oct 12, 2015 at 9:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .