## LaTeX forum ⇒ Document Classes ⇒ xcolor package and beamer

Information and discussion about specific document classes and how to create your own document classes.
m.carrara3
Posts: 21
Joined: Mon Sep 08, 2008 7:13 pm

### xcolor package and beamer

I have a problem; I'm using beamer class for my thesis presentation and I need to change the font's color into a tabular enviroment but it doesn't work.
After \begin{document} I'm using this package
\usepackage[dvipsnames]{xcolor}

I also post the code I'm using into the document:
\resizebox{\textwidth}{!}{\begin{tabular}{|l|c|}\hline			\textbf{{\textcolor{red}{Mg}}} & {\textcolor{red}{59.20 $\%$}} \\			\hline			\textbf{Al micrometrico} & 36.20 $\%$ \\			\hline			\textbf{{\textcolor{ForestGreen}{Al nanometrico}}} & {\textcolor{ForestGreen}{23.04 $\%$}} \\			\hline			\textbf{$MgH_2$} & 33.65 $\%$ \\			\hline			\textbf{Al nano + $MgH_2$} & 37.15 $\%$ \\\hline\end{tabular}}

Any suggestion?

M

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
I assume that you are compiling with pdflatex hence you are loading the xcolor package with the wrong option.
\usepackage[svgnames]{xcolor}

This line has to be inserted in the preamble, not in the body of the document. Names of colors stay the same.

Best regards
Thorsten¹
LaTeX Community Moderator

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

m.carrara3
Posts: 21
Joined: Mon Sep 08, 2008 7:13 pm
I've already put \usepackage command in the preable;
now I changed the option with the one you gave to me but it still doesn't work out...

Error message says to me:
Package xcolor Error: Undefined color ForestGreen...

Even if I put the right option class for ForestGreen color; I looked also to xcolor guide but it doesn't seem to solve my problem at all...

I tried also to use xcolor command outside tabular but I got the same error...

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
The main fault is to load the xcolor package again because it is already loaded by the beamer class. This is expressed by an error message (which you should get, too).
! LaTeX Error: Option clash for package xcolor. See the LaTeX manual or LaTeX Companion for explanation.Type  H <return>  for immediate help.

To avoid this, put the option svgnames into the option list for the document class. It will be passed to xcolor.
\documentclass[svgnames,smaller]{beamer}

Delete the line which loads the package and it will work fine.
LaTeX Community Moderator

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

m.carrara3
Posts: 21
Joined: Mon Sep 08, 2008 7:13 pm
Cool!!!! It works perfectly!!! Thanks!!!!

dejan85
Posts: 8
Joined: Sat Nov 08, 2008 3:14 pm
I have the similar problem. I follow instruction from site http://faculty.csuci.edu/jorge.garcia/tex/beamer.htm to install beamer, a test beamer with their template.txt from site. I got the same error
"! LaTeX Error: Option clash for package xcolor..."
.
template.txt :
\documentclass[t]{beamer}\input mybeamersettings

First line I changed to "\documentclass[svgnames,smaller]{beamer}" but I got the same error.
I download some presentation with first lines
\documentclass[10pt]{beamer}\mode<presentation> {   \usetheme{Warsaw}   \setbeamercovered{transparent}}

and the same error appears.
I can't make pdflatex with any correct .tex fail.
Please, can you tell me what may be a problem. I need to fix this very soon for my thesis presentation.

Stefan Kottwitz
Posts: 8262
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Hi,

dejan85 wrote:First line I changed to "\documentclass[svgnames,smaller]{beamer}" but I got the same error.

Further you have to remove the line
\usepackage[...]{xcolor}

in your preamble or mybeamersettings.tex.

If this doesn't help please post a small code example containing enough information.

Stefan

dejan85
Posts: 8
Joined: Sat Nov 08, 2008 3:14 pm
I want to remove this line, but it doesn't exist, neither in my tex file, nor in the mybeamersettings.tex. In mybeamersettings there are only two lines with usepackage:
\usepackage[english]{babel}\usepackage{listings,amsmath,multimedia}

I didn't make the presentation, I'd downloaded the example from http://faculty.csuci.edu/jorge.garcia/tex/beamer.htm. It should be working. You can look at the example. There is no "\usepackage[...]{xcolor}" line.

Stefan Kottwitz
Posts: 8262
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
The error message shows that the xcolor package was loaded more than once. Have a look at "Option clash for package" in the UK TeX FAQ for more information.
That example worked for me. For further investigation you could post your .log file as attachment here, perhaps we would find the cause there.

Stefan

dejan85
Posts: 8
Joined: Sat Nov 08, 2008 3:14 pm
I look at my.log file and I find lines that contains xcolor
C:\texmf\tex\latex\xcolor\xcolor.sty...C:\texmf\tex\latex\pgf\xxcolor.sty

After second line there is Option clash... Probably, latex load xcolor package more than once automatically, so I really don't know how to solve problem. I upload my .log file.
Attachments
template.log
my log file