Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using beamer for writing my presentation. I was initially using latex+dvipdf, then with the help of other tex.exchange users I recognized that I cannot use transparency in this way. So now I am switching to pdflatex.

Because I use personalized colors and didn't want to use RGB names, I was using names from dvipsnames, but now I have to switch to svgnames, and the color names are of course different. I would like to use a variable that stores the color name, so that I can choose a color to be defined either in svgnames or in dvipsnames, depending if I am using pdflatex or not.

I tried this

\ifpdf color1=cyan
\else color1=PineGreen \fi

but it doesn't work, what should I do?

share|improve this question
2  
Since beamer uses xcolor, I suppose that \colorlet{color1}{cyan} should work. –  egreg Oct 8 '12 at 14:03
    
It isn't clear to me why you can't use dvipsnames with pdflatex. Do you have a MWE (ie small complete document that shows the problem) –  David Carlisle Oct 8 '12 at 14:15
    
@David Carlisle you are right, it works. I must have been mistaken earlier. I suppose I should delete this question? On the other side the question still makes sense, regardless if dvipsnames work or not with pdflatex –  simona Oct 8 '12 at 14:47
add comment

1 Answer

up vote 4 down vote accepted

You can load the dvipsnames option:

\documentclass[xcolor=dvipsnames]{beamer}

Since beamer already loads xcolor with the svgnames option, you can't say \usepackage[dvipsnames]{xcolor} (or color); in order to overcome this limitation, one can specify that option to the class.

If you still want to use different colors based on the compiler, then

\usepackage{ifpdf}
\ifpdf
  \colorlet{color1}{cyan}
\else
  \colorlet{color1}{PineGreen}
\fi

will work.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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