LaTeX forum ⇒ Graphics, Figures & TablesOption Clash for Package

Information and discussion about graphics, figures & tables in LaTeX documents.
Curious George
Posts: 9
Joined: Wed Apr 04, 2012 6:33 pm

Option Clash for Package

Postby Curious George » Fri Apr 19, 2013 1:52 am

Trying to use the x11names option for xcolor in a beamer presentation, getting an "option clash" error. Example below. What is going on?

Danke/gracias/merci/thanks for your help.

This is the code.
  1. \documentclass{beamer}
  2. \usepackage[x11names]{xcolor}
  3. \begin{document}
  4. begin{frame}
  5. This is a test
  6. \end{frame}
  7. \end{document}
  8.  


The following error occurs.
  1. This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2012.10.18) 18 APR 2013 17:35
  2.  
  3. ...
  4.  
  5. ! LaTeX Error: Option clash for package xcolor.
  6.  
  7. See the LaTeX manual or LaTeX Companion for explanation.
  8. Type H <return> for immediate help.
  9. ...
  10.  
  11. l.3 \begin
  12. {document}

Tags:

User avatar
tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

Postby tom » Fri Apr 19, 2013 6:17 am

Hi!

Because beamer loads xcolor, you have to use a trick to pass the option to the package.

  1. \PassOptionsToPackage{x11names}{xcolor}
  2. \documentclass{beamer}
  3. \begin{document}
  4. \begin{frame}{Title}
  5. This is an x11 color: \fcolorbox{black}{SlateGray1}{test}.
  6. \end{frame}
  7. \end{document}

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Fri Apr 19, 2013 9:16 am

According to Section 2.6 of the beamer user guide Tom's approach can be simplified a bit.
  1. \documentclass[xcolor=x11names]{beamer}
  2. \usepackage[T1]{fontenc}
  3.  
  4. \begin{document}
  5.  
  6. \begin{frame}{Title}
  7. This is an x11 color: \fcolorbox{black}{SlateGray1}{test}.
  8. \end{frame}
  9.  
  10. \end{document}

More than one single option for xcolor would require additional braces for grouping.
  1. \documentclass[xcolor={dvipsnames,x11names}]{beamer}



Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 9 guests