# LuaLaTeX engine, babel and pdfx package

There is one error with the combination of spanish babel, pdfx package, and LuaLaTex engine, how it is very easy to test with this MWE:

\documentclass{article}

\usepackage[spanish]{babel}

\usepackage{amsmath}
\usepackage{pdfx}

\begin{document}

\begin{equation*}
P_{\max}=0.1
\end{equation*}

\end{document}


The .log contains

! Illegal unit of measure (pt inserted).
/
l.11 P_{\max
}=0.1
?
! Missing number, treated as zero.
\xdef
l.11 P_{\max
}=0.1
?
! Illegal unit of measure (pt inserted).
\xdef
l.11 P_{\max
}=0.1
?
! Illegal unit of measure (pt inserted).
/
l.11 P_{\max
}=0.1
?
! Missing = inserted for ifdim.
/
l.11 P_{\max
}=0.1
?
! Missing number, treated as zero.
/
l.11 P_{\max
}=0.1
?


and a stream of similar complaints all for the same single line.

• What exactly is the error? The document compiles fine for me when I run it with LuaLaTeX (or pdfLaTeX, as a matter of fact I get an error about CreationDate is not properly supported; PDF validation may fail. with XeLaTeX). The output looks OK as well (I get "máx" for \max and "0,1" for 0.1) but I assume that is intended if spanish is passed to babel. Can you please include the relevant bits of your .log file and a screenshot of the output (if appropriate). – moewe May 24 at 15:25
• Thanks for the .log. The only relevant difference I could spot on first glance is that my pdfx package is older than yours. I'll investigate ... edit: Yup. Updated pdfx (which wasn't up to date for some reason) and I can now reproduce the error. – moewe May 24 at 15:35
• At least my incompetence in keeping my packages up to date strongly suggests that pdfx is the culprit. I had pdfx v1.6.1 and things worked, after an update to v1.6.3 things don't work any more. So it probably broke in between those two versions. – moewe May 24 at 15:42
• pdfx added some code to change mathaccents and this breaks with spanish. You could add \unaccentedoperators as a workaround. – Ulrike Fischer May 24 at 16:22
• @JavierBezos pdfx has added a \pdfx@mathaccentV and then redefines mathaccentV. – Ulrike Fischer May 24 at 16:23

It's a bug in spanish, which has popped up after a change in pdfx. As a workaround, after loading babel, write:

\makeatletter
\def\es@fetchenc{%
\begingroup
\count@\escapechar \escapechar=\m@ne
\edef\es@a{\expandafter\string\the\textfont\mathgroup}%
\expandafter\split@name\es@a////\@nil
\escapechar=\count@
\@expandtwoargs\in@{////}{\f@size}%
\ifin@\else
\PackageError{spanish}{%
Non-NFSS font name. The current math font (\es@a)\MessageBreak
doesn't follow the NFSS conventions. I'll use the\MessageBreak
default \string\i\space for \string\dotlessi,
but expect a wrong output.}%
{Find where this font has been (re)defined, and fix it.}%
\def\f@encoding{OT1}%
\fi
\bbl@exp{\endgroup\def\\\f@encoding{\f@encoding}}}
\makeatother

• The workaround resolves the problem. I'm going to accept the solution and I'm going to vote up – jpayansomet May 24 at 17:33