Graphics, Figures & TablesOption Clash for Package

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

Option Clash for Package

Post by Curious George »

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.

Code: Select all

\documentclass{beamer}
\usepackage[x11names]{xcolor}
\begin{document}
begin{frame}
This is a test
\end{frame}
\end{document}

The following error occurs.

Code: Select all

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian) (format=pdflatex 2012.10.18)  18 APR 2013 17:35

...

! LaTeX Error: Option clash for package xcolor.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.3 \begin
          {document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

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

Option Clash for Package

Post by tom »

Hi!

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

Code: Select all

\PassOptionsToPackage{x11names}{xcolor}
\documentclass{beamer}
\begin{document}
\begin{frame}{Title}
  This is an x11 color: \fcolorbox{black}{SlateGray1}{test}.
\end{frame}
\end{document}
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Option Clash for Package

Post by localghost »

According to Section 2.6 of the beamer user guide Tom's approach can be simplified a bit.

Code: Select all

\documentclass[xcolor=x11names]{beamer}
\usepackage[T1]{fontenc}

\begin{document}

\begin{frame}{Title}
  This is an x11 color: \fcolorbox{black}{SlateGray1}{test}.
\end{frame}

\end{document}
More than one single option for xcolor would require additional braces for grouping.

Code: Select all

\documentclass[xcolor={dvipsnames,x11names}]{beamer}

Thorsten
Post Reply