7

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

\documentclass{article}
\usepackage{fontspec}
\usepackage{eulervm}
\usepackage{amsmath}

\begin{document}
foo
\end{document}

results in:

(/usr/local/texlive/2015/texmf-dist/tex/latex/amsmath/amsopn.sty)
Runaway argument?
undefined\@nil \hat  \@tempa {\check } \@tempa {\tilde } \@tempa {\acute \ETC.
! Paragraph ended before \@tempb was complete.
<to be read again> 
\par 
l.950         \noindent##1\par
                            }%

I am using MacTeX 2015, all packages updated.

0

2 Answers 2

5

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

\documentclass{article}
\usepackage{fontspec}
\usepackage{eulervm}
\def\hat{?? }
\def\check{?? }
\def\tilde{?? }
\def\acute{?? }
\def\grave{?? }
\def\dot{?? }
\def\ddot{?? }
\def\breve{?? }
\def\bar{?? }
\def\vec{?? }

\usepackage{amsmath}

\begin{document}
foo
\end{document}

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\@tempa#1{\@xp\@tempb\meaning#1\@nil#1}
\def\@tempb#1>#2#3 #4\@nil#5{%
1
  • 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.) Oct 12, 2015 at 12:45
4

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.

\documentclass{article}

\usepackage{amsmath}
\usepackage[euler-digits]{eulervm}
\usepackage{fontspec}

% fix the font used for operators and \mathrm
\DeclareSymbolFont{operators}{\encodingdefault}{\familydefault}{m}{n}

\begin{document}
foo $1+\sin x$
\end{document}

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

enter image description here

2
  • Note that loading eulervm before fontspec+\setmainfont leads to wrong font being used in \mathrm.
    – yo'
    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
    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 .