2

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}
  • I've removed the tikz-pgf tag, since this is not related to the problem – user31729 Apr 22 '16 at 11:46
3

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}
2

You can use demo as an option to article class. Since mdframed loads graphicx you don't need to load graphicx (and that's the cause of the clash initially)

In any case, the demo option must be known to mdframed before it loads graphicx with other (conflicting) options.

This is a general rule, not restricted to graphicx etc.

Another example could be the options of xcolor, also causing trouble sometimes!

\documentclass[demo]{article}

\usepackage[framemethod=tikz]{mdframed} % only 1 of them can be loaded
%\usepackage{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.}

\includegraphics{ente}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.