[Tex/LaTex] Option clash for [framemethod=tikz]{mdframed} & [draft]{graphicx} | same clash for [demo]{graphicx}

graphicsmdframedoption-clash

The following combination of options and packages gives an Option clash, and thus prohibits anybody from compiling the code:

  • \usepackage[framemethod=tikz]{mdframed}
  • \usepackage[demo]{graphicx} (or \usepackage[draft]{graphicx})

Who knows how to ommit the Option clash, but still keep using both lines of code in the same document?

MnotWE

\documentclass{article}

\usepackage[framemethod=tikz]{mdframed} % only 1 of them can be loaded
\usepackage[demo]{graphicx} % only 1 of them can be loaded (regardless of whether you use the "demo" or "draft" optional argument)

\begin{document}

If you try to include both of the lines (the ones commented above), the error is: \textbf{LaTeX Error Option clash for package graphicx.}

\end{document}

Best Answer

Move the call to graphicx before mdframed:

\documentclass{article}
\usepackage[demo]{graphicx} 
\usepackage[framemethod=tikz]{mdframed} % 


\begin{document}

\includegraphics{blub}

\end{document}

Or pass the option:

\documentclass{article}

\PassOptionsToPackage{demo}{graphicx}
\usepackage[framemethod=tikz]{mdframed} % 

\begin{document}

\includegraphics{blub}

\end{document}

Or use the documentclass option:

\documentclass[demo]{article}

\usepackage[framemethod=tikz]{mdframed} % 


\begin{document}

\includegraphics{blub}

\end{document}