LaTeX forum ⇒ Document Classesxcolor 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

Postby m.carrara3 » Sat Sep 13, 2008 6:17 pm

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
  1. \usepackage[dvipsnames]{xcolor}

I also post the code I'm using into the document:
  1. \resizebox{\textwidth}{!}{
  2. \begin{tabular}{|l|c|}
  3. \hline
  4. \textbf{{\textcolor{red}{Mg}}} & {\textcolor{red}{59.20 $\%$}} \\
  5. \hline
  6. \textbf{Al micrometrico} & 36.20 $\%$ \\
  7. \hline
  8. \textbf{{\textcolor{ForestGreen}{Al nanometrico}}} & {\textcolor{ForestGreen}{23.04 $\%$}} \\
  9. \hline
  10. \textbf{$MgH_2$} & 33.65 $\%$ \\
  11. \hline
  12. \textbf{Al nano + $MgH_2$} & 37.15 $\%$ \\
  13. \hline
  14. \end{tabular}}


Any suggestion?

M

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Sat Sep 13, 2008 6:27 pm

I assume that you are compiling with pdflatex hence you are loading the xcolor package with the wrong option.
  1. \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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

m.carrara3
Posts: 21
Joined: Mon Sep 08, 2008 7:13 pm

Postby m.carrara3 » Sat Sep 13, 2008 6:40 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...

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Sat Sep 13, 2008 6:52 pm

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).
  1. ! LaTeX Error: Option clash for package xcolor.
  2.  
  3. See the LaTeX manual or LaTeX Companion for explanation.
  4. 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.
  1. \documentclass[svgnames,smaller]{beamer}

Delete the line which loads the package and it will work fine.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 13.1 (Linux 3.11.10), TeX Live 2013 (vanilla), TeXworks 0.5 (r1351)
² Posting stopped indefinitely due to offenses

Link:
BBcode:
HTML:
Hide post links
Show post links

m.carrara3
Posts: 21
Joined: Mon Sep 08, 2008 7:13 pm

Postby m.carrara3 » Sat Sep 13, 2008 6:57 pm

Cool!!!! It works perfectly!!! Thanks!!!!

Link:
BBcode:
HTML:
Hide post links
Show post links

dejan85
Posts: 8
Joined: Sat Nov 08, 2008 3:14 pm

Postby dejan85 » Sat Nov 08, 2008 3:41 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
  1. "! LaTeX Error: Option clash for package xcolor..."
.
template.txt :
  1. \documentclass[t]{beamer}
  2. \input mybeamersettings

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

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.

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7804
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sat Nov 08, 2008 6:39 pm

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
  1. \usepackage[...]{xcolor}

in your preamble or mybeamersettings.tex.

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

Stefan
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

dejan85
Posts: 8
Joined: Sat Nov 08, 2008 3:14 pm

Postby dejan85 » Sat Nov 08, 2008 11:16 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:
  1. \usepackage[english]{babel}
  2. \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.

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7804
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Nov 09, 2008 12:13 am

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
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links

dejan85
Posts: 8
Joined: Sat Nov 08, 2008 3:14 pm

Postby dejan85 » Sun Nov 09, 2008 1:31 pm

I look at my.log file and I find lines that contains xcolor
  1. C:\texmf\tex\latex\xcolor\xcolor.sty
  2. ...
  3. 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
(9.52 KiB) Downloaded 138 times

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 2 guests