# xelatex and nag problem

Somet time ago xelatex stopped to compile my document.

LaTeX Warning: You have requested package xpatch, but the package provides xparse.

Package: xparse 2016/03/28 v6468 L3 Experimental document command parser (c:/texlive/2015/texmf-dist/tex/latex/etoolbox/etoolbox.sty ! Missing $inserted.$ l.12

I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.

Overfull \hbox (43.7436pt too wide) in paragraph at lines 27--12 []\EU1/lmr/m/n/10 Id: xpatch.dtx 0.3 2012-10-02 12:00:00Z Enrico $[]$ []

Package: etoolbox 2015/08/02 v2.2a e-TeX tools for LaTeX (JAW) \etb@tempcnta=\count134 ) ! TeX capacity exceeded, sorry [input stack size=5000]. \etoolbox.sty-h@@k ->\etoolbox.sty-h@@k \etb@catcodes \undef \etb@catcodes l.43 \cs_generate_variant:Nn \tl_if_in:NnT { Nx } If you really absolutely need more capacity, you can ask a wizard to enlarge me.

after deleting line by line I gain following MWE:

\RequirePackage[l2tabu]{nag}
\documentclass{book}

\usepackage{fontspec}
\usepackage{imakeidx}

\begin{document}

\end{document}


It seems like nag+fontspec+imakeidx conflict? If I comment any of those lines (RequirePackage[l2tabu]{nag}, usepackage{fontspec} or usepackage{imakeidx}) or even l2tabu parameter it works.

• A nice and really minimal MWE! – Mico Apr 18 '16 at 10:48

Since xpatch is loaded by imakeidx at begin document, every sort of evil will happen if nag is loaded.

I don't think I'll add patches for supporting nag (a package I don't recommend). Note that similar issues can arise whenever a package is loaded at begin document, when nag is loaded.

You can work around the issue by explicitly loading xpatch before imakeidx.

\RequirePackage[l2tabu]{nag}
\documentclass{book}

\usepackage{fontspec}
\usepackage{xpatch}
\usepackage{imakeidx}

\begin{document}

\end{document}

• On one hand, I wonder if I should alter our loader to set the catcode of \$, but on the other I'm not really a fan of \GetIdInfo so ... – Joseph Wright Apr 18 '16 at 10:53
• @JosephWright I think I'll remove \GetIdInfo in future versions. This should solve this issue, but I still see no point in using nag. One doesn't call “duck” a “sheep”, when knowing the correct name; in my opinion, nag is just about “don't call sheep a duck”. – egreg Apr 18 '16 at 10:58