I don't know if it is stated in any documentation somewhere, but I can't figure out why I can't compile this MWE when \usepackage[draft]{graphicx}
is loaded after \usepackage{fontspec}
\RequirePackage{luatex85}
\documentclass{article}
\usepackage{fontspec}
\usepackage[draft]{graphicx}
\begin{document}
Text
\end{document}
with error
Option clash for package graphicx
However, loading \usepackage[draft]{graphicx}
before \usepackage{fontspec}
makes the compilation go smooth as in
\RequirePackage{luatex85}
\documentclass{article}
\usepackage[draft]{graphicx}
\usepackage{fontspec}
\begin{document}
Text
\end{document}
Best Answer
Package
fontspec
loadsfontspec-luatex.sty
, if used with LuaTeX. Then packagexunicode
is loaded that loads packagegraphicx
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}
.