LuaLaTeX: option clash for package graphicx when loaded after fontspec

Package fontspec loads fontspec-luatex.sty, if used with LuaTeX. Then package xunicode is loaded that loads package graphicx without options.

The LaTeX reaches \usepackage[draft]{graphicx}. The package is already loaded. Therefore, LaTeX only checks the options. If there is any new option (here: draft) it throws the error message.

Solutions:

  • Load package graphicx with all needed options before \usepackage{fontspec} as in the question.

  • \PassOptionsToPackage{draft}{graphicx} before \usepackage{fontspec}.


If you load fontspec with the tuenc option (which should become the default in the near future), there is no problem:

\RequirePackage{luatex85}
\documentclass{article}

\usepackage[tuenc]{fontspec}
\usepackage[draft]{graphicx}

\begin{document}
    Text
\end{document}

Otherwise, load graphicx (with options) before fontspec.